diff options
author | Haakon Meland Eriksen <haakon.eriksen@far.no> | 2015-09-20 21:29:41 +0200 |
---|---|---|
committer | Haakon Meland Eriksen <haakon.eriksen@far.no> | 2015-09-20 21:29:41 +0200 |
commit | 099f236f45b30391ae0fa13ef067309ae2b2ddbc (patch) | |
tree | 0abb523482648ad2e33b43f74a154de306b62a5c | |
parent | 5a7e8d8520601b3c08ef15c520da19d05b31d23b (diff) | |
parent | 996cd7e2aba37ce2c4613753a68552c92dcb9be9 (diff) | |
download | volse-hubzilla-099f236f45b30391ae0fa13ef067309ae2b2ddbc.tar.gz volse-hubzilla-099f236f45b30391ae0fa13ef067309ae2b2ddbc.tar.bz2 volse-hubzilla-099f236f45b30391ae0fa13ef067309ae2b2ddbc.zip |
Merge remote-tracking branch 'upstream/master'
-rw-r--r-- | include/DReport.php | 46 | ||||
-rw-r--r-- | include/zot.php | 36 | ||||
-rw-r--r-- | version.inc | 2 |
3 files changed, 66 insertions, 18 deletions
diff --git a/include/DReport.php b/include/DReport.php new file mode 100644 index 000000000..6c7bf354a --- /dev/null +++ b/include/DReport.php @@ -0,0 +1,46 @@ +<?php + + +class DReport { + + private $location; + private $sender; + private $recipient; + private $message_id; + private $status; + private $date; + + function __construct($location,$sender,$recipient,$message_id,$status = 'deliver') { + $this->location = $location; + $this->sender = $sender; + $this->recipient = $recipient; + $this->message_id = $message_id; + $this->status = $status; + $this->date = datetime_convert(); + } + + function update($status) { + $this->status = $status; + $this->date = datetime_convert(); + } + + function set($arr) { + $this->location = $arr['location']; + $this->sender = $arr['sender']; + $this->recipient = $arr['recipient']; + $this->message_id = $arr['message_id']; + $this->status = $arr['status']; + $this->date = $arr['date']; + } + + function get() { + return array( + 'location' => $this->location, + 'sender' => $this->sender, + 'recipient' => $this->recipient, + 'message_id' => $this->message_id, + 'status' => $this->status, + 'date' => $this->date + ); + } +} diff --git a/include/zot.php b/include/zot.php index 6c5a8c289..f6816ee7c 100644 --- a/include/zot.php +++ b/include/zot.php @@ -487,20 +487,17 @@ function zot_refresh($them, $channel = null, $force = false) { if($y) { logger("New introduction received for {$channel['channel_name']}"); $new_perms = get_all_perms($channel['channel_id'],$x['hash']); - if($new_perms != $previous_perms) { - // Send back a permissions update if permissions have changed - $z = q("select * from abook where abook_xchan = '%s' and abook_channel = %d and abook_self = 0 limit 1", - dbesc($x['hash']), - intval($channel['channel_id']) - ); - if($z) - proc_run('php','include/notifier.php','permission_update',$z[0]['abook_id']); - } - $new_connection = q("select abook_id, abook_pending from abook where abook_channel = %d and abook_xchan = '%s' order by abook_created desc limit 1", - intval($channel['channel_id']), - dbesc($x['hash']) + + // Send a clone sync packet and a permissions update if permissions have changed + + $new_connection = q("select * from abook where abook_xchan = '%s' and abook_channel = %d and abook_self = 0 order by abook_created desc limit 1", + dbesc($x['hash']), + intval($channel['channel_id']) ); + if($new_connection) { + if($new_perms != $previous_perms) + proc_run('php','include/notifier.php','permission_update',$new_connection[0]['abook_id']); require_once('include/enotify.php'); notification(array( 'type' => NOTIFY_INTRO, @@ -508,12 +505,17 @@ function zot_refresh($them, $channel = null, $force = false) { 'to_xchan' => $channel['channel_hash'], 'link' => z_root() . '/connedit/' . $new_connection[0]['abook_id'], )); - } + + if($their_perms & PERMS_R_STREAM) { + if(($channel['channel_w_stream'] & PERMS_PENDING) + || (! intval($new_connection[0]['abook_pending'])) ) + proc_run('php','include/onepoll.php',$new_connection[0]['abook_id']); + } - if($new_connection && ($their_perms & PERMS_R_STREAM)) { - if(($channel['channel_w_stream'] & PERMS_PENDING) - || (! intval($new_connection[0]['abook_pending'])) ) - proc_run('php','include/onepoll.php',$new_connection[0]['abook_id']); + unset($new_connection[0]['abook_id']); + unset($new_connection[0]['abook_account']); + unset($new_connection[0]['abook_channel']); + build_sync_packet($channel['channel_id'], array('abook' => $new_connection)); } } } diff --git a/version.inc b/version.inc index 2d7153d51..e412e1495 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2015-09-18.1159 +2015-09-20.1161 |