change flags for one-way connections from hidden to unconnected so we can still use hidden for - well hiding connections
This commit is contained in:
parent
f2c8559170
commit
86d60f572f
1
boot.php
1
boot.php
@ -290,6 +290,7 @@ define ( 'ABOOK_FLAG_IGNORED' , 0x0002);
|
|||||||
define ( 'ABOOK_FLAG_HIDDEN' , 0x0004);
|
define ( 'ABOOK_FLAG_HIDDEN' , 0x0004);
|
||||||
define ( 'ABOOK_FLAG_ARCHIVED' , 0x0008);
|
define ( 'ABOOK_FLAG_ARCHIVED' , 0x0008);
|
||||||
define ( 'ABOOK_FLAG_PENDING' , 0x0010);
|
define ( 'ABOOK_FLAG_PENDING' , 0x0010);
|
||||||
|
define ( 'ABOOK_FLAG_UNCONNECTED', 0x0020);
|
||||||
define ( 'ABOOK_FLAG_SELF' , 0x0080);
|
define ( 'ABOOK_FLAG_SELF' , 0x0080);
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,19 +29,16 @@ function onepoll_run($argv, $argc){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$d = datetime_convert();
|
$d = datetime_convert();
|
||||||
|
|
||||||
|
|
||||||
$contacts = q("SELECT abook.*, xchan.*, account.*
|
$contacts = q("SELECT abook.*, xchan.*, account.*
|
||||||
FROM abook LEFT JOIN account on abook_account = account_id left join xchan on xchan_hash = abook_xchan
|
FROM abook LEFT JOIN account on abook_account = account_id left join xchan on xchan_hash = abook_xchan
|
||||||
where abook_id = %d
|
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",
|
AND (( account_flags = %d ) OR ( account_flags = %d )) limit 1",
|
||||||
intval($contact_id),
|
intval($contact_id),
|
||||||
intval(ABOOK_FLAG_HIDDEN),
|
intval(ABOOK_FLAG_HIDDEN|ABOOK_FLAG_PENDING|ABOOK_FLAG_UNCONNECTED),
|
||||||
intval(0),
|
intval(0),
|
||||||
intval(ABOOK_FLAG_PENDING),
|
|
||||||
intval(ACCOUNT_OK),
|
intval(ACCOUNT_OK),
|
||||||
intval(ACCOUNT_UNVERIFIED)
|
intval(ACCOUNT_UNVERIFIED)
|
||||||
);
|
);
|
||||||
|
@ -184,9 +184,7 @@ function poller_run($argv, $argc){
|
|||||||
if(! $restart)
|
if(! $restart)
|
||||||
proc_run('php','include/cronhooks.php');
|
proc_run('php','include/cronhooks.php');
|
||||||
|
|
||||||
// Only poll from those with suitable relationships,
|
// 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.
|
|
||||||
|
|
||||||
$abandon_sql = (($abandon_days)
|
$abandon_sql = (($abandon_days)
|
||||||
? sprintf(" AND account_lastlog > UTC_TIMESTAMP() - INTERVAL %d DAY ", intval($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
|
$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
|
FROM abook LEFT JOIN account on abook_account = account_id where 1
|
||||||
$sql_extra
|
$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()",
|
AND (( account_flags = %d ) OR ( account_flags = %d )) $abandon_sql ORDER BY RAND()",
|
||||||
|
intval(ABOOK_FLAG_HIDDEN|ABOOK_FLAG_PENDING|ABOOK_FLAG_UNCONNECTED),
|
||||||
intval(ABOOK_FLAG_HIDDEN),
|
|
||||||
intval(0),
|
intval(0),
|
||||||
intval(ACCOUNT_OK),
|
intval(ACCOUNT_OK),
|
||||||
intval(ACCOUNT_UNVERIFIED) // FIXME
|
intval(ACCOUNT_UNVERIFIED) // FIXME
|
||||||
|
@ -352,6 +352,9 @@ function zot_refresh($them,$channel = null, $force = false) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
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
|
$y = q("update abook set abook_their_perms = %d
|
||||||
where abook_xchan = '%s' and abook_channel = %d
|
where abook_xchan = '%s' and abook_channel = %d
|
||||||
and not (abook_flags & %d) limit 1",
|
and not (abook_flags & %d) limit 1",
|
||||||
@ -360,14 +363,16 @@ function zot_refresh($them,$channel = null, $force = false) {
|
|||||||
intval($channel['channel_id']),
|
intval($channel['channel_id']),
|
||||||
intval(ABOOK_FLAG_SELF)
|
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)) {
|
||||||
|
|
||||||
$y1 = q("update abook set abook_flags = (abook_flags | %d)
|
// 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)
|
||||||
where abook_xchan = '%s' and abook_channel = %d
|
where abook_xchan = '%s' and abook_channel = %d
|
||||||
and not (abook_flags & %d) limit 1",
|
and not (abook_flags & %d) limit 1",
|
||||||
intval(ABOOK_FLAG_HIDDEN),
|
intval(ABOOK_FLAG_UNCONNECTED),
|
||||||
dbesc($x['hash']),
|
dbesc($x['hash']),
|
||||||
intval($channel['channel_id']),
|
intval($channel['channel_id']),
|
||||||
intval(ABOOK_FLAG_SELF)
|
intval(ABOOK_FLAG_SELF)
|
||||||
|
@ -35,7 +35,7 @@ function connections_post(&$a) {
|
|||||||
|
|
||||||
if(! $orig_record) {
|
if(! $orig_record) {
|
||||||
notice( t('Could not access contact record.') . EOL);
|
notice( t('Could not access contact record.') . EOL);
|
||||||
goaway($a->get_baseurl(true) . '/connections');
|
goaway(z_root() . '/connections');
|
||||||
return; // NOTREACHED
|
return; // NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ function connections_content(&$a) {
|
|||||||
$archived = false;
|
$archived = false;
|
||||||
$unblocked = false;
|
$unblocked = false;
|
||||||
$pending = false;
|
$pending = false;
|
||||||
|
$unconnected = false;
|
||||||
$all = false;
|
$all = false;
|
||||||
|
|
||||||
$_SESSION['return_url'] = $a->query_string;
|
$_SESSION['return_url'] = $a->query_string;
|
||||||
@ -212,6 +212,11 @@ function connections_content(&$a) {
|
|||||||
$pending = true;
|
$pending = true;
|
||||||
nav_set_selected('intros');
|
nav_set_selected('intros');
|
||||||
break;
|
break;
|
||||||
|
case 'unconnected':
|
||||||
|
$search_flags = ABOOK_FLAG_UNCONNECTED;
|
||||||
|
$head = t('Unconnected');
|
||||||
|
$unconnected = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'all':
|
case 'all':
|
||||||
$head = t('All');
|
$head = t('All');
|
||||||
@ -237,57 +242,65 @@ function connections_content(&$a) {
|
|||||||
$tabs = array(
|
$tabs = array(
|
||||||
array(
|
array(
|
||||||
'label' => t('Suggestions'),
|
'label' => t('Suggestions'),
|
||||||
'url' => $a->get_baseurl(true) . '/suggest',
|
'url' => z_root() . '/suggest',
|
||||||
'sel' => '',
|
'sel' => '',
|
||||||
'title' => t('Suggest new connections'),
|
'title' => t('Suggest new connections'),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'label' => t('New Connections'),
|
'label' => t('New Connections'),
|
||||||
'url' => $a->get_baseurl(true) . '/connections/pending',
|
'url' => z_root() . '/connections/pending',
|
||||||
'sel' => ($pending) ? 'active' : '',
|
'sel' => ($pending) ? 'active' : '',
|
||||||
'title' => t('Show pending (new) connections'),
|
'title' => t('Show pending (new) connections'),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'label' => t('All Connections'),
|
'label' => t('All Connections'),
|
||||||
'url' => $a->get_baseurl(true) . '/connections/all',
|
'url' => z_root() . '/connections/all',
|
||||||
'sel' => ($all) ? 'active' : '',
|
'sel' => ($all) ? 'active' : '',
|
||||||
'title' => t('Show all connections'),
|
'title' => t('Show all connections'),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'label' => t('Unblocked'),
|
'label' => t('Unblocked'),
|
||||||
'url' => $a->get_baseurl(true) . '/connections',
|
'url' => z_root() . '/connections',
|
||||||
'sel' => (($unblocked) && (! $search) && (! $nets)) ? 'active' : '',
|
'sel' => (($unblocked) && (! $search) && (! $nets)) ? 'active' : '',
|
||||||
'title' => t('Only show unblocked connections'),
|
'title' => t('Only show unblocked connections'),
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'label' => t('Blocked'),
|
'label' => t('Blocked'),
|
||||||
'url' => $a->get_baseurl(true) . '/connections/blocked',
|
'url' => z_root() . '/connections/blocked',
|
||||||
'sel' => ($blocked) ? 'active' : '',
|
'sel' => ($blocked) ? 'active' : '',
|
||||||
'title' => t('Only show blocked connections'),
|
'title' => t('Only show blocked connections'),
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'label' => t('Ignored'),
|
'label' => t('Ignored'),
|
||||||
'url' => $a->get_baseurl(true) . '/connections/ignored',
|
'url' => z_root() . '/connections/ignored',
|
||||||
'sel' => ($ignored) ? 'active' : '',
|
'sel' => ($ignored) ? 'active' : '',
|
||||||
'title' => t('Only show ignored connections'),
|
'title' => t('Only show ignored connections'),
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'label' => t('Archived'),
|
'label' => t('Archived'),
|
||||||
'url' => $a->get_baseurl(true) . '/connections/archived',
|
'url' => z_root() . '/connections/archived',
|
||||||
'sel' => ($archived) ? 'active' : '',
|
'sel' => ($archived) ? 'active' : '',
|
||||||
'title' => t('Only show archived connections'),
|
'title' => t('Only show archived connections'),
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'label' => t('Hidden'),
|
'label' => t('Hidden'),
|
||||||
'url' => $a->get_baseurl(true) . '/connections/hidden',
|
'url' => z_root() . '/connections/hidden',
|
||||||
'sel' => ($hidden) ? 'active' : '',
|
'sel' => ($hidden) ? 'active' : '',
|
||||||
'title' => t('Only show hidden connections'),
|
'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');
|
$tab_tpl = get_markup_template('common_tabs.tpl');
|
||||||
|
Reference in New Issue
Block a user