}
}
-class FaveCommand extends Command {
+class FavCommand extends Command {
var $other = NULL;
return;
}
- mail_notify_fave($recipient, $this->user, $notice);
+ $other = User::staticGet('id', $recipient->id);
+
+ if ($other && $other->id != $user->id) {
+ if ($other->email && $other->emailnotifyfav) {
+ mail_notify_fave($other, $this->user, $notice);
+ }
+ }
+
$this->user->blowFavesCache();
- $channel->output($this->user, _('Message marked as fave.'));
+ $channel->output($this->user, _('Notice marked as fave.'));
}
}
function __construct($user, $other, $text) {
parent::__construct($user);
$this->other = $other;
- $this->text = $other;
+ $this->text = $text;
}
function execute($channel) {
$channel->error($this->user, _('No content!'));
return;
} else if ($len > 140) {
- $channel->error($this->user,sprintf(_('Message too long - maximum is 140 characters, you sent %d'), $len));
- return;
- } else if (!$other) {
+ $content = common_shorten_links($content);
+ if (mb_strlen($content) > 140) {
+ $channel->error($this->user, sprintf(_('Message too long - maximum is 140 characters, you sent %d'), $len));
+ return;
+ }
+ }
+
+ if (!$other) {
$channel->error($this->user, _('No such user.'));
return;
- } else if (!$user->mutuallySubscribed($other)) {
+ } else if (!$this->user->mutuallySubscribed($other)) {
$channel->error($this->user, _('You can\'t send a message to this user.'));
return;
- } else if ($user->id == $other->id) {
+ } else if ($this->user->id == $other->id) {
$channel->error($this->user, _('Don\'t send a message to yourself; just say it to yourself quietly instead.'));
return;
}
- $message = Message::saveNew($user->id, $other->id, $body, 'xmpp');
+ $message = Message::saveNew($this->user->id, $other->id, $this->text, $channel->source());
if ($message) {
$channel->output($this->user, sprintf(_('Direct message to %s sent'), $this->other));
} else {
}
function execute($channel) {
- $target =
- common_relative_profile($this->user, common_canonical_nickname($this->other));
+ $target_nickname = common_canonical_nickname($this->other);
+
+ $target =
+ common_relative_profile($this->user, $target_nickname);
if (!$target) {
$channel->error($this->user, _('No such user.'));
return;
}
$notice_content = $notice->content;
+
$channel->output($this->user, $target_nickname . ": " . $notice_content);
}
}
return;
}
- $result = subs_subscribe_user($user, $this->other);
+ $result = subs_subscribe_user($this->user, $this->other);
if ($result == 'true') {
$channel->output($this->user, sprintf(_('Subscribed to %s'), $this->other));
return;
}
- $result=subs_unsubscribe_user($user, $this->other);
+ $result=subs_unsubscribe_user($this->user, $this->other);
if ($result) {
$channel->output($this->user, sprintf(_('Unsubscribed from %s'), $this->other));
$channel->error($this->user, _("Command not yet implemented."));
} else {
if ($channel->off($this->user)) {
- $channel->output(_('Notification off.'));
+ $channel->output($this->user, _('Notification off.'));
} else {
- $channel->error(_('Can\'t turn off notification.'));
+ $channel->error($this->user, _('Can\'t turn off notification.'));
}
}
}
$channel->error($this->user, _("Command not yet implemented."));
} else {
if ($channel->on($this->user)) {
- $channel->output(_('Notification on.'));
+ $channel->output($this->user, _('Notification on.'));
} else {
- $channel->error(_('Can\'t turn on notification.'));
+ $channel->error($this->user, _('Can\'t turn on notification.'));
}
}
}