From 884812bcbadc5ecdc7a38a10abfa5045667f7d2c Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 25 Mar 2013 21:32:12 -0700 Subject: doco --- include/poller.php | 8 +++++-- include/zot.php | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 66 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/poller.php b/include/poller.php index 6f4736855..1dd065196 100644 --- a/include/poller.php +++ b/include/poller.php @@ -30,8 +30,8 @@ function poller_run($argv, $argc){ // expire any expired accounts q("UPDATE account - SET account_flags = account_flags | %d - where not account_flags & %d + SET account_flags = (account_flags | %d) + where not (account_flags & %d) and account_expires != '0000-00-00 00:00:00' and account_expires < UTC_TIMESTAMP() ", intval(ACCOUNT_EXPIRED), @@ -56,6 +56,10 @@ function poller_run($argv, $argc){ proc_run('php','include/expire.php'); } + // If this is a directory server, request a sync with an upstream + // directory at least once a day, up to once every poll interval. + // Pull remote changes and push local changes. + // potential issue: how do we keep from creating an endless update loop? $manual_id = 0; $generation = 0; diff --git a/include/zot.php b/include/zot.php index 7c54e5239..78978bbf9 100644 --- a/include/zot.php +++ b/include/zot.php @@ -47,6 +47,9 @@ function zot_get_hubloc($arr,$primary = false) { } +/** + * obsolete + function zot_notify($channel,$url,$type = 'notify',$recipients = null, $remote_key = null) { $params = array( @@ -74,6 +77,9 @@ function zot_notify($channel,$url,$type = 'notify',$recipients = null, $remote_k $x = z_post_url($url,$params); return($x); } +*/ + + /* * @@ -117,10 +123,33 @@ function zot_build_packet($channel,$type = 'notify',$recipients = null, $remote_ } +/** + * @function: zot_zot + * @param: string $url + * @param: array $data + * + * @returns: array => see z_post_url for returned data format + */ + + + function zot_zot($url,$data) { return z_post_url($url,array('data' => $data)); } +/** + * @function: zot_finger + * + * Look up information about channel + * @param: string $webbie + * does not have to be host qualified e.g. 'foo' is treated as 'foo@thishub' + * @param: array $channel + * (optional), if supplied permissions will be enumerated specifically for $channel + * + * @returns: array => see z_post_url and mod/zfinger.php + */ + + function zot_finger($webbie,$channel) { @@ -191,6 +220,15 @@ function zot_finger($webbie,$channel) { } +/** + * @function: zot_refresh + * + * zot_refresh is typically invoked when somebody has changed permissions of a channel and they are notified + * to fetch new permissions via a finger operation. This may result in a new connection (abook entry) being added to a local channel + * and it may result in auto-permissions being granted. + * + */ + function zot_refresh($them,$channel = null) { logger('zot_refresh: them: ' . print_r($them,true), LOGGER_DATA); @@ -360,6 +398,15 @@ function zot_refresh($them,$channel = null) { return false; } +/** + * @function: zot_gethub + * + * A guid and a url, both signed by the sender, distinguish a known sender at a known location + * This function looks these up to see if the channel is known. If not, we will need to verify it. + * @returns: array => hubloc record + */ + + function zot_gethub($arr) { @@ -649,6 +696,18 @@ function zot_process_response($hub,$arr,$outq) { logger('zot_process_response: ' . print_r($x,true), LOGGER_DATA); } +/** + * @function: zot_fetch + * + * We received a notification packet (in mod/post.php) that a message is waiting for us, and we've verified the sender. + * Now send back a pickup message, using our message tracking ID ($arr['secret']), which we will sign. + * The entire pickup message is encrypted with the remote site's public key. + * If everything checks out on the remote end, we will receive back a packet containing one or more messages, + * which will be processed before returning. + * + */ + + function zot_fetch($arr) { logger('zot_fetch: ' . print_r($arr,true), LOGGER_DATA); @@ -657,7 +716,7 @@ function zot_fetch($arr) { $ret_hub = zot_gethub($arr['sender']); if(! $ret_hub) { - logger('zot_fetch: not ret_hub'); + logger('zot_fetch: no hub: ' . print_r($arr['sender'],true)); return; } -- cgit v1.2.3