The Hubzilla
 All Classes Namespaces Files Functions Variables Pages
zot.php File Reference

Hubzilla implementation of zot protocol. More...

Functions

 zot_new_uid ($channel_nick)
 Generates a unique string for use as a zot guid. More...
 
 make_xchan_hash ($guid, $guid_sig)
 Generates a portable hash identifier for a channel. More...
 
 zot_get_hublocs ($hash)
 Given a zot hash, return all distinct hubs. More...
 
 zot_build_packet ($channel, $type= 'notify', $recipients=null, $remote_key=null, $methods= '', $secret=null, $extra=null)
 Builds a zot notification packet. More...
 
 zot_best_algorithm ($methods)
 Choose best encryption function from those available on both sites. More...
 
 zot_zot ($url, $data)
 
 zot_refresh ($them, $channel=null, $force=false)
 Refreshes after permission changed or friending, etc. More...
 
 zot_gethub ($arr, $multiple=false)
 Look up if channel is known and previously verified. More...
 
 zot_register_hub ($arr)
 Registers an unknown hub. More...
 
 import_xchan ($arr, $ud_flags=UPDATE_FLAGS_UPDATED, $ud_arr=null)
 Takes an associative array of a fetched discovery packet and updates all internal data structures which need to be updated as a result. More...
 
 zot_process_response ($hub, $arr, $outq)
 Called immediately after sending a zot message which is using queue processing. More...
 
 zot_fetch ($arr)
 We received a notification packet (in mod_post) 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 with our site private key. 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 and delivered before this function ultimately returns. More...
 
 zot_import ($arr, $sender_url)
 Process incoming array of messages. More...
 
 public_recips ($msg)
 A public message with no listed recipients can be delivered to anybody who has PERMS_NETWORK for that type of post, PERMS_AUTHED (in-network senders are by definition authenticated) or PERMS_SITE and is one the same site, or PERMS_SPECIFIC and the sender is a contact who is granted permissions via their connection permissions in the address book. Here we take a given message and construct a list of hashes of everybody on the site that we should try and deliver to. Some of these will be rejected, but this gives us a place to start. More...
 
 allowed_public_recips ($msg)
 This is the second part of public_recips(). More...
 
 process_delivery ($sender, $arr, $deliveries, $relay, $public=false, $request=false)
 
 remove_community_tag ($sender, $arr, $uid)
 Remove community tag. More...
 
 update_imported_item ($sender, $item, $orig, $uid, $tag_delivery)
 Updates an imported item. More...
 
 delete_imported_item ($sender, $item, $uid, $relay)
 Deletes an imported item. More...
 
 process_mail_delivery ($sender, $arr, $deliveries)
 
 process_rating_delivery ($sender, $arr)
 Processes delivery of rating. More...
 
 process_profile_delivery ($sender, $arr, $deliveries)
 Processes delivery of profile. More...
 
 process_location_delivery ($sender, $arr, $deliveries)
 
 check_location_move ($sender_hash, $locations)
 Checks for a moved UNO channel and sets the channel_moved flag. More...
 
 sync_locations ($sender, $arr, $absolute=false)
 Synchronises locations. More...
 
 zot_encode_locations ($channel)
 Returns an array with all known distinct hubs for this channel. More...
 
 import_directory_profile ($hash, $profile, $addr, $ud_flags=UPDATE_FLAGS_UPDATED, $suppress_update=0)
 Imports a directory profile. More...
 
 import_directory_keywords ($hash, $keywords)
 
 update_modtime ($hash, $guid, $addr, $flags=0)
 
 import_site ($arr, $pubkey)
 
 build_sync_packet ($uid=0, $packet=null, $groups_changed=false)
 Builds and sends a sync packet. More...
 
 process_channel_sync_delivery ($sender, $arr, $deliveries)
 
 get_rpost_path ($observer)
 Returns path to /rpost. More...
 
 import_author_zot ($x)
 
 zot_reply_message_request ($data)
 Process a message request. More...
 
 zot_rekey_request ($sender, $data)
 
 zotinfo ($arr)
 
 zot_site_info ($channel_key= '')
 
 check_zotinfo ($channel, $locations, &$ret)
 
 delivery_report_is_storable ($dr)
 
 update_hub_connected ($hub, $sitekey= '')
 
 zot_reply_ping ()
 Useful to get a health check on a remote site. More...
 
 zot_reply_pickup ($data)
 
 zot_reply_auth_check ($data, $encrypted_packet)
 
 zot_reply_purge ($sender, $recipients)
 
 zot_reply_refresh ($sender, $recipients)
 Remote channel info (such as permissions or photo or something) has been updated. Grab a fresh copy and sync it. More...
 
 zot_reply_notify ($data)
 

Detailed Description

Function Documentation

allowed_public_recips (   $msg)

This is the second part of public_recips().

We'll find all the channels willing to accept public posts from us, then match them against the sender privacy scope and see who in that list that the sender is allowing.

See Also
public_recipes()
Parameters
array$msg
Returns
array

Referenced by zot_import().

build_sync_packet (   $uid = 0,
  $packet = null,
  $groups_changed = false 
)

Builds and sends a sync packet.

Send a zot packet to all hubs where this channel is duplicated, refreshing such things as personal settings, channel permissions, address book updates, etc.

Parameters
int$uid(optional) default 0
array$packet(optional) default null
boolean$groups_changed(optional) default false

Referenced by Zotlabs\Lib\Apps\app_destroy(), Zotlabs\Lib\Apps\app_install(), attach_change_permissions(), attach_store(), change_channel_keys(), Zotlabs\Module\Connedit\connedit_clone(), Zotlabs\Module\Defperms\defperms_clone(), Zotlabs\Lib\Chatroom\destroy(), event_addtocal(), Zotlabs\Module\Moderate\get(), Zotlabs\Module\Like\get(), Zotlabs\Module\Tagger\get(), Zotlabs\Module\Settings\Permcats\get(), Zotlabs\Module\Filestorage\get(), Zotlabs\Module\Mail\get(), Zotlabs\Module\Thing\get(), Zotlabs\Module\Events\get(), Zotlabs\Module\Profile_photo\get(), Zotlabs\Module\Connedit\get(), Zotlabs\Module\Item\get(), group_add(), group_add_member(), group_rmv(), group_rmv_member(), Zotlabs\Module\Notes\init(), Zotlabs\Module\Starred\init(), Zotlabs\Module\Follow\init(), Zotlabs\Module\Thing\init(), item_create_edit_activity(), menu_sync_packet(), Zotlabs\Module\Pdledit\post(), Zotlabs\Module\Settings\Features\post(), Zotlabs\Module\Settings\Featured\post(), Zotlabs\Module\Settings\Permcats\post(), Zotlabs\Module\Group\post(), Zotlabs\Module\Pconfig\post(), Zotlabs\Module\Settings\Channel\post(), Zotlabs\Module\File_upload\post(), Zotlabs\Module\Settings\Display\post(), Zotlabs\Module\Events\post(), Zotlabs\Module\Mail\post(), Zotlabs\Module\Wall_attach\post(), Zotlabs\Module\Item\post(), Zotlabs\Module\Chat\post(), Zotlabs\Module\Profile_photo\post(), Zotlabs\Module\Photos\post(), Zotlabs\Module\Profiles\post(), private_messages_drop(), profiles_build_sync(), Zotlabs\Daemon\Importfile\run(), Zotlabs\Daemon\Cron\run(), Zotlabs\Lib\NativeWiki\sync_a_wiki_item(), sync_an_item(), and zot_refresh().

check_location_move (   $sender_hash,
  $locations 
)

Checks for a moved UNO channel and sets the channel_moved flag.

Currently the effect of this flag is to turn the channel into 'read-only' mode. New content will not be processed (there was still an issue with blocking the ability to post comments as of 10-Mar-2016). We do not physically remove the channel at this time. The hub admin may choose to do so, but is encouraged to allow a grace period of several days in case there are any issues migrating content. This packet will generally be received by the original site when the basic channel import has been processed.

This will only be executed on the UNO system which is the old location if a new location is reported and there is only one location record. The rest of the hubloc syncronisation will be handled within sync_locations

Parameters
string$sender_hashA channel hash
array$locations
Hooks:
location_move Called when a new location has been provided to a UNO channel (indicating a move rather than a clone).
  • array channel
  • array locations

Referenced by sync_locations().

check_zotinfo (   $channel,
  $locations,
$ret 
)
Parameters
array$channel
array$locations
[out]array$retarray locations result of zot_encode_locations()
Fixme:
ensure that the system channel exists in the first place and has an xchan

Referenced by zotinfo().

delete_imported_item (   $sender,
  $item,
  $uid,
  $relay 
)

Deletes an imported item.

Parameters
array$sender
  • string hash a xchan_hash
array$item
int$uid
boolean$relay
Returns
boolean|int post_id

Referenced by process_delivery().

delivery_report_is_storable (   $dr)
Parameters
array$dr
Returns
boolean
Hooks:
dreport_is_storable Called before storing a dreport record to determine whether to store it.
  • array

Referenced by Zotlabs\Daemon\Deliver\run(), and zot_process_response().

get_rpost_path (   $observer)

Returns path to /rpost.

Todo:
We probably should make rpost discoverable.
Parameters
array$observer
  • string xchan_url
Returns
string

Referenced by Zotlabs\Module\Rpost\get().

import_author_zot (   $x)
Parameters
array$x
Returns
boolean|string return false or a hash

Referenced by import_author_xchan().

import_directory_keywords (   $hash,
  $keywords 
)
Parameters
string$hashAn xtag_hash
array$keywords

Referenced by import_directory_profile().

import_directory_profile (   $hash,
  $profile,
  $addr,
  $ud_flags = UPDATE_FLAGS_UPDATED,
  $suppress_update = 0 
)

Imports a directory profile.

Parameters
string$hash
array$profile
string$addr
number$ud_flags(optional) UPDATE_FLAGS_UPDATED
number$suppress_update(optional) default 0
Returns
boolean $updated if something changed
Hooks:
import_directory_profile Called when processing delivery of a profile structure from an external source (usually for directory storage).
  • array xprof
  • array profile
  • boolean update

Referenced by import_xchan(), local_dir_update(), and process_profile_delivery().

import_site (   $arr,
  $pubkey 
)
Parameters
array$arr
string$pubkey
Returns
boolean true if updated or inserted

Referenced by import_xchan().

import_xchan (   $arr,
  $ud_flags = UPDATE_FLAGS_UPDATED,
  $ud_arr = null 
)

Takes an associative array of a fetched discovery packet and updates all internal data structures which need to be updated as a result.

Parameters
array$arr=> json_decoded discovery packet
int$ud_flagsDetermines whether to create a directory update record if any changes occur, default is UPDATE_FLAGS_UPDATED $ud_flags = UPDATE_FLAGS_FORCED indicates a forced refresh where we unconditionally create a directory update record this typically occurs once a month for each channel as part of a scheduled ping to notify the directory that the channel still exists
array$ud_arrIf set [typically by update_directory_entry()] indicates a specific update table row and more particularly contains a particular address (ud_addr) which needs to be updated in that table.
Returns
array An associative array with:
  • boolean success boolean true or false
  • string message (optional) error string only if success is false
Hooks:
import_xchan Called when processing the result of zot_finger() to store the result
  • array
Todo:
: check if we're the same directory realm, which would mean we are allowed to see it

Referenced by discover_by_webbie(), Zotlabs\Module\Chanview\get(), Zotlabs\Module\Probe\get(), Zotlabs\Zot\Auth\GetHublocs(), Zotlabs\Module\Magic\init(), Zotlabs\Module\Regdir\init(), new_contact(), owt_init(), poco_load(), Zotlabs\Module\Mail\post(), Zotlabs\Daemon\Gprobe\run(), update_directory_entry(), zot_refresh(), and zot_register_hub().

make_xchan_hash (   $guid,
  $guid_sig 
)

Generates a portable hash identifier for a channel.

Generates a portable hash identifier for the channel identified by $guid and signed with $guid_sig.

Note
This ID is portable across the network but MUST be calculated locally by verifying the signature and can not be trusted as an identity.
Parameters
string$guid
string$guid_sig

Referenced by allowed_public_recips(), change_channel_keys(), create_identity(), get_item_elements(), Zotlabs\Module\Import\import_account(), import_author_zot(), import_channel(), import_hublocs(), import_xchan(), Zotlabs\Module\Zfinger\init(), process_channel_sync_delivery(), zot_import(), zot_register_hub(), zot_rekey_request(), zot_reply_auth_check(), zot_reply_message_request(), zot_reply_purge(), and zotinfo().

process_channel_sync_delivery (   $sender,
  $arr,
  $deliveries 
)
Parameters
array$sender
array$arr
array$deliveries
Returns
array
Fixme:
this will sync red structures (channel, pconfig and abook). Eventually we need to make this application agnostic.
Fixme:
does not handle sync of del_abconfig
Todo:
We also need to import local photos if a custom photo is selected
Hooks:
process_channel_sync_delivery Called when accepting delivery of a 'sync packet' containing structure and table updates from a channel clone.
  • array channel
  • array data

Referenced by zot_import().

process_delivery (   $sender,
  $arr,
  $deliveries,
  $relay,
  $public = false,
  $request = false 
)
Parameters
array$sender
array$arr
array$deliveries
boolean$relay
boolean$public(optional) default false
boolean$request(optional) default false
Returns
array
Fixme:
: Somehow we need to block normal message delivery from our clones, as the delivered message doesn't have ACL information in it as the cloned copy does. That copy will normally arrive first via sync delivery, but this isn't guaranteed. There's a chance the current delivery could take place before the cloned copy arrives hence the item could have the wrong ACL and could be used in subsequent deliveries or access checks. So far all attempts at identifying this situation precisely have caused issues with delivery of relayed comments.
Hooks:
post_local Called when an item has been posted on this machine via mod/item.php (also via API).
  • array with an item
Hooks:
activity_received Called when an activity (post, comment, like, etc.) has been received from a zot source.
  • int item_id
  • array item
  • array sender
  • array channel

Referenced by Zotlabs\Daemon\Externals\run(), Zotlabs\Daemon\Onepoll\run(), and zot_import().

process_location_delivery (   $sender,
  $arr,
  $deliveries 
)
Parameters
array$senderan associative array
  • string hash a xchan_hash
array$arr
array$deliveries(unused) deliveries is irrelevant

Referenced by zot_import().

process_mail_delivery (   $sender,
  $arr,
  $deliveries 
)

Referenced by zot_import().

process_profile_delivery (   $sender,
  $arr,
  $deliveries 
)

Processes delivery of profile.

See Also
import_directory_profile()
Parameters
array$senderan associative array
  • string hash a xchan_hash
array$arr
array$deliveries(unused)

Referenced by zot_import().

process_rating_delivery (   $sender,
  $arr 
)

Processes delivery of rating.

Parameters
array$sender
  • string hash a xchan_hash
array$arr

Referenced by zot_import().

public_recips (   $msg)

A public message with no listed recipients can be delivered to anybody who has PERMS_NETWORK for that type of post, PERMS_AUTHED (in-network senders are by definition authenticated) or PERMS_SITE and is one the same site, or PERMS_SPECIFIC and the sender is a contact who is granted permissions via their connection permissions in the address book. Here we take a given message and construct a list of hashes of everybody on the site that we should try and deliver to. Some of these will be rejected, but this gives us a place to start.

Parameters
array$msg
Returns
NULL|array

Referenced by allowed_public_recips().

remove_community_tag (   $sender,
  $arr,
  $uid 
)

Remove community tag.

Parameters
array$senderan associative array with
  • string hash a xchan_hash
array$arran associative array
  • int verb
  • int obj_type
  • int mid
int$uid

Referenced by process_delivery().

sync_locations (   $sender,
  $arr,
  $absolute = false 
)

Synchronises locations.

Parameters
array$sender
array$arr
boolean$absolute(optional) default false
Returns
array

Referenced by import_xchan(), and process_location_delivery().

update_hub_connected (   $hub,
  $sitekey = '' 
)
Parameters
array$hub
string$sitekey(optional, default empty)
Returns
string hubloc_url

Referenced by Zotlabs\Zot\Receiver\ValidateSender().

update_imported_item (   $sender,
  $item,
  $orig,
  $uid,
  $tag_delivery 
)

Updates an imported item.

See Also
item_store_update()
Parameters
array$sender
array$item
array$orig
int$uid
boolean$tag_delivery

Referenced by process_delivery().

update_modtime (   $hash,
  $guid,
  $addr,
  $flags = 0 
)
Parameters
string$hash
string$guid
string$addr
int$flags(optional) default 0

Referenced by import_directory_profile(), import_xchan(), local_dir_update(), and process_location_delivery().

zot_best_algorithm (   $methods)

Choose best encryption function from those available on both sites.

Parameters
string$methodscomma separated list of encryption methods
Returns
string first match from our site method preferences crypto_methods() array of a method which is common to both sites; or 'aes256cbc' if no matches are found.
Hooks:
zot_best_algorithm Called when negotiating crypto algorithms with remote sites.
  • string methods - comma separated list of encryption methods
  • string result - the algorithm to return

Referenced by zot_build_packet(), zot_fetch(), and zot_reply_pickup().

zot_build_packet (   $channel,
  $type = 'notify',
  $recipients = null,
  $remote_key = null,
  $methods = '',
  $secret = null,
  $extra = null 
)

Builds a zot notification packet.

Builds a zot notification packet that you can either store in the queue with a message array or call zot_zot to immediately zot it to the other side.

Parameters
array$channelsender channel structure
string$typepacket type: one of 'ping', 'pickup', 'purge', 'refresh', 'keychange', 'force_refresh', 'notify', 'auth_check'
array$recipientsenvelope information, array ( 'guid' => string, 'guid_sig' => string ); empty for public posts
string$remote_keyoptional public site key of target hub used to encrypt entire packet NOTE: remote_key and encrypted packets are required for 'auth_check' packets, optional for all others
string$methodsoptional comma separated list of encryption methods zot_best_algorithm()
string$secretrandom string, required for packets which require verification/callback e.g. 'pickup', 'purge', 'notify', 'auth_check'. Packet types 'ping', 'force_refresh', and 'refresh' do not require verification
string$extra
Returns
string json encoded zot packet

Referenced by build_sync_packet(), Zotlabs\Module\Zping\get(), ping_site(), Zotlabs\Daemon\Ratenotif\run(), Zotlabs\Daemon\Directory\run(), Zotlabs\Daemon\Notifier\run(), Zotlabs\Zot\Auth\Verify(), and zot_reply_message_request().

zot_encode_locations (   $channel)

Returns an array with all known distinct hubs for this channel.

See Also
zot_get_hublocs()
Parameters
array$channelan associative array which must contain
  • string channel_hash the hash of the channel
Returns
array an array with associative arrays

Referenced by check_zotinfo(), Zotlabs\Daemon\Notifier\run(), and zotinfo().

zot_fetch (   $arr)

We received a notification packet (in mod_post) 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 with our site private key. 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 and delivered before this function ultimately returns.

See Also
zot_import()
Parameters
array$arrdecrypted and json decoded notify packet from remote site
Returns
array from zot_import()

Referenced by zot_reply_notify().

zot_get_hublocs (   $hash)

Given a zot hash, return all distinct hubs.

This function is used in building the zot discovery packet and therefore should only be used by channels which are defined on this hub.

Parameters
string$hash- xchan_hash
Returns
array of hubloc (hub location structures)
  • hubloc_id int
  • hubloc_guid char(191)
  • hubloc_guid_sig text
  • hubloc_hash char(191)
  • hubloc_addr char(191)
  • hubloc_flags int
  • hubloc_status int
  • hubloc_url char(191)
  • hubloc_url_sig text
  • hubloc_host char(191)
  • hubloc_callback char(191)
  • hubloc_connect char(191)
  • hubloc_sitekey text
  • hubloc_updated datetime
  • hubloc_connected datetime

Referenced by Zotlabs\Module\Fhublocs\get(), process_channel_sync_delivery(), and zot_encode_locations().

zot_gethub (   $arr,
  $multiple = false 
)

Look up if channel is known and previously verified.

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 and therefore previously verified. If not, we will need to verify it.

Parameters
array$arran associative array which must contain:
  • string guid => guid of conversant
  • string guid_sig => guid signed with conversant's private key
  • string url => URL of the origination hub of this communication
  • string url_sig => URL signed with conversant's private key
boolean$multiple(optional) default false
Returns
array|null
  • null if site is blacklisted or not found
  • otherwise an array with an hubloc record

Referenced by import_hublocs(), Zotlabs\Zot\Receiver\ValidateSender(), zot_fetch(), and zot_import().

zot_import (   $arr,
  $sender_url 
)

Process incoming array of messages.

Process an incoming array of messages which were obtained via pickup, and import, update, delete as directed.

The message types handled here are 'activity' (e.g. posts), 'mail', 'profile', 'location' and 'channel_sync'.

Parameters
array$arr'pickup' structure returned from remote site
string$sender_urlthe url specified by the sender in the initial communication. We will verify the sender and url in each returned message structure and also verify that all the messages returned match the site url that we are currently processing.
Returns
array Suitable for logging remotely, enumerating the processing results of each message/recipient combination
  • [0] => string $channel_hash
  • [1] => string $delivery_status
  • [2] => string $address

Referenced by Zotlabs\Daemon\Deliver\run(), and zot_fetch().

zot_new_uid (   $channel_nick)

Generates a unique string for use as a zot guid.

Generates a unique string for use as a zot guid using our DNS-based url, the channel nickname and some entropy. The entropy ensures uniqueness against re-installs where the same URL and nickname are chosen.

Note
zot doesn't require this to be unique. Internally we use a whirlpool hash of this guid and the signature of this guid signed with the channel private key. This can be verified and should make the probability of collision of the verified result negligible within the constraints of our immediate universe.
Parameters
string$channel_nicka unique nickname of controlling entity
Returns
string

Referenced by create_identity().

zot_process_response (   $hub,
  $arr,
  $outq 
)

Called immediately after sending a zot message which is using queue processing.

Updates the queue item according to the response result and logs any information returned to aid communications troubleshooting.

Parameters
string$hub- url of site we just contacted
array$arr- output of z_post_url()
array$outq- The queue structure attached to this request

Referenced by queue_deliver().

zot_refresh (   $them,
  $channel = null,
  $force = false 
)

Refreshes after permission changed or friending, etc.

The top half of this function is similar to \Zotlabs\Zot\Finger::run() and could potentially be consolidated.

zot_refresh is typically invoked when somebody has changed permissions of a channel and they are notified to fetch new permissions via a finger/discovery 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.

Friending in zot is accomplished by sending a refresh packet to a specific channel which indicates a permission change has been made by the sender which affects the target channel. The hub controlling the target channel does targetted discovery (a zot-finger request requesting permissions for the local channel). These are decoded here, and if necessary and abook structure (addressbook) is created to store the permissions assigned to this channel.

Initially these abook structures are created with a 'pending' flag, so that no reverse permissions are implied until this is approved by the owner channel. A channel can also auto-populate permissions in return and send back a refresh packet of its own. This is used by forum and group communication channels so that friending and membership in the channel's "club" is automatic.

Parameters
array$them=> xchan structure of sender
array$channel=> local channel structure of target recipient, required for "friending" operations
array$force(optional) default false
Returns
boolean
  • true if successful
  • otherwise false

Referenced by Zotlabs\Module\Connedit\get(), import_author_zot(), Zotlabs\Daemon\Onepoll\run(), and zot_reply_refresh().

zot_register_hub (   $arr)

Registers an unknown hub.

A communication has been received which has an unknown (to us) sender. Perform discovery based on our calculated hash of the sender at the origination address. This will fetch the discovery packet of the sender, which contains the public key we need to verify our guid and url signatures.

Parameters
array$arran associative array which must contain:
  • string guid => guid of conversant
  • string guid_sig => guid signed with conversant's private key
  • string url => URL of the origination hub of this communication
  • string url_sig => URL signed with conversant's private key
Returns
array An associative array with
  • success boolean true or false
  • message (optional) error string only if success is false

Referenced by Zotlabs\Zot\Receiver\ValidateSender().

zot_rekey_request (   $sender,
  $data 
)
zot_reply_auth_check (   $data,
  $encrypted_packet 
)
Todo:
This was and should be 10 minutes but my hosting provider has time lag between the DB and the web server. We should probably convert this to webserver time rather than DB time so that the different clocks won't affect it and allow us to keep the time short.

Referenced by Zotlabs\Zot\ZotHandler\AuthCheck().

zot_reply_message_request (   $data)

Process a message request.

If a site receives a comment to a post but finds they have no parent to attach it with, they may send a 'request' packet containing the message_id of the missing parent. This is the handler for that packet. We will create a message_list array of the entire conversation starting with the missing parent and invoke delivery to the sender of the packet.

include/deliver.php (for local delivery) and mod/post.php (for web delivery) detect the existence of this 'message_list' at the destination and split it into individual messages which are processed/delivered in order.

Called from mod/post.php

Parameters
array$data
Returns
array

Referenced by Zotlabs\Zot\ZotHandler\Request().

zot_reply_notify (   $data)
zot_reply_pickup (   $data)
zot_reply_ping ( )

Useful to get a health check on a remote site.

This will let us know if any important communication details that we may have stored are no longer valid, regardless of xchan details.

Returns
json_return_and_die()

Referenced by Zotlabs\Zot\ZotHandler\Ping().

zot_reply_purge (   $sender,
  $recipients 
)
Parameters
array$sender
array$recipientsreturn json_return_and_die()

Referenced by Zotlabs\Zot\ZotHandler\Purge().

zot_reply_refresh (   $sender,
  $recipients 
)

Remote channel info (such as permissions or photo or something) has been updated. Grab a fresh copy and sync it.

The difference between refresh and force_refresh is that force_refresh unconditionally creates a directory update record, even if no changes were detected upon processing.

Parameters
array$sender
array$recipients
Returns
json_return_and_die()

Referenced by Zotlabs\Zot\ZotHandler\Refresh().

zot_site_info (   $channel_key = '')

Referenced by zotinfo().

zot_zot (   $url,
  $data 
)
See Also
z_post_url()
Parameters
string$url
array$data
Returns
array see z_post_url() for returned data format

Referenced by Zotlabs\Module\Zping\get(), ping_site(), queue_deliver(), Zotlabs\Daemon\Directory\run(), Zotlabs\Zot\Auth\Verify(), and zot_fetch().

zotinfo (   $arr)

The special address '[system]' will return a system channel if one has been defined, Or the first valid channel we find if there are no system channels.

This is used by magic-auth if we have no prior communications with this site - and returns an identity on this site which we can use to create a valid hub record so that we can exchange signed messages. The precise identity is irrelevant. It's the hub information that we really need at the other end - and this will return it.

Hooks:
channel_protocols
  • int channel_id
  • array protocols
Hooks:
zot_finger Called when a zot-info packet has been requested (this is our webfinger discovery mechanism).
  • array The final return array

Referenced by Zotlabs\Module\Zfinger\init(), and Zotlabs\Module\Wfinger\init().