if(is_null($db)) {
@include(".htconfig.php");
- require_once("dba.php");
+ require_once("include/dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
};
load_hooks();
logger('onepoll: start');
-
+
$manual_id = 0;
$generation = 0;
$hub_update = false;
logger('onepoll: no contact');
return;
}
-
+
+ // Test
+ $lockpath = get_config('system','lockpath');
+ if ($lockpath != '') {
+ $pidfile = new pidfile($lockpath, 'onepoll'.$contact_id.'.lck');
+ if($pidfile->is_already_running()) {
+ logger("onepoll: Already running for contact ".$contact_id);
+ exit;
+ }
+ }
+
$d = datetime_convert();
$stat_writeable = ((($contact['notify']) && ($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['rel'] == CONTACT_IS_FRIEND)) ? 1 : 0);
+ if($contact['network'] === NETWORK_OSTATUS && get_pconfig($importer_uid,'system','ostatus_autofriend'))
+ $stat_writeable = 1;
+
if($stat_writeable != $contact['writable']) {
q("UPDATE `contact` SET `writable` = %d WHERE `id` = %d LIMIT 1",
intval($stat_writeable),
);
if(count($r)) {
- logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user'],LOGGER_DEBUG);
- if($meta->deleted && ! $r[0]['deleted']) {
- q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `id` = %d LIMIT 1",
- dbesc(datetime_convert()),
- intval($r[0]['id'])
- );
- }
+ logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],LOGGER_DEBUG);
+
+ // Only delete when mails aren't automatically moved or deleted
+ if (($mailconf[0]['action'] != 1) AND ($mailconf[0]['action'] != 3))
+ if($meta->deleted && ! $r[0]['deleted']) {
+ q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `id` = %d LIMIT 1",
+ dbesc(datetime_convert()),
+ intval($r[0]['id'])
+ );
+ }
+
switch ($mailconf[0]['action']) {
case 0:
logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user'].". Doing nothing.", LOGGER_DEBUG);
continue;
}
$datarray['body'] = escape_tags($r['body']);
+ $datarray['body'] = limit_body_size($datarray['body']);
logger("Mail: Importing ".$msg_uid." for ".$mailconf[0]['user']);
if($contact['network'] === NETWORK_DFRN || $contact['blocked'] || $contact['readonly'])
$hubmode = 'unsubscribe';
- if($contact['network'] === NETWORK_OSTATUS && (! $contact['hub-verify']))
+ if(($contact['network'] === NETWORK_OSTATUS || $contact['network'] == NETWORK_FEED) && (! $contact['hub-verify']))
$hub_update = true;
- if((strlen($hub)) && ($hub_update) && ($contact['rel'] != CONTACT_IS_FOLLOWER)) {
+ if((strlen($hub)) && ($hub_update) && (($contact['rel'] != CONTACT_IS_FOLLOWER) || $contact['network'] == NETWORK_FEED) ) {
logger('poller: hub ' . $hubmode . ' : ' . $hub . ' contact name : ' . $contact['name'] . ' local user : ' . $importer['name']);
$hubs = explode(',', $hub);
if(count($hubs)) {