]> git.mxchange.org Git - friendica.git/blobdiff - mod/dfrn_confirm.php
Avoid beeing flooded by invalid requests
[friendica.git] / mod / dfrn_confirm.php
index 4abaf978fb7f99d0e319690258f6f07f9952f973..d3fa45d361219a1ce9632e209ca18cd8ca06ec2b 100644 (file)
@@ -337,7 +337,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
                        );
                } else {
                        if ($network == Protocol::ACTIVITYPUB) {
-                               ActivityPub::transmitContactAccept($contact['url'], $contact['hub-verify'], $uid);
+                               ActivityPub\Transmitter::sendContactAccept($contact['url'], $contact['hub-verify'], $uid);
                                $pending = true;
                        } else {
                                $pending = false;
@@ -356,7 +356,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
                        $new_relation = $contact['rel'];
                        $writable = $contact['writable'];
 
-                       if ($network === Protocol::DIASPORA) {
+                       if (in_array($network, [Protocol::DIASPORA, Protocol::ACTIVITYPUB])) {
                                if ($duplex) {
                                        $new_relation = Contact::FRIEND;
                                } else {
@@ -393,6 +393,10 @@ function dfrn_confirm_post(App $a, $handsfree = null)
 
                Group::addMember(User::getDefaultGroup($uid, $contact["network"]), $contact['id']);
 
+               if ($network == Protocol::ACTIVITYPUB && $duplex) {
+                       ActivityPub\Transmitter::sendActivity('Follow', $contact['url'], $uid);
+               }
+
                // Let's send our user to the contact editor in case they want to
                // do anything special with this new friend.
                if ($handsfree === null) {