summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-03-08 13:37:45 -0800
committerBrion Vibber <brion@pobox.com>2010-03-08 13:37:45 -0800
commit42463e160d6672f6e5e458a22ddae79b62fa39bf (patch)
treee0733a6cbb4d2bac34c2a8fc604e32e5363b41f7 /lib
parentef3991dbbe0acdba2dd7050b99f951ccfe5b8258 (diff)
parent7e7d88831cf8b3e8876499b86890da2e63b08c97 (diff)
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'lib')
-rw-r--r--lib/jabber.php34
-rw-r--r--lib/queued_xmpp.php18
-rw-r--r--lib/xmppmanager.php1
3 files changed, 36 insertions, 17 deletions
diff --git a/lib/jabber.php b/lib/jabber.php
index e1bf06ba6..db4e2e9a7 100644
--- a/lib/jabber.php
+++ b/lib/jabber.php
@@ -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();
+ }
}
/**
diff --git a/lib/queued_xmpp.php b/lib/queued_xmpp.php
index fdd074db2..f6bccfd5b 100644
--- a/lib/queued_xmpp.php
+++ b/lib/queued_xmpp.php
@@ -49,10 +49,20 @@ class Queued_XMPP extends XMPPHP_XMPP
*/
public function __construct($host, $port, $user, $password, $resource, $server = null, $printlog = false, $loglevel = null)
{
- parent::__construct($host, $port, $user, $password, $resource, $server, $printlog, $loglevel);
- // Normally the fulljid isn't filled out until resource binding time;
- // we need to save it here since we're not talking to a real server.
- $this->fulljid = "{$this->basejid}/{$this->resource}";
+ parent::__construct($host, $port, $user, $password, $resource, $server, $printlog, $loglevel);
+
+ // We use $host to connect, but $server to build JIDs if specified.
+ // This seems to fix an upstream bug where $host was used to build
+ // $this->basejid, never seen since it isn't actually used in the base
+ // classes.
+ if (!$server) {
+ $server = $this->host;
+ }
+ $this->basejid = $this->user . '@' . $server;
+
+ // Normally the fulljid is filled out by the server at resource binding
+ // time, but we need to do it since we're not talking to a real server.
+ $this->fulljid = "{$this->basejid}/{$this->resource}";
}
/**
diff --git a/lib/xmppmanager.php b/lib/xmppmanager.php
index f37635855..cca54db08 100644
--- a/lib/xmppmanager.php
+++ b/lib/xmppmanager.php
@@ -36,6 +36,7 @@ class XmppManager extends IoManager
protected $site = null;
protected $pingid = 0;
protected $lastping = null;
+ protected $conn = null;
static protected $singletons = array();