mirror of
https://github.com/chatmail/core.git
synced 2026-05-01 20:36:31 +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 {
|
pub fn set_seen<S: AsRef<str>>(&self, context: &Context, folder: S, uid: u32) -> ImapResult {
|
||||||
let mut res = DC_RETRY_LATER;
|
let mut res = ImapResult::RetryLater;
|
||||||
|
|
||||||
if uid == 0 {
|
if uid == 0 {
|
||||||
res = DC_FAILED
|
res = ImapResult::Failed
|
||||||
} else if self.is_connected() {
|
} else if self.is_connected() {
|
||||||
info!(
|
info!(
|
||||||
context,
|
context,
|
||||||
@@ -1284,15 +1284,15 @@ impl Imap {
|
|||||||
} else if self.add_flag(context, uid, "\\Seen") == 0 {
|
} else if self.add_flag(context, uid, "\\Seen") == 0 {
|
||||||
warn!(context, "Cannot mark message as seen.",);
|
warn!(context, "Cannot mark message as seen.",);
|
||||||
} else {
|
} else {
|
||||||
res = DC_SUCCESS
|
res = ImapResult::Success
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if res == DC_RETRY_LATER {
|
if res == ImapResult::RetryLater {
|
||||||
if self.should_reconnect() {
|
if self.should_reconnect() {
|
||||||
DC_RETRY_LATER
|
ImapResult::RetryLater
|
||||||
} else {
|
} else {
|
||||||
DC_FAILED
|
ImapResult::Failed
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
res
|
res
|
||||||
|
|||||||
@@ -332,9 +332,9 @@ impl Job {
|
|||||||
if ok_to_continue {
|
if ok_to_continue {
|
||||||
if let Ok(msg) = dc_msg_load_from_db(context, self.foreign_id) {
|
if let Ok(msg) = dc_msg_load_from_db(context, self.foreign_id) {
|
||||||
let server_folder = msg.server_folder.as_ref().unwrap();
|
let server_folder = msg.server_folder.as_ref().unwrap();
|
||||||
match inbox.set_seen(context, server_folder, msg.server_uid) as libc::c_uint {
|
match inbox.set_seen(context, server_folder, msg.server_uid) {
|
||||||
0 => {}
|
ImapResult::Failed => {}
|
||||||
1 => {
|
ImapResult::RetryLater => {
|
||||||
self.try_again_later(3i32, None);
|
self.try_again_later(3i32, None);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
@@ -387,7 +387,7 @@ impl Job {
|
|||||||
ok_to_continue = true;
|
ok_to_continue = true;
|
||||||
}
|
}
|
||||||
if ok_to_continue {
|
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);
|
self.try_again_later(3i32, None);
|
||||||
}
|
}
|
||||||
if 0 != self.param.get_int(Param::AlsoMove).unwrap_or_default() {
|
if 0 != self.param.get_int(Param::AlsoMove).unwrap_or_default() {
|
||||||
|
|||||||
Reference in New Issue
Block a user