fromgplus: Additional detection for a posting loop. Preparation for the new google+ connector

pull/157/head
Michael Vogel 2013-10-15 00:50:58 +02:00
parent b6aa4fd753
commit 191c22f709
1 changed files with 15 additions and 7 deletions

View File

@ -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,8 +355,6 @@ 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, $item->provider->title, $post, $location);
@ -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,8 +389,6 @@ 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, $item->provider->title, $post, $location);
break;