From f87cb4231cd16c86f5ddfc49707e202392400ef7 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Thu, 28 Nov 2019 16:38:34 +0100 Subject: [PATCH] rename jobs to make "rg Markseen" and other searches for the job enum produce all places dealing with the enum --- src/configure/mod.rs | 7 +++---- src/imex.rs | 2 +- src/job.rs | 38 ++++++++++++++++++-------------------- src/location.rs | 4 ++-- 4 files changed, 24 insertions(+), 27 deletions(-) diff --git a/src/configure/mod.rs b/src/configure/mod.rs index 50297a6fd..9f2a64031 100644 --- a/src/configure/mod.rs +++ b/src/configure/mod.rs @@ -45,9 +45,8 @@ pub fn dc_is_configured(context: &Context) -> bool { /******************************************************************************* * Configure JOB ******************************************************************************/ -// the other dc_job_do_DC_JOB_*() functions are declared static in the c-file #[allow(non_snake_case, unused_must_use)] -pub fn dc_job_do_DC_JOB_CONFIGURE_IMAP(context: &Context) { +pub fn JobConfigureImap(context: &Context) { if !context.sql.is_open() { error!(context, "Cannot configure, database not opened.",); progress!(context, 0); @@ -601,7 +600,7 @@ pub fn read_autoconf_file(context: &Context, url: &str) -> Option { mod tests { use crate::config::*; - use crate::configure::dc_job_do_DC_JOB_CONFIGURE_IMAP; + use crate::configure::JobConfigureImap; use crate::test_utils::*; #[test] @@ -611,6 +610,6 @@ mod tests { .set_config(Config::Addr, Some("probably@unexistant.addr")) .unwrap(); t.ctx.set_config(Config::MailPw, Some("123456")).unwrap(); - dc_job_do_DC_JOB_CONFIGURE_IMAP(&t.ctx); + JobConfigureImap(&t.ctx); } } diff --git a/src/imex.rs b/src/imex.rs index b71369b3b..c5c3066ad 100644 --- a/src/imex.rs +++ b/src/imex.rs @@ -367,7 +367,7 @@ pub fn normalize_setup_code(s: &str) -> String { } #[allow(non_snake_case)] -pub fn job_do_DC_JOB_IMEX_IMAP(context: &Context, job: &Job) -> Result<()> { +pub fn JobImexImap(context: &Context, job: &Job) -> Result<()> { ensure!(context.alloc_ongoing(), "could not allocate ongoing"); let what: Option = job.param.get_int(Param::Cmd).and_then(ImexMode::from_i32); let param = job.param.get(Param::Arg).unwrap_or_default(); diff --git a/src/job.rs b/src/job.rs index d6ac6ed6d..9db698c07 100644 --- a/src/job.rs +++ b/src/job.rs @@ -137,7 +137,7 @@ impl Job { } #[allow(non_snake_case)] - fn do_DC_JOB_SEND(&mut self, context: &Context) { + fn SendMsgToSmtp(&mut self, context: &Context) { /* connect to SMTP server, if not yet done */ if !context.smtp.lock().unwrap().is_connected() { let loginparam = LoginParam::from_database(context, "configured_"); @@ -209,7 +209,7 @@ impl Job { } #[allow(non_snake_case)] - fn do_DC_JOB_MOVE_MSG(&mut self, context: &Context) { + fn MoveMsg(&mut self, context: &Context) { let imap_inbox = &context.inbox_thread.read().unwrap().imap; if let Ok(msg) = Message::load_from_db(context, MsgId::new(self.foreign_id)) { @@ -254,7 +254,7 @@ impl Job { } #[allow(non_snake_case)] - fn do_DC_JOB_DELETE_MSG_ON_IMAP(&mut self, context: &Context) { + fn DeleteMsgOnImap(&mut self, context: &Context) { let imap_inbox = &context.inbox_thread.read().unwrap().imap; if let Ok(mut msg) = Message::load_from_db(context, MsgId::new(self.foreign_id)) { @@ -283,7 +283,7 @@ impl Job { } #[allow(non_snake_case)] - fn do_DC_JOB_EMPTY_SERVER(&mut self, context: &Context) { + fn EmptyServer(&mut self, context: &Context) { let imap_inbox = &context.inbox_thread.read().unwrap().imap; if self.foreign_id & DC_EMPTY_MVBOX > 0 { if let Some(mvbox_folder) = context @@ -299,7 +299,7 @@ impl Job { } #[allow(non_snake_case)] - fn do_DC_JOB_MARKSEEN_MSG_ON_IMAP(&mut self, context: &Context) { + fn MarkseenMsgOnImap(&mut self, context: &Context) { let imap_inbox = &context.inbox_thread.read().unwrap().imap; if let Ok(msg) = Message::load_from_db(context, MsgId::new(self.foreign_id)) { @@ -327,7 +327,7 @@ impl Job { } #[allow(non_snake_case)] - fn do_DC_JOB_MARKSEEN_MDN_ON_IMAP(&mut self, context: &Context) { + fn MarkseenMdnOnImap(&mut self, context: &Context) { let folder = self .param .get(Param::ServerFolder) @@ -802,27 +802,25 @@ fn job_perform(context: &Context, thread: Thread, probe_network: bool) { match job.action { Action::Unknown => { - warn!(context, "Unknown job id found"); + info!(context, "Unknown job id found"); } - Action::SendMsgToSmtp => job.do_DC_JOB_SEND(context), - Action::EmptyServer => job.do_DC_JOB_EMPTY_SERVER(context), - Action::DeleteMsgOnImap => job.do_DC_JOB_DELETE_MSG_ON_IMAP(context), - Action::MarkseenMsgOnImap => job.do_DC_JOB_MARKSEEN_MSG_ON_IMAP(context), - Action::MarkseenMdnOnImap => job.do_DC_JOB_MARKSEEN_MDN_ON_IMAP(context), - Action::MoveMsg => job.do_DC_JOB_MOVE_MSG(context), - Action::SendMdn => job.do_DC_JOB_SEND(context), - Action::ConfigureImap => dc_job_do_DC_JOB_CONFIGURE_IMAP(context), - Action::ImexImap => match job_do_DC_JOB_IMEX_IMAP(context, &job) { + Action::SendMsgToSmtp => job.SendMsgToSmtp(context), + Action::EmptyServer => job.EmptyServer(context), + Action::DeleteMsgOnImap => job.DeleteMsgOnImap(context), + Action::MarkseenMsgOnImap => job.MarkseenMsgOnImap(context), + Action::MarkseenMdnOnImap => job.MarkseenMdnOnImap(context), + Action::MoveMsg => job.MoveMsg(context), + Action::SendMdn => job.SendMsgToSmtp(context), + Action::ConfigureImap => JobConfigureImap(context), + Action::ImexImap => match JobImexImap(context, &job) { Ok(()) => {} Err(err) => { error!(context, "{}", err); } }, - Action::MaybeSendLocations => { - location::job_do_DC_JOB_MAYBE_SEND_LOCATIONS(context, &job) - } + Action::MaybeSendLocations => location::JobMaybeSendLocations(context, &job), Action::MaybeSendLocationsEnded => { - location::job_do_DC_JOB_MAYBE_SEND_LOC_ENDED(context, &mut job) + location::JobMaybeSendLocationsEnded(context, &mut job) } Action::Housekeeping => sql::housekeeping(context), Action::SendMdnOld => {} diff --git a/src/location.rs b/src/location.rs index 2fd4700c7..92cb3a93a 100644 --- a/src/location.rs +++ b/src/location.rs @@ -538,7 +538,7 @@ pub fn save( } #[allow(non_snake_case)] -pub fn job_do_DC_JOB_MAYBE_SEND_LOCATIONS(context: &Context, _job: &Job) { +pub fn JobMaybeSendLocations(context: &Context, _job: &Job) { let now = time(); let mut continue_streaming = false; info!( @@ -628,7 +628,7 @@ pub fn job_do_DC_JOB_MAYBE_SEND_LOCATIONS(context: &Context, _job: &Job) { } #[allow(non_snake_case)] -pub fn job_do_DC_JOB_MAYBE_SEND_LOC_ENDED(context: &Context, job: &mut Job) { +pub fn JobMaybeSendLocationsEnded(context: &Context, job: &mut Job) { // this function is called when location-streaming _might_ have ended for a chat. // the function checks, if location-streaming is really ended; // if so, a device-message is added if not yet done.