$users = q("SELECT `url`, `created`, `updated`, `last_failure`, `last_contact`, `server_url` FROM `gcontact`
WHERE `last_contact` < UTC_TIMESTAMP - INTERVAL 1 MONTH AND
`last_failure` < UTC_TIMESTAMP - INTERVAL 1 MONTH AND
- `network` IN ('%s', '%s', '%s') ORDER BY rand()",
- dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS));
+ `network` IN ('%s', '%s', '%s', '%s', '') ORDER BY rand()",
+ dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA),
+ dbesc(NETWORK_OSTATUS), dbesc(NETWORK_FEED));
if (!$users)
return;
if (!isset($urlparts["scheme"]))
return $gcid;
- if (in_array($urlparts["host"], array("facebook.com", "twitter.com", "www.twitter-rss.com",
+ if (in_array($urlparts["host"], array("www.facebook.com", "facebook.com", "twitter.com",
"identi.ca", "alpha.app.net")))
return $gcid;
q("UPDATE `gcontact` SET `created` = '%s' WHERE `nurl` = '%s'",
dbesc(datetime_convert()), dbesc(normalise_link($profile)));
+ $urlparts = parse_url($profile);
+ if (!isset($urlparts["scheme"]))
+ return;
+
+ if (in_array($urlparts["host"], array("www.facebook.com", "facebook.com", "twitter.com",
+ "identi.ca", "alpha.app.net"))) {
+ q("UPDATE `gcontact` SET `network` = '%s' WHERE `nurl` = '%s'",
+ dbesc(NETWORK_PHANTOM), dbesc(normalise_link($profile)));
+ return;
+ }
+
if ($gcontacts[0]["server_url"] != "")
$server_url = $gcontacts[0]["server_url"];
else
$server_url = poco_detect_server($profile);
- if ($server_url != "")
+ if ($server_url != "") {
if (!poco_check_server($server_url, $gcontacts[0]["network"]))
return false;
+ q("UPDATE `gcontact` SET `server_url` = '%s' WHERE `nurl` = '%s'",
+ dbesc($server_url), dbesc(normalise_link($profile)));
+ }
+
+ if (in_array($gcontacts[0]["network"], array("", NETWORK_FEED))) {
+ $server = q("SELECT `network` FROM `gserver` WHERE `nurl` = '%s' AND `network` != ''",
+ dbesc(normalise_link($server_url)));
+
+ if ($server)
+ q("UPDATE `gcontact` SET `network` = '%s' WHERE `nurl` = '%s'",
+ dbesc($server[0]["network"]), dbesc(normalise_link($profile)));
+ else
+ return;
+ }
+
// noscrape is really fast so we don't cache the call.
if (($gcontacts[0]["server_url"] != "") AND ($gcontacts[0]["nick"] != "")) {