aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rwxr-xr-xmod/mood.php59
1 files changed, 26 insertions, 33 deletions
diff --git a/mod/mood.php b/mod/mood.php
index 8992c55e3..ddd721823 100755
--- a/mod/mood.php
+++ b/mod/mood.php
@@ -30,7 +30,7 @@ function mood_init(&$a) {
if($parent) {
- $r = q("select uri, private, allow_cid, allow_gid, deny_cid, deny_gid
+ $r = q("select uri, owner_xchan, private, allow_cid, allow_gid, deny_cid, deny_gid
from item where id = %d and parent = %d and uid = %d limit 1",
intval($parent),
intval($parent),
@@ -47,62 +47,55 @@ function mood_init(&$a) {
}
else {
- $private = 0;
+ $private = 0;
+ $channel = $a->get_channel();
- $allow_cid = $a->user['allow_cid'];
- $allow_gid = $a->user['allow_gid'];
- $deny_cid = $a->user['deny_cid'];
- $deny_gid = $a->user['deny_gid'];
+ $allow_cid = $channel['channel_allow_cid'];
+ $allow_gid = $channel['channel_allow_gid'];
+ $deny_cid = $channel['channel_deny_cid'];
+ $deny_gid = $channel['channel_deny_gid'];
}
- $poster = $a->contact;
+ $poster = $a->get_observer();
$uri = item_message_id();
- $action = sprintf( t('%1$s is currently %2$s'), '[url=' . $poster['url'] . ']' . $poster['name'] . '[/url]' , $verbs[$verb]);
+ $action = sprintf( t('%1$s is currently %2$s'), '[url=' . $poster['xchan_url'] . ']' . $poster['xchan_name'] . '[/url]' , $verbs[$verb]);
+ $item_flags = ITEM_WALL|ITEM_ORIGIN|ITEM_UNSEEN;
+ if(! $parent_uri)
+ $item_flags |= ITEM_THREAD_TOP;
+
$arr = array();
+ $arr['aid'] = get_account_id();
$arr['uid'] = $uid;
$arr['uri'] = $uri;
- $arr['parent-uri'] = (($parent_uri) ? $parent_uri : $uri);
- $arr['type'] = 'activity';
- $arr['wall'] = 1;
- $arr['contact-id'] = $poster['id'];
- $arr['owner-name'] = $poster['name'];
- $arr['owner-link'] = $poster['url'];
- $arr['owner-avatar'] = $poster['thumb'];
- $arr['author-name'] = $poster['name'];
- $arr['author-link'] = $poster['url'];
- $arr['author-avatar'] = $poster['thumb'];
+ $arr['parent_uri'] = (($parent_uri) ? $parent_uri : $uri);
+ $arr['item_flags'] = $item_flags;
+ $arr['author_xchan'] = $poster['xchan_hash'];
+ $arr['owner_xchan'] = (($parent_uri) ? $r[0]['owner_xchan'] : $poster['xchan_hash']);
$arr['title'] = '';
$arr['allow_cid'] = $allow_cid;
$arr['allow_gid'] = $allow_gid;
$arr['deny_cid'] = $deny_cid;
$arr['deny_gid'] = $deny_gid;
- $arr['last-child'] = 1;
- $arr['visible'] = 1;
$arr['verb'] = $activity;
- $arr['private'] = $private;
-
- $arr['origin'] = 1;
$arr['body'] = $action;
$item_id = item_store($arr);
if($item_id) {
- q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
- dbesc($a->get_baseurl() . '/display/' . $poster['nickname'] . '/' . $item_id),
- intval($uid),
- intval($item_id)
- );
- proc_run('php',"include/notifier.php","tag","$item_id");
- }
+// q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
+// dbesc($a->get_baseurl() . '/display/' . $poster['nickname'] . '/' . $item_id),
+// intval($uid),
+// intval($item_id)
+// );
+ proc_run('php',"include/notifier.php","activity", $item_id);
- call_hooks('post_local_end', $arr);
-
- proc_run('php',"include/notifier.php","like","$post_id");
+ }
+ call_hooks('post_local_end', $arr);
return;
}