X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fcommand.php;h=ea7b60372d96542dd134069d7a94b67b4d40756c;hb=b0a75a2ab24673452674a8f296ca4dbb110bed6b;hp=c0a32e1b1a4cb2184434e96bc5423a57749262cd;hpb=fdb64eed2f1d24ad38fe4a6bc680e3592647c0a6;p=quix0rs-gnu-social.git diff --git a/lib/command.php b/lib/command.php index c0a32e1b1a..ea7b60372d 100644 --- a/lib/command.php +++ b/lib/command.php @@ -422,7 +422,7 @@ class RepeatCommand extends Command $repeat = $notice->repeat($this->user->id, $channel->source); if ($repeat) { - common_broadcast_notice($repeat); + $channel->output($this->user, sprintf(_('Notice from %s repeated'), $recipient->nickname)); } else { $channel->error($this->user, _('Error repeating notice.')); @@ -492,7 +492,7 @@ class ReplyCommand extends Command } else { $channel->error($this->user, _('Error saving notice.')); } - common_broadcast_notice($notice); + } } @@ -548,12 +548,19 @@ class SubCommand extends Command return; } - $result = subs_subscribe_user($this->user, $this->other); + $otherUser = User::staticGet('nickname', $this->other); + + if (empty($otherUser)) { + $channel->error($this->user, _('No such user')); + return; + } - if ($result == 'true') { + try { + Subscription::start($this->user->getProfile(), + $otherUser->getProfile()); $channel->output($this->user, sprintf(_('Subscribed to %s'), $this->other)); - } else { - $channel->error($this->user, $result); + } catch (Exception $e) { + $channel->error($this->user, $e->getMessage()); } } } @@ -576,12 +583,18 @@ class UnsubCommand extends Command return; } - $result=subs_unsubscribe_user($this->user, $this->other); + $otherUser = User::staticGet('nickname', $this->other); + + if (empty($otherUser)) { + $channel->error($this->user, _('No such user')); + } - if ($result) { + try { + Subscription::cancel($this->user->getProfile(), + $otherUser->getProfile()); $channel->output($this->user, sprintf(_('Unsubscribed from %s'), $this->other)); - } else { - $channel->error($this->user, $result); + } catch (Exception $e) { + $channel->error($this->user, $e->getMessage()); } } }