]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Realtime/RealtimePlugin.php
plugins onAutoload now only overloads if necessary (extlibs etc.)
[quix0rs-gnu-social.git] / plugins / Realtime / RealtimePlugin.php
index 287e48e48475e4cb267a3ed2ec97c8754ce30ecf..42a254ab0c844b51d15d0187e8a635bd002d8698 100644 (file)
@@ -66,24 +66,6 @@ class RealtimePlugin extends Plugin
         return true;
     }
 
-    function onAutoload($cls)
-    {
-        $dir = dirname(__FILE__);
-
-        switch ($cls)
-        {
-        case 'KeepalivechannelAction':
-        case 'ClosechannelAction':
-            include_once $dir . '/' . strtolower(mb_substr($cls, 0, -6)) . '.php';
-            return false;
-        case 'Realtime_channel':
-            include_once $dir.'/'.$cls.'.php';
-            return false;
-        default:
-            return true;
-        }
-    }
-
     /**
      * Hook for RouterInitialized event.
      *
@@ -179,7 +161,7 @@ class RealtimePlugin extends Plugin
             return true;
         }
 
-        $user = User::staticGet('id', $notice->profile_id);
+        $user = User::getKV('id', $notice->profile_id);
 
         if (!empty($user)) {
             $paths[] = array('showstream', $user->nickname, null);
@@ -208,7 +190,7 @@ class RealtimePlugin extends Plugin
         $ni = $notice->whoGets();
 
         foreach (array_keys($ni) as $user_id) {
-            $user = User::staticGet('id', $user_id);
+            $user = User::getKV('id', $user_id);
             $paths[] = array('all', $user->nickname, null);
         }
 
@@ -219,7 +201,7 @@ class RealtimePlugin extends Plugin
 
         if ($reply->find()) {
             while ($reply->fetch()) {
-                $user = User::staticGet('id', $reply->profile_id);
+                $user = User::getKV('id', $reply->profile_id);
                 if (!empty($user)) {
                     $paths[] = array('replies', $user->nickname, null);
                 }
@@ -234,7 +216,7 @@ class RealtimePlugin extends Plugin
 
         if ($gi->find()) {
             while ($gi->fetch()) {
-                $ug = User_group::staticGet('id', $gi->group_id);
+                $ug = User_group::getKV('id', $gi->group_id);
                 $paths[] = array('showgroup', $ug->nickname, null);
             }
         }
@@ -253,6 +235,9 @@ class RealtimePlugin extends Plugin
                 list($action, $arg1, $arg2) = $path;
 
                 $channels = Realtime_channel::getAllChannels($action, $arg1, $arg2);
+                $this->log(LOG_INFO, sprintf(_("%d candidate channels for notice %d"),
+                                             count($channels), 
+                                             $notice->id));
 
                 foreach ($channels as $channel) {
 
@@ -262,9 +247,16 @@ class RealtimePlugin extends Plugin
                     if (is_null($channel->user_id)) {
                         $profile = null;
                     } else {
-                        $profile = Profile::staticGet('id', $channel->user_id);
+                        $profile = Profile::getKV('id', $channel->user_id);
                     }
                     if ($notice->inScope($profile)) {
+                        $this->log(LOG_INFO, 
+                                   sprintf(_("Delivering notice %d to channel (%s, %s, %s) for user '%s'"),
+                                           $notice->id,
+                                           $channel->action,
+                                           $channel->arg1,
+                                           $channel->arg2,
+                                           ($profile) ? ($profile->nickname) : "<public>"));
                         $timeline = $this->_pathToChannel(array($channel->channel_key));
                         $this->_publish($timeline, $json);
                     }
@@ -335,7 +327,7 @@ class RealtimePlugin extends Plugin
         // Add needed repeat data
 
         if (!empty($notice->repeat_of)) {
-            $original = Notice::staticGet('id', $notice->repeat_of);
+            $original = Notice::getKV('id', $notice->repeat_of);
             if (!empty($original)) {
                 $arr['retweeted_status']['url'] = $original->bestUrl();
                 $arr['retweeted_status']['html'] = htmlspecialchars($original->rendered);
@@ -375,7 +367,7 @@ class RealtimePlugin extends Plugin
         $convurl = null;
 
         if ($notice->hasConversation()) {
-            $conv = Conversation::staticGet(
+            $conv = Conversation::getKV(
                 'id',
                 $notice->conversation
             );