aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-02-06 20:29:17 -0800
committerfriendica <info@friendica.com>2013-02-06 20:29:17 -0800
commit1e8146fc5c4ac78e2652aa2a3d2477b72f01e452 (patch)
tree5e008c75c3de3f4d19179e4985faa6b82dd99781 /include/items.php
parente6aaf1e9bf4e4debcc539e454234dddae9915d13 (diff)
downloadvolse-hubzilla-1e8146fc5c4ac78e2652aa2a3d2477b72f01e452.tar.gz
volse-hubzilla-1e8146fc5c4ac78e2652aa2a3d2477b72f01e452.tar.bz2
volse-hubzilla-1e8146fc5c4ac78e2652aa2a3d2477b72f01e452.zip
work on notifications
Diffstat (limited to 'include/items.php')
-rwxr-xr-xinclude/items.php62
1 files changed, 62 insertions, 0 deletions
diff --git a/include/items.php b/include/items.php
index 7a00754e6..8f3fa9530 100755
--- a/include/items.php
+++ b/include/items.php
@@ -1505,11 +1505,73 @@ function item_store($arr,$force_parent = false) {
intval($parent_id)
);
+
+ send_status_notifications($current_post,$arr);
+
tag_deliver($arr['uid'],$current_post);
return $current_post;
}
+
+function send_status_notifications($post_id,$item) {
+
+ $notify = false;
+ $parent = 0;
+
+ $r = q("select channel_hash from channel where channel_id = %d limit 1",
+ intval($item['uid'])
+ );
+ if(! $r)
+ return;
+
+ // my own post - no notification needed
+ if($item['author_xchan'] === $r[0]['channel_hash'])
+ return;
+
+ // I'm the owner - notify me
+
+ if($item['owner_hash'] === $r[0]['channel_hash'])
+ $notify = true;
+
+ // Was I involved in this conversation?
+
+ $x = q("select * from item where parent_uri = '%s' and uid = %d",
+ dbesc($item['parent_uri']),
+ intval($item['uid'])
+ );
+ if($x) {
+ foreach($x as $xx) {
+ if($xx['author_xchan'] === $r[0]['channel_hash']) {
+ $notify = true;
+ if($xx['id'] == $xx['parent'])
+ $parent = $xx['parent'];
+ }
+ }
+ }
+
+ if(! $notify)
+ return;
+ require_once('include/enotify.php');
+ notification(array(
+ 'type' => NOTIFY_COMMENT,
+ 'from_xchan' => $item['author_xchan'],
+ 'to_xchan' => $r[0]['channel_hash'],
+ 'item' => $item,
+ 'link' => $a->get_baseurl() . '/display/' . $item['uri'],
+ 'verb' => ACTIVITY_POST,
+ 'otype' => 'item',
+ 'parent' => $parent,
+ 'parent_uri' => $item['parent_uri']
+ ));
+ return;
+}
+
+
+
+
+
+
function get_item_contact($item,$contacts) {
if(! count($contacts) || (! is_array($item)))
return false;