diff options
Diffstat (limited to 'include/items.php')
-rwxr-xr-x | include/items.php | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/include/items.php b/include/items.php index e7cc02579..08be981e7 100755 --- a/include/items.php +++ b/include/items.php @@ -1559,7 +1559,7 @@ function encode_item_flags($item) { return $ret; } -function encode_mail($item) { +function encode_mail($item,$extended = false) { $x = array(); $x['type'] = 'mail'; $x['encoding'] = 'zot'; @@ -1592,6 +1592,18 @@ function encode_mail($item) { $x['body'] = ''; } + if($extended) { + $x['conv_guid'] = $item['conv_guid']; + if(intval($item['mail_deleted'])) + $x['flags'][] = 'deleted'; + if(intval($item['mail_replied'])) + $x['flags'][] = 'replied'; + if(intval($item['mail_isreply'])) + $x['flags'][] = 'isreply'; + if(intval($item['mail_seen'])) + $x['flags'][] = 'seen'; + } + return $x; } @@ -1604,6 +1616,8 @@ function get_mail_elements($x) { $arr['body'] = (($x['body']) ? htmlspecialchars($x['body'], ENT_COMPAT,'UTF-8',false) : ''); $arr['title'] = (($x['title'])? htmlspecialchars($x['title'],ENT_COMPAT,'UTF-8',false) : ''); + $arr['conv_guid'] = (($x['conv_guid'])? htmlspecialchars($x['conv_guid'],ENT_COMPAT,'UTF-8',false) : ''); + $arr['created'] = datetime_convert('UTC','UTC',$x['created']); if((! array_key_exists('expires',$x)) || ($x['expires'] === NULL_DATE)) $arr['expires'] = NULL_DATE; @@ -1616,6 +1630,18 @@ function get_mail_elements($x) { if(in_array('recalled',$x['flags'])) { $arr['mail_recalled'] = 1; } + if(in_array('replied',$x['flags'])) { + $arr['mail_replied'] = 1; + } + if(in_array('isreply',$x['flags'])) { + $arr['mail_isreply'] = 1; + } + if(in_array('seen',$x['flags'])) { + $arr['mail_seen'] = 1; + } + if(in_array('deleted',$x['flags'])) { + $arr['mail_deleted'] = 1; + } } $key = get_config('system','pubkey'); @@ -1630,6 +1656,7 @@ function get_mail_elements($x) { if($arr['created'] > datetime_convert()) $arr['created'] = datetime_convert(); + $arr['mid'] = (($x['message_id']) ? htmlspecialchars($x['message_id'], ENT_COMPAT,'UTF-8',false) : ''); $arr['parent_mid'] = (($x['message_parent']) ? htmlspecialchars($x['message_parent'], ENT_COMPAT,'UTF-8',false) : ''); @@ -3510,6 +3537,7 @@ function mail_store($arr) { $arr['title'] = ((x($arr,'title')) ? trim($arr['title']) : ''); $arr['parent_mid'] = ((x($arr,'parent_mid')) ? notags(trim($arr['parent_mid'])) : ''); $arr['body'] = ((x($arr,'body')) ? trim($arr['body']) : ''); + $arr['conv_guid'] = ((x($arr,'conv_guid')) ? trim($arr['conv_guid']) : ''); $arr['mail_flags'] = ((x($arr,'mail_flags')) ? intval($arr['mail_flags']) : 0 ); |