Added a "groups" command

This commit is contained in:
Craig Andrews 2009-11-16 11:23:00 -05:00
parent 7177585630
commit 0e7dd81a6c
2 changed files with 26 additions and 0 deletions

View File

@ -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 <nickname> - 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 <nickname> - unsubscribe from user\n".

View File

@ -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);