diff options
author | Zach Copley <zach@controlyourself.ca> | 2009-01-04 23:02:12 -0500 |
---|---|---|
committer | Zach Copley <zach@controlyourself.ca> | 2009-01-04 23:02:12 -0500 |
commit | e0fbf02bbf516db10070bddaabbbaea31d336cda (patch) | |
tree | c44b562a6a8bb73766884f2539928b2fb6209729 /scripts | |
parent | fd6f9b9d7622f280f92810770deb217eb7301c14 (diff) |
trac750 configurable sync flags for Facebook app (noticesync, replysync)
darcs-hash:20090105040212-7b5ce-37f6195649dc673241e4566a93183b13e428d98f.gz
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/update_facebook.php | 17 |
1 files changed, 10 insertions, 7 deletions
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(){ |