Now if you follow somebody it will create an abook entry on the other site with blocked,ignored, and pending set. No "friend notifications" yet.

This commit is contained in:
friendica 2012-11-29 18:15:13 -08:00
parent e138052584
commit 7082d198c2
6 changed files with 51 additions and 18 deletions

View File

@ -190,6 +190,7 @@ define ( 'ABOOK_FLAG_BLOCKED' , 0x0001);
define ( 'ABOOK_FLAG_IGNORED' , 0x0002);
define ( 'ABOOK_FLAG_HIDDEN' , 0x0004);
define ( 'ABOOK_FLAG_ARCHIVED' , 0x0008);
define ( 'ABOOK_FLAG_PENDING' , 0x0010);
define ( 'ABOOK_FLAG_SELF' , 0x0080);

View File

@ -42,7 +42,7 @@ require_once('include/html2plain.php');
* and ITEM_ID is the id of the item in the database that needs to be sent to others.
*
* ZOT
* permission_updated abook_id
* permission_update abook_id
* relay item_id (item was relayed to owner, we will deliver it as owner)
*
*/
@ -114,6 +114,8 @@ function notifier_run($argv, $argc){
}
}
}
return;
}

View File

@ -248,18 +248,38 @@ function zot_refresh($them,$channel = null) {
$their_perms = $their_perms | intval($global_perms[$k][1]);
}
}
$r = q("update abook set abook_their_perms = %d
where abook_xchan = '%s' and abook_channel = %d
and not (abook_flags & %d) limit 1",
intval($their_perms),
dbg(1);
$r = q("select * from abook where abook_xchan = '%s' and abook_channel = %d and not (abook_flags & %d) limit 1",
dbesc($x['hash']),
intval($channel['channel_id']),
intval(ABOOK_FLAG_SELF)
);
if(! $r)
logger('abook update failed');
if($r) {
$y = q("update abook set abook_their_perms = %d
where abook_xchan = '%s' and abook_channel = %d
and not (abook_flags & %d) limit 1",
intval($their_perms),
dbesc($x['hash']),
intval($channel['channel_id']),
intval(ABOOK_FLAG_SELF)
);
if(! $y)
logger('abook update failed');
}
else {
$y = q("insert into abook ( abook_account, abook_channel, abook_xchan, abook_their_perms, abook_created, abook_updated, abook_flags ) values ( %d, %d, '%s', %d, '%s', '%s', %d )",
intval($channel['channel_account_id']),
intval($channel['channel_id']),
dbesc($x['hash']),
intval($their_perms),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
intval(ABOOK_FLAG_BLOCKED|ABOOK_FLAG_IGNORED|ABOOK_FLAG_PENDING)
);
if($y)
logger("New introduction received for {$channel['channel_name']}");
}
dbg(0);
}
return true;

View File

@ -386,6 +386,7 @@ EOT;
'$header' => t('Contact Settings') . ' for ' . $contact['xchan_name'],
'$viewprof' => t('View Profile'),
'$lbl_slider' => t('Slide to adjust your degree of friendship'),
'$slide' => $slide,
'$tabs' => $t,
'$tab_str' => $tab_str,
@ -449,7 +450,7 @@ EOT;
$hidden = false;
$ignored = false;
$archived = false;
$unblocked = false;
$all = false;
$_SESSION['return_url'] = $a->query_string;
@ -479,10 +480,18 @@ EOT;
$search_flags = 0;
$all = true;
break;
}
$sql_extra = (($search_flags) ? " and ( abook_flags & " . $search_flags . " ) " : "");
}
else {
$sql_extra = " and not ( abook_flags & " . ABOOK_FLAG_BLOCKED . " ) ";
$unblocked = true;
}
$sql_extra = (($search_flags) ? "and ( abook_flags & " . $search_flags . " ) " : "");
$search = ((x($_REQUEST,'search')) ? notags(trim($_REQUEST['search'])) : '');
@ -504,7 +513,7 @@ EOT;
array(
'label' => t('Unblocked'),
'url' => $a->get_baseurl(true) . '/connections',
'sel' => ((! $all) && (! $blocked) && (! $hidden) && (! $search) && (! $nets) && (! $ignored) && (! $archived)) ? 'active' : '',
'sel' => (($unblocked) && (! $search) && (! $nets)) ? 'active' : '',
'title' => t('Only show unblocked connections'),
),
@ -561,7 +570,7 @@ EOT;
$a->set_pager_total($r[0]['total']);
$total = $r[0]['total'];
}
dbg(1);
$r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash
WHERE abook_channel = %d and not (abook_flags & %d) $sql_extra $sql_extra2 ORDER BY xchan_name LIMIT %d , %d ",
intval(local_user()),
@ -569,7 +578,7 @@ EOT;
intval($a->pager['start']),
intval($a->pager['itemspage'])
);
dbg(0);
$contacts = array();
if(count($r)) {

View File

@ -1 +1 @@
2012-11-28.153
2012-11-29.154

View File

@ -7,12 +7,13 @@ $tabs
</div>
<div id="contact-edit-wrapper">
<br />
<h3>Slide to adjust your degree of friendship</h3>
{{ if $slide }}
<h3>$lbl_slider</h3>
$slide
{{ endif }}
<h3>Permissions</h3>