From 6c33483cd0e75eab94d4560b717e5a1eb2a77b25 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Fri, 24 Nov 2017 14:01:15 +0100 Subject: [PATCH] doxygen --- docs/html/annotated.html | 8 +- docs/html/classes.html | 4 +- docs/html/files.html | 31 +-- docs/html/functions.html | 22 +- docs/html/functions_func.html | 12 +- docs/html/functions_vars.html | 10 +- docs/html/mrarray_8h_source.html | 2 +- docs/html/mrchatlist_8h_source.html | 8 +- docs/html/mrlot_8h_source.html | 110 ++++++++++ docs/html/mrmailbox_8h_source.html | 4 +- docs/html/mrmsg_8h_source.html | 28 +-- docs/html/mrpoortext_8h_source.html | 9 +- docs/html/mrtools_8h_source.html | 2 +- docs/html/search/all_1.js | 22 +- docs/html/search/classes_0.js | 4 +- docs/html/search/functions_0.js | 10 +- docs/html/search/variables_0.js | 10 +- docs/html/structmrarray__t.html | 6 +- docs/html/structmrchatlist__t-members.html | 2 +- docs/html/structmrchatlist__t.html | 30 +-- docs/html/structmrlot__t-members.html | 105 +++++++++ docs/html/structmrlot__t.html | 241 +++++++++++++++++++++ docs/html/structmrmailbox__t.html | 2 +- docs/html/structmrmsg__t-members.html | 4 +- docs/html/structmrmsg__t.html | 40 ++-- 25 files changed, 593 insertions(+), 133 deletions(-) create mode 100644 docs/html/mrlot_8h_source.html create mode 100644 docs/html/structmrlot__t-members.html create mode 100644 docs/html/structmrlot__t.html diff --git a/docs/html/annotated.html b/docs/html/annotated.html index 94506d0e..49ee1ec3 100644 --- a/docs/html/annotated.html +++ b/docs/html/annotated.html @@ -87,13 +87,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
Here are the classes, structs, unions and interfaces with brief descriptions:
- + - - - + + +
 Cmrarray_tAn object representing a simple array
 Cmrarray_tAn object containing a simple array
 Cmrchat_tAn object representing a single chat in memory
 Cmrchatlist_tAn object representing a single chatlist in memory
 Cmrcontact_tAn object representing a single contact in memory
 Cmrmailbox_tAn object representing a single mailbox
 Cmrmsg_tAn object representing a single message in memory
 Cmrpoortext_tAn object representing text with some attributes
 Cmrlot_tAn object containing a set of values
 Cmrmailbox_tAn object representing a single mailbox
 Cmrmsg_tAn object representing a single message in memory
diff --git a/docs/html/classes.html b/docs/html/classes.html index 860a680e..140e2e96 100644 --- a/docs/html/classes.html +++ b/docs/html/classes.html @@ -88,8 +88,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
M
- + +
  m  
-
mrchat_t   mrcontact_t   mrmsg_t   
mrchatlist_t   mrmailbox_t   mrpoortext_t   
mrchat_t   mrcontact_t   mrmailbox_t   
mrchatlist_t   mrlot_t   mrmsg_t   
mrarray_t   
diff --git a/docs/html/files.html b/docs/html/files.html index 6385789d..238c2e1d 100644 --- a/docs/html/files.html +++ b/docs/html/files.html @@ -101,21 +101,22 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');  mrkey.h  mrkeyring.h  mrloginparam.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 + 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 3f7fd77f..bd6cc5b7 100644 --- a/docs/html/functions.html +++ b/docs/html/functions.html @@ -142,19 +142,19 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); , mrcontact_t
  • m_state -: mrpoortext_t +: mrlot_t
  • m_text1 -: mrpoortext_t +: mrlot_t
  • m_text1_meaning -: mrpoortext_t +: mrlot_t
  • m_text2 -: mrpoortext_t +: mrlot_t
  • m_timestamp -: mrpoortext_t +: mrlot_t
  • m_to_id : mrmsg_t @@ -196,7 +196,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : mrchatlist_t
  • mrchatlist_get_summary() -: mrchatlist_t +: mrchatlist_t
  • mrchatlist_unref() : mrchatlist_t @@ -222,6 +222,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • mrcontact_unref() : mrcontact_t
  • +
  • mrlot_unref() +: mrlot_t +
  • mrmailbox_add_address_book() : mrmailbox_t
  • @@ -442,7 +445,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : mrmsg_t
  • mrmsg_get_mediainfo() -: mrmsg_t +: mrmsg_t
  • mrmsg_get_showpadlock() : mrmsg_t @@ -451,7 +454,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : mrmsg_t
  • mrmsg_get_summary() -: mrmsg_t +: mrmsg_t
  • mrmsg_get_summarytext() : mrmsg_t @@ -486,9 +489,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • mrmsg_unref() : mrmsg_t
  • -
  • mrpoortext_unref() -: mrpoortext_t -
  • diff --git a/docs/html/functions_func.html b/docs/html/functions_func.html index 2642fb80..a1a2361b 100644 --- a/docs/html/functions_func.html +++ b/docs/html/functions_func.html @@ -128,7 +128,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : mrchatlist_t
  • mrchatlist_get_summary() -: mrchatlist_t +: mrchatlist_t
  • mrchatlist_unref() : mrchatlist_t @@ -154,6 +154,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • mrcontact_unref() : mrcontact_t
  • +
  • mrlot_unref() +: mrlot_t +
  • mrmailbox_add_address_book() : mrmailbox_t
  • @@ -371,7 +374,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : mrmsg_t
  • mrmsg_get_mediainfo() -: mrmsg_t +: mrmsg_t
  • mrmsg_get_showpadlock() : mrmsg_t @@ -380,7 +383,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : mrmsg_t
  • mrmsg_get_summary() -: mrmsg_t +: mrmsg_t
  • mrmsg_get_summarytext() : mrmsg_t @@ -415,9 +418,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • mrmsg_unref() : mrmsg_t
  • -
  • mrpoortext_unref() -: mrpoortext_t -
  • diff --git a/docs/html/functions_vars.html b/docs/html/functions_vars.html index bd514adc..340efd2a 100644 --- a/docs/html/functions_vars.html +++ b/docs/html/functions_vars.html @@ -135,19 +135,19 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); , mrcontact_t
  • m_state -: mrpoortext_t +: mrlot_t
  • m_text1 -: mrpoortext_t +: mrlot_t
  • m_text1_meaning -: mrpoortext_t +: mrlot_t
  • m_text2 -: mrpoortext_t +: mrlot_t
  • m_timestamp -: mrpoortext_t +: mrlot_t
  • m_to_id : mrmsg_t diff --git a/docs/html/mrarray_8h_source.html b/docs/html/mrarray_8h_source.html index f3169b43..19b22013 100644 --- a/docs/html/mrarray_8h_source.html +++ b/docs/html/mrarray_8h_source.html @@ -89,7 +89,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    mrarray.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 __MRARRAY_H__
    24 #define __MRARRAY_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 typedef struct mrmailbox_t mrmailbox_t;
    31 
    32 
    39 typedef struct mrarray_t
    40 {
    44  size_t m_allocated;
    45  size_t m_count;
    46  uintptr_t* m_array;
    47 } mrarray_t;
    48 
    49 
    50 mrarray_t* mrarray_new (mrmailbox_t*, size_t initsize);
    51 void mrarray_empty (mrarray_t*);
    52 void mrarray_unref (mrarray_t*);
    53 
    54 void mrarray_add_id (mrarray_t*, uint32_t id);
    55 
    56 size_t mrarray_get_cnt (mrarray_t*);
    57 uint32_t mrarray_get_id (mrarray_t*, size_t index);
    58 int mrarray_search_id (mrarray_t*, uint32_t needle, size_t* indx);
    59 
    60 #ifdef __cplusplus
    61 } /* /extern "C" */
    62 #endif
    63 #endif /* __MRARRAY_H__ */
    64 
    An object representing a simple array.
    Definition: mrarray.h:39
    +
    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 __MRARRAY_H__
    24 #define __MRARRAY_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 typedef struct mrmailbox_t mrmailbox_t;
    31 
    32 
    39 typedef struct mrarray_t
    40 {
    44  size_t m_allocated;
    45  size_t m_count;
    46  uintptr_t* m_array;
    47 } mrarray_t;
    48 
    49 
    50 mrarray_t* mrarray_new (mrmailbox_t*, size_t initsize);
    51 void mrarray_empty (mrarray_t*);
    52 void mrarray_unref (mrarray_t*);
    53 
    54 void mrarray_add_id (mrarray_t*, uint32_t id);
    55 
    56 size_t mrarray_get_cnt (mrarray_t*);
    57 uint32_t mrarray_get_id (mrarray_t*, size_t index);
    58 int mrarray_search_id (mrarray_t*, uint32_t needle, size_t* indx);
    59 
    60 #ifdef __cplusplus
    61 } /* /extern "C" */
    62 #endif
    63 #endif /* __MRARRAY_H__ */
    64 
    An object containing a simple array.
    Definition: mrarray.h:39
    size_t mrarray_get_cnt(mrarray_t *array)
    Find out the number of items in an array.
    Definition: mrarray.c:136
    An object representing a single mailbox.
    Definition: mrmailbox.h:184
    void mrarray_unref(mrarray_t *array)
    Free an array object.
    Definition: mrarray.c:67
    diff --git a/docs/html/mrchatlist_8h_source.html b/docs/html/mrchatlist_8h_source.html index 86939e2b..2f043053 100644 --- a/docs/html/mrchatlist_8h_source.html +++ b/docs/html/mrchatlist_8h_source.html @@ -89,16 +89,16 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    mrchatlist.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 __MRCHATLIST_H__
    24 #define __MRCHATLIST_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 typedef struct mrmailbox_t mrmailbox_t;
    31 typedef struct mrpoortext_t mrpoortext_t;
    32 typedef struct mrchat_t mrchat_t;
    33 typedef struct mrarray_t mrarray_t;
    34 
    35 
    43 typedef struct mrchatlist_t
    44 {
    48  #define MR_CHATLIST_IDS_PER_RESULT 2
    49  size_t m_cnt;
    50  mrarray_t* m_chatNlastmsg_ids;
    51 } mrchatlist_t;
    52 
    53 
    54 mrchatlist_t* mrchatlist_new (mrmailbox_t*);
    55 void mrchatlist_empty (mrchatlist_t*);
    58 uint32_t mrchatlist_get_chat_id (mrchatlist_t*, size_t index);
    59 uint32_t mrchatlist_get_msg_id (mrchatlist_t*, size_t index);
    61 
    62 /* library-internal */
    63 int mrchatlist_load_from_db__ (mrchatlist_t*, int listflags, const char* query);
    64 
    65 
    66 #ifdef __cplusplus
    67 } /* /extern "C" */
    68 #endif
    69 #endif /* __MRCHATLIST_H__ */
    mrmailbox_t * m_mailbox
    The mailbox, the chatlist belongs to.
    Definition: mrchatlist.h:45
    -
    An object representing a simple array.
    Definition: mrarray.h:39
    +
    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 __MRCHATLIST_H__
    24 #define __MRCHATLIST_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 typedef struct mrmailbox_t mrmailbox_t;
    31 typedef struct mrlot_t mrlot_t;
    32 typedef struct mrchat_t mrchat_t;
    33 typedef struct mrarray_t mrarray_t;
    34 
    35 
    43 typedef struct mrchatlist_t
    44 {
    48  #define MR_CHATLIST_IDS_PER_RESULT 2
    49  size_t m_cnt;
    50  mrarray_t* m_chatNlastmsg_ids;
    51 } mrchatlist_t;
    52 
    53 
    54 mrchatlist_t* mrchatlist_new (mrmailbox_t*);
    55 void mrchatlist_empty (mrchatlist_t*);
    58 uint32_t mrchatlist_get_chat_id (mrchatlist_t*, size_t index);
    59 uint32_t mrchatlist_get_msg_id (mrchatlist_t*, size_t index);
    61 
    62 /* library-internal */
    63 int mrchatlist_load_from_db__ (mrchatlist_t*, int listflags, const char* query);
    64 
    65 
    66 #ifdef __cplusplus
    67 } /* /extern "C" */
    68 #endif
    69 #endif /* __MRCHATLIST_H__ */
    mrmailbox_t * m_mailbox
    The mailbox, the chatlist belongs to.
    Definition: mrchatlist.h:45
    +
    An object containing a simple array.
    Definition: mrarray.h:39
    An object representing a single chatlist in memory.
    Definition: mrchatlist.h:43
    -
    mrpoortext_t * mrchatlist_get_summary(mrchatlist_t *chatlist, size_t index, mrchat_t *chat)
    Get a summary for a chatlist index.
    Definition: mrchatlist.c:189
    An object representing a single mailbox.
    Definition: mrmailbox.h:184
    uint32_t mrchatlist_get_msg_id(mrchatlist_t *chatlist, size_t index)
    Get a single message ID of a chatlist.
    Definition: mrchatlist.c:149
    -
    An object representing text with some attributes.
    Definition: mrpoortext.h:35
    +
    An object containing a set of values.
    Definition: mrlot.h:36
    size_t mrchatlist_get_cnt(mrchatlist_t *chatlist)
    Find out the number of chats in a chatlist.
    Definition: mrchatlist.c:101
    uint32_t mrchatlist_get_chat_id(mrchatlist_t *chatlist, size_t index)
    Get a single chat ID of a chatlist.
    Definition: mrchatlist.c:125
    void mrchatlist_unref(mrchatlist_t *chatlist)
    Free a chatlist object.
    Definition: mrchatlist.c:62
    +
    mrlot_t * mrchatlist_get_summary(mrchatlist_t *chatlist, size_t index, mrchat_t *chat)
    Get a summary for a chatlist index.
    Definition: mrchatlist.c:187
    An object representing a single chat in memory.
    Definition: mrchat.h:39
    diff --git a/docs/html/mrlot_8h_source.html b/docs/html/mrlot_8h_source.html new file mode 100644 index 00000000..7bde041e --- /dev/null +++ b/docs/html/mrlot_8h_source.html @@ -0,0 +1,110 @@ + + + + + + +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrlot.h Source File + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Delta Chat Core C-API +
    +
    +
    + + + + + + +
    +
    + + +
    + +
    + + +
    +
    +
    +
    mrlot.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 __MRLOT_H__
    24 #define __MRLOT_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    36 typedef struct mrlot_t
    37 {
    39  char* m_text1;
    40  char* m_text2;
    41  time_t m_timestamp;
    42  int m_state;
    43 } mrlot_t;
    44 
    45 
    46 #define MR_TEXT1_DRAFT 1
    47 #define MR_TEXT1_USERNAME 2
    48 #define MR_TEXT1_SELF 3
    49 
    50 
    51 mrlot_t* mrlot_new ();
    52 void mrlot_empty (mrlot_t*);
    53 void mrlot_unref (mrlot_t*);
    54 
    55 
    56 /* library-internal */
    57 #define MR_SUMMARY_CHARACTERS 160 /* in practice, the user additionally cuts the string himself pixel-accurate */
    58 void mrlot_fill (mrlot_t*, const mrmsg_t*, const mrchat_t*, const mrcontact_t*);
    59 
    60 
    61 #ifdef __cplusplus
    62 } /* /extern "C" */
    63 #endif
    64 #endif /* __MRLOT_H__ */
    An object representing a single contact in memory.
    Definition: mrcontact.h:38
    +
    char * m_text2
    The meaning of this string is defined by the creator of the object.
    Definition: mrlot.h:40
    +
    int m_state
    The meaning of this value is defined by the creator of the object.
    Definition: mrlot.h:42
    +
    int m_text1_meaning
    The meaning of this value is defined by the creator of the object.
    Definition: mrlot.h:38
    +
    An object representing a single message in memory.
    Definition: mrmsg.h:40
    +
    An object containing a set of values.
    Definition: mrlot.h:36
    +
    void mrlot_unref(mrlot_t *set)
    Frees an object containing a set of parameters.
    Definition: mrlot.c:52
    +
    time_t m_timestamp
    The meaning of this value is defined by the creator of the object.
    Definition: mrlot.h:41
    +
    char * m_text1
    The meaning of this string is defined by the creator of the object.
    Definition: mrlot.h:39
    +
    An object representing a single chat in memory.
    Definition: mrchat.h:39
    +
    + + + + diff --git a/docs/html/mrmailbox_8h_source.html b/docs/html/mrmailbox_8h_source.html index c72b4b43..52555f8e 100644 --- a/docs/html/mrmailbox_8h_source.html +++ b/docs/html/mrmailbox_8h_source.html @@ -89,7 +89,7 @@ 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_image_msg (mrmailbox_t*, uint32_t chat_id, const char* file, const char* filemime, int width, int height);
    259 uint32_t mrmailbox_send_video_msg (mrmailbox_t*, uint32_t chat_id, const char* file, const char* filemime, int width, int height, int duration);
    260 uint32_t mrmailbox_send_voice_msg (mrmailbox_t*, uint32_t chat_id, const char* file, const char* filemime, int duration);
    261 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);
    262 uint32_t mrmailbox_send_file_msg (mrmailbox_t*, uint32_t chat_id, const char* file, const char* filemime);
    263 uint32_t mrmailbox_send_vcard_msg (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    264 void mrmailbox_set_draft (mrmailbox_t*, uint32_t chat_id, const char*);
    265 
    266 #define MR_GCM_ADDDAYMARKER 0x01
    267 mrarray_t* mrmailbox_get_chat_msgs (mrmailbox_t*, uint32_t chat_id, uint32_t flags, uint32_t marker1before);
    268 int mrmailbox_get_total_msg_count (mrmailbox_t*, uint32_t chat_id);
    269 int mrmailbox_get_fresh_msg_count (mrmailbox_t*, uint32_t chat_id);
    270 mrarray_t* mrmailbox_get_fresh_msgs (mrmailbox_t*);
    271 void mrmailbox_marknoticed_chat (mrmailbox_t*, uint32_t chat_id);
    272 mrarray_t* mrmailbox_get_chat_media (mrmailbox_t*, uint32_t chat_id, int msg_type, int or_msg_type);
    273 uint32_t mrmailbox_get_next_media (mrmailbox_t*, uint32_t curr_msg_id, int dir);
    274 
    275 void mrmailbox_archive_chat (mrmailbox_t*, uint32_t chat_id, int archive);
    276 void mrmailbox_delete_chat (mrmailbox_t*, uint32_t chat_id);
    277 
    278 mrarray_t* mrmailbox_get_chat_contacts (mrmailbox_t*, uint32_t chat_id);
    279 mrarray_t* mrmailbox_search_msgs (mrmailbox_t*, uint32_t chat_id, const char* query);
    280 
    281 mrchat_t* mrmailbox_get_chat (mrmailbox_t*, uint32_t chat_id);
    282 
    283 
    284 /* Handle group chats */
    285 uint32_t mrmailbox_create_group_chat (mrmailbox_t*, const char* name);
    286 int mrmailbox_is_contact_in_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    287 int mrmailbox_add_contact_to_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    288 int mrmailbox_remove_contact_from_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    289 int mrmailbox_set_chat_name (mrmailbox_t*, uint32_t chat_id, const char* name);
    290 int mrmailbox_set_chat_profile_image (mrmailbox_t*, uint32_t chat_id, const char* image);
    291 
    292 
    293 /* Handle messages */
    294 char* mrmailbox_get_msg_info (mrmailbox_t*, uint32_t msg_id);
    295 void mrmailbox_delete_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt);
    296 void mrmailbox_forward_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt, uint32_t chat_id);
    297 void mrmailbox_marknoticed_contact (mrmailbox_t*, uint32_t contact_id);
    298 void mrmailbox_markseen_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt);
    299 void mrmailbox_star_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt, int star);
    300 mrmsg_t* mrmailbox_get_msg (mrmailbox_t*, uint32_t msg_id);
    301 
    302 
    303 /* Handle contacts */
    304 uint32_t mrmailbox_create_contact (mrmailbox_t*, const char* name, const char* addr);
    305 int mrmailbox_add_address_book (mrmailbox_t*, const char*);
    306 mrarray_t* mrmailbox_get_known_contacts (mrmailbox_t*, const char* query);
    307 int mrmailbox_get_blocked_count (mrmailbox_t*);
    309 void mrmailbox_block_contact (mrmailbox_t*, uint32_t contact_id, int block);
    310 char* mrmailbox_get_contact_encrinfo (mrmailbox_t*, uint32_t contact_id);
    311 int mrmailbox_delete_contact (mrmailbox_t*, uint32_t contact_id);
    312 mrcontact_t* mrmailbox_get_contact (mrmailbox_t*, uint32_t contact_id);
    313 
    314 
    315 /* Import/export and Tools */
    316 #define MR_IMEX_CANCEL 0
    317 #define MR_IMEX_EXPORT_SELF_KEYS 1 /* param1 is a directory where the keys are written to */
    318 #define MR_IMEX_IMPORT_SELF_KEYS 2 /* param1 is a directory where the keys are searched in and read from */
    319 #define MR_IMEX_EXPORT_BACKUP 11 /* param1 is a directory where the backup is written to */
    320 #define MR_IMEX_IMPORT_BACKUP 12 /* param1 is the file with the backup to import */
    321 #define MR_IMEX_EXPORT_SETUP_MESSAGE 20 /* param1 is a directory where the setup file is written to */
    322 #define MR_BAK_PREFIX "delta-chat"
    323 #define MR_BAK_SUFFIX "bak"
    324 void mrmailbox_imex (mrmailbox_t*, int what, const char* param1, const char* setup_code);
    325 char* mrmailbox_imex_has_backup (mrmailbox_t*, const char* dir);
    326 int mrmailbox_check_password (mrmailbox_t*, const char* pw);
    327 char* mrmailbox_create_setup_code (mrmailbox_t*);
    328 void mrmailbox_heartbeat (mrmailbox_t*);
    329 
    330 
    331 /* logging */
    332 void mrmailbox_log_error (mrmailbox_t*, int code, const char* msg, ...);
    333 void mrmailbox_log_error_if (int* condition, mrmailbox_t*, int code, const char* msg, ...);
    334 void mrmailbox_log_warning (mrmailbox_t*, int code, const char* msg, ...);
    335 void mrmailbox_log_info (mrmailbox_t*, int code, const char* msg, ...);
    336 void mrmailbox_log_vprintf (mrmailbox_t*, int event, int code, const char* msg, va_list);
    337 int mrmailbox_get_thread_index (void);
    338 
    339 
    340 /* error codes */
    341 #define MR_ERR_SELF_NOT_IN_GROUP 1
    342 #define MR_ERR_NONETWORK 2
    343 
    344 
    345 /* deprecated functions */
    346 int mrchat_set_draft (mrchat_t*, const char* msg); /* deprecated - use mrmailbox_set_draft() instead */
    347 
    348 
    349 /* library-internal */
    350 uint32_t mrmailbox_send_msg_object (mrmailbox_t*, uint32_t chat_id, mrmsg_t*);
    351 void mrmailbox_connect_to_imap (mrmailbox_t*, mrjob_t*);
    352 void mrmailbox_wake_lock (mrmailbox_t*);
    353 void mrmailbox_wake_unlock (mrmailbox_t*);
    354 int mrmailbox_poke_eml_file (mrmailbox_t*, const char* file);
    355 int mrmailbox_is_reply_to_known_message__ (mrmailbox_t*, mrmimeparser_t*);
    356 int mrmailbox_is_reply_to_messenger_message__ (mrmailbox_t*, mrmimeparser_t*);
    357 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);
    358 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);
    359 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);
    360 int mrmailbox_get_archived_count__ (mrmailbox_t*);
    361 int mrmailbox_reset_tables (mrmailbox_t*, int bits); /* reset tables but leaves server configuration, 1=jobs, 2=e2ee, 8=rest but server config */
    362 size_t mrmailbox_get_real_contact_cnt__ (mrmailbox_t*);
    363 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);
    364 int mrmailbox_get_contact_origin__ (mrmailbox_t*, uint32_t id, int* ret_blocked);
    365 int mrmailbox_is_contact_blocked__ (mrmailbox_t*, uint32_t id);
    366 int mrmailbox_real_contact_exists__ (mrmailbox_t*, uint32_t id);
    367 int mrmailbox_contact_addr_equals__ (mrmailbox_t*, uint32_t contact_id, const char* other_addr);
    368 void mrmailbox_scaleup_contact_origin__ (mrmailbox_t*, uint32_t contact_id, int origin);
    369 void mrmailbox_unarchive_chat__ (mrmailbox_t*, uint32_t chat_id);
    370 size_t mrmailbox_get_chat_cnt__ (mrmailbox_t*);
    371 uint32_t mrmailbox_create_or_lookup_nchat_by_contact_id__ (mrmailbox_t*, uint32_t contact_id);
    372 uint32_t mrmailbox_lookup_real_nchat_by_contact_id__ (mrmailbox_t*, uint32_t contact_id);
    373 int mrmailbox_get_total_msg_count__ (mrmailbox_t*, uint32_t chat_id);
    374 int mrmailbox_get_fresh_msg_count__ (mrmailbox_t*, uint32_t chat_id);
    375 uint32_t mrmailbox_get_last_deaddrop_fresh_msg__ (mrmailbox_t*);
    376 void mrmailbox_send_msg_to_smtp (mrmailbox_t*, mrjob_t*);
    377 void mrmailbox_send_msg_to_imap (mrmailbox_t*, mrjob_t*);
    378 int mrmailbox_add_contact_to_chat__ (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    379 int mrmailbox_is_contact_in_chat__ (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    380 int mrmailbox_get_chat_contact_count__ (mrmailbox_t*, uint32_t chat_id);
    381 int mrmailbox_group_explicitly_left__ (mrmailbox_t*, const char* grpid);
    382 void mrmailbox_set_group_explicitly_left__ (mrmailbox_t*, const char* grpid);
    383 size_t mrmailbox_get_real_msg_cnt__ (mrmailbox_t*); /* the number of messages assigned to real chat (!=deaddrop, !=trash) */
    384 size_t mrmailbox_get_deaddrop_msg_cnt__ (mrmailbox_t*);
    385 int mrmailbox_rfc724_mid_cnt__ (mrmailbox_t*, const char* rfc724_mid);
    386 int mrmailbox_rfc724_mid_exists__ (mrmailbox_t*, const char* rfc724_mid, char** ret_server_folder, uint32_t* ret_server_uid);
    387 void mrmailbox_update_server_uid__ (mrmailbox_t*, const char* rfc724_mid, const char* server_folder, uint32_t server_uid);
    388 void mrmailbox_update_msg_chat_id__ (mrmailbox_t*, uint32_t msg_id, uint32_t chat_id);
    389 void mrmailbox_update_msg_state__ (mrmailbox_t*, uint32_t msg_id, int state);
    390 void mrmailbox_delete_msg_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    391 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 */
    392 void mrmailbox_send_mdn (mrmailbox_t*, mrjob_t* job);
    393 void mrmailbox_markseen_msg_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    394 void mrmailbox_markseen_mdn_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    395 
    396 
    397 /* library private: end-to-end-encryption */
    398 #define MR_E2EE_DEFAULT_ENABLED 1
    399 #define MR_MDNS_DEFAULT_ENABLED 1
    400 
    401 typedef struct mrmailbox_e2ee_helper_t {
    402  int m_encryption_successfull;
    403  void* m_cdata_to_free;
    404 } mrmailbox_e2ee_helper_t;
    405 
    406 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*);
    407 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 */
    408 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! */
    409 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 */
    410 
    411 
    412 #ifdef __cplusplus
    413 } /* /extern "C" */
    414 #endif
    415 #endif /* __MRMAILBOX_H__ */
    int mrmailbox_add_address_book(mrmailbox_t *mailbox, const char *adr_book)
    Add a number of contacts.
    Definition: mrmailbox.c:4337
    +
    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 "mrlot.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_image_msg (mrmailbox_t*, uint32_t chat_id, const char* file, const char* filemime, int width, int height);
    259 uint32_t mrmailbox_send_video_msg (mrmailbox_t*, uint32_t chat_id, const char* file, const char* filemime, int width, int height, int duration);
    260 uint32_t mrmailbox_send_voice_msg (mrmailbox_t*, uint32_t chat_id, const char* file, const char* filemime, int duration);
    261 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);
    262 uint32_t mrmailbox_send_file_msg (mrmailbox_t*, uint32_t chat_id, const char* file, const char* filemime);
    263 uint32_t mrmailbox_send_vcard_msg (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    264 void mrmailbox_set_draft (mrmailbox_t*, uint32_t chat_id, const char*);
    265 
    266 #define MR_GCM_ADDDAYMARKER 0x01
    267 mrarray_t* mrmailbox_get_chat_msgs (mrmailbox_t*, uint32_t chat_id, uint32_t flags, uint32_t marker1before);
    268 int mrmailbox_get_total_msg_count (mrmailbox_t*, uint32_t chat_id);
    269 int mrmailbox_get_fresh_msg_count (mrmailbox_t*, uint32_t chat_id);
    270 mrarray_t* mrmailbox_get_fresh_msgs (mrmailbox_t*);
    271 void mrmailbox_marknoticed_chat (mrmailbox_t*, uint32_t chat_id);
    272 mrarray_t* mrmailbox_get_chat_media (mrmailbox_t*, uint32_t chat_id, int msg_type, int or_msg_type);
    273 uint32_t mrmailbox_get_next_media (mrmailbox_t*, uint32_t curr_msg_id, int dir);
    274 
    275 void mrmailbox_archive_chat (mrmailbox_t*, uint32_t chat_id, int archive);
    276 void mrmailbox_delete_chat (mrmailbox_t*, uint32_t chat_id);
    277 
    278 mrarray_t* mrmailbox_get_chat_contacts (mrmailbox_t*, uint32_t chat_id);
    279 mrarray_t* mrmailbox_search_msgs (mrmailbox_t*, uint32_t chat_id, const char* query);
    280 
    281 mrchat_t* mrmailbox_get_chat (mrmailbox_t*, uint32_t chat_id);
    282 
    283 
    284 /* Handle group chats */
    285 uint32_t mrmailbox_create_group_chat (mrmailbox_t*, const char* name);
    286 int mrmailbox_is_contact_in_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    287 int mrmailbox_add_contact_to_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    288 int mrmailbox_remove_contact_from_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    289 int mrmailbox_set_chat_name (mrmailbox_t*, uint32_t chat_id, const char* name);
    290 int mrmailbox_set_chat_profile_image (mrmailbox_t*, uint32_t chat_id, const char* image);
    291 
    292 
    293 /* Handle messages */
    294 char* mrmailbox_get_msg_info (mrmailbox_t*, uint32_t msg_id);
    295 void mrmailbox_delete_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt);
    296 void mrmailbox_forward_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt, uint32_t chat_id);
    297 void mrmailbox_marknoticed_contact (mrmailbox_t*, uint32_t contact_id);
    298 void mrmailbox_markseen_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt);
    299 void mrmailbox_star_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt, int star);
    300 mrmsg_t* mrmailbox_get_msg (mrmailbox_t*, uint32_t msg_id);
    301 
    302 
    303 /* Handle contacts */
    304 uint32_t mrmailbox_create_contact (mrmailbox_t*, const char* name, const char* addr);
    305 int mrmailbox_add_address_book (mrmailbox_t*, const char*);
    306 mrarray_t* mrmailbox_get_known_contacts (mrmailbox_t*, const char* query);
    307 int mrmailbox_get_blocked_count (mrmailbox_t*);
    309 void mrmailbox_block_contact (mrmailbox_t*, uint32_t contact_id, int block);
    310 char* mrmailbox_get_contact_encrinfo (mrmailbox_t*, uint32_t contact_id);
    311 int mrmailbox_delete_contact (mrmailbox_t*, uint32_t contact_id);
    312 mrcontact_t* mrmailbox_get_contact (mrmailbox_t*, uint32_t contact_id);
    313 
    314 
    315 /* Import/export and Tools */
    316 #define MR_IMEX_CANCEL 0
    317 #define MR_IMEX_EXPORT_SELF_KEYS 1 /* param1 is a directory where the keys are written to */
    318 #define MR_IMEX_IMPORT_SELF_KEYS 2 /* param1 is a directory where the keys are searched in and read from */
    319 #define MR_IMEX_EXPORT_BACKUP 11 /* param1 is a directory where the backup is written to */
    320 #define MR_IMEX_IMPORT_BACKUP 12 /* param1 is the file with the backup to import */
    321 #define MR_IMEX_EXPORT_SETUP_MESSAGE 20 /* param1 is a directory where the setup file is written to */
    322 #define MR_BAK_PREFIX "delta-chat"
    323 #define MR_BAK_SUFFIX "bak"
    324 void mrmailbox_imex (mrmailbox_t*, int what, const char* param1, const char* setup_code);
    325 char* mrmailbox_imex_has_backup (mrmailbox_t*, const char* dir);
    326 int mrmailbox_check_password (mrmailbox_t*, const char* pw);
    327 char* mrmailbox_create_setup_code (mrmailbox_t*);
    328 void mrmailbox_heartbeat (mrmailbox_t*);
    329 
    330 
    331 /* logging */
    332 void mrmailbox_log_error (mrmailbox_t*, int code, const char* msg, ...);
    333 void mrmailbox_log_error_if (int* condition, mrmailbox_t*, int code, const char* msg, ...);
    334 void mrmailbox_log_warning (mrmailbox_t*, int code, const char* msg, ...);
    335 void mrmailbox_log_info (mrmailbox_t*, int code, const char* msg, ...);
    336 void mrmailbox_log_vprintf (mrmailbox_t*, int event, int code, const char* msg, va_list);
    337 int mrmailbox_get_thread_index (void);
    338 
    339 
    340 /* error codes */
    341 #define MR_ERR_SELF_NOT_IN_GROUP 1
    342 #define MR_ERR_NONETWORK 2
    343 
    344 
    345 /* deprecated functions */
    346 int mrchat_set_draft (mrchat_t*, const char* msg); /* deprecated - use mrmailbox_set_draft() instead */
    347 #define mrpoortext_t mrlot_t
    348 #define mrpoortext_unref mrlot_unref
    349 
    350 
    351 /* library-internal */
    352 uint32_t mrmailbox_send_msg_object (mrmailbox_t*, uint32_t chat_id, mrmsg_t*);
    353 void mrmailbox_connect_to_imap (mrmailbox_t*, mrjob_t*);
    354 void mrmailbox_wake_lock (mrmailbox_t*);
    355 void mrmailbox_wake_unlock (mrmailbox_t*);
    356 int mrmailbox_poke_eml_file (mrmailbox_t*, const char* file);
    357 int mrmailbox_is_reply_to_known_message__ (mrmailbox_t*, mrmimeparser_t*);
    358 int mrmailbox_is_reply_to_messenger_message__ (mrmailbox_t*, mrmimeparser_t*);
    359 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);
    360 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);
    361 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);
    362 int mrmailbox_get_archived_count__ (mrmailbox_t*);
    363 int mrmailbox_reset_tables (mrmailbox_t*, int bits); /* reset tables but leaves server configuration, 1=jobs, 2=e2ee, 8=rest but server config */
    364 size_t mrmailbox_get_real_contact_cnt__ (mrmailbox_t*);
    365 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);
    366 int mrmailbox_get_contact_origin__ (mrmailbox_t*, uint32_t id, int* ret_blocked);
    367 int mrmailbox_is_contact_blocked__ (mrmailbox_t*, uint32_t id);
    368 int mrmailbox_real_contact_exists__ (mrmailbox_t*, uint32_t id);
    369 int mrmailbox_contact_addr_equals__ (mrmailbox_t*, uint32_t contact_id, const char* other_addr);
    370 void mrmailbox_scaleup_contact_origin__ (mrmailbox_t*, uint32_t contact_id, int origin);
    371 void mrmailbox_unarchive_chat__ (mrmailbox_t*, uint32_t chat_id);
    372 size_t mrmailbox_get_chat_cnt__ (mrmailbox_t*);
    373 uint32_t mrmailbox_create_or_lookup_nchat_by_contact_id__ (mrmailbox_t*, uint32_t contact_id);
    374 uint32_t mrmailbox_lookup_real_nchat_by_contact_id__ (mrmailbox_t*, uint32_t contact_id);
    375 int mrmailbox_get_total_msg_count__ (mrmailbox_t*, uint32_t chat_id);
    376 int mrmailbox_get_fresh_msg_count__ (mrmailbox_t*, uint32_t chat_id);
    377 uint32_t mrmailbox_get_last_deaddrop_fresh_msg__ (mrmailbox_t*);
    378 void mrmailbox_send_msg_to_smtp (mrmailbox_t*, mrjob_t*);
    379 void mrmailbox_send_msg_to_imap (mrmailbox_t*, mrjob_t*);
    380 int mrmailbox_add_contact_to_chat__ (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    381 int mrmailbox_is_contact_in_chat__ (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    382 int mrmailbox_get_chat_contact_count__ (mrmailbox_t*, uint32_t chat_id);
    383 int mrmailbox_group_explicitly_left__ (mrmailbox_t*, const char* grpid);
    384 void mrmailbox_set_group_explicitly_left__ (mrmailbox_t*, const char* grpid);
    385 size_t mrmailbox_get_real_msg_cnt__ (mrmailbox_t*); /* the number of messages assigned to real chat (!=deaddrop, !=trash) */
    386 size_t mrmailbox_get_deaddrop_msg_cnt__ (mrmailbox_t*);
    387 int mrmailbox_rfc724_mid_cnt__ (mrmailbox_t*, const char* rfc724_mid);
    388 int mrmailbox_rfc724_mid_exists__ (mrmailbox_t*, const char* rfc724_mid, char** ret_server_folder, uint32_t* ret_server_uid);
    389 void mrmailbox_update_server_uid__ (mrmailbox_t*, const char* rfc724_mid, const char* server_folder, uint32_t server_uid);
    390 void mrmailbox_update_msg_chat_id__ (mrmailbox_t*, uint32_t msg_id, uint32_t chat_id);
    391 void mrmailbox_update_msg_state__ (mrmailbox_t*, uint32_t msg_id, int state);
    392 void mrmailbox_delete_msg_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    393 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 */
    394 void mrmailbox_send_mdn (mrmailbox_t*, mrjob_t* job);
    395 void mrmailbox_markseen_msg_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    396 void mrmailbox_markseen_mdn_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    397 
    398 
    399 /* library private: end-to-end-encryption */
    400 #define MR_E2EE_DEFAULT_ENABLED 1
    401 #define MR_MDNS_DEFAULT_ENABLED 1
    402 
    403 typedef struct mrmailbox_e2ee_helper_t {
    404  int m_encryption_successfull;
    405  void* m_cdata_to_free;
    406 } mrmailbox_e2ee_helper_t;
    407 
    408 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*);
    409 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 */
    410 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! */
    411 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 */
    412 
    413 
    414 #ifdef __cplusplus
    415 } /* /extern "C" */
    416 #endif
    417 #endif /* __MRMAILBOX_H__ */
    int mrmailbox_add_address_book(mrmailbox_t *mailbox, const char *adr_book)
    Add a number of contacts.
    Definition: mrmailbox.c:4337
    uint32_t mrmailbox_create_group_chat(mrmailbox_t *mailbox, const char *chat_name)
    Create a new group chat.
    Definition: mrmailbox.c:3625
    uint32_t mrmailbox_create_contact(mrmailbox_t *mailbox, const char *name, const char *addr)
    Add a single contact.
    Definition: mrmailbox.c:4294
    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:3247
    @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    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:3980
    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
    +
    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:2109
    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:3462
    int mrmailbox_delete_contact(mrmailbox_t *mailbox, uint32_t contact_id)
    Delete a contact.
    Definition: mrmailbox.c:4825
    diff --git a/docs/html/mrmsg_8h_source.html b/docs/html/mrmsg_8h_source.html index 824abb3c..1d97adc8 100644 --- a/docs/html/mrmsg_8h_source.html +++ b/docs/html/mrmsg_8h_source.html @@ -89,34 +89,34 @@ 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 {
    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
    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);
    136 
    137 void mrmsg_latefiling_mediasize (mrmsg_t*, int width, int height, int duration);
    138 
    139 
    140 /* library-private */
    141 #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 "
    142 int mrmsg_set_from_stmt__ (mrmsg_t*, sqlite3_stmt* row, int row_offset); /* row order is MR_MSG_FIELDS */
    143 int mrmsg_load_from_db__ (mrmsg_t*, mrmailbox_t*, uint32_t id);
    144 int mrmsg_is_increation__ (const mrmsg_t*);
    145 char* mrmsg_get_summarytext_by_raw (int type, const char* text, mrparam_t*, int approx_bytes); /* the returned value must be free()'d */
    146 void mrmsg_save_param_to_disk__ (mrmsg_t*);
    147 void mrmsg_guess_msgtype_from_suffix (const char* pathNfilename, int* ret_msgtype, char** ret_mime);
    148 void mrmsg_get_authorNtitle_from_filename (const char* pathNfilename, char** ret_author, char** ret_title);
    149 
    150 #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)
    151 #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. */
    152 #define MR_MSG_MAKE_SUFFIX_SEARCHABLE(a) ((a)==MR_MSG_IMAGE || (a)==MR_MSG_GIF || (a)==MR_MSG_VOICE)
    153 
    154 #define APPROX_SUBJECT_CHARS 32 /* as we do not cut inside words, this results in about 32-42 characters.
    155  Do not use too long subjects - we add a tag after the subject which gets truncated by the clients otherwise.
    156  It should also be very clear, the subject is _not_ the whole message.
    157  The value is also used for CC:-summaries */
    158 
    159 
    160 #ifdef __cplusplus
    161 } /* /extern "C" */
    162 #endif
    163 #endif /* __MRMSG_H__ */
    An object representing a single mailbox.
    Definition: mrmailbox.h:184
    -
    int mrmsg_is_systemcmd(mrmsg_t *msg)
    Check if the message is a system command.
    Definition: mrmsg.c:627
    +
    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
    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);
    136 
    137 void mrmsg_latefiling_mediasize (mrmsg_t*, int width, int height, int duration);
    138 
    139 
    140 /* library-private */
    141 #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 "
    142 int mrmsg_set_from_stmt__ (mrmsg_t*, sqlite3_stmt* row, int row_offset); /* row order is MR_MSG_FIELDS */
    143 int mrmsg_load_from_db__ (mrmsg_t*, mrmailbox_t*, uint32_t id);
    144 int mrmsg_is_increation__ (const mrmsg_t*);
    145 char* mrmsg_get_summarytext_by_raw (int type, const char* text, mrparam_t*, int approx_bytes); /* the returned value must be free()'d */
    146 void mrmsg_save_param_to_disk__ (mrmsg_t*);
    147 void mrmsg_guess_msgtype_from_suffix (const char* pathNfilename, int* ret_msgtype, char** ret_mime);
    148 void mrmsg_get_authorNtitle_from_filename (const char* pathNfilename, char** ret_author, char** ret_title);
    149 
    150 #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)
    151 #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. */
    152 #define MR_MSG_MAKE_SUFFIX_SEARCHABLE(a) ((a)==MR_MSG_IMAGE || (a)==MR_MSG_GIF || (a)==MR_MSG_VOICE)
    153 
    154 #define APPROX_SUBJECT_CHARS 32 /* as we do not cut inside words, this results in about 32-42 characters.
    155  Do not use too long subjects - we add a tag after the subject which gets truncated by the clients otherwise.
    156  It should also be very clear, the subject is _not_ the whole message.
    157  The value is also used for CC:-summaries */
    158 
    159 
    160 #ifdef __cplusplus
    161 } /* /extern "C" */
    162 #endif
    163 #endif /* __MRMSG_H__ */
    An object representing a single mailbox.
    Definition: mrmailbox.h:184
    +
    int mrmsg_is_systemcmd(mrmsg_t *msg)
    Check if the message is a system command.
    Definition: mrmsg.c:647
    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:548
    +
    char * mrmsg_get_summarytext(mrmsg_t *msg, int approx_characters)
    Get a message summary as a single line of text.
    Definition: mrmsg.c:568
    uint64_t mrmsg_get_filebytes(mrmsg_t *msg)
    Get the size of the file.
    Definition: mrmsg.c:319
    uint32_t m_chat_id
    Chat ID the message belongs to.
    Definition: mrmsg.h:69
    int mrmsg_get_state(mrmsg_t *msg)
    Get the state of a message.
    Definition: mrmsg.c:160
    -
    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:506
    -
    mrpoortext_t * mrmsg_get_mediainfo(mrmsg_t *msg)
    Get real author and title.
    Definition: mrmsg.c:352
    +
    mrlot_t * mrmsg_get_mediainfo(mrmsg_t *msg)
    Get real author and title.
    Definition: mrmsg.c:357
    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:921
    +
    void mrmsg_latefiling_mediasize(mrmsg_t *msg, int width, int height, int duration)
    Late filing information to a message.
    Definition: mrmsg.c:941
    +
    mrlot_t * mrmsg_get_summary(mrmsg_t *msg, mrchat_t *chat)
    Get a summary for a message.
    Definition: mrmsg.c:526
    uint32_t m_to_id
    Contact ID of the recipient.
    Definition: mrmsg.h:62
    +
    An object containing a set of values.
    Definition: mrlot.h:36
    uint32_t m_from_id
    Contact ID of the sender.
    Definition: mrmsg.h:55
    -
    int mrmsg_get_duration(mrmsg_t *msg)
    Get duration of audio or video.
    Definition: mrmsg.c:460
    -
    int mrmsg_is_starred(mrmsg_t *msg)
    Check if a message is starred.
    Definition: mrmsg.c:572
    +
    int mrmsg_get_duration(mrmsg_t *msg)
    Get duration of audio or video.
    Definition: mrmsg.c:465
    +
    int mrmsg_is_starred(mrmsg_t *msg)
    Check if a message is starred.
    Definition: mrmsg.c:592
    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:219
    -
    int mrmsg_is_increation(mrmsg_t *msg)
    Check if a message is still in creation.
    Definition: mrmsg.c:867
    +
    int mrmsg_is_increation(mrmsg_t *msg)
    Check if a message is still in creation.
    Definition: mrmsg.c:887
    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:278
    -
    int mrmsg_get_width(mrmsg_t *msg)
    Get width of image or video.
    Definition: mrmsg.c:413
    +
    int mrmsg_get_width(mrmsg_t *msg)
    Get width of image or video.
    Definition: mrmsg.c:418
    time_t mrmsg_get_timestamp(mrmsg_t *msg)
    Get message time.
    Definition: mrmsg.c:178
    -
    int mrmsg_get_showpadlock(mrmsg_t *msg)
    Check if a padlock should be shown beside the message.
    Definition: mrmsg.c:478
    +
    int mrmsg_get_showpadlock(mrmsg_t *msg)
    Check if a padlock should be shown beside the message.
    Definition: mrmsg.c:483
    char * mrmsg_get_filename(mrmsg_t *msg)
    Get base file name without path.
    Definition: mrmsg.c:246
    char * mrmsg_get_text(mrmsg_t *msg)
    Get the text of the message.
    Definition: mrmsg.c:198
    -
    int mrmsg_is_forwarded(mrmsg_t *msg)
    Check if the message is a forwarded message.
    Definition: mrmsg.c:600
    -
    int mrmsg_get_height(mrmsg_t *msg)
    Get height of image or video.
    Definition: mrmsg.c:438
    +
    int mrmsg_is_forwarded(mrmsg_t *msg)
    Check if the message is a forwarded message.
    Definition: mrmsg.c:620
    +
    int mrmsg_get_height(mrmsg_t *msg)
    Get height of image or video.
    Definition: mrmsg.c:443
    An object representing a single chat in memory.
    Definition: mrchat.h:39
    diff --git a/docs/html/mrpoortext_8h_source.html b/docs/html/mrpoortext_8h_source.html index 4ec9093b..fb8e5b24 100644 --- a/docs/html/mrpoortext_8h_source.html +++ b/docs/html/mrpoortext_8h_source.html @@ -89,14 +89,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    mrpoortext.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 __MRPOORTEXT_H__
    24 #define __MRPOORTEXT_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    35 typedef struct mrpoortext_t
    36 {
    44 
    45  char* m_text1;
    46  char* m_text2;
    47  time_t m_timestamp;
    48  int m_state;
    49 } mrpoortext_t;
    50 
    51 
    52 #define MR_TEXT1_NORMAL 0
    53 #define MR_TEXT1_DRAFT 1
    54 #define MR_TEXT1_USERNAME 2
    55 #define MR_TEXT1_SELF 3
    56 
    57 
    58 mrpoortext_t* mrpoortext_new ();
    59 void mrpoortext_empty (mrpoortext_t*);
    61 
    62 
    63 #define MR_SUMMARY_CHARACTERS 160
    64 void mrpoortext_fill (mrpoortext_t*, const mrmsg_t*, const mrchat_t*, const mrcontact_t*);
    65 
    66 
    67 #ifdef __cplusplus
    68 } /* /extern "C" */
    69 #endif
    70 #endif /* __MRPOORTEXT_H__ */
    void mrpoortext_unref(mrpoortext_t *poortext)
    Frees a poortext object.
    Definition: mrpoortext.c:55
    -
    char * m_text2
    The meaning is defined by the creator of the object.
    Definition: mrpoortext.h:46
    -
    int m_state
    Typically a MR_MSG_STATE_* constant.
    Definition: mrpoortext.h:48
    -
    time_t m_timestamp
    Typically a message timestamp.
    Definition: mrpoortext.h:47
    -
    char * m_text1
    The meaning is defined by m_text1_meaning and by the creator of the object.
    Definition: mrpoortext.h:45
    -
    An object representing text with some attributes.
    Definition: mrpoortext.h:35
    -
    int m_text1_meaning
    Defines the meaning of the m_text1 string.
    Definition: mrpoortext.h:43
    -
    +
    1 /* deprecated */
    2