From: Michael Vogel Date: Mon, 14 Oct 2013 22:50:58 +0000 (+0200) Subject: fromgplus: Additional detection for a posting loop. Preparation for the new google... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=191c22f7093b50d04868f0ebdbed1d2ad4955eab;p=friendica-addons.git fromgplus: Additional detection for a posting loop. Preparation for the new google+ connector --- diff --git a/fromgplus/fromgplus.php b/fromgplus/fromgplus.php index 9fc13c5e..4c271873 100644 --- a/fromgplus/fromgplus.php +++ b/fromgplus/fromgplus.php @@ -304,6 +304,9 @@ function fromgplus_handleattachments($item, $displaytext) { function fromgplus_fetch($a, $uid) { $maxfetch = 20; + // Special blank to identify postings from the googleplus connector + $blank = html_entity_decode(" ", ENT_QUOTES, 'UTF-8'); + $account = get_pconfig($uid,'fromgplus','account'); $key = get_config('fromgplus','key'); @@ -330,6 +333,15 @@ function fromgplus_fetch($a, $uid) { $lastdate = strtotime($item->published); if ($item->access->description == "Public") + + // Loop prevention - ignore postings from HootSuite + if ($item->provider->title == "HootSuite") + continue; + + // Loop prevention through the special blank from the googleplus connector + if (strstr($item->object->content, $blank)) + continue; + switch($item->object->objectType) { case "note": $post = fromgplus_html2bbcode($item->object->content); @@ -343,9 +355,7 @@ function fromgplus_fetch($a, $uid) { else $location = ""; - // Loop prevention - should be made better - if ($item->provider->title != "HootSuite") - fromgplus_post($a, $uid, "Google+", $post, $location); + fromgplus_post($a, $uid, "Google+", $post, $location); //fromgplus_post($a, $uid, $item->provider->title, $post, $location); break; @@ -353,7 +363,7 @@ function fromgplus_fetch($a, $uid) { case "activity": $post = fromgplus_html2bbcode($item->annotation)."\n"; - if (intval(get_config('system','new_share'))) { + if (!intval(get_config('system','old_share'))) { $post .= "[share author='".str_replace("'", "'",$item->object->actor->displayName). "' profile='".$item->object->actor->url. "' avatar='".$item->object->actor->image->url. @@ -379,9 +389,7 @@ function fromgplus_fetch($a, $uid) { else $location = ""; - // Loop prevention - should be made better - if ($item->provider->title != "HootSuite") - fromgplus_post($a, $uid, "Google+", $post, $location); + fromgplus_post($a, $uid, "Google+", $post, $location); //fromgplus_post($a, $uid, $item->provider->title, $post, $location); break; }