$writeable = 1;
}
+ if($ret['network'] === NETWORK_DIASPORA)
+ $writeable = 1;
// check if we already have a contact
// the poll url is more reliable than the profile url, as we may have
if(count($r)) {
// update contact
- if($r[0]['rel'] == CONTACT_IS_FOLLOWER) {
+ if($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) {
q("UPDATE `contact` SET `rel` = %d , `readonly` = 0 WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval(CONTACT_IS_FRIEND),
intval($r[0]['id']),
}
}
else {
+
+ $new_relation = (($ret['network'] === NETWORK_MAIL) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING);
+ if($ret['network'] === NETWORK_DIASPORA)
+ $new_relation = CONTACT_IS_FOLLOWER;
+
// create contact record
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `addr`, `alias`, `notify`, `poll`, `name`, `nick`, `photo`, `network`, `rel`, `priority`,
`writable`, `blocked`, `readonly`, `pending` )
dbesc($ret['nick']),
dbesc($ret['photo']),
dbesc($ret['network']),
- intval(($ret['network'] === NETWORK_MAIL) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING),
+ intval($new_relation),
intval($ret['priority']),
intval($writeable)
);