From e0fbf02bbf516db10070bddaabbbaea31d336cda Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sun, 4 Jan 2009 23:02:12 -0500 Subject: trac750 configurable sync flags for Facebook app (noticesync, replysync) darcs-hash:20090105040212-7b5ce-37f6195649dc673241e4566a93183b13e428d98f.gz --- scripts/update_facebook.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'scripts/update_facebook.php') diff --git a/scripts/update_facebook.php b/scripts/update_facebook.php index d2440b163..02e47cefe 100755 --- a/scripts/update_facebook.php +++ b/scripts/update_facebook.php @@ -52,9 +52,16 @@ while($notice->fetch()) { $flink = Foreign_link::getByUserID($notice->profile_id, 2); $fbuid = $flink->foreign_id; + $content = $notice->content; - update_status($fbuid, $notice); + if (($flink->noticesync & FOREIGN_NOTICE_SEND) == FOREIGN_NOTICE_SEND) { + // If it's not a reply, or if the user WANTS to send replies... + if (!preg_match('/@[a-zA-Z0-9_]{1,15}\b/u', $content) || + (($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) == FOREIGN_NOTICE_SEND_REPLY)) { + update_status($fbuid, $content); + } + } } update_last_updated($current_time); @@ -63,18 +70,14 @@ exit(0); -function update_status($fbuid, $notice) { +function update_status($fbuid, $content) { global $facebook; try { - - $result = $facebook->api_client->users_setStatus($notice->content, $fbuid, false, true); - + $result = $facebook->api_client->users_setStatus($content, $fbuid, false, true); } catch(FacebookRestClientException $e){ - print_r($e); } - } function get_last_updated(){ -- cgit v1.2.3-54-g00ecf