diff options
Diffstat (limited to 'include')
-rwxr-xr-x | include/diaspora.php | 10 | ||||
-rwxr-xr-x | include/items.php | 8 | ||||
-rw-r--r-- | include/message.php | 16 | ||||
-rw-r--r-- | include/text.php | 5 | ||||
-rw-r--r-- | include/zot.php | 2 |
5 files changed, 18 insertions, 23 deletions
diff --git a/include/diaspora.php b/include/diaspora.php index 997cbb187..ef02b5fc0 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -1723,14 +1723,14 @@ function diaspora_conversation($importer,$xml,$msg) { if($body) $body = str_rot47(base64url_encode($body)); - q("insert into mail ( `channel_id`, `convid`, `from_xchan`,`to_xchan`,`title`,`body`,`mail_flags`,`mid`,`parent_mid`,`created`) values ( %d, %d, '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s')", + q("insert into mail ( `channel_id`, `convid`, `from_xchan`,`to_xchan`,`title`,`body`,`mail_obscured`,`mid`,`parent_mid`,`created`) values ( %d, %d, '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s')", intval($importer['channel_id']), intval($conversation['id']), dbesc($person['xchan_hash']), dbesc($importer['channel_hash']), dbesc($subject), dbesc($body), - intval(MAIL_OBSCURED), + intval(1), dbesc($msg_guid), dbesc($parent_uri), dbesc($msg_created_at) @@ -1855,14 +1855,14 @@ function diaspora_message($importer,$xml,$msg) { if($body) $body = str_rot47(base64url_encode($body)); - q("insert into mail ( `channel_id`, `convid`, `from_xchan`,`to_xchan`,`title`,`body`,`mail_flags`,`mid`,`parent_mid`,`created`) values ( %d, %d, '%s', '%s', '%s', '%s', '%d','%s','%s','%s')", + q("insert into mail ( `channel_id`, `convid`, `from_xchan`,`to_xchan`,`title`,`body`,`mail_obscured`,`mid`,`parent_mid`,`created`) values ( %d, %d, '%s', '%s', '%s', '%s', '%d','%s','%s','%s')", intval($importer['channel_id']), intval($conversation['id']), dbesc($person['xchan_hash']), dbesc($importer['xchan_hash']), dbesc($subject), dbesc($body), - intval(MAIL_OBSCURED), + intval(1), dbesc($msg_guid), dbesc($parent_uri), dbesc($msg_created_at) @@ -2897,7 +2897,7 @@ function diaspora_send_mail($item,$owner,$contact) { 'participant_handles' => xmlify($cnv['recips']) ); - if(array_key_exists('mail_flags',$item) && ($item['mail_flags'] & MAIL_OBSCURED)) { + if(array_key_exists('mail_obscured',$item) && intval($item['mail_obscured'])) { if($item['title']) $item['title'] = base64url_decode(str_rot47($item['title'])); if($item['body']) diff --git a/include/items.php b/include/items.php index ee8ce5575..cf7e28daa 100755 --- a/include/items.php +++ b/include/items.php @@ -1473,7 +1473,7 @@ function encode_mail($item) { $x['type'] = 'mail'; $x['encoding'] = 'zot'; - if(array_key_exists('mail_flags',$item) && ($item['mail_flags'] & MAIL_OBSCURED)) { + if(array_key_exists('mail_obscured',$item) && intval($item['mail_obscured'])) { if($item['title']) $item['title'] = base64url_decode(str_rot47($item['title'])); if($item['body']) @@ -1495,7 +1495,7 @@ function encode_mail($item) { $x['flags'] = array(); - if($item['mail_flags'] & MAIL_RECALLED) { + if(intval($item['mail_recalled'])) { $x['flags'][] = 'recalled'; $x['title'] = ''; $x['body'] = ''; @@ -1523,12 +1523,12 @@ function get_mail_elements($x) { if($x['flags'] && is_array($x['flags'])) { if(in_array('recalled',$x['flags'])) { - $arr['mail_flags'] |= MAIL_RECALLED; + $arr['mail_recalled'] = 1; } } $key = get_config('system','pubkey'); - $arr['mail_flags'] |= MAIL_OBSCURED; + $arr['mail_obscured'] = 1; if($arr['body']) { $arr['body'] = str_rot47(base64url_encode($arr['body'])); $arr['body'] = htmlspecialchars($arr['body'],ENT_COMPAT,'UTF-8',false); diff --git a/include/message.php b/include/message.php index 8f1430e64..46f113cf4 100644 --- a/include/message.php +++ b/include/message.php @@ -283,8 +283,8 @@ function private_messages_list($uid, $mailbox = '', $start = 0, $numitems = 0) { foreach($r as $k => $rr) { $r[$k]['from'] = find_xchan_in_array($rr['from_xchan'],$c); $r[$k]['to'] = find_xchan_in_array($rr['to_xchan'],$c); - $r[$k]['seen'] = (($rr['mail_flags'] & MAIL_SEEN) ? 1 : 0); - if($r[$k]['mail_flags'] & MAIL_OBSCURED) { + $r[$k]['seen'] = intval($rr['mail_seen']); + if(intval($r[$k]['mail_obscured'])) { if($r[$k]['title']) $r[$k]['title'] = base64url_decode(str_rot47($r[$k]['title'])); if($r[$k]['body']) @@ -322,7 +322,7 @@ function private_messages_fetch_message($channel_id, $messageitem_id, $updatesee foreach($messages as $k => $message) { $messages[$k]['from'] = find_xchan_in_array($message['from_xchan'],$c); $messages[$k]['to'] = find_xchan_in_array($message['to_xchan'],$c); - if($messages[$k]['mail_flags'] & MAIL_OBSCURED) { + if(intval($messages[$k]['mail_obscured'])) { if($messages[$k]['title']) $messages[$k]['title'] = base64url_decode(str_rot47($messages[$k]['title'])); if($messages[$k]['body']) @@ -331,9 +331,7 @@ function private_messages_fetch_message($channel_id, $messageitem_id, $updatesee } if($updateseen) { - $r = q("UPDATE `mail` SET mail_flags = (mail_flags | %d) where not (mail_flags & %d)>0 and id = %d AND channel_id = %d", - intval(MAIL_SEEN), - intval(MAIL_SEEN), + $r = q("UPDATE `mail` SET mail_seen = 1 where mail_seen = 0 and id = %d AND channel_id = %d", dbesc($messageitem_id), intval($channel_id) ); @@ -409,7 +407,7 @@ function private_messages_fetch_conversation($channel_id, $messageitem_id, $upda foreach($messages as $k => $message) { $messages[$k]['from'] = find_xchan_in_array($message['from_xchan'],$c); $messages[$k]['to'] = find_xchan_in_array($message['to_xchan'],$c); - if($messages[$k]['mail_flags'] & MAIL_OBSCURED) { + if(intval($messages[$k]['mail_obscured'])) { if($messages[$k]['title']) $messages[$k]['title'] = base64url_decode(str_rot47($messages[$k]['title'])); if($messages[$k]['body']) @@ -419,9 +417,7 @@ function private_messages_fetch_conversation($channel_id, $messageitem_id, $upda if($updateseen) { - $r = q("UPDATE `mail` SET mail_flags = (mail_flags | %d) where not (mail_flags & %d)>0 and parent_mid = '%s' AND channel_id = %d", - intval(MAIL_SEEN), - intval(MAIL_SEEN), + $r = q("UPDATE `mail` SET mail_seen = 1 where mail_seen = 0 and parent_mid = '%s' AND channel_id = %d", dbesc($r[0]['parent_mid']), intval($channel_id) ); diff --git a/include/text.php b/include/text.php index 377c1c46f..33562a69f 100644 --- a/include/text.php +++ b/include/text.php @@ -1251,10 +1251,9 @@ function unobscure(&$item) { if($item['body']) $item['body'] = crypto_unencapsulate(json_decode_plus($item['body']),$key); if(get_config('system','item_cache')) { - q("update item set title = '%s', body = '%s', item_flags = %d where id = %d", + q("update item set title = '%s', body = '%s', item_obscured = 0 where id = %d", dbesc($item['title']), dbesc($item['body']), - intval($item['item_flags'] - ITEM_OBSCURED), intval($item['id']) ); } @@ -1262,7 +1261,7 @@ function unobscure(&$item) { } function unobscure_mail(&$item) { - if(array_key_exists('mail_flags',$item) && ($item['mail_flags'] & MAIL_OBSCURED)) { + if(array_key_exists('mail_obscured',$item) && intval($item['mail_obscured'])) { if($item['title']) $item['title'] = base64url_decode(str_rot47($item['title'])); if($item['body']) diff --git a/include/zot.php b/include/zot.php index 2187f3103..568049237 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1926,7 +1926,7 @@ function process_mail_delivery($sender, $arr, $deliveries) { intval($channel['channel_id']) ); if($r) { - if($arr['mail_flags'] & MAIL_RECALLED) { + if(intval($arr['mail_recalled'])) { $x = q("delete from mail where id = %d and channel_id = %d", intval($r[0]['id']), intval($channel['channel_id']) |