} elseif ($contact['network'] == Protocol::DIASPORA) {
Diaspora::sendUnshare($user, $contact);
} elseif ($contact['network'] == Protocol::ACTIVITYPUB) {
- ActivityPub::transmitContactUndo($contact['url'], $user['uid']);
+ ActivityPub\Transmitter::sendContactUndo($contact['url'], $user['uid']);
if ($dissolve) {
- ActivityPub::transmitContactReject($contact['url'], $contact['hub-verify'], $user['uid']);
+ ActivityPub\Transmitter::sendContactReject($contact['url'], $contact['hub-verify'], $user['uid']);
}
}
}
require_once 'include/conversation.php';
- // There are no posts with "uid = 0" with connector networks
- // This speeds up the query a lot
- $r = q("SELECT `network`, `id` AS `author-id`, `contact-type` FROM `contact`
- WHERE `contact`.`nurl` = '%s' AND `contact`.`uid` = 0",
- DBA::escape(normalise_link($contact_url))
- );
+ $cid = Self::getIdForURL($contact_url);
- if (!DBA::isResult($r)) {
+ $contact = DBA::selectFirst('contact', ['contact-type', 'network'], ['id' => $cid]);
+ if (!DBA::isResult($contact)) {
return '';
}
- if (in_array($r[0]["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, ""])) {
+ if (in_array($contact["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, ""])) {
$sql = "(`item`.`uid` = 0 OR (`item`.`uid` = ? AND NOT `item`.`global`))";
} else {
$sql = "`item`.`uid` = ?";
}
- $author_id = intval($r[0]["author-id"]);
-
- $contact = ($r[0]["contact-type"] == self::ACCOUNT_TYPE_COMMUNITY ? 'owner-id' : 'author-id');
+ $contact_field = ($contact["contact-type"] == self::ACCOUNT_TYPE_COMMUNITY ? 'owner-id' : 'author-id');
if ($thread_mode) {
- $condition = ["`$contact` = ? AND `gravity` = ? AND " . $sql,
- $author_id, GRAVITY_PARENT, local_user()];
+ $condition = ["`$contact_field` = ? AND `gravity` = ? AND " . $sql,
+ $cid, GRAVITY_PARENT, local_user()];
} else {
- $condition = ["`$contact` = ? AND `gravity` IN (?, ?) AND " . $sql,
- $author_id, GRAVITY_PARENT, GRAVITY_COMMENT, local_user()];
+ $condition = ["`$contact_field` = ? AND `gravity` IN (?, ?) AND " . $sql,
+ $cid, GRAVITY_PARENT, GRAVITY_COMMENT, local_user()];
}
$params = ['order' => ['created' => true],
if (($ret['network'] === Protocol::DFRN) && !DBA::isResult($contact)) {
if ($interactive) {
- if (strlen($a->urlpath)) {
+ if (strlen($a->getURLPath())) {
$myaddr = bin2hex(System::baseUrl() . '/profile/' . $a->user['nickname']);
} else {
- $myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname());
+ $myaddr = bin2hex($a->user['nickname'] . '@' . $a->getHostName());
}
goaway($ret['request'] . "&addr=$myaddr");
$ret = Diaspora::sendShare($a->user, $contact);
logger('share returns: ' . $ret);
} elseif ($contact['network'] == Protocol::ACTIVITYPUB) {
- $ret = ActivityPub::transmitActivity('Follow', $contact['url'], $uid);
+ $ret = ActivityPub\Transmitter::sendActivity('Follow', $contact['url'], $uid);
logger('Follow returns: ' . $ret);
}
}
}
if ($contact['network'] == Protocol::ACTIVITYPUB) {
- ActivityPub::transmitContactAccept($contact['url'], $contact['hub-verify'], $importer['uid']);
+ ActivityPub\Transmitter::sendContactAccept($contact['url'], $contact['hub-verify'], $importer['uid']);
}
// send email notification to owner?
} elseif (DBA::isResult($user) && in_array($user['page-flags'], [self::PAGE_SOAPBOX, self::PAGE_FREELOVE, self::PAGE_COMMUNITY])) {
$condition = ['uid' => $importer['uid'], 'url' => $url, 'pending' => true];
DBA::update('contact', ['pending' => false], $condition);
+
+ $contact = DBA::selectFirst('contact', ['url', 'network', 'hub-verify'], ['id' => $contact_record['id']]);
+
+ if ($contact['network'] == Protocol::ACTIVITYPUB) {
+ ActivityPub\Transmitter::sendContactAccept($contact['url'], $contact['hub-verify'], $importer['uid']);
+ }
}
}
}