diff options
author | Craig Andrews <candrews@integralblue.com> | 2010-01-23 01:25:27 -0500 |
---|---|---|
committer | Craig Andrews <candrews@integralblue.com> | 2010-01-27 13:48:35 -0500 |
commit | e9995b0f6ab0788162e22c996e5ee0af416dd519 (patch) | |
tree | 10b6eda02028c3320d0c7aaef88570f3ac862041 /scripts | |
parent | 5224c7d6c263f078c3628650ff2b4b706862307c (diff) |
Create IM plugin, Pluginize XMPP, Create AIM plugin
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/getvaliddaemons.php | 4 | ||||
-rwxr-xr-x | scripts/imdaemon.php (renamed from scripts/xmppdaemon.php) | 39 | ||||
-rwxr-xr-x | scripts/queuedaemon.php | 9 | ||||
-rwxr-xr-x | scripts/stopdaemons.sh | 4 |
4 files changed, 21 insertions, 35 deletions
diff --git a/scripts/getvaliddaemons.php b/scripts/getvaliddaemons.php index a332e06b5..80c21bce5 100755 --- a/scripts/getvaliddaemons.php +++ b/scripts/getvaliddaemons.php @@ -39,9 +39,7 @@ $daemons = array(); $daemons[] = INSTALLDIR.'/scripts/queuedaemon.php'; -if(common_config('xmpp','enabled')) { - $daemons[] = INSTALLDIR.'/scripts/xmppdaemon.php'; -} +$daemons[] = INSTALLDIR.'/scripts/imdaemon.php'; if (Event::handle('GetValidDaemons', array(&$daemons))) { foreach ($daemons as $daemon) { diff --git a/scripts/xmppdaemon.php b/scripts/imdaemon.php index fd7cf055b..c37a26b7c 100755 --- a/scripts/xmppdaemon.php +++ b/scripts/imdaemon.php @@ -23,34 +23,32 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); $shortoptions = 'fi::'; $longoptions = array('id::', 'foreground'); -$helptext = <<<END_OF_XMPP_HELP -Daemon script for receiving new notices from Jabber users. +$helptext = <<<END_OF_IM_HELP +Daemon script for receiving new notices from IM users. -i --id Identity (default none) -f --foreground Stay in the foreground (default background) -END_OF_XMPP_HELP; +END_OF_IM_HELP; require_once INSTALLDIR.'/scripts/commandline.inc'; -require_once INSTALLDIR . '/lib/jabber.php'; - -class XMPPDaemon extends SpawningDaemon +class ImDaemon extends SpawningDaemon { function __construct($id=null, $daemonize=true, $threads=1) { if ($threads != 1) { // This should never happen. :) - throw new Exception("XMPPDaemon can must run single-threaded"); + throw new Exception("IMDaemon can must run single-threaded"); } parent::__construct($id, $daemonize, $threads); } function runThread() { - common_log(LOG_INFO, 'Waiting to listen to XMPP and queues'); + common_log(LOG_INFO, 'Waiting to listen to IM connections and queues'); - $master = new XmppMaster($this->get_id()); + $master = new ImMaster($this->get_id()); $master->init(); $master->service(); @@ -61,7 +59,7 @@ class XMPPDaemon extends SpawningDaemon } -class XmppMaster extends IoMaster +class ImMaster extends IoMaster { /** * Initialize IoManagers for the currently configured site @@ -69,20 +67,17 @@ class XmppMaster extends IoMaster */ function initManagers() { - // @fixme right now there's a hack in QueueManager to determine - // which queues to subscribe to based on the master class. - $this->instantiate('QueueManager'); - $this->instantiate('XmppManager'); + $classes = array(); + if (Event::handle('StartImDaemonIoManagers', array(&$classes))) { + $classes[] = 'QueueManager'; + } + Event::handle('EndImDaemonIoManagers', array(&$classes)); + foreach ($classes as $class) { + $this->instantiate($class); + } } } -// Abort immediately if xmpp is not enabled, otherwise the daemon chews up -// lots of CPU trying to connect to unconfigured servers -if (common_config('xmpp','enabled')==false) { - print "Aborting daemon - xmpp is disabled\n"; - exit(); -} - if (have_option('i', 'id')) { $id = get_option_value('i', 'id'); } else if (count($args) > 0) { @@ -93,6 +88,6 @@ if (have_option('i', 'id')) { $foreground = have_option('f', 'foreground'); -$daemon = new XMPPDaemon($id, !$foreground); +$daemon = new ImDaemon($id, !$foreground); $daemon->runOnce(); diff --git a/scripts/queuedaemon.php b/scripts/queuedaemon.php index a9cfda6d7..bedd14b1a 100755 --- a/scripts/queuedaemon.php +++ b/scripts/queuedaemon.php @@ -21,7 +21,7 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); $shortoptions = 'fi:at:'; -$longoptions = array('id=', 'foreground', 'all', 'threads=', 'skip-xmpp', 'xmpp-only'); +$longoptions = array('id=', 'foreground', 'all', 'threads='); /** * Attempts to get a count of the processors available on the current system @@ -163,13 +163,6 @@ if (!$threads) { $daemonize = !(have_option('f') || have_option('--foreground')); $all = have_option('a') || have_option('--all'); -if (have_option('--skip-xmpp')) { - define('XMPP_EMERGENCY_FLAG', true); -} -if (have_option('--xmpp-only')) { - define('XMPP_ONLY_FLAG', true); -} - $daemon = new QueueDaemon($id, $daemonize, $threads, $all); $daemon->runOnce(); diff --git a/scripts/stopdaemons.sh b/scripts/stopdaemons.sh index c790f1f34..bc1230e64 100755 --- a/scripts/stopdaemons.sh +++ b/scripts/stopdaemons.sh @@ -23,8 +23,8 @@ SDIR=`dirname $0` DIR=`php $SDIR/getpiddir.php` -for f in jabberhandler ombhandler publichandler smshandler pinghandler \ - xmppconfirmhandler xmppdaemon twitterhandler facebookhandler \ +for f in ombhandler smshandler pinghandler \ + twitterhandler facebookhandler \ twitterstatusfetcher synctwitterfriends pluginhandler rsscloudhandler; do FILES="$DIR/$f.*.pid" |