From 732c6134ddfc6bb1df191c7967069e008d85acfb Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 14 Oct 2015 13:11:24 -0700 Subject: support for mail sync --- include/items.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index eed9dabb2..54dcf2b51 100755 --- a/include/items.php +++ b/include/items.php @@ -1561,7 +1561,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'; @@ -1595,6 +1595,18 @@ function encode_mail($item) { $x['body'] = ''; } + if($extended) { + $x['conv_guid'] = $item['conv_guid']; + if($item['mail_flags'] & MAIL_DELETED) + $x['flags'][] = 'deleted'; + if($item['mail_flags'] & MAIL_REPLIED) + $x['flags'][] = 'replied'; + if($item['mail_flags'] & MAIL_ISREPLY) + $x['flags'][] = 'isreply'; + if($item['mail_flags'] & MAIL_SEEN) + $x['flags'][] = 'seen'; + } + return $x; } @@ -1619,6 +1631,18 @@ function get_mail_elements($x) { if(in_array('recalled',$x['flags'])) { $arr['mail_flags'] |= MAIL_RECALLED; } + if(in_array('replied',$x['flags'])) { + $arr['mail_flags'] |= MAIL_REPLIED; + } + if(in_array('isreply',$x['flags'])) { + $arr['mail_flags'] |= MAIL_ISREPLY; + } + if(in_array('seen',$x['flags'])) { + $arr['mail_flags'] |= MAIL_SEEN; + } + if(in_array('deleted',$x['flags'])) { + $arr['mail_flags'] |= MAIL_DELETED; + } } $key = get_config('system','pubkey'); -- cgit v1.2.3 From b4e83b65375e62259671749c089d9cd7a2a2967a Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 14 Oct 2015 22:14:19 +0200 Subject: allow photo-items to appear full width if large photos feature is enabled. in prepare_body() split off mentions, tags, categories folders and attachments from body for easier theming. some other little fixes. --- include/items.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index e7cc02579..3b0072956 100755 --- a/include/items.php +++ b/include/items.php @@ -889,6 +889,7 @@ function get_item_elements($x,$allow_code = false) { $arr['mimetype'] = (($x['mimetype']) ? htmlspecialchars($x['mimetype'], ENT_COMPAT,'UTF-8',false) : ''); $arr['obj_type'] = (($x['object_type']) ? htmlspecialchars($x['object_type'], ENT_COMPAT,'UTF-8',false) : ''); $arr['tgt_type'] = (($x['target_type']) ? htmlspecialchars($x['target_type'], ENT_COMPAT,'UTF-8',false) : ''); + $arr['resource_type'] = (($x['resource_type']) ? htmlspecialchars($x['resource_type'], ENT_COMPAT,'UTF-8',false) : ''); $arr['public_policy'] = (($x['public_scope']) ? htmlspecialchars($x['public_scope'], ENT_COMPAT,'UTF-8',false) : ''); if($arr['public_policy'] === 'public') @@ -1285,6 +1286,7 @@ function encode_item($item,$mirror = false) { $x['verb'] = $item['verb']; $x['object_type'] = $item['obj_type']; $x['target_type'] = $item['tgt_type']; + $x['resource_type'] = $item['resource_type']; $x['permalink'] = $item['plink']; $x['location'] = $item['location']; $x['longlat'] = $item['coord']; -- cgit v1.2.3 From f4e708a02f70e0ca2dbe43419d6f1c92ff2000e9 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 14 Oct 2015 13:19:28 -0700 Subject: port of mail encoding --- include/items.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index e69e83b83..5569cd1e4 100755 --- a/include/items.php +++ b/include/items.php @@ -1594,13 +1594,13 @@ function encode_mail($item,$extended = false) { if($extended) { $x['conv_guid'] = $item['conv_guid']; - if($item['mail_flags'] & MAIL_DELETED) + if(intval($item['mail_deleted'])) $x['flags'][] = 'deleted'; - if($item['mail_flags'] & MAIL_REPLIED) + if(intval($item['mail_replied'])) $x['flags'][] = 'replied'; - if($item['mail_flags'] & MAIL_ISREPLY) + if(intval($item['mail_isreply'])) $x['flags'][] = 'isreply'; - if($item['mail_flags'] & MAIL_SEEN) + if(intval($item['mail_seen'])) $x['flags'][] = 'seen'; } @@ -1629,16 +1629,16 @@ function get_mail_elements($x) { $arr['mail_recalled'] = 1; } if(in_array('replied',$x['flags'])) { - $arr['mail_flags'] |= MAIL_REPLIED; + $arr['mail_replied'] = 1; } if(in_array('isreply',$x['flags'])) { - $arr['mail_flags'] |= MAIL_ISREPLY; + $arr['mail_isreply'] = 1; } if(in_array('seen',$x['flags'])) { - $arr['mail_flags'] |= MAIL_SEEN; + $arr['mail_seen'] = 1; } if(in_array('deleted',$x['flags'])) { - $arr['mail_flags'] |= MAIL_DELETED; + $arr['mail_deleted'] = 1; } } -- cgit v1.2.3 From 93f061f78a8b914a731838058a38354a62d002de Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 15 Oct 2015 18:52:04 -0700 Subject: mail sync/migrate continued; also abstract delivery loop to make it re-usable, change refresh_all to use delivery loop. --- include/items.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index ae5b0ca94..9159f6da3 100755 --- a/include/items.php +++ b/include/items.php @@ -1618,6 +1618,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; @@ -1656,6 +1658,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) : ''); @@ -3536,6 +3539,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 ); -- cgit v1.2.3