aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-03-04 14:35:42 -0800
committerfriendica <info@friendica.com>2014-03-04 14:35:42 -0800
commit86d60f572f6accb086f7cd4271ababde2c5d3669 (patch)
tree4db82a891da7b73be248f083770716cb3f1099f5
parentf2c8559170f7271a60df624d4222a2bc88435687 (diff)
downloadvolse-hubzilla-86d60f572f6accb086f7cd4271ababde2c5d3669.tar.gz
volse-hubzilla-86d60f572f6accb086f7cd4271ababde2c5d3669.tar.bz2
volse-hubzilla-86d60f572f6accb086f7cd4271ababde2c5d3669.zip
change flags for one-way connections from hidden to unconnected so we can still use hidden for - well hiding connections
-rwxr-xr-xboot.php1
-rw-r--r--include/onepoll.php7
-rw-r--r--include/poller.php9
-rw-r--r--include/zot.php15
-rw-r--r--mod/connections.php47
5 files changed, 46 insertions, 33 deletions
diff --git a/boot.php b/boot.php
index 19d79941c..863085526 100755
--- a/boot.php
+++ b/boot.php
@@ -290,6 +290,7 @@ define ( 'ABOOK_FLAG_IGNORED' , 0x0002);
define ( 'ABOOK_FLAG_HIDDEN' , 0x0004);
define ( 'ABOOK_FLAG_ARCHIVED' , 0x0008);
define ( 'ABOOK_FLAG_PENDING' , 0x0010);
+define ( 'ABOOK_FLAG_UNCONNECTED', 0x0020);
define ( 'ABOOK_FLAG_SELF' , 0x0080);
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)
diff --git a/mod/connections.php b/mod/connections.php
index 679b6d79d..dbdcbdc93 100644
--- a/mod/connections.php
+++ b/mod/connections.php
@@ -35,7 +35,7 @@ function connections_post(&$a) {
if(! $orig_record) {
notice( t('Could not access contact record.') . EOL);
- goaway($a->get_baseurl(true) . '/connections');
+ goaway(z_root() . '/connections');
return; // NOTREACHED
}
@@ -170,14 +170,14 @@ function connections_content(&$a) {
return login();
}
- $blocked = false;
- $hidden = false;
- $ignored = false;
- $archived = false;
- $unblocked = false;
- $pending = false;
-
- $all = false;
+ $blocked = false;
+ $hidden = false;
+ $ignored = false;
+ $archived = false;
+ $unblocked = false;
+ $pending = false;
+ $unconnected = false;
+ $all = false;
$_SESSION['return_url'] = $a->query_string;
@@ -212,6 +212,11 @@ function connections_content(&$a) {
$pending = true;
nav_set_selected('intros');
break;
+ case 'unconnected':
+ $search_flags = ABOOK_FLAG_UNCONNECTED;
+ $head = t('Unconnected');
+ $unconnected = true;
+ break;
case 'all':
$head = t('All');
@@ -237,57 +242,65 @@ function connections_content(&$a) {
$tabs = array(
array(
'label' => t('Suggestions'),
- 'url' => $a->get_baseurl(true) . '/suggest',
+ 'url' => z_root() . '/suggest',
'sel' => '',
'title' => t('Suggest new connections'),
),
array(
'label' => t('New Connections'),
- 'url' => $a->get_baseurl(true) . '/connections/pending',
+ 'url' => z_root() . '/connections/pending',
'sel' => ($pending) ? 'active' : '',
'title' => t('Show pending (new) connections'),
),
array(
'label' => t('All Connections'),
- 'url' => $a->get_baseurl(true) . '/connections/all',
+ 'url' => z_root() . '/connections/all',
'sel' => ($all) ? 'active' : '',
'title' => t('Show all connections'),
),
array(
'label' => t('Unblocked'),
- 'url' => $a->get_baseurl(true) . '/connections',
+ 'url' => z_root() . '/connections',
'sel' => (($unblocked) && (! $search) && (! $nets)) ? 'active' : '',
'title' => t('Only show unblocked connections'),
),
array(
'label' => t('Blocked'),
- 'url' => $a->get_baseurl(true) . '/connections/blocked',
+ 'url' => z_root() . '/connections/blocked',
'sel' => ($blocked) ? 'active' : '',
'title' => t('Only show blocked connections'),
),
array(
'label' => t('Ignored'),
- 'url' => $a->get_baseurl(true) . '/connections/ignored',
+ 'url' => z_root() . '/connections/ignored',
'sel' => ($ignored) ? 'active' : '',
'title' => t('Only show ignored connections'),
),
array(
'label' => t('Archived'),
- 'url' => $a->get_baseurl(true) . '/connections/archived',
+ 'url' => z_root() . '/connections/archived',
'sel' => ($archived) ? 'active' : '',
'title' => t('Only show archived connections'),
),
array(
'label' => t('Hidden'),
- 'url' => $a->get_baseurl(true) . '/connections/hidden',
+ 'url' => z_root() . '/connections/hidden',
'sel' => ($hidden) ? 'active' : '',
'title' => t('Only show hidden connections'),
),
+ array(
+ 'label' => t('Unconnected'),
+ 'url' => z_root() . '/connections/unconnected',
+ 'sel' => ($unconnected) ? 'active' : '',
+ 'title' => t('Only show one-way connections'),
+ ),
+
+
);
$tab_tpl = get_markup_template('common_tabs.tpl');