summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/getvaliddaemons.php4
-rwxr-xr-xscripts/imdaemon.php (renamed from scripts/xmppdaemon.php)39
-rwxr-xr-xscripts/stopdaemons.sh4
3 files changed, 20 insertions, 27 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 46dd9b90c..ffb5ecf0d 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/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"