IM cleanup on 1.0.x branch:

* Fake_XMPP back to Queued_XMPP, refactor how we use it and don't create objects and load classes until we need them.
* fix fatal error in IM settings while waiting for a Jabber confirmation.
* Caching fix for user_im_prefs
* fix for saving multiple transport settings
* some fixes for AIM & using normalized addresses for lookups
This commit is contained in:
Brion Vibber
2010-04-30 14:41:54 -07:00
parent e3e90b4c27
commit 5414396a2e
8 changed files with 89 additions and 37 deletions

View File

@@ -60,8 +60,6 @@ class XmppPlugin extends ImPlugin
public $transport = 'xmpp';
protected $fake_xmpp;
function getDisplayName(){
return _m('XMPP/Jabber/GTalk');
}
@@ -292,7 +290,7 @@ class XmppPlugin extends ImPlugin
require_once 'XMPP.php';
return false;
case 'Sharing_XMPP':
case 'Fake_XMPP':
case 'Queued_XMPP':
require_once $dir . '/'.$cls.'.php';
return false;
case 'XmppManager':
@@ -317,9 +315,7 @@ class XmppPlugin extends ImPlugin
function send_message($screenname, $body)
{
$this->fake_xmpp->message($screenname, $body, 'chat');
$this->enqueue_outgoing_raw($this->fake_xmpp->would_be_sent);
return true;
$this->queuedConnection()->message($screenname, $body, 'chat');
}
function send_notice($screenname, $notice)
@@ -327,8 +323,7 @@ class XmppPlugin extends ImPlugin
$msg = $this->format_notice($notice);
$entry = $this->format_entry($notice);
$this->fake_xmpp->message($screenname, $msg, 'chat', null, $entry);
$this->enqueue_outgoing_raw($this->fake_xmpp->would_be_sent);
$this->queuedConnection()->message($screenname, $msg, 'chat', null, $entry);
return true;
}
@@ -385,10 +380,19 @@ class XmppPlugin extends ImPlugin
return true;
}
return $this->handle_incoming($from, $pl['body']);
$this->handle_incoming($from, $pl['body']);
return true;
}
function initialize(){
/**
* Build a queue-proxied XMPP interface object. Any outgoing messages
* will be run back through us for enqueing rather than sent directly.
*
* @return Queued_XMPP
* @throws Exception if server settings are invalid.
*/
function queuedConnection(){
if(!isset($this->server)){
throw new Exception("must specify a server");
}
@@ -402,7 +406,7 @@ class XmppPlugin extends ImPlugin
throw new Exception("must specify a password");
}
$this->fake_xmpp = new Fake_XMPP($this->host ?
return new Queued_XMPP($this, $this->host ?
$this->host :
$this->server,
$this->port,
@@ -415,7 +419,6 @@ class XmppPlugin extends ImPlugin
$this->debug ?
XMPPHP_Log::LEVEL_VERBOSE : null
);
return true;
}
function onPluginVersion(&$versions)