From 6088f59c33d7136d416d184871c19f98ffbddc52 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 7 Sep 2015 23:14:18 +0200 Subject: [PATCH 1/2] Bugfix: "remote self" items weren't posted by connectors --- include/items.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/items.php b/include/items.php index 5915e2ecee..9a4d4d5e3c 100644 --- a/include/items.php +++ b/include/items.php @@ -1423,7 +1423,10 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa // Fill the cache field put_item_in_cache($arr); - call_hooks('post_remote',$arr); + if ($notify) + call_hooks('post_local',$arr); + else + call_hooks('post_remote',$arr); if(x($arr,'cancel')) { logger('item_store: post cancelled by plugin.'); @@ -1569,7 +1572,10 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa $r = q('SELECT * FROM `item` WHERE id = %d', intval($current_post)); if (count($r) == 1) { - call_hooks('post_remote_end', $r[0]); + if ($notify) + call_hooks('post_local_end', $r[0]); + else + call_hooks('post_remote_end', $r[0]); } else logger('item_store: new item not found in DB, id ' . $current_post); } From f2cb9b889edfd296fc934ac86222d750e2cf3a33 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 7 Sep 2015 23:33:02 +0200 Subject: [PATCH 2/2] Only set a prefix for the guid if it is a locally stored item --- include/items.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/items.php b/include/items.php index 9a4d4d5e3c..b00942b5ae 100644 --- a/include/items.php +++ b/include/items.php @@ -1209,8 +1209,13 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa } } + if ($notify) + $guid_prefix = ""; + else + $guid_prefix = $arr['network']; + $arr['wall'] = ((x($arr,'wall')) ? intval($arr['wall']) : 0); - $arr['guid'] = ((x($arr,'guid')) ? notags(trim($arr['guid'])) : get_guid(32, $arr['network'])); + $arr['guid'] = ((x($arr,'guid')) ? notags(trim($arr['guid'])) : get_guid(32, $guid_prefix)); $arr['uri'] = ((x($arr,'uri')) ? notags(trim($arr['uri'])) : $arr['guid']); $arr['extid'] = ((x($arr,'extid')) ? notags(trim($arr['extid'])) : ''); $arr['author-name'] = ((x($arr,'author-name')) ? notags(trim($arr['author-name'])) : '');