summaryrefslogtreecommitdiff
path: root/lib/command.php
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2010-02-24 20:52:45 -0500
committerCraig Andrews <candrews@integralblue.com>2010-02-24 20:52:45 -0500
commitc187bf55974347f7ddb4f28714af57861dce8f08 (patch)
tree4398b456d88ce79977959b25ba1a0f6fe0c1d77f /lib/command.php
parent20d6a7caed6636c28cc7b95c584549691dff4388 (diff)
parent8914b69d5055c1bc7d0604ee338ffdaf6b0a8606 (diff)
Merge branch '0.9.x' into 1.0.x
Conflicts: EVENTS.txt db/statusnet.sql lib/queuemanager.php
Diffstat (limited to 'lib/command.php')
-rw-r--r--lib/command.php58
1 files changed, 50 insertions, 8 deletions
diff --git a/lib/command.php b/lib/command.php
index 44b7b2274..5be9cd6e8 100644
--- a/lib/command.php
+++ b/lib/command.php
@@ -548,12 +548,19 @@ class SubCommand extends Command
return;
}
- $result = subs_subscribe_user($this->user, $this->other);
+ $otherUser = User::staticGet('nickname', $this->other);
- if ($result == 'true') {
+ if (empty($otherUser)) {
+ $channel->error($this->user, _('No such user'));
+ return;
+ }
+
+ 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());
}
}
}
@@ -576,12 +583,18 @@ class UnsubCommand extends Command
return;
}
- $result=subs_unsubscribe_user($this->user, $this->other);
+ $otherUser = User::staticGet('nickname', $this->other);
- if ($result) {
+ if (empty($otherUser)) {
+ $channel->error($this->user, _('No such user'));
+ }
+
+ 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());
}
}
}
@@ -655,6 +668,34 @@ class LoginCommand extends Command
}
}
+class LoseCommand extends Command
+{
+
+ var $other = null;
+
+ function __construct($user, $other)
+ {
+ parent::__construct($user);
+ $this->other = $other;
+ }
+
+ function execute($channel)
+ {
+ if(!$this->other) {
+ $channel->error($this->user, _('Specify the name of the user to unsubscribe from'));
+ return;
+ }
+
+ $result=subs_unsubscribe_from($this->user, $this->other);
+
+ if ($result) {
+ $channel->output($this->user, sprintf(_('Unsubscribed %s'), $this->other));
+ } else {
+ $channel->error($this->user, $result);
+ }
+ }
+}
+
class SubscriptionsCommand extends Command
{
function execute($channel)
@@ -737,6 +778,7 @@ class HelpCommand extends Command
"d <nickname> <text> - direct message to user\n".
"get <nickname> - get last notice from user\n".
"whois <nickname> - get profile info on user\n".
+ "lose <nickname> - force user to stop following you\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".
"repeat #<notice_id> - repeat a notice with a given id\n".