diff options
author | friendica <info@friendica.com> | 2012-11-19 16:51:15 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-11-19 16:51:15 -0800 |
commit | 194ef02c287edbce6b797f1411afe0bb964e8c80 (patch) | |
tree | cfb80e3bc0cb356952e2ac8d1320d1cb72ff5fd3 /mod | |
parent | db77309bc399669c5c98f4fac99f2d5f96cfbaeb (diff) | |
download | volse-hubzilla-194ef02c287edbce6b797f1411afe0bb964e8c80.tar.gz volse-hubzilla-194ef02c287edbce6b797f1411afe0bb964e8c80.tar.bz2 volse-hubzilla-194ef02c287edbce6b797f1411afe0bb964e8c80.zip |
DATABASE: outq additions, delivery now getting the notify across to the other side
Diffstat (limited to 'mod')
-rw-r--r-- | mod/post.php | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/mod/post.php b/mod/post.php index f84b641ca..320e9fdd9 100644 --- a/mod/post.php +++ b/mod/post.php @@ -15,23 +15,25 @@ function post_post(&$a) { if(array_key_exists('iv',$_REQUEST)) { // hush-hush ultra top secret mode - $data = aes_unencapsulate($_REQUEST,get_config('system','site_prvkey')); + $data = json_decode(aes_unencapsulate($_REQUEST['data'],get_config('system','site_prvkey')),true); } else { - $data = $_REQUEST; + $data = json_decode($_REQUEST['data'],true); } + + $msgtype = ((array_key_exists('type',$data)) ? $data['type'] : ''); if(array_key_exists('sender',$data)) { - $j_sender = json_decode($data['sender']); + $sender = $data['sender']; } - $hub = zot_gethub($j_sender); + $hub = zot_gethub($sender); if(! $hub) { // (!!) this will validate the sender - $result = zot_register_hub($j_sender); - if((! $result['success']) || (! zot_gethub($j_sender))) { + $result = zot_register_hub($sender); + if((! $result['success']) || (! zot_gethub($sender))) { $ret['message'] = 'Hub not available.'; logger('mod_zot: no hub'); json_return_and_die($ret); @@ -41,29 +43,29 @@ function post_post(&$a) { // TODO: check which hub is primary and take action if mismatched if(array_key_exists('recipients',$data)) - $j_recipients = json_decode($data['recipients']); + $recipients = $data['recipients']; if($msgtype === 'refresh') { // remote channel info (such as permissions or photo or something) // has been updated. Grab a fresh copy and sync it. - if($j_recipients) { + if($recipients) { // This would be a permissions update, typically for one connection - foreach($j_recipients as $recip) { + foreach($recipients as $recip) { $r = q("select channel.*,xchan.* from channel left join xchan on channel_hash = xchan_hash where channel_guid = '%s' and channel_guid_sig = '%s' limit 1", - dbesc($recip->guid), - dbesc($recip->guid_sig) + dbesc($recip['guid']), + dbesc($recip['guid_sig']) ); $x = zot_refresh(array( - 'xchan_guid' => $j_sender->guid, - 'xchan_guid_sig' => $j_sender->guid_sig, - 'hubloc_url' => $j_sender->url + 'xchan_guid' => $sender['guid'], + 'xchan_guid_sig' => $sender['guid_sig'], + 'hubloc_url' => $sender['url'] ),$r[0]); } } @@ -72,9 +74,9 @@ function post_post(&$a) { // system wide refresh $x = zot_refresh(array( - 'xchan_guid' => $j_sender->guid, - 'xchan_guid_sig' => $j_sender->guid_sig, - 'hubloc_url' => $j_sender->url + 'xchan_guid' => $sender['guid'], + 'xchan_guid_sig' => $sender['guid_sig'], + 'hubloc_url' => $sender['url'] ),null); } $ret['result'] = true; @@ -82,13 +84,12 @@ function post_post(&$a) { } if($msgtype === 'notify') { - - // add to receive queue // qreceive_add($data); $ret['result'] = true; json_return_and_die($ret); + } } |