use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
$dfrn_confirm = $contact['confirm'];
$aes_allow = $contact['aes_allow'];
- $network = ((strlen($contact['issued-id'])) ? NETWORK_DFRN : NETWORK_OSTATUS);
+ $network = ((strlen($contact['issued-id'])) ? Protocol::DFRN : Protocol::OSTATUS);
if ($contact['network']) {
$network = $contact['network'];
}
- if ($network === NETWORK_DFRN) {
+ if ($network === Protocol::DFRN) {
/*
* Generate a key pair for all further communications with this person.
* We have a keypair for every contact, and a site key for unknown people.
$params['duplex'] = 1;
}
- if ($user['page-flags'] == PAGE_COMMUNITY) {
+ if ($user['page-flags'] == Contact::PAGE_COMMUNITY) {
$params['page'] = 1;
}
- if ($user['page-flags'] == PAGE_PRVGROUP) {
+ if ($user['page-flags'] == Contact::PAGE_PRVGROUP) {
$params['page'] = 2;
}
if (stristr($res, "<status") === false) {
// wrong xml! stop here!
+ logger('Unexpected response posting to ' . $dfrn_confirm);
notice(L10n::t('Unexpected response from remote site: ') . EOL . htmlspecialchars($res) . EOL);
return;
}
logger('dfrn_confirm: confirm - imported photos');
- if ($network === NETWORK_DFRN) {
- $new_relation = CONTACT_IS_FOLLOWER;
- if (($relation == CONTACT_IS_SHARING) || ($duplex)) {
- $new_relation = CONTACT_IS_FRIEND;
+ if ($network === Protocol::DFRN) {
+ $new_relation = Contact::FOLLOWER;
+
+ if (($relation == Contact::SHARING) || ($duplex)) {
+ $new_relation = Contact::FRIEND;
}
- if (($relation == CONTACT_IS_SHARING) && ($duplex)) {
+ if (($relation == Contact::SHARING) && ($duplex)) {
$duplex = 0;
}
DBA::escape(DateTimeFormat::utcNow()),
intval($duplex),
intval($hidden),
- DBA::escape(NETWORK_DFRN),
+ DBA::escape(Protocol::DFRN),
intval($contact_id)
);
} else {
- // $network !== NETWORK_DFRN
- $network = defaults($contact, 'network', NETWORK_OSTATUS);
+ // $network !== Protocol::DFRN
+ $network = defaults($contact, 'network', Protocol::OSTATUS);
$arr = Probe::uri($contact['url']);
$new_relation = $contact['rel'];
$writable = $contact['writable'];
- if ($network === NETWORK_DIASPORA) {
+ if ($network === Protocol::DIASPORA) {
if ($duplex) {
- $new_relation = CONTACT_IS_FRIEND;
+ $new_relation = Contact::FRIEND;
} else {
- $new_relation = CONTACT_IS_FOLLOWER;
+ $new_relation = Contact::FOLLOWER;
}
- if ($new_relation != CONTACT_IS_FOLLOWER) {
+ if ($new_relation != Contact::FOLLOWER) {
$writable = 1;
}
}
// reload contact info
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
- if ((isset($new_relation) && $new_relation == CONTACT_IS_FRIEND)) {
- if (DBA::isResult($contact) && ($contact['network'] === NETWORK_DIASPORA)) {
+ if ((isset($new_relation) && $new_relation == Contact::FRIEND)) {
+ if (DBA::isResult($contact) && ($contact['network'] === Protocol::DIASPORA)) {
$ret = Diaspora::sendShare($user, $contact);
logger('share returns: ' . $ret);
}
logger('dfrn_confirm: request - photos imported');
- $new_relation = CONTACT_IS_SHARING;
- if (($relation == CONTACT_IS_FOLLOWER) || ($duplex)) {
- $new_relation = CONTACT_IS_FRIEND;
+ $new_relation = Contact::SHARING;
+
+ if (($relation == Contact::FOLLOWER) || ($duplex)) {
+ $new_relation = Contact::FRIEND;
}
- if (($relation == CONTACT_IS_FOLLOWER) && ($duplex)) {
+ if (($relation == Contact::FOLLOWER) && ($duplex)) {
$duplex = 0;
}
intval($duplex),
intval($forum),
intval($prv),
- DBA::escape(NETWORK_DFRN),
+ DBA::escape(Protocol::DFRN),
intval($dfrn_record)
);
if (!DBA::isResult($r)) { // indicates schema is messed up or total db failure
$combined = $r[0];
if ($combined['notify-flags'] & NOTIFY_CONFIRM) {
- $mutual = ($new_relation == CONTACT_IS_FRIEND);
+ $mutual = ($new_relation == Contact::FRIEND);
notification([
'type' => NOTIFY_CONFIRM,
'notify_flags' => $combined['notify-flags'],