]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - xmppdaemon.php
enable confirmation queue
[quix0rs-gnu-social.git] / xmppdaemon.php
index 772e99d3dddbfd3802e0dc94a069fdb966d896fb..e5c5c20afb5af87a1e2021cf7cd4d26e7df08783 100755 (executable)
@@ -54,6 +54,7 @@ class XMPPDaemon {
        }
 
        function connect() {
+
                $connect_to = ($this->host) ? $this->host : $this->server;
 
                $this->log(LOG_INFO, "Connecting to $connect_to on port $this->port");
@@ -63,6 +64,7 @@ class XMPPDaemon {
                if (!$this->conn) {
                        return false;
                }
+           
                return !$this->conn->isDisconnected();
        }
 
@@ -71,7 +73,7 @@ class XMPPDaemon {
                static $parts = array('message', 'presence',
                                                          'end_stream', 'session_start');
 
-               while(!$this->conn->disconnected) {
+               while(!$this->conn->isDisconnected()) {
 
                        $payloads = $this->conn->processUntil($parts, 10);
 
@@ -202,7 +204,7 @@ class XMPPDaemon {
                        return;
                }
                $notice->query('COMMIT');
-               common_broadcast_notice($notice);
+               common_real_broadcast($notice);
                $this->log(LOG_INFO,
                                   'Added notice ' . $notice->id . ' from user ' . $user->nickname);
        }
@@ -323,7 +325,7 @@ class XMPPDaemon {
        }
        
        function confirmation_queue() {
-               $this->clear_old_confirm_claims();
+           # $this->clear_old_confirm_claims();
                $this->log(LOG_INFO, 'checking for queued confirmations');
                do {
                        $confirm = $this->next_confirm();
@@ -334,10 +336,9 @@ class XMPPDaemon {
                                        $this->log(LOG_WARNING, 'Confirmation for unknown user ' . $confirm->user_id);
                                        continue;
                                }
-                               
                                $success = jabber_confirm_address($confirm->code,
-                                                                                                 $user->nickname,
-                                                                                                 $jabber);
+                                                                 $user->nickname,
+                                                                 $confirm->address);
                                if (!$success) {
                                        $this->log(LOG_ERROR, 'Confirmation failed for ' . $confirm->address);
                                        # Just let the claim age out; hopefully things work then
@@ -360,8 +361,9 @@ class XMPPDaemon {
        
        function next_confirm() {
                $confirm = new Confirm_address();
-               $confirm->sent = NULL;
-               $confirm->claimed = NULL;
+               $confirm->whereAdd('claimed IS NULL');
+               # XXX: eventually we could do other confirmations in the queue, too
+               $confirm->address_type = 'jabber';
                $confirm->orderBy('modified DESC');
                $confirm->limit(1);
                if ($confirm->find(TRUE)) {