XMPP cleanup: fix outgoing XMPP when queuing is disabled; fix notice for first access to undefined member variable

This commit is contained in:
Brion Vibber 2010-03-08 10:32:40 -08:00
parent 5adb494c26
commit a77efb2447
2 changed files with 22 additions and 13 deletions

View File

@ -88,9 +88,14 @@ class Sharing_XMPP extends XMPPHP_XMPP
/** /**
* Build an XMPP proxy connection that'll save outgoing messages * Build an XMPP proxy connection that'll save outgoing messages
* to the 'xmppout' queue to be picked up by xmppdaemon later. * 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() function jabber_proxy()
{ {
if (common_config('queue', 'enabled')) {
$proxy = new Queued_XMPP(common_config('xmpp', 'host') ? $proxy = new Queued_XMPP(common_config('xmpp', 'host') ?
common_config('xmpp', 'host') : common_config('xmpp', 'host') :
common_config('xmpp', 'server'), common_config('xmpp', 'server'),
@ -104,6 +109,9 @@ function jabber_proxy()
common_config('xmpp', 'debug') ? common_config('xmpp', 'debug') ?
XMPPHP_Log::LEVEL_VERBOSE : null); XMPPHP_Log::LEVEL_VERBOSE : null);
return $proxy; return $proxy;
} else {
return jabber_connect();
}
} }
/** /**

View File

@ -36,6 +36,7 @@ class XmppManager extends IoManager
protected $site = null; protected $site = null;
protected $pingid = 0; protected $pingid = 0;
protected $lastping = null; protected $lastping = null;
protected $conn = null;
static protected $singletons = array(); static protected $singletons = array();