]> git.mxchange.org Git - friendica-addons.git/commitdiff
app.net, pump.io, statusnet, twitter: There were situations, when contacts were added...
authorMichael Vogel <icarus@dabo.de>
Tue, 24 Jun 2014 23:20:04 +0000 (01:20 +0200)
committerMichael Vogel <icarus@dabo.de>
Tue, 24 Jun 2014 23:20:04 +0000 (01:20 +0200)
appnet/appnet.php
fbsync/fbsync.php
pumpio/pumpio.php
statusnet/statusnet.php
twitter/twitter.php

index de1dd970dfa61b39d0dddd5514f65ab32df85dc3..acbd5ce53bc8c8e87ce681f6cd800ba6a16de54f 100644 (file)
@@ -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`,
index 858591519b32fd9bd801ee71437394da5e1ecd4a..14de4df25a0e1390d11acf263aff830a216a7a92 100644 (file)
@@ -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) {
index 624674144f39033d8ca3b741c0b952f553f07cd1..c9eb0208f526c984554cbc669c315b527dd0a97a 100644 (file)
@@ -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)));
 
index 7293f882c7202d1094a01ec4e11312b1c1345726..2f3f84d20eeaacd035baeb6057925ac47cae800f 100644 (file)
@@ -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'];
 
index b6d0d3af312d05c050ab1a5ddfe7125b44297572..d2dc4fd69c92551c78b79277d67915b07668faa3 100644 (file)
@@ -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'];