]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/xmppoutqueuehandler.php
Initial upgraded Atom output for group timelines
[quix0rs-gnu-social.git] / lib / xmppoutqueuehandler.php
1 <?php
2 /*
3  * StatusNet - the distributed open-source microblogging tool
4  * Copyright (C) 2010, StatusNet, Inc.
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Affero General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Affero General Public License for more details.
15  *
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 /**
21  * Queue handler for pre-processed outgoing XMPP messages.
22  * Formatted XML stanzas will have been pushed into the queue
23  * via the Queued_XMPP connection proxy, probably from some
24  * other queue processor.
25  *
26  * Here, the XML stanzas are simply pulled out of the queue and
27  * pushed out over the wire; an XmppManager is needed to set up
28  * and maintain the actual server connection.
29  *
30  * This queue will be run via XmppDaemon rather than QueueDaemon.
31  *
32  * @author Brion Vibber <brion@status.net>
33  */
34 class XmppOutQueueHandler extends QueueHandler
35 {
36     function transport() {
37         return 'xmppout';
38     }
39
40     /**
41      * Take a previously-queued XMPP stanza and send it out ot the server.
42      * @param string $msg
43      * @return boolean true on success
44      */
45     function handle($msg)
46     {
47         assert(is_string($msg));
48
49         $xmpp = XmppManager::get();
50         $ok = $xmpp->send($msg);
51
52         return $ok;
53     }
54 }
55