mail sync debugging
This commit is contained in:
parent
93f061f78a
commit
3f7ee613fc
@ -95,6 +95,7 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
|
|||||||
);
|
);
|
||||||
if($r) {
|
if($r) {
|
||||||
$retconv = $r[0];
|
$retconv = $r[0];
|
||||||
|
$retconv['subject'] = base64url_decode(str_rot47($retconv['subject']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,6 +106,7 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
|
|||||||
);
|
);
|
||||||
if($r) {
|
if($r) {
|
||||||
$retconv = $r[0];
|
$retconv = $r[0];
|
||||||
|
$retconv['subject'] = base64url_decode(str_rot47($retconv['subject']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,7 +211,8 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
|
|||||||
);
|
);
|
||||||
if($r) {
|
if($r) {
|
||||||
$post_id = $r[0]['id'];
|
$post_id = $r[0]['id'];
|
||||||
$retmail = $r;
|
$retmail = $r[0];
|
||||||
|
xchan_mail_query($retmail);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$ret['message'] = t('Stored post could not be verified.');
|
$ret['message'] = t('Stored post could not be verified.');
|
||||||
@ -382,31 +385,67 @@ function private_messages_fetch_message($channel_id, $messageitem_id, $updatesee
|
|||||||
|
|
||||||
function private_messages_drop($channel_id, $messageitem_id, $drop_conversation = false) {
|
function private_messages_drop($channel_id, $messageitem_id, $drop_conversation = false) {
|
||||||
|
|
||||||
if($drop_conversation) {
|
|
||||||
// find the parent_id
|
$x = q("select * from mail where id = %d and channel_id = %d limit 1",
|
||||||
$p = q("SELECT parent_mid, conv_guid FROM mail WHERE id = %d AND channel_id = %d LIMIT 1",
|
|
||||||
intval($messageitem_id),
|
intval($messageitem_id),
|
||||||
intval($channel_id)
|
intval($channel_id)
|
||||||
);
|
);
|
||||||
if($p) {
|
if(! $x)
|
||||||
|
return false;
|
||||||
|
|
||||||
$r = q("DELETE FROM mail WHERE parent_mid = '%s' AND channel_id = %d ",
|
$conversation = null;
|
||||||
dbesc($p[0]['parent_mid']),
|
|
||||||
|
if($x[0]['conv_guid']) {
|
||||||
|
$y = q("select * from conv where guid = '%s' and uid = %d limit 1",
|
||||||
|
dbesc($x[0]['conv_guid']),
|
||||||
intval($channel_id)
|
intval($channel_id)
|
||||||
);
|
);
|
||||||
if($r)
|
if($y) {
|
||||||
|
$conversation = $y[0];
|
||||||
|
$conversation['subject'] = base64url_decode(str_rot47($conversation['subject']));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($drop_conversation) {
|
||||||
|
$m = array();
|
||||||
|
$m['conv'] = array($conversation);
|
||||||
|
$m['conv'][0]['deleted'] = 1;
|
||||||
|
|
||||||
|
$z = q("select * from mail where parent_mid = '%s' and channel_id = %d",
|
||||||
|
dbesc($x[0]['parent_mid']),
|
||||||
|
intval($channel_id)
|
||||||
|
);
|
||||||
|
if($z) {
|
||||||
|
q("delete from conv where guid = '%s' and uid = %d limit 1",
|
||||||
|
dbesc($x[0]['conv_guid']),
|
||||||
|
intval($channel_id)
|
||||||
|
);
|
||||||
|
$m['mail'] = array();
|
||||||
|
foreach($z as $zz) {
|
||||||
|
xchan_mail_query($zz);
|
||||||
|
$zz['mail_deleted'] = 1;
|
||||||
|
$m['mail'][] = encode_mail($zz,true);
|
||||||
|
}
|
||||||
|
q("DELETE FROM mail WHERE parent_mid = '%s' AND channel_id = %d ",
|
||||||
|
dbesc($x[0]['parent_mid']),
|
||||||
|
intval($channel_id)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
build_sync_packet($channel_id,$m);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
|
xchan_mail_query($x[0]);
|
||||||
|
$x[0]['mail_deleted'] = true;
|
||||||
$r = q("DELETE FROM mail WHERE id = %d AND channel_id = %d",
|
$r = q("DELETE FROM mail WHERE id = %d AND channel_id = %d",
|
||||||
intval($messageitem_id),
|
intval($messageitem_id),
|
||||||
intval($channel_id)
|
intval($channel_id)
|
||||||
);
|
);
|
||||||
if($r)
|
build_sync_packet($channel_id,array('mail' => array(encode_mail($x,true))));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,6 +98,7 @@ function mail_post(&$a) {
|
|||||||
$ret = send_message(0, $recipient, $body, $subject, $replyto, $expires);
|
$ret = send_message(0, $recipient, $body, $subject, $replyto, $expires);
|
||||||
|
|
||||||
if($ret['success']) {
|
if($ret['success']) {
|
||||||
|
xchan_mail_query($ret['mail']);
|
||||||
build_sync_packet(0,array('conv' => array($ret['conv']),'mail' => array(encode_mail($ret['mail'],true))));
|
build_sync_packet(0,array('conv' => array($ret['conv']),'mail' => array(encode_mail($ret['mail'],true))));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -152,6 +153,14 @@ function mail_content(&$a) {
|
|||||||
intval(argv(3)),
|
intval(argv(3)),
|
||||||
intval(local_channel())
|
intval(local_channel())
|
||||||
);
|
);
|
||||||
|
$x = q("select * from mail where id = %d and channel_id = %d",
|
||||||
|
intval(argv(3)),
|
||||||
|
intval(local_channel())
|
||||||
|
);
|
||||||
|
if($x) {
|
||||||
|
build_sync_packet(local_channel(),array('mail' => encode_mail($x[0],true)));
|
||||||
|
}
|
||||||
|
|
||||||
proc_run('php','include/notifier.php','mail',intval(argv(3)));
|
proc_run('php','include/notifier.php','mail',intval(argv(3)));
|
||||||
|
|
||||||
if($r) {
|
if($r) {
|
||||||
|
Reference in New Issue
Block a user