mirror of
https://github.com/deltachat/deltachat-core.git
synced 2025-10-05 10:39:27 +02:00
simplify job-adding
This commit is contained in:
parent
62f09a9fff
commit
fe44ea0cb0
2 changed files with 3 additions and 8 deletions
|
@ -509,11 +509,10 @@ void mrmailbox_suspend_smtp_thread(mrmailbox_t* mailbox, int suspend)
|
|||
******************************************************************************/
|
||||
|
||||
|
||||
uint32_t mrjob_add(mrmailbox_t* mailbox, int action, int foreign_id, const char* param, int delay_seconds)
|
||||
void mrjob_add(mrmailbox_t* mailbox, int action, int foreign_id, const char* param, int delay_seconds)
|
||||
{
|
||||
time_t timestamp = time(NULL);
|
||||
sqlite3_stmt* stmt;
|
||||
uint32_t job_id = 0;
|
||||
int thread;
|
||||
|
||||
if( action >= MR_IMAP_THREAD && action < MR_IMAP_THREAD+1000 ) {
|
||||
|
@ -523,7 +522,7 @@ uint32_t mrjob_add(mrmailbox_t* mailbox, int action, int foreign_id, const char*
|
|||
thread = MR_SMTP_THREAD;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
stmt = mrsqlite3_prepare_v2_(mailbox->m_sql,
|
||||
|
@ -537,16 +536,12 @@ uint32_t mrjob_add(mrmailbox_t* mailbox, int action, int foreign_id, const char*
|
|||
sqlite3_step(stmt);
|
||||
sqlite3_finalize(stmt);
|
||||
|
||||
job_id = sqlite3_last_insert_rowid(mailbox->m_sql->m_cobj);
|
||||
|
||||
if( thread == MR_IMAP_THREAD ) {
|
||||
mrmailbox_interrupt_idle(mailbox);
|
||||
}
|
||||
else {
|
||||
mrmailbox_interrupt_smtp_idle(mailbox);
|
||||
}
|
||||
|
||||
return job_id;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ typedef struct mrjob_t
|
|||
} mrjob_t;
|
||||
|
||||
|
||||
uint32_t mrjob_add (mrmailbox_t*, int action, int foreign_id, const char* param, int delay); /* returns the job_id or 0 on errors. the job may or may not be done if the function returns. */
|
||||
void mrjob_add (mrmailbox_t*, int action, int foreign_id, const char* param, int delay);
|
||||
void mrjob_kill_actions (mrmailbox_t*, int action1, int action2); /* delete all pending jobs with the given actions */
|
||||
|
||||
#define MR_AT_ONCE 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue