]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Add "followers" and "following" commands
authorCraig Andrews <candrews@integralblue.com>
Mon, 16 Nov 2009 05:19:47 +0000 (00:19 -0500)
committerCraig Andrews <candrews@integralblue.com>
Mon, 16 Nov 2009 05:19:47 +0000 (00:19 -0500)
lib/command.php
lib/commandinterpreter.php

index 2ec3320de88eca871052306d9228dd305431449f..c4a4f7cf4f56b901fe3e5a11be7fc9bfc8392a89 100644 (file)
@@ -605,6 +605,44 @@ class LoginCommand extends Command
     }
 }
 
+class FollowingCommand extends Command
+{
+    function execute($channel)
+    {
+        $profile = $this->user->getSubscriptions(0);
+        $nicknames=array();
+        while ($profile->fetch()) {
+            $nicknames[]=$profile->nickname;
+        }
+        if(count($nicknames)==0){
+            $out=_('You are not subscribed to anyone.');
+        }else{
+            $out=_('You are subscribed to these people: ');
+            $out.=implode(', ',$nicknames);
+        }
+        $channel->output($this->user,$out);
+    }
+}
+
+class FollowersCommand extends Command
+{
+    function execute($channel)
+    {
+        $profile = $this->user->getSubscribers();
+        $nicknames=array();
+        while ($profile->fetch()) {
+            $nicknames[]=$profile->nickname;
+        }
+        if(count($nicknames)==0){
+            $out=_('No one is subscribed to you.');
+        }else{
+            $out=_('These people are subscribed to you: ');
+            $out.=implode(', ',$nicknames);
+        }
+        $channel->output($this->user,$out);
+    }
+}
+
 class HelpCommand extends Command
 {
     function execute($channel)
@@ -615,6 +653,8 @@ class HelpCommand extends Command
                            "off - turn off notifications\n".
                            "help - show this help\n".
                            "follow <nickname> - subscribe to user\n".
+                           "following - list the people you follow\n".
+                           "followers - list the people that follow you\n".
                            "leave <nickname> - unsubscribe from user\n".
                            "d <nickname> <text> - direct message to user\n".
                            "get <nickname> - get last notice from user\n".
index d878fe26809eeb22515211a1556074fedec340f5..ecc08f1018a4a9751a1b704aa1d7838fdd7b6f57 100644 (file)
@@ -47,6 +47,18 @@ class CommandInterpreter
             } else {
                 return new LoginCommand($user);
             }
+         case 'followers':
+            if ($arg) {
+                return null;
+            } else {
+                return new FollowersCommand($user);
+            }
+         case 'following':
+            if ($arg) {
+                return null;
+            } else {
+                return new FollowingCommand($user);
+            }
          case 'on':
             if ($arg) {
                 list($other, $extra) = $this->split_arg($arg);