diff options
author | friendica <info@friendica.com> | 2012-11-19 20:45:12 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-11-19 20:45:12 -0800 |
commit | cd4e381aa146dd185021c86ac1ecc9755fa81453 (patch) | |
tree | ac04c8cd2957abf088cd118b04113d56e6489f30 /include | |
parent | 194ef02c287edbce6b797f1411afe0bb964e8c80 (diff) | |
download | volse-hubzilla-cd4e381aa146dd185021c86ac1ecc9755fa81453.tar.gz volse-hubzilla-cd4e381aa146dd185021c86ac1ecc9755fa81453.tar.bz2 volse-hubzilla-cd4e381aa146dd185021c86ac1ecc9755fa81453.zip |
"heavy lifting" - zot messages flowing, now just need to be parsed and stored at the other end.
Diffstat (limited to 'include')
-rwxr-xr-x | include/items.php | 1 | ||||
-rw-r--r-- | include/zot.php | 70 |
2 files changed, 70 insertions, 1 deletions
diff --git a/include/items.php b/include/items.php index 5a8ecb540..28b19caad 100755 --- a/include/items.php +++ b/include/items.php @@ -522,6 +522,7 @@ function import_author_xchan($x) { function encode_item($item) { $x = array(); + $x['type'] = 'activity'; logger('encode_item: ' . print_r($item,true)); diff --git a/include/zot.php b/include/zot.php index 9e9f5099d..ba2a6a834 100644 --- a/include/zot.php +++ b/include/zot.php @@ -564,4 +564,72 @@ function zot_process_response($arr,$outq) { } logger('zot_process_response: ' . print_r($x,true), LOGGER_DATA); -}
\ No newline at end of file +} + +function zot_fetch($arr) { + + logger('zot_fetch: ' . print_r($arr,true), LOGGER_DATA); + + $url = $arr['sender']['url'] . $arr['callback']; + + $ret_hub = zot_gethub($arr['sender']); + if(! $ret_hub) { + logger('zot_fetch: not ret_hub'); + return; + } + + + $ret_secret = json_encode(array($arr['secret'],'secret_sig' => base64url_encode(rsa_sign($arr['secret'],get_config('system','prvkey'))))); + + + $data = array( + 'type' => 'pickup', + 'url' => z_root(), + 'callback_sig' => base64url_encode(rsa_sign(z_root() . '/post',get_config('system','prvkey'))), + 'callback' => z_root() . '/post', + 'secret' => $arr['secret'], + 'secret_sig' => base64url_encode(rsa_sign($arr['secret'],get_config('system','prvkey'))) + ); + + + $datatosend = json_encode(aes_encapsulate(json_encode($data),$ret_hub['hubloc_sitekey'])); + + $fetch = zot_zot($url,$datatosend); + + $result = zot_import($fetch); + +} + + +function zot_import($arr) { + + logger('zot_import: ' . print_r($arr,true), LOGGER_DATA); + logger('zot_import: data' . print_r($data,true), LOGGER_DATA); + + $data = json_decode($arr['body'],true); + if(array_key_exists('iv',$data)) { + $data = json_decode(aes_unencapsulate($data,get_config('system','prvkey')),true); + } + + $incoming = $data['pickup']; + if(is_array($incoming)) { + foreach($incoming as $i) { + if($i['notify'] && $i['notify']['recipients']) { + // look for our site members in the recipient list + // (fix the notifier to send them...) + + } + else { + // look for any site members who are accepting posts from this sender + + } + if($i['message'] && $i['message']['type'] === 'activity') { + // process the message + + + + + } + } + } +} |