Make return type of Image::mv an enum

Replace named constants with enum to improve type-safety and make
exhausiveness checks possible.

Note, that since this enum never pass FFI border, its numeric values
does not need to be specified explicitly and can be left on compiler's
discretion.
This commit is contained in:
Dmitry Bogatov
2019-09-18 15:13:56 +00:00
parent 391a6bf422
commit 6ee9465d43
2 changed files with 23 additions and 15 deletions

View File

@@ -247,13 +247,13 @@ impl Job {
&dest_folder,
&mut dest_uid,
) {
DC_RETRY_LATER => {
ImapResult::RetryLater => {
self.try_again_later(3i32, None);
}
DC_SUCCESS => {
ImapResult::Success => {
dc_update_server_uid(context, &msg.rfc724_mid, &dest_folder, dest_uid);
}
DC_FAILED | DC_ALREADY_DONE | _ => {}
ImapResult::Failed | ImapResult::AlreadyDone => {}
}
}
}
@@ -401,8 +401,8 @@ impl Job {
}
let dest_folder = context.sql.get_config(context, "configured_mvbox_folder");
if let Some(dest_folder) = dest_folder {
if 1 == inbox.mv(context, folder, uid, dest_folder, &mut dest_uid)
as libc::c_uint
if ImapResult::RetryLater
== inbox.mv(context, folder, uid, dest_folder, &mut dest_uid)
{
self.try_again_later(3, None);
}