- if (preg_match('=https?://(.*)/user/(.*)=ism', $profile_url, $matches)) {
- $statusnet_host = $matches[1];
- $statusnet_user = $matches[2];
- $UserData = DI::httpClient()->fetch('http://' . $statusnet_host . '/api/users/show.json?user_id=' . $statusnet_user);
- $user = json_decode($UserData);
- if ($user) {
- $matches[2] = $user->screen_name;
- return self::STATUSNET;
+ if (in_array($protocol, [Protocol::OSTATUS, Protocol::DFRN])) {
+ // create a follow slap
+ $item = [
+ 'verb' => Activity::FOLLOW,
+ 'gravity' => Item::GRAVITY_ACTIVITY,
+ 'follow' => $contact['url'],
+ 'body' => '',
+ 'title' => '',
+ 'guid' => '',
+ 'uri-id' => 0,
+ ];
+
+ $slap = OStatus::salmon($item, $owner);
+
+ if (!empty($contact['notify'])) {
+ Salmon::slapper($owner, $contact['notify'], $slap);
+ }
+ } elseif ($protocol == Protocol::DIASPORA) {
+ $contact = Diaspora::sendShare($owner, $contact);
+ Logger::notice('share returns: ' . $contact);
+ } elseif ($protocol == Protocol::ACTIVITYPUB) {
+ $activity_id = ActivityPub\Transmitter::activityIDFromContact($contact['id']);
+ if (empty($activity_id)) {
+ // This really should never happen
+ return false;