aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/onepoll.php7
-rw-r--r--include/poller.php9
-rw-r--r--include/zot.php15
3 files changed, 15 insertions, 16 deletions
diff --git a/include/onepoll.php b/include/onepoll.php
index a821b76cf..e81d8bcf7 100644
--- a/include/onepoll.php
+++ b/include/onepoll.php
@@ -29,19 +29,16 @@ function onepoll_run($argv, $argc){
return;
}
-
$d = datetime_convert();
-
$contacts = q("SELECT abook.*, xchan.*, account.*
FROM abook LEFT JOIN account on abook_account = account_id left join xchan on xchan_hash = abook_xchan
where abook_id = %d
- AND (( abook_flags = %d ) OR ( abook_flags = %d ) OR ( abook_flags & %d ))
+ AND (( abook_flags & %d ) OR ( abook_flags = %d ))
AND (( account_flags = %d ) OR ( account_flags = %d )) limit 1",
intval($contact_id),
- intval(ABOOK_FLAG_HIDDEN),
+ intval(ABOOK_FLAG_HIDDEN|ABOOK_FLAG_PENDING|ABOOK_FLAG_UNCONNECTED),
intval(0),
- intval(ABOOK_FLAG_PENDING),
intval(ACCOUNT_OK),
intval(ACCOUNT_UNVERIFIED)
);
diff --git a/include/poller.php b/include/poller.php
index 649da30f6..423ee46c1 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -184,9 +184,7 @@ function poller_run($argv, $argc){
if(! $restart)
proc_run('php','include/cronhooks.php');
- // Only poll from those with suitable relationships,
- // and which have a polling address and ignore Diaspora since
- // we are unable to match those posts with a Diaspora GUID and prevent duplicates.
+ // Only poll from those with suitable relationships
$abandon_sql = (($abandon_days)
? sprintf(" AND account_lastlog > UTC_TIMESTAMP() - INTERVAL %d DAY ", intval($abandon_days))
@@ -197,10 +195,9 @@ function poller_run($argv, $argc){
$contacts = q("SELECT abook_id, abook_flags, abook_updated, abook_connected, abook_closeness, abook_channel
FROM abook LEFT JOIN account on abook_account = account_id where 1
$sql_extra
- AND (( abook_flags = %d ) OR ( abook_flags = %d ))
+ AND (( abook_flags & %d ) OR ( abook_flags = %d ))
AND (( account_flags = %d ) OR ( account_flags = %d )) $abandon_sql ORDER BY RAND()",
-
- intval(ABOOK_FLAG_HIDDEN),
+ intval(ABOOK_FLAG_HIDDEN|ABOOK_FLAG_PENDING|ABOOK_FLAG_UNCONNECTED),
intval(0),
intval(ACCOUNT_OK),
intval(ACCOUNT_UNVERIFIED) // FIXME
diff --git a/include/zot.php b/include/zot.php
index e80dabed9..cfabbae2e 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -351,7 +351,10 @@ function zot_refresh($them,$channel = null, $force = false) {
intval(ABOOK_FLAG_SELF)
);
- if($r) {
+ if($r) {
+
+ $current_abook_connected = (($r[0]['abook_flags'] & ABOOK_FLAG_UNCONNECTED) ? 0 : 1);
+
$y = q("update abook set abook_their_perms = %d
where abook_xchan = '%s' and abook_channel = %d
and not (abook_flags & %d) limit 1",
@@ -360,14 +363,16 @@ function zot_refresh($them,$channel = null, $force = false) {
intval($channel['channel_id']),
intval(ABOOK_FLAG_SELF)
);
- if($connected_set === 0) {
- // if they are in your address book but you aren't in theirs, mark their address book entry hidden.
+ if(($connected_set === 0 || $connected_set === 1) && ($connected_set !== $current_abook_unconnected)) {
+
+ // if they are in your address book but you aren't in theirs, and/or this does not
+ // match your current connected state setting, toggle it.
- $y1 = q("update abook set abook_flags = (abook_flags | %d)
+ $y1 = q("update abook set abook_flags = (abook_flags ^ %d)
where abook_xchan = '%s' and abook_channel = %d
and not (abook_flags & %d) limit 1",
- intval(ABOOK_FLAG_HIDDEN),
+ intval(ABOOK_FLAG_UNCONNECTED),
dbesc($x['hash']),
intval($channel['channel_id']),
intval(ABOOK_FLAG_SELF)