public scope delivery issues

This commit is contained in:
friendica 2014-08-06 21:16:24 -07:00
parent 86bccf35a2
commit 2cff122d6f
3 changed files with 18 additions and 7 deletions

View File

@ -903,7 +903,6 @@ function encode_item($item) {
if($y = encode_item_flags($item)) if($y = encode_item_flags($item))
$x['flags'] = $y; $x['flags'] = $y;
if($scope != 'public')
$x['public_scope'] = $scope; $x['public_scope'] = $scope;
if($item['item_flags'] & ITEM_NOCOMMENT) if($item['item_flags'] & ITEM_NOCOMMENT)
@ -2453,6 +2452,8 @@ function tag_deliver($uid,$item_id) {
$private = (($u[0]['channel_allow_cid'] || $u[0]['channel_allow_gid'] || $u[0]['channel_deny_cid'] || $u[0]['channel_deny_gid']) ? 1 : 0); $private = (($u[0]['channel_allow_cid'] || $u[0]['channel_allow_gid'] || $u[0]['channel_deny_cid'] || $u[0]['channel_deny_gid']) ? 1 : 0);
//FIXME - add check for public_policy
$flag_bits = ITEM_WALL|ITEM_ORIGIN; $flag_bits = ITEM_WALL|ITEM_ORIGIN;
// maintain the original source, which will be the original item owner and was stored in source_xchan // maintain the original source, which will be the original item owner and was stored in source_xchan
@ -2593,6 +2594,8 @@ function tag_deliver($uid,$item_id) {
$private = (($u[0]['channel_allow_cid'] || $u[0]['channel_allow_gid'] || $u[0]['channel_deny_cid'] || $u[0]['channel_deny_gid']) ? 1 : 0); $private = (($u[0]['channel_allow_cid'] || $u[0]['channel_allow_gid'] || $u[0]['channel_deny_cid'] || $u[0]['channel_deny_gid']) ? 1 : 0);
// FIXME set public_policy and recheck private
$flag_bits = ITEM_WALL|ITEM_ORIGIN|ITEM_UPLINK; $flag_bits = ITEM_WALL|ITEM_ORIGIN|ITEM_UPLINK;
// preserve the source // preserve the source

View File

@ -1200,6 +1200,12 @@ function zot_import($arr, $sender_url) {
continue; continue;
} }
// It's a specifically targetted post. If we were sent a public_scope hint (likely),
// get rid of it so that it doesn't get stored and cause trouble.
if(array_key_exists('message',$i) && array_key_exists('public_scope',$i['message']))
unset($i['message']['public_scope']);
$deliveries = $r; $deliveries = $r;
// We found somebody on this site that's in the recipient list. // We found somebody on this site that's in the recipient list.
@ -1207,10 +1213,12 @@ function zot_import($arr, $sender_url) {
} }
else { else {
if(($i['message']) && (array_key_exists('flags',$i['message'])) && (in_array('private',$i['message']['flags']))) { if(($i['message']) && (array_key_exists('flags',$i['message'])) && (in_array('private',$i['message']['flags']))) {
if(array_key_exists('public_scope',$i['message']) && $i['message']['public_scope'] === 'public') {
// This should not happen but until we can stop it... // This should not happen but until we can stop it...
logger('private message was delivered with no recipients.'); logger('private message was delivered with no recipients.');
continue; continue;
} }
}
logger('public post'); logger('public post');

View File

@ -275,14 +275,14 @@ function item_post(&$a) {
$str_contact_allow = $orig_post['allow_cid']; $str_contact_allow = $orig_post['allow_cid'];
$str_group_deny = $orig_post['deny_gid']; $str_group_deny = $orig_post['deny_gid'];
$str_contact_deny = $orig_post['deny_cid']; $str_contact_deny = $orig_post['deny_cid'];
$public_scope = $orig_post['public_scope']; $public_policy = $orig_post['public_policy'];
} }
if((strlen($str_group_allow)) if((strlen($str_group_allow))
|| strlen($str_contact_allow) || strlen($str_contact_allow)
|| strlen($str_group_deny) || strlen($str_group_deny)
|| strlen($str_contact_deny) || strlen($str_contact_deny)
|| strlen($public_scope)) { || strlen($public_policy)) {
$private = 1; $private = 1;
} }