From 64e343ed4ba8c9de97dea4adba082b475cb6ad02 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 12 Apr 2015 10:32:02 +0200 Subject: [PATCH] Some refinement to the contact update --- mod/contacts.php | 10 ++++++++-- mod/crepair.php | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/mod/contacts.php b/mod/contacts.php index 2e70c9ab88..5d40ff9940 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -211,12 +211,16 @@ function _contact_update($contact_id) { } function _contact_update_profile($contact_id) { - $r = q("SELECT `url` FROM `contact` WHERE `id` = %d", intval($contact_id)); + $r = q("SELECT `url`, `network` FROM `contact` WHERE `id` = %d", intval($contact_id)); if (!$r) return; $data = probe_url($r[0]["url"]); + // "Feed" is mostly a sign of communication problems + if (($data["network"] == NETWORK_FEED) AND ($data["network"] != $r[0]["network"])) + return; + $updatefields = array("name", "nick", "url", "addr", "batch", "notify", "poll", "request", "confirm", "poco", "network", "alias", "pubkey"); $update = array(); @@ -225,6 +229,8 @@ function _contact_update_profile($contact_id) { if (isset($data[$field]) AND ($data[$field] != "")) $update[$field] = $data[$field]; + $update["nurl"] = normalise_link($data["url"]); + $query = ""; if (isset($data["priority"]) AND ($data["priority"] != 0)) @@ -344,7 +350,7 @@ function contacts_content(&$a) { if($cmd === 'updateprofile') { _contact_update_profile($contact_id); - goaway($a->get_baseurl(true) . '/contacts/' . $contact_id); + goaway($a->get_baseurl(true) . '/crepair/' . $contact_id); // NOTREACHED } diff --git a/mod/crepair.php b/mod/crepair.php index 670143d35f..55231faf7d 100644 --- a/mod/crepair.php +++ b/mod/crepair.php @@ -165,7 +165,7 @@ function crepair_content(&$a) { $tpl = get_markup_template('crepair.tpl'); $o .= replace_macros($tpl, array( '$update_profile' => update_profile, - '$udprofilenow' => t('Update profile now'), + '$udprofilenow' => t('Refetch contact data'), '$label_name' => t('Name'), '$label_nick' => t('Account Nickname'), '$label_attag' => t('@Tagname - overrides Name/Nickname'),