mirror of
https://github.com/chatmail/core.git
synced 2026-04-19 22:46:29 +03:00
feat: send sync messages over SMTP and do not move them to mvbox
This commit is contained in:
@@ -711,46 +711,6 @@ impl TestContext {
|
||||
})
|
||||
}
|
||||
|
||||
/// Retrieves a sent sync message from the db.
|
||||
///
|
||||
/// This retrieves and removes a sync message which has been scheduled to send from the jobs
|
||||
/// table. Messages are returned in the order they have been sent.
|
||||
///
|
||||
/// Panics if there is no message or on any error.
|
||||
pub async fn pop_sent_sync_msg(&self) -> SentMessage<'_> {
|
||||
let (id, msg_id, payload) = self
|
||||
.ctx
|
||||
.sql
|
||||
.query_row(
|
||||
"SELECT id, msg_id, mime \
|
||||
FROM imap_send \
|
||||
ORDER BY id",
|
||||
(),
|
||||
|row| {
|
||||
let rowid: i64 = row.get(0)?;
|
||||
let msg_id: MsgId = row.get(1)?;
|
||||
let mime: String = row.get(2)?;
|
||||
Ok((rowid, msg_id, mime))
|
||||
},
|
||||
)
|
||||
.await
|
||||
.expect("query_row failed");
|
||||
self.ctx
|
||||
.sql
|
||||
.execute("DELETE FROM imap_send WHERE id=?", (id,))
|
||||
.await
|
||||
.expect("failed to remove job");
|
||||
update_msg_state(&self.ctx, msg_id, MessageState::OutDelivered)
|
||||
.await
|
||||
.expect("failed to update message state");
|
||||
SentMessage {
|
||||
payload,
|
||||
sender_msg_id: msg_id,
|
||||
sender_context: &self.ctx,
|
||||
recipients: self.get_primary_self_addr().await.unwrap(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Parses a message.
|
||||
///
|
||||
/// Parsing a message does not run the entire receive pipeline, but is not without
|
||||
@@ -1550,7 +1510,7 @@ pub(crate) async fn mark_as_verified(this: &TestContext, other: &TestContext) {
|
||||
/// alice0's side that implies sending a sync message.
|
||||
pub(crate) async fn sync(alice0: &TestContext, alice1: &TestContext) {
|
||||
alice0.send_sync_msg().await.unwrap();
|
||||
let sync_msg = alice0.pop_sent_sync_msg().await;
|
||||
let sync_msg = alice0.pop_sent_msg().await;
|
||||
alice1.recv_msg_trash(&sync_msg).await;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user