diff options
author | Manuel Jiménez Friaza <mjfriaza@openmailbox.org> | 2019-01-20 12:58:27 +0100 |
---|---|---|
committer | Manuel Jiménez Friaza <mjfriaza@openmailbox.org> | 2019-01-20 12:58:27 +0100 |
commit | 4e8fc6d19851b6d05a49d5151aaa1f0f1fcfb5c0 (patch) | |
tree | 49111cffad0616616f4ce76fed9dd6b4fad8e41f /include/items.php | |
parent | 618d673947dc627dcdac3f9b6da7f31123472b05 (diff) | |
parent | 39128c34ccf48cc23ed368cf5bbedd71b5ef75db (diff) | |
download | volse-hubzilla-4e8fc6d19851b6d05a49d5151aaa1f0f1fcfb5c0.tar.gz volse-hubzilla-4e8fc6d19851b6d05a49d5151aaa1f0f1fcfb5c0.tar.bz2 volse-hubzilla-4e8fc6d19851b6d05a49d5151aaa1f0f1fcfb5c0.zip |
Merge remote-tracking branch 'upstream/dev' into dev
Diffstat (limited to 'include/items.php')
-rwxr-xr-x | include/items.php | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/include/items.php b/include/items.php index 0cbca23fc..e5f2be003 100755 --- a/include/items.php +++ b/include/items.php @@ -95,9 +95,24 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) { //$sys = get_sys_channel(); if(array_key_exists('public_policy',$item) && $item['public_policy'] !== 'self') { - $r = q("select abook_xchan, xchan_network from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and abook_self = 0 and abook_pending = 0 and abook_archived = 0 ", + + $hookinfo = [ + 'recipients' => [], + 'item' => $item, + 'private_envelope' => $private_envelope, + 'include_groups' => $include_groups + ]; + + call_hooks('collect_public_recipients',$hookinfo); + + if ($hookinfo['recipients']) { + $r = $hookinfo['recipients']; + } else { + $r = q("select abook_xchan, xchan_network from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and abook_self = 0 and abook_pending = 0 and abook_archived = 0 ", intval($item['uid']) - ); + ); + } + if($r) { // filter out restrictive public_policy settings from remote networks @@ -1591,6 +1606,14 @@ function item_store($arr, $allow_exec = false, $deliver = true) { 'item' => $arr, 'allow_exec' => $allow_exec ]; + + if ($arr['item_type']==ITEM_TYPE_CUSTOM) { + /* Custom items are not stored by default + because they require an addon to process. */ + $d['item']['cancel']=true; + + call_hooks('item_custom',$d); + } /** * @hooks item_store * Called when item_store() stores a record of type item. @@ -2016,6 +2039,13 @@ function item_store($arr, $allow_exec = false, $deliver = true) { */ call_hooks('post_remote_end', $arr); + /** + * @hooks item_stored + * Called after new item is stored in the database. + * (By this time we have an item_id and other frequently needed info.) + */ + call_hooks('item_stored',$arr); + item_update_parent_commented($arr); // If _creating_ a deleted item, don't propagate it further or send out notifications. @@ -2049,6 +2079,15 @@ function item_store_update($arr, $allow_exec = false, $deliver = true) { 'item' => $arr, 'allow_exec' => $allow_exec ]; + + if ($arr['item_type']==ITEM_TYPE_CUSTOM) { + /* Custom items are not stored by default + because they require an addon to process. */ + $d['item']['cancel']=true; + + call_hooks('item_custom_update',$d); + } + /** * @hooks item_store_update * Called when item_store_update() is called to update a stored item. It @@ -2339,6 +2378,12 @@ function item_store_update($arr, $allow_exec = false, $deliver = true) { */ call_hooks('post_remote_update_end', $arr); + /** + * @hooks item_stored_update + * Called after updated item is stored in the database. + */ + call_hooks('item_stored_update',$arr); + if($deliver) { send_status_notifications($orig_post_id,$arr); tag_deliver($uid,$orig_post_id); |