Merge pull request #92 from annando/master

fbpost sometimes seems to send comments
This commit is contained in:
Tobias Diekershoff 2013-01-07 11:07:15 -08:00
commit 2224ce15e8
3 changed files with 19 additions and 0 deletions

View file

@ -394,6 +394,10 @@ function fbpost_post_hook(&$a,&$b) {
if($b['deleted'] || ($b['created'] !== $b['edited'])) if($b['deleted'] || ($b['created'] !== $b['edited']))
return; return;
// Don't transmit answers (have to be cleaned up in the following code)
if($b['parent'] != $b['id'])
return;
// if post comes from facebook don't send it back // if post comes from facebook don't send it back
if($b['app'] == "Facebook") if($b['app'] == "Facebook")
return; return;
@ -1016,6 +1020,8 @@ function fbpost_fetchwall($a, $uid) {
$url = "https://graph.facebook.com/".$post_to_page."/feed?access_token=".$access_token; $url = "https://graph.facebook.com/".$post_to_page."/feed?access_token=".$access_token;
$first_time = ($lastcreated == "");
if ($lastcreated != "") if ($lastcreated != "")
$url .= "&since=".urlencode($lastcreated); $url .= "&since=".urlencode($lastcreated);
@ -1027,6 +1033,9 @@ function fbpost_fetchwall($a, $uid) {
if ($item->created_time > $lastcreated) if ($item->created_time > $lastcreated)
$lastcreated = $item->created_time; $lastcreated = $item->created_time;
if ($first_time)
continue;
if ($item->application->id == get_config('facebook','appid')) if ($item->application->id == get_config('facebook','appid'))
continue; continue;

View file

@ -800,6 +800,8 @@ function statusnet_fetchtimeline($a, $uid) {
$parameters = array("exclude_replies" => true, "trim_user" => true, "contributor_details" => false, "include_rts" => false); $parameters = array("exclude_replies" => true, "trim_user" => true, "contributor_details" => false, "include_rts" => false);
$first_time = ($lastid == "");
if ($lastid <> "") if ($lastid <> "")
$parameters["since_id"] = $lastid; $parameters["since_id"] = $lastid;
@ -810,6 +812,9 @@ function statusnet_fetchtimeline($a, $uid) {
if ($post->id > $lastid) if ($post->id > $lastid)
$lastid = $post->id; $lastid = $post->id;
if ($firsttime)
continue;
if (is_object($post->retweeted_status)) if (is_object($post->retweeted_status))
continue; continue;

View file

@ -604,6 +604,8 @@ function twitter_fetchtimeline($a, $uid) {
$parameters = array("exclude_replies" => true, "trim_user" => true, "contributor_details" => false, "include_rts" => false); $parameters = array("exclude_replies" => true, "trim_user" => true, "contributor_details" => false, "include_rts" => false);
$first_time = ($lastid == "");
if ($lastid <> "") if ($lastid <> "")
$parameters["since_id"] = $lastid; $parameters["since_id"] = $lastid;
@ -614,6 +616,9 @@ function twitter_fetchtimeline($a, $uid) {
if ($post->id_str > $lastid) if ($post->id_str > $lastid)
$lastid = $post->id_str; $lastid = $post->id_str;
if ($firsttime)
continue;
if (!strpos($post->source, $application_name)) { if (!strpos($post->source, $application_name)) {
$_SESSION["authenticated"] = true; $_SESSION["authenticated"] = true;
$_SESSION["uid"] = $uid; $_SESSION["uid"] = $uid;