]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/command.php
Type testing instead of just empty() in OStatusPlugin
[quix0rs-gnu-social.git] / lib / command.php
index 6d0d7194f3953b6b9f54234ac9b295299457df0f..bc0dd894de6d7f396dac1d17eb7d7786ca2459b0 100644 (file)
@@ -586,7 +586,7 @@ class MessageCommand extends Command
     function handle($channel)
     {
         try {
-            $other = $this->getUser($this->other);
+            $other = $this->getUser($this->other)->getProfile();
         } catch (CommandException $e) {
             try {
                 $profile = $this->getProfile($this->other);
@@ -619,7 +619,7 @@ class MessageCommand extends Command
             return;
         }
 
-        if (!$other) {
+        if (!$other instanceof Profile) {
             // TRANS: Error text shown when trying to send a direct message to a user that does not exist.
             $channel->error($this->user, _('No such user.'));
             return;
@@ -770,12 +770,6 @@ class SubCommand extends Command
 
         $target = $this->getProfile($this->other);
 
-        $remote = Remote_profile::getKV('id', $target->id);
-        if ($remote) {
-            // TRANS: Command exception text shown when trying to subscribe to an OMB profile using the subscribe command.
-            throw new CommandException(_("Can't subscribe to OMB profiles by command."));
-        }
-
         try {
             Subscription::start($this->user->getProfile(), $target);
             // TRANS: Text shown after having subscribed to another user successfully.
@@ -986,7 +980,7 @@ class GroupsCommand extends Command
     {
         $group = $this->user->getGroups();
         $groups=array();
-        while ($group->fetch()) {
+        while ($group instanceof User_group && $group->fetch()) {
             $groups[]=$group->nickname;
         }
         if(count($groups)==0){