diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-06-28 22:33:13 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-06-28 22:33:13 -0700 |
commit | 63f2e9b41259975f1af6415cda01dc0f81b1af30 (patch) | |
tree | 01518a9183b0daf02350da8f8e7d853f1a039ffc /include/zot.php | |
parent | 8d84472b4cb85b50c314491e0706d80eb5b7de6d (diff) | |
parent | 090dae46e500634cec8f3718fbb83d5dbb8f9690 (diff) | |
download | volse-hubzilla-63f2e9b41259975f1af6415cda01dc0f81b1af30.tar.gz volse-hubzilla-63f2e9b41259975f1af6415cda01dc0f81b1af30.tar.bz2 volse-hubzilla-63f2e9b41259975f1af6415cda01dc0f81b1af30.zip |
Merge branch 'master' of https://github.com/redmatrix/redmatrix
Conflicts:
include/zot.php
mod/connedit.php
util/messages.po
Diffstat (limited to 'include/zot.php')
-rw-r--r-- | include/zot.php | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/include/zot.php b/include/zot.php index 568049237..dfaff268e 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1625,6 +1625,13 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $ } } + + $ab = q("select abook.* from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d + and abook_self = 0", + intval($channel['channel_id']) + ); + $abook = (($ab) ? $ab[0] : null); + if(intval($arr['item_deleted'])) { // remove_community_tag is a no-op if this isn't a community tag activity @@ -1665,10 +1672,15 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $ elseif($arr['edited'] > $r[0]['edited']) { $arr['id'] = $r[0]['id']; $arr['uid'] = $channel['channel_id']; - update_imported_item($sender,$arr,$channel['channel_id']); - $result[] = array($d['hash'],'updated',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); - if(! $relay) - add_source_route($item_id,$sender['hash']); + if(($arr['mid'] == $arr['parent_mid']) && (! post_is_importable($arr,$abook))) { + $result[] = array($d['hash'],'update ignored',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); + } + else { + update_imported_item($sender,$arr,$channel['channel_id']); + $result[] = array($d['hash'],'updated',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); + if(! $relay) + add_source_route($item_id,$sender['hash']); + } } else { $result[] = array($d['hash'],'update ignored',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); @@ -1688,18 +1700,24 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $ if(check_item_source($arr['uid'], $arr)) call_hooks('post_local', $arr); - - $item_result = item_store($arr); + $item_id = 0; - if($item_result['success']) { - $item_id = $item_result['item_id']; - $parr = array('item_id' => $item_id,'item' => $arr,'sender' => $sender,'channel' => $channel); - call_hooks('activity_received',$parr); - // don't add a source route if it's a relay or later recipients will get a route mismatch - if(! $relay) - add_source_route($item_id,$sender['hash']); + + if(($arr['mid'] == $arr['parent_mid']) && (! post_is_importable($arr,$abook))) { + $result[] = array($d['hash'],'post ignored',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); + } + else { + $item_result = item_store($arr); + if($item_result['success']) { + $item_id = $item_result['item_id']; + $parr = array('item_id' => $item_id,'item' => $arr,'sender' => $sender,'channel' => $channel); + call_hooks('activity_received',$parr); + // don't add a source route if it's a relay or later recipients will get a route mismatch + if(! $relay) + add_source_route($item_id,$sender['hash']); + } + $result[] = array($d['hash'],(($item_id) ? 'posted' : 'storage failed:' . $item_result['message']),$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); } - $result[] = array($d['hash'],(($item_id) ? 'posted' : 'storage failed:' . $item_result['message']),$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); } if($relay && $item_id) { |