]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #1883 from annando/1509-addon-remote-self
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Tue, 8 Sep 2015 04:47:27 +0000 (06:47 +0200)
committerTobias Diekershoff <tobias.diekershoff@gmx.net>
Tue, 8 Sep 2015 04:47:27 +0000 (06:47 +0200)
Bugfix: "remote self" items weren't posted by connectors

include/items.php

index 5915e2ecee24691462c56959c0a2d68cf9fbfcb7..b00942b5aee745b110a7bc2048f155ce4c6a4df1 100644 (file)
@@ -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']))   : '');
@@ -1423,7 +1428,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 +1577,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);
        }