diff --git a/docs/Doxyfile b/docs/Doxyfile
index efbff8d1..573eefdc 100644
--- a/docs/Doxyfile
+++ b/docs/Doxyfile
@@ -33,7 +33,7 @@ DOXYFILE_ENCODING = UTF-8
# The default value is: My Project.
######################################################
-PROJECT_NAME = "Delta Chat Core C-Library"
+PROJECT_NAME = "Delta Chat Core C-API"
######################################################
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
diff --git a/docs/html/annotated.html b/docs/html/annotated.html
index fee9f8a3..c6cefd67 100644
--- a/docs/html/annotated.html
+++ b/docs/html/annotated.html
@@ -4,7 +4,7 @@
-
Delta Chat Core C-Library: Class List
+Delta Chat Core C-API: Class List
@@ -24,7 +24,7 @@
-
Delta Chat Core C-Library
+
Delta Chat Core C-API
@@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-Generated on Tue Nov 14 2017 11:55:36 for Delta Chat Core C-Library by
+Generated on Tue Nov 14 2017 12:20:57 for Delta Chat Core C-API by 1.8.11
diff --git a/docs/html/classes.html b/docs/html/classes.html
index 13093407..c56a8825 100644
--- a/docs/html/classes.html
+++ b/docs/html/classes.html
@@ -4,7 +4,7 @@
-Delta Chat Core C-Library: Class Index
+Delta Chat Core C-API: Class Index
@@ -24,7 +24,7 @@
-
Delta Chat Core C-Library
+
Delta Chat Core C-API
@@ -97,7 +97,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-Generated on Tue Nov 14 2017 11:55:36 for Delta Chat Core C-Library by
+Generated on Tue Nov 14 2017 12:20:57 for Delta Chat Core C-API by 1.8.11
diff --git a/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html b/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html
index 68726907..1b0b06fd 100644
--- a/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html
+++ b/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html
@@ -4,7 +4,7 @@
-Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src Directory Reference
+Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src Directory Reference
@@ -24,7 +24,7 @@
-
Delta Chat Core C-Library
+
Delta Chat Core C-API
@@ -95,7 +95,7 @@ Files
-Generated on Tue Nov 14 2017 11:55:36 for Delta Chat Core C-Library by
+Generated on Tue Nov 14 2017 12:20:57 for Delta Chat Core C-API by 1.8.11
diff --git a/docs/html/files.html b/docs/html/files.html
index 29c7091b..ebe57cf2 100644
--- a/docs/html/files.html
+++ b/docs/html/files.html
@@ -4,7 +4,7 @@
-Delta Chat Core C-Library: File List
+Delta Chat Core C-API: File List
@@ -24,7 +24,7 @@
-
Delta Chat Core C-Library
+
Delta Chat Core C-API
@@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-Generated on Tue Nov 14 2017 11:55:36 for Delta Chat Core C-Library by
+Generated on Tue Nov 14 2017 12:20:57 for Delta Chat Core C-API by 1.8.11
diff --git a/docs/html/functions.html b/docs/html/functions.html
index 62ffd4c4..698c75cd 100644
--- a/docs/html/functions.html
+++ b/docs/html/functions.html
@@ -4,7 +4,7 @@
-Delta Chat Core C-Library: Class Members
+Delta Chat Core C-API: Class Members
@@ -24,7 +24,7 @@
-
Delta Chat Core C-Library
+
Delta Chat Core C-API
@@ -129,7 +129,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
: mrmsg_t
mrchatlist_get_summary()
: mrchatlist_t
@@ -477,7 +479,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-Generated on Tue Nov 14 2017 11:55:36 for Delta Chat Core C-Library by
+Generated on Tue Nov 14 2017 12:20:57 for Delta Chat Core C-API by 1.8.11
diff --git a/docs/html/functions_func.html b/docs/html/functions_func.html
index 065535f3..eb685780 100644
--- a/docs/html/functions_func.html
+++ b/docs/html/functions_func.html
@@ -4,7 +4,7 @@
-Delta Chat Core C-Library: Class Members - Functions
+Delta Chat Core C-API: Class Members - Functions
@@ -24,7 +24,7 @@
-
Delta Chat Core C-Library
+
Delta Chat Core C-API
@@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
mrchatlist_get_summary()
: mrchatlist_t
@@ -381,7 +381,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-Generated on Tue Nov 14 2017 11:55:36 for Delta Chat Core C-Library by
+Generated on Tue Nov 14 2017 12:20:57 for Delta Chat Core C-API by 1.8.11
diff --git a/docs/html/functions_rela.html b/docs/html/functions_rela.html
index 7af0cb0e..82387911 100644
--- a/docs/html/functions_rela.html
+++ b/docs/html/functions_rela.html
@@ -4,7 +4,7 @@
-Delta Chat Core C-Library: Class Members - Related Functions
+Delta Chat Core C-API: Class Members - Related Functions
@@ -24,7 +24,7 @@
-
Delta Chat Core C-Library
+
Delta Chat Core C-API
@@ -107,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-Generated on Tue Nov 14 2017 11:55:36 for Delta Chat Core C-Library by
+Generated on Tue Nov 14 2017 12:20:57 for Delta Chat Core C-API by 1.8.11
diff --git a/docs/html/functions_type.html b/docs/html/functions_type.html
index b88d7a53..37ffe29e 100644
--- a/docs/html/functions_type.html
+++ b/docs/html/functions_type.html
@@ -4,7 +4,7 @@
-Delta Chat Core C-Library: Class Members - Typedefs
+Delta Chat Core C-API: Class Members - Typedefs
@@ -24,7 +24,7 @@
-
Delta Chat Core C-Library
+
Delta Chat Core C-API
@@ -98,7 +98,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-Generated on Tue Nov 14 2017 11:55:36 for Delta Chat Core C-Library by
+Generated on Tue Nov 14 2017 12:20:57 for Delta Chat Core C-API by 1.8.11
diff --git a/docs/html/functions_vars.html b/docs/html/functions_vars.html
index 5a99546a..c4de5714 100644
--- a/docs/html/functions_vars.html
+++ b/docs/html/functions_vars.html
@@ -4,7 +4,7 @@
-Delta Chat Core C-Library: Class Members - Variables
+Delta Chat Core C-API: Class Members - Variables
@@ -24,7 +24,7 @@
-
Delta Chat Core C-Library
+
Delta Chat Core C-API
@@ -129,7 +129,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
: mrmsg_t
First of all, you have to define a function that is called by the library on specific events (eg. when the configuration is done or when fresh messages arrive). Your function should look like the following:
-
uintptr_t my_delta_handler(mrmailbox_t* nb, int event, uintptr_t data1, uintptr_t data2)
{
return 0; // for unhandled events, it is always safe to return 0
}
After that, you can create and configure a mrmailbox_t object easily as follows:
+
#include <mrmailbox.h>
uintptr_t my_delta_handler(mrmailbox_t* nb, int event, uintptr_t data1, uintptr_t data2)
{
return 0; // for unhandled events, it is always safe to return 0
}
After that, you can create and configure a mrmailbox_t object easily as follows:
Now, go to the testing address (bob) and you should have received a normal email. Answer this email in any email program with "Got it!" and you will get the message from delta as follows:
41 #define MR_CHAT_ID_DEADDROP 1 /* messages send from unknown/unwanted users to us, chats_contacts is not set up. This group may be shown normally. */
42 #define MR_CHAT_ID_TO_DEADDROP 2 /* messages send from us to unknown/unwanted users (this may happen when deleting chats or when using CC: in the email-program) */
43 #define MR_CHAT_ID_TRASH 3 /* messages that should be deleted get this chat_id; the messages are deleted from the working thread later then. This is also needed as rfc724_mid should be preset as long as the message is not deleted on the server (otherwise it is downloaded again) */
44 #define MR_CHAT_ID_MSGS_IN_CREATION 4 /* a message is just in creation but not yet assigned to a chat (eg. we may need the message ID to set up blobs; this avoids unready message to be send and shown) */
46 #define MR_CHAT_ID_ARCHIVED_LINK 6 /* a link at the end of the chatlist, if present the UI should show the button "Archived chats" */
47 #define MR_CHAT_ID_LAST_SPECIAL 9 /* larger chat IDs are "real" chats, their messages are "real" messages. */
48 uint32_t m_id;
49
50 #define MR_CHAT_TYPE_UNDEFINED 0
51 #define MR_CHAT_TYPE_NORMAL 100 /* a normal chat is a chat with a single contact, chats_contacts contains one record for the user, MR_CONTACT_ID_SELF is not added. */
52 #define MR_CHAT_TYPE_GROUP 120 /* a group chat, chats_contacts conain all group members, incl. MR_CONTACT_ID_SELF */
41 #define MR_CHAT_ID_DEADDROP 1 /* messages send from unknown/unwanted users to us, chats_contacts is not set up. This group may be shown normally. */
42 #define MR_CHAT_ID_TO_DEADDROP 2 /* messages send from us to unknown/unwanted users (this may happen when deleting chats or when using CC: in the email-program) */
43 #define MR_CHAT_ID_TRASH 3 /* messages that should be deleted get this chat_id; the messages are deleted from the working thread later then. This is also needed as rfc724_mid should be preset as long as the message is not deleted on the server (otherwise it is downloaded again) */
44 #define MR_CHAT_ID_MSGS_IN_CREATION 4 /* a message is just in creation but not yet assigned to a chat (eg. we may need the message ID to set up blobs; this avoids unready message to be send and shown) */
51 #define MR_CHAT_TYPE_NORMAL 100 /* a normal chat is a chat with a single contact, chats_contacts contains one record for the user, MR_CONTACT_ID_SELF is not added. */
52 #define MR_CHAT_TYPE_GROUP 120 /* a group chat, chats_contacts conain all group members, incl. MR_CONTACT_ID_SELF */
32char* mr_dehtml(char* buf_terminated); /* mr_dehtml() returns way too many lineends; however, an optimisation on this issue is not needed as the lineends are typically remove in further processing by the caller */
33
34
35#ifdef __cplusplus
36 } /* /extern "C" */
37#endif
38#endif /* __MRDEHTML_H__ */
39
-Generated on Tue Nov 14 2017 11:55:36 for Delta Chat Core C-Library by
+Generated on Tue Nov 14 2017 12:20:56 for Delta Chat Core C-API by 1.8.11
diff --git a/docs/html/mrimap_8h_source.html b/docs/html/mrimap_8h_source.html
index 4c9e595f..a0d22f2e 100644
--- a/docs/html/mrimap_8h_source.html
+++ b/docs/html/mrimap_8h_source.html
@@ -4,7 +4,7 @@
-Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrimap.h Source File
+Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrimap.h Source File
@@ -24,7 +24,7 @@
-
Delta Chat Core C-Library
+
Delta Chat Core C-API
@@ -88,11 +88,11 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
58int m_connected; /* initally connected and watch thread installed */
59 mailimap* m_hEtpan; /* normally, if connected, m_hEtpan is also set; however, if a reconnection is required, we may lost this handle */
60 pthread_mutex_t m_hEtpanmutex;
61int m_idle_set_up;
62char* m_selected_folder;
63int m_should_reconnect;
64
65int m_can_idle;
66int m_has_xlist;
67char* m_moveto_folder;/* Folder, where reveived chat messages should go to. Normally "Chats" but may be NULL to leave them in the INBOX */
68char* m_sent_folder; /* Folder, where send messages should go to. Normally "Chats". */
69 pthread_mutex_t m_idlemutex; /* set, if idle is not possible; morover, the interrupted IDLE thread waits a second before IDLEing again; this allows several jobs to be executed */
70 pthread_mutex_t m_inwait_mutex; /* only used to wait for mailstream_wait_idle()/mailimap_idle_done() to terminate. */
116int mrimap_markseen_msg (mrimap_t*, constchar* folder, uint32_t server_uid, int ms_flags, char** ret_server_folder, uint32_t* ret_server_uid, int* ret_ms_flags); /* only returns 0 on connection problems; we should try later again in this case */
117
118int mrimap_delete_msg (mrimap_t*, constchar* rfc724_mid, constchar* folder, uint32_t server_uid); /* only returns 0 on connection problems; we should try later again in this case */
58int m_connected; /* initally connected and watch thread installed */
59 mailimap* m_hEtpan; /* normally, if connected, m_hEtpan is also set; however, if a reconnection is required, we may lost this handle */
60 pthread_mutex_t m_hEtpanmutex;
61int m_idle_set_up;
62char* m_selected_folder;
63int m_should_reconnect;
64
65int m_can_idle;
66int m_has_xlist;
67char* m_moveto_folder;/* Folder, where reveived chat messages should go to. Normally "Chats" but may be NULL to leave them in the INBOX */
68char* m_sent_folder; /* Folder, where send messages should go to. Normally "Chats". */
69 pthread_mutex_t m_idlemutex; /* set, if idle is not possible; morover, the interrupted IDLE thread waits a second before IDLEing again; this allows several jobs to be executed */
70 pthread_mutex_t m_inwait_mutex; /* only used to wait for mailstream_wait_idle()/mailimap_idle_done() to terminate. */
116int mrimap_markseen_msg (mrimap_t*, constchar* folder, uint32_t server_uid, int ms_flags, char** ret_server_folder, uint32_t* ret_server_uid, int* ret_ms_flags); /* only returns 0 on connection problems; we should try later again in this case */
117
118int mrimap_delete_msg (mrimap_t*, constchar* rfc724_mid, constchar* folder, uint32_t server_uid); /* only returns 0 on connection problems; we should try later again in this case */
54 uint32_t mrjob_add__ (mrmailbox_t*, int action, int foreign_id, constchar* param); /* returns the job_id or 0 on errors. the job may or may not be done if the function returns. */
55void mrjob_kill_action__ (mrmailbox_t*, int action); /* delete all pending jobs with the given action */
56
57#define MR_AT_ONCE 0
58#define MR_INCREATION_POLL 2 /* this value does not increase the number of tries */
59#define MR_STANDARD_DELAY 3
60void mrjob_try_again_later (mrjob_t*, int initial_delay_seconds);
54 uint32_t mrjob_add__ (mrmailbox_t*, int action, int foreign_id, constchar* param); /* returns the job_id or 0 on errors. the job may or may not be done if the function returns. */
55void mrjob_kill_action__ (mrmailbox_t*, int action); /* delete all pending jobs with the given action */
56
57#define MR_AT_ONCE 0
58#define MR_INCREATION_POLL 2 /* this value does not increase the number of tries */
59#define MR_STANDARD_DELAY 3
60void mrjob_try_again_later (mrjob_t*, int initial_delay_seconds);
37/* IMAP/POP3 - all pointers may be NULL if unset, public read */
38char* m_addr;
39char* m_mail_server;
40char* m_mail_user;
41char* m_mail_pw;
42 uint16_t m_mail_port;
43
44/* SMTP - all pointers may be NULL if unset, public read */
45char* m_send_server;
46char* m_send_user;
47char* m_send_pw;
48int m_send_port;
49
50/* Server options*/
51 #define MR_AUTH_XOAUTH2 0x2
52 #define MR_AUTH_NORMAL 0x4
53 #define MR_AUTH_FLAGS (MR_AUTH_XOAUTH2|MR_AUTH_NORMAL) /* if none of these flags are set, the default is choosen, even if MR_NO_AUTOCONFIG is set */
54
55 #define MR_IMAP_SOCKET_STARTTLS 0x100
56 #define MR_IMAP_SOCKET_SSL 0x200
57 #define MR_IMAP_SOCKET_PLAIN 0x400
58 #define MR_IMAP_SOCKET_FLAGS (MR_IMAP_SOCKET_STARTTLS|MR_IMAP_SOCKET_SSL|MR_IMAP_SOCKET_PLAIN) /* if none of these flags are set, the default is choosen, even if MR_NO_AUTOCONFIG is set */
59
60 #define MR_SMTP_SOCKET_STARTTLS 0x10000
61 #define MR_SMTP_SOCKET_SSL 0x20000
62 #define MR_SMTP_SOCKET_PLAIN 0x40000
63 #define MR_SMTP_SOCKET_FLAGS (MR_SMTP_SOCKET_STARTTLS|MR_SMTP_SOCKET_SSL|MR_SMTP_SOCKET_PLAIN) /* if none of these flags are set, the default is choosen, even if MR_NO_AUTOCONFIG is set */
64
65 #define MR_NO_EXTRA_IMAP_UPLOAD 0x2000000
66 #define MR_NO_MOVE_TO_CHATS 0x4000000
67
68int m_server_flags;
69 } mrloginparam_t;
70
71
72 mrloginparam_t* mrloginparam_new ();
73void mrloginparam_unref (mrloginparam_t*);
74void mrloginparam_empty (mrloginparam_t*); /* clears all data and frees its memory. All pointers are NULL after this function is called. */
296void mrmailbox_scaleup_contact_origin__ (mrmailbox_t*, uint32_t contact_id, int origin);
297
298
299/* library private: end-to-end-encryption */
300#define MR_E2EE_DEFAULT_ENABLED 1
301#define MR_MDNS_DEFAULT_ENABLED 1
302
303typedefstruct mrmailbox_e2ee_helper_t {
304int m_encryption_successfull;
305void* m_cdata_to_free;
306 } mrmailbox_e2ee_helper_t;
307
308void mrmailbox_e2ee_encrypt (mrmailbox_t*, const clist* recipients_addr, int e2ee_guaranteed, int encrypt_to_self, struct mailmime* in_out_message, mrmailbox_e2ee_helper_t*);
309int mrmailbox_e2ee_decrypt (mrmailbox_t*, struct mailmime* in_out_message, int* ret_validation_errors); /* returns 1 if sth. was decrypted, 0 in other cases */
310void mrmailbox_e2ee_thanks (mrmailbox_e2ee_helper_t*); /* frees data referenced by "mailmime" but not freed by mailmime_free(). After calling mre2ee_unhelp(), in_out_message cannot be used any longer! */
311int mrmailbox_ensure_secret_key_exists (mrmailbox_t*); /* makes sure, the private key exists, needed only for exporting keys and the case no message was sent before */
300void mrmailbox_scaleup_contact_origin__ (mrmailbox_t*, uint32_t contact_id, int origin);
301
302
303/* library private: end-to-end-encryption */
304#define MR_E2EE_DEFAULT_ENABLED 1
305#define MR_MDNS_DEFAULT_ENABLED 1
306
307typedefstruct mrmailbox_e2ee_helper_t {
308int m_encryption_successfull;
309void* m_cdata_to_free;
310 } mrmailbox_e2ee_helper_t;
311
312void mrmailbox_e2ee_encrypt (mrmailbox_t*, const clist* recipients_addr, int e2ee_guaranteed, int encrypt_to_self, struct mailmime* in_out_message, mrmailbox_e2ee_helper_t*);
313int mrmailbox_e2ee_decrypt (mrmailbox_t*, struct mailmime* in_out_message, int* ret_validation_errors); /* returns 1 if sth. was decrypted, 0 in other cases */
314void mrmailbox_e2ee_thanks (mrmailbox_e2ee_helper_t*); /* frees data referenced by "mailmime" but not freed by mailmime_free(). After calling mre2ee_unhelp(), in_out_message cannot be used any longer! */
315int mrmailbox_ensure_secret_key_exists (mrmailbox_t*); /* makes sure, the private key exists, needed only for exporting keys and the case no message was sent before */
109#define MR_MSG_MAKE_FILENAME_SEARCHABLE(a) ((a)==MR_MSG_AUDIO || (a)==MR_MSG_FILE || (a)==MR_MSG_VIDEO ) /* add filename.ext (without path) to m_text? this is needed for the fulltext search. The extension is useful to get all PDF, all MP3 etc. */
109#define MR_MSG_MAKE_FILENAME_SEARCHABLE(a) ((a)==MR_MSG_AUDIO || (a)==MR_MSG_FILE || (a)==MR_MSG_VIDEO ) /* add filename.ext (without path) to m_text? this is needed for the fulltext search. The extension is useful to get all PDF, all MP3 etc. */
189/* tools, these functions are compatible to the corresponding sqlite3_* functions */
190 sqlite3_stmt* mrsqlite3_predefine__ (mrsqlite3_t*, size_t idx, constchar* sql); /*the result is resetted as needed and must not be freed. CAVE: you must not call this function with different strings for the same index!*/
191 sqlite3_stmt* mrsqlite3_prepare_v2_ (mrsqlite3_t*, constchar* sql); /* the result mus be freed using sqlite3_finalize() */
189/* tools, these functions are compatible to the corresponding sqlite3_* functions */
190 sqlite3_stmt* mrsqlite3_predefine__ (mrsqlite3_t*, size_t idx, constchar* sql); /*the result is resetted as needed and must not be freed. CAVE: you must not call this function with different strings for the same index!*/
191 sqlite3_stmt* mrsqlite3_prepare_v2_ (mrsqlite3_t*, constchar* sql); /* the result mus be freed using sqlite3_finalize() */
40char* safe_strdup (constchar*); /* safe_strdup() returns empty string if NULL is given, never returns NULL (exists on errors) */
41char* strdup_keep_null (constchar*); /* strdup(NULL) is undefined, safe_strdup_keep_null(NULL) returns NULL in this case */
42int atoi_null_is_0 (constchar*);
43void mr_ltrim (char*);
44void mr_rtrim (char*);
45void mr_trim (char*);
46char* mr_strlower (constchar*); /* the result must be free()'d */
47void mr_strlower_in_place (char*);
48int mr_str_replace (char** haystack, constchar* needle, constchar* replacement); /* haystack may be realloc()'d, returns the number of replacements */
49char* mr_null_terminate (constchar*, int bytes); /* the result must be free()'d */
50char* mr_mprintf (constchar* format, ...); /* The result must be free()'d. */
51void mr_remove_cr_chars (char*); /* remove all \r characters from string */
52void mr_replace_bad_utf8_chars (char*); /* replace bad UTF-8 characters by sequences of `_` (to avoid problems in filenames, we do not use eg. `?`) the function is useful if strings are unexpectingly encoded eg. as ISO-8859-1 */
53void mr_truncate_n_unwrap_str (char*, int approx_characters, int do_unwrap);
54 carray* mr_split_into_lines (constchar* buf_terminated); /* split string into lines*/
55void mr_free_splitted_lines (carray* lines);
56char* mr_insert_breaks (constchar*, int break_every, constchar* break_chars); /* insert a break every n characters, the return must be free()'d */
57char* mr_arr_to_string (const uint32_t*, int cnt);
58char* mr_decode_header_string (constchar*); /* the result must be free()'d */
59char* mr_encode_header_string (constchar*); /* the result must be free()'d */
60char* imap_modified_utf7_to_utf8 (constchar *mbox, int change_spaces);
61char* imap_utf8_to_modified_utf7 (constchar *src, int change_spaces);
62char* mr_url_encode (constchar*); /* the result must be free()'d */
63char* encode_base64 (constchar * in, int len); /* prototype, from libetpan/src/data-types/base64.h which cannot be included without adding libetpan/src/... to the include-search-paths, which would result in double-file-name-errors */
114char* mr_get_filesuffix_lc (constchar* pathNfilename); /* the returned suffix is lower-case */
115void mr_split_filename (constchar* pathNfilename, char** ret_basename, char** ret_all_suffixes_incl_dot); /* the case of the suffix is preserved! */
40char* safe_strdup (constchar*); /* safe_strdup() returns empty string if NULL is given, never returns NULL (exists on errors) */
41char* strdup_keep_null (constchar*); /* strdup(NULL) is undefined, safe_strdup_keep_null(NULL) returns NULL in this case */
42int atoi_null_is_0 (constchar*);
43void mr_ltrim (char*);
44void mr_rtrim (char*);
45void mr_trim (char*);
46char* mr_strlower (constchar*); /* the result must be free()'d */
47void mr_strlower_in_place (char*);
48int mr_str_replace (char** haystack, constchar* needle, constchar* replacement); /* haystack may be realloc()'d, returns the number of replacements */
49char* mr_null_terminate (constchar*, int bytes); /* the result must be free()'d */
50char* mr_mprintf (constchar* format, ...); /* The result must be free()'d. */
51void mr_remove_cr_chars (char*); /* remove all \r characters from string */
52void mr_replace_bad_utf8_chars (char*); /* replace bad UTF-8 characters by sequences of `_` (to avoid problems in filenames, we do not use eg. `?`) the function is useful if strings are unexpectingly encoded eg. as ISO-8859-1 */
53void mr_truncate_n_unwrap_str (char*, int approx_characters, int do_unwrap);
54 carray* mr_split_into_lines (constchar* buf_terminated); /* split string into lines*/
55void mr_free_splitted_lines (carray* lines);
56char* mr_insert_breaks (constchar*, int break_every, constchar* break_chars); /* insert a break every n characters, the return must be free()'d */
57char* mr_arr_to_string (const uint32_t*, int cnt);
58char* mr_decode_header_string (constchar*); /* the result must be free()'d */
59char* mr_encode_header_string (constchar*); /* the result must be free()'d */
60char* imap_modified_utf7_to_utf8 (constchar *mbox, int change_spaces);
61char* imap_utf8_to_modified_utf7 (constchar *src, int change_spaces);
62char* mr_url_encode (constchar*); /* the result must be free()'d */
63char* encode_base64 (constchar * in, int len); /* prototype, from libetpan/src/data-types/base64.h which cannot be included without adding libetpan/src/... to the include-search-paths, which would result in double-file-name-errors */
114char* mr_get_filesuffix_lc (constchar* pathNfilename); /* the returned suffix is lower-case */
115void mr_split_filename (constchar* pathNfilename, char** ret_basename, char** ret_all_suffixes_incl_dot); /* the case of the suffix is preserved! */
Chat ID under which this object is available in the database.
+
+
+
+
+
+
+
+
+
int mrchat_t::m_type
+
+
+
+
+
Chat type, one of the MR_CHAT_TYPE_* constants.
+
The documentation for this struct was generated from the following files:
@@ -242,7 +270,7 @@ char *
-Generated on Tue Nov 14 2017 11:55:36 for Delta Chat Core C-Library by
+Generated on Tue Nov 14 2017 12:20:57 for Delta Chat Core C-API by 1.8.11
diff --git a/docs/html/structmrchatlist__t-members.html b/docs/html/structmrchatlist__t-members.html
index 6c748aa3..94a669dae 100644
--- a/docs/html/structmrchatlist__t-members.html
+++ b/docs/html/structmrchatlist__t-members.html
@@ -4,7 +4,7 @@
-Delta Chat Core C-Library: Member List
+Delta Chat Core C-API: Member List
@@ -24,7 +24,7 @@
-
Delta Chat Core C-Library
+
Delta Chat Core C-API
@@ -90,15 +90,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
@@ -331,7 +333,7 @@ Public Attributes
-Generated on Tue Nov 14 2017 11:55:36 for Delta Chat Core C-Library by
+Generated on Tue Nov 14 2017 12:20:57 for Delta Chat Core C-API by 1.8.11
diff --git a/docs/html/structmrcontact__t-members.html b/docs/html/structmrcontact__t-members.html
index dc74f38c..877bb9c5 100644
--- a/docs/html/structmrcontact__t-members.html
+++ b/docs/html/structmrcontact__t-members.html
@@ -4,7 +4,7 @@
-Delta Chat Core C-Library: Member List
+Delta Chat Core C-API: Member List
@@ -24,7 +24,7 @@
-
Delta Chat Core C-Library
+
Delta Chat Core C-API
@@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-Generated on Tue Nov 14 2017 11:55:36 for Delta Chat Core C-Library by
+Generated on Tue Nov 14 2017 12:20:57 for Delta Chat Core C-API by 1.8.11
diff --git a/docs/html/structmrcontact__t.html b/docs/html/structmrcontact__t.html
index 3f158a5d..6972ed5e 100644
--- a/docs/html/structmrcontact__t.html
+++ b/docs/html/structmrcontact__t.html
@@ -4,7 +4,7 @@
-Delta Chat Core C-Library: mrcontact_t Struct Reference
+Delta Chat Core C-API: mrcontact_t Struct Reference
@@ -24,7 +24,7 @@
-
Delta Chat Core C-Library
+
Delta Chat Core C-API
@@ -235,7 +235,7 @@ char *
-Generated on Tue Nov 14 2017 11:55:36 for Delta Chat Core C-Library by
+Generated on Tue Nov 14 2017 12:20:57 for Delta Chat Core C-API by 1.8.11
diff --git a/docs/html/structmrmailbox__t-members.html b/docs/html/structmrmailbox__t-members.html
index 049a6b3f..ee4316c1 100644
--- a/docs/html/structmrmailbox__t-members.html
+++ b/docs/html/structmrmailbox__t-members.html
@@ -4,7 +4,7 @@
-Delta Chat Core C-Library: Member List
+Delta Chat Core C-API: Member List
@@ -24,7 +24,7 @@
-
Delta Chat Core C-Library
+
Delta Chat Core C-API
@@ -156,7 +156,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-Generated on Tue Nov 14 2017 11:55:36 for Delta Chat Core C-Library by
+Generated on Tue Nov 14 2017 12:20:57 for Delta Chat Core C-API by 1.8.11
diff --git a/docs/html/structmrmailbox__t.html b/docs/html/structmrmailbox__t.html
index 002d462e..6cec8aec 100644
--- a/docs/html/structmrmailbox__t.html
+++ b/docs/html/structmrmailbox__t.html
@@ -4,7 +4,7 @@
-Delta Chat Core C-Library: mrmailbox_t Struct Reference
+Delta Chat Core C-API: mrmailbox_t Struct Reference
@@ -24,7 +24,7 @@
-
Delta Chat Core C-Library
+
Delta Chat Core C-API
@@ -2690,7 +2690,7 @@ void *
-Generated on Tue Nov 14 2017 11:55:36 for Delta Chat Core C-Library by
+Generated on Tue Nov 14 2017 12:20:57 for Delta Chat Core C-API by 1.8.11
diff --git a/docs/html/structmrmsg__t-members.html b/docs/html/structmrmsg__t-members.html
index 5f643817..87768eff 100644
--- a/docs/html/structmrmsg__t-members.html
+++ b/docs/html/structmrmsg__t-members.html
@@ -4,7 +4,7 @@
-Delta Chat Core C-Library: Member List
+Delta Chat Core C-API: Member List
@@ -24,7 +24,7 @@
-
Delta Chat Core C-Library
+
Delta Chat Core C-API
@@ -111,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-Generated on Tue Nov 14 2017 11:55:36 for Delta Chat Core C-Library by
+Generated on Tue Nov 14 2017 12:20:57 for Delta Chat Core C-API by 1.8.11
diff --git a/docs/html/structmrmsg__t.html b/docs/html/structmrmsg__t.html
index 23a3370a..da8b1ba1 100644
--- a/docs/html/structmrmsg__t.html
+++ b/docs/html/structmrmsg__t.html
@@ -4,7 +4,7 @@
-Delta Chat Core C-Library: mrmsg_t Struct Reference
+Delta Chat Core C-API: mrmsg_t Struct Reference
@@ -24,7 +24,7 @@
-
Delta Chat Core C-Library
+
Delta Chat Core C-API
@@ -538,7 +538,7 @@ char *
-Generated on Tue Nov 14 2017 11:55:36 for Delta Chat Core C-Library by
+Generated on Tue Nov 14 2017 12:20:57 for Delta Chat Core C-API by 1.8.11
diff --git a/docs/html/structmrparam__t-members.html b/docs/html/structmrparam__t-members.html
index 76193da8..95f995d6 100644
--- a/docs/html/structmrparam__t-members.html
+++ b/docs/html/structmrparam__t-members.html
@@ -4,7 +4,7 @@
-Delta Chat Core C-Library: Member List
+Delta Chat Core C-API: Member List
@@ -24,7 +24,7 @@
-
Delta Chat Core C-Library
+
Delta Chat Core C-API
@@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-Generated on Tue Nov 14 2017 11:55:36 for Delta Chat Core C-Library by
+Generated on Tue Nov 14 2017 12:20:57 for Delta Chat Core C-API by 1.8.11
diff --git a/docs/html/structmrparam__t.html b/docs/html/structmrparam__t.html
index de5d1050..5cba2e0d 100644
--- a/docs/html/structmrparam__t.html
+++ b/docs/html/structmrparam__t.html
@@ -4,7 +4,7 @@
-Delta Chat Core C-Library: mrparam_t Struct Reference
+Delta Chat Core C-API: mrparam_t Struct Reference
@@ -24,7 +24,7 @@
-
Delta Chat Core C-Library
+
Delta Chat Core C-API
@@ -408,7 +408,7 @@ Public Member Functions
-Generated on Tue Nov 14 2017 11:55:36 for Delta Chat Core C-Library by
+Generated on Tue Nov 14 2017 12:20:57 for Delta Chat Core C-API by 1.8.11
diff --git a/docs/html/structmrpoortext__t-members.html b/docs/html/structmrpoortext__t-members.html
index 985c8774..43f75fc0 100644
--- a/docs/html/structmrpoortext__t-members.html
+++ b/docs/html/structmrpoortext__t-members.html
@@ -4,7 +4,7 @@
-Delta Chat Core C-Library: Member List
+Delta Chat Core C-API: Member List
@@ -24,7 +24,7 @@
-
Delta Chat Core C-Library
+
Delta Chat Core C-API
@@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-Generated on Tue Nov 14 2017 11:55:36 for Delta Chat Core C-Library by
+Generated on Tue Nov 14 2017 12:20:57 for Delta Chat Core C-API by 1.8.11
diff --git a/docs/html/structmrpoortext__t.html b/docs/html/structmrpoortext__t.html
index 68acf628..9d5490aa 100644
--- a/docs/html/structmrpoortext__t.html
+++ b/docs/html/structmrpoortext__t.html
@@ -4,7 +4,7 @@
-Delta Chat Core C-Library: mrpoortext_t Struct Reference
+Delta Chat Core C-API: mrpoortext_t Struct Reference
@@ -24,7 +24,7 @@
-
Delta Chat Core C-Library
+
Delta Chat Core C-API
@@ -169,7 +169,7 @@ int
-Generated on Tue Nov 14 2017 11:55:36 for Delta Chat Core C-Library by
+Generated on Tue Nov 14 2017 12:20:57 for Delta Chat Core C-API by 1.8.11
diff --git a/src/mrchat.c b/src/mrchat.c
index c9269ef7..88417b89 100644
--- a/src/mrchat.c
+++ b/src/mrchat.c
@@ -28,101 +28,6 @@
#include "mrmimefactory.h"
-int mrchat_update_param__(mrchat_t* ths)
-{
- int success = 0;
- sqlite3_stmt* stmt = mrsqlite3_prepare_v2_(ths->m_mailbox->m_sql, "UPDATE chats SET param=? WHERE id=?");
- sqlite3_bind_text(stmt, 1, ths->m_param->m_packed, -1, SQLITE_STATIC);
- sqlite3_bind_int (stmt, 2, ths->m_id);
- success = sqlite3_step(stmt)==SQLITE_DONE? 1 : 0;
- sqlite3_finalize(stmt);
- return success;
-}
-
-
-static int mrchat_set_from_stmt__(mrchat_t* ths, sqlite3_stmt* row)
-{
- int row_offset = 0;
- const char* draft_text;
-
- if( ths == NULL || row == NULL ) {
- return 0;
- }
-
- mrchat_empty(ths);
-
- #define MR_CHAT_FIELDS " c.id,c.type,c.name, c.draft_timestamp,c.draft_txt,c.grpid,c.param,c.archived "
- ths->m_id = sqlite3_column_int (row, row_offset++); /* the columns are defined in MR_CHAT_FIELDS */
- ths->m_type = sqlite3_column_int (row, row_offset++);
- ths->m_name = safe_strdup((char*)sqlite3_column_text (row, row_offset++));
- ths->m_draft_timestamp = sqlite3_column_int64(row, row_offset++);
- draft_text = (const char*)sqlite3_column_text (row, row_offset++);
- ths->m_grpid = safe_strdup((char*)sqlite3_column_text (row, row_offset++));
- mrparam_set_packed(ths->m_param, (char*)sqlite3_column_text (row, row_offset++));
- ths->m_archived = sqlite3_column_int (row, row_offset++);
-
- /* We leave a NULL-pointer for the very usual situation of "no draft".
- Also make sure, m_draft_text and m_draft_timestamp are set together */
- if( ths->m_draft_timestamp && draft_text && draft_text[0] ) {
- ths->m_draft_text = safe_strdup(draft_text);
- }
- else {
- ths->m_draft_timestamp = 0;
- }
-
- /* correct the title of some special groups */
- if( ths->m_id == MR_CHAT_ID_DEADDROP ) {
- free(ths->m_name);
- ths->m_name = mrstock_str(MR_STR_DEADDROP);
- }
- else if( ths->m_id == MR_CHAT_ID_ARCHIVED_LINK ) {
- free(ths->m_name);
- char* tempname = mrstock_str(MR_STR_ARCHIVEDCHATS);
- ths->m_name = mr_mprintf("%s (%i)", tempname, mrmailbox_get_archived_count__(ths->m_mailbox));
- free(tempname);
- }
- else if( ths->m_id == MR_CHAT_ID_STARRED ) {
- free(ths->m_name);
- ths->m_name = mrstock_str(MR_STR_STARREDMSGS);
- }
-
- return row_offset; /* success, return the next row offset */
-}
-
-
-/**
- * Library-internal.
- *
- * Calling this function is not thread-safe, locking is up to the caller.
- *
- * @private @memberof mrchat_t
- */
-int mrchat_load_from_db__(mrchat_t* ths, uint32_t id)
-{
- sqlite3_stmt* stmt;
-
- if( ths==NULL ) {
- return 0;
- }
-
- mrchat_empty(ths);
-
- stmt = mrsqlite3_predefine__(ths->m_mailbox->m_sql, SELECT_itndd_FROM_chats_WHERE_i,
- "SELECT " MR_CHAT_FIELDS " FROM chats c WHERE c.id=?;");
- sqlite3_bind_int(stmt, 1, id);
-
- if( sqlite3_step(stmt) != SQLITE_ROW ) {
- return 0;
- }
-
- if( !mrchat_set_from_stmt__(ths, stmt) ) {
- return 0;
- }
-
- return 1;
-}
-
-
/**
* Create a chat object in memory.
*
@@ -178,27 +83,27 @@ void mrchat_unref(mrchat_t* chat)
*
* @return None.
*/
-void mrchat_empty(mrchat_t* ths)
+void mrchat_empty(mrchat_t* chat)
{
- if( ths == NULL ) {
+ if( chat == NULL ) {
return;
}
- free(ths->m_name);
- ths->m_name = NULL;
+ free(chat->m_name);
+ chat->m_name = NULL;
- ths->m_draft_timestamp = 0;
+ chat->m_draft_timestamp = 0;
- free(ths->m_draft_text);
- ths->m_draft_text = NULL;
+ free(chat->m_draft_text);
+ chat->m_draft_text = NULL;
- ths->m_type = MR_CHAT_TYPE_UNDEFINED;
- ths->m_id = 0;
+ chat->m_type = MR_CHAT_TYPE_UNDEFINED;
+ chat->m_id = 0;
- free(ths->m_grpid);
- ths->m_grpid = NULL;
+ free(chat->m_grpid);
+ chat->m_grpid = NULL;
- mrparam_set_packed(ths->m_param, NULL);
+ mrparam_set_packed(chat->m_param, NULL);
}
@@ -272,4 +177,108 @@ char* mrchat_get_subtitle(mrchat_t* chat)
}
+int mrchat_update_param__(mrchat_t* ths)
+{
+ int success = 0;
+ sqlite3_stmt* stmt = mrsqlite3_prepare_v2_(ths->m_mailbox->m_sql, "UPDATE chats SET param=? WHERE id=?");
+ sqlite3_bind_text(stmt, 1, ths->m_param->m_packed, -1, SQLITE_STATIC);
+ sqlite3_bind_int (stmt, 2, ths->m_id);
+ success = sqlite3_step(stmt)==SQLITE_DONE? 1 : 0;
+ sqlite3_finalize(stmt);
+ return success;
+}
+
+
+static int mrchat_set_from_stmt__(mrchat_t* ths, sqlite3_stmt* row)
+{
+ int row_offset = 0;
+ const char* draft_text;
+
+ if( ths == NULL || row == NULL ) {
+ return 0;
+ }
+
+ mrchat_empty(ths);
+
+ #define MR_CHAT_FIELDS " c.id,c.type,c.name, c.draft_timestamp,c.draft_txt,c.grpid,c.param,c.archived "
+ ths->m_id = sqlite3_column_int (row, row_offset++); /* the columns are defined in MR_CHAT_FIELDS */
+ ths->m_type = sqlite3_column_int (row, row_offset++);
+ ths->m_name = safe_strdup((char*)sqlite3_column_text (row, row_offset++));
+ ths->m_draft_timestamp = sqlite3_column_int64(row, row_offset++);
+ draft_text = (const char*)sqlite3_column_text (row, row_offset++);
+ ths->m_grpid = safe_strdup((char*)sqlite3_column_text (row, row_offset++));
+ mrparam_set_packed(ths->m_param, (char*)sqlite3_column_text (row, row_offset++));
+ ths->m_archived = sqlite3_column_int (row, row_offset++);
+
+ /* We leave a NULL-pointer for the very usual situation of "no draft".
+ Also make sure, m_draft_text and m_draft_timestamp are set together */
+ if( ths->m_draft_timestamp && draft_text && draft_text[0] ) {
+ ths->m_draft_text = safe_strdup(draft_text);
+ }
+ else {
+ ths->m_draft_timestamp = 0;
+ }
+
+ /* correct the title of some special groups */
+ if( ths->m_id == MR_CHAT_ID_DEADDROP ) {
+ free(ths->m_name);
+ ths->m_name = mrstock_str(MR_STR_DEADDROP);
+ }
+ else if( ths->m_id == MR_CHAT_ID_ARCHIVED_LINK ) {
+ free(ths->m_name);
+ char* tempname = mrstock_str(MR_STR_ARCHIVEDCHATS);
+ ths->m_name = mr_mprintf("%s (%i)", tempname, mrmailbox_get_archived_count__(ths->m_mailbox));
+ free(tempname);
+ }
+ else if( ths->m_id == MR_CHAT_ID_STARRED ) {
+ free(ths->m_name);
+ ths->m_name = mrstock_str(MR_STR_STARREDMSGS);
+ }
+
+ return row_offset; /* success, return the next row offset */
+}
+
+
+/**
+ * Library-internal.
+ *
+ * Calling this function is not thread-safe, locking is up to the caller.
+ *
+ * @private @memberof mrchat_t
+ *
+ * @param chat The chat object that should be filled with the data from the database.
+ * Existing data are free()'d before using mrchat_empty().
+ *
+ * @param chat_id Chat ID that should be loaded from the database.
+ *
+ * @return 1=success, 0=error.
+ */
+int mrchat_load_from_db__(mrchat_t* chat, uint32_t chat_id)
+{
+ sqlite3_stmt* stmt;
+
+ if( chat==NULL ) {
+ return 0;
+ }
+
+ mrchat_empty(chat);
+
+ stmt = mrsqlite3_predefine__(chat->m_mailbox->m_sql, SELECT_itndd_FROM_chats_WHERE_i,
+ "SELECT " MR_CHAT_FIELDS " FROM chats c WHERE c.id=?;");
+ sqlite3_bind_int(stmt, 1, chat_id);
+
+ if( sqlite3_step(stmt) != SQLITE_ROW ) {
+ return 0;
+ }
+
+ if( !mrchat_set_from_stmt__(chat, stmt) ) {
+ return 0;
+ }
+
+ return 1;
+}
+
+
+
+
diff --git a/src/mrchat.h b/src/mrchat.h
index 2503df44..bf6dd9df 100644
--- a/src/mrchat.h
+++ b/src/mrchat.h
@@ -45,12 +45,12 @@ typedef struct mrchat_t
#define MR_CHAT_ID_STARRED 5 /* virtual chat containing all starred messages */
#define MR_CHAT_ID_ARCHIVED_LINK 6 /* a link at the end of the chatlist, if present the UI should show the button "Archived chats" */
#define MR_CHAT_ID_LAST_SPECIAL 9 /* larger chat IDs are "real" chats, their messages are "real" messages. */
- uint32_t m_id;
+ uint32_t m_id; /**< Chat ID under which this object is available in the database. */
#define MR_CHAT_TYPE_UNDEFINED 0
#define MR_CHAT_TYPE_NORMAL 100 /* a normal chat is a chat with a single contact, chats_contacts contains one record for the user, MR_CONTACT_ID_SELF is not added. */
#define MR_CHAT_TYPE_GROUP 120 /* a group chat, chats_contacts conain all group members, incl. MR_CONTACT_ID_SELF */
- int m_type;
+ int m_type; /**< Chat type, one of the MR_CHAT_TYPE_* constants. */
char* m_name; /**< NULL if unset */
time_t m_draft_timestamp; /**< 0 if there is no draft */
diff --git a/src/mrchatlist.c b/src/mrchatlist.c
index 1afdcac5..61b1e443 100644
--- a/src/mrchatlist.c
+++ b/src/mrchatlist.c
@@ -115,16 +115,18 @@ size_t mrchatlist_get_cnt(mrchatlist_t* chatlist)
*
* @param chatlist The chatlist object as created eg. by mrmailbox_get_chatlist().
*
+ * @param index The index to get the chat ID for.
+ *
* @return Returns the chat_id of the item at the given index. Index must be between
* 0 and mrchatlist_get_cnt()-1.
*/
-uint32_t mrchatlist_get_chat_id(mrchatlist_t* ths, size_t index)
+uint32_t mrchatlist_get_chat_id(mrchatlist_t* chatlist, size_t index)
{
- if( ths == NULL || ths->m_chatNlastmsg_ids == NULL || index >= ths->m_cnt ) {
+ if( chatlist == NULL || chatlist->m_chatNlastmsg_ids == NULL || index >= chatlist->m_cnt ) {
return 0;
}
- return (uint32_t)(uintptr_t)carray_get(ths->m_chatNlastmsg_ids, index*MR_CHATLIST_IDS_PER_RESULT);
+ return (uint32_t)(uintptr_t)carray_get(chatlist->m_chatNlastmsg_ids, index*MR_CHATLIST_IDS_PER_RESULT);
}
@@ -145,16 +147,18 @@ mrchat_t* mrchatlist_get_chat_by_index(mrchatlist_t* ths, size_t index) /* depre
*
* @param chatlist The chatlist object as created eg. by mrmailbox_get_chatlist().
*
+ * @param index The index to get the chat ID for.
+ *
* @return Returns the message_id of the item at the given index. Index must be between
* 0 and mrchatlist_get_cnt()-1. If there is no message at the given index (eg. the chat may be empty), 0 is returned.
*/
-uint32_t mrchatlist_get_msg_id(mrchatlist_t* ths, size_t index)
+uint32_t mrchatlist_get_msg_id(mrchatlist_t* chatlist, size_t index)
{
- if( ths == NULL || ths->m_chatNlastmsg_ids == NULL || index >= ths->m_cnt ) {
+ if( chatlist == NULL || chatlist->m_chatNlastmsg_ids == NULL || index >= chatlist->m_cnt ) {
return 0;
}
- return (uint32_t)(uintptr_t)carray_get(ths->m_chatNlastmsg_ids, index*MR_CHATLIST_IDS_PER_RESULT+1);
+ return (uint32_t)(uintptr_t)carray_get(chatlist->m_chatNlastmsg_ids, index*MR_CHATLIST_IDS_PER_RESULT+1);
}
diff --git a/src/mrmailbox.h b/src/mrmailbox.h
index 07ee4035..f38a9970 100644
--- a/src/mrmailbox.h
+++ b/src/mrmailbox.h
@@ -45,6 +45,8 @@ extern "C" {
* Your function should look like the following:
*
* ```
+ * #include
+ *
* uintptr_t my_delta_handler(mrmailbox_t* nb, int event, uintptr_t data1, uintptr_t data2)
* {
* return 0; // for unhandled events, it is always safe to return 0
@@ -97,7 +99,7 @@ extern "C" {
*/
-#include /* defines uint16_t etc. */
+#include /* defines uint16_t and carray */
#include "mrchatlist.h"
#include "mrchat.h"
#include "mrmsg.h"
@@ -140,37 +142,39 @@ typedef uintptr_t (*mrmailboxcb_t) (mrmailbox_t*, int event, uintptr_t data1, ui
*/
typedef struct mrmailbox_t
{
- void* m_userdata; /**< the same pointer as given to mrmailbox_new(), may be used by the caller for any purpose */
- char* m_dbfile; /**< the database file in file. */
- char* m_blobdir; /**< full path of the blob directory in use. */
+ void* m_userdata; /**< the same pointer as given to mrmailbox_new(), may be used by the caller for any purpose */
+ char* m_dbfile; /**< the database file in file. */
+ char* m_blobdir; /**< full path of the blob directory in use. */
/** @privatesection */
- mrsqlite3_t* m_sql; /**< Internal SQL object, never NULL */
- mrimap_t* m_imap; /**< Internal IMAP object, never NULL */
- mrsmtp_t* m_smtp; /**< Internal SMTP object, never NULL */
+ mrsqlite3_t* m_sql; /**< Internal SQL object, never NULL */
+ mrimap_t* m_imap; /**< Internal IMAP object, never NULL */
+ mrsmtp_t* m_smtp; /**< Internal SMTP object, never NULL */
- pthread_t m_job_thread; /**< Internal */
- pthread_cond_t m_job_cond; /**< Internal */
- pthread_mutex_t m_job_condmutex; /**< Internal */
- int m_job_condflag; /**< Internal */
- int m_job_do_exit; /**< Internal */
+ pthread_t m_job_thread; /**< Internal */
+ pthread_cond_t m_job_cond; /**< Internal */
+ pthread_mutex_t m_job_condmutex; /**< Internal */
+ int m_job_condflag; /**< Internal */
+ int m_job_do_exit; /**< Internal */
- mrmailboxcb_t m_cb; /**< Internal */
+ mrmailboxcb_t m_cb; /**< Internal */
- char* m_os_name; /**< Internal */
+ char* m_os_name; /**< Internal */
- uint32_t m_cmdline_sel_chat_id; /**< Internal */
+ uint32_t m_cmdline_sel_chat_id; /**< Internal */
- int m_wake_lock; /**< Internal */
- pthread_mutex_t m_wake_lock_critical; /**< Internal */
+ int m_wake_lock; /**< Internal */
+ pthread_mutex_t m_wake_lock_critical; /**< Internal */
- int m_e2ee_enabled; /**< Internal */
+ int m_e2ee_enabled; /**< Internal */
#define MR_LOG_RINGBUF_SIZE 200
pthread_mutex_t m_log_ringbuf_critical; /**< Internal */
- char* m_log_ringbuf[MR_LOG_RINGBUF_SIZE]; /**< Internal */
- time_t m_log_ringbuf_times[MR_LOG_RINGBUF_SIZE]; /**< Internal */
- int m_log_ringbuf_pos; /**< Internal. The oldest position resp. the position that is overwritten next */
+ char* m_log_ringbuf[MR_LOG_RINGBUF_SIZE];
+ /**< Internal */
+ time_t m_log_ringbuf_times[MR_LOG_RINGBUF_SIZE];
+ /**< Internal */
+ int m_log_ringbuf_pos; /**< Internal. The oldest position resp. the position that is overwritten next */
} mrmailbox_t;