summaryrefslogtreecommitdiff
path: root/plugins/Facebook/facebookqueuehandler.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 /plugins/Facebook/facebookqueuehandler.php
parent392bc728c795dd50e19a56cb097ab9a64f129573 (diff)
parentec145b73fc91dd54695dd374c8a71a11e233b8c0 (diff)
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'plugins/Facebook/facebookqueuehandler.php')
-rw-r--r--[-rwxr-xr-x]plugins/Facebook/facebookqueuehandler.php52
1 files changed, 15 insertions, 37 deletions
diff --git a/plugins/Facebook/facebookqueuehandler.php b/plugins/Facebook/facebookqueuehandler.php
index e4ae7d4ee..1778690e5 100755..100644
--- a/plugins/Facebook/facebookqueuehandler.php
+++ b/plugins/Facebook/facebookqueuehandler.php
@@ -1,4 +1,3 @@
-#!/usr/bin/env php
<?php
/*
* StatusNet - the distributed open-source microblogging tool
@@ -18,21 +17,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/../..'));
+if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
-$shortoptions = 'i::';
-$longoptions = array('id::');
-
-$helptext = <<<END_OF_FACEBOOK_HELP
-Daemon script for pushing new notices to Facebook.
-
- -i --id Identity (default none)
-
-END_OF_FACEBOOK_HELP;
-
-require_once INSTALLDIR . '/scripts/commandline.inc';
require_once INSTALLDIR . '/plugins/Facebook/facebookutil.php';
-require_once INSTALLDIR . '/lib/queuehandler.php';
class FacebookQueueHandler extends QueueHandler
{
@@ -41,33 +28,24 @@ class FacebookQueueHandler extends QueueHandler
return 'facebook';
}
- function start()
- {
- $this->log(LOG_INFO, "INITIALIZE");
- return true;
- }
-
function handle_notice($notice)
{
- return facebookBroadcastNotice($notice);
+ if ($this->_isLocal($notice)) {
+ return facebookBroadcastNotice($notice);
+ }
+ return true;
}
- function finish()
+ /**
+ * Determine whether the notice was locally created
+ *
+ * @param Notice $notice the notice
+ *
+ * @return boolean locality
+ */
+ function _isLocal($notice)
{
+ return ($notice->is_local == Notice::LOCAL_PUBLIC ||
+ $notice->is_local == Notice::LOCAL_NONPUBLIC);
}
-
}
-
-if (have_option('i')) {
- $id = get_option_value('i');
-} else if (have_option('--id')) {
- $id = get_option_value('--id');
-} else if (count($args) > 0) {
- $id = $args[0];
-} else {
- $id = null;
-}
-
-$handler = new FacebookQueueHandler($id);
-
-$handler->runOnce();