aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/externals.php19
-rwxr-xr-xinclude/items.php12
-rw-r--r--include/zot.php2
3 files changed, 23 insertions, 10 deletions
diff --git a/include/externals.php b/include/externals.php
index e7e9504a0..96644d68d 100644
--- a/include/externals.php
+++ b/include/externals.php
@@ -64,6 +64,25 @@ function externals_run($argv, $argc){
$results = process_delivery(array('hash' => 'undefined'), get_item_elements($message),
array(array('hash' => $sys['xchan_hash'])), false, true);
$total ++;
+ $z = q("select id from item where mid = '%s' and uid = %d limit 1",
+ dbesc($message['message_id']),
+ intval($sys['channel_id'])
+ );
+ if($z) {
+ $flag_bits = ITEM_WALL|ITEM_ORIGIN|ITEM_UPLINK;
+ // preserve the source
+
+ $r = q("update item set source_xchan = owner_xchan where id = %d limit 1",
+ intval($z[0]['id'])
+ );
+
+ $r = q("update item set item_flags = ( item_flags | %d ), owner_xchan = '%s'
+ where id = %d limit 1",
+ intval($flag_bits),
+ dbesc($sys['xchan_hash']),
+ intval($z[0]['id'])
+ );
+ }
}
logger('externals: import_public_posts: ' . $total . ' messages imported', LOGGER_DEBUG);
}
diff --git a/include/items.php b/include/items.php
index af0d4d297..a7d3a21ce 100755
--- a/include/items.php
+++ b/include/items.php
@@ -842,14 +842,6 @@ function encode_item($item) {
$item['body'] = crypto_unencapsulate(json_decode_plus($item['body']),$key);
}
- if($item['item_restrict'] & ITEM_DELETED) {
- $x['message_id'] = $item['mid'];
- $x['created'] = $item['created'];
- $x['flags'] = array('deleted');
- $x['owner'] = encode_item_xchan($item['owner']);
- $x['author'] = encode_item_xchan($item['author']);
- return $x;
- }
$x['message_id'] = $item['mid'];
$x['message_top'] = $item['parent_mid'];
@@ -1034,9 +1026,11 @@ function encode_item_flags($item) {
// most of item_flags and item_restrict are local settings which don't apply when transmitted.
// We may need those for the case of syncing other hub locations which you are attached to.
-// ITEM_DELETED is handled in encode_item directly so we don't need to handle it here.
$ret = array();
+
+ if($item['item_restrict'] & ITEM_DELETED)
+ $ret[] = 'deleted';
if($item['item_flags'] & ITEM_THREAD_TOP)
$ret[] = 'thread_parent';
if($item['item_flags'] & ITEM_NSFW)
diff --git a/include/zot.php b/include/zot.php
index 19512c1ec..f9d527b33 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -1412,7 +1412,7 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false) {
}
if((! perm_is_allowed($channel['channel_id'],$sender['hash'],$perm)) && (! $tag_delivery) && (! $public)) {
- logger("permission denied for delivery {$channel['channel_id']}");
+ logger("permission denied for delivery to channel {$channel['channel_id']} {$channel['channel_address']}");
$result[] = array($d['hash'],'permission denied',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>');
continue;
}