diff --git a/docs/html/annotated.html b/docs/html/annotated.html index 0c302a5f..94506d0e 100644 --- a/docs/html/annotated.html +++ b/docs/html/annotated.html @@ -93,8 +93,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');  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 - Cmrparam_tAn object for handling key=value parameter lists - Cmrpoortext_tAn object representing text with some attributes + Cmrpoortext_tAn object representing text with some attributes diff --git a/docs/html/classes.html b/docs/html/classes.html index e2e93d73..860a680e 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   mrpoortext_t   
mrchatlist_t   mrmailbox_t   mrparam_t   
mrchat_t   mrcontact_t   mrmsg_t   
mrchatlist_t   mrmailbox_t   mrpoortext_t   
mrarray_t   
diff --git a/docs/html/functions.html b/docs/html/functions.html index 5f1e7dac..3f7fd77f 100644 --- a/docs/html/functions.html +++ b/docs/html/functions.html @@ -486,24 +486,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • mrmsg_unref() : mrmsg_t
  • -
  • mrparam_empty() -: mrparam_t -
  • -
  • mrparam_exists() -: mrparam_t -
  • -
  • mrparam_get() -: mrparam_t -
  • -
  • mrparam_get_int() -: mrparam_t -
  • -
  • mrparam_set() -: mrparam_t -
  • -
  • mrparam_set_int() -: mrparam_t -
  • mrpoortext_unref() : mrpoortext_t
  • diff --git a/docs/html/functions_func.html b/docs/html/functions_func.html index d1e3c3ef..2642fb80 100644 --- a/docs/html/functions_func.html +++ b/docs/html/functions_func.html @@ -415,24 +415,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • mrmsg_unref() : mrmsg_t
  • -
  • mrparam_empty() -: mrparam_t -
  • -
  • mrparam_exists() -: mrparam_t -
  • -
  • mrparam_get() -: mrparam_t -
  • -
  • mrparam_get_int() -: mrparam_t -
  • -
  • mrparam_set() -: mrparam_t -
  • -
  • mrparam_set_int() -: mrparam_t -
  • mrpoortext_unref() : mrpoortext_t
  • diff --git a/docs/html/mrarray_8h_source.html b/docs/html/mrarray_8h_source.html index b86c9144..f3169b43 100644 --- a/docs/html/mrarray_8h_source.html +++ b/docs/html/mrarray_8h_source.html @@ -89,12 +89,12 @@ 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_max;
    45  size_t m_len;
    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
    -
    size_t mrarray_get_cnt(mrarray_t *array)
    Find out the number of items in an array.
    Definition: mrarray.c:162
    +
    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
    +
    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:73
    +
    void mrarray_unref(mrarray_t *array)
    Free an array object.
    Definition: mrarray.c:67
    mrmailbox_t * m_mailbox
    The mailbox the array belongs to.
    Definition: mrarray.h:41
    -
    uint32_t mrarray_get_id(mrarray_t *array, size_t index)
    Get the item at the given index as an ID.
    Definition: mrarray.c:183
    +
    uint32_t mrarray_get_id(mrarray_t *array, size_t index)
    Get the item at the given index as an ID.
    Definition: mrarray.c:156
    -
    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 
    129  char* m_grpid;
    130  mrparam_t* m_param;
    131 } mrchat_t;
    132 
    133 
    134 mrchat_t* mrchat_new (mrmailbox_t*);
    135 void mrchat_empty (mrchat_t*);
    136 void mrchat_unref (mrchat_t*);
    137 
    141 
    142 /* library-internal */
    143 int mrchat_load_from_db__ (mrchat_t*, uint32_t id);
    144 int mrchat_update_param__ (mrchat_t*);
    145 
    146 #define MR_CHAT_PREFIX "Chat:" /* you MUST NOT modify this or the following strings */
    147 #define MR_CHATS_FOLDER "Chats" /* if we want to support Gma'l-labels - "Chats" is a reserved word for Gma'l */
    148 
    149 
    150 #ifdef __cplusplus
    151 } /* /extern "C" */
    152 #endif
    153 #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 
    129  char* m_grpid;
    130  mrparam_t* m_param;
    131 } mrchat_t;
    132 
    133 
    134 mrchat_t* mrchat_new (mrmailbox_t*);
    135 void mrchat_empty (mrchat_t*);
    136 void mrchat_unref (mrchat_t*);
    137 
    141 
    142 /* library-internal */
    143 int mrchat_load_from_db__ (mrchat_t*, uint32_t id);
    144 int mrchat_update_param__ (mrchat_t*);
    145 
    146 #define MR_CHAT_PREFIX "Chat:" /* you MUST NOT modify this or the following strings */
    147 #define MR_CHATS_FOLDER "Chats" /* if we want to support Gma'l-labels - "Chats" is a reserved word for Gma'l */
    148 
    149 
    150 #ifdef __cplusplus
    151 } /* /extern "C" */
    152 #endif
    153 #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
    mrmailbox_t * m_mailbox
    The mailbox object the chat belongs to.
    Definition: mrchat.h:111
    int m_archived
    Flag for the archived state.
    Definition: mrchat.h:126
    char * m_name
    Name of the chat.
    Definition: mrchat.h:86
    -
    An object for handling key=value parameter lists.
    Definition: mrparam.h:44
    char * mrchat_get_profile_image(mrchat_t *chat)
    Get the chat's profile image.
    Definition: mrchat.c:151
    time_t m_draft_timestamp
    Timestamp of the draft.
    Definition: mrchat.h:96
    int mrchat_is_unpromoted(mrchat_t *chat)
    Check if a chat is still unpromoted.
    Definition: mrchat.c:130
    diff --git a/docs/html/mrjob_8h_source.html b/docs/html/mrjob_8h_source.html index ed65048b..8dd474d5 100644 --- a/docs/html/mrjob_8h_source.html +++ b/docs/html/mrjob_8h_source.html @@ -89,8 +89,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    mrjob.h
    -
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Contact: r10s@b44t.com, http://b44t.com
    5  *
    6  * This program is free software: you can redistribute it and/or modify it under
    7  * the terms of the GNU General Public License as published by the Free Software
    8  * Foundation, either version 3 of the License, or (at your option) any later
    9  * version.
    10  *
    11  * This program is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    13  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    14  * details.
    15  *
    16  * You should have received a copy of the GNU General Public License along with
    17  * this program. If not, see http://www.gnu.org/licenses/ .
    18  *
    19  ******************************************************************************/
    20 
    21 
    22 #ifndef __MRJOB_H__
    23 #define __MRJOB_H__
    24 #ifdef __cplusplus
    25 extern "C" {
    26 #endif
    27 
    28 
    29 #define MRJ_DELETE_MSG_ON_IMAP 100 /* low priority ... */
    30 #define MRJ_MARKSEEN_MDN_ON_IMAP 102
    31 #define MRJ_SEND_MDN 105
    32 #define MRJ_MARKSEEN_MSG_ON_IMAP 110
    33 #define MRJ_SEND_MSG_TO_IMAP 700
    34 #define MRJ_SEND_MSG_TO_SMTP 800
    35 #define MRJ_CONNECT_TO_IMAP 900 /* ... high priority*/
    36 
    40 typedef struct mrjob_t
    41 {
    44  uint32_t m_job_id;
    45  int m_action;
    46  uint32_t m_foreign_id;
    47  mrparam_t* m_param;
    48  /* the following fields are set by the execution routines, m_param may also be modified */
    49  time_t m_start_again_at; /* 1=on next loop, >1=on timestamp, 0=delete job (default) */
    50 } mrjob_t;
    51 
    52 void mrjob_init_thread (mrmailbox_t*);
    53 void mrjob_exit_thread (mrmailbox_t*);
    54 uint32_t mrjob_add__ (mrmailbox_t*, int action, int foreign_id, const char* param); /* returns the job_id or 0 on errors. the job may or may not be done if the function returns. */
    55 void mrjob_kill_action__ (mrmailbox_t*, int action); /* delete all pending jobs with the given action */
    56 
    57 #define MR_AT_ONCE 0
    58 #define MR_INCREATION_POLL 2 /* this value does not increase the number of tries */
    59 #define MR_STANDARD_DELAY 3
    60 void mrjob_try_again_later (mrjob_t*, int initial_delay_seconds);
    61 
    62 
    63 #ifdef __cplusplus
    64 } /* /extern "C" */
    65 #endif
    66 #endif /* __MRJOB_H__ */
    67 
    An object representing a single mailbox.
    Definition: mrmailbox.h:184
    -
    An object for handling key=value parameter lists.
    Definition: mrparam.h:44
    +
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Contact: r10s@b44t.com, http://b44t.com
    5  *
    6  * This program is free software: you can redistribute it and/or modify it under
    7  * the terms of the GNU General Public License as published by the Free Software
    8  * Foundation, either version 3 of the License, or (at your option) any later
    9  * version.
    10  *
    11  * This program is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    13  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    14  * details.
    15  *
    16  * You should have received a copy of the GNU General Public License along with
    17  * this program. If not, see http://www.gnu.org/licenses/ .
    18  *
    19  ******************************************************************************/
    20 
    21 
    22 #ifndef __MRJOB_H__
    23 #define __MRJOB_H__
    24 #ifdef __cplusplus
    25 extern "C" {
    26 #endif
    27 
    28 
    29 #define MRJ_DELETE_MSG_ON_IMAP 100 /* low priority ... */
    30 #define MRJ_MARKSEEN_MDN_ON_IMAP 102
    31 #define MRJ_SEND_MDN 105
    32 #define MRJ_MARKSEEN_MSG_ON_IMAP 110
    33 #define MRJ_SEND_MSG_TO_IMAP 700
    34 #define MRJ_SEND_MSG_TO_SMTP 800
    35 #define MRJ_CONNECT_TO_IMAP 900 /* ... high priority*/
    36 
    40 typedef struct mrjob_t
    41 {
    44  uint32_t m_job_id;
    45  int m_action;
    46  uint32_t m_foreign_id;
    47  mrparam_t* m_param;
    48  /* the following fields are set by the execution routines, m_param may also be modified */
    49  time_t m_start_again_at; /* 1=on next loop, >1=on timestamp, 0=delete job (default) */
    50 } mrjob_t;
    51 
    52 void mrjob_init_thread (mrmailbox_t*);
    53 void mrjob_exit_thread (mrmailbox_t*);
    54 uint32_t mrjob_add__ (mrmailbox_t*, int action, int foreign_id, const char* param); /* returns the job_id or 0 on errors. the job may or may not be done if the function returns. */
    55 void mrjob_kill_action__ (mrmailbox_t*, int action); /* delete all pending jobs with the given action */
    56 
    57 #define MR_AT_ONCE 0
    58 #define MR_INCREATION_POLL 2 /* this value does not increase the number of tries */
    59 #define MR_STANDARD_DELAY 3
    60 void mrjob_try_again_later (mrjob_t*, int initial_delay_seconds);
    61 
    62 
    63 #ifdef __cplusplus
    64 } /* /extern "C" */
    65 #endif
    66 #endif /* __MRJOB_H__ */
    67 
    An object representing a single mailbox.
    Definition: mrmailbox.h:184
    -
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 /* Parse MIME body; this is the text part of an IMF, see https://tools.ietf.org/html/rfc5322
    24 mrmimeparser_t has no deep dependencies to mrmailbox_t or to the database
    25 (mrmailbox_t is used for logging only). */
    26 
    27 
    28 #ifndef __MRMIMEPARSER_H__
    29 #define __MRMIMEPARSER_H__
    30 #ifdef __cplusplus
    31 extern "C" {
    32 #endif
    33 
    34 
    38 typedef struct mrmimepart_t
    39 {
    41  int m_type; /*one of MR_MSG_* */
    42  int m_is_meta; /*meta parts contain eg. profile or group images and are only present if there is at least one "normal" part*/
    43  char* m_msg;
    44  char* m_msg_raw;
    45  int m_bytes;
    46  mrparam_t* m_param;
    47 } mrmimepart_t;
    48 
    49 
    53 typedef struct mrmimeparser_t
    54 {
    57  /* data, read-only, must not be free()'d (it is free()'d when the MrMimeParser object gets destructed) */
    58  carray* m_parts; /*array of mrmimepart_t objects*/
    59  struct mailmime* m_mimeroot;
    60  struct mailimf_fields* m_header; /* a pointer somewhere to the MIME data, must not be freed */
    61  char* m_subject;
    62  int m_is_send_by_messenger;
    63  int m_decrypted_and_validated;
    64  int m_decrypted_with_validation_errors;
    65  int m_decrypting_failed; /* set, if there are multipart/encrypted parts left after decryption */
    66  const char* m_blobdir;
    67 
    68  int m_is_forwarded;
    69 
    70  mrmailbox_t* m_mailbox;
    71 
    72  carray* m_reports; /* array of mailmime objects */
    73 
    74  int m_is_system_message;
    75 
    76 } mrmimeparser_t;
    77 
    78 
    79 mrmimeparser_t* mrmimeparser_new (const char* blobdir, mrmailbox_t*);
    80 void mrmimeparser_unref (mrmimeparser_t*);
    81 void mrmimeparser_empty (mrmimeparser_t*);
    82 
    83 /* The data returned from Parse() must not be freed (it is free()'d when the MrMimeParser object gets destructed)
    84 Unless memory-allocation-errors occur, Parse() returns at least one empty part.
    85 (this is because we want to add even these message to our database to avoid reading them several times.
    86 of course, these empty messages are not added to any chat) */
    87 void mrmimeparser_parse (mrmimeparser_t*, const char* body_not_terminated, size_t body_bytes);
    88 
    89 /* mrmimeparser_get_last_nonmeta() gets the _last_ part _not_ flagged with m_is_meta. */
    90 mrmimepart_t* mrmimeparser_get_last_nonmeta (mrmimeparser_t*);
    91 #define mrmimeparser_has_nonmeta(a) (mrmimeparser_get_last_nonmeta((a))!=NULL)
    92 
    93 /* mrmimeparser_is_mailinglist_message() just checks if there is a `List-ID`-header. */
    94 int mrmimeparser_is_mailinglist_message (mrmimeparser_t*);
    95 
    96 /* low-level-tools for working with mailmime structures directly */
    97 char* mr_find_first_addr (const struct mailimf_mailbox_list*); /*the result must be freed*/
    98 char* mr_normalize_addr (const char*); /*the result must be freed*/
    99 struct mailimf_fields* mr_find_mailimf_fields(struct mailmime*); /*the result is a pointer to mime, must not be freed*/
    100 struct mailimf_field* mr_find_mailimf_field (struct mailimf_fields*, int wanted_fld_type); /*the result is a pointer to mime, must not be freed*/
    101 struct mailimf_optional_field* mr_find_mailimf_field2(struct mailimf_fields*, const char* wanted_fld_name);
    102 struct mailmime_parameter* mr_find_ct_parameter (struct mailmime*, const char* name);
    103 int mr_mime_transfer_decode(struct mailmime*, const char** ret_decoded_data, size_t* ret_decoded_data_bytes, char** ret_to_mmap_string_unref);
    104 
    105 
    106 #ifdef MR_USE_MIME_DEBUG
    107 void mr_print_mime(struct mailmime * mime);
    108 #endif
    109 
    110 
    111 #ifdef __cplusplus
    112 } /* /extern "C" */
    113 #endif
    114 #endif /* __MRMIMEPARSER_H__ */
    115 
    An object representing a single mailbox.
    Definition: mrmailbox.h:184
    -
    An object for handling key=value parameter lists.
    Definition: mrparam.h:44
    +
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 /* Parse MIME body; this is the text part of an IMF, see https://tools.ietf.org/html/rfc5322
    24 mrmimeparser_t has no deep dependencies to mrmailbox_t or to the database
    25 (mrmailbox_t is used for logging only). */
    26 
    27 
    28 #ifndef __MRMIMEPARSER_H__
    29 #define __MRMIMEPARSER_H__
    30 #ifdef __cplusplus
    31 extern "C" {
    32 #endif
    33 
    34 
    38 typedef struct mrmimepart_t
    39 {
    41  int m_type; /*one of MR_MSG_* */
    42  int m_is_meta; /*meta parts contain eg. profile or group images and are only present if there is at least one "normal" part*/
    43  char* m_msg;
    44  char* m_msg_raw;
    45  int m_bytes;
    46  mrparam_t* m_param;
    47 } mrmimepart_t;
    48 
    49 
    53 typedef struct mrmimeparser_t
    54 {
    57  /* data, read-only, must not be free()'d (it is free()'d when the MrMimeParser object gets destructed) */
    58  carray* m_parts; /*array of mrmimepart_t objects*/
    59  struct mailmime* m_mimeroot;
    60  struct mailimf_fields* m_header; /* a pointer somewhere to the MIME data, must not be freed */
    61  char* m_subject;
    62  int m_is_send_by_messenger;
    63  int m_decrypted_and_validated;
    64  int m_decrypted_with_validation_errors;
    65  int m_decrypting_failed; /* set, if there are multipart/encrypted parts left after decryption */
    66  const char* m_blobdir;
    67 
    68  int m_is_forwarded;
    69 
    70  mrmailbox_t* m_mailbox;
    71 
    72  carray* m_reports; /* array of mailmime objects */
    73 
    74  int m_is_system_message;
    75 
    76 } mrmimeparser_t;
    77 
    78 
    79 mrmimeparser_t* mrmimeparser_new (const char* blobdir, mrmailbox_t*);
    80 void mrmimeparser_unref (mrmimeparser_t*);
    81 void mrmimeparser_empty (mrmimeparser_t*);
    82 
    83 /* The data returned from Parse() must not be freed (it is free()'d when the MrMimeParser object gets destructed)
    84 Unless memory-allocation-errors occur, Parse() returns at least one empty part.
    85 (this is because we want to add even these message to our database to avoid reading them several times.
    86 of course, these empty messages are not added to any chat) */
    87 void mrmimeparser_parse (mrmimeparser_t*, const char* body_not_terminated, size_t body_bytes);
    88 
    89 /* mrmimeparser_get_last_nonmeta() gets the _last_ part _not_ flagged with m_is_meta. */
    90 mrmimepart_t* mrmimeparser_get_last_nonmeta (mrmimeparser_t*);
    91 #define mrmimeparser_has_nonmeta(a) (mrmimeparser_get_last_nonmeta((a))!=NULL)
    92 
    93 /* mrmimeparser_is_mailinglist_message() just checks if there is a `List-ID`-header. */
    94 int mrmimeparser_is_mailinglist_message (mrmimeparser_t*);
    95 
    96 /* low-level-tools for working with mailmime structures directly */
    97 char* mr_find_first_addr (const struct mailimf_mailbox_list*); /*the result must be freed*/
    98 char* mr_normalize_addr (const char*); /*the result must be freed*/
    99 struct mailimf_fields* mr_find_mailimf_fields(struct mailmime*); /*the result is a pointer to mime, must not be freed*/
    100 struct mailimf_field* mr_find_mailimf_field (struct mailimf_fields*, int wanted_fld_type); /*the result is a pointer to mime, must not be freed*/
    101 struct mailimf_optional_field* mr_find_mailimf_field2(struct mailimf_fields*, const char* wanted_fld_name);
    102 struct mailmime_parameter* mr_find_ct_parameter (struct mailmime*, const char* name);
    103 int mr_mime_transfer_decode(struct mailmime*, const char** ret_decoded_data, size_t* ret_decoded_data_bytes, char** ret_to_mmap_string_unref);
    104 
    105 
    106 #ifdef MR_USE_MIME_DEBUG
    107 void mr_print_mime(struct mailmime * mime);
    108 #endif
    109 
    110 
    111 #ifdef __cplusplus
    112 } /* /extern "C" */
    113 #endif
    114 #endif /* __MRMIMEPARSER_H__ */
    115 
    An object representing a single mailbox.
    Definition: mrmailbox.h:184
    -
    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
    +
    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
    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
    @@ -106,7 +106,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    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
    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
    -
    An object for handling key=value parameter lists.
    Definition: mrparam.h:44
    int mrmsg_is_increation(mrmsg_t *msg)
    Check if a message is still in creation.
    Definition: mrmsg.c:867
    void mrmsg_unref(mrmsg_t *msg)
    Free a message object.
    Definition: mrmsg.c:66
    uint32_t m_id
    Message ID.
    Definition: mrmsg.h:45
    diff --git a/docs/html/mrparam_8h_source.html b/docs/html/mrparam_8h_source.html index 97f6a1d8..19d8bb14 100644 --- a/docs/html/mrparam_8h_source.html +++ b/docs/html/mrparam_8h_source.html @@ -89,14 +89,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    mrparam.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 __MRPARAM_H__
    24 #define __MRPARAM_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    44 typedef struct mrparam_t
    45 {
    47  char* m_packed;
    48 } mrparam_t;
    49 
    50 
    51 #define MRP_FILE 'f' /* for msgs */
    52 #define MRP_WIDTH 'w' /* for msgs */
    53 #define MRP_HEIGHT 'h' /* for msgs */
    54 #define MRP_DURATION 'd' /* for msgs */
    55 #define MRP_MIMETYPE 'm' /* for msgs */
    56 #define MRP_AUTHORNAME 'N' /* for msgs: name of author or artist */
    57 #define MRP_TRACKNAME 'n' /* for msgs: name of author or artist */
    58 #define MRP_GUARANTEE_E2EE 'c' /* for msgs: 'c'rypted in original/guarantee E2EE or the message is not send */
    59 #define MRP_ERRONEOUS_E2EE 'e' /* for msgs: decrypted with validation errors or without mutual set, if neither 'c' nor 'e' are preset, the messages is only transport encrypted */
    60 #define MRP_WANTS_MDN 'r' /* for msgs: an incoming message which requestes a MDN (aka read receipt) */
    61 #define MRP_FORWARDED 'a' /* for msgs */
    62 #define MRP_SYSTEM_CMD 'S' /* for msgs */
    63 #define MRP_SYSTEM_CMD_PARAM 'E' /* for msgs */
    64 
    65 #define MRP_SERVER_FOLDER 'Z' /* for jobs */
    66 #define MRP_SERVER_UID 'z' /* for jobs */
    67 #define MRP_TIMES 't' /* for jobs: times a job was tried */
    68 #define MRP_TIMES_INCREATION 'T' /* for jobs: times a job was tried, used for increation */
    69 
    70 #define MRP_REFERENCES 'R' /* for groups and chats: References-header last used for a chat */
    71 #define MRP_UNPROMOTED 'U' /* for groups */
    72 #define MRP_PROFILE_IMAGE 'i' /* for groups and contacts */
    73 #define MRP_DEL_AFTER_SEND 'P' /* for groups and msgs: physically delete group after message sending if msg-value matches group-value */
    74 
    75 
    76 /* user functions */
    77 int mrparam_exists (mrparam_t*, int key);
    78 char* mrparam_get (mrparam_t*, int key, const char* def); /* the value may be an empty string, "def" is returned only if the value unset. The result must be free()'d in any case. */
    79 int32_t mrparam_get_int (mrparam_t*, int key, int32_t def);
    80 void mrparam_set (mrparam_t*, int key, const char* value);
    81 void mrparam_set_int (mrparam_t*, int key, int32_t value);
    82 
    83 /* library-private */
    84 mrparam_t* mrparam_new ();
    85 void mrparam_empty (mrparam_t*);
    86 void mrparam_unref (mrparam_t*);
    87 void mrparam_set_packed (mrparam_t*, const char*);
    88 
    89 
    90 
    91 
    92 #ifdef __cplusplus
    93 } /* /extern "C" */
    94 #endif
    95 #endif /* __MRPARAM_H__ */
    int mrparam_exists(mrparam_t *param, int key)
    Check if a parameter exists.
    Definition: mrparam.c:161
    -
    char * mrparam_get(mrparam_t *param, int key, const char *def)
    Get value of a parameter.
    Definition: mrparam.c:186
    -
    void mrparam_set(mrparam_t *param, int key, const char *value)
    Set parameter to a string.
    Definition: mrparam.c:253
    -
    void mrparam_set_int(mrparam_t *param, int key, int32_t value)
    Set parameter to an integer.
    Definition: mrparam.c:318
    -
    int32_t mrparam_get_int(mrparam_t *param, int key, int32_t def)
    Get value of a parameter.
    Definition: mrparam.c:223
    -
    An object for handling key=value parameter lists.
    Definition: mrparam.h:44
    -
    void mrparam_empty(mrparam_t *param)
    Delete all parameters in the object.
    Definition: mrparam.c:111
    -
    +
    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 __MRPARAM_H__
    24 #define __MRPARAM_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    44 typedef struct mrparam_t
    45 {
    47  char* m_packed;
    48 } mrparam_t;
    49 
    50 
    51 #define MRP_FILE 'f' /* for msgs */
    52 #define MRP_WIDTH 'w' /* for msgs */
    53 #define MRP_HEIGHT 'h' /* for msgs */
    54 #define MRP_DURATION 'd' /* for msgs */
    55 #define MRP_MIMETYPE 'm' /* for msgs */
    56 #define MRP_AUTHORNAME 'N' /* for msgs: name of author or artist */
    57 #define MRP_TRACKNAME 'n' /* for msgs: name of author or artist */
    58 #define MRP_GUARANTEE_E2EE 'c' /* for msgs: 'c'rypted in original/guarantee E2EE or the message is not send */
    59 #define MRP_ERRONEOUS_E2EE 'e' /* for msgs: decrypted with validation errors or without mutual set, if neither 'c' nor 'e' are preset, the messages is only transport encrypted */
    60 #define MRP_WANTS_MDN 'r' /* for msgs: an incoming message which requestes a MDN (aka read receipt) */
    61 #define MRP_FORWARDED 'a' /* for msgs */
    62 #define MRP_SYSTEM_CMD 'S' /* for msgs */
    63 #define MRP_SYSTEM_CMD_PARAM 'E' /* for msgs */
    64 
    65 #define MRP_SERVER_FOLDER 'Z' /* for jobs */
    66 #define MRP_SERVER_UID 'z' /* for jobs */
    67 #define MRP_TIMES 't' /* for jobs: times a job was tried */
    68 #define MRP_TIMES_INCREATION 'T' /* for jobs: times a job was tried, used for increation */
    69 
    70 #define MRP_REFERENCES 'R' /* for groups and chats: References-header last used for a chat */
    71 #define MRP_UNPROMOTED 'U' /* for groups */
    72 #define MRP_PROFILE_IMAGE 'i' /* for groups and contacts */
    73 #define MRP_DEL_AFTER_SEND 'P' /* for groups and msgs: physically delete group after message sending if msg-value matches group-value */
    74 
    75 
    76 /* user functions */
    77 int mrparam_exists (mrparam_t*, int key);
    78 char* mrparam_get (mrparam_t*, int key, const char* def); /* the value may be an empty string, "def" is returned only if the value unset. The result must be free()'d in any case. */
    79 int32_t mrparam_get_int (mrparam_t*, int key, int32_t def);
    80 void mrparam_set (mrparam_t*, int key, const char* value);
    81 void mrparam_set_int (mrparam_t*, int key, int32_t value);
    82 
    83 /* library-private */
    84 mrparam_t* mrparam_new ();
    85 void mrparam_empty (mrparam_t*);
    86 void mrparam_unref (mrparam_t*);
    87 void mrparam_set_packed (mrparam_t*, const char*);
    88 
    89 
    90 
    91 
    92 #ifdef __cplusplus
    93 } /* /extern "C" */
    94 #endif
    95 #endif /* __MRPARAM_H__ */