]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/xmppmanager.php
In single-user mode, link #hashtags to the user's tagged stream rather than the globa...
[quix0rs-gnu-social.git] / lib / xmppmanager.php
index 299175dd7d79927f8819d24c9ca4e6ae9db6014c..cca54db08da4b4a016354ffa1b685564c9900fe8 100644 (file)
@@ -36,6 +36,7 @@ class XmppManager extends IoManager
     protected $site = null;
     protected $pingid = 0;
     protected $lastping = null;
+    protected $conn = null;
 
     static protected $singletons = array();
     
@@ -48,7 +49,7 @@ class XmppManager extends IoManager
     public static function get()
     {
         if (common_config('xmpp', 'enabled')) {
-            $site = common_config('site', 'server');
+            $site = StatusNet::currentSite();
             if (empty(self::$singletons[$site])) {
                 self::$singletons[$site] = new XmppManager();
             }
@@ -69,7 +70,7 @@ class XmppManager extends IoManager
 
     function __construct()
     {
-        $this->site = common_config('site', 'server');
+        $this->site = StatusNet::currentSite();
         $this->resource = common_config('xmpp', 'resource') . 'daemon';
     }
 
@@ -101,7 +102,7 @@ class XmppManager extends IoManager
         $this->conn->addEventHandler('reconnect', 'handle_reconnect', $this);
 
         $this->conn->setReconnectTimeout(600);
-        jabber_send_presence("Send me a message to post a notice", 'available', null, 'available', -1);
+        jabber_send_presence("Send me a message to post a notice", 'available', null, 'available', 100);
 
         return !is_null($this->conn);
     }
@@ -233,7 +234,7 @@ class XmppManager extends IoManager
         common_log(LOG_NOTICE, 'XMPP reconnected');
 
         $this->conn->processUntil('session_start');
-        $this->conn->presence(null, 'available', null, 'available', -1);
+        $this->conn->presence(null, 'available', null, 'available', 100);
     }
 
 
@@ -476,10 +477,10 @@ class XmppManager extends IoManager
      */
     protected function switchSite()
     {
-        if ($this->site != common_config('site', 'server')) {
+        if ($this->site != StatusNet::currentSite()) {
             common_log(LOG_DEBUG, __METHOD__ . ": switching to site $this->site");
             $this->stats('switch');
-            StatusNet::init($this->site);
+            StatusNet::switchSite($this->site);
         }
     }
 }