diff --git a/docs/html/functions.html b/docs/html/functions.html index b3e48b20..39c2c304 100644 --- a/docs/html/functions.html +++ b/docs/html/functions.html @@ -409,15 +409,33 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • mrmsg_empty() : mrmsg_t
  • +
  • mrmsg_get_file() +: mrmsg_t +
  • mrmsg_get_mediainfo() : mrmsg_t
  • +
  • mrmsg_get_showpadlock() +: mrmsg_t +
  • +
  • mrmsg_get_state() +: mrmsg_t +
  • mrmsg_get_summary() : mrmsg_t
  • mrmsg_get_summarytext() : mrmsg_t
  • +
  • mrmsg_get_text() +: mrmsg_t +
  • +
  • mrmsg_get_type() +: mrmsg_t +
  • +
  • mrmsg_is_increation() +: mrmsg_t +
  • mrmsg_new() : mrmsg_t
  • @@ -433,9 +451,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • mrmsg_set_type() : mrmsg_t
  • -
  • mrmsg_show_padlock() -: mrmsg_t -
  • mrmsg_unref() : mrmsg_t
  • diff --git a/docs/html/functions_func.html b/docs/html/functions_func.html index 2494af73..a89b1d7e 100644 --- a/docs/html/functions_func.html +++ b/docs/html/functions_func.html @@ -322,15 +322,33 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • mrmsg_empty() : mrmsg_t
  • +
  • mrmsg_get_file() +: mrmsg_t +
  • mrmsg_get_mediainfo() : mrmsg_t
  • +
  • mrmsg_get_showpadlock() +: mrmsg_t +
  • +
  • mrmsg_get_state() +: mrmsg_t +
  • mrmsg_get_summary() : mrmsg_t
  • mrmsg_get_summarytext() : mrmsg_t
  • +
  • mrmsg_get_text() +: mrmsg_t +
  • +
  • mrmsg_get_type() +: mrmsg_t +
  • +
  • mrmsg_is_increation() +: mrmsg_t +
  • mrmsg_new() : mrmsg_t
  • @@ -346,9 +364,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • mrmsg_set_type() : mrmsg_t
  • -
  • mrmsg_show_padlock() -: mrmsg_t -
  • mrmsg_unref() : mrmsg_t
  • diff --git a/docs/html/mrchat_8h_source.html b/docs/html/mrchat_8h_source.html index f56624be..17628818 100644 --- a/docs/html/mrchat_8h_source.html +++ b/docs/html/mrchat_8h_source.html @@ -89,7 +89,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    mrchat.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 __MRCHAT_H__
    24 #define __MRCHAT_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 
    33 
    39 typedef struct mrchat_t
    40 {
    51  uint32_t m_id;
    52  #define MR_CHAT_ID_DEADDROP 1
    53  #define MR_CHAT_ID_TO_DEADDROP 2 /* messages send from us to unknown/unwanted users (this may happen when deleting chats or when using CC: in the email-program) */
    54  #define MR_CHAT_ID_TRASH 3 /* messages that should be deleted get this chat_id; the messages are deleted from the working thread later then. This is also needed as rfc724_mid should be preset as long as the message is not deleted on the server (otherwise it is downloaded again) */
    55  #define MR_CHAT_ID_MSGS_IN_CREATION 4 /* a message is just in creation but not yet assigned to a chat (eg. we may need the message ID to set up blobs; this avoids unready message to be send and shown) */
    56  #define MR_CHAT_ID_STARRED 5
    57  #define MR_CHAT_ID_ARCHIVED_LINK 6
    58  #define MR_CHAT_ID_LAST_SPECIAL 9 /* larger chat IDs are "real" chats, their messages are "real" messages. */
    59 
    60 
    69  int m_type;
    70  #define MR_CHAT_TYPE_UNDEFINED 0
    71  #define MR_CHAT_TYPE_NORMAL 100
    72  #define MR_CHAT_TYPE_GROUP 120
    73 
    74 
    86  char* m_name;
    87 
    97 
    107 
    112 
    127 
    134 
    136  char* m_grpid; /* NULL if unset */
    137 } mrchat_t;
    138 
    139 
    140 mrchat_t* mrchat_new (mrmailbox_t*);
    141 void mrchat_empty (mrchat_t*);
    142 void mrchat_unref (mrchat_t*);
    144 
    145 /* library-internal */
    146 int mrchat_load_from_db__ (mrchat_t*, uint32_t id);
    147 int mrchat_update_param__ (mrchat_t*);
    148 
    149 #define MR_CHAT_PREFIX "Chat:" /* you MUST NOT modify this or the following strings */
    150 #define MR_CHATS_FOLDER "Chats" /* if we want to support Gma'l-labels - "Chats" is a reserved word for Gma'l */
    151 
    152 
    153 #ifdef __cplusplus
    154 } /* /extern "C" */
    155 #endif
    156 #endif /* __MRCHAT_H__ */
    int m_type
    Chat type.
    Definition: mrchat.h:69
    +
    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 __MRCHAT_H__
    24 #define __MRCHAT_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 
    33 
    39 typedef struct mrchat_t
    40 {
    51  uint32_t m_id;
    52  #define MR_CHAT_ID_DEADDROP 1
    53  #define MR_CHAT_ID_TO_DEADDROP 2 /* messages send from us to unknown/unwanted users (this may happen when deleting chats or when using CC: in the email-program) */
    54  #define MR_CHAT_ID_TRASH 3 /* messages that should be deleted get this chat_id; the messages are deleted from the working thread later then. This is also needed as rfc724_mid should be preset as long as the message is not deleted on the server (otherwise it is downloaded again) */
    55  #define MR_CHAT_ID_MSGS_IN_CREATION 4 /* a message is just in creation but not yet assigned to a chat (eg. we may need the message ID to set up blobs; this avoids unready message to be send and shown) */
    56  #define MR_CHAT_ID_STARRED 5
    57  #define MR_CHAT_ID_ARCHIVED_LINK 6
    58  #define MR_CHAT_ID_LAST_SPECIAL 9 /* larger chat IDs are "real" chats, their messages are "real" messages. */
    59 
    60 
    69  int m_type;
    70  #define MR_CHAT_TYPE_UNDEFINED 0
    71  #define MR_CHAT_TYPE_NORMAL 100
    72  #define MR_CHAT_TYPE_GROUP 120
    73 
    74 
    86  char* m_name;
    87 
    97 
    107 
    112 
    127 
    134 
    136  char* m_grpid; /* NULL if unset */
    137 } mrchat_t;
    138 
    139 
    140 mrchat_t* mrchat_new (mrmailbox_t*);
    141 void mrchat_empty (mrchat_t*);
    142 void mrchat_unref (mrchat_t*);
    143 
    145 
    146 /* library-internal */
    147 int mrchat_load_from_db__ (mrchat_t*, uint32_t id);
    148 int mrchat_update_param__ (mrchat_t*);
    149 
    150 #define MR_CHAT_PREFIX "Chat:" /* you MUST NOT modify this or the following strings */
    151 #define MR_CHATS_FOLDER "Chats" /* if we want to support Gma'l-labels - "Chats" is a reserved word for Gma'l */
    152 
    153 
    154 #ifdef __cplusplus
    155 } /* /extern "C" */
    156 #endif
    157 #endif /* __MRCHAT_H__ */
    int m_type
    Chat type.
    Definition: mrchat.h:69
    An object representing a single mailbox.
    Definition: mrmailbox.h:184
    void mrchat_unref(mrchat_t *chat)
    Free a chat object.
    Definition: mrchat.c:65
    char * m_draft_text
    The draft text.
    Definition: mrchat.h:106
    diff --git a/docs/html/mrmailbox_8h_source.html b/docs/html/mrmailbox_8h_source.html index d54d39ee..477bc110 100644 --- a/docs/html/mrmailbox_8h_source.html +++ b/docs/html/mrmailbox_8h_source.html @@ -89,43 +89,43 @@ 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 9
    32 #define MR_VERSION_REVISION 10
    33 
    34 
    140 #include <pthread.h>
    141 #include <libetpan/libetpan.h> /* defines uint16_t */
    142 #include "mrarray.h"
    143 #include "mrchatlist.h"
    144 #include "mrchat.h"
    145 #include "mrmsg.h"
    146 #include "mrcontact.h"
    147 #include "mrpoortext.h"
    148 #include "mrparam.h"
    149 #include "mrevent.h"
    150 
    151 typedef struct mrmailbox_t mrmailbox_t;
    152 typedef struct mrimap_t mrimap_t;
    153 typedef struct mrsmtp_t mrsmtp_t;
    154 typedef struct mrsqlite3_t mrsqlite3_t;
    155 typedef struct mrjob_t mrjob_t;
    156 typedef struct mrmimeparser_t mrmimeparser_t;
    157 
    158 
    174 typedef uintptr_t (*mrmailboxcb_t) (mrmailbox_t*, int event, uintptr_t data1, uintptr_t data2);
    175 
    176 
    184 typedef struct mrmailbox_t
    185 {
    186  void* m_userdata;
    187  char* m_dbfile;
    188  char* m_blobdir;
    191  mrsqlite3_t* m_sql;
    192  mrimap_t* m_imap;
    193  mrsmtp_t* m_smtp;
    195  pthread_t m_job_thread;
    196  pthread_cond_t m_job_cond;
    197  pthread_mutex_t m_job_condmutex;
    198  int m_job_condflag;
    199  int m_job_do_exit;
    201  mrmailboxcb_t m_cb;
    203  char* m_os_name;
    205  uint32_t m_cmdline_sel_chat_id;
    207  int m_wake_lock;
    208  pthread_mutex_t m_wake_lock_critical;
    210  int m_e2ee_enabled;
    212  #define MR_LOG_RINGBUF_SIZE 200
    213  pthread_mutex_t m_log_ringbuf_critical;
    214  char* m_log_ringbuf[MR_LOG_RINGBUF_SIZE];
    216  time_t m_log_ringbuf_times[MR_LOG_RINGBUF_SIZE];
    218  int m_log_ringbuf_pos;
    220 } mrmailbox_t;
    221 
    222 
    223 /* create/open/connect */
    224 mrmailbox_t* mrmailbox_new (mrmailboxcb_t, void* userdata, const char* os_name);
    225 void mrmailbox_unref (mrmailbox_t*);
    226 
    227 int mrmailbox_open (mrmailbox_t*, const char* dbfile, const char* blobdir);
    228 void mrmailbox_close (mrmailbox_t*);
    229 int mrmailbox_is_open (const mrmailbox_t*);
    230 
    231 int mrmailbox_set_config (mrmailbox_t*, const char* key, const char* value);
    232 char* mrmailbox_get_config (mrmailbox_t*, const char* key, const char* def);
    233 int mrmailbox_set_config_int (mrmailbox_t*, const char* key, int32_t value);
    234 int32_t mrmailbox_get_config_int (mrmailbox_t*, const char* key, int32_t def);
    235 char* mrmailbox_get_version_str (void);
    236 
    237 int mrmailbox_configure_and_connect(mrmailbox_t*);
    238 void mrmailbox_configure_cancel (mrmailbox_t*);
    239 int mrmailbox_is_configured (mrmailbox_t*);
    240 
    241 void mrmailbox_connect (mrmailbox_t*);
    242 void mrmailbox_disconnect (mrmailbox_t*);
    243 
    244 char* mrmailbox_get_info (mrmailbox_t*);
    245 
    246 
    247 /* Handle chatlists */
    248 #define MR_GCL_ARCHIVED_ONLY 0x01
    249 #define MR_GCL_NO_SPECIALS 0x02
    250 mrchatlist_t* mrmailbox_get_chatlist (mrmailbox_t*, int flags, const char* query);
    251 
    252 
    253 /* Handle chats */
    254 uint32_t mrmailbox_create_chat_by_contact_id (mrmailbox_t*, uint32_t contact_id);
    255 uint32_t mrmailbox_get_chat_id_by_contact_id (mrmailbox_t*, uint32_t contact_id);
    256 
    257 uint32_t mrmailbox_send_text_msg (mrmailbox_t*, uint32_t chat_id, const char* text_to_send);
    258 uint32_t mrmailbox_send_msg (mrmailbox_t*, uint32_t chat_id, mrmsg_t*);
    259 void mrmailbox_set_draft (mrmailbox_t*, uint32_t chat_id, const char*);
    260 
    261 #define MR_GCM_ADDDAYMARKER 0x01
    262 mrarray_t* mrmailbox_get_chat_msgs (mrmailbox_t*, uint32_t chat_id, uint32_t flags, uint32_t marker1before);
    263 int mrmailbox_get_total_msg_count (mrmailbox_t*, uint32_t chat_id);
    264 int mrmailbox_get_fresh_msg_count (mrmailbox_t*, uint32_t chat_id);
    265 mrarray_t* mrmailbox_get_fresh_msgs (mrmailbox_t*);
    266 void mrmailbox_marknoticed_chat (mrmailbox_t*, uint32_t chat_id);
    267 mrarray_t* mrmailbox_get_chat_media (mrmailbox_t*, uint32_t chat_id, int msg_type, int or_msg_type);
    268 uint32_t mrmailbox_get_next_media (mrmailbox_t*, uint32_t curr_msg_id, int dir);
    269 
    270 void mrmailbox_archive_chat (mrmailbox_t*, uint32_t chat_id, int archive);
    271 void mrmailbox_delete_chat (mrmailbox_t*, uint32_t chat_id);
    272 
    273 mrarray_t* mrmailbox_get_chat_contacts (mrmailbox_t*, uint32_t chat_id);
    274 mrarray_t* mrmailbox_search_msgs (mrmailbox_t*, uint32_t chat_id, const char* query);
    275 
    276 mrchat_t* mrmailbox_get_chat (mrmailbox_t*, uint32_t chat_id);
    277 
    278 
    279 /* Handle group chats */
    280 uint32_t mrmailbox_create_group_chat (mrmailbox_t*, const char* name);
    281 int mrmailbox_is_contact_in_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    282 int mrmailbox_add_contact_to_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    283 int mrmailbox_remove_contact_from_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    284 int mrmailbox_set_chat_name (mrmailbox_t*, uint32_t chat_id, const char* name);
    285 int mrmailbox_set_chat_image (mrmailbox_t*, uint32_t chat_id, const char* image);
    286 
    287 
    288 /* Handle messages */
    289 char* mrmailbox_get_msg_info (mrmailbox_t*, uint32_t msg_id);
    290 void mrmailbox_delete_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt);
    291 void mrmailbox_forward_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt, uint32_t chat_id);
    292 void mrmailbox_marknoticed_contact (mrmailbox_t*, uint32_t contact_id);
    293 void mrmailbox_markseen_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt);
    294 void mrmailbox_star_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt, int star);
    295 mrmsg_t* mrmailbox_get_msg (mrmailbox_t*, uint32_t msg_id);
    296 
    297 
    298 /* Handle contacts */
    299 uint32_t mrmailbox_create_contact (mrmailbox_t*, const char* name, const char* addr);
    300 int mrmailbox_add_address_book (mrmailbox_t*, const char*);
    301 mrarray_t* mrmailbox_get_known_contacts (mrmailbox_t*, const char* query);
    302 int mrmailbox_get_blocked_count (mrmailbox_t*);
    304 void mrmailbox_block_contact (mrmailbox_t*, uint32_t contact_id, int block);
    305 char* mrmailbox_get_contact_encrinfo (mrmailbox_t*, uint32_t contact_id);
    306 int mrmailbox_delete_contact (mrmailbox_t*, uint32_t contact_id);
    307 mrcontact_t* mrmailbox_get_contact (mrmailbox_t*, uint32_t contact_id);
    308 
    309 
    310 /* Import/export and Tools */
    311 #define MR_IMEX_CANCEL 0
    312 #define MR_IMEX_EXPORT_SELF_KEYS 1 /* param1 is a directory where the keys are written to */
    313 #define MR_IMEX_IMPORT_SELF_KEYS 2 /* param1 is a directory where the keys are searched in and read from */
    314 #define MR_IMEX_EXPORT_BACKUP 11 /* param1 is a directory where the backup is written to */
    315 #define MR_IMEX_IMPORT_BACKUP 12 /* param1 is the file with the backup to import */
    316 #define MR_IMEX_EXPORT_SETUP_MESSAGE 20 /* param1 is a directory where the setup file is written to */
    317 #define MR_BAK_PREFIX "delta-chat"
    318 #define MR_BAK_SUFFIX "bak"
    319 void mrmailbox_imex (mrmailbox_t*, int what, const char* param1, const char* setup_code);
    320 char* mrmailbox_imex_has_backup (mrmailbox_t*, const char* dir);
    321 int mrmailbox_check_password (mrmailbox_t*, const char* pw);
    322 char* mrmailbox_create_setup_code (mrmailbox_t*);
    323 void mrmailbox_heartbeat (mrmailbox_t*);
    324 
    325 
    326 /* logging */
    327 void mrmailbox_log_error (mrmailbox_t*, int code, const char* msg, ...);
    328 void mrmailbox_log_error_if (int* condition, mrmailbox_t*, int code, const char* msg, ...);
    329 void mrmailbox_log_warning (mrmailbox_t*, int code, const char* msg, ...);
    330 void mrmailbox_log_info (mrmailbox_t*, int code, const char* msg, ...);
    331 void mrmailbox_log_vprintf (mrmailbox_t*, int event, int code, const char* msg, va_list);
    332 int mrmailbox_get_thread_index (void);
    333 
    334 
    335 /* error codes */
    336 #define MR_ERR_SELF_NOT_IN_GROUP 1
    337 #define MR_ERR_NONETWORK 2
    338 
    339 
    340 /* deprecated functions */
    341 int mrchat_set_draft (mrchat_t*, const char* msg); /* deprecated - use mrmailbox_set_draft() instead */
    342 
    343 
    344 /* library-internal */
    345 uint32_t mrmailbox_send_msg_i__ (mrmailbox_t*, mrchat_t*, const mrmsg_t*, time_t);
    346 void mrmailbox_connect_to_imap (mrmailbox_t*, mrjob_t*);
    347 void mrmailbox_wake_lock (mrmailbox_t*);
    348 void mrmailbox_wake_unlock (mrmailbox_t*);
    349 int mrmailbox_poke_eml_file (mrmailbox_t*, const char* file);
    350 int mrmailbox_is_reply_to_known_message__ (mrmailbox_t*, mrmimeparser_t*);
    351 int mrmailbox_is_reply_to_messenger_message__ (mrmailbox_t*, mrmimeparser_t*);
    352 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);
    353 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);
    354 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);
    355 int mrmailbox_get_archived_count__ (mrmailbox_t*);
    356 int mrmailbox_reset_tables (mrmailbox_t*, int bits); /* reset tables but leaves server configuration, 1=jobs, 2=e2ee, 8=rest but server config */
    357 size_t mrmailbox_get_real_contact_cnt__ (mrmailbox_t*);
    358 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);
    359 int mrmailbox_get_contact_origin__ (mrmailbox_t*, uint32_t id, int* ret_blocked);
    360 int mrmailbox_is_contact_blocked__ (mrmailbox_t*, uint32_t id);
    361 int mrmailbox_real_contact_exists__ (mrmailbox_t*, uint32_t id);
    362 int mrmailbox_contact_addr_equals__ (mrmailbox_t*, uint32_t contact_id, const char* other_addr);
    363 void mrmailbox_scaleup_contact_origin__ (mrmailbox_t*, uint32_t contact_id, int origin);
    364 void mrmailbox_unarchive_chat__ (mrmailbox_t*, uint32_t chat_id);
    365 size_t mrmailbox_get_chat_cnt__ (mrmailbox_t*);
    366 uint32_t mrmailbox_create_or_lookup_nchat_by_contact_id__ (mrmailbox_t*, uint32_t contact_id);
    367 uint32_t mrmailbox_lookup_real_nchat_by_contact_id__ (mrmailbox_t*, uint32_t contact_id);
    368 int mrmailbox_get_total_msg_count__ (mrmailbox_t*, uint32_t chat_id);
    369 int mrmailbox_get_fresh_msg_count__ (mrmailbox_t*, uint32_t chat_id);
    370 uint32_t mrmailbox_get_last_deaddrop_fresh_msg__ (mrmailbox_t*);
    371 void mrmailbox_send_msg_to_smtp (mrmailbox_t*, mrjob_t*);
    372 void mrmailbox_send_msg_to_imap (mrmailbox_t*, mrjob_t*);
    373 int mrmailbox_add_contact_to_chat__ (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    374 int mrmailbox_is_contact_in_chat__ (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    375 int mrmailbox_get_chat_contact_count__ (mrmailbox_t*, uint32_t chat_id);
    376 int mrmailbox_group_explicitly_left__ (mrmailbox_t*, const char* grpid);
    377 void mrmailbox_set_group_explicitly_left__ (mrmailbox_t*, const char* grpid);
    378 size_t mrmailbox_get_real_msg_cnt__ (mrmailbox_t*); /* the number of messages assigned to real chat (!=deaddrop, !=trash) */
    379 size_t mrmailbox_get_deaddrop_msg_cnt__ (mrmailbox_t*);
    380 int mrmailbox_rfc724_mid_cnt__ (mrmailbox_t*, const char* rfc724_mid);
    381 int mrmailbox_rfc724_mid_exists__ (mrmailbox_t*, const char* rfc724_mid, char** ret_server_folder, uint32_t* ret_server_uid);
    382 void mrmailbox_update_server_uid__ (mrmailbox_t*, const char* rfc724_mid, const char* server_folder, uint32_t server_uid);
    383 void mrmailbox_update_msg_chat_id__ (mrmailbox_t*, uint32_t msg_id, uint32_t chat_id);
    384 void mrmailbox_update_msg_state__ (mrmailbox_t*, uint32_t msg_id, int state);
    385 void mrmailbox_delete_msg_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    386 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 */
    387 void mrmailbox_send_mdn (mrmailbox_t*, mrjob_t* job);
    388 void mrmailbox_markseen_msg_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    389 void mrmailbox_markseen_mdn_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    390 
    391 
    392 /* library private: end-to-end-encryption */
    393 #define MR_E2EE_DEFAULT_ENABLED 1
    394 #define MR_MDNS_DEFAULT_ENABLED 1
    395 
    396 typedef struct mrmailbox_e2ee_helper_t {
    397  int m_encryption_successfull;
    398  void* m_cdata_to_free;
    399 } mrmailbox_e2ee_helper_t;
    400 
    401 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*);
    402 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 */
    403 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! */
    404 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 */
    405 
    406 
    407 #ifdef __cplusplus
    408 } /* /extern "C" */
    409 #endif
    410 #endif /* __MRMAILBOX_H__ */
    int mrmailbox_add_address_book(mrmailbox_t *mailbox, const char *adr_book)
    Add a number of contacts.
    Definition: mrmailbox.c:4041
    -
    uint32_t mrmailbox_create_group_chat(mrmailbox_t *mailbox, const char *chat_name)
    Create a new group chat.
    Definition: mrmailbox.c:3343
    -
    uint32_t mrmailbox_create_contact(mrmailbox_t *mailbox, const char *name, const char *addr)
    Add a single contact.
    Definition: mrmailbox.c:4001
    -
    uint32_t mrmailbox_send_text_msg(mrmailbox_t *mailbox, uint32_t chat_id, const char *text_to_send)
    Send a simple text message to the given chat.
    Definition: mrmailbox.c:3091
    +
    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 9
    32 #define MR_VERSION_REVISION 10
    33 
    34 
    140 #include <pthread.h>
    141 #include <libetpan/libetpan.h> /* defines uint16_t */
    142 #include "mrarray.h"
    143 #include "mrchatlist.h"
    144 #include "mrchat.h"
    145 #include "mrmsg.h"
    146 #include "mrcontact.h"
    147 #include "mrpoortext.h"
    148 #include "mrparam.h"
    149 #include "mrevent.h"
    150 
    151 typedef struct mrmailbox_t mrmailbox_t;
    152 typedef struct mrimap_t mrimap_t;
    153 typedef struct mrsmtp_t mrsmtp_t;
    154 typedef struct mrsqlite3_t mrsqlite3_t;
    155 typedef struct mrjob_t mrjob_t;
    156 typedef struct mrmimeparser_t mrmimeparser_t;
    157 
    158 
    174 typedef uintptr_t (*mrmailboxcb_t) (mrmailbox_t*, int event, uintptr_t data1, uintptr_t data2);
    175 
    176 
    184 typedef struct mrmailbox_t
    185 {
    186  void* m_userdata;
    187  char* m_dbfile;
    188  char* m_blobdir;
    191  mrsqlite3_t* m_sql;
    192  mrimap_t* m_imap;
    193  mrsmtp_t* m_smtp;
    195  pthread_t m_job_thread;
    196  pthread_cond_t m_job_cond;
    197  pthread_mutex_t m_job_condmutex;
    198  int m_job_condflag;
    199  int m_job_do_exit;
    201  mrmailboxcb_t m_cb;
    203  char* m_os_name;
    205  uint32_t m_cmdline_sel_chat_id;
    207  int m_wake_lock;
    208  pthread_mutex_t m_wake_lock_critical;
    210  int m_e2ee_enabled;
    212  #define MR_LOG_RINGBUF_SIZE 200
    213  pthread_mutex_t m_log_ringbuf_critical;
    214  char* m_log_ringbuf[MR_LOG_RINGBUF_SIZE];
    216  time_t m_log_ringbuf_times[MR_LOG_RINGBUF_SIZE];
    218  int m_log_ringbuf_pos;
    220 } mrmailbox_t;
    221 
    222 
    223 /* create/open/connect */
    224 mrmailbox_t* mrmailbox_new (mrmailboxcb_t, void* userdata, const char* os_name);
    225 void mrmailbox_unref (mrmailbox_t*);
    226 
    227 int mrmailbox_open (mrmailbox_t*, const char* dbfile, const char* blobdir);
    228 void mrmailbox_close (mrmailbox_t*);
    229 int mrmailbox_is_open (const mrmailbox_t*);
    230 
    231 int mrmailbox_set_config (mrmailbox_t*, const char* key, const char* value);
    232 char* mrmailbox_get_config (mrmailbox_t*, const char* key, const char* def);
    233 int mrmailbox_set_config_int (mrmailbox_t*, const char* key, int32_t value);
    234 int32_t mrmailbox_get_config_int (mrmailbox_t*, const char* key, int32_t def);
    235 char* mrmailbox_get_version_str (void);
    236 
    237 int mrmailbox_configure_and_connect(mrmailbox_t*);
    238 void mrmailbox_configure_cancel (mrmailbox_t*);
    239 int mrmailbox_is_configured (mrmailbox_t*);
    240 
    241 void mrmailbox_connect (mrmailbox_t*);
    242 void mrmailbox_disconnect (mrmailbox_t*);
    243 
    244 char* mrmailbox_get_info (mrmailbox_t*);
    245 
    246 
    247 /* Handle chatlists */
    248 #define MR_GCL_ARCHIVED_ONLY 0x01
    249 #define MR_GCL_NO_SPECIALS 0x02
    250 mrchatlist_t* mrmailbox_get_chatlist (mrmailbox_t*, int flags, const char* query);
    251 
    252 
    253 /* Handle chats */
    254 uint32_t mrmailbox_create_chat_by_contact_id (mrmailbox_t*, uint32_t contact_id);
    255 uint32_t mrmailbox_get_chat_id_by_contact_id (mrmailbox_t*, uint32_t contact_id);
    256 
    257 uint32_t mrmailbox_send_text_msg (mrmailbox_t*, uint32_t chat_id, const char* text_to_send);
    258 uint32_t mrmailbox_send_msg (mrmailbox_t*, uint32_t chat_id, mrmsg_t*);
    259 void mrmailbox_set_draft (mrmailbox_t*, uint32_t chat_id, const char*);
    260 
    261 #define MR_GCM_ADDDAYMARKER 0x01
    262 mrarray_t* mrmailbox_get_chat_msgs (mrmailbox_t*, uint32_t chat_id, uint32_t flags, uint32_t marker1before);
    263 int mrmailbox_get_total_msg_count (mrmailbox_t*, uint32_t chat_id);
    264 int mrmailbox_get_fresh_msg_count (mrmailbox_t*, uint32_t chat_id);
    265 mrarray_t* mrmailbox_get_fresh_msgs (mrmailbox_t*);
    266 void mrmailbox_marknoticed_chat (mrmailbox_t*, uint32_t chat_id);
    267 mrarray_t* mrmailbox_get_chat_media (mrmailbox_t*, uint32_t chat_id, int msg_type, int or_msg_type);
    268 uint32_t mrmailbox_get_next_media (mrmailbox_t*, uint32_t curr_msg_id, int dir);
    269 
    270 void mrmailbox_archive_chat (mrmailbox_t*, uint32_t chat_id, int archive);
    271 void mrmailbox_delete_chat (mrmailbox_t*, uint32_t chat_id);
    272 
    273 mrarray_t* mrmailbox_get_chat_contacts (mrmailbox_t*, uint32_t chat_id);
    274 mrarray_t* mrmailbox_search_msgs (mrmailbox_t*, uint32_t chat_id, const char* query);
    275 
    276 mrchat_t* mrmailbox_get_chat (mrmailbox_t*, uint32_t chat_id);
    277 
    278 
    279 /* Handle group chats */
    280 uint32_t mrmailbox_create_group_chat (mrmailbox_t*, const char* name);
    281 int mrmailbox_is_contact_in_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    282 int mrmailbox_add_contact_to_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    283 int mrmailbox_remove_contact_from_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    284 int mrmailbox_set_chat_name (mrmailbox_t*, uint32_t chat_id, const char* name);
    285 int mrmailbox_set_chat_image (mrmailbox_t*, uint32_t chat_id, const char* image);
    286 
    287 
    288 /* Handle messages */
    289 char* mrmailbox_get_msg_info (mrmailbox_t*, uint32_t msg_id);
    290 void mrmailbox_delete_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt);
    291 void mrmailbox_forward_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt, uint32_t chat_id);
    292 void mrmailbox_marknoticed_contact (mrmailbox_t*, uint32_t contact_id);
    293 void mrmailbox_markseen_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt);
    294 void mrmailbox_star_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt, int star);
    295 mrmsg_t* mrmailbox_get_msg (mrmailbox_t*, uint32_t msg_id);
    296 
    297 
    298 /* Handle contacts */
    299 uint32_t mrmailbox_create_contact (mrmailbox_t*, const char* name, const char* addr);
    300 int mrmailbox_add_address_book (mrmailbox_t*, const char*);
    301 mrarray_t* mrmailbox_get_known_contacts (mrmailbox_t*, const char* query);
    302 int mrmailbox_get_blocked_count (mrmailbox_t*);
    304 void mrmailbox_block_contact (mrmailbox_t*, uint32_t contact_id, int block);
    305 char* mrmailbox_get_contact_encrinfo (mrmailbox_t*, uint32_t contact_id);
    306 int mrmailbox_delete_contact (mrmailbox_t*, uint32_t contact_id);
    307 mrcontact_t* mrmailbox_get_contact (mrmailbox_t*, uint32_t contact_id);
    308 
    309 
    310 /* Import/export and Tools */
    311 #define MR_IMEX_CANCEL 0
    312 #define MR_IMEX_EXPORT_SELF_KEYS 1 /* param1 is a directory where the keys are written to */
    313 #define MR_IMEX_IMPORT_SELF_KEYS 2 /* param1 is a directory where the keys are searched in and read from */
    314 #define MR_IMEX_EXPORT_BACKUP 11 /* param1 is a directory where the backup is written to */
    315 #define MR_IMEX_IMPORT_BACKUP 12 /* param1 is the file with the backup to import */
    316 #define MR_IMEX_EXPORT_SETUP_MESSAGE 20 /* param1 is a directory where the setup file is written to */
    317 #define MR_BAK_PREFIX "delta-chat"
    318 #define MR_BAK_SUFFIX "bak"
    319 void mrmailbox_imex (mrmailbox_t*, int what, const char* param1, const char* setup_code);
    320 char* mrmailbox_imex_has_backup (mrmailbox_t*, const char* dir);
    321 int mrmailbox_check_password (mrmailbox_t*, const char* pw);
    322 char* mrmailbox_create_setup_code (mrmailbox_t*);
    323 void mrmailbox_heartbeat (mrmailbox_t*);
    324 
    325 
    326 /* logging */
    327 void mrmailbox_log_error (mrmailbox_t*, int code, const char* msg, ...);
    328 void mrmailbox_log_error_if (int* condition, mrmailbox_t*, int code, const char* msg, ...);
    329 void mrmailbox_log_warning (mrmailbox_t*, int code, const char* msg, ...);
    330 void mrmailbox_log_info (mrmailbox_t*, int code, const char* msg, ...);
    331 void mrmailbox_log_vprintf (mrmailbox_t*, int event, int code, const char* msg, va_list);
    332 int mrmailbox_get_thread_index (void);
    333 
    334 
    335 /* error codes */
    336 #define MR_ERR_SELF_NOT_IN_GROUP 1
    337 #define MR_ERR_NONETWORK 2
    338 
    339 
    340 /* deprecated functions */
    341 int mrchat_set_draft (mrchat_t*, const char* msg); /* deprecated - use mrmailbox_set_draft() instead */
    342 
    343 
    344 /* library-internal */
    345 uint32_t mrmailbox_send_msg_i__ (mrmailbox_t*, mrchat_t*, const mrmsg_t*, time_t);
    346 void mrmailbox_connect_to_imap (mrmailbox_t*, mrjob_t*);
    347 void mrmailbox_wake_lock (mrmailbox_t*);
    348 void mrmailbox_wake_unlock (mrmailbox_t*);
    349 int mrmailbox_poke_eml_file (mrmailbox_t*, const char* file);
    350 int mrmailbox_is_reply_to_known_message__ (mrmailbox_t*, mrmimeparser_t*);
    351 int mrmailbox_is_reply_to_messenger_message__ (mrmailbox_t*, mrmimeparser_t*);
    352 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);
    353 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);
    354 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);
    355 int mrmailbox_get_archived_count__ (mrmailbox_t*);
    356 int mrmailbox_reset_tables (mrmailbox_t*, int bits); /* reset tables but leaves server configuration, 1=jobs, 2=e2ee, 8=rest but server config */
    357 size_t mrmailbox_get_real_contact_cnt__ (mrmailbox_t*);
    358 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);
    359 int mrmailbox_get_contact_origin__ (mrmailbox_t*, uint32_t id, int* ret_blocked);
    360 int mrmailbox_is_contact_blocked__ (mrmailbox_t*, uint32_t id);
    361 int mrmailbox_real_contact_exists__ (mrmailbox_t*, uint32_t id);
    362 int mrmailbox_contact_addr_equals__ (mrmailbox_t*, uint32_t contact_id, const char* other_addr);
    363 void mrmailbox_scaleup_contact_origin__ (mrmailbox_t*, uint32_t contact_id, int origin);
    364 void mrmailbox_unarchive_chat__ (mrmailbox_t*, uint32_t chat_id);
    365 size_t mrmailbox_get_chat_cnt__ (mrmailbox_t*);
    366 uint32_t mrmailbox_create_or_lookup_nchat_by_contact_id__ (mrmailbox_t*, uint32_t contact_id);
    367 uint32_t mrmailbox_lookup_real_nchat_by_contact_id__ (mrmailbox_t*, uint32_t contact_id);
    368 int mrmailbox_get_total_msg_count__ (mrmailbox_t*, uint32_t chat_id);
    369 int mrmailbox_get_fresh_msg_count__ (mrmailbox_t*, uint32_t chat_id);
    370 uint32_t mrmailbox_get_last_deaddrop_fresh_msg__ (mrmailbox_t*);
    371 void mrmailbox_send_msg_to_smtp (mrmailbox_t*, mrjob_t*);
    372 void mrmailbox_send_msg_to_imap (mrmailbox_t*, mrjob_t*);
    373 int mrmailbox_add_contact_to_chat__ (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    374 int mrmailbox_is_contact_in_chat__ (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    375 int mrmailbox_get_chat_contact_count__ (mrmailbox_t*, uint32_t chat_id);
    376 int mrmailbox_group_explicitly_left__ (mrmailbox_t*, const char* grpid);
    377 void mrmailbox_set_group_explicitly_left__ (mrmailbox_t*, const char* grpid);
    378 size_t mrmailbox_get_real_msg_cnt__ (mrmailbox_t*); /* the number of messages assigned to real chat (!=deaddrop, !=trash) */
    379 size_t mrmailbox_get_deaddrop_msg_cnt__ (mrmailbox_t*);
    380 int mrmailbox_rfc724_mid_cnt__ (mrmailbox_t*, const char* rfc724_mid);
    381 int mrmailbox_rfc724_mid_exists__ (mrmailbox_t*, const char* rfc724_mid, char** ret_server_folder, uint32_t* ret_server_uid);
    382 void mrmailbox_update_server_uid__ (mrmailbox_t*, const char* rfc724_mid, const char* server_folder, uint32_t server_uid);
    383 void mrmailbox_update_msg_chat_id__ (mrmailbox_t*, uint32_t msg_id, uint32_t chat_id);
    384 void mrmailbox_update_msg_state__ (mrmailbox_t*, uint32_t msg_id, int state);
    385 void mrmailbox_delete_msg_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    386 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 */
    387 void mrmailbox_send_mdn (mrmailbox_t*, mrjob_t* job);
    388 void mrmailbox_markseen_msg_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    389 void mrmailbox_markseen_mdn_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    390 
    391 
    392 /* library private: end-to-end-encryption */
    393 #define MR_E2EE_DEFAULT_ENABLED 1
    394 #define MR_MDNS_DEFAULT_ENABLED 1
    395 
    396 typedef struct mrmailbox_e2ee_helper_t {
    397  int m_encryption_successfull;
    398  void* m_cdata_to_free;
    399 } mrmailbox_e2ee_helper_t;
    400 
    401 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*);
    402 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 */
    403 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! */
    404 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 */
    405 
    406 
    407 #ifdef __cplusplus
    408 } /* /extern "C" */
    409 #endif
    410 #endif /* __MRMAILBOX_H__ */
    int mrmailbox_add_address_book(mrmailbox_t *mailbox, const char *adr_book)
    Add a number of contacts.
    Definition: mrmailbox.c:4043
    +
    uint32_t mrmailbox_create_group_chat(mrmailbox_t *mailbox, const char *chat_name)
    Create a new group chat.
    Definition: mrmailbox.c:3345
    +
    uint32_t mrmailbox_create_contact(mrmailbox_t *mailbox, const char *name, const char *addr)
    Add a single contact.
    Definition: mrmailbox.c:4003
    +
    uint32_t mrmailbox_send_text_msg(mrmailbox_t *mailbox, uint32_t chat_id, const char *text_to_send)
    Send a simple text message to the given chat.
    Definition: mrmailbox.c:3093
    void mrmailbox_close(mrmailbox_t *mailbox)
    Close mailbox database.
    Definition: mrmailbox.c:1081
    mrmailbox_t * mrmailbox_new(mrmailboxcb_t cb, void *userdata, const char *os_name)
    Create a new mailbox object.
    Definition: mrmailbox.c:898
    -
    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:3575
    +
    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:3577
    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:1697
    -
    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:3688
    +
    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:3690
    int mrmailbox_open(mrmailbox_t *mailbox, const char *dbfile, const char *blobdir)
    Open mailbox database.
    Definition: mrmailbox.c:1016
    An object representing a single contact in memory.
    Definition: mrcontact.h:38
    An object representing 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:2108
    -
    int mrmailbox_delete_contact(mrmailbox_t *mailbox, uint32_t contact_id)
    Delete a contact.
    Definition: mrmailbox.c:4529
    +
    int mrmailbox_delete_contact(mrmailbox_t *mailbox, uint32_t contact_id)
    Delete a contact.
    Definition: mrmailbox.c:4531
    An object representing a single chatlist in memory.
    Definition: mrchatlist.h:43
    void mrmailbox_heartbeat(mrmailbox_t *ths)
    Stay alive.
    Definition: mrmailbox.c:1621
    -
    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:4974
    +
    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:4976
    int mrmailbox_set_config(mrmailbox_t *ths, const char *key, const char *value)
    Configure the mailbox.
    Definition: mrmailbox.c:1182
    char * m_dbfile
    The database file.
    Definition: mrmailbox.h:187
    An object representing a single mailbox.
    Definition: mrmailbox.h:184
    -
    void mrmailbox_delete_msgs(mrmailbox_t *mailbox, const uint32_t *msg_ids, int msg_cnt)
    Delete messages.
    Definition: mrmailbox.c:5116
    +
    void mrmailbox_delete_msgs(mrmailbox_t *mailbox, const uint32_t *msg_ids, int msg_cnt)
    Delete messages.
    Definition: mrmailbox.c:5118
    int mrmailbox_is_open(const mrmailbox_t *mailbox)
    Check if the mailbox database is open.
    Definition: mrmailbox.c:1115
    void mrmailbox_archive_chat(mrmailbox_t *mailbox, uint32_t chat_id, int archive)
    Archive or unarchive a chat.
    Definition: mrmailbox.c:2644
    char * mrmailbox_get_info(mrmailbox_t *mailbox)
    Get information about the mailbox.
    Definition: mrmailbox.c:1283
    -
    mrarray_t * mrmailbox_get_blocked_contacts(mrmailbox_t *mailbox)
    Get blocked contacts.
    Definition: mrmailbox.c:4160
    -
    mrarray_t * mrmailbox_get_known_contacts(mrmailbox_t *mailbox, const char *query)
    Returns known and unblocked contacts.
    Definition: mrmailbox.c:4096
    -
    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:3605
    +
    mrarray_t * mrmailbox_get_blocked_contacts(mrmailbox_t *mailbox)
    Get blocked contacts.
    Definition: mrmailbox.c:4162
    +
    mrarray_t * mrmailbox_get_known_contacts(mrmailbox_t *mailbox, const char *query)
    Returns known and unblocked contacts.
    Definition: mrmailbox.c:4098
    +
    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:3607
    uint32_t mrmailbox_get_next_media(mrmailbox_t *mailbox, uint32_t curr_msg_id, int dir)
    Returns all message IDs of the given types in a chat.
    Definition: mrmailbox.c:1915
    char * mrmailbox_get_version_str(void)
    Find out the version of the Delta Chat core library.
    Definition: mrmailbox.c:1481
    void mrmailbox_disconnect(mrmailbox_t *mailbox)
    Disonnect the mailbox from the server.
    Definition: mrmailbox.c:1596
    char * m_blobdir
    Full path of the blob directory.
    Definition: mrmailbox.h:188
    -
    uint32_t mrmailbox_send_msg(mrmailbox_t *mailbox, uint32_t chat_id, mrmsg_t *msg)
    Send a message of any type to a chat.
    Definition: mrmailbox.c:3151
    +
    uint32_t mrmailbox_send_msg(mrmailbox_t *mailbox, uint32_t chat_id, mrmsg_t *msg)
    Send a message of any type to a chat.
    Definition: mrmailbox.c:3153
    void mrmailbox_connect(mrmailbox_t *mailbox)
    Connect to the mailbox using the configured settings.
    Definition: mrmailbox.c:1569
    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:2578
    void mrmailbox_unref(mrmailbox_t *mailbox)
    Free a mailbox object.
    Definition: mrmailbox.c:955
    -
    void mrmailbox_block_contact(mrmailbox_t *mailbox, uint32_t contact_id, int new_blocking)
    Block or unblock a contact.
    Definition: mrmailbox.c:4310
    +
    void mrmailbox_block_contact(mrmailbox_t *mailbox, uint32_t contact_id, int new_blocking)
    Block or unblock a contact.
    Definition: mrmailbox.c:4312
    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:174
    int mrmailbox_configure_and_connect(mrmailbox_t *mailbox)
    Configure and connect a mailbox.
    Definition: mrmailbox_configure.c:397
    mrchatlist_t * mrmailbox_get_chatlist(mrmailbox_t *mailbox, int listflags, const char *query)
    Get a list of chats.
    Definition: mrmailbox.c:1653
    @@ -134,32 +134,32 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    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:2606
    void mrmailbox_delete_chat(mrmailbox_t *mailbox, uint32_t chat_id)
    Delete a chat.
    Definition: mrmailbox.c:2763
    void mrmailbox_set_draft(mrmailbox_t *mailbox, uint32_t chat_id, const char *msg)
    Save a draft for a chat.
    Definition: mrmailbox.c:2361
    -
    int mrmailbox_get_blocked_count(mrmailbox_t *mailbox)
    Get the number of blocked contacts.
    Definition: mrmailbox.c:4194
    -
    int mrmailbox_set_chat_image(mrmailbox_t *mailbox, uint32_t chat_id, const char *new_image)
    Set group image.
    Definition: mrmailbox.c:3486
    +
    int mrmailbox_get_blocked_count(mrmailbox_t *mailbox)
    Get the number of blocked contacts.
    Definition: mrmailbox.c:4196
    +
    int mrmailbox_set_chat_image(mrmailbox_t *mailbox, uint32_t chat_id, const char *new_image)
    Set group image.
    Definition: mrmailbox.c:3488
    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:2212
    -
    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:4721
    +
    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:4723
    void * m_userdata
    Use data, may be used for any purpose.
    Definition: mrmailbox.h:186
    int mrmailbox_is_configured(mrmailbox_t *mailbox)
    Check if the mailbox is already configured.
    Definition: mrmailbox_configure.c:751
    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:1804
    -
    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:4888
    -
    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:5257
    +
    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:4890
    +
    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:5259
    mrarray_t * mrmailbox_get_chat_contacts(mrmailbox_t *mailbox, uint32_t chat_id)
    Get contact IDs belonging to a chat.
    Definition: mrmailbox.c:1991
    void mrmailbox_marknoticed_chat(mrmailbox_t *mailbox, uint32_t chat_id)
    Mark all message in a chat as noticed.
    Definition: mrmailbox.c:1743
    char * mrmailbox_imex_has_backup(mrmailbox_t *mailbox, const char *dir_name)
    Check if there is a backup file.
    Definition: mrmailbox_imex.c:697
    void mrmailbox_configure_cancel(mrmailbox_t *mailbox)
    Signal the configure-process to stop.
    Definition: mrmailbox_configure.c:720
    mrarray_t * mrmailbox_get_fresh_msgs(mrmailbox_t *mailbox)
    Returns the message IDs of all fresh messages of any chat.
    Definition: mrmailbox.c:2040
    -
    mrcontact_t * mrmailbox_get_contact(mrmailbox_t *mailbox, uint32_t contact_id)
    Get a single contact object.
    Definition: mrmailbox.c:4236
    +
    mrcontact_t * mrmailbox_get_contact(mrmailbox_t *mailbox, uint32_t contact_id)
    Get a single contact object.
    Definition: mrmailbox.c:4238
    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:1051
    -
    void mrmailbox_marknoticed_contact(mrmailbox_t *mailbox, uint32_t contact_id)
    Mark all messages send by the given contact as noticed.
    Definition: mrmailbox.c:4284
    +
    void mrmailbox_marknoticed_contact(mrmailbox_t *mailbox, uint32_t contact_id)
    Mark all messages send by the given contact as noticed.
    Definition: mrmailbox.c:4286
    int mrmailbox_set_config_int(mrmailbox_t *ths, const char *key, int32_t value)
    Configure the mailbox.
    Definition: mrmailbox.c:1235
    int32_t mrmailbox_get_config_int(mrmailbox_t *ths, const char *key, int32_t def)
    Get a configuration option.
    Definition: mrmailbox.c:1257
    -
    int mrmailbox_set_chat_name(mrmailbox_t *mailbox, uint32_t chat_id, const char *new_name)
    Set group name.
    Definition: mrmailbox.c:3409
    +
    int mrmailbox_set_chat_name(mrmailbox_t *mailbox, uint32_t chat_id, const char *new_name)
    Set group name.
    Definition: mrmailbox.c:3411
    char * mrmailbox_create_setup_code(mrmailbox_t *mailbox)
    Create random setup code.
    Definition: mrmailbox_imex.c:1108
    -
    char * mrmailbox_get_contact_encrinfo(mrmailbox_t *mailbox, uint32_t contact_id)
    Get encryption info for a contact.
    Definition: mrmailbox.c:4401
    +
    char * mrmailbox_get_contact_encrinfo(mrmailbox_t *mailbox, uint32_t contact_id)
    Get encryption info for a contact.
    Definition: mrmailbox.c:4403
    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:1884
    void mrmailbox_imex(mrmailbox_t *mailbox, int what, const char *param1, const char *setup_code)
    Import/export things.
    Definition: mrmailbox_imex.c:998
    char * mrmailbox_get_config(mrmailbox_t *ths, const char *key, const char *def)
    Get a configuration option.
    Definition: mrmailbox.c:1213
    -
    char * mrmailbox_get_msg_info(mrmailbox_t *mailbox, uint32_t msg_id)
    Get an informational text for a single message.
    Definition: mrmailbox.c:4763
    +
    char * mrmailbox_get_msg_info(mrmailbox_t *mailbox, uint32_t msg_id)
    Get an informational text for a single message.
    Definition: mrmailbox.c:4765
    An object representing a single chat in memory.
    Definition: mrchat.h:39
    diff --git a/docs/html/mrmsg_8h_source.html b/docs/html/mrmsg_8h_source.html index 447cc2c1..69660bf2 100644 --- a/docs/html/mrmsg_8h_source.html +++ b/docs/html/mrmsg_8h_source.html @@ -89,31 +89,36 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    mrmsg.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 __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 {
    52  uint32_t m_id;
    53  #define MR_MSG_ID_MARKER1 1
    54  #define MR_MSG_ID_DAYMARKER 9
    55  #define MR_MSG_ID_LAST_SPECIAL 9
    56 
    57 
    62  uint32_t m_from_id;
    63 
    64 
    69  uint32_t m_to_id;
    70 
    71 
    76  uint32_t m_chat_id;
    77 
    78 
    82  time_t m_timestamp;
    83 
    84 
    98  int m_type;
    99  #define MR_MSG_UNDEFINED 0
    100  #define MR_MSG_TEXT 10
    101  #define MR_MSG_IMAGE 20
    102  #define MR_MSG_GIF 21
    103  #define MR_MSG_AUDIO 40
    104  #define MR_MSG_VOICE 41
    105  #define MR_MSG_VIDEO 50
    106  #define MR_MSG_FILE 60
    107 
    108 
    128  int m_state;
    129  #define MR_STATE_UNDEFINED 0
    130  #define MR_STATE_IN_FRESH 10
    131  #define MR_STATE_IN_NOTICED 13
    132  #define MR_STATE_IN_SEEN 16
    133  #define MR_STATE_OUT_PENDING 20
    134  #define MR_STATE_OUT_ERROR 24
    135  #define MR_STATE_OUT_DELIVERED 26
    136  #define MR_STATE_OUT_MDN_RCVD 28
    137 
    138  char* m_text;
    140  int m_starred;
    144  mrmailbox_t* m_mailbox;
    145  char* m_rfc724_mid;
    146  char* m_server_folder;
    147  uint32_t m_server_uid;
    148 } mrmsg_t;
    149 
    150 
    151 mrmsg_t* mrmsg_new ();
    152 void mrmsg_unref (mrmsg_t*);
    153 void mrmsg_empty (mrmsg_t*);
    154 
    155 void mrmsg_set_type (mrmsg_t*, int type);
    156 void mrmsg_set_file (mrmsg_t*, const char* file);
    157 void mrmsg_set_text (mrmsg_t*, const char* text);
    158 
    160 char* mrmsg_get_summarytext (mrmsg_t*, int approx_characters);
    162 char* mrmsg_get_file (mrmsg_t*);
    163 char* mrmsg_get_filename (mrmsg_t*);
    165 int mrmsg_is_increation (mrmsg_t*);
    167 
    168 
    169 /* library-private */
    170 #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 "
    171 int mrmsg_set_from_stmt__ (mrmsg_t*, sqlite3_stmt* row, int row_offset); /* row order is MR_MSG_FIELDS */
    172 int mrmsg_load_from_db__ (mrmsg_t*, mrmailbox_t*, uint32_t id);
    173 int mrmsg_is_increation__ (const mrmsg_t*);
    174 char* mrmsg_get_summarytext_by_raw (int type, const char* text, mrparam_t*, int approx_bytes); /* the returned value must be free()'d */
    175 void mrmsg_save_param_to_disk__ (mrmsg_t*);
    176 void mrmsg_guess_msgtype_from_suffix (const char* pathNfilename, int* ret_msgtype, char** ret_mime);
    177 void mrmsg_get_authorNtitle_from_filename (const char* pathNfilename, char** ret_author, char** ret_title);
    178 
    179 #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)
    180 #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. */
    181 #define MR_MSG_MAKE_SUFFIX_SEARCHABLE(a) ((a)==MR_MSG_IMAGE || (a)==MR_MSG_GIF || (a)==MR_MSG_VOICE)
    182 
    183 #define APPROX_SUBJECT_CHARS 32 /* as we do not cut inside words, this results in about 32-42 characters.
    184  Do not use too long subjects - we add a tag after the subject which gets truncated by the clients otherwise.
    185  It should also be very clear, the subject is _not_ the whole message.
    186  The value is also used for CC:-summaries */
    187 
    188 
    189 #ifdef __cplusplus
    190 } /* /extern "C" */
    191 #endif
    192 #endif /* __MRMSG_H__ */
    int m_is_msgrmsg
    Set to 1 if the message was sent by another messenger.
    Definition: mrmsg.h:141
    +
    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 {
    52  uint32_t m_id;
    53  #define MR_MSG_ID_MARKER1 1
    54  #define MR_MSG_ID_DAYMARKER 9
    55  #define MR_MSG_ID_LAST_SPECIAL 9
    56 
    57 
    62  uint32_t m_from_id;
    63 
    64 
    69  uint32_t m_to_id;
    70 
    71 
    76  uint32_t m_chat_id;
    77 
    78 
    82  time_t m_timestamp;
    83 
    84 
    88  int m_type;
    89  #define MR_MSG_UNDEFINED 0
    90  #define MR_MSG_TEXT 10
    91  #define MR_MSG_IMAGE 20 /* m_param may contain MRP_FILE, MRP_WIDTH, MRP_HEIGHT */
    92  #define MR_MSG_GIF 21 /* - " - */
    93  #define MR_MSG_AUDIO 40 /* m_param may contain MRP_FILE, MRP_DURATION */
    94  #define MR_MSG_VOICE 41 /* - " - */
    95  #define MR_MSG_VIDEO 50 /* m_param may contain MRP_FILE, MRP_WIDTH, MRP_HEIGHT, MRP_DURATION */
    96  #define MR_MSG_FILE 60 /* m_param may contain MRP_FILE */
    97 
    98 
    102  int m_state;
    103  #define MR_STATE_UNDEFINED 0
    104  #define MR_STATE_IN_FRESH 10
    105  #define MR_STATE_IN_NOTICED 13
    106  #define MR_STATE_IN_SEEN 16
    107  #define MR_STATE_OUT_PENDING 20
    108  #define MR_STATE_OUT_ERROR 24
    109  #define MR_STATE_OUT_DELIVERED 26
    110  #define MR_STATE_OUT_MDN_RCVD 28
    111 
    116  char* m_text;
    117 
    119  int m_starred;
    124  mrmailbox_t* m_mailbox;
    125  char* m_rfc724_mid;
    126  char* m_server_folder;
    127  uint32_t m_server_uid;
    128 } mrmsg_t;
    129 
    130 
    131 mrmsg_t* mrmsg_new ();
    132 void mrmsg_unref (mrmsg_t*);
    133 void mrmsg_empty (mrmsg_t*);
    134 
    135 void mrmsg_set_type (mrmsg_t*, int type);
    136 void mrmsg_set_text (mrmsg_t*, const char* text);
    137 void mrmsg_set_file (mrmsg_t*, const char* file);
    138 
    139 int mrmsg_get_type (mrmsg_t*);
    140 int mrmsg_get_state (mrmsg_t*);
    141 char* mrmsg_get_text (mrmsg_t*);
    142 char* mrmsg_get_file (mrmsg_t*);
    143 char* mrmsg_get_filename (mrmsg_t*);
    147 char* mrmsg_get_summarytext (mrmsg_t*, int approx_characters);
    148 
    151 
    152 
    153 /* library-private */
    154 #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 "
    155 int mrmsg_set_from_stmt__ (mrmsg_t*, sqlite3_stmt* row, int row_offset); /* row order is MR_MSG_FIELDS */
    156 int mrmsg_load_from_db__ (mrmsg_t*, mrmailbox_t*, uint32_t id);
    157 int mrmsg_is_increation__ (const mrmsg_t*);
    158 char* mrmsg_get_summarytext_by_raw (int type, const char* text, mrparam_t*, int approx_bytes); /* the returned value must be free()'d */
    159 void mrmsg_save_param_to_disk__ (mrmsg_t*);
    160 void mrmsg_guess_msgtype_from_suffix (const char* pathNfilename, int* ret_msgtype, char** ret_mime);
    161 void mrmsg_get_authorNtitle_from_filename (const char* pathNfilename, char** ret_author, char** ret_title);
    162 
    163 #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)
    164 #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. */
    165 #define MR_MSG_MAKE_SUFFIX_SEARCHABLE(a) ((a)==MR_MSG_IMAGE || (a)==MR_MSG_GIF || (a)==MR_MSG_VOICE)
    166 
    167 #define APPROX_SUBJECT_CHARS 32 /* as we do not cut inside words, this results in about 32-42 characters.
    168  Do not use too long subjects - we add a tag after the subject which gets truncated by the clients otherwise.
    169  It should also be very clear, the subject is _not_ the whole message.
    170  The value is also used for CC:-summaries */
    171 
    172 
    173 #ifdef __cplusplus
    174 } /* /extern "C" */
    175 #endif
    176 #endif /* __MRMSG_H__ */
    int m_is_msgrmsg
    Set to 1 if the message was sent by another messenger.
    Definition: mrmsg.h:120
    An object representing a single mailbox.
    Definition: mrmailbox.h:184
    -
    int m_type
    Type of the message.
    Definition: mrmsg.h:98
    -
    char * mrmsg_get_summarytext(mrmsg_t *msg, int approx_characters)
    Get a message summary as a single line of text.
    Definition: mrmsg.c:389
    +
    int mrmsg_get_type(mrmsg_t *msg)
    Get the type of the message.
    Definition: mrmsg.c:202
    +
    int m_type
    Message type.
    Definition: mrmsg.h:88
    +
    char * mrmsg_get_summarytext(mrmsg_t *msg, int approx_characters)
    Get a message summary as a single line of text.
    Definition: mrmsg.c:459
    uint32_t m_chat_id
    Chat ID the message belongs to.
    Definition: mrmsg.h:76
    +
    int mrmsg_get_state(mrmsg_t *msg)
    Get the state of a message.
    Definition: mrmsg.c:238
    mrmsg_t * mrmsg_new()
    Create new message object.
    Definition: mrmsg.c:41
    An object representing text with some attributes.
    Definition: mrpoortext.h:35
    -
    mrpoortext_t * mrmsg_get_summary(mrmsg_t *msg, mrchat_t *chat)
    Get a summary for a message.
    Definition: mrmsg.c:312
    -
    void mrmsg_set_file(mrmsg_t *msg, const char *file)
    Set the file belonging to a message.
    Definition: mrmsg.c:148
    -
    mrpoortext_t * mrmsg_get_mediainfo(mrmsg_t *msg)
    Get real author and title.
    Definition: mrmsg.c:529
    +
    mrpoortext_t * mrmsg_get_summary(mrmsg_t *msg, mrchat_t *chat)
    Get a summary for a message.
    Definition: mrmsg.c:417
    +
    void mrmsg_set_file(mrmsg_t *msg, const char *file)
    Set the file belonging to a message.
    Definition: mrmsg.c:177
    +
    mrpoortext_t * mrmsg_get_mediainfo(mrmsg_t *msg)
    Get real author and title.
    Definition: mrmsg.c:335
    An object representing a single message in memory.
    Definition: mrmsg.h:40
    -
    int mrmsg_show_padlock(mrmsg_t *msg)
    Check if a padlock should be shown beside the message.
    Definition: mrmsg.c:351
    uint32_t m_to_id
    Contact ID of the recipient.
    Definition: mrmsg.h:69
    uint32_t m_from_id
    Contact ID of the sender.
    Definition: mrmsg.h:62
    -
    int m_starred
    Starred-state of the message.
    Definition: mrmsg.h:140
    -
    void mrmsg_set_text(mrmsg_t *msg, const char *text)
    Set the text of a message object.
    Definition: mrmsg.c:174
    +
    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:274
    +
    int m_starred
    Starred-state of the message.
    Definition: mrmsg.h:119
    +
    void mrmsg_set_text(mrmsg_t *msg, const char *text)
    Set the text of a message object.
    Definition: mrmsg.c:153
    An object for handling key=value parameter lists.
    Definition: mrparam.h:44
    -
    mrparam_t * m_param
    Additional paramter for the message.
    Definition: mrmsg.h:139
    -
    char * m_text
    message text or NULL if unset
    Definition: mrmsg.h:138
    +
    int mrmsg_is_increation(mrmsg_t *msg)
    Check if a message is still in creation.
    Definition: mrmsg.c:697
    +
    mrparam_t * m_param
    Additional paramter for the message.
    Definition: mrmsg.h:118
    +
    char * m_text
    Message text.
    Definition: mrmsg.h:116
    void mrmsg_unref(mrmsg_t *msg)
    Free an mrmsg_t object created eg.
    Definition: mrmsg.c:68
    -
    void mrmsg_set_type(mrmsg_t *msg, int type)
    Set the type of a message.
    Definition: mrmsg.c:125
    +
    void mrmsg_set_type(mrmsg_t *msg, int type)
    Set the type of a message.
    Definition: mrmsg.c:126
    uint32_t m_id
    Message ID.
    Definition: mrmsg.h:52
    -
    int m_state
    Message state.
    Definition: mrmsg.h:128
    -
    void mrmsg_save_param_to_disk(mrmsg_t *msg)
    can be used to add some additional, persistent information to a messages record.
    Definition: mrmsg.c:639
    +
    int m_state
    Message state.
    Definition: mrmsg.h:102
    +
    int mrmsg_get_showpadlock(mrmsg_t *msg)
    Check if a padlock should be shown beside the message.
    Definition: mrmsg.c:389
    +
    void mrmsg_save_param_to_disk(mrmsg_t *msg)
    can be used to add some additional, persistent information to a messages record.
    Definition: mrmsg.c:732
    void mrmsg_empty(mrmsg_t *msg)
    Empty a message object.
    Definition: mrmsg.c:89
    +
    char * mrmsg_get_text(mrmsg_t *msg)
    Get the text of the message.
    Definition: mrmsg.c:256
    time_t m_timestamp
    Unix time the message was sended or received.
    Definition: mrmsg.h:82
    An object representing a single chat in memory.
    Definition: mrchat.h:39
    diff --git a/docs/html/search/all_1.js b/docs/html/search/all_1.js index 1a00566b..9edeea45 100644 --- a/docs/html/search/all_1.js +++ b/docs/html/search/all_1.js @@ -125,15 +125,20 @@ var searchData= ['mrmailbox_5funref',['mrmailbox_unref',['../structmrmailbox__t.html#a825cec4a85da05335674eae221d51374',1,'mrmailbox_t']]], ['mrmailboxcb_5ft',['mrmailboxcb_t',['../structmrmailbox__t.html#a957f0bbae60f389bac40acf42b68b134',1,'mrmailbox_t']]], ['mrmsg_5fempty',['mrmsg_empty',['../structmrmsg__t.html#a57d94b55fc918b27874b9194d6c35388',1,'mrmsg_t']]], + ['mrmsg_5fget_5ffile',['mrmsg_get_file',['../structmrmsg__t.html#a2544769c77af5447546fcf5fc95c64f7',1,'mrmsg_t']]], ['mrmsg_5fget_5fmediainfo',['mrmsg_get_mediainfo',['../structmrmsg__t.html#ad87b7df007489b3a47c3fde79978a58a',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#afc3d94448ada0ad7142cf168cab1462e',1,'mrmsg_t']]], ['mrmsg_5fget_5fsummarytext',['mrmsg_get_summarytext',['../structmrmsg__t.html#a8c8c1f342f01439ae40c5cf37532387e',1,'mrmsg_t']]], + ['mrmsg_5fget_5ftext',['mrmsg_get_text',['../structmrmsg__t.html#ae549e58d9ae2f73ad76bd27636b43982',1,'mrmsg_t']]], + ['mrmsg_5fget_5ftype',['mrmsg_get_type',['../structmrmsg__t.html#a705454903b36ded8c3cd43a2044de60a',1,'mrmsg_t']]], + ['mrmsg_5fis_5fincreation',['mrmsg_is_increation',['../structmrmsg__t.html#a32d23bac4bf35ed5f8c2cfbb93d636f5',1,'mrmsg_t']]], ['mrmsg_5fnew',['mrmsg_new',['../structmrmsg__t.html#a80f470eb34af414ff28e7d3b3c715b48',1,'mrmsg_t']]], ['mrmsg_5fsave_5fparam_5fto_5fdisk',['mrmsg_save_param_to_disk',['../structmrmsg__t.html#a0bc3ce5f2ef0065547e4aee0143d22ef',1,'mrmsg_t']]], ['mrmsg_5fset_5ffile',['mrmsg_set_file',['../structmrmsg__t.html#a98455bee60d64b3d59d89fbbb520ddd5',1,'mrmsg_t']]], ['mrmsg_5fset_5ftext',['mrmsg_set_text',['../structmrmsg__t.html#ae940aa79a261e1a427b12baefbee2d23',1,'mrmsg_t']]], ['mrmsg_5fset_5ftype',['mrmsg_set_type',['../structmrmsg__t.html#a3581e331fe9f3f38d4c5bb1b1c8c7867',1,'mrmsg_t']]], - ['mrmsg_5fshow_5fpadlock',['mrmsg_show_padlock',['../structmrmsg__t.html#a9980da92916e42081f2f39ccc72c1696',1,'mrmsg_t']]], ['mrmsg_5ft',['mrmsg_t',['../structmrmsg__t.html',1,'']]], ['mrmsg_5funref',['mrmsg_unref',['../structmrmsg__t.html#aa33212e41efff643aa7290753f3d9b02',1,'mrmsg_t']]], ['mrparam_5fempty',['mrparam_empty',['../structmrparam__t.html#a88397aa66e74bcdc61c8376c8e9a761b',1,'mrparam_t']]], diff --git a/docs/html/search/functions_0.js b/docs/html/search/functions_0.js index 9392d9b9..9c6f6310 100644 --- a/docs/html/search/functions_0.js +++ b/docs/html/search/functions_0.js @@ -75,15 +75,20 @@ var searchData= ['mrmailbox_5fstar_5fmsgs',['mrmailbox_star_msgs',['../structmrmailbox__t.html#a8ed1c3bd08cd6515abf6046ebad9cafc',1,'mrmailbox_t']]], ['mrmailbox_5funref',['mrmailbox_unref',['../structmrmailbox__t.html#a825cec4a85da05335674eae221d51374',1,'mrmailbox_t']]], ['mrmsg_5fempty',['mrmsg_empty',['../structmrmsg__t.html#a57d94b55fc918b27874b9194d6c35388',1,'mrmsg_t']]], + ['mrmsg_5fget_5ffile',['mrmsg_get_file',['../structmrmsg__t.html#a2544769c77af5447546fcf5fc95c64f7',1,'mrmsg_t']]], ['mrmsg_5fget_5fmediainfo',['mrmsg_get_mediainfo',['../structmrmsg__t.html#ad87b7df007489b3a47c3fde79978a58a',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#afc3d94448ada0ad7142cf168cab1462e',1,'mrmsg_t']]], ['mrmsg_5fget_5fsummarytext',['mrmsg_get_summarytext',['../structmrmsg__t.html#a8c8c1f342f01439ae40c5cf37532387e',1,'mrmsg_t']]], + ['mrmsg_5fget_5ftext',['mrmsg_get_text',['../structmrmsg__t.html#ae549e58d9ae2f73ad76bd27636b43982',1,'mrmsg_t']]], + ['mrmsg_5fget_5ftype',['mrmsg_get_type',['../structmrmsg__t.html#a705454903b36ded8c3cd43a2044de60a',1,'mrmsg_t']]], + ['mrmsg_5fis_5fincreation',['mrmsg_is_increation',['../structmrmsg__t.html#a32d23bac4bf35ed5f8c2cfbb93d636f5',1,'mrmsg_t']]], ['mrmsg_5fnew',['mrmsg_new',['../structmrmsg__t.html#a80f470eb34af414ff28e7d3b3c715b48',1,'mrmsg_t']]], ['mrmsg_5fsave_5fparam_5fto_5fdisk',['mrmsg_save_param_to_disk',['../structmrmsg__t.html#a0bc3ce5f2ef0065547e4aee0143d22ef',1,'mrmsg_t']]], ['mrmsg_5fset_5ffile',['mrmsg_set_file',['../structmrmsg__t.html#a98455bee60d64b3d59d89fbbb520ddd5',1,'mrmsg_t']]], ['mrmsg_5fset_5ftext',['mrmsg_set_text',['../structmrmsg__t.html#ae940aa79a261e1a427b12baefbee2d23',1,'mrmsg_t']]], ['mrmsg_5fset_5ftype',['mrmsg_set_type',['../structmrmsg__t.html#a3581e331fe9f3f38d4c5bb1b1c8c7867',1,'mrmsg_t']]], - ['mrmsg_5fshow_5fpadlock',['mrmsg_show_padlock',['../structmrmsg__t.html#a9980da92916e42081f2f39ccc72c1696',1,'mrmsg_t']]], ['mrmsg_5funref',['mrmsg_unref',['../structmrmsg__t.html#aa33212e41efff643aa7290753f3d9b02',1,'mrmsg_t']]], ['mrparam_5fempty',['mrparam_empty',['../structmrparam__t.html#a88397aa66e74bcdc61c8376c8e9a761b',1,'mrparam_t']]], ['mrparam_5fexists',['mrparam_exists',['../structmrparam__t.html#a0a9d3768d128dce0088b089f66fafb68',1,'mrparam_t']]], diff --git a/docs/html/structmrmailbox__t.html b/docs/html/structmrmailbox__t.html index 832998b3..0f517dd7 100644 --- a/docs/html/structmrmailbox__t.html +++ b/docs/html/structmrmailbox__t.html @@ -2336,6 +2336,7 @@ Public Attributes

    Send a simple text message to the given chat.

    Sends the event MR_EVENT_MSGS_CHANGED on succcess. However, this does not imply, the message really reached the recipient - sending may be delayed eg. due to network problems. However, from your view, you're done with the message. Sooner or later it will find its way.

    +

    To send messages of other types, see mrmailbox_send_msg().

    Parameters
    diff --git a/docs/html/structmrmsg__t-members.html b/docs/html/structmrmsg__t-members.html index 79156f83..230a472c 100644 --- a/docs/html/structmrmsg__t-members.html +++ b/docs/html/structmrmsg__t-members.html @@ -100,16 +100,21 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); - - - + + + + + + + + + - - +
    mailboxThe mailbox object as returned from mrmailbox_new().
    m_to_idmrmsg_t
    m_typemrmsg_t
    mrmsg_empty(mrmsg_t *msg)mrmsg_t
    mrmsg_get_mediainfo(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_file(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_type(mrmsg_t *msg)mrmsg_t
    mrmsg_is_increation(mrmsg_t *msg)mrmsg_t
    mrmsg_new()mrmsg_t
    mrmsg_save_param_to_disk(mrmsg_t *msg)mrmsg_t
    mrmsg_set_file(mrmsg_t *msg, const char *file)mrmsg_t
    mrmsg_set_text(mrmsg_t *msg, const char *text)mrmsg_t
    mrmsg_set_type(mrmsg_t *msg, int type)mrmsg_t
    mrmsg_show_padlock(mrmsg_t *msg)mrmsg_t
    mrmsg_unref(mrmsg_t *msg)mrmsg_t
    mrmsg_unref(mrmsg_t *msg)mrmsg_t