$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.'));
} else {
$channel->error($this->user, _('Error saving notice.'));
}
- common_broadcast_notice($notice);
+
}
}
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());
}
}
}
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());
}
}
}