]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/jabber.php
Include meta charset header in saved HTML file for long OStatus messages; without...
[quix0rs-gnu-social.git] / lib / jabber.php
index b6b23521bdf4e8a11088c94d4dfdc983e2849872..db4e2e9a706a62f8bf905e4b34167f37416492f3 100644 (file)
@@ -88,22 +88,30 @@ class Sharing_XMPP extends XMPPHP_XMPP
 /**
  * Build an XMPP proxy connection that'll save outgoing messages
  * to the 'xmppout' queue to be picked up by xmppdaemon later.
+ *
+ * If queueing is disabled, we'll grab a live connection.
+ *
+ * @return XMPPHP
  */
 function jabber_proxy()
 {
-       $proxy = new Queued_XMPP(common_config('xmpp', 'host') ?
-                             common_config('xmpp', 'host') :
-                             common_config('xmpp', 'server'),
-                             common_config('xmpp', 'port'),
-                             common_config('xmpp', 'user'),
-                             common_config('xmpp', 'password'),
-                             common_config('xmpp', 'resource') . 'daemon',
-                             common_config('xmpp', 'server'),
-                             common_config('xmpp', 'debug') ?
-                             true : false,
-                             common_config('xmpp', 'debug') ?
-                             XMPPHP_Log::LEVEL_VERBOSE :  null);
-    return $proxy;
+    if (common_config('queue', 'enabled')) {
+           $proxy = new Queued_XMPP(common_config('xmpp', 'host') ?
+                                 common_config('xmpp', 'host') :
+                                 common_config('xmpp', 'server'),
+                                 common_config('xmpp', 'port'),
+                                 common_config('xmpp', 'user'),
+                                 common_config('xmpp', 'password'),
+                                 common_config('xmpp', 'resource') . 'daemon',
+                                 common_config('xmpp', 'server'),
+                                 common_config('xmpp', 'debug') ?
+                                 true : false,
+                                 common_config('xmpp', 'debug') ?
+                                 XMPPHP_Log::LEVEL_VERBOSE :  null);
+        return $proxy;
+    } else {
+        return jabber_connect();
+    }
 }
 
 /**
@@ -358,7 +366,7 @@ function jabber_broadcast_notice($notice)
         common_log(LOG_WARNING, 'Refusing to broadcast notice with ' .
                    'unknown profile ' . common_log_objstring($notice),
                    __FILE__);
-        return false;
+        return true; // not recoverable; discard.
     }
 
     $msg   = jabber_format_notice($profile, $notice);
@@ -437,7 +445,7 @@ function jabber_public_notice($notice)
             common_log(LOG_WARNING, 'Refusing to broadcast notice with ' .
                        'unknown profile ' . common_log_objstring($notice),
                        __FILE__);
-            return false;
+            return true; // not recoverable; discard.
         }
 
         $msg   = jabber_format_notice($profile, $notice);