From 75f6b10c4edc5c027db472a7801bc52f85fd0971 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 7 Jan 2013 19:19:55 +0100 Subject: [PATCH 1/2] fbpost: Sometimes comments were sent to facebook. --- fbpost/fbpost.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fbpost/fbpost.php b/fbpost/fbpost.php index bef8117e..e33ad626 100644 --- a/fbpost/fbpost.php +++ b/fbpost/fbpost.php @@ -394,6 +394,10 @@ function fbpost_post_hook(&$a,&$b) { if($b['deleted'] || ($b['created'] !== $b['edited'])) 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($b['app'] == "Facebook") return; From 52d585863a5234d56b6d2cfe1c5ebeb71f21df51 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 7 Jan 2013 19:30:18 +0100 Subject: [PATCH 2/2] fbpost/statusnet/twitter: When messages are fetched the first time for mirroring, then don't post them --- fbpost/fbpost.php | 5 +++++ statusnet/statusnet.php | 5 +++++ twitter/twitter.php | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/fbpost/fbpost.php b/fbpost/fbpost.php index e33ad626..1486afdb 100644 --- a/fbpost/fbpost.php +++ b/fbpost/fbpost.php @@ -1020,6 +1020,8 @@ function fbpost_fetchwall($a, $uid) { $url = "https://graph.facebook.com/".$post_to_page."/feed?access_token=".$access_token; + $first_time = ($lastcreated == ""); + if ($lastcreated != "") $url .= "&since=".urlencode($lastcreated); @@ -1031,6 +1033,9 @@ function fbpost_fetchwall($a, $uid) { if ($item->created_time > $lastcreated) $lastcreated = $item->created_time; + if ($first_time) + continue; + if ($item->application->id == get_config('facebook','appid')) continue; diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 6a00d3df..d5700710 100755 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -800,6 +800,8 @@ function statusnet_fetchtimeline($a, $uid) { $parameters = array("exclude_replies" => true, "trim_user" => true, "contributor_details" => false, "include_rts" => false); + $first_time = ($lastid == ""); + if ($lastid <> "") $parameters["since_id"] = $lastid; @@ -810,6 +812,9 @@ function statusnet_fetchtimeline($a, $uid) { if ($post->id > $lastid) $lastid = $post->id; + if ($firsttime) + continue; + if (is_object($post->retweeted_status)) continue; diff --git a/twitter/twitter.php b/twitter/twitter.php index aeacb5b2..b9cb3146 100755 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -604,6 +604,8 @@ function twitter_fetchtimeline($a, $uid) { $parameters = array("exclude_replies" => true, "trim_user" => true, "contributor_details" => false, "include_rts" => false); + $first_time = ($lastid == ""); + if ($lastid <> "") $parameters["since_id"] = $lastid; @@ -614,6 +616,9 @@ function twitter_fetchtimeline($a, $uid) { if ($post->id_str > $lastid) $lastid = $post->id_str; + if ($firsttime) + continue; + if (!strpos($post->source, $application_name)) { $_SESSION["authenticated"] = true; $_SESSION["uid"] = $uid;