separate permission_update notification into permission_create and permission_update, since some networks send out a notification for duplicate share requests even if connected.

This commit is contained in:
redmatrix
2015-10-18 20:13:12 -07:00
parent 9b3662e5ad
commit f0a33c00bc
4 changed files with 11 additions and 7 deletions

View File

@@ -261,7 +261,7 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
);
if($r) {
$result['abook'] = $r[0];
proc_run('php', 'include/notifier.php', 'permission_update', $result['abook']['abook_id']);
proc_run('php', 'include/notifier.php', 'permission_create', $result['abook']['abook_id']);
}
$arr = array('channel_id' => $uid, 'abook' => $result['abook']);

View File

@@ -108,7 +108,7 @@ function notifier_run($argv, $argc){
}
if($cmd == 'permission_update') {
if($cmd == 'permission_update' || $cmd == 'permission_create') {
// Get the recipient
$r = q("select abook.*, hubloc.* from abook
left join hubloc on hubloc_hash = abook_xchan
@@ -126,7 +126,12 @@ function notifier_run($argv, $argc){
);
if($s) {
$perm_update = array('sender' => $s[0], 'recipient' => $r[0], 'success' => false, 'deliveries' => '');
call_hooks('permissions_update',$perm_update);
if($cmd == 'permission_create'])
call_hooks('permissions_create',$perm_update);
else
call_hooks('permissions_update',$perm_update);
if($perm_update['success'] && $perm_update['deliveries'])
$deliveries[] = $perm_update['deliveries'];

View File

@@ -503,7 +503,7 @@ function zot_refresh($them, $channel = null, $force = false) {
if($new_connection) {
if($new_perms != $previous_perms)
proc_run('php','include/notifier.php','permission_update',$new_connection[0]['abook_id']);
proc_run('php','include/notifier.php','permission_create',$new_connection[0]['abook_id']);
require_once('include/enotify.php');
notification(array(
'type' => NOTIFY_INTRO,