+ public static function transmitActivity($activity, $target, $uid)
+ {
+ $profile = Probe::uri($target, Protocol::ACTIVITYPUB);
+
+ $owner = User::getOwnerDataById($uid);
+
+ $data = ['@context' => 'https://www.w3.org/ns/activitystreams',
+ 'id' => 'https://pirati.ca/activity/' . System::createGUID(),
+ 'type' => $activity,
+ 'actor' => $owner['url'],
+ 'object' => $profile['url']];
+
+ logger('Sending activity ' . $activity . ' to ' . $target . ' for user ' . $uid, LOGGER_DEBUG);
+ return self::transmit($data, $profile['notify'], $uid);
+ }
+
+ public static function transmitContactActivity($activity, $target, $id, $uid)
+ {
+ $profile = Probe::uri($target, Protocol::ACTIVITYPUB);
+
+ if (empty($id)) {
+ $id = 'https://pirati.ca/activity/' . System::createGUID();
+ }
+
+ $owner = User::getOwnerDataById($uid);
+ $data = ['@context' => 'https://www.w3.org/ns/activitystreams',
+ 'id' => 'https://pirati.ca/activity/' . System::createGUID(),
+ 'type' => $activity,
+ 'actor' => $owner['url'],
+ 'object' => ['id' => $id, 'type' => 'Follow',
+ 'actor' => $owner['url'],
+ 'object' => $profile['url']]];
+
+ logger('Sending ' . $activity . ' to ' . $target . ' for user ' . $uid . ' with id ' . $id, LOGGER_DEBUG);
+ return self::transmit($data, $profile['notify'], $uid);
+ }
+