use Friendica\Model\Contact;
use Friendica\Model\Item;
use Friendica\Model\User;
-use Friendica\Network\HTTPRequest;
use Friendica\Protocol\Activity;
use Friendica\Protocol\ActivityPub;
use Friendica\Protocol\Email;
use Friendica\Protocol\Feed;
-use Friendica\Protocol\PortableContact;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Strings;
use Friendica\Util\XML;
return;
}
- if (($contact['network'] != Protocol::MAIL) || $force) {
- Contact::updateFromProbe($contact_id, '', $force);
+ if (($contact['network'] != Protocol::MAIL) && $force) {
+ Contact::updateFromProbe($contact_id);
}
// Special treatment for wrongly detected local contacts
if (!$force && ($contact['network'] != Protocol::DFRN) && Contact::isLocalById($contact_id)) {
- Contact::updateFromProbe($contact_id, Protocol::DFRN, true);
+ Contact::updateFromProbe($contact_id, Protocol::DFRN);
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
}
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
}
- // load current friends if possible.
- if (!empty($contact['poco']) && !$contact['failed']) {
- if (!DBA::exists('glink', ["`cid` = ? AND updated > UTC_TIMESTAMP() - INTERVAL 1 DAY", $contact['id']])) {
- PortableContact::loadWorker($contact['id'], $importer_uid, 0, $contact['poco']);
- }
- }
-
// Don't poll if polling is deactivated (But we poll feeds and mails anyway)
if (!in_array($protocol, [Protocol::FEED, Protocol::MAIL]) && DI::config()->get('system', 'disable_polling')) {
Logger::log('Polling is disabled');
return;
}
+ // Don't poll local contacts
+ if (User::getIdForURL($contact['url'])) {
+ Logger::info('Local contacts are not polled', ['id' => $contact['id']]);
+
+ // set the last-update so we don't keep polling
+ DBA::update('contact', ['last-update' => $updated], ['id' => $contact['id']]);
+ return;
+ }
+
// We don't poll AP contacts by now
if ($protocol === Protocol::ACTIVITYPUB) {
Logger::log("Don't poll AP contact");
. '&type=data&last_update=' . $last_update
. '&perm=' . $perm;
- $curlResult = HTTPRequest::curl($url);
+ $curlResult = DI::httpRequest()->get($url);
if (!$curlResult->isSuccess() && ($curlResult->getErrorNumber() == CURLE_OPERATION_TIMEDOUT)) {
// set the last-update so we don't keep polling
$postvars['dfrn_version'] = DFRN_PROTOCOL_VERSION;
$postvars['perm'] = 'rw';
- return HTTPRequest::post($contact['poll'], $postvars)->getBody();
+ return DI::httpRequest()->post($contact['poll'], $postvars)->getBody();
}
/**
}
$cookiejar = tempnam(get_temppath(), 'cookiejar-onepoll-');
- $curlResult = HTTPRequest::curl($contact['poll'], false, ['cookiejar' => $cookiejar]);
+ $curlResult = DI::httpRequest()->get($contact['poll'], false, ['cookiejar' => $cookiejar]);
unlink($cookiejar);
if ($curlResult->isTimeout()) {
Logger::log("Mail: no mails for ".$mailconf['user']);
}
+ self::updateContact($contact, ['failed' => false, 'last-update' => $updated, 'success_update' => $updated]);
+ Contact::unmarkForArchival($contact);
+
Logger::log("Mail: closing connection for ".$mailconf['user']);
imap_close($mbox);
}
DBA::update('contact', ['hub-verify' => $verify_token], ['id' => $contact['id']]);
}
- $postResult = HTTPRequest::post($url, $params);
+ $postResult = DI::httpRequest()->post($url, $params);
Logger::log('subscribe_to_hub: returns: ' . $postResult->getReturnCode(), Logger::DEBUG);