mirror of
https://github.com/chatmail/core.git
synced 2026-04-02 05:22:14 +03:00
Change return type of Imap::set_seen to enum
This commit is contained in:
14
src/imap.rs
14
src/imap.rs
@@ -1262,11 +1262,11 @@ impl Imap {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_seen<S: AsRef<str>>(&self, context: &Context, folder: S, uid: u32) -> usize {
|
||||
let mut res = DC_RETRY_LATER;
|
||||
pub fn set_seen<S: AsRef<str>>(&self, context: &Context, folder: S, uid: u32) -> ImapResult {
|
||||
let mut res = ImapResult::RetryLater;
|
||||
|
||||
if uid == 0 {
|
||||
res = DC_FAILED
|
||||
res = ImapResult::Failed
|
||||
} else if self.is_connected() {
|
||||
info!(
|
||||
context,
|
||||
@@ -1284,15 +1284,15 @@ impl Imap {
|
||||
} else if self.add_flag(context, uid, "\\Seen") == 0 {
|
||||
warn!(context, "Cannot mark message as seen.",);
|
||||
} else {
|
||||
res = DC_SUCCESS
|
||||
res = ImapResult::Success
|
||||
}
|
||||
}
|
||||
|
||||
if res == DC_RETRY_LATER {
|
||||
if res == ImapResult::RetryLater {
|
||||
if self.should_reconnect() {
|
||||
DC_RETRY_LATER
|
||||
ImapResult::RetryLater
|
||||
} else {
|
||||
DC_FAILED
|
||||
ImapResult::Failed
|
||||
}
|
||||
} else {
|
||||
res
|
||||
|
||||
@@ -332,9 +332,9 @@ impl Job {
|
||||
if ok_to_continue {
|
||||
if let Ok(msg) = dc_msg_load_from_db(context, self.foreign_id) {
|
||||
let server_folder = msg.server_folder.as_ref().unwrap();
|
||||
match inbox.set_seen(context, server_folder, msg.server_uid) as libc::c_uint {
|
||||
0 => {}
|
||||
1 => {
|
||||
match inbox.set_seen(context, server_folder, msg.server_uid) {
|
||||
ImapResult::Failed => {}
|
||||
ImapResult::RetryLater => {
|
||||
self.try_again_later(3i32, None);
|
||||
}
|
||||
_ => {
|
||||
@@ -387,7 +387,7 @@ impl Job {
|
||||
ok_to_continue = true;
|
||||
}
|
||||
if ok_to_continue {
|
||||
if inbox.set_seen(context, &folder, uid) == 0 {
|
||||
if inbox.set_seen(context, &folder, uid) == ImapResult::Failed {
|
||||
self.try_again_later(3i32, None);
|
||||
}
|
||||
if 0 != self.param.get_int(Param::AlsoMove).unwrap_or_default() {
|
||||
|
||||
Reference in New Issue
Block a user