aboutsummaryrefslogtreecommitdiff
path: root/src/mail/user.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-06-30 17:40:59 +0200
committerAlex Auvolat <alex@adnab.me>2022-06-30 17:40:59 +0200
commit2c61af6684c44e3558cc808c6b319bc9706adb00 (patch)
treed8828a6faed5c42665ed9a1732cb284ff045a3b7 /src/mail/user.rs
parent484ad97b65ba2295aadd9cf7eaf865573b859a10 (diff)
downloadaerogramme-2c61af6684c44e3558cc808c6b319bc9706adb00.tar.gz
aerogramme-2c61af6684c44e3558cc808c6b319bc9706adb00.zip
More work on incoming mails, but no mails yet
Diffstat (limited to 'src/mail/user.rs')
-rw-r--r--src/mail/user.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/mail/user.rs b/src/mail/user.rs
index fefb084..c2d1d85 100644
--- a/src/mail/user.rs
+++ b/src/mail/user.rs
@@ -9,10 +9,10 @@ use tokio::sync::watch;
use crate::cryptoblob::{open_deserialize, seal_serialize};
use crate::login::{Credentials, StorageCredentials};
+use crate::mail::incoming::incoming_mail_watch_process;
use crate::mail::mailbox::Mailbox;
use crate::mail::uidindex::ImapUidvalidity;
use crate::mail::unique_ident::{gen_ident, UniqueIdent};
-use crate::mail::incoming::incoming_mail_watch_process;
use crate::time::now_msec;
const MAILBOX_HIERARCHY_DELIMITER: &str = "/";
@@ -119,7 +119,7 @@ impl User {
let user = Arc::new(Self {
username,
- creds,
+ creds: creds.clone(),
k2v,
tx_inbox_id,
mailboxes: std::sync::Mutex::new(HashMap::new()),
@@ -128,12 +128,16 @@ impl User {
// Ensure INBOX exists (done inside load_mailbox_list)
user.load_mailbox_list().await?;
- tokio::spawn(incoming_mail_watch_process(Arc::downgrade(&user), rx_inbox_id));
+ tokio::spawn(incoming_mail_watch_process(
+ Arc::downgrade(&user),
+ user.creds.clone(),
+ rx_inbox_id,
+ ));
Ok(user)
}
- async fn open_mailbox_by_id(
+ pub(super) async fn open_mailbox_by_id(
&self,
id: UniqueIdent,
min_uidvalidity: ImapUidvalidity,
@@ -167,15 +171,15 @@ impl User {
let mut list = BTreeMap::new();
for v in cv.value {
if let K2vValue::Value(vbytes) = v {
- let list2 = open_deserialize::<MailboxList>(&vbytes, &self.creds.keys.master)?;
+ let list2 =
+ open_deserialize::<MailboxList>(&vbytes, &self.creds.keys.master)?;
list = merge_mailbox_lists(list, list2);
}
}
(list, Some(cv.causality))
- },
+ }
};
-
// If INBOX doesn't exist, create a new mailbox with that name
// and save new mailbox list.
// Also, ensure that the mpsc::watch that keeps track of the