X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=classes%2FCommand.php;h=c2409d140a2ac152c86ca780ffe36d288833bf42;hb=cad6f78fe66e73665fe736cfe78d6633e1120ea7;hp=dbfe3b7be6839d4906632e70db5644f206d30c9d;hpb=adc08e9df57461f2fc36d08cd3b92b6867895eed;p=quix0rs-gnu-social.git diff --git a/classes/Command.php b/classes/Command.php index dbfe3b7be6..c2409d140a 100644 --- a/classes/Command.php +++ b/classes/Command.php @@ -102,7 +102,7 @@ class StatsCommand extends Command { } } -class FaveCommand extends Command { +class FavCommand extends Command { var $other = NULL; @@ -133,7 +133,14 @@ class FaveCommand extends Command { 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, _('Notice marked as fave.')); @@ -190,9 +197,14 @@ class MessageCommand extends Command { $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 (!$this->user->mutuallySubscribed($other)) { @@ -221,8 +233,10 @@ class GetCommand extends Command { } 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.')); @@ -234,6 +248,7 @@ class GetCommand extends Command { return; } $notice_content = $notice->content; + $channel->output($this->user, $target_nickname . ": " . $notice_content); } } @@ -300,9 +315,9 @@ class OffCommand extends Command { $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.')); } } } @@ -320,9 +335,9 @@ class OnCommand extends Command { $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.')); } } }