diff options
author | Craig Andrews <candrews@integralblue.com> | 2009-10-27 22:45:00 -0400 |
---|---|---|
committer | Craig Andrews <candrews@integralblue.com> | 2009-10-27 22:45:00 -0400 |
commit | 5f42023f97fca2c3b5fbd0da2d5e333e4cc2f109 (patch) | |
tree | 64472db06060e0c83192cdc1ba30ab7c0253e1f4 /lib/command.php | |
parent | da16dc05a81e2fcc1ed89fe16717f2652265f23a (diff) |
implement the nudge command
Diffstat (limited to 'lib/command.php')
-rw-r--r-- | lib/command.php | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/command.php b/lib/command.php index d7ae11361..9efa40696 100644 --- a/lib/command.php +++ b/lib/command.php @@ -73,7 +73,7 @@ class UntrackCommand extends UnimplementedCommand } } -class NudgeCommand extends UnimplementedCommand +class NudgeCommand extends Command { var $other = null; function __construct($user, $other) @@ -81,6 +81,26 @@ class NudgeCommand extends UnimplementedCommand parent::__construct($user); $this->other = $other; } + function execute($channel) + { + $recipient = User::staticGet('nickname', $this->other); + if(! $recipient){ + $channel->error($this->user, sprintf(_('Could not find a user with nickname %s'), + $this->other)); + }else{ + if ($recipient->id == $this->user->id) { + $channel->error($this->user, _('It does not make a lot of sense to nudge yourself!')); + }else{ + if ($recipient->email && $recipient->emailnotifynudge) { + mail_notify_nudge($this->user, $recipient); + } + // XXX: notify by IM + // XXX: notify by SMS + $channel->output($this->user, sprintf(_('Nudge sent to %s'), + $recipient->nickname)); + } + } + } } class InviteCommand extends UnimplementedCommand @@ -587,7 +607,7 @@ class HelpCommand extends Command "last <nickname> - same as 'get'\n". "on <nickname> - not yet implemented.\n". "off <nickname> - not yet implemented.\n". - "nudge <nickname> - not yet implemented.\n". + "nudge <nickname> - remind a user to update.\n". "invite <phone number> - not yet implemented.\n". "track <word> - not yet implemented.\n". "untrack <word> - not yet implemented.\n". |