use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
{
$fields = ['created' => DateTimeFormat::utcNow(),
'name' => 'relay', 'nick' => 'relay',
- 'url' => $server_url, 'network' => NETWORK_DIASPORA,
+ 'url' => $server_url, 'network' => Protocol::DIASPORA,
'batch' => $server_url . '/receive/public',
'rel' => Contact::FOLLOWER, 'blocked' => false,
'pending' => false, 'writable' => true];
{
$update = false;
- $person = DBA::selectFirst('fcontact', [], ['network' => NETWORK_DIASPORA, 'addr' => $handle]);
+ $person = DBA::selectFirst('fcontact', [], ['network' => Protocol::DIASPORA, 'addr' => $handle]);
if (DBA::isResult($person)) {
logger("In cache " . print_r($person, true), LOGGER_DEBUG);
if (!DBA::isResult($person) || $update) {
logger("create or refresh", LOGGER_DEBUG);
- $r = Probe::uri($handle, NETWORK_DIASPORA);
+ $r = Probe::uri($handle, Protocol::DIASPORA);
// Note that Friendica contacts will return a "Diaspora person"
// if Diaspora connectivity is enabled on their server
- if ($r && ($r["network"] === NETWORK_DIASPORA)) {
+ if ($r && ($r["network"] === Protocol::DIASPORA)) {
self::updateFContact($r);
// Fetch the updated or added contact
- $person = DBA::selectFirst('fcontact', [], ['network' => NETWORK_DIASPORA, 'addr' => $handle]);
+ $person = DBA::selectFirst('fcontact', [], ['network' => Protocol::DIASPORA, 'addr' => $handle]);
if (!DBA::isResult($person)) {
$person = $r;
}
$r = q(
"SELECT `url` FROM `fcontact` WHERE `url` != '' AND `network` = '%s' AND `guid` = '%s'",
- DBA::escape(NETWORK_DIASPORA),
+ DBA::escape(Protocol::DIASPORA),
DBA::escape($fcontact_guid)
);
$network = $contact["network"];
} else {
$cid = $def_contact["id"];
- $network = NETWORK_DIASPORA;
+ $network = Protocol::DIASPORA;
}
return ["cid" => $cid, "network" => $network];
}
}
- if ($contact["network"] == NETWORK_DFRN) {
+ if ($contact["network"] == Protocol::DFRN) {
return str_replace("/profile/" . $contact["nick"] . "/", "/display/" . $guid, $contact["url"] . "/");
}
// change the technical stuff in contact and gcontact
$data = Probe::uri($new_handle);
- if ($data['network'] == NETWORK_PHANTOM) {
+ if ($data['network'] == Protocol::PHANTOM) {
logger('Account for '.$new_handle." couldn't be probed.");
return false;
}
DBA::update('contact', $fields, ['id' => $contact['id']]);
- $gcontact = ["url" => $contact["url"], "network" => NETWORK_DIASPORA, "generation" => 2,
+ $gcontact = ["url" => $contact["url"], "network" => Protocol::DIASPORA, "generation" => 2,
"photo" => $image_url, "name" => $name, "location" => $location,
"about" => $about, "birthday" => $birthday, "gender" => $gender,
"addr" => $author, "nick" => $nick, "keywords" => $keywords,
$ret = self::personByHandle($author);
- if (!$ret || ($ret["network"] != NETWORK_DIASPORA)) {
+ if (!$ret || ($ret["network"] != Protocol::DIASPORA)) {
logger("Cannot resolve diaspora handle ".$author." for ".$recipient);
return false;
}
$datarray["uid"] = $importer["uid"];
$datarray["contact-id"] = $contact["id"];
- $datarray["network"] = NETWORK_DIASPORA;
+ $datarray["network"] = Protocol::DIASPORA;
$datarray["author-link"] = $contact["url"];
$datarray["author-id"] = Contact::getIdForURL($contact["url"], 0);
$datarray["uid"] = $importer["uid"];
$datarray["contact-id"] = $contact["id"];
- $datarray["network"] = NETWORK_DIASPORA;
+ $datarray["network"] = Protocol::DIASPORA;
$datarray["author-link"] = $contact["url"];
$datarray["author-id"] = Contact::getIdForURL($contact["url"], 0);
if (!$no_queue && ($contact['contact-type'] != Contact::ACCOUNT_TYPE_RELAY)) {
logger("queue message");
// queue message for redelivery
- Queue::add($contact["id"], NETWORK_DIASPORA, $envelope, $public_batch, $guid);
+ Queue::add($contact["id"], Protocol::DIASPORA, $envelope, $public_batch, $guid);
}
// The message could not be delivered. We mark the contact as "dead"
$envelope = self::buildMessage($msg, $owner, $contact, $owner['uprvkey'], $contact['pubkey'], $public_batch);
if ($spool) {
- Queue::add($contact['id'], NETWORK_DIASPORA, $envelope, $public_batch, $guid);
+ Queue::add($contact['id'], Protocol::DIASPORA, $envelope, $public_batch, $guid);
return true;
} else {
$return_code = self::transmit($owner, $contact, $envelope, $public_batch, false, $guid);
}
if (($guid != "") && $complete) {
- $condition = ['guid' => $guid, 'network' => [NETWORK_DFRN, NETWORK_DIASPORA]];
+ $condition = ['guid' => $guid, 'network' => [Protocol::DFRN, Protocol::DIASPORA]];
$item = Item::selectFirst(['contact-id'], $condition);
if (DBA::isResult($item)) {
$ret= [];
$recips = q(
"SELECT `id`,`name`,`network`,`pubkey`,`notify` FROM `contact` WHERE `network` = '%s'
AND `uid` = %d AND `rel` != %d",
- DBA::escape(NETWORK_DIASPORA),
+ DBA::escape(Protocol::DIASPORA),
intval($uid),
intval(Contact::SHARING)
);