summaryrefslogtreecommitdiff
path: root/lib/command.php
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2009-10-27 21:48:56 -0400
committerCraig Andrews <candrews@integralblue.com>2009-10-27 21:48:56 -0400
commit922ee7b3b292689806b0b94a9eb94fe08a204751 (patch)
treec7e0e00cabe49b9a3690a9ebee6e50145261ad09 /lib/command.php
parenta1798039b23ed5d4b92458478bd76c7055d601e2 (diff)
Implemented reply # command, allowing users to favorite specific notices by the notice id
Diffstat (limited to 'lib/command.php')
-rw-r--r--lib/command.php33
1 files changed, 23 insertions, 10 deletions
diff --git a/lib/command.php b/lib/command.php
index 11d40b8e1..6ece01b96 100644
--- a/lib/command.php
+++ b/lib/command.php
@@ -124,18 +124,30 @@ class FavCommand extends Command
function execute($channel)
{
+ if(substr($this->other,0,1)=='#'){
+ //replying to a specific notice_id
- $recipient =
- common_relative_profile($this->user, common_canonical_nickname($this->other));
+ $notice = Notice::staticGet(substr($this->other,1));
+ if (!$notice) {
+ $channel->error($this->user, _('Notice with that id does not exist'));
+ return;
+ }
+ $recipient = $notice->getProfile();
+ }else{
+ //replying to a given user's last notice
- if (!$recipient) {
- $channel->error($this->user, _('No such user.'));
- return;
- }
- $notice = $recipient->getCurrentNotice();
- if (!$notice) {
- $channel->error($this->user, _('User has no last notice'));
- return;
+ $recipient =
+ common_relative_profile($this->user, common_canonical_nickname($this->other));
+
+ if (!$recipient) {
+ $channel->error($this->user, _('No such user.'));
+ return;
+ }
+ $notice = $recipient->getCurrentNotice();
+ if (!$notice) {
+ $channel->error($this->user, _('User has no last notice'));
+ return;
+ }
}
$fave = Fave::addNew($this->user, $notice);
@@ -497,6 +509,7 @@ class HelpCommand extends Command
"get <nickname> - get last notice from user\n".
"whois <nickname> - get profile info on user\n".
"fav <nickname> - add user's last notice as a 'fave'\n".
+ "fav #<notice_id> - add notice with the given id as a 'fave'\n".
"join <group> - join group\n".
"drop <group> - leave group\n".
"stats - get your stats\n".