From 0a6d1f9e492459aed2607b2432438b66b50bc4f8 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Wed, 25 Jun 2014 01:20:04 +0200 Subject: [PATCH] app.net, pump.io, statusnet, twitter: There were situations, when contacts were added by mistake. --- appnet/appnet.php | 11 +++++++++++ fbsync/fbsync.php | 3 +++ pumpio/pumpio.php | 3 +++ statusnet/statusnet.php | 2 ++ twitter/twitter.php | 2 ++ 5 files changed, 21 insertions(+) diff --git a/appnet/appnet.php b/appnet/appnet.php index de1dd970..acbd5ce5 100644 --- a/appnet/appnet.php +++ b/appnet/appnet.php @@ -856,6 +856,8 @@ function appnet_createpost($a, $uid, $post, $me, $user, $ownid, $createuser, $th } } } + // Don't create accounts of people who just comment something + $createuser = false; } else $postarray['thr-parent'] = $postarray['uri']; @@ -1042,6 +1044,8 @@ function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) { if(!count($r) AND !$create_user) return($me); + if ($contact["canonical_url"] == "") + return($me); if (count($r) AND ($r[0]["readonly"] OR $r[0]["blocked"])) { logger("appnet_fetchcontact: Contact '".$r[0]["nick"]."' is blocked or readonly.", LOGGER_DEBUG); @@ -1049,6 +1053,13 @@ function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) { } if(!count($r)) { + + if ($contact["name"] == "") + $contact["name"] = $contact["username"]; + + if ($contact["username"] == "") + $contact["username"] = $contact["name"]; + // create contact record q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`, `name`, `nick`, `photo`, `network`, `rel`, `priority`, diff --git a/fbsync/fbsync.php b/fbsync/fbsync.php index 85859151..14de4df2 100644 --- a/fbsync/fbsync.php +++ b/fbsync/fbsync.php @@ -278,6 +278,9 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr } if ($contact_id <= 0) { + // To-Do: + // $contacts[$post->source_id] seems to be wrong by repeated posts + // must be changed in future $contact_id = fbsync_fetch_contact($uid, $contacts[$post->source_id], $create_user); if ($contact_id == -1) { diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 62467414..c9eb0208 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -888,6 +888,9 @@ function pumpio_dolike(&$a, $uid, $self, $post, $own_id) { function pumpio_get_contact($uid, $contact) { + if (($contact->url == "") OR ($contact->id == 0)) + return(false); + $r = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1", dbesc(normalise_link($contact->url))); diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 7293f882..2f3f84d2 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -1059,6 +1059,8 @@ function statusnet_createpost($a, $uid, $post, $self, $create_user, $only_existi } else return(array()); } + // Don't create accounts of people who just comment something + $create_user = false; } else $postarray['parent-uri'] = $postarray['uri']; diff --git a/twitter/twitter.php b/twitter/twitter.php index b6d0d3af..d2dc4fd6 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -1232,6 +1232,8 @@ function twitter_createpost($a, $uid, $post, $self, $create_user, $only_existing } else return(array()); } + // Don't create accounts of people who just comment something + $create_user = false; } else $postarray['parent-uri'] = $postarray['uri'];