aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/items.php')
-rwxr-xr-xinclude/items.php49
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);