aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/follow.php2
-rw-r--r--include/notifier.php9
-rw-r--r--include/zot.php2
-rw-r--r--mod/connedit.php5
4 files changed, 11 insertions, 7 deletions
diff --git a/include/follow.php b/include/follow.php
index ae0f9f041..40ad2c299 100644
--- a/include/follow.php
+++ b/include/follow.php
@@ -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']);
diff --git a/include/notifier.php b/include/notifier.php
index 2676f20d9..b7cea629d 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -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'];
diff --git a/include/zot.php b/include/zot.php
index 26baeddaf..02dab3617 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -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,
diff --git a/mod/connedit.php b/mod/connedit.php
index 75a5fd719..6170d05a8 100644
--- a/mod/connedit.php
+++ b/mod/connedit.php
@@ -190,7 +190,7 @@ function connedit_post(&$a) {
}
}
- $abook_pending = $new_friend ? 0 : $orig_record[0]['abook_pending'];
+ $abook_pending = (($new_friend) ? 0 : $orig_record[0]['abook_pending'];
$r = q("UPDATE abook SET abook_profile = '%s', abook_my_perms = %d , abook_closeness = %d, abook_pending = %d,
abook_incl = '%s', abook_excl = '%s'
@@ -214,7 +214,6 @@ function connedit_post(&$a) {
}
-
if($r)
info( t('Connection updated.') . EOL);
else
@@ -222,7 +221,7 @@ function connedit_post(&$a) {
if($a->poi && $a->poi['abook_my_perms'] != $abook_my_perms
&& (! intval($a->poi['abook_self']))) {
- proc_run('php', 'include/notifier.php', 'permission_update', $contact_id);
+ proc_run('php', 'include/notifier.php', (($new_friend) ? 'permission_create' : 'permission_update'), $contact_id);
}
if($new_friend) {