Delta Chat Core C-API
dc_job.h
1 #ifndef __DC_JOB_H__
2 #define __DC_JOB_H__
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
6 
7 
8 // thread IDs
9 #define DC_IMAP_THREAD 100
10 #define DC_SMTP_THREAD 5000
11 
12 
13 // jobs in the INBOX-thread
14 #define DC_JOB_HOUSEKEEPING 105 // low priority ...
15 #define DC_JOB_DELETE_MSG_ON_IMAP 110
16 #define DC_JOB_MARKSEEN_MDN_ON_IMAP 120
17 #define DC_JOB_MARKSEEN_MSG_ON_IMAP 130
18 #define DC_JOB_MOVE_MSG 200
19 #define DC_JOB_CONFIGURE_IMAP 900
20 #define DC_JOB_IMEX_IMAP 910 // ... high priority
21 
22 
23 // jobs in the SMTP-thread
24 #define DC_JOB_SEND_MDN 5010 // low priority ...
25 #define DC_JOB_SEND_MSG_TO_SMTP 5900 // ... high priority
26 
27 
28 // timeouts until actions are aborted.
29 // this may also affects IDLE to return, so a re-connect may take this time.
30 // mailcore2 uses 30 seconds, k-9 uses 10 seconds
31 #define DC_IMAP_TIMEOUT_SEC 10
32 #define DC_SMTP_TIMEOUT_SEC 10
33 
34 
35 typedef struct _dc_job dc_job_t;
36 
40 struct _dc_job
41 {
44  uint32_t job_id;
45  int action;
46  uint32_t foreign_id;
47  time_t desired_timestamp;
48  time_t added_timestamp;
49  int tries;
50  dc_param_t* param;
51 
52  int try_again;
53  char* pending_error; // discarded if the retry succeeds
54 };
55 
56 
57 void dc_job_add (dc_context_t*, int action, int foreign_id, const char* param, int delay);
58 void dc_job_kill_action (dc_context_t*, int action); /* delete all pending jobs with the given action */
59 
60 #define DC_DONT_TRY_AGAIN 0
61 #define DC_AT_ONCE -1
62 #define DC_INCREATION_POLL 2 // this value does not increase the number of tries
63 #define DC_STANDARD_DELAY 3
64 void dc_job_try_again_later (dc_job_t*, int try_again, const char* error);
65 
66 
67 // the other dc_job_do_DC_JOB_*() functions are declared static in the c-file
68 void dc_job_do_DC_JOB_CONFIGURE_IMAP (dc_context_t*, dc_job_t*);
69 void dc_job_do_DC_JOB_IMEX_IMAP (dc_context_t*, dc_job_t*);
70 
71 
72 #ifdef __cplusplus
73 } /* /extern "C" */
74 #endif
75 #endif /* __DC_JOB_H__ */
76 
An object representing a single account.