mirror of
https://github.com/friendica/friendica
synced 2024-11-10 03:42:53 +00:00
Don't probe anymore, but ensure that we got good contact data
This commit is contained in:
parent
93fd04e381
commit
d7c477d0f4
2 changed files with 36 additions and 36 deletions
|
@ -944,21 +944,36 @@ class Contact extends BaseObject
|
|||
'name' => $data['name'],
|
||||
'nick' => $data['nick']];
|
||||
|
||||
// Only fill the pubkey if it was empty before. We have to prevent identity theft.
|
||||
if (!empty($contact['pubkey'])) {
|
||||
unset($contact['pubkey']);
|
||||
} else {
|
||||
$updated['pubkey'] = $data['pubkey'];
|
||||
}
|
||||
|
||||
if ($data['keywords'] != '') {
|
||||
$updated['keywords'] = $data['keywords'];
|
||||
}
|
||||
if ($data['location'] != '') {
|
||||
$updated['location'] = $data['location'];
|
||||
}
|
||||
if ($data['about'] != '') {
|
||||
$updated['about'] = $data['about'];
|
||||
|
||||
// Update the technical stuff as well - if filled
|
||||
if ($data['notify'] != '') {
|
||||
$updated['notify'] = $data['notify'];
|
||||
}
|
||||
if ($data['poll'] != '') {
|
||||
$updated['poll'] = $data['poll'];
|
||||
}
|
||||
if ($data['batch'] != '') {
|
||||
$updated['batch'] = $data['batch'];
|
||||
}
|
||||
if ($data['request'] != '') {
|
||||
$updated['request'] = $data['request'];
|
||||
}
|
||||
if ($data['confirm'] != '') {
|
||||
$updated['confirm'] = $data['confirm'];
|
||||
}
|
||||
if ($data['poco'] != '') {
|
||||
$updated['poco'] = $data['poco'];
|
||||
}
|
||||
|
||||
// Only fill the pubkey if it had been empty before. We have to prevent identity theft.
|
||||
if (empty($contact['pubkey'])) {
|
||||
$updated['pubkey'] = $data['pubkey'];
|
||||
}
|
||||
|
||||
if (($data["addr"] != $contact["addr"]) || ($data["alias"] != $contact["alias"])) {
|
||||
|
|
|
@ -164,10 +164,11 @@ class Notifier {
|
|||
if (!in_array($cmd, [Delivery::MAIL, Delivery::SUGGESTION, Delivery::RELOCATION])) {
|
||||
$parent = $items[0];
|
||||
|
||||
$thr_parent = q("SELECT `network`, `author-link`, `owner-link` FROM `item` WHERE `uri` = '%s' AND `uid` = %d",
|
||||
dbesc($target_item["thr-parent"]), intval($target_item["uid"]));
|
||||
$fields = ['network', 'author-id', 'owner-id'];
|
||||
$condition = ['uri' => $target_item["thr-parent"], 'uid' => $target_item["uid"]];
|
||||
$thr_parent = dba::selectFirst('item', $fields, $condition);
|
||||
|
||||
logger('GUID: '.$target_item["guid"].': Parent is '.$parent['network'].'. Thread parent is '.$thr_parent[0]['network'], LOGGER_DEBUG);
|
||||
logger('GUID: '.$target_item["guid"].': Parent is '.$parent['network'].'. Thread parent is '.$thr_parent['network'], LOGGER_DEBUG);
|
||||
|
||||
// This is IMPORTANT!!!!
|
||||
|
||||
|
@ -213,7 +214,7 @@ class Notifier {
|
|||
}
|
||||
|
||||
// Special treatment for forum posts
|
||||
if (($target_item['author-link'] != $target_item['owner-link']) &&
|
||||
if (($target_item['author-id'] != $target_item['owner-id']) &&
|
||||
($owner['id'] != $target_item['contact-id']) &&
|
||||
($target_item['uri'] === $target_item['parent-uri'])) {
|
||||
|
||||
|
@ -247,7 +248,7 @@ class Notifier {
|
|||
$target_item['deny_cid'].$target_item['deny_gid']) == 0))
|
||||
$push_notify = true;
|
||||
|
||||
if (($thr_parent && ($thr_parent[0]['network'] == NETWORK_OSTATUS)) || ($parent['network'] == NETWORK_OSTATUS)) {
|
||||
if (($thr_parent && ($thr_parent['network'] == NETWORK_OSTATUS)) || ($parent['network'] == NETWORK_OSTATUS)) {
|
||||
$push_notify = true;
|
||||
|
||||
if ($parent["network"] == NETWORK_OSTATUS) {
|
||||
|
@ -333,37 +334,21 @@ class Notifier {
|
|||
|
||||
// If the thread parent is OStatus then do some magic to distribute the messages.
|
||||
// We have not only to look at the parent, since it could be a Friendica thread.
|
||||
if (($thr_parent && ($thr_parent[0]['network'] == NETWORK_OSTATUS)) || ($parent['network'] == NETWORK_OSTATUS)) {
|
||||
if (($thr_parent && ($thr_parent['network'] == NETWORK_OSTATUS)) || ($parent['network'] == NETWORK_OSTATUS)) {
|
||||
$diaspora_delivery = false;
|
||||
|
||||
logger('Some parent is OStatus for '.$target_item["guid"]." - Author: ".$thr_parent[0]['author-link']." - Owner: ".$thr_parent[0]['owner-link'], LOGGER_DEBUG);
|
||||
logger('Some parent is OStatus for '.$target_item["guid"]." - Author: ".$thr_parent['author-id']." - Owner: ".$thr_parent['owner-id'], LOGGER_DEBUG);
|
||||
|
||||
// Send a salmon to the parent author
|
||||
$r = q("SELECT `url`, `notify` FROM `contact` WHERE `nurl`='%s' AND `uid` IN (0, %d) AND `notify` != ''",
|
||||
dbesc(normalise_link($thr_parent[0]['author-link'])),
|
||||
intval($uid));
|
||||
if (DBM::is_result($r)) {
|
||||
$probed_contact = $r[0];
|
||||
} else {
|
||||
$probed_contact = Probe::uri($thr_parent[0]['author-link']);
|
||||
}
|
||||
|
||||
if ($probed_contact["notify"] != "") {
|
||||
$probed_contact = dba::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['author-id']]);
|
||||
if (DBM::is_result($probed_contact) && !empty($probed_contact["notify"])) {
|
||||
logger('Notify parent author '.$probed_contact["url"].': '.$probed_contact["notify"]);
|
||||
$url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
|
||||
}
|
||||
|
||||
// Send a salmon to the parent owner
|
||||
$r = q("SELECT `url`, `notify` FROM `contact` WHERE `nurl`='%s' AND `uid` IN (0, %d) AND `notify` != ''",
|
||||
dbesc(normalise_link($thr_parent[0]['owner-link'])),
|
||||
intval($uid));
|
||||
if (DBM::is_result($r)) {
|
||||
$probed_contact = $r[0];
|
||||
} else {
|
||||
$probed_contact = Probe::uri($thr_parent[0]['owner-link']);
|
||||
}
|
||||
|
||||
if ($probed_contact["notify"] != "") {
|
||||
$probed_contact = dba::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['owner-id']]);
|
||||
if (DBM::is_result($probed_contact) && !empty($probed_contact["notify"])) {
|
||||
logger('Notify parent owner '.$probed_contact["url"].': '.$probed_contact["notify"]);
|
||||
$url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue