mirror of
https://github.com/chatmail/core.git
synced 2026-05-13 11:56:30 +03:00
rename jobs to make "rg Markseen" and other searches for the job enum produce all places dealing with the enum
This commit is contained in:
committed by
Alexander Krotov
parent
430d4e5f6e
commit
f87cb4231c
@@ -45,9 +45,8 @@ pub fn dc_is_configured(context: &Context) -> bool {
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Configure JOB
|
* Configure JOB
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
// the other dc_job_do_DC_JOB_*() functions are declared static in the c-file
|
|
||||||
#[allow(non_snake_case, unused_must_use)]
|
#[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() {
|
if !context.sql.is_open() {
|
||||||
error!(context, "Cannot configure, database not opened.",);
|
error!(context, "Cannot configure, database not opened.",);
|
||||||
progress!(context, 0);
|
progress!(context, 0);
|
||||||
@@ -601,7 +600,7 @@ pub fn read_autoconf_file(context: &Context, url: &str) -> Option<String> {
|
|||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
use crate::config::*;
|
use crate::config::*;
|
||||||
use crate::configure::dc_job_do_DC_JOB_CONFIGURE_IMAP;
|
use crate::configure::JobConfigureImap;
|
||||||
use crate::test_utils::*;
|
use crate::test_utils::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -611,6 +610,6 @@ mod tests {
|
|||||||
.set_config(Config::Addr, Some("probably@unexistant.addr"))
|
.set_config(Config::Addr, Some("probably@unexistant.addr"))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
t.ctx.set_config(Config::MailPw, Some("123456")).unwrap();
|
t.ctx.set_config(Config::MailPw, Some("123456")).unwrap();
|
||||||
dc_job_do_DC_JOB_CONFIGURE_IMAP(&t.ctx);
|
JobConfigureImap(&t.ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ pub fn normalize_setup_code(s: &str) -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[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");
|
ensure!(context.alloc_ongoing(), "could not allocate ongoing");
|
||||||
let what: Option<ImexMode> = job.param.get_int(Param::Cmd).and_then(ImexMode::from_i32);
|
let what: Option<ImexMode> = job.param.get_int(Param::Cmd).and_then(ImexMode::from_i32);
|
||||||
let param = job.param.get(Param::Arg).unwrap_or_default();
|
let param = job.param.get(Param::Arg).unwrap_or_default();
|
||||||
|
|||||||
38
src/job.rs
38
src/job.rs
@@ -137,7 +137,7 @@ impl Job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[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 */
|
/* connect to SMTP server, if not yet done */
|
||||||
if !context.smtp.lock().unwrap().is_connected() {
|
if !context.smtp.lock().unwrap().is_connected() {
|
||||||
let loginparam = LoginParam::from_database(context, "configured_");
|
let loginparam = LoginParam::from_database(context, "configured_");
|
||||||
@@ -209,7 +209,7 @@ impl Job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[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;
|
let imap_inbox = &context.inbox_thread.read().unwrap().imap;
|
||||||
|
|
||||||
if let Ok(msg) = Message::load_from_db(context, MsgId::new(self.foreign_id)) {
|
if let Ok(msg) = Message::load_from_db(context, MsgId::new(self.foreign_id)) {
|
||||||
@@ -254,7 +254,7 @@ impl Job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[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;
|
let imap_inbox = &context.inbox_thread.read().unwrap().imap;
|
||||||
|
|
||||||
if let Ok(mut msg) = Message::load_from_db(context, MsgId::new(self.foreign_id)) {
|
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)]
|
#[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;
|
let imap_inbox = &context.inbox_thread.read().unwrap().imap;
|
||||||
if self.foreign_id & DC_EMPTY_MVBOX > 0 {
|
if self.foreign_id & DC_EMPTY_MVBOX > 0 {
|
||||||
if let Some(mvbox_folder) = context
|
if let Some(mvbox_folder) = context
|
||||||
@@ -299,7 +299,7 @@ impl Job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[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;
|
let imap_inbox = &context.inbox_thread.read().unwrap().imap;
|
||||||
|
|
||||||
if let Ok(msg) = Message::load_from_db(context, MsgId::new(self.foreign_id)) {
|
if let Ok(msg) = Message::load_from_db(context, MsgId::new(self.foreign_id)) {
|
||||||
@@ -327,7 +327,7 @@ impl Job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[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
|
let folder = self
|
||||||
.param
|
.param
|
||||||
.get(Param::ServerFolder)
|
.get(Param::ServerFolder)
|
||||||
@@ -802,27 +802,25 @@ fn job_perform(context: &Context, thread: Thread, probe_network: bool) {
|
|||||||
|
|
||||||
match job.action {
|
match job.action {
|
||||||
Action::Unknown => {
|
Action::Unknown => {
|
||||||
warn!(context, "Unknown job id found");
|
info!(context, "Unknown job id found");
|
||||||
}
|
}
|
||||||
Action::SendMsgToSmtp => job.do_DC_JOB_SEND(context),
|
Action::SendMsgToSmtp => job.SendMsgToSmtp(context),
|
||||||
Action::EmptyServer => job.do_DC_JOB_EMPTY_SERVER(context),
|
Action::EmptyServer => job.EmptyServer(context),
|
||||||
Action::DeleteMsgOnImap => job.do_DC_JOB_DELETE_MSG_ON_IMAP(context),
|
Action::DeleteMsgOnImap => job.DeleteMsgOnImap(context),
|
||||||
Action::MarkseenMsgOnImap => job.do_DC_JOB_MARKSEEN_MSG_ON_IMAP(context),
|
Action::MarkseenMsgOnImap => job.MarkseenMsgOnImap(context),
|
||||||
Action::MarkseenMdnOnImap => job.do_DC_JOB_MARKSEEN_MDN_ON_IMAP(context),
|
Action::MarkseenMdnOnImap => job.MarkseenMdnOnImap(context),
|
||||||
Action::MoveMsg => job.do_DC_JOB_MOVE_MSG(context),
|
Action::MoveMsg => job.MoveMsg(context),
|
||||||
Action::SendMdn => job.do_DC_JOB_SEND(context),
|
Action::SendMdn => job.SendMsgToSmtp(context),
|
||||||
Action::ConfigureImap => dc_job_do_DC_JOB_CONFIGURE_IMAP(context),
|
Action::ConfigureImap => JobConfigureImap(context),
|
||||||
Action::ImexImap => match job_do_DC_JOB_IMEX_IMAP(context, &job) {
|
Action::ImexImap => match JobImexImap(context, &job) {
|
||||||
Ok(()) => {}
|
Ok(()) => {}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
error!(context, "{}", err);
|
error!(context, "{}", err);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Action::MaybeSendLocations => {
|
Action::MaybeSendLocations => location::JobMaybeSendLocations(context, &job),
|
||||||
location::job_do_DC_JOB_MAYBE_SEND_LOCATIONS(context, &job)
|
|
||||||
}
|
|
||||||
Action::MaybeSendLocationsEnded => {
|
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::Housekeeping => sql::housekeeping(context),
|
||||||
Action::SendMdnOld => {}
|
Action::SendMdnOld => {}
|
||||||
|
|||||||
@@ -538,7 +538,7 @@ pub fn save(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[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 now = time();
|
||||||
let mut continue_streaming = false;
|
let mut continue_streaming = false;
|
||||||
info!(
|
info!(
|
||||||
@@ -628,7 +628,7 @@ pub fn job_do_DC_JOB_MAYBE_SEND_LOCATIONS(context: &Context, _job: &Job) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[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.
|
// this function is called when location-streaming _might_ have ended for a chat.
|
||||||
// the function checks, if location-streaming is really ended;
|
// the function checks, if location-streaming is really ended;
|
||||||
// if so, a device-message is added if not yet done.
|
// if so, a device-message is added if not yet done.
|
||||||
|
|||||||
Reference in New Issue
Block a user