From 71b6c81d8070d0b5714f3e1f4e05cb28554cb918 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Fri, 8 Dec 2017 19:16:40 +0100 Subject: [PATCH] doxygen --- docs/Doxyfile | 2 +- docs/html/files.html | 43 ++++----- docs/html/functions.html | 3 + docs/html/functions_func.html | 3 + docs/html/mrcontact_8h_source.html | 2 +- docs/html/mrhash_8h_source.html | 100 ++++++++++++++++++++ docs/html/mrmailbox_8h_source.html | 128 +++++++++++++------------- docs/html/mrmimeparser_8h_source.html | 2 +- docs/html/mrmsg_8h_source.html | 7 +- docs/html/search/all_1.js | 1 + docs/html/search/functions_0.js | 1 + docs/html/structmrmailbox__t.html | 11 ++- docs/html/structmrmsg__t-members.html | 33 +++---- docs/html/structmrmsg__t.html | 30 ++++++ 14 files changed, 254 insertions(+), 112 deletions(-) create mode 100644 docs/html/mrhash_8h_source.html diff --git a/docs/Doxyfile b/docs/Doxyfile index 113c5e0e..96804a04 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -853,7 +853,7 @@ EXCLUDE_PATTERNS = ###################################################### EXCLUDE_SYMBOLS = mraheader_t mrapeerstate_t mrmailbox_e2ee_helper_t mrimap_t mrjob_t mrkey_t mrkeyring_t mrloginparam_t mrmime*_t -EXCLUDE_SYMBOLS += mrsaxparser_t mrsimplify_t mrsmtp_t mrsqlite3_t mrstrbuilder_t mrparam_t +EXCLUDE_SYMBOLS += mrsaxparser_t mrsimplify_t mrsmtp_t mrsqlite3_t mrstrbuilder_t mrparam_t mrhash_t mrhashelem_t ###################################################### # The EXAMPLE_PATH tag can be used to specify one or more files or directories diff --git a/docs/html/files.html b/docs/html/files.html index 238c2e1d..bd926c89 100644 --- a/docs/html/files.html +++ b/docs/html/files.html @@ -96,27 +96,28 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');  mrcontact.h  mrdehtml.h  mrevent.hThe following constants are used as events reported to the callback given to mrmailbox_new() - mrimap.h - mrjob.h - mrkey.h - mrkeyring.h - mrloginparam.h - mrlot.h - mrmailbox.h - mrmailbox_internal.h - mrmimefactory.h - mrmimeparser.h - mrmsg.h - mrosnative.h - mrparam.h - mrpgp.h - mrpoortext.h - mrsaxparser.h - mrsimplify.h - mrsmtp.h - mrsqlite3.h - mrstock.h - mrtools.h + mrhash.h + mrimap.h + mrjob.h + mrkey.h + mrkeyring.h + mrloginparam.h + mrlot.h + mrmailbox.h + mrmailbox_internal.h + mrmimefactory.h + mrmimeparser.h + mrmsg.h + mrosnative.h + mrparam.h + mrpgp.h + mrpoortext.h + mrsaxparser.h + mrsimplify.h + mrsmtp.h + mrsqlite3.h + mrstock.h + mrtools.h diff --git a/docs/html/functions.html b/docs/html/functions.html index 5dd1d641..e8d1cdd6 100644 --- a/docs/html/functions.html +++ b/docs/html/functions.html @@ -423,6 +423,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • mrmsg_get_mediainfo() : mrmsg_t
  • +
  • mrmsg_get_setupcodebegin() +: mrmsg_t +
  • mrmsg_get_showpadlock() : mrmsg_t
  • diff --git a/docs/html/functions_func.html b/docs/html/functions_func.html index ced30799..8234fe75 100644 --- a/docs/html/functions_func.html +++ b/docs/html/functions_func.html @@ -388,6 +388,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • mrmsg_get_mediainfo() : mrmsg_t
  • +
  • mrmsg_get_setupcodebegin() +: mrmsg_t +
  • mrmsg_get_showpadlock() : mrmsg_t
  • diff --git a/docs/html/mrcontact_8h_source.html b/docs/html/mrcontact_8h_source.html index 94d253f2..8f3801f1 100644 --- a/docs/html/mrcontact_8h_source.html +++ b/docs/html/mrcontact_8h_source.html @@ -89,7 +89,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    mrcontact.h
    -
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 #ifndef __MRCONTACT_H__
    24 #define __MRCONTACT_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 typedef struct mrsqlite3_t mrsqlite3_t;
    31 
    32 
    38 typedef struct mrcontact_t
    39 {
    48  uint32_t m_id;
    49  #define MR_CONTACT_ID_SELF 1
    50  #define MR_CONTACT_ID_LAST_SPECIAL 9
    51 
    52 
    55  char* m_name;
    56  char* m_authname;
    57  char* m_addr;
    58  int m_blocked;
    59  int m_origin;
    60 } mrcontact_t;
    61 
    62 
    63 mrcontact_t* mrcontact_new (); /* the returned pointer is ref'd and must be unref'd after usage */
    64 void mrcontact_empty (mrcontact_t*);
    66 
    72 
    73 
    74 /* library-internal */
    75 #define MR_ORIGIN_UNSET 0
    76 #define MR_ORIGIN_INCOMING_UNKNOWN_FROM 0x10 /* From: of incoming messages of unknown sender */
    77 #define MR_ORIGIN_INCOMING_UNKNOWN_CC 0x20 /* Cc: of incoming messages of unknown sender */
    78 #define MR_ORIGIN_INCOMING_UNKNOWN_TO 0x40 /* To: of incoming messages of unknown sender */
    79 #define MR_ORIGIN_INCOMING_REPLY_TO 0x100 /* Reply-To: of incoming message of known sender */
    80 #define MR_ORIGIN_INCOMING_CC 0x200 /* Cc: of incoming message of known sender */
    81 #define MR_ORIGIN_INCOMING_TO 0x400 /* additional To:'s of incoming message of known sender */
    82 #define MR_ORIGIN_CREATE_CHAT 0x800 /* a chat was manually created for this user, but no message yet sent */
    83 #define MR_ORIGIN_OUTGOING_BCC 0x1000 /* message send by us */
    84 #define MR_ORIGIN_OUTGOING_CC 0x2000 /* message send by us */
    85 #define MR_ORIGIN_OUTGOING_TO 0x4000 /* message send by us */
    86 #define MR_ORIGIN_INTERNAL 0x40000 /* internal use */
    87 #define MR_ORIGIN_ADRESS_BOOK 0x80000 /* address is in our address book */
    88 #define MR_ORIGIN_MANUALLY_CREATED 0x100000 /* contact added by mrmailbox_create_contact() */
    89 
    90 #define MR_ORIGIN_MIN_CONTACT_LIST (MR_ORIGIN_INCOMING_REPLY_TO) /* contacts with at least this origin value are shown in the contact list */
    91 #define MR_ORIGIN_MIN_VERIFIED (MR_ORIGIN_INCOMING_REPLY_TO) /* contacts with at least this origin value are verified and known not to be spam */
    92 #define MR_ORIGIN_MIN_START_NEW_NCHAT (0x7FFFFFFF) /* contacts with at least this origin value start a new "normal" chat, defaults to off */
    93 
    94 int mrcontact_load_from_db__ (mrcontact_t*, mrsqlite3_t*, uint32_t contact_id);
    95 void mr_normalize_name (char* full_name);
    96 char* mr_get_first_name (const char* full_name);
    97 
    98 
    99 #ifdef __cplusplus
    100 } /* /extern "C" */
    101 #endif
    102 #endif /* __MRCONTACT_H__ */
    char * mrcontact_get_name_n_addr(mrcontact_t *contact)
    Get a summary of name and address.
    Definition: mrcontact.c:193
    +
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 #ifndef __MRCONTACT_H__
    24 #define __MRCONTACT_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 typedef struct mrsqlite3_t mrsqlite3_t;
    31 
    32 
    38 typedef struct mrcontact_t
    39 {
    48  uint32_t m_id;
    49  #define MR_CONTACT_ID_SELF 1
    50  #define MR_CONTACT_ID_LAST_SPECIAL 9
    51 
    52 
    55  char* m_name;
    56  char* m_authname;
    57  char* m_addr;
    58  int m_blocked;
    59  int m_origin;
    60 } mrcontact_t;
    61 
    62 
    63 mrcontact_t* mrcontact_new (); /* the returned pointer is ref'd and must be unref'd after usage */
    64 void mrcontact_empty (mrcontact_t*);
    66 
    72 
    73 
    74 /* library-internal */
    75 #define MR_ORIGIN_UNSET 0
    76 #define MR_ORIGIN_INCOMING_UNKNOWN_FROM 0x10 /* From: of incoming messages of unknown sender */
    77 #define MR_ORIGIN_INCOMING_UNKNOWN_CC 0x20 /* Cc: of incoming messages of unknown sender */
    78 #define MR_ORIGIN_INCOMING_UNKNOWN_TO 0x40 /* To: of incoming messages of unknown sender */
    79 #define MR_ORIGIN_INCOMING_REPLY_TO 0x100 /* Reply-To: of incoming message of known sender */
    80 #define MR_ORIGIN_INCOMING_CC 0x200 /* Cc: of incoming message of known sender */
    81 #define MR_ORIGIN_INCOMING_TO 0x400 /* additional To:'s of incoming message of known sender */
    82 #define MR_ORIGIN_CREATE_CHAT 0x800 /* a chat was manually created for this user, but no message yet sent */
    83 #define MR_ORIGIN_OUTGOING_BCC 0x1000 /* message send by us */
    84 #define MR_ORIGIN_OUTGOING_CC 0x2000 /* message send by us */
    85 #define MR_ORIGIN_OUTGOING_TO 0x4000 /* message send by us */
    86 #define MR_ORIGIN_INTERNAL 0x40000 /* internal use */
    87 #define MR_ORIGIN_ADRESS_BOOK 0x80000 /* address is in our address book */
    88 #define MR_ORIGIN_MANUALLY_CREATED 0x100000 /* contact added by mrmailbox_create_contact() */
    89 
    90 #define MR_ORIGIN_MIN_CONTACT_LIST (MR_ORIGIN_INCOMING_REPLY_TO) /* contacts with at least this origin value are shown in the contact list */
    91 #define MR_ORIGIN_MIN_VERIFIED (MR_ORIGIN_INCOMING_REPLY_TO) /* contacts with at least this origin value are verified and known not to be spam */
    92 #define MR_ORIGIN_MIN_START_NEW_NCHAT (0x7FFFFFFF) /* contacts with at least this origin value start a new "normal" chat, defaults to off */
    93 
    94 int mrcontact_load_from_db__ (mrcontact_t*, mrsqlite3_t*, uint32_t contact_id);
    95 void mr_normalize_name (char* full_name);
    96 char* mr_normalize_addr (const char* email_addr);
    97 char* mr_get_first_name (const char* full_name);
    98 
    99 
    100 #ifdef __cplusplus
    101 } /* /extern "C" */
    102 #endif
    103 #endif /* __MRCONTACT_H__ */
    char * mrcontact_get_name_n_addr(mrcontact_t *contact)
    Get a summary of name and address.
    Definition: mrcontact.c:193
    An object representing a single contact in memory.
    Definition: mrcontact.h:38
    void mrcontact_unref(mrcontact_t *contact)
    Free a contact object.
    Definition: mrcontact.c:57
    char * mrcontact_get_display_name(mrcontact_t *contact)
    Get display name.
    Definition: mrcontact.c:162
    diff --git a/docs/html/mrhash_8h_source.html b/docs/html/mrhash_8h_source.html new file mode 100644 index 00000000..f16b34f9 --- /dev/null +++ b/docs/html/mrhash_8h_source.html @@ -0,0 +1,100 @@ + + + + + + +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrhash.h Source File + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Delta Chat Core C-API +
    +
    +
    + + + + + + +
    +
    + + +
    + +
    + + +
    +
    +
    +
    mrhash.h
    +
    +
    +
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 #ifndef __MRHASH_H__
    24 #define __MRHASH_H__
    25 #ifdef __cplusplus
    26 extern "C"
    27 {
    28 #endif
    29 
    30 
    31 /* Forward declarations of structures.
    32  */
    33 typedef struct mrhashelem_t mrhashelem_t;
    34 
    35 
    36 /* A complete hash table is an instance of the following structure.
    37  * The internals of this structure are intended to be opaque -- client
    38  * code should not attempt to access or modify the fields of this structure
    39  * directly. Change this structure only by using the routines below.
    40  * However, many of the "procedures" and "functions" for modifying and
    41  * accessing this structure are really macros, so we can't really make
    42  * this structure opaque.
    43  */
    44 typedef struct mrhash_t
    45 {
    46  char keyClass; /* SJHASH_INT, _POINTER, _STRING, _BINARY */
    47  char copyKey; /* True if copy of key made on insert */
    48  int count; /* Number of entries in this table */
    49  mrhashelem_t* first; /* The first element of the array */
    50  int htsize; /* Number of buckets in the hash table */
    51  struct _ht
    52  { /* the hash table */
    53  int count; /* Number of entries with this hash */
    54  mrhashelem_t* chain; /* Pointer to first entry with this hash */
    55  } *ht;
    56 } mrhash_t;
    57 
    58 
    59 /* Each element in the hash table is an instance of the following
    60  * structure. All elements are stored on a single doubly-linked list.
    61  *
    62  * Again, this structure is intended to be opaque, but it can't really
    63  * be opaque because it is used by macros.
    64  */
    65 typedef struct mrhashelem_t
    66 {
    67  mrhashelem_t *next, *prev; /* Next and previous elements in the table */
    68  void* data; /* Data associated with this element */
    69  void* pKey; /* Key associated with this element */
    70  int nKey; /* Key associated with this element */
    71 } mrhashelem_t;
    72 
    73 
    74 /*
    75  * There are 4 different modes of operation for a hash table:
    76  *
    77  * MRHASH_INT nKey is used as the key and pKey is ignored.
    78  *
    79  * MRHASH_POINTER pKey is used as the key and nKey is ignored.
    80  *
    81  * MRHASH_STRING pKey points to a string that is nKey bytes long
    82  * (including the null-terminator, if any). Case
    83  * is ignored in comparisons.
    84  *
    85  * MRHASH_BINARY pKey points to binary data nKey bytes long.
    86  * memcmp() is used to compare keys.
    87  *
    88  * A copy of the key is made for MRHASH_STRING and MRHASH_BINARY
    89  * if the copyKey parameter to mrhash_init() is 1.
    90  */
    91 #define MRHASH_INT 1
    92 #define MRHASH_POINTER 2
    93 #define MRHASH_STRING 3
    94 #define MRHASH_BINARY 4
    95 
    96 
    97 /*
    98  * Access routines. To delete an element, insert a NULL pointer.
    99  */
    100 void mrhash_init (mrhash_t*, int keytype, int copyKey);
    101 void* mrhash_insert (mrhash_t*, const void *pKey, int nKey, void *pData);
    102 void* mrhash_find (const mrhash_t*, const void *pKey, int nKey);
    103 void mrhash_clear (mrhash_t*);
    104 
    105 
    106 /*
    107  * Macros for looping over all elements of a hash table. The idiom is
    108  * like this:
    109  *
    110  * SjHash h;
    111  * SjHashElem *p;
    112  * ...
    113  * for(p=mrhash_first(&h); p; p=mrhash_next(p)){
    114  * SomeStructure *pData = mrhash_data(p);
    115  * // do something with pData
    116  * }
    117  */
    118 #define mrhash_first(H) ((H)->first)
    119 #define mrhash_next(E) ((E)->next)
    120 #define mrhash_data(E) ((E)->data)
    121 #define mrhash_key(E) ((E)->pKey)
    122 #define mrhash_keysize(E) ((E)->nKey)
    123 
    124 
    125 /*
    126  * Number of entries in a hash table
    127  */
    128 #define mrhash_count(H) ((H)->count)
    129 
    130 
    131 #ifdef __cplusplus
    132 }; /* /extern "C" */
    133 #endif
    134 #endif /* __MRHASH_H__ */
    + + + + diff --git a/docs/html/mrmailbox_8h_source.html b/docs/html/mrmailbox_8h_source.html index 97216a44..78b6a3de 100644 --- a/docs/html/mrmailbox_8h_source.html +++ b/docs/html/mrmailbox_8h_source.html @@ -89,81 +89,81 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    mrmailbox.h
    -
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 #ifndef __MRMAILBOX_H__
    24 #define __MRMAILBOX_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 #define MR_VERSION_MAJOR 0
    31 #define MR_VERSION_MINOR 10
    32 #define MR_VERSION_REVISION 0
    33 
    34 
    145 #include <pthread.h>
    146 #include <libetpan/libetpan.h> /* defines uint16_t */
    147 #include "mrarray.h"
    148 #include "mrchatlist.h"
    149 #include "mrchat.h"
    150 #include "mrmsg.h"
    151 #include "mrcontact.h"
    152 #include "mrlot.h"
    153 #include "mrparam.h"
    154 #include "mrevent.h"
    155 
    156 typedef struct mrmailbox_t mrmailbox_t;
    157 typedef struct mrimap_t mrimap_t;
    158 typedef struct mrsmtp_t mrsmtp_t;
    159 typedef struct mrsqlite3_t mrsqlite3_t;
    160 typedef struct mrjob_t mrjob_t;
    161 typedef struct mrmimeparser_t mrmimeparser_t;
    162 
    163 
    179 typedef uintptr_t (*mrmailboxcb_t) (mrmailbox_t*, int event, uintptr_t data1, uintptr_t data2);
    180 
    181 
    189 typedef struct mrmailbox_t
    190 {
    191  void* m_userdata;
    194  char* m_dbfile;
    195  char* m_blobdir;
    197  mrsqlite3_t* m_sql;
    198  mrimap_t* m_imap;
    199  mrsmtp_t* m_smtp;
    201  pthread_t m_job_thread;
    202  pthread_cond_t m_job_cond;
    203  pthread_mutex_t m_job_condmutex;
    204  int m_job_condflag;
    205  int m_job_do_exit;
    207  mrmailboxcb_t m_cb;
    209  char* m_os_name;
    211  uint32_t m_cmdline_sel_chat_id;
    213  int m_wake_lock;
    214  pthread_mutex_t m_wake_lock_critical;
    216  int m_e2ee_enabled;
    218  #define MR_LOG_RINGBUF_SIZE 200
    219  pthread_mutex_t m_log_ringbuf_critical;
    220  char* m_log_ringbuf[MR_LOG_RINGBUF_SIZE];
    222  time_t m_log_ringbuf_times[MR_LOG_RINGBUF_SIZE];
    224  int m_log_ringbuf_pos;
    226 } mrmailbox_t;
    227 
    228 
    229 /* create/open/connect */
    230 mrmailbox_t* mrmailbox_new (mrmailboxcb_t, void* userdata, const char* os_name);
    231 void mrmailbox_unref (mrmailbox_t*);
    232 
    233 int mrmailbox_open (mrmailbox_t*, const char* dbfile, const char* blobdir);
    234 void mrmailbox_close (mrmailbox_t*);
    235 int mrmailbox_is_open (const mrmailbox_t*);
    236 
    237 int mrmailbox_set_config (mrmailbox_t*, const char* key, const char* value);
    238 char* mrmailbox_get_config (mrmailbox_t*, const char* key, const char* def);
    239 int mrmailbox_set_config_int (mrmailbox_t*, const char* key, int32_t value);
    240 int32_t mrmailbox_get_config_int (mrmailbox_t*, const char* key, int32_t def);
    241 char* mrmailbox_get_version_str (void);
    242 
    243 int mrmailbox_configure_and_connect(mrmailbox_t*);
    244 void mrmailbox_stop_ongoing_process(mrmailbox_t*);
    245 int mrmailbox_is_configured (mrmailbox_t*);
    246 
    247 void mrmailbox_connect (mrmailbox_t*);
    248 void mrmailbox_disconnect (mrmailbox_t*);
    249 
    250 char* mrmailbox_get_info (mrmailbox_t*);
    251 
    252 
    253 /* Handle chatlists */
    254 #define MR_GCL_ARCHIVED_ONLY 0x01
    255 #define MR_GCL_NO_SPECIALS 0x02
    256 mrchatlist_t* mrmailbox_get_chatlist (mrmailbox_t*, int flags, const char* query);
    257 
    258 
    259 /* Handle chats */
    260 uint32_t mrmailbox_create_chat_by_contact_id (mrmailbox_t*, uint32_t contact_id);
    261 uint32_t mrmailbox_get_chat_id_by_contact_id (mrmailbox_t*, uint32_t contact_id);
    262 
    263 uint32_t mrmailbox_send_text_msg (mrmailbox_t*, uint32_t chat_id, const char* text_to_send);
    264 uint32_t mrmailbox_send_image_msg (mrmailbox_t*, uint32_t chat_id, const char* file, const char* filemime, int width, int height);
    265 uint32_t mrmailbox_send_video_msg (mrmailbox_t*, uint32_t chat_id, const char* file, const char* filemime, int width, int height, int duration);
    266 uint32_t mrmailbox_send_voice_msg (mrmailbox_t*, uint32_t chat_id, const char* file, const char* filemime, int duration);
    267 uint32_t mrmailbox_send_audio_msg (mrmailbox_t*, uint32_t chat_id, const char* file, const char* filemime, int duration, const char* author, const char* trackname);
    268 uint32_t mrmailbox_send_file_msg (mrmailbox_t*, uint32_t chat_id, const char* file, const char* filemime);
    269 uint32_t mrmailbox_send_vcard_msg (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    270 void mrmailbox_set_draft (mrmailbox_t*, uint32_t chat_id, const char*);
    271 
    272 #define MR_GCM_ADDDAYMARKER 0x01
    273 mrarray_t* mrmailbox_get_chat_msgs (mrmailbox_t*, uint32_t chat_id, uint32_t flags, uint32_t marker1before);
    274 int mrmailbox_get_total_msg_count (mrmailbox_t*, uint32_t chat_id);
    275 int mrmailbox_get_fresh_msg_count (mrmailbox_t*, uint32_t chat_id);
    276 mrarray_t* mrmailbox_get_fresh_msgs (mrmailbox_t*);
    277 void mrmailbox_marknoticed_chat (mrmailbox_t*, uint32_t chat_id);
    278 mrarray_t* mrmailbox_get_chat_media (mrmailbox_t*, uint32_t chat_id, int msg_type, int or_msg_type);
    279 uint32_t mrmailbox_get_next_media (mrmailbox_t*, uint32_t curr_msg_id, int dir);
    280 
    281 void mrmailbox_archive_chat (mrmailbox_t*, uint32_t chat_id, int archive);
    282 void mrmailbox_delete_chat (mrmailbox_t*, uint32_t chat_id);
    283 
    284 mrarray_t* mrmailbox_get_chat_contacts (mrmailbox_t*, uint32_t chat_id);
    285 mrarray_t* mrmailbox_search_msgs (mrmailbox_t*, uint32_t chat_id, const char* query);
    286 
    287 mrchat_t* mrmailbox_get_chat (mrmailbox_t*, uint32_t chat_id);
    288 
    289 
    290 /* Handle group chats */
    291 uint32_t mrmailbox_create_group_chat (mrmailbox_t*, const char* name);
    292 int mrmailbox_is_contact_in_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    293 int mrmailbox_add_contact_to_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    294 int mrmailbox_remove_contact_from_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    295 int mrmailbox_set_chat_name (mrmailbox_t*, uint32_t chat_id, const char* name);
    296 int mrmailbox_set_chat_profile_image (mrmailbox_t*, uint32_t chat_id, const char* image);
    297 
    298 
    299 /* Handle messages */
    300 char* mrmailbox_get_msg_info (mrmailbox_t*, uint32_t msg_id);
    301 void mrmailbox_delete_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt);
    302 void mrmailbox_forward_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt, uint32_t chat_id);
    303 void mrmailbox_marknoticed_contact (mrmailbox_t*, uint32_t contact_id);
    304 void mrmailbox_markseen_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt);
    305 void mrmailbox_star_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt, int star);
    306 mrmsg_t* mrmailbox_get_msg (mrmailbox_t*, uint32_t msg_id);
    307 
    308 
    309 /* Handle contacts */
    310 uint32_t mrmailbox_create_contact (mrmailbox_t*, const char* name, const char* addr);
    311 int mrmailbox_add_address_book (mrmailbox_t*, const char*);
    312 mrarray_t* mrmailbox_get_known_contacts (mrmailbox_t*, const char* query);
    313 int mrmailbox_get_blocked_count (mrmailbox_t*);
    315 void mrmailbox_block_contact (mrmailbox_t*, uint32_t contact_id, int block);
    316 char* mrmailbox_get_contact_encrinfo (mrmailbox_t*, uint32_t contact_id);
    317 int mrmailbox_delete_contact (mrmailbox_t*, uint32_t contact_id);
    318 mrcontact_t* mrmailbox_get_contact (mrmailbox_t*, uint32_t contact_id);
    319 
    320 
    321 /* Import/export and Tools */
    322 #define MR_IMEX_EXPORT_SELF_KEYS 1 /* param1 is a directory where the keys are written to */
    323 #define MR_IMEX_IMPORT_SELF_KEYS 2 /* param1 is a directory where the keys are searched in and read from */
    324 #define MR_IMEX_EXPORT_BACKUP 11 /* param1 is a directory where the backup is written to */
    325 #define MR_IMEX_IMPORT_BACKUP 12 /* param1 is the file with the backup to import */
    326 #define MR_BAK_PREFIX "delta-chat"
    327 #define MR_BAK_SUFFIX "bak"
    328 int mrmailbox_imex (mrmailbox_t*, int what, const char* param1, const char* param2);
    329 char* mrmailbox_imex_has_backup (mrmailbox_t*, const char* dir);
    330 int mrmailbox_check_password (mrmailbox_t*, const char* pw);
    331 char* mrmailbox_initiate_key_transfer(mrmailbox_t*);
    332 int mrmailbox_continue_key_transfer(mrmailbox_t*, uint32_t msg_id, const char* setup_code);
    333 void mrmailbox_heartbeat (mrmailbox_t*);
    334 
    335 
    336 /* logging */
    337 void mrmailbox_log_error (mrmailbox_t*, int code, const char* msg, ...);
    338 void mrmailbox_log_error_if (int* condition, mrmailbox_t*, int code, const char* msg, ...);
    339 void mrmailbox_log_warning (mrmailbox_t*, int code, const char* msg, ...);
    340 void mrmailbox_log_info (mrmailbox_t*, int code, const char* msg, ...);
    341 void mrmailbox_log_vprintf (mrmailbox_t*, int event, int code, const char* msg, va_list);
    342 int mrmailbox_get_thread_index (void);
    343 
    344 
    345 /* error codes */
    346 #define MR_ERR_SELF_NOT_IN_GROUP 1
    347 #define MR_ERR_NONETWORK 2
    348 
    349 
    350 /* deprecated functions */
    351 int mrchat_set_draft (mrchat_t*, const char* msg); /* deprecated - use mrmailbox_set_draft() instead */
    352 #define mrpoortext_t mrlot_t
    353 #define mrpoortext_unref mrlot_unref
    354 #define mrmailbox_imex_cancel mrmailbox_stop_ongoing_process
    355 #define mrmailbox_configure_cancel mrmailbox_stop_ongoing_process
    356 
    357 
    358 /* library-internal */
    359 uint32_t mrmailbox_send_msg_object (mrmailbox_t*, uint32_t chat_id, mrmsg_t*);
    360 void mrmailbox_connect_to_imap (mrmailbox_t*, mrjob_t*);
    361 void mrmailbox_wake_lock (mrmailbox_t*);
    362 void mrmailbox_wake_unlock (mrmailbox_t*);
    363 int mrmailbox_poke_eml_file (mrmailbox_t*, const char* file);
    364 int mrmailbox_is_reply_to_known_message__ (mrmailbox_t*, mrmimeparser_t*);
    365 int mrmailbox_is_reply_to_messenger_message__ (mrmailbox_t*, mrmimeparser_t*);
    366 time_t mrmailbox_correct_bad_timestamp__ (mrmailbox_t* ths, uint32_t chat_id, uint32_t from_id, time_t desired_timestamp, int is_fresh_msg);
    367 void mrmailbox_add_or_lookup_contacts_by_mailbox_list__(mrmailbox_t* ths, struct mailimf_mailbox_list* mb_list, int origin, mrarray_t* ids, int* check_self);
    368 void mrmailbox_add_or_lookup_contacts_by_address_list__(mrmailbox_t* ths, struct mailimf_address_list* adr_list, int origin, mrarray_t* ids, int* check_self);
    369 int mrmailbox_get_archived_count__ (mrmailbox_t*);
    370 int mrmailbox_reset_tables (mrmailbox_t*, int bits); /* reset tables but leaves server configuration, 1=jobs, 2=e2ee, 8=rest but server config */
    371 size_t mrmailbox_get_real_contact_cnt__ (mrmailbox_t*);
    372 uint32_t mrmailbox_add_or_lookup_contact__ (mrmailbox_t*, const char* display_name /*can be NULL*/, const char* addr_spec, int origin, int* sth_modified);
    373 int mrmailbox_get_contact_origin__ (mrmailbox_t*, uint32_t id, int* ret_blocked);
    374 int mrmailbox_is_contact_blocked__ (mrmailbox_t*, uint32_t id);
    375 int mrmailbox_real_contact_exists__ (mrmailbox_t*, uint32_t id);
    376 int mrmailbox_contact_addr_equals__ (mrmailbox_t*, uint32_t contact_id, const char* other_addr);
    377 void mrmailbox_scaleup_contact_origin__ (mrmailbox_t*, uint32_t contact_id, int origin);
    378 void mrmailbox_unarchive_chat__ (mrmailbox_t*, uint32_t chat_id);
    379 size_t mrmailbox_get_chat_cnt__ (mrmailbox_t*);
    380 uint32_t mrmailbox_create_or_lookup_nchat_by_contact_id__ (mrmailbox_t*, uint32_t contact_id);
    381 uint32_t mrmailbox_lookup_real_nchat_by_contact_id__ (mrmailbox_t*, uint32_t contact_id);
    382 int mrmailbox_get_total_msg_count__ (mrmailbox_t*, uint32_t chat_id);
    383 int mrmailbox_get_fresh_msg_count__ (mrmailbox_t*, uint32_t chat_id);
    384 uint32_t mrmailbox_get_last_deaddrop_fresh_msg__ (mrmailbox_t*);
    385 void mrmailbox_send_msg_to_smtp (mrmailbox_t*, mrjob_t*);
    386 void mrmailbox_send_msg_to_imap (mrmailbox_t*, mrjob_t*);
    387 int mrmailbox_add_contact_to_chat__ (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    388 int mrmailbox_is_contact_in_chat__ (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    389 int mrmailbox_get_chat_contact_count__ (mrmailbox_t*, uint32_t chat_id);
    390 int mrmailbox_group_explicitly_left__ (mrmailbox_t*, const char* grpid);
    391 void mrmailbox_set_group_explicitly_left__ (mrmailbox_t*, const char* grpid);
    392 size_t mrmailbox_get_real_msg_cnt__ (mrmailbox_t*); /* the number of messages assigned to real chat (!=deaddrop, !=trash) */
    393 size_t mrmailbox_get_deaddrop_msg_cnt__ (mrmailbox_t*);
    394 int mrmailbox_rfc724_mid_cnt__ (mrmailbox_t*, const char* rfc724_mid);
    395 int mrmailbox_rfc724_mid_exists__ (mrmailbox_t*, const char* rfc724_mid, char** ret_server_folder, uint32_t* ret_server_uid);
    396 void mrmailbox_update_server_uid__ (mrmailbox_t*, const char* rfc724_mid, const char* server_folder, uint32_t server_uid);
    397 void mrmailbox_update_msg_chat_id__ (mrmailbox_t*, uint32_t msg_id, uint32_t chat_id);
    398 void mrmailbox_update_msg_state__ (mrmailbox_t*, uint32_t msg_id, int state);
    399 void mrmailbox_delete_msg_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    400 int mrmailbox_mdn_from_ext__ (mrmailbox_t*, uint32_t from_id, const char* rfc724_mid, uint32_t* ret_chat_id, uint32_t* ret_msg_id); /* returns 1 if an event should be send */
    401 void mrmailbox_send_mdn (mrmailbox_t*, mrjob_t* job);
    402 void mrmailbox_markseen_msg_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    403 void mrmailbox_markseen_mdn_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    404 
    405 
    406 /* library private: end-to-end-encryption */
    407 #define MR_E2EE_DEFAULT_ENABLED 1
    408 #define MR_MDNS_DEFAULT_ENABLED 1
    409 
    410 typedef struct mrmailbox_e2ee_helper_t {
    411  int m_encryption_successfull;
    412  void* m_cdata_to_free;
    413 } mrmailbox_e2ee_helper_t;
    414 
    415 void 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*);
    416 int mrmailbox_e2ee_decrypt (mrmailbox_t*, struct mailmime* in_out_message, int* ret_validation_errors); /* returns 1 if sth. was decrypted, 0 in other cases */
    417 void 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! */
    418 int 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 */
    419 char* mrmailbox_create_setup_code (mrmailbox_t*);
    420 int mrmailbox_render_setup_file (mrmailbox_t* mailbox, const char* passphrase, char** ret_msg);
    421 
    422 extern int mr_shall_stop_ongoing;
    423 int mrmailbox_alloc_ongoing (mrmailbox_t*);
    424 void mrmailbox_free_ongoing (mrmailbox_t*);
    425 
    426 
    427 #ifdef __cplusplus
    428 } /* /extern "C" */
    429 #endif
    430 #endif /* __MRMAILBOX_H__ */
    int mrmailbox_add_address_book(mrmailbox_t *mailbox, const char *adr_book)
    Add a number of contacts.
    Definition: mrmailbox.c:4350
    -
    uint32_t mrmailbox_create_group_chat(mrmailbox_t *mailbox, const char *chat_name)
    Create a new group chat.
    Definition: mrmailbox.c:3638
    -
    uint32_t mrmailbox_create_contact(mrmailbox_t *mailbox, const char *name, const char *addr)
    Add a single contact.
    Definition: mrmailbox.c:4307
    -
    uint32_t mrmailbox_send_text_msg(mrmailbox_t *mailbox, uint32_t chat_id, const char *text_to_send)
    Send a simple text message a given chat.
    Definition: mrmailbox.c:3260
    -
    void mrmailbox_close(mrmailbox_t *mailbox)
    Close mailbox database.
    Definition: mrmailbox.c:1090
    -
    char * mrmailbox_initiate_key_transfer(mrmailbox_t *mailbox)
    Initiate Autocrypt Key Transfer.
    Definition: mrmailbox_imex.c:469
    -
    mrmailbox_t * mrmailbox_new(mrmailboxcb_t cb, void *userdata, const char *os_name)
    Create a new mailbox object.
    Definition: mrmailbox.c:907
    -
    int mrmailbox_is_contact_in_chat(mrmailbox_t *mailbox, uint32_t chat_id, uint32_t contact_id)
    Check if a given contact ID is a member of a group chat.
    Definition: mrmailbox.c:3876
    +
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 #ifndef __MRMAILBOX_H__
    24 #define __MRMAILBOX_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 #define MR_VERSION_MAJOR 0
    31 #define MR_VERSION_MINOR 10
    32 #define MR_VERSION_REVISION 0
    33 
    34 
    145 #include <pthread.h>
    146 #include <libetpan/libetpan.h> /* defines uint16_t */
    147 #include "mrarray.h"
    148 #include "mrchatlist.h"
    149 #include "mrchat.h"
    150 #include "mrmsg.h"
    151 #include "mrcontact.h"
    152 #include "mrlot.h"
    153 #include "mrparam.h"
    154 #include "mrevent.h"
    155 
    156 typedef struct mrmailbox_t mrmailbox_t;
    157 typedef struct mrimap_t mrimap_t;
    158 typedef struct mrsmtp_t mrsmtp_t;
    159 typedef struct mrsqlite3_t mrsqlite3_t;
    160 typedef struct mrjob_t mrjob_t;
    161 typedef struct mrmimeparser_t mrmimeparser_t;
    162 
    163 
    179 typedef uintptr_t (*mrmailboxcb_t) (mrmailbox_t*, int event, uintptr_t data1, uintptr_t data2);
    180 
    181 
    189 typedef struct mrmailbox_t
    190 {
    191  void* m_userdata;
    194  char* m_dbfile;
    195  char* m_blobdir;
    197  mrsqlite3_t* m_sql;
    198  mrimap_t* m_imap;
    199  mrsmtp_t* m_smtp;
    201  pthread_t m_job_thread;
    202  pthread_cond_t m_job_cond;
    203  pthread_mutex_t m_job_condmutex;
    204  int m_job_condflag;
    205  int m_job_do_exit;
    207  mrmailboxcb_t m_cb;
    209  char* m_os_name;
    211  uint32_t m_cmdline_sel_chat_id;
    213  int m_wake_lock;
    214  pthread_mutex_t m_wake_lock_critical;
    216  int m_e2ee_enabled;
    218  #define MR_LOG_RINGBUF_SIZE 200
    219  pthread_mutex_t m_log_ringbuf_critical;
    220  char* m_log_ringbuf[MR_LOG_RINGBUF_SIZE];
    222  time_t m_log_ringbuf_times[MR_LOG_RINGBUF_SIZE];
    224  int m_log_ringbuf_pos;
    226 } mrmailbox_t;
    227 
    228 
    229 /* create/open/connect */
    230 mrmailbox_t* mrmailbox_new (mrmailboxcb_t, void* userdata, const char* os_name);
    231 void mrmailbox_unref (mrmailbox_t*);
    232 
    233 int mrmailbox_open (mrmailbox_t*, const char* dbfile, const char* blobdir);
    234 void mrmailbox_close (mrmailbox_t*);
    235 int mrmailbox_is_open (const mrmailbox_t*);
    236 
    237 int mrmailbox_set_config (mrmailbox_t*, const char* key, const char* value);
    238 char* mrmailbox_get_config (mrmailbox_t*, const char* key, const char* def);
    239 int mrmailbox_set_config_int (mrmailbox_t*, const char* key, int32_t value);
    240 int32_t mrmailbox_get_config_int (mrmailbox_t*, const char* key, int32_t def);
    241 char* mrmailbox_get_version_str (void);
    242 
    243 int mrmailbox_configure_and_connect(mrmailbox_t*);
    244 void mrmailbox_stop_ongoing_process(mrmailbox_t*);
    245 int mrmailbox_is_configured (mrmailbox_t*);
    246 
    247 void mrmailbox_connect (mrmailbox_t*);
    248 void mrmailbox_disconnect (mrmailbox_t*);
    249 
    250 char* mrmailbox_get_info (mrmailbox_t*);
    251 
    252 
    253 /* Handle chatlists */
    254 #define MR_GCL_ARCHIVED_ONLY 0x01
    255 #define MR_GCL_NO_SPECIALS 0x02
    256 mrchatlist_t* mrmailbox_get_chatlist (mrmailbox_t*, int flags, const char* query);
    257 
    258 
    259 /* Handle chats */
    260 uint32_t mrmailbox_create_chat_by_contact_id (mrmailbox_t*, uint32_t contact_id);
    261 uint32_t mrmailbox_get_chat_id_by_contact_id (mrmailbox_t*, uint32_t contact_id);
    262 
    263 uint32_t mrmailbox_send_text_msg (mrmailbox_t*, uint32_t chat_id, const char* text_to_send);
    264 uint32_t mrmailbox_send_image_msg (mrmailbox_t*, uint32_t chat_id, const char* file, const char* filemime, int width, int height);
    265 uint32_t mrmailbox_send_video_msg (mrmailbox_t*, uint32_t chat_id, const char* file, const char* filemime, int width, int height, int duration);
    266 uint32_t mrmailbox_send_voice_msg (mrmailbox_t*, uint32_t chat_id, const char* file, const char* filemime, int duration);
    267 uint32_t mrmailbox_send_audio_msg (mrmailbox_t*, uint32_t chat_id, const char* file, const char* filemime, int duration, const char* author, const char* trackname);
    268 uint32_t mrmailbox_send_file_msg (mrmailbox_t*, uint32_t chat_id, const char* file, const char* filemime);
    269 uint32_t mrmailbox_send_vcard_msg (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    270 void mrmailbox_set_draft (mrmailbox_t*, uint32_t chat_id, const char*);
    271 
    272 #define MR_GCM_ADDDAYMARKER 0x01
    273 mrarray_t* mrmailbox_get_chat_msgs (mrmailbox_t*, uint32_t chat_id, uint32_t flags, uint32_t marker1before);
    274 int mrmailbox_get_total_msg_count (mrmailbox_t*, uint32_t chat_id);
    275 int mrmailbox_get_fresh_msg_count (mrmailbox_t*, uint32_t chat_id);
    276 mrarray_t* mrmailbox_get_fresh_msgs (mrmailbox_t*);
    277 void mrmailbox_marknoticed_chat (mrmailbox_t*, uint32_t chat_id);
    278 mrarray_t* mrmailbox_get_chat_media (mrmailbox_t*, uint32_t chat_id, int msg_type, int or_msg_type);
    279 uint32_t mrmailbox_get_next_media (mrmailbox_t*, uint32_t curr_msg_id, int dir);
    280 
    281 void mrmailbox_archive_chat (mrmailbox_t*, uint32_t chat_id, int archive);
    282 void mrmailbox_delete_chat (mrmailbox_t*, uint32_t chat_id);
    283 
    284 mrarray_t* mrmailbox_get_chat_contacts (mrmailbox_t*, uint32_t chat_id);
    285 mrarray_t* mrmailbox_search_msgs (mrmailbox_t*, uint32_t chat_id, const char* query);
    286 
    287 mrchat_t* mrmailbox_get_chat (mrmailbox_t*, uint32_t chat_id);
    288 
    289 
    290 /* Handle group chats */
    291 uint32_t mrmailbox_create_group_chat (mrmailbox_t*, const char* name);
    292 int mrmailbox_is_contact_in_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    293 int mrmailbox_add_contact_to_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    294 int mrmailbox_remove_contact_from_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    295 int mrmailbox_set_chat_name (mrmailbox_t*, uint32_t chat_id, const char* name);
    296 int mrmailbox_set_chat_profile_image (mrmailbox_t*, uint32_t chat_id, const char* image);
    297 
    298 
    299 /* Handle messages */
    300 char* mrmailbox_get_msg_info (mrmailbox_t*, uint32_t msg_id);
    301 void mrmailbox_delete_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt);
    302 void mrmailbox_forward_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt, uint32_t chat_id);
    303 void mrmailbox_marknoticed_contact (mrmailbox_t*, uint32_t contact_id);
    304 void mrmailbox_markseen_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt);
    305 void mrmailbox_star_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt, int star);
    306 mrmsg_t* mrmailbox_get_msg (mrmailbox_t*, uint32_t msg_id);
    307 
    308 
    309 /* Handle contacts */
    310 uint32_t mrmailbox_create_contact (mrmailbox_t*, const char* name, const char* addr);
    311 int mrmailbox_add_address_book (mrmailbox_t*, const char*);
    312 mrarray_t* mrmailbox_get_known_contacts (mrmailbox_t*, const char* query);
    313 int mrmailbox_get_blocked_count (mrmailbox_t*);
    315 void mrmailbox_block_contact (mrmailbox_t*, uint32_t contact_id, int block);
    316 char* mrmailbox_get_contact_encrinfo (mrmailbox_t*, uint32_t contact_id);
    317 int mrmailbox_delete_contact (mrmailbox_t*, uint32_t contact_id);
    318 mrcontact_t* mrmailbox_get_contact (mrmailbox_t*, uint32_t contact_id);
    319 
    320 
    321 /* Import/export and Tools */
    322 #define MR_IMEX_EXPORT_SELF_KEYS 1 /* param1 is a directory where the keys are written to */
    323 #define MR_IMEX_IMPORT_SELF_KEYS 2 /* param1 is a directory where the keys are searched in and read from */
    324 #define MR_IMEX_EXPORT_BACKUP 11 /* param1 is a directory where the backup is written to */
    325 #define MR_IMEX_IMPORT_BACKUP 12 /* param1 is the file with the backup to import */
    326 #define MR_BAK_PREFIX "delta-chat"
    327 #define MR_BAK_SUFFIX "bak"
    328 int mrmailbox_imex (mrmailbox_t*, int what, const char* param1, const char* param2);
    329 char* mrmailbox_imex_has_backup (mrmailbox_t*, const char* dir);
    330 int mrmailbox_check_password (mrmailbox_t*, const char* pw);
    331 char* mrmailbox_initiate_key_transfer(mrmailbox_t*);
    332 int mrmailbox_continue_key_transfer(mrmailbox_t*, uint32_t msg_id, const char* setup_code);
    333 void mrmailbox_heartbeat (mrmailbox_t*);
    334 
    335 
    336 /* logging */
    337 void mrmailbox_log_error (mrmailbox_t*, int code, const char* msg, ...);
    338 void mrmailbox_log_error_if (int* condition, mrmailbox_t*, int code, const char* msg, ...);
    339 void mrmailbox_log_warning (mrmailbox_t*, int code, const char* msg, ...);
    340 void mrmailbox_log_info (mrmailbox_t*, int code, const char* msg, ...);
    341 void mrmailbox_log_vprintf (mrmailbox_t*, int event, int code, const char* msg, va_list);
    342 int mrmailbox_get_thread_index (void);
    343 
    344 
    345 /* error codes */
    346 #define MR_ERR_SELF_NOT_IN_GROUP 1
    347 #define MR_ERR_NONETWORK 2
    348 
    349 
    350 /* deprecated functions */
    351 int mrchat_set_draft (mrchat_t*, const char* msg); /* deprecated - use mrmailbox_set_draft() instead */
    352 #define mrpoortext_t mrlot_t
    353 #define mrpoortext_unref mrlot_unref
    354 #define mrmailbox_imex_cancel mrmailbox_stop_ongoing_process
    355 #define mrmailbox_configure_cancel mrmailbox_stop_ongoing_process
    356 
    357 
    358 /* library-internal */
    359 uint32_t mrmailbox_send_msg_object (mrmailbox_t*, uint32_t chat_id, mrmsg_t*);
    360 void mrmailbox_connect_to_imap (mrmailbox_t*, mrjob_t*);
    361 void mrmailbox_wake_lock (mrmailbox_t*);
    362 void mrmailbox_wake_unlock (mrmailbox_t*);
    363 int mrmailbox_poke_eml_file (mrmailbox_t*, const char* file);
    364 int mrmailbox_is_reply_to_known_message__ (mrmailbox_t*, mrmimeparser_t*);
    365 int mrmailbox_is_reply_to_messenger_message__ (mrmailbox_t*, mrmimeparser_t*);
    366 time_t mrmailbox_correct_bad_timestamp__ (mrmailbox_t* ths, uint32_t chat_id, uint32_t from_id, time_t desired_timestamp, int is_fresh_msg);
    367 void mrmailbox_add_or_lookup_contacts_by_mailbox_list__(mrmailbox_t* ths, struct mailimf_mailbox_list* mb_list, int origin, mrarray_t* ids, int* check_self);
    368 void mrmailbox_add_or_lookup_contacts_by_address_list__(mrmailbox_t* ths, struct mailimf_address_list* adr_list, int origin, mrarray_t* ids, int* check_self);
    369 int mrmailbox_get_archived_count__ (mrmailbox_t*);
    370 int mrmailbox_reset_tables (mrmailbox_t*, int bits); /* reset tables but leaves server configuration, 1=jobs, 2=e2ee, 8=rest but server config */
    371 size_t mrmailbox_get_real_contact_cnt__ (mrmailbox_t*);
    372 uint32_t mrmailbox_add_or_lookup_contact__ (mrmailbox_t*, const char* display_name /*can be NULL*/, const char* addr_spec, int origin, int* sth_modified);
    373 int mrmailbox_get_contact_origin__ (mrmailbox_t*, uint32_t id, int* ret_blocked);
    374 int mrmailbox_is_contact_blocked__ (mrmailbox_t*, uint32_t id);
    375 int mrmailbox_real_contact_exists__ (mrmailbox_t*, uint32_t id);
    376 int mrmailbox_contact_addr_equals__ (mrmailbox_t*, uint32_t contact_id, const char* other_addr);
    377 void mrmailbox_scaleup_contact_origin__ (mrmailbox_t*, uint32_t contact_id, int origin);
    378 void mrmailbox_unarchive_chat__ (mrmailbox_t*, uint32_t chat_id);
    379 size_t mrmailbox_get_chat_cnt__ (mrmailbox_t*);
    380 uint32_t mrmailbox_create_or_lookup_nchat_by_contact_id__ (mrmailbox_t*, uint32_t contact_id);
    381 uint32_t mrmailbox_lookup_real_nchat_by_contact_id__ (mrmailbox_t*, uint32_t contact_id);
    382 int mrmailbox_get_total_msg_count__ (mrmailbox_t*, uint32_t chat_id);
    383 int mrmailbox_get_fresh_msg_count__ (mrmailbox_t*, uint32_t chat_id);
    384 uint32_t mrmailbox_get_last_deaddrop_fresh_msg__ (mrmailbox_t*);
    385 void mrmailbox_send_msg_to_smtp (mrmailbox_t*, mrjob_t*);
    386 void mrmailbox_send_msg_to_imap (mrmailbox_t*, mrjob_t*);
    387 int mrmailbox_add_contact_to_chat__ (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    388 int mrmailbox_is_contact_in_chat__ (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    389 int mrmailbox_get_chat_contact_count__ (mrmailbox_t*, uint32_t chat_id);
    390 int mrmailbox_group_explicitly_left__ (mrmailbox_t*, const char* grpid);
    391 void mrmailbox_set_group_explicitly_left__ (mrmailbox_t*, const char* grpid);
    392 size_t mrmailbox_get_real_msg_cnt__ (mrmailbox_t*); /* the number of messages assigned to real chat (!=deaddrop, !=trash) */
    393 size_t mrmailbox_get_deaddrop_msg_cnt__ (mrmailbox_t*);
    394 int mrmailbox_rfc724_mid_cnt__ (mrmailbox_t*, const char* rfc724_mid);
    395 int mrmailbox_rfc724_mid_exists__ (mrmailbox_t*, const char* rfc724_mid, char** ret_server_folder, uint32_t* ret_server_uid);
    396 void mrmailbox_update_server_uid__ (mrmailbox_t*, const char* rfc724_mid, const char* server_folder, uint32_t server_uid);
    397 void mrmailbox_update_msg_chat_id__ (mrmailbox_t*, uint32_t msg_id, uint32_t chat_id);
    398 void mrmailbox_update_msg_state__ (mrmailbox_t*, uint32_t msg_id, int state);
    399 void mrmailbox_delete_msg_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    400 int mrmailbox_mdn_from_ext__ (mrmailbox_t*, uint32_t from_id, const char* rfc724_mid, uint32_t* ret_chat_id, uint32_t* ret_msg_id); /* returns 1 if an event should be send */
    401 void mrmailbox_send_mdn (mrmailbox_t*, mrjob_t* job);
    402 void mrmailbox_markseen_msg_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    403 void mrmailbox_markseen_mdn_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    404 
    405 
    406 /* library private: end-to-end-encryption */
    407 #define MR_E2EE_DEFAULT_ENABLED 1
    408 #define MR_MDNS_DEFAULT_ENABLED 1
    409 
    410 typedef struct mrmailbox_e2ee_helper_t {
    411  int m_encryption_successfull;
    412  void* m_cdata_to_free;
    413 } mrmailbox_e2ee_helper_t;
    414 
    415 void 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*);
    416 int mrmailbox_e2ee_decrypt (mrmailbox_t*, struct mailmime* in_out_message, int* ret_validation_errors); /* returns 1 if sth. was decrypted, 0 in other cases */
    417 void 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! */
    418 int 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 */
    419 char* mrmailbox_create_setup_code (mrmailbox_t*);
    420 int mrmailbox_render_setup_file (mrmailbox_t* mailbox, const char* passphrase, char** ret_msg);
    421 
    422 extern int mr_shall_stop_ongoing;
    423 int mrmailbox_alloc_ongoing (mrmailbox_t*);
    424 void mrmailbox_free_ongoing (mrmailbox_t*);
    425 
    426 
    427 #ifdef __cplusplus
    428 } /* /extern "C" */
    429 #endif
    430 #endif /* __MRMAILBOX_H__ */
    int mrmailbox_add_address_book(mrmailbox_t *mailbox, const char *adr_book)
    Add a number of contacts.
    Definition: mrmailbox.c:4322
    +
    uint32_t mrmailbox_create_group_chat(mrmailbox_t *mailbox, const char *chat_name)
    Create a new group chat.
    Definition: mrmailbox.c:3610
    +
    uint32_t mrmailbox_create_contact(mrmailbox_t *mailbox, const char *name, const char *addr)
    Add a single contact.
    Definition: mrmailbox.c:4279
    +
    uint32_t mrmailbox_send_text_msg(mrmailbox_t *mailbox, uint32_t chat_id, const char *text_to_send)
    Send a simple text message a given chat.
    Definition: mrmailbox.c:3232
    +
    void mrmailbox_close(mrmailbox_t *mailbox)
    Close mailbox database.
    Definition: mrmailbox.c:1062
    +
    char * mrmailbox_initiate_key_transfer(mrmailbox_t *mailbox)
    Initiate Autocrypt Key Transfer.
    Definition: mrmailbox_imex.c:470
    +
    mrmailbox_t * mrmailbox_new(mrmailboxcb_t cb, void *userdata, const char *os_name)
    Create a new mailbox object.
    Definition: mrmailbox.c:879
    +
    int mrmailbox_is_contact_in_chat(mrmailbox_t *mailbox, uint32_t chat_id, uint32_t contact_id)
    Check if a given contact ID is a member of a group chat.
    Definition: mrmailbox.c:3848
    The following constants are used as events reported to the callback given to mrmailbox_new().
    -
    mrchat_t * mrmailbox_get_chat(mrmailbox_t *mailbox, uint32_t chat_id)
    Get chat object by a chat ID.
    Definition: mrmailbox.c:1706
    -
    int mrmailbox_remove_contact_from_chat(mrmailbox_t *mailbox, uint32_t chat_id, uint32_t contact_id)
    Remove a member from a group.
    Definition: mrmailbox.c:3993
    -
    int mrmailbox_open(mrmailbox_t *mailbox, const char *dbfile, const char *blobdir)
    Open mailbox database.
    Definition: mrmailbox.c:1025
    +
    mrchat_t * mrmailbox_get_chat(mrmailbox_t *mailbox, uint32_t chat_id)
    Get chat object by a chat ID.
    Definition: mrmailbox.c:1678
    +
    int mrmailbox_remove_contact_from_chat(mrmailbox_t *mailbox, uint32_t chat_id, uint32_t contact_id)
    Remove a member from a group.
    Definition: mrmailbox.c:3965
    +
    int mrmailbox_open(mrmailbox_t *mailbox, const char *dbfile, const char *blobdir)
    Open mailbox database.
    Definition: mrmailbox.c:997
    An object representing a single contact in memory.
    Definition: mrcontact.h:38
    An object containing a simple array.
    Definition: mrarray.h:39
    -
    mrarray_t * mrmailbox_get_chat_msgs(mrmailbox_t *mailbox, uint32_t chat_id, uint32_t flags, uint32_t marker1before)
    Get all message IDs belonging to a chat.
    Definition: mrmailbox.c:2118
    -
    uint32_t mrmailbox_send_file_msg(mrmailbox_t *mailbox, uint32_t chat_id, const char *file, const char *filemime)
    Send a document to a chat.
    Definition: mrmailbox.c:3475
    -
    int mrmailbox_delete_contact(mrmailbox_t *mailbox, uint32_t contact_id)
    Delete a contact.
    Definition: mrmailbox.c:4838
    +
    mrarray_t * mrmailbox_get_chat_msgs(mrmailbox_t *mailbox, uint32_t chat_id, uint32_t flags, uint32_t marker1before)
    Get all message IDs belonging to a chat.
    Definition: mrmailbox.c:2090
    +
    uint32_t mrmailbox_send_file_msg(mrmailbox_t *mailbox, uint32_t chat_id, const char *file, const char *filemime)
    Send a document to a chat.
    Definition: mrmailbox.c:3447
    +
    int mrmailbox_delete_contact(mrmailbox_t *mailbox, uint32_t contact_id)
    Delete a contact.
    Definition: mrmailbox.c:4810
    An object representing a single chatlist in memory.
    Definition: mrchatlist.h:43
    -
    void mrmailbox_heartbeat(mrmailbox_t *ths)
    Stay alive.
    Definition: mrmailbox.c:1630
    -
    void mrmailbox_star_msgs(mrmailbox_t *mailbox, const uint32_t *msg_ids, int msg_cnt, int star)
    Star/unstar messages by setting the last parameter to 0 (unstar) or 1(star).
    Definition: mrmailbox.c:5283
    -
    int mrmailbox_set_config(mrmailbox_t *ths, const char *key, const char *value)
    Configure the mailbox.
    Definition: mrmailbox.c:1191
    +
    void mrmailbox_heartbeat(mrmailbox_t *ths)
    Stay alive.
    Definition: mrmailbox.c:1602
    +
    void mrmailbox_star_msgs(mrmailbox_t *mailbox, const uint32_t *msg_ids, int msg_cnt, int star)
    Star/unstar messages by setting the last parameter to 0 (unstar) or 1(star).
    Definition: mrmailbox.c:5255
    +
    int mrmailbox_set_config(mrmailbox_t *ths, const char *key, const char *value)
    Configure the mailbox.
    Definition: mrmailbox.c:1163
    An object representing a single mailbox.
    Definition: mrmailbox.h:189
    -
    void mrmailbox_delete_msgs(mrmailbox_t *mailbox, const uint32_t *msg_ids, int msg_cnt)
    Delete messages.
    Definition: mrmailbox.c:5425
    -
    uint32_t mrmailbox_send_video_msg(mrmailbox_t *mailbox, uint32_t chat_id, const char *file, const char *filemime, int width, int height, int duration)
    Send an video to a chat.
    Definition: mrmailbox.c:3346
    -
    int mrmailbox_is_open(const mrmailbox_t *mailbox)
    Check if the mailbox database is open.
    Definition: mrmailbox.c:1124
    -
    void mrmailbox_archive_chat(mrmailbox_t *mailbox, uint32_t chat_id, int archive)
    Archive or unarchive a chat.
    Definition: mrmailbox.c:2656
    -
    char * mrmailbox_get_info(mrmailbox_t *mailbox)
    Get information about the mailbox.
    Definition: mrmailbox.c:1292
    -
    mrarray_t * mrmailbox_get_blocked_contacts(mrmailbox_t *mailbox)
    Get blocked contacts.
    Definition: mrmailbox.c:4469
    -
    mrarray_t * mrmailbox_get_known_contacts(mrmailbox_t *mailbox, const char *query)
    Returns known and unblocked contacts.
    Definition: mrmailbox.c:4405
    -
    int mrmailbox_add_contact_to_chat(mrmailbox_t *mailbox, uint32_t chat_id, uint32_t contact_id)
    Add a member to a group.
    Definition: mrmailbox.c:3908
    -
    uint32_t mrmailbox_get_next_media(mrmailbox_t *mailbox, uint32_t curr_msg_id, int dir)
    Get next/previous message of the same type.
    Definition: mrmailbox.c:1925
    -
    char * mrmailbox_get_version_str(void)
    Find out the version of the Delta Chat core library.
    Definition: mrmailbox.c:1490
    -
    void mrmailbox_disconnect(mrmailbox_t *mailbox)
    Disonnect the mailbox from the server.
    Definition: mrmailbox.c:1605
    -
    uint32_t mrmailbox_send_voice_msg(mrmailbox_t *mailbox, uint32_t chat_id, const char *file, const char *filemime, int duration)
    Send a voice message to a chat.
    Definition: mrmailbox.c:3390
    +
    void mrmailbox_delete_msgs(mrmailbox_t *mailbox, const uint32_t *msg_ids, int msg_cnt)
    Delete messages.
    Definition: mrmailbox.c:5397
    +
    uint32_t mrmailbox_send_video_msg(mrmailbox_t *mailbox, uint32_t chat_id, const char *file, const char *filemime, int width, int height, int duration)
    Send an video to a chat.
    Definition: mrmailbox.c:3318
    +
    int mrmailbox_is_open(const mrmailbox_t *mailbox)
    Check if the mailbox database is open.
    Definition: mrmailbox.c:1096
    +
    void mrmailbox_archive_chat(mrmailbox_t *mailbox, uint32_t chat_id, int archive)
    Archive or unarchive a chat.
    Definition: mrmailbox.c:2628
    +
    char * mrmailbox_get_info(mrmailbox_t *mailbox)
    Get information about the mailbox.
    Definition: mrmailbox.c:1264
    +
    mrarray_t * mrmailbox_get_blocked_contacts(mrmailbox_t *mailbox)
    Get blocked contacts.
    Definition: mrmailbox.c:4441
    +
    mrarray_t * mrmailbox_get_known_contacts(mrmailbox_t *mailbox, const char *query)
    Returns known and unblocked contacts.
    Definition: mrmailbox.c:4377
    +
    int mrmailbox_add_contact_to_chat(mrmailbox_t *mailbox, uint32_t chat_id, uint32_t contact_id)
    Add a member to a group.
    Definition: mrmailbox.c:3880
    +
    uint32_t mrmailbox_get_next_media(mrmailbox_t *mailbox, uint32_t curr_msg_id, int dir)
    Get next/previous message of the same type.
    Definition: mrmailbox.c:1897
    +
    char * mrmailbox_get_version_str(void)
    Find out the version of the Delta Chat core library.
    Definition: mrmailbox.c:1462
    +
    void mrmailbox_disconnect(mrmailbox_t *mailbox)
    Disonnect the mailbox from the server.
    Definition: mrmailbox.c:1577
    +
    uint32_t mrmailbox_send_voice_msg(mrmailbox_t *mailbox, uint32_t chat_id, const char *file, const char *filemime, int duration)
    Send a voice message to a chat.
    Definition: mrmailbox.c:3362
    void mrmailbox_stop_ongoing_process(mrmailbox_t *mailbox)
    Signal an ongoing process to stop.
    Definition: mrmailbox_configure.c:785
    -
    void mrmailbox_connect(mrmailbox_t *mailbox)
    Connect to the mailbox using the configured settings.
    Definition: mrmailbox.c:1578
    -
    int mrmailbox_get_total_msg_count(mrmailbox_t *mailbox, uint32_t chat_id)
    Get the total number of messages in a chat.
    Definition: mrmailbox.c:2588
    -
    uint32_t mrmailbox_send_vcard_msg(mrmailbox_t *mailbox, uint32_t chat_id, uint32_t contact_id)
    Send foreign contact data to a chat.
    Definition: mrmailbox.c:3523
    -
    void mrmailbox_unref(mrmailbox_t *mailbox)
    Free a mailbox object.
    Definition: mrmailbox.c:964
    -
    void mrmailbox_block_contact(mrmailbox_t *mailbox, uint32_t contact_id, int new_blocking)
    Block or unblock a contact.
    Definition: mrmailbox.c:4619
    -
    int mrmailbox_continue_key_transfer(mrmailbox_t *mailbox, uint32_t msg_id, const char *setup_code)
    Continue the Autocrypt Key Transfer on another device.
    Definition: mrmailbox_imex.c:581
    +
    void mrmailbox_connect(mrmailbox_t *mailbox)
    Connect to the mailbox using the configured settings.
    Definition: mrmailbox.c:1550
    +
    int mrmailbox_get_total_msg_count(mrmailbox_t *mailbox, uint32_t chat_id)
    Get the total number of messages in a chat.
    Definition: mrmailbox.c:2560
    +
    uint32_t mrmailbox_send_vcard_msg(mrmailbox_t *mailbox, uint32_t chat_id, uint32_t contact_id)
    Send foreign contact data to a chat.
    Definition: mrmailbox.c:3495
    +
    void mrmailbox_unref(mrmailbox_t *mailbox)
    Free a mailbox object.
    Definition: mrmailbox.c:936
    +
    void mrmailbox_block_contact(mrmailbox_t *mailbox, uint32_t contact_id, int new_blocking)
    Block or unblock a contact.
    Definition: mrmailbox.c:4591
    +
    int mrmailbox_continue_key_transfer(mrmailbox_t *mailbox, uint32_t msg_id, const char *setup_code)
    Continue the Autocrypt Key Transfer on another device.
    Definition: mrmailbox_imex.c:585
    uintptr_t(* mrmailboxcb_t)(mrmailbox_t *, int event, uintptr_t data1, uintptr_t data2)
    Callback function that should be given to mrmailbox_new().
    Definition: mrmailbox.h:179
    int mrmailbox_configure_and_connect(mrmailbox_t *mailbox)
    Configure and connect a mailbox.
    Definition: mrmailbox_configure.c:393
    -
    mrchatlist_t * mrmailbox_get_chatlist(mrmailbox_t *mailbox, int listflags, const char *query)
    Get a list of chats.
    Definition: mrmailbox.c:1662
    +
    mrchatlist_t * mrmailbox_get_chatlist(mrmailbox_t *mailbox, int listflags, const char *query)
    Get a list of chats.
    Definition: mrmailbox.c:1634
    An object representing a single message in memory.
    Definition: mrmsg.h:40
    -
    uint32_t mrmailbox_get_chat_id_by_contact_id(mrmailbox_t *mailbox, uint32_t contact_id)
    Check, if there is a normal chat with a given contact.
    Definition: mrmailbox.c:1786
    -
    int mrmailbox_get_fresh_msg_count(mrmailbox_t *mailbox, uint32_t chat_id)
    Get the number of fresh messages in a chat.
    Definition: mrmailbox.c:2616
    -
    void mrmailbox_delete_chat(mrmailbox_t *mailbox, uint32_t chat_id)
    Delete a chat.
    Definition: mrmailbox.c:2777
    -
    void mrmailbox_set_draft(mrmailbox_t *mailbox, uint32_t chat_id, const char *msg)
    Save a draft for a chat.
    Definition: mrmailbox.c:2371
    -
    int mrmailbox_imex(mrmailbox_t *mailbox, int what, const char *param1, const char *param2)
    Import/export things.
    Definition: mrmailbox_imex.c:1113
    -
    int mrmailbox_get_blocked_count(mrmailbox_t *mailbox)
    Get the number of blocked contacts.
    Definition: mrmailbox.c:4503
    -
    mrarray_t * mrmailbox_search_msgs(mrmailbox_t *mailbox, uint32_t chat_id, const char *query)
    Search messages containing the given query string.
    Definition: mrmailbox.c:2222
    -
    uint32_t mrmailbox_send_image_msg(mrmailbox_t *mailbox, uint32_t chat_id, const char *file, const char *filemime, int width, int height)
    Send an image to a chat.
    Definition: mrmailbox.c:3301
    -
    mrmsg_t * mrmailbox_get_msg(mrmailbox_t *mailbox, uint32_t msg_id)
    Get a single message object of the type mrmsg_t.
    Definition: mrmailbox.c:5030
    +
    uint32_t mrmailbox_get_chat_id_by_contact_id(mrmailbox_t *mailbox, uint32_t contact_id)
    Check, if there is a normal chat with a given contact.
    Definition: mrmailbox.c:1758
    +
    int mrmailbox_get_fresh_msg_count(mrmailbox_t *mailbox, uint32_t chat_id)
    Get the number of fresh messages in a chat.
    Definition: mrmailbox.c:2588
    +
    void mrmailbox_delete_chat(mrmailbox_t *mailbox, uint32_t chat_id)
    Delete a chat.
    Definition: mrmailbox.c:2749
    +
    void mrmailbox_set_draft(mrmailbox_t *mailbox, uint32_t chat_id, const char *msg)
    Save a draft for a chat.
    Definition: mrmailbox.c:2343
    +
    int mrmailbox_imex(mrmailbox_t *mailbox, int what, const char *param1, const char *param2)
    Import/export things.
    Definition: mrmailbox_imex.c:1121
    +
    int mrmailbox_get_blocked_count(mrmailbox_t *mailbox)
    Get the number of blocked contacts.
    Definition: mrmailbox.c:4475
    +
    mrarray_t * mrmailbox_search_msgs(mrmailbox_t *mailbox, uint32_t chat_id, const char *query)
    Search messages containing the given query string.
    Definition: mrmailbox.c:2194
    +
    uint32_t mrmailbox_send_image_msg(mrmailbox_t *mailbox, uint32_t chat_id, const char *file, const char *filemime, int width, int height)
    Send an image to a chat.
    Definition: mrmailbox.c:3273
    +
    mrmsg_t * mrmailbox_get_msg(mrmailbox_t *mailbox, uint32_t msg_id)
    Get a single message object of the type mrmsg_t.
    Definition: mrmailbox.c:5002
    void * m_userdata
    Use data, may be used for any purpose.
    Definition: mrmailbox.h:191
    int mrmailbox_is_configured(mrmailbox_t *mailbox)
    Check if the mailbox is already configured.
    Definition: mrmailbox_configure.c:705
    -
    int mrmailbox_set_chat_profile_image(mrmailbox_t *mailbox, uint32_t chat_id, const char *new_image)
    Set group profile image.
    Definition: mrmailbox.c:3787
    -
    uint32_t mrmailbox_create_chat_by_contact_id(mrmailbox_t *mailbox, uint32_t contact_id)
    Create a normal chat with a single user.
    Definition: mrmailbox.c:1813
    -
    void mrmailbox_forward_msgs(mrmailbox_t *mailbox, const uint32_t *msg_ids, int msg_cnt, uint32_t chat_id)
    Forward messages to another chat.
    Definition: mrmailbox.c:5197
    -
    void mrmailbox_markseen_msgs(mrmailbox_t *mailbox, const uint32_t *msg_ids, int msg_cnt)
    Mark a message as seen, updates the IMAP state and sends MDNs.
    Definition: mrmailbox.c:5566
    -
    mrarray_t * mrmailbox_get_chat_contacts(mrmailbox_t *mailbox, uint32_t chat_id)
    Get contact IDs belonging to a chat.
    Definition: mrmailbox.c:2001
    -
    void mrmailbox_marknoticed_chat(mrmailbox_t *mailbox, uint32_t chat_id)
    Mark all message in a chat as noticed.
    Definition: mrmailbox.c:1752
    -
    char * mrmailbox_imex_has_backup(mrmailbox_t *mailbox, const char *dir_name)
    Check if there is a backup file.
    Definition: mrmailbox_imex.c:1239
    -
    mrarray_t * mrmailbox_get_fresh_msgs(mrmailbox_t *mailbox)
    Returns the message IDs of all fresh messages of any chat.
    Definition: mrmailbox.c:2050
    -
    mrcontact_t * mrmailbox_get_contact(mrmailbox_t *mailbox, uint32_t contact_id)
    Get a single contact object.
    Definition: mrmailbox.c:4545
    -
    int mrmailbox_check_password(mrmailbox_t *mailbox, const char *test_pw)
    Check if the user is authorized by the given password in some way.
    Definition: mrmailbox_imex.c:1305
    -
    void mrmailbox_marknoticed_contact(mrmailbox_t *mailbox, uint32_t contact_id)
    Mark all messages send by the given contact as noticed.
    Definition: mrmailbox.c:4593
    -
    int mrmailbox_set_config_int(mrmailbox_t *ths, const char *key, int32_t value)
    Configure the mailbox.
    Definition: mrmailbox.c:1244
    -
    int32_t mrmailbox_get_config_int(mrmailbox_t *ths, const char *key, int32_t def)
    Get a configuration option.
    Definition: mrmailbox.c:1266
    -
    int mrmailbox_set_chat_name(mrmailbox_t *mailbox, uint32_t chat_id, const char *new_name)
    Set group name.
    Definition: mrmailbox.c:3706
    -
    char * mrmailbox_get_contact_encrinfo(mrmailbox_t *mailbox, uint32_t contact_id)
    Get encryption info for a contact.
    Definition: mrmailbox.c:4710
    -
    mrarray_t * mrmailbox_get_chat_media(mrmailbox_t *mailbox, uint32_t chat_id, int msg_type, int or_msg_type)
    Returns all message IDs of the given types in a chat.
    Definition: mrmailbox.c:1893
    -
    uint32_t mrmailbox_send_audio_msg(mrmailbox_t *mailbox, uint32_t chat_id, const char *file, const char *filemime, int duration, const char *author, const char *trackname)
    Send an audio file to a chat.
    Definition: mrmailbox.c:3433
    -
    char * mrmailbox_get_config(mrmailbox_t *ths, const char *key, const char *def)
    Get a configuration option.
    Definition: mrmailbox.c:1222
    -
    char * mrmailbox_get_msg_info(mrmailbox_t *mailbox, uint32_t msg_id)
    Get an informational text for a single message.
    Definition: mrmailbox.c:5072
    +
    int mrmailbox_set_chat_profile_image(mrmailbox_t *mailbox, uint32_t chat_id, const char *new_image)
    Set group profile image.
    Definition: mrmailbox.c:3759
    +
    uint32_t mrmailbox_create_chat_by_contact_id(mrmailbox_t *mailbox, uint32_t contact_id)
    Create a normal chat with a single user.
    Definition: mrmailbox.c:1785
    +
    void mrmailbox_forward_msgs(mrmailbox_t *mailbox, const uint32_t *msg_ids, int msg_cnt, uint32_t chat_id)
    Forward messages to another chat.
    Definition: mrmailbox.c:5169
    +
    void mrmailbox_markseen_msgs(mrmailbox_t *mailbox, const uint32_t *msg_ids, int msg_cnt)
    Mark a message as seen, updates the IMAP state and sends MDNs.
    Definition: mrmailbox.c:5538
    +
    mrarray_t * mrmailbox_get_chat_contacts(mrmailbox_t *mailbox, uint32_t chat_id)
    Get contact IDs belonging to a chat.
    Definition: mrmailbox.c:1973
    +
    void mrmailbox_marknoticed_chat(mrmailbox_t *mailbox, uint32_t chat_id)
    Mark all message in a chat as noticed.
    Definition: mrmailbox.c:1724
    +
    char * mrmailbox_imex_has_backup(mrmailbox_t *mailbox, const char *dir_name)
    Check if there is a backup file.
    Definition: mrmailbox_imex.c:1247
    +
    mrarray_t * mrmailbox_get_fresh_msgs(mrmailbox_t *mailbox)
    Returns the message IDs of all fresh messages of any chat.
    Definition: mrmailbox.c:2022
    +
    mrcontact_t * mrmailbox_get_contact(mrmailbox_t *mailbox, uint32_t contact_id)
    Get a single contact object.
    Definition: mrmailbox.c:4517
    +
    int mrmailbox_check_password(mrmailbox_t *mailbox, const char *test_pw)
    Check if the user is authorized by the given password in some way.
    Definition: mrmailbox_imex.c:1313
    +
    void mrmailbox_marknoticed_contact(mrmailbox_t *mailbox, uint32_t contact_id)
    Mark all messages send by the given contact as noticed.
    Definition: mrmailbox.c:4565
    +
    int mrmailbox_set_config_int(mrmailbox_t *ths, const char *key, int32_t value)
    Configure the mailbox.
    Definition: mrmailbox.c:1216
    +
    int32_t mrmailbox_get_config_int(mrmailbox_t *ths, const char *key, int32_t def)
    Get a configuration option.
    Definition: mrmailbox.c:1238
    +
    int mrmailbox_set_chat_name(mrmailbox_t *mailbox, uint32_t chat_id, const char *new_name)
    Set group name.
    Definition: mrmailbox.c:3678
    +
    char * mrmailbox_get_contact_encrinfo(mrmailbox_t *mailbox, uint32_t contact_id)
    Get encryption info for a contact.
    Definition: mrmailbox.c:4682
    +
    mrarray_t * mrmailbox_get_chat_media(mrmailbox_t *mailbox, uint32_t chat_id, int msg_type, int or_msg_type)
    Returns all message IDs of the given types in a chat.
    Definition: mrmailbox.c:1865
    +
    uint32_t mrmailbox_send_audio_msg(mrmailbox_t *mailbox, uint32_t chat_id, const char *file, const char *filemime, int duration, const char *author, const char *trackname)
    Send an audio file to a chat.
    Definition: mrmailbox.c:3405
    +
    char * mrmailbox_get_config(mrmailbox_t *ths, const char *key, const char *def)
    Get a configuration option.
    Definition: mrmailbox.c:1194
    +
    char * mrmailbox_get_msg_info(mrmailbox_t *mailbox, uint32_t msg_id)
    Get an informational text for a single message.
    Definition: mrmailbox.c:5044
    An object representing a single chat in memory.
    Definition: mrchat.h:39
    diff --git a/docs/html/mrmimeparser_8h_source.html b/docs/html/mrmimeparser_8h_source.html index e71d79a9..e25b510d 100644 --- a/docs/html/mrmimeparser_8h_source.html +++ b/docs/html/mrmimeparser_8h_source.html @@ -89,7 +89,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    mrmimeparser.h
    -
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 /* Parse MIME body; this is the text part of an IMF, see https://tools.ietf.org/html/rfc5322
    24 mrmimeparser_t has no deep dependencies to mrmailbox_t or to the database
    25 (mrmailbox_t is used for logging only). */
    26 
    27 
    28 #ifndef __MRMIMEPARSER_H__
    29 #define __MRMIMEPARSER_H__
    30 #ifdef __cplusplus
    31 extern "C" {
    32 #endif
    33 
    34 
    38 typedef struct mrmimepart_t
    39 {
    41  int m_type; /*one of MR_MSG_* */
    42  int m_is_meta; /*meta parts contain eg. profile or group images and are only present if there is at least one "normal" part*/
    43  char* m_msg;
    44  char* m_msg_raw;
    45  int m_bytes;
    46  mrparam_t* m_param;
    47 } mrmimepart_t;
    48 
    49 
    53 typedef struct mrmimeparser_t
    54 {
    57  /* data, read-only, must not be free()'d (it is free()'d when the MrMimeParser object gets destructed) */
    58  carray* m_parts; /*array of mrmimepart_t objects*/
    59  struct mailmime* m_mimeroot;
    60  struct mailimf_fields* m_header; /* a pointer somewhere to the MIME data, must not be freed */
    61  char* m_subject;
    62  int m_is_send_by_messenger;
    63  int m_decrypted_and_validated;
    64  int m_decrypted_with_validation_errors;
    65  int m_decrypting_failed; /* set, if there are multipart/encrypted parts left after decryption */
    66  const char* m_blobdir;
    67 
    68  int m_is_forwarded;
    69 
    70  mrmailbox_t* m_mailbox;
    71 
    72  carray* m_reports; /* array of mailmime objects */
    73 
    74  int m_is_system_message;
    75 
    76 } mrmimeparser_t;
    77 
    78 
    79 mrmimeparser_t* mrmimeparser_new (const char* blobdir, mrmailbox_t*);
    80 void mrmimeparser_unref (mrmimeparser_t*);
    81 void mrmimeparser_empty (mrmimeparser_t*);
    82 
    83 /* The data returned from Parse() must not be freed (it is free()'d when the MrMimeParser object gets destructed)
    84 Unless memory-allocation-errors occur, Parse() returns at least one empty part.
    85 (this is because we want to add even these message to our database to avoid reading them several times.
    86 of course, these empty messages are not added to any chat) */
    87 void mrmimeparser_parse (mrmimeparser_t*, const char* body_not_terminated, size_t body_bytes);
    88 
    89 /* mrmimeparser_get_last_nonmeta() gets the _last_ part _not_ flagged with m_is_meta. */
    90 mrmimepart_t* mrmimeparser_get_last_nonmeta (mrmimeparser_t*);
    91 #define mrmimeparser_has_nonmeta(a) (mrmimeparser_get_last_nonmeta((a))!=NULL)
    92 
    93 /* mrmimeparser_is_mailinglist_message() just checks if there is a `List-ID`-header. */
    94 int mrmimeparser_is_mailinglist_message (mrmimeparser_t*);
    95 
    96 /* low-level-tools for working with mailmime structures directly */
    97 char* mr_find_first_addr (const struct mailimf_mailbox_list*); /*the result must be freed*/
    98 char* mr_normalize_addr (const char*); /*the result must be freed*/
    99 struct mailimf_fields* mr_find_mailimf_fields(struct mailmime*); /*the result is a pointer to mime, must not be freed*/
    100 struct mailimf_field* mr_find_mailimf_field (struct mailimf_fields*, int wanted_fld_type); /*the result is a pointer to mime, must not be freed*/
    101 struct mailimf_optional_field* mr_find_mailimf_field2(struct mailimf_fields*, const char* wanted_fld_name);
    102 struct mailmime_parameter* mr_find_ct_parameter (struct mailmime*, const char* name);
    103 int mr_mime_transfer_decode(struct mailmime*, const char** ret_decoded_data, size_t* ret_decoded_data_bytes, char** ret_to_mmap_string_unref);
    104 
    105 
    106 #ifdef MR_USE_MIME_DEBUG
    107 void mr_print_mime(struct mailmime * mime);
    108 #endif
    109 
    110 
    111 #ifdef __cplusplus
    112 } /* /extern "C" */
    113 #endif
    114 #endif /* __MRMIMEPARSER_H__ */
    115 
    An object representing a single mailbox.
    Definition: mrmailbox.h:189
    +
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 /* Parse MIME body; this is the text part of an IMF, see https://tools.ietf.org/html/rfc5322
    24 mrmimeparser_t has no deep dependencies to mrmailbox_t or to the database
    25 (mrmailbox_t is used for logging only). */
    26 
    27 
    28 #ifndef __MRMIMEPARSER_H__
    29 #define __MRMIMEPARSER_H__
    30 #ifdef __cplusplus
    31 extern "C" {
    32 #endif
    33 
    34 
    35 #include "mrhash.h"
    36 
    37 
    38 typedef struct mrmimepart_t
    39 {
    41  int m_type; /*one of MR_MSG_* */
    42  int m_is_meta; /*meta parts contain eg. profile or group images and are only present if there is at least one "normal" part*/
    43  char* m_msg;
    44  char* m_msg_raw;
    45  int m_bytes;
    46  mrparam_t* m_param;
    47 } mrmimepart_t;
    48 
    49 
    50 typedef struct mrmimeparser_t
    51 {
    54  /* data, read-only, must not be free()'d (it is free()'d when the mrmimeparser_t object gets destructed) */
    55  carray* m_parts; /* array of mrmimepart_t objects */
    56  struct mailmime* m_mimeroot;
    57 
    58  mrhash_t m_header; /* memoryhole-compliant header */
    59  struct mailimf_fields* m_header_root; /* must NOT be freed, do not use for query, merged into m_header, a pointer somewhere to the MIME data*/
    60  struct mailimf_fields* m_header_protected; /* MUST be freed, do not use for query, merged into m_header */
    61 
    62  char* m_subject;
    63  int m_is_send_by_messenger;
    64  int m_decrypted_and_validated;
    65  int m_decrypted_with_validation_errors;
    66  int m_decrypting_failed; /* set, if there are multipart/encrypted parts left after decryption */
    67  const char* m_blobdir;
    68 
    69  int m_is_forwarded;
    70 
    71  mrmailbox_t* m_mailbox;
    72 
    73  carray* m_reports; /* array of mailmime objects */
    74 
    75  int m_is_system_message;
    76 
    77 } mrmimeparser_t;
    78 
    79 
    80 mrmimeparser_t* mrmimeparser_new (const char* blobdir, mrmailbox_t*);
    81 void mrmimeparser_unref (mrmimeparser_t*);
    82 void mrmimeparser_empty (mrmimeparser_t*);
    83 
    84 void mrmimeparser_parse (mrmimeparser_t*, const char* body_not_terminated, size_t body_bytes);
    85 
    86 
    87 /* the following functions can be used only after a call to mrmimeparser_parse() */
    88 struct mailimf_field* mrmimeparser_lookup_field (mrmimeparser_t*, const char* field_name);
    89 struct mailimf_optional_field* mrmimeparser_lookup_optional_field (mrmimeparser_t*, const char* field_name);
    90 struct mailimf_optional_field* mrmimeparser_lookup_optional_field2 (mrmimeparser_t*, const char* field_name, const char* or_field_name);
    91 mrmimepart_t* mrmimeparser_get_last_nonmeta (mrmimeparser_t*);
    92 #define mrmimeparser_has_nonmeta(a) (mrmimeparser_get_last_nonmeta((a))!=NULL)
    93 int mrmimeparser_is_mailinglist_message (mrmimeparser_t*);
    94 
    95 
    96 
    97 /* low-level-tools for working with mailmime structures directly */
    98 #ifdef MR_USE_MIME_DEBUG
    99 void mailmime_print (struct mailmime*);
    100 #endif
    101 struct mailmime_parameter* mailmime_find_ct_parameter (struct mailmime*, const char* name);
    102 int mailmime_transfer_decode (struct mailmime*, const char** ret_decoded_data, size_t* ret_decoded_data_bytes, char** ret_to_mmap_string_unref);
    103 struct mailimf_fields* mailmime_find_mailimf_fields (struct mailmime*); /*the result is a pointer to mime, must not be freed*/
    104 char* mailimf_find_first_addr (const struct mailimf_mailbox_list*); /*the result must be freed*/
    105 struct mailimf_field* mailimf_find_field (struct mailimf_fields*, int wanted_fld_type); /*the result is a pointer to mime, must not be freed*/
    106 struct mailimf_optional_field* mailimf_find_optional_field (struct mailimf_fields*, const char* wanted_fld_name);
    107 
    108 
    109 #ifdef __cplusplus
    110 } /* /extern "C" */
    111 #endif
    112 #endif /* __MRMIMEPARSER_H__ */
    113 
    An object representing a single mailbox.
    Definition: mrmailbox.h:189
    -
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 #ifndef __MRMSG_H__
    24 #define __MRMSG_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 typedef struct mrmailbox_t mrmailbox_t;
    31 typedef struct mrparam_t mrparam_t;
    32 typedef struct sqlite3_stmt sqlite3_stmt;
    33 
    34 
    40 typedef struct mrmsg_t
    41 {
    45  uint32_t m_id;
    46  #define MR_MSG_ID_MARKER1 1
    47  #define MR_MSG_ID_DAYMARKER 9
    48  #define MR_MSG_ID_LAST_SPECIAL 9
    49 
    50 
    55  uint32_t m_from_id;
    56 
    57 
    62  uint32_t m_to_id;
    63 
    64 
    69  uint32_t m_chat_id;
    70 
    71 
    72  /*
    73  * The mailbox object the chat belongs to. Never NULL.
    74  */
    75  //mrmailbox_t* m_mailbox;
    76 
    77 
    80  int m_type;
    81  #define MR_MSG_UNDEFINED 0
    82  #define MR_MSG_TEXT 10
    83  #define MR_MSG_IMAGE 20 /* m_param may contain MRP_FILE, MRP_WIDTH, MRP_HEIGHT */
    84  #define MR_MSG_GIF 21 /* - " - */
    85  #define MR_MSG_AUDIO 40 /* m_param may contain MRP_FILE, MRP_DURATION */
    86  #define MR_MSG_VOICE 41 /* - " - */
    87  #define MR_MSG_VIDEO 50 /* m_param may contain MRP_FILE, MRP_WIDTH, MRP_HEIGHT, MRP_DURATION */
    88  #define MR_MSG_FILE 60 /* m_param may contain MRP_FILE */
    89 
    90  int m_state;
    91  #define MR_STATE_UNDEFINED 0
    92  #define MR_STATE_IN_FRESH 10
    93  #define MR_STATE_IN_NOTICED 13
    94  #define MR_STATE_IN_SEEN 16
    95  #define MR_STATE_OUT_PENDING 20
    96  #define MR_STATE_OUT_ERROR 24
    97  #define MR_STATE_OUT_DELIVERED 26 /* to check if a mail was sent, use mrmsg_is_sent() */
    98  #define MR_STATE_OUT_MDN_RCVD 28
    99 
    100  time_t m_timestamp;
    101  char* m_text;
    103  mrmailbox_t* m_mailbox;
    104  char* m_rfc724_mid;
    105  char* m_server_folder;
    106  uint32_t m_server_uid;
    107  int m_is_msgrmsg;
    108  int m_starred;
    109  mrparam_t* m_param;
    110 } mrmsg_t;
    111 
    112 
    113 mrmsg_t* mrmsg_new ();
    114 void mrmsg_unref (mrmsg_t*);
    115 void mrmsg_empty (mrmsg_t*);
    116 
    117 int mrmsg_get_type (mrmsg_t*);
    118 int mrmsg_get_state (mrmsg_t*);
    119 time_t mrmsg_get_timestamp (mrmsg_t*);
    120 char* mrmsg_get_text (mrmsg_t*);
    121 char* mrmsg_get_file (mrmsg_t*);
    122 char* mrmsg_get_filename (mrmsg_t*);
    123 char* mrmsg_get_filemime (mrmsg_t*);
    124 uint64_t mrmsg_get_filebytes (mrmsg_t*);
    126 int mrmsg_get_width (mrmsg_t*);
    131 char* mrmsg_get_summarytext (mrmsg_t*, int approx_characters);
    132 int mrmsg_is_sent (mrmsg_t*);
    137 
    139 
    140 void mrmsg_latefiling_mediasize (mrmsg_t*, int width, int height, int duration);
    141 
    142 
    143 /* library-private */
    144 #define MR_MSG_FIELDS " m.id,rfc724_mid,m.server_folder,m.server_uid,m.chat_id, m.from_id,m.to_id,m.timestamp, m.type,m.state,m.msgrmsg,m.txt, m.param,m.starred "
    145 int mrmsg_set_from_stmt__ (mrmsg_t*, sqlite3_stmt* row, int row_offset); /* row order is MR_MSG_FIELDS */
    146 int mrmsg_load_from_db__ (mrmsg_t*, mrmailbox_t*, uint32_t id);
    147 int mrmsg_is_increation__ (const mrmsg_t*);
    148 char* mrmsg_get_summarytext_by_raw (int type, const char* text, mrparam_t*, int approx_bytes); /* the returned value must be free()'d */
    149 void mrmsg_save_param_to_disk__ (mrmsg_t*);
    150 void mrmsg_guess_msgtype_from_suffix (const char* pathNfilename, int* ret_msgtype, char** ret_mime);
    151 void mrmsg_get_authorNtitle_from_filename (const char* pathNfilename, char** ret_author, char** ret_title);
    152 
    153 #define MR_MSG_NEEDS_ATTACHMENT(a) ((a)==MR_MSG_IMAGE || (a)==MR_MSG_GIF || (a)==MR_MSG_AUDIO || (a)==MR_MSG_VOICE || (a)==MR_MSG_VIDEO || (a)==MR_MSG_FILE)
    154 #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. */
    155 #define MR_MSG_MAKE_SUFFIX_SEARCHABLE(a) ((a)==MR_MSG_IMAGE || (a)==MR_MSG_GIF || (a)==MR_MSG_VOICE)
    156 
    157 #define APPROX_SUBJECT_CHARS 32 /* as we do not cut inside words, this results in about 32-42 characters.
    158  Do not use too long subjects - we add a tag after the subject which gets truncated by the clients otherwise.
    159  It should also be very clear, the subject is _not_ the whole message.
    160  The value is also used for CC:-summaries */
    161 
    162 
    163 #ifdef __cplusplus
    164 } /* /extern "C" */
    165 #endif
    166 #endif /* __MRMSG_H__ */
    An object representing a single mailbox.
    Definition: mrmailbox.h:189
    +
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 #ifndef __MRMSG_H__
    24 #define __MRMSG_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 typedef struct mrmailbox_t mrmailbox_t;
    31 typedef struct mrparam_t mrparam_t;
    32 typedef struct sqlite3_stmt sqlite3_stmt;
    33 
    34 
    40 typedef struct mrmsg_t
    41 {
    45  uint32_t m_id;
    46  #define MR_MSG_ID_MARKER1 1
    47  #define MR_MSG_ID_DAYMARKER 9
    48  #define MR_MSG_ID_LAST_SPECIAL 9
    49 
    50 
    55  uint32_t m_from_id;
    56 
    57 
    62  uint32_t m_to_id;
    63 
    64 
    69  uint32_t m_chat_id;
    70 
    71 
    72  /*
    73  * The mailbox object the chat belongs to. Never NULL.
    74  */
    75  //mrmailbox_t* m_mailbox;
    76 
    77 
    80  int m_type;
    81  #define MR_MSG_UNDEFINED 0
    82  #define MR_MSG_TEXT 10
    83  #define MR_MSG_IMAGE 20 /* m_param may contain MRP_FILE, MRP_WIDTH, MRP_HEIGHT */
    84  #define MR_MSG_GIF 21 /* - " - */
    85  #define MR_MSG_AUDIO 40 /* m_param may contain MRP_FILE, MRP_DURATION */
    86  #define MR_MSG_VOICE 41 /* - " - */
    87  #define MR_MSG_VIDEO 50 /* m_param may contain MRP_FILE, MRP_WIDTH, MRP_HEIGHT, MRP_DURATION */
    88  #define MR_MSG_FILE 60 /* m_param may contain MRP_FILE */
    89 
    90  int m_state;
    91  #define MR_STATE_UNDEFINED 0
    92  #define MR_STATE_IN_FRESH 10
    93  #define MR_STATE_IN_NOTICED 13
    94  #define MR_STATE_IN_SEEN 16
    95  #define MR_STATE_OUT_PENDING 20
    96  #define MR_STATE_OUT_ERROR 24
    97  #define MR_STATE_OUT_DELIVERED 26 /* to check if a mail was sent, use mrmsg_is_sent() */
    98  #define MR_STATE_OUT_MDN_RCVD 28
    99 
    100  time_t m_timestamp;
    101  char* m_text;
    103  mrmailbox_t* m_mailbox;
    104  char* m_rfc724_mid;
    105  char* m_server_folder;
    106  uint32_t m_server_uid;
    107  int m_is_msgrmsg;
    108  int m_starred;
    109  mrparam_t* m_param;
    110 } mrmsg_t;
    111 
    112 
    113 mrmsg_t* mrmsg_new ();
    114 void mrmsg_unref (mrmsg_t*);
    115 void mrmsg_empty (mrmsg_t*);
    116 
    117 int mrmsg_get_type (mrmsg_t*);
    118 int mrmsg_get_state (mrmsg_t*);
    119 time_t mrmsg_get_timestamp (mrmsg_t*);
    120 char* mrmsg_get_text (mrmsg_t*);
    121 char* mrmsg_get_file (mrmsg_t*);
    122 char* mrmsg_get_filename (mrmsg_t*);
    123 char* mrmsg_get_filemime (mrmsg_t*);
    124 uint64_t mrmsg_get_filebytes (mrmsg_t*);
    126 int mrmsg_get_width (mrmsg_t*);
    131 char* mrmsg_get_summarytext (mrmsg_t*, int approx_characters);
    132 int mrmsg_is_sent (mrmsg_t*);
    137 
    140 
    141 void mrmsg_latefiling_mediasize (mrmsg_t*, int width, int height, int duration);
    142 
    143 
    144 /* library-private */
    145 #define MR_MSG_FIELDS " m.id,rfc724_mid,m.server_folder,m.server_uid,m.chat_id, m.from_id,m.to_id,m.timestamp, m.type,m.state,m.msgrmsg,m.txt, m.param,m.starred "
    146 int mrmsg_set_from_stmt__ (mrmsg_t*, sqlite3_stmt* row, int row_offset); /* row order is MR_MSG_FIELDS */
    147 int mrmsg_load_from_db__ (mrmsg_t*, mrmailbox_t*, uint32_t id);
    148 int mrmsg_is_increation__ (const mrmsg_t*);
    149 char* mrmsg_get_summarytext_by_raw (int type, const char* text, mrparam_t*, int approx_bytes); /* the returned value must be free()'d */
    150 void mrmsg_save_param_to_disk__ (mrmsg_t*);
    151 void mrmsg_guess_msgtype_from_suffix (const char* pathNfilename, int* ret_msgtype, char** ret_mime);
    152 void mrmsg_get_authorNtitle_from_filename (const char* pathNfilename, char** ret_author, char** ret_title);
    153 
    154 #define MR_MSG_NEEDS_ATTACHMENT(a) ((a)==MR_MSG_IMAGE || (a)==MR_MSG_GIF || (a)==MR_MSG_AUDIO || (a)==MR_MSG_VOICE || (a)==MR_MSG_VIDEO || (a)==MR_MSG_FILE)
    155 #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. */
    156 #define MR_MSG_MAKE_SUFFIX_SEARCHABLE(a) ((a)==MR_MSG_IMAGE || (a)==MR_MSG_GIF || (a)==MR_MSG_VOICE)
    157 
    158 #define APPROX_SUBJECT_CHARS 32 /* as we do not cut inside words, this results in about 32-42 characters.
    159  Do not use too long subjects - we add a tag after the subject which gets truncated by the clients otherwise.
    160  It should also be very clear, the subject is _not_ the whole message.
    161  The value is also used for CC:-summaries */
    162 
    163 
    164 #ifdef __cplusplus
    165 } /* /extern "C" */
    166 #endif
    167 #endif /* __MRMSG_H__ */
    char * mrmsg_get_setupcodebegin(mrmsg_t *msg)
    Get the first characters of the setup code.
    Definition: mrmsg.c:722
    +
    An object representing a single mailbox.
    Definition: mrmailbox.h:189
    int mrmsg_is_systemcmd(mrmsg_t *msg)
    Check if the message is a system command.
    Definition: mrmsg.c:670
    int mrmsg_get_type(mrmsg_t *msg)
    Get the type of the message.
    Definition: mrmsg.c:124
    char * mrmsg_get_summarytext(mrmsg_t *msg, int approx_characters)
    Get a message summary as a single line of text.
    Definition: mrmsg.c:570
    @@ -99,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    int mrmsg_get_state(mrmsg_t *msg)
    Get the state of a message.
    Definition: mrmsg.c:162
    mrlot_t * mrmsg_get_mediainfo(mrmsg_t *msg)
    Get real author and title.
    Definition: mrmsg.c:359
    An object representing a single message in memory.
    Definition: mrmsg.h:40
    -
    void mrmsg_latefiling_mediasize(mrmsg_t *msg, int width, int height, int duration)
    Late filing information to a message.
    Definition: mrmsg.c:996
    +
    void mrmsg_latefiling_mediasize(mrmsg_t *msg, int width, int height, int duration)
    Late filing information to a message.
    Definition: mrmsg.c:1018
    int mrmsg_is_sent(mrmsg_t *msg)
    Check if a message was sent successfully.
    Definition: mrmsg.c:592
    mrlot_t * mrmsg_get_summary(mrmsg_t *msg, mrchat_t *chat)
    Get a summary for a message.
    Definition: mrmsg.c:528
    uint32_t m_to_id
    Contact ID of the recipient.
    Definition: mrmsg.h:62
    @@ -108,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    int mrmsg_get_duration(mrmsg_t *msg)
    Get duration of audio or video.
    Definition: mrmsg.c:467
    int mrmsg_is_starred(mrmsg_t *msg)
    Check if a message is starred.
    Definition: mrmsg.c:615
    char * mrmsg_get_file(mrmsg_t *msg)
    Find out full path, file name and extension of the file associated with a message.
    Definition: mrmsg.c:221
    -
    int mrmsg_is_increation(mrmsg_t *msg)
    Check if a message is still in creation.
    Definition: mrmsg.c:942
    +
    int mrmsg_is_increation(mrmsg_t *msg)
    Check if a message is still in creation.
    Definition: mrmsg.c:964
    void mrmsg_unref(mrmsg_t *msg)
    Free a message object.
    Definition: mrmsg.c:66
    uint32_t m_id
    Message ID.
    Definition: mrmsg.h:45
    char * mrmsg_get_filemime(mrmsg_t *msg)
    Get mime type of the file.
    Definition: mrmsg.c:280
    diff --git a/docs/html/search/all_1.js b/docs/html/search/all_1.js index f51660dd..411e2dd2 100644 --- a/docs/html/search/all_1.js +++ b/docs/html/search/all_1.js @@ -132,6 +132,7 @@ var searchData= ['mrmsg_5fget_5ffilename',['mrmsg_get_filename',['../structmrmsg__t.html#ad0dcfc0a1e33d9a88b7381e368d7895a',1,'mrmsg_t']]], ['mrmsg_5fget_5fheight',['mrmsg_get_height',['../structmrmsg__t.html#a8600ed157b44b1089783e66ce7b33353',1,'mrmsg_t']]], ['mrmsg_5fget_5fmediainfo',['mrmsg_get_mediainfo',['../structmrmsg__t.html#a1c6dfee4004fe0e9b9f90720bad73ecb',1,'mrmsg_t']]], + ['mrmsg_5fget_5fsetupcodebegin',['mrmsg_get_setupcodebegin',['../structmrmsg__t.html#a7ef8629603b2462f890dfbbe304c8f7d',1,'mrmsg_t']]], ['mrmsg_5fget_5fshowpadlock',['mrmsg_get_showpadlock',['../structmrmsg__t.html#a7f1bd3d845bbc5face7636aed8f8afd4',1,'mrmsg_t']]], ['mrmsg_5fget_5fstate',['mrmsg_get_state',['../structmrmsg__t.html#a1f411e4be17fb5fe408a1aa74cba90a5',1,'mrmsg_t']]], ['mrmsg_5fget_5fsummary',['mrmsg_get_summary',['../structmrmsg__t.html#a3c14a8dbd6cc7f90c642223a873312e3',1,'mrmsg_t']]], diff --git a/docs/html/search/functions_0.js b/docs/html/search/functions_0.js index 2c62a741..17ba411c 100644 --- a/docs/html/search/functions_0.js +++ b/docs/html/search/functions_0.js @@ -97,6 +97,7 @@ var searchData= ['mrmsg_5fget_5ffilename',['mrmsg_get_filename',['../structmrmsg__t.html#ad0dcfc0a1e33d9a88b7381e368d7895a',1,'mrmsg_t']]], ['mrmsg_5fget_5fheight',['mrmsg_get_height',['../structmrmsg__t.html#a8600ed157b44b1089783e66ce7b33353',1,'mrmsg_t']]], ['mrmsg_5fget_5fmediainfo',['mrmsg_get_mediainfo',['../structmrmsg__t.html#a1c6dfee4004fe0e9b9f90720bad73ecb',1,'mrmsg_t']]], + ['mrmsg_5fget_5fsetupcodebegin',['mrmsg_get_setupcodebegin',['../structmrmsg__t.html#a7ef8629603b2462f890dfbbe304c8f7d',1,'mrmsg_t']]], ['mrmsg_5fget_5fshowpadlock',['mrmsg_get_showpadlock',['../structmrmsg__t.html#a7f1bd3d845bbc5face7636aed8f8afd4',1,'mrmsg_t']]], ['mrmsg_5fget_5fstate',['mrmsg_get_state',['../structmrmsg__t.html#a1f411e4be17fb5fe408a1aa74cba90a5',1,'mrmsg_t']]], ['mrmsg_5fget_5fsummary',['mrmsg_get_summary',['../structmrmsg__t.html#a3c14a8dbd6cc7f90c642223a873312e3',1,'mrmsg_t']]], diff --git a/docs/html/structmrmailbox__t.html b/docs/html/structmrmailbox__t.html index c35d4bd0..0f444bef 100644 --- a/docs/html/structmrmailbox__t.html +++ b/docs/html/structmrmailbox__t.html @@ -2833,7 +2833,7 @@ Public Attributes

    Signal an ongoing process to stop.

    After that, mrmailbox_stop_ongoing_process() returns without waiting for the ongoing process to return.

    -

    The ongoing process will return ASAP then, however, it may still take a moment. If in doubt, the caller may also decide the kill the thread after a few seconds; eg. the process may hang in a function not under the control of the core (eg. MR_EVENT_HTTP_GET). Another reason for mrmailbox_stop_ongoing_process() not to wait is that otherwise it would be GUI-blocking and should be started in another thread then; this would make things even more complicated.

    +

    The ongoing process will return ASAP then, however, it may still take a moment. If in doubt, the caller may also decide to kill the thread after a few seconds; eg. the process may hang in a function not under the control of the core (eg. MR_EVENT_HTTP_GET). Another reason for mrmailbox_stop_ongoing_process() not to wait is that otherwise it would be GUI-blocking and should be started in another thread then; this would make things even more complicated.

    Typical ongoing processes are started by mrmailbox_configure_and_connect(), mrmailbox_initiate_key_transfer() or mrmailbox_imex(). As there is always at most only one onging process at the same time, there is no need to define which process to exit.

    Parameters
    @@ -2868,11 +2868,11 @@ Public Attributes
    Returns
    The setup code. Must be free()'d after usage. On errors, eg. if the message could not be sent, NULL is returned.

    Before starting the key transfer with this function, the user should be asked:

    -
    "The 'Autocrypt Key Transfer' requires that the mail client on the other device is Autocrypt-compliant.
    You can then send the key to yourself. The key will be encrypted by a setup code which is displayed here and must be typed on the other device."

    After that, this function should be called to send the Autocrypt setup message. The required setup code is then returned in the following format:

    +
    "The 'Autocrypt Key Transfer' requires that the mail client on the other device is Autocrypt-compliant.
    You can then send your key to yourself. Your key will be encrypted by a setup code which is displayed here and must be typed on the other device."

    After that, this function should be called to send the Autocrypt setup message. The function creates the setup message and waits until it is really sent. As this may take a while, it is recommended to start the function in a separate thread; to interrupt it, you can use mrmailbox_stop_ongoing_process().

    +

    After everything succeeded, the required setup code is returned in the following format:

    1234-1234-1234-1234-1234-1234-1234-1234-1234

    The setup code should be shown to the user then:

    -
    "The key has been sent to yourself. Switch to the other device and
    open the setup message. You should be prompted for a setup code. Type
    the following digits into the prompt:
    1234 - 1234 - 1234 -
    1234 - 1234 - 1234 -
    1234 - 1234 - 1234
    Once you're done, your other device will be ready to use Autocrypt."

    On the other device you will call mrmailbox_continue_key_transfer() then for setup messages identified by mrmsg_is_setupmessage().

    -

    For more details about the Autocrypt setup process, please refer to https://autocrypt.org/en/latest/level1.html#autocrypt-setup-message

    -

    NB: If the user has never sent a message before, this function requires a key to be created. In this case, the function may take some seconds to finish and it might be a good idea to start it in a separate thread. If so, it can be interrupted using mrmailbox_stop_ongoing_process().

    +
    "Your key has been sent to yourself. Switch to the other device and
    open the setup message. You should be prompted for a setup code. Type
    the following digits into the prompt:
    1234 - 1234 - 1234 -
    1234 - 1234 - 1234 -
    1234 - 1234 - 1234
    Once you're done, your other device will be ready to use Autocrypt."

    On the other device you will call mrmailbox_continue_key_transfer() then for setup messages identified by mrmsg_is_setupmessage().

    +

    For more details about the Autocrypt setup process, please refer to https://autocrypt.org/en/latest/level1.html#autocrypt-setup-message

    @@ -2908,6 +2908,7 @@ Public Attributes

    Continue the Autocrypt Key Transfer on another device.

    If you have started the key transfer on another device using mrmailbox_initiate_key_transfer() and you've detected a setup message with mrmsg_is_setupmessage(), you should prompt the user for the setup code and call this function then.

    +

    You can use mrmsg_get_setupcodebegin() to give the user a hint about the code (useful if the user has created several messages and should not enter the wrong code).

    Parameters
    diff --git a/docs/html/structmrmsg__t-members.html b/docs/html/structmrmsg__t-members.html index 01536c5c..946291de 100644 --- a/docs/html/structmrmsg__t-members.html +++ b/docs/html/structmrmsg__t-members.html @@ -99,22 +99,23 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +
    mailboxThe mailbox object.
    mrmsg_get_filename(mrmsg_t *msg)mrmsg_t
    mrmsg_get_height(mrmsg_t *msg)mrmsg_t
    mrmsg_get_mediainfo(mrmsg_t *msg)mrmsg_t
    mrmsg_get_showpadlock(mrmsg_t *msg)mrmsg_t
    mrmsg_get_state(mrmsg_t *msg)mrmsg_t
    mrmsg_get_summary(mrmsg_t *msg, mrchat_t *chat)mrmsg_t
    mrmsg_get_summarytext(mrmsg_t *msg, int approx_characters)mrmsg_t
    mrmsg_get_text(mrmsg_t *msg)mrmsg_t
    mrmsg_get_timestamp(mrmsg_t *msg)mrmsg_t
    mrmsg_get_type(mrmsg_t *msg)mrmsg_t
    mrmsg_get_width(mrmsg_t *msg)mrmsg_t
    mrmsg_is_forwarded(mrmsg_t *msg)mrmsg_t
    mrmsg_is_increation(mrmsg_t *msg)mrmsg_t
    mrmsg_is_sent(mrmsg_t *msg)mrmsg_t
    mrmsg_is_setupmessage(mrmsg_t *msg)mrmsg_t
    mrmsg_is_starred(mrmsg_t *msg)mrmsg_t
    mrmsg_is_systemcmd(mrmsg_t *msg)mrmsg_t
    mrmsg_latefiling_mediasize(mrmsg_t *msg, int width, int height, int duration)mrmsg_t
    mrmsg_unref(mrmsg_t *msg)mrmsg_t
    mrmsg_get_setupcodebegin(mrmsg_t *msg)mrmsg_t
    mrmsg_get_showpadlock(mrmsg_t *msg)mrmsg_t
    mrmsg_get_state(mrmsg_t *msg)mrmsg_t
    mrmsg_get_summary(mrmsg_t *msg, mrchat_t *chat)mrmsg_t
    mrmsg_get_summarytext(mrmsg_t *msg, int approx_characters)mrmsg_t
    mrmsg_get_text(mrmsg_t *msg)mrmsg_t
    mrmsg_get_timestamp(mrmsg_t *msg)mrmsg_t
    mrmsg_get_type(mrmsg_t *msg)mrmsg_t
    mrmsg_get_width(mrmsg_t *msg)mrmsg_t
    mrmsg_is_forwarded(mrmsg_t *msg)mrmsg_t
    mrmsg_is_increation(mrmsg_t *msg)mrmsg_t
    mrmsg_is_sent(mrmsg_t *msg)mrmsg_t
    mrmsg_is_setupmessage(mrmsg_t *msg)mrmsg_t
    mrmsg_is_starred(mrmsg_t *msg)mrmsg_t
    mrmsg_is_systemcmd(mrmsg_t *msg)mrmsg_t
    mrmsg_latefiling_mediasize(mrmsg_t *msg, int width, int height, int duration)mrmsg_t
    mrmsg_unref(mrmsg_t *msg)mrmsg_t
    +
    + +
    +
    + + + + + + + + +
    char * mrmsg_get_setupcodebegin (mrmsg_tmsg)
    +
    + +

    Get the first characters of the setup code.

    +

    Typically, this is used to pre-fill the first entry field of the setup code. If the user has several setup messages, he can be sure typing in the correct digits.

    +

    To check, if a message is a setup message, use mrmsg_is_setupmessage(). To decrypt a secret key from a setup message, use mrmailbox_continue_key_transfer().

    +
    Parameters
    + + +
    msgThe message object.
    +
    +
    +
    Returns
    Typically, the first two digits of the setup code or an empty string if unknown. NULL is never returned. Must be free()'d when done.
    +