]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Added a "groups" command
authorCraig Andrews <candrews@integralblue.com>
Mon, 16 Nov 2009 16:23:00 +0000 (11:23 -0500)
committerCraig Andrews <candrews@integralblue.com>
Mon, 16 Nov 2009 16:23:00 +0000 (11:23 -0500)
lib/command.php
lib/commandinterpreter.php

index 247ea447582a0d4d35568ad5c364aa1d1d5e5a1e..0c98c94ac4ad69d722f8c45929b35e8e66ba8051 100644 (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".
index c39fafb62bdc87faad7072fdfdd420ce3cf28644..665015afccb9b9c2f9f654052dd4f380e33a7166 100644 (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);