many jabber queue management changes
Added a method to QueueManager to let subclasses do stuff when idle. Needed so that XMPP queue manager can service its message queue. Cleaned up jabber_broadcast_message quite a bit. Use custom joins instead of loop-and-query, should fix some problems with users who are getting messages even after turning off notification. Only build $msg and $entry once, and use the XMPPHP function for messages with a payload, rather than rolling our own. darcs-hash:20080829200352-84dde-427e4ca8c81d4222a36f78e7c580b611ff0bf765.gz
This commit is contained in:
@@ -34,6 +34,8 @@ require_once(INSTALLDIR . '/lib/queuehandler.php');
|
||||
set_error_handler('common_error_handler');
|
||||
|
||||
class XmppQueueHandler extends QueueHandler {
|
||||
|
||||
var $conn = NULL;
|
||||
|
||||
function transport() {
|
||||
return 'jabber';
|
||||
@@ -42,15 +44,24 @@ class XmppQueueHandler extends QueueHandler {
|
||||
function start() {
|
||||
# Low priority; we don't want to receive messages
|
||||
$this->conn = jabber_connect($this->_id, NULL, -1);
|
||||
$this->conn->addEventHandler('message', 'forward_message', $this);
|
||||
return !is_null($this->conn);
|
||||
}
|
||||
|
||||
function handle_notice($notice) {
|
||||
return jabber_broadcast_notice($notice);
|
||||
}
|
||||
|
||||
function idle() {
|
||||
# Process the queue for a second
|
||||
$this->conn->processTime(1);
|
||||
}
|
||||
|
||||
function finish() {
|
||||
}
|
||||
|
||||
function forward_message(&$pl) {
|
||||
}
|
||||
}
|
||||
|
||||
mb_internal_encoding('UTF-8');
|
||||
|
Reference in New Issue
Block a user