From 0e7dd81a6cf38c879f24f476411104d67b9eb177 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Mon, 16 Nov 2009 11:23:00 -0500 Subject: Added a "groups" command --- lib/command.php | 20 ++++++++++++++++++++ lib/commandinterpreter.php | 6 ++++++ 2 files changed, 26 insertions(+) (limited to 'lib') diff --git a/lib/command.php b/lib/command.php index 247ea4475..0c98c94ac 100644 --- a/lib/command.php +++ b/lib/command.php @@ -643,6 +643,25 @@ class SubscribersCommand extends Command } } +class GroupsCommand extends Command +{ + function execute($channel) + { + $group = $this->user->getGroups(); + $groups=array(); + while ($group->fetch()) { + $groups[]=$group->nickname; + } + if(count($groups)==0){ + $out=_('You are not a member of any groups.'); + }else{ + $out=_('You are a member of these groups: '); + $out.=implode(', ',$groups); + } + $channel->output($this->user,$out); + } +} + class HelpCommand extends Command { function execute($channel) @@ -653,6 +672,7 @@ class HelpCommand extends Command "off - turn off notifications\n". "help - show this help\n". "follow - subscribe to user\n". + "groups - lists the groups you have joined\n". "subscriptions - list the people you follow\n". "subscribers - list the people that follow you\n". "leave - unsubscribe from user\n". diff --git a/lib/commandinterpreter.php b/lib/commandinterpreter.php index c39fafb62..665015afc 100644 --- a/lib/commandinterpreter.php +++ b/lib/commandinterpreter.php @@ -59,6 +59,12 @@ class CommandInterpreter } else { return new SubscriptionsCommand($user); } + case 'groups': + if ($arg) { + return null; + } else { + return new GroupsCommand($user); + } case 'on': if ($arg) { list($other, $extra) = $this->split_arg($arg); -- cgit v1.2.3-54-g00ecf