]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - xmppdaemon.php
limit rss streams to 100 items by default
[quix0rs-gnu-social.git] / xmppdaemon.php
index 1a77c4340af1d5310be1c1eb3cf8b120805c7c2f..afe248c8e4f2fa4394cef43d3325032a0a93dd8a 100755 (executable)
@@ -88,6 +88,22 @@ class XMPPDaemon {
                }
        }
 
+       function get_user($from) {
+               $user = User::staticGet('jabber', jabber_normalize_jid($from));
+               return $user;
+       }
+
+       function get_confirmation($from) {
+               $confirm = new Confirm_address();
+               $confirm->address = $from;
+               $confirm->address_type = 'jabber';
+               if ($confirm->find(TRUE)) {
+                       return $confirm;
+               } else {
+                       return NULL;
+               }
+       }
+
        function handle_message(&$pl) {
                if ($pl['type'] != 'chat') {
                        return;
@@ -95,8 +111,10 @@ class XMPPDaemon {
                if (strlen($pl['body']) == 0) {
                        return;
                }
+
                $from = jabber_normalize_jid($pl['from']);
-               $user = User::staticGet('jabber', $from);
+               $user = $this->get_user($from);
+
                if (!$user) {
                        $this->log(LOG_WARNING, 'Message from unknown user ' . $from);
                        return;
@@ -180,8 +198,8 @@ class XMPPDaemon {
                                   'Accepted subscription from ' . $from);
                                break;
                        case 'subscribed':
-                       case 'unsubscribe':
                        case 'unsubscribed':
+                       case 'unsubscribe':
                                $this->log(LOG_INFO,
                                   'Ignoring  "' . $pl['type'] . '" from ' . $from);
                                break;