support for mail sync

This commit is contained in:
redmatrix 2015-10-14 13:11:24 -07:00
parent 578f1b8ece
commit 732c6134dd
3 changed files with 51 additions and 2 deletions

View File

@ -622,6 +622,31 @@ function identity_basic_export($channel_id, $items = false) {
if($r) if($r)
$ret['likes'] = $r; $ret['likes'] = $r;
$r = q("select * from conv where uid = %d",
intval($channel_id)
);
if($r)
$ret['conv'] = $r;
$r = q("select mail.*, conv.guid as conv_guid from mail left join conv on mail.convid = conv.id where mail.uid = %d",
intval($channel_id)
);
if($r) {
$m = array();
foreach($r as $rr) {
}
$ret['mail'] = $m;
}
$r = q("select item_id.*, item.mid from item_id left join item on item_id.iid = item.id where item_id.uid = %d", $r = q("select item_id.*, item.mid from item_id left join item on item_id.iid = item.id where item_id.uid = %d",
intval($channel_id) intval($channel_id)
); );

View File

@ -1561,7 +1561,7 @@ function encode_item_flags($item) {
return $ret; return $ret;
} }
function encode_mail($item) { function encode_mail($item,$extended = false) {
$x = array(); $x = array();
$x['type'] = 'mail'; $x['type'] = 'mail';
$x['encoding'] = 'zot'; $x['encoding'] = 'zot';
@ -1595,6 +1595,18 @@ function encode_mail($item) {
$x['body'] = ''; $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; return $x;
} }
@ -1619,6 +1631,18 @@ function get_mail_elements($x) {
if(in_array('recalled',$x['flags'])) { if(in_array('recalled',$x['flags'])) {
$arr['mail_flags'] |= MAIL_RECALLED; $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'); $key = get_config('system','pubkey');

View File

@ -1 +1 @@
2015-10-13.1184 2015-10-14.1185