summaryrefslogtreecommitdiff
path: root/lib/unqueuemanager.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-01-12 23:25:25 -0800
committerEvan Prodromou <evan@status.net>2010-01-12 23:25:25 -0800
commite34ece8b0630394b606b57b19de58c830fad9c4d (patch)
treed6354a6e02517dd75c32f40b1d08a4b9cffd9b11 /lib/unqueuemanager.php
parent392bc728c795dd50e19a56cb097ab9a64f129573 (diff)
parentec145b73fc91dd54695dd374c8a71a11e233b8c0 (diff)
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'lib/unqueuemanager.php')
-rw-r--r--lib/unqueuemanager.php58
1 files changed, 18 insertions, 40 deletions
diff --git a/lib/unqueuemanager.php b/lib/unqueuemanager.php
index 72dbc4eed..5595eac05 100644
--- a/lib/unqueuemanager.php
+++ b/lib/unqueuemanager.php
@@ -23,57 +23,35 @@
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Sarven Capadisli <csarven@status.net>
+ * @author Brion Vibber <brion@status.net>
* @copyright 2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-class UnQueueManager
+class UnQueueManager extends QueueManager
{
+
+ /**
+ * Dummy queue storage manager: instead of saving events for later,
+ * we just process them immediately. This is only suitable for events
+ * that can be processed quickly and don't need polling or long-running
+ * connections to another server such as XMPP.
+ *
+ * @param Notice $object
+ * @param string $queue
+ */
function enqueue($object, $queue)
{
$notice = $object;
-
- switch ($queue)
- {
- case 'omb':
- if ($this->_isLocal($notice)) {
- require_once(INSTALLDIR.'/lib/omb.php');
- omb_broadcast_notice($notice);
- }
- break;
- case 'public':
- if ($this->_isLocal($notice)) {
- require_once(INSTALLDIR.'/lib/jabber.php');
- jabber_public_notice($notice);
- }
- break;
- case 'ping':
- if ($this->_isLocal($notice)) {
- require_once INSTALLDIR . '/lib/ping.php';
- return ping_broadcast_notice($notice);
- }
- case 'sms':
- require_once(INSTALLDIR.'/lib/mail.php');
- mail_broadcast_notice_sms($notice);
- break;
- case 'jabber':
- require_once(INSTALLDIR.'/lib/jabber.php');
- jabber_broadcast_notice($notice);
- break;
- case 'plugin':
- Event::handle('HandleQueuedNotice', array(&$notice));
- break;
- default:
+
+ $handler = $this->getHandler($queue);
+ if ($handler) {
+ $handler->handle_notice($notice);
+ } else {
if (Event::handle('UnqueueHandleNotice', array(&$notice, $queue))) {
throw new ServerException("UnQueueManager: Unknown queue: $queue");
}
}
}
-
- function _isLocal($notice)
- {
- return ($notice->is_local == Notice::LOCAL_PUBLIC ||
- $notice->is_local == Notice::LOCAL_NONPUBLIC);
- }
-} \ No newline at end of file
+}