diff --git a/docs/Doxyfile b/docs/Doxyfile index efbff8d1..573eefdc 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -33,7 +33,7 @@ DOXYFILE_ENCODING = UTF-8 # The default value is: My Project. ###################################################### -PROJECT_NAME = "Delta Chat Core C-Library" +PROJECT_NAME = "Delta Chat Core C-API" ###################################################### # The PROJECT_NUMBER tag can be used to enter a project or revision number. This diff --git a/docs/html/annotated.html b/docs/html/annotated.html index fee9f8a3..c6cefd67 100644 --- a/docs/html/annotated.html +++ b/docs/html/annotated.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: Class List +Delta Chat Core C-API: Class List @@ -24,7 +24,7 @@ -
Delta Chat Core C-Library +
Delta Chat Core C-API
@@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
diff --git a/docs/html/classes.html b/docs/html/classes.html index 13093407..c56a8825 100644 --- a/docs/html/classes.html +++ b/docs/html/classes.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: Class Index +Delta Chat Core C-API: Class Index @@ -24,7 +24,7 @@ -
Delta Chat Core C-Library +
Delta Chat Core C-API
@@ -97,7 +97,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
diff --git a/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html b/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html index 68726907..1b0b06fd 100644 --- a/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html +++ b/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src Directory Reference +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src Directory Reference @@ -24,7 +24,7 @@ -
Delta Chat Core C-Library +
Delta Chat Core C-API
@@ -95,7 +95,7 @@ Files
diff --git a/docs/html/files.html b/docs/html/files.html index 29c7091b..ebe57cf2 100644 --- a/docs/html/files.html +++ b/docs/html/files.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: File List +Delta Chat Core C-API: File List @@ -24,7 +24,7 @@ -
Delta Chat Core C-Library +
Delta Chat Core C-API
@@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
diff --git a/docs/html/functions.html b/docs/html/functions.html index 62ffd4c4..698c75cd 100644 --- a/docs/html/functions.html +++ b/docs/html/functions.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: Class Members +Delta Chat Core C-API: Class Members @@ -24,7 +24,7 @@ -
Delta Chat Core C-Library +
Delta Chat Core C-API
@@ -129,7 +129,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : mrmsg_t
  • m_id -: mrcontact_t +: mrchat_t +, mrcontact_t , mrmsg_t
  • m_is_msgrmsg @@ -174,7 +175,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : mrmsg_t
  • m_type -: mrmsg_t +: mrchat_t +, mrmsg_t
  • m_userdata : mrmailbox_t @@ -192,7 +194,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : mrpoortext_t
  • mrchat_empty() -: mrchat_t +: mrchat_t
  • mrchat_get_subtitle() : mrchat_t @@ -204,13 +206,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : mrchatlist_t
  • mrchatlist_get_chat_id() -: mrchatlist_t +: mrchatlist_t
  • mrchatlist_get_cnt() : mrchatlist_t
  • mrchatlist_get_msg_id() -: mrchatlist_t +: mrchatlist_t
  • mrchatlist_get_summary() : mrchatlist_t @@ -477,7 +479,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • diff --git a/docs/html/functions_func.html b/docs/html/functions_func.html index 065535f3..eb685780 100644 --- a/docs/html/functions_func.html +++ b/docs/html/functions_func.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: Class Members - Functions +Delta Chat Core C-API: Class Members - Functions @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

    - m -

    diff --git a/docs/html/functions_rela.html b/docs/html/functions_rela.html index 7af0cb0e..82387911 100644 --- a/docs/html/functions_rela.html +++ b/docs/html/functions_rela.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: Class Members - Related Functions +Delta Chat Core C-API: Class Members - Related Functions @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -107,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    diff --git a/docs/html/functions_type.html b/docs/html/functions_type.html index b88d7a53..37ffe29e 100644 --- a/docs/html/functions_type.html +++ b/docs/html/functions_type.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: Class Members - Typedefs +Delta Chat Core C-API: Class Members - Typedefs @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -98,7 +98,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    diff --git a/docs/html/functions_vars.html b/docs/html/functions_vars.html index 5a99546a..c4de5714 100644 --- a/docs/html/functions_vars.html +++ b/docs/html/functions_vars.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: Class Members - Variables +Delta Chat Core C-API: Class Members - Variables @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -129,7 +129,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : mrmsg_t
  • m_id -: mrcontact_t +: mrchat_t +, mrcontact_t , mrmsg_t
  • m_is_msgrmsg @@ -174,7 +175,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : mrmsg_t
  • m_type -: mrmsg_t +: mrchat_t +, mrmsg_t
  • m_userdata : mrmailbox_t @@ -183,7 +185,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • diff --git a/docs/html/index.html b/docs/html/index.html index c86cfd3e..51240ddb 100644 --- a/docs/html/index.html +++ b/docs/html/index.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: Tutorial +Delta Chat Core C-API: Tutorial @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -82,7 +82,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

    This document describes how to handle the Delta Chat core library.For general information about Delta Chat itself, see https://delta.chat and https://github.com/deltachat.

    Let's start.

    First of all, you have to define a function that is called by the library on specific events (eg. when the configuration is done or when fresh messages arrive). Your function should look like the following:

    -
    uintptr_t my_delta_handler(mrmailbox_t* nb, int event, uintptr_t data1, uintptr_t data2)
    {
    return 0; // for unhandled events, it is always safe to return 0
    }

    After that, you can create and configure a mrmailbox_t object easily as follows:

    +
    #include <mrmailbox.h>
    uintptr_t my_delta_handler(mrmailbox_t* nb, int event, uintptr_t data1, uintptr_t data2)
    {
    return 0; // for unhandled events, it is always safe to return 0
    }

    After that, you can create and configure a mrmailbox_t object easily as follows:

    mrmailbox_t* mb = mrmailbox_new(my_delta_handler, NULL, NULL);
    mrmailbox_set_config(mb, "addr", "alice@delta.chat"); // use some real test credentials here
    mrmailbox_set_config(mb, "mail_pw", "***");

    If this works, you'll receive the event MR_EVENT_CONFIGURE_ENDED with data1 set to 1 - and you can start sending your first message:

    uint32_t contact_id = mrmailbox_create_contact(mb, "bob@delta.chat"); // use a real testing address here
    uint32_t chat_id = mrmailbox_create_chat_by_contact_id(mb, contact_id);
    mrmailbox_send_text_msg(mb, chat_id, "Hi, here is my first message!");

    Now, go to the testing address (bob) and you should have received a normal email. Answer this email in any email program with "Got it!" and you will get the message from delta as follows:

    carray* msglist = mrmailbox_get_chat_msgs(mb, chat_id, 0, 0);
    for( size_t i = 0; i < carray_count(msglist); i++ )
    {
    uint32_t msg_id = carray_get_uint32(msglist, i);
    mrmsg_t* msg = mrmailbox_get_msg(mb, msg_id);
    printf("message %i: %s\n", i+1, msg->m_text);
    }

    This will output the following two lines:

    @@ -90,7 +90,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    diff --git a/docs/html/mraheader_8h_source.html b/docs/html/mraheader_8h_source.html index 02fec62f..1ebac51d 100644 --- a/docs/html/mraheader_8h_source.html +++ b/docs/html/mraheader_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mraheader.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mraheader.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -91,7 +91,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    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 __MRAHEADER_H__
    24 #define __MRAHEADER_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 #include "mrkey.h"
    31 
    32 
    36 typedef struct mraheader_t
    37 {
    38  char* m_addr;
    39  mrkey_t* m_public_key; /* != NULL */
    40  int m_prefer_encrypt; /* YES, NO or NOPREFERENCE if attribute is missing */
    41 } mraheader_t;
    42 
    43 
    44 mraheader_t* mraheader_new (); /* the returned pointer is ref'd and must be unref'd after usage */
    45 mraheader_t* mraheader_new_from_imffields(const char* wanted_from, const struct mailimf_fields* mime);
    46 void mraheader_empty (mraheader_t*);
    47 void mraheader_unref (mraheader_t*);
    48 
    49 int mraheader_set_from_string (mraheader_t*, const char* header_str);
    50 
    51 char* mraheader_render (const mraheader_t*);
    52 
    53 
    54 #ifdef __cplusplus
    55 } /* /extern "C" */
    56 #endif
    57 #endif /* __MRAHEADER_H__ */
    diff --git a/docs/html/mrapeerstate_8h_source.html b/docs/html/mrapeerstate_8h_source.html index c37a5523..1137211b 100644 --- a/docs/html/mrapeerstate_8h_source.html +++ b/docs/html/mrapeerstate_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrapeerstate.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrapeerstate.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -91,7 +91,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    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 __MRAPEERSTATE_H__
    24 #define __MRAPEERSTATE_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 #include "mrkey.h"
    31 
    32 
    33 typedef struct mraheader_t mraheader_t;
    34 
    35 
    36 #define MRA_PE_NOPREFERENCE 0 /* prefer-encrypt states */
    37 #define MRA_PE_MUTUAL 1
    38 #define MRA_PE_GOSSIP 2
    39 #define MRA_PE_RESET 20
    40 
    41 
    45 typedef struct mrapeerstate_t
    46 {
    48  char* m_addr;
    49  time_t m_last_seen;
    50  time_t m_last_seen_autocrypt;
    51  mrkey_t* m_public_key;
    52  int m_prefer_encrypt;
    53 
    54  #define MRA_SAVE_LAST_SEEN 0x01
    55  #define MRA_SAVE_ALL 0x02
    56  int m_to_save;
    57 } mrapeerstate_t;
    58 
    59 
    60 mrapeerstate_t* mrapeerstate_new (); /* the returned pointer is ref'd and must be unref'd after usage */
    61 void mrapeerstate_unref (mrapeerstate_t*);
    62 
    63 int mrapeerstate_init_from_header (mrapeerstate_t*, const mraheader_t*, time_t message_time);
    64 int mrapeerstate_degrade_encryption(mrapeerstate_t*, time_t message_time);
    65 int mrapeerstate_apply_header (mrapeerstate_t*, const mraheader_t*, time_t message_time); /*returns 1 on changes*/
    66 
    67 int mrapeerstate_load_from_db__ (mrapeerstate_t*, mrsqlite3_t*, const char* addr);
    68 int mrapeerstate_save_to_db__ (const mrapeerstate_t*, mrsqlite3_t*, int create);
    69 
    70 
    71 #ifdef __cplusplus
    72 } /* /extern "C" */
    73 #endif
    74 #endif /* __MRAPEERSTATE_H__ */
    75 
    diff --git a/docs/html/mrchat_8h_source.html b/docs/html/mrchat_8h_source.html index 641c55f3..e2a95f56 100644 --- a/docs/html/mrchat_8h_source.html +++ b/docs/html/mrchat_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrchat.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrchat.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -88,22 +88,24 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    mrchat.h
    -
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 #ifndef __MRCHAT_H__
    24 #define __MRCHAT_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 typedef struct mrmailbox_t mrmailbox_t;
    31 typedef struct mrparam_t mrparam_t;
    32 
    33 
    39 typedef struct mrchat_t
    40 {
    41  #define MR_CHAT_ID_DEADDROP 1 /* messages send from unknown/unwanted users to us, chats_contacts is not set up. This group may be shown normally. */
    42  #define MR_CHAT_ID_TO_DEADDROP 2 /* messages send from us to unknown/unwanted users (this may happen when deleting chats or when using CC: in the email-program) */
    43  #define MR_CHAT_ID_TRASH 3 /* messages that should be deleted get this chat_id; the messages are deleted from the working thread later then. This is also needed as rfc724_mid should be preset as long as the message is not deleted on the server (otherwise it is downloaded again) */
    44  #define MR_CHAT_ID_MSGS_IN_CREATION 4 /* a message is just in creation but not yet assigned to a chat (eg. we may need the message ID to set up blobs; this avoids unready message to be send and shown) */
    45  #define MR_CHAT_ID_STARRED 5 /* virtual chat containing all starred messages */
    46  #define MR_CHAT_ID_ARCHIVED_LINK 6 /* a link at the end of the chatlist, if present the UI should show the button "Archived chats" */
    47  #define MR_CHAT_ID_LAST_SPECIAL 9 /* larger chat IDs are "real" chats, their messages are "real" messages. */
    48  uint32_t m_id;
    49 
    50  #define MR_CHAT_TYPE_UNDEFINED 0
    51  #define MR_CHAT_TYPE_NORMAL 100 /* a normal chat is a chat with a single contact, chats_contacts contains one record for the user, MR_CONTACT_ID_SELF is not added. */
    52  #define MR_CHAT_TYPE_GROUP 120 /* a group chat, chats_contacts conain all group members, incl. MR_CONTACT_ID_SELF */
    53  int m_type;
    54 
    55  char* m_name;
    57  char* m_draft_text;
    59  int m_archived;
    63  char* m_grpid; /* NULL if unset */
    64 } mrchat_t;
    65 
    66 
    67 mrchat_t* mrchat_new (mrmailbox_t*);
    68 void mrchat_empty (mrchat_t*);
    69 void mrchat_unref (mrchat_t*);
    71 
    72 /* library-internal */
    73 int mrchat_load_from_db__ (mrchat_t*, uint32_t id);
    74 int mrchat_update_param__ (mrchat_t*);
    75 
    76 #define MR_CHAT_PREFIX "Chat:" /* you MUST NOT modify this or the following strings */
    77 #define MR_CHATS_FOLDER "Chats" /* if we want to support Gma'l-labels - "Chats" is a reserved word for Gma'l */
    78 
    79 
    80 #ifdef __cplusplus
    81 } /* /extern "C" */
    82 #endif
    83 #endif /* __MRCHAT_H__ */
    An object representing a single mailbox.
    Definition: mrmailbox.h:141
    -
    void mrchat_unref(mrchat_t *chat)
    Free a chat object.
    Definition: mrchat.c:160
    +
    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 {
    41  #define MR_CHAT_ID_DEADDROP 1 /* messages send from unknown/unwanted users to us, chats_contacts is not set up. This group may be shown normally. */
    42  #define MR_CHAT_ID_TO_DEADDROP 2 /* messages send from us to unknown/unwanted users (this may happen when deleting chats or when using CC: in the email-program) */
    43  #define MR_CHAT_ID_TRASH 3 /* messages that should be deleted get this chat_id; the messages are deleted from the working thread later then. This is also needed as rfc724_mid should be preset as long as the message is not deleted on the server (otherwise it is downloaded again) */
    44  #define MR_CHAT_ID_MSGS_IN_CREATION 4 /* a message is just in creation but not yet assigned to a chat (eg. we may need the message ID to set up blobs; this avoids unready message to be send and shown) */
    45  #define MR_CHAT_ID_STARRED 5 /* virtual chat containing all starred messages */
    46  #define MR_CHAT_ID_ARCHIVED_LINK 6 /* a link at the end of the chatlist, if present the UI should show the button "Archived chats" */
    47  #define MR_CHAT_ID_LAST_SPECIAL 9 /* larger chat IDs are "real" chats, their messages are "real" messages. */
    48  uint32_t m_id;
    50  #define MR_CHAT_TYPE_UNDEFINED 0
    51  #define MR_CHAT_TYPE_NORMAL 100 /* a normal chat is a chat with a single contact, chats_contacts contains one record for the user, MR_CONTACT_ID_SELF is not added. */
    52  #define MR_CHAT_TYPE_GROUP 120 /* a group chat, chats_contacts conain all group members, incl. MR_CONTACT_ID_SELF */
    53  int m_type;
    55  char* m_name;
    57  char* m_draft_text;
    59  int m_archived;
    63  char* m_grpid; /* NULL if unset */
    64 } mrchat_t;
    65 
    66 
    67 mrchat_t* mrchat_new (mrmailbox_t*);
    68 void mrchat_empty (mrchat_t*);
    69 void mrchat_unref (mrchat_t*);
    71 
    72 /* library-internal */
    73 int mrchat_load_from_db__ (mrchat_t*, uint32_t id);
    74 int mrchat_update_param__ (mrchat_t*);
    75 
    76 #define MR_CHAT_PREFIX "Chat:" /* you MUST NOT modify this or the following strings */
    77 #define MR_CHATS_FOLDER "Chats" /* if we want to support Gma'l-labels - "Chats" is a reserved word for Gma'l */
    78 
    79 
    80 #ifdef __cplusplus
    81 } /* /extern "C" */
    82 #endif
    83 #endif /* __MRCHAT_H__ */
    int m_type
    Chat type, one of the MR_CHAT_TYPE_* constants.
    Definition: mrchat.h:53
    +
    An object representing a single mailbox.
    Definition: mrmailbox.h:143
    +
    void mrchat_unref(mrchat_t *chat)
    Free a chat object.
    Definition: mrchat.c:65
    char * m_draft_text
    NULL if unset.
    Definition: mrchat.h:57
    mrmailbox_t * m_mailbox
    != NULL
    Definition: mrchat.h:58
    mrparam_t * m_param
    != NULL
    Definition: mrchat.h:60
    +
    void mrchat_empty(mrchat_t *chat)
    Empty a chat object.
    Definition: mrchat.c:86
    int m_archived
    1=chat archived, this state should always be shown the UI, eg.
    Definition: mrchat.h:59
    char * m_name
    NULL if unset.
    Definition: mrchat.h:55
    An object for handling key=value parameter lists.
    Definition: mrparam.h:36
    -
    void mrchat_empty(mrchat_t *ths)
    Empty a chat object.
    Definition: mrchat.c:181
    time_t m_draft_timestamp
    0 if there is no draft
    Definition: mrchat.h:56
    +
    uint32_t m_id
    Chat ID under which this object is available in the database.
    Definition: mrchat.h:48
    An object representing a single chat in memory.
    Definition: mrchat.h:39
    -
    char * mrchat_get_subtitle(mrchat_t *chat)
    Get a subtitle for a chat.
    Definition: mrchat.c:215
    +
    char * mrchat_get_subtitle(mrchat_t *chat)
    Get a subtitle for a chat.
    Definition: mrchat.c:120
    diff --git a/docs/html/mrchatlist_8h_source.html b/docs/html/mrchatlist_8h_source.html index ee3c95f6..05fd8e50 100644 --- a/docs/html/mrchatlist_8h_source.html +++ b/docs/html/mrchatlist_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrchatlist.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrchatlist.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -88,21 +88,21 @@ 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 
    34 
    42 typedef struct mrchatlist_t
    43 {
    47  #define MR_CHATLIST_IDS_PER_RESULT 2
    48  size_t m_cnt;
    49  carray* m_chatNlastmsg_ids;
    50 } mrchatlist_t;
    51 
    52 
    53 mrchatlist_t* mrchatlist_new (mrmailbox_t*);
    57 uint32_t mrchatlist_get_chat_id (mrchatlist_t*, size_t index);
    58 uint32_t mrchatlist_get_msg_id (mrchatlist_t*, size_t index);
    60 
    61 /* library-internal */
    62 int mrchatlist_load_from_db__ (mrchatlist_t*, int listflags, const char* query);
    63 
    64 
    65 #ifdef __cplusplus
    66 } /* /extern "C" */
    67 #endif
    68 #endif /* __MRCHATLIST_H__ */
    mrmailbox_t * m_mailbox
    The mailbox, the chatlist belongs to.
    Definition: mrchatlist.h:44
    -
    uint32_t mrchatlist_get_msg_id(mrchatlist_t *ths, size_t index)
    Get a single message ID of a chatlist.
    Definition: mrchatlist.c:151
    +
    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 
    34 
    42 typedef struct mrchatlist_t
    43 {
    47  #define MR_CHATLIST_IDS_PER_RESULT 2
    48  size_t m_cnt;
    49  carray* m_chatNlastmsg_ids;
    50 } mrchatlist_t;
    51 
    52 
    53 mrchatlist_t* mrchatlist_new (mrmailbox_t*);
    57 uint32_t mrchatlist_get_chat_id (mrchatlist_t*, size_t index);
    58 uint32_t mrchatlist_get_msg_id (mrchatlist_t*, size_t index);
    60 
    61 /* library-internal */
    62 int mrchatlist_load_from_db__ (mrchatlist_t*, int listflags, const char* query);
    63 
    64 
    65 #ifdef __cplusplus
    66 } /* /extern "C" */
    67 #endif
    68 #endif /* __MRCHATLIST_H__ */
    mrmailbox_t * m_mailbox
    The mailbox, the chatlist belongs to.
    Definition: mrchatlist.h:44
    An object representing a single chatlist in memory.
    Definition: mrchatlist.h:42
    -
    mrpoortext_t * mrchatlist_get_summary(mrchatlist_t *chatlist, size_t index, mrchat_t *chat)
    Get a summary for a chatlist index.
    Definition: mrchatlist.c:201
    -
    An object representing a single mailbox.
    Definition: mrmailbox.h:141
    +
    mrpoortext_t * mrchatlist_get_summary(mrchatlist_t *chatlist, size_t index, mrchat_t *chat)
    Get a summary for a chatlist index.
    Definition: mrchatlist.c:205
    +
    An object representing a single mailbox.
    Definition: mrmailbox.h:143
    void mrchatlist_empty(mrchatlist_t *chatlist)
    Empty a chatlist object.
    Definition: mrchatlist.c:83
    +
    uint32_t mrchatlist_get_msg_id(mrchatlist_t *chatlist, size_t index)
    Get a single message ID of a chatlist.
    Definition: mrchatlist.c:155
    the poortext object and some function accessing it.
    Definition: mrpoortext.h:35
    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 *ths, size_t index)
    Get a single chat ID of a chatlist.
    Definition: mrchatlist.c:121
    +
    uint32_t mrchatlist_get_chat_id(mrchatlist_t *chatlist, size_t index)
    Get a single chat ID of a chatlist.
    Definition: mrchatlist.c:123
    void mrchatlist_unref(mrchatlist_t *chatlist)
    Free a mrchatlist_t object as created eg.
    Definition: mrchatlist.c:62
    An object representing a single chat in memory.
    Definition: mrchat.h:39
    diff --git a/docs/html/mrcontact_8h_source.html b/docs/html/mrcontact_8h_source.html index c90380f3..606008d5 100644 --- a/docs/html/mrcontact_8h_source.html +++ b/docs/html/mrcontact_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrcontact.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrcontact.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    diff --git a/docs/html/mrdehtml_8h_source.html b/docs/html/mrdehtml_8h_source.html index 8416a511..a057a7ac 100644 --- a/docs/html/mrdehtml_8h_source.html +++ b/docs/html/mrdehtml_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrdehtml.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrdehtml.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -91,7 +91,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    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 __MRDEHTML_H__
    24 #define __MRDEHTML_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 /*** library-internal *********************************************************/
    31 
    32 char* mr_dehtml(char* buf_terminated); /* mr_dehtml() returns way too many lineends; however, an optimisation on this issue is not needed as the lineends are typically remove in further processing by the caller */
    33 
    34 
    35 #ifdef __cplusplus
    36 } /* /extern "C" */
    37 #endif
    38 #endif /* __MRDEHTML_H__ */
    39 
    diff --git a/docs/html/mrimap_8h_source.html b/docs/html/mrimap_8h_source.html index 4c9e595f..a0d22f2e 100644 --- a/docs/html/mrimap_8h_source.html +++ b/docs/html/mrimap_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrimap.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrimap.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -88,11 +88,11 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    mrimap.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 /* Purpose: Reading from IMAP servers with no dependencies to the database.
    24 mrmailbox_t is only used for logging and to get information about
    25 the online state. */
    26 
    27 
    28 #ifndef __MRIMAP_H__
    29 #define __MRIMAP_H__
    30 #ifdef __cplusplus
    31 extern "C" {
    32 #endif
    33 
    34 
    35 typedef struct mrloginparam_t mrloginparam_t;
    36 typedef struct mrimap_t mrimap_t;
    37 
    38 #define MR_IMAP_SEEN 0x0001L
    39 
    40 typedef int32_t (*mr_get_config_int_t)(mrimap_t*, const char*, int32_t);
    41 typedef void (*mr_set_config_int_t)(mrimap_t*, const char*, int32_t);
    42 typedef void (*mr_receive_imf_t) (mrimap_t*, const char* imf_raw_not_terminated, size_t imf_raw_bytes, const char* server_folder, uint32_t server_uid, uint32_t flags);
    43 
    44 
    48 typedef struct mrimap_t
    49 {
    52  char* m_imap_server;
    53  int m_imap_port;
    54  char* m_imap_user;
    55  char* m_imap_pw;
    56  int m_server_flags;
    57 
    58  int m_connected; /* initally connected and watch thread installed */
    59  mailimap* m_hEtpan; /* normally, if connected, m_hEtpan is also set; however, if a reconnection is required, we may lost this handle */
    60  pthread_mutex_t m_hEtpanmutex;
    61  int m_idle_set_up;
    62  char* m_selected_folder;
    63  int m_should_reconnect;
    64 
    65  int m_can_idle;
    66  int m_has_xlist;
    67  char* m_moveto_folder;/* Folder, where reveived chat messages should go to. Normally "Chats" but may be NULL to leave them in the INBOX */
    68  char* m_sent_folder; /* Folder, where send messages should go to. Normally "Chats". */
    69  pthread_mutex_t m_idlemutex; /* set, if idle is not possible; morover, the interrupted IDLE thread waits a second before IDLEing again; this allows several jobs to be executed */
    70  pthread_mutex_t m_inwait_mutex; /* only used to wait for mailstream_wait_idle()/mailimap_idle_done() to terminate. */
    71 
    72  pthread_t m_watch_thread;
    73  pthread_cond_t m_watch_cond;
    74  pthread_mutex_t m_watch_condmutex;
    75  int m_watch_condflag;
    76  int m_watch_do_exit;
    77 
    78  time_t m_enter_watch_wait_time;
    79 
    80  pthread_t m_heartbeat_thread;
    81  pthread_cond_t m_heartbeat_cond;
    82  pthread_mutex_t m_heartbeat_condmutex;
    83 
    84  pthread_t m_restore_thread;
    85  int m_restore_thread_created;
    86  int m_restore_do_exit;
    87 
    88  struct mailimap_fetch_type* m_fetch_type_uid;
    89  struct mailimap_fetch_type* m_fetch_type_body;
    90  struct mailimap_fetch_type* m_fetch_type_flags;
    91 
    92  mr_get_config_int_t m_get_config_int;
    93  mr_set_config_int_t m_set_config_int;
    94  mr_receive_imf_t m_receive_imf;
    95  void* m_userData;
    96  mrmailbox_t* m_mailbox;
    97 
    98  int m_log_connect_errors;
    99 } mrimap_t;
    100 
    101 
    102 mrimap_t* mrimap_new (mr_get_config_int_t, mr_set_config_int_t, mr_receive_imf_t, void* userData, mrmailbox_t*);
    103 void mrimap_unref (mrimap_t*);
    104 
    105 int mrimap_connect (mrimap_t*, const mrloginparam_t*);
    106 void mrimap_disconnect (mrimap_t*);
    107 int mrimap_is_connected (mrimap_t*);
    108 int mrimap_fetch (mrimap_t*);
    109 int mrimap_restore (mrimap_t*, time_t seconds_to_restore);
    110 
    111 int mrimap_append_msg (mrimap_t*, time_t timestamp, const char* data_not_terminated, size_t data_bytes, char** ret_server_folder, uint32_t* ret_server_uid);
    112 
    113 #define MR_MS_ALSO_MOVE 0x01
    114 #define MR_MS_SET_MDNSent_FLAG 0x02
    115 #define MR_MS_MDNSent_JUST_SET 0x10
    116 int mrimap_markseen_msg (mrimap_t*, const char* folder, uint32_t server_uid, int ms_flags, char** ret_server_folder, uint32_t* ret_server_uid, int* ret_ms_flags); /* only returns 0 on connection problems; we should try later again in this case */
    117 
    118 int mrimap_delete_msg (mrimap_t*, const char* rfc724_mid, const char* folder, uint32_t server_uid); /* only returns 0 on connection problems; we should try later again in this case */
    119 
    120 void mrimap_heartbeat (mrimap_t*);
    121 
    122 #ifdef __cplusplus
    123 } /* /extern "C" */
    124 #endif
    125 #endif /* __MRIMAP_H__ */
    126 
    An object representing a single mailbox.
    Definition: mrmailbox.h:141
    +
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 /* Purpose: Reading from IMAP servers with no dependencies to the database.
    24 mrmailbox_t is only used for logging and to get information about
    25 the online state. */
    26 
    27 
    28 #ifndef __MRIMAP_H__
    29 #define __MRIMAP_H__
    30 #ifdef __cplusplus
    31 extern "C" {
    32 #endif
    33 
    34 
    35 typedef struct mrloginparam_t mrloginparam_t;
    36 typedef struct mrimap_t mrimap_t;
    37 
    38 #define MR_IMAP_SEEN 0x0001L
    39 
    40 typedef int32_t (*mr_get_config_int_t)(mrimap_t*, const char*, int32_t);
    41 typedef void (*mr_set_config_int_t)(mrimap_t*, const char*, int32_t);
    42 typedef void (*mr_receive_imf_t) (mrimap_t*, const char* imf_raw_not_terminated, size_t imf_raw_bytes, const char* server_folder, uint32_t server_uid, uint32_t flags);
    43 
    44 
    48 typedef struct mrimap_t
    49 {
    52  char* m_imap_server;
    53  int m_imap_port;
    54  char* m_imap_user;
    55  char* m_imap_pw;
    56  int m_server_flags;
    57 
    58  int m_connected; /* initally connected and watch thread installed */
    59  mailimap* m_hEtpan; /* normally, if connected, m_hEtpan is also set; however, if a reconnection is required, we may lost this handle */
    60  pthread_mutex_t m_hEtpanmutex;
    61  int m_idle_set_up;
    62  char* m_selected_folder;
    63  int m_should_reconnect;
    64 
    65  int m_can_idle;
    66  int m_has_xlist;
    67  char* m_moveto_folder;/* Folder, where reveived chat messages should go to. Normally "Chats" but may be NULL to leave them in the INBOX */
    68  char* m_sent_folder; /* Folder, where send messages should go to. Normally "Chats". */
    69  pthread_mutex_t m_idlemutex; /* set, if idle is not possible; morover, the interrupted IDLE thread waits a second before IDLEing again; this allows several jobs to be executed */
    70  pthread_mutex_t m_inwait_mutex; /* only used to wait for mailstream_wait_idle()/mailimap_idle_done() to terminate. */
    71 
    72  pthread_t m_watch_thread;
    73  pthread_cond_t m_watch_cond;
    74  pthread_mutex_t m_watch_condmutex;
    75  int m_watch_condflag;
    76  int m_watch_do_exit;
    77 
    78  time_t m_enter_watch_wait_time;
    79 
    80  pthread_t m_heartbeat_thread;
    81  pthread_cond_t m_heartbeat_cond;
    82  pthread_mutex_t m_heartbeat_condmutex;
    83 
    84  pthread_t m_restore_thread;
    85  int m_restore_thread_created;
    86  int m_restore_do_exit;
    87 
    88  struct mailimap_fetch_type* m_fetch_type_uid;
    89  struct mailimap_fetch_type* m_fetch_type_body;
    90  struct mailimap_fetch_type* m_fetch_type_flags;
    91 
    92  mr_get_config_int_t m_get_config_int;
    93  mr_set_config_int_t m_set_config_int;
    94  mr_receive_imf_t m_receive_imf;
    95  void* m_userData;
    96  mrmailbox_t* m_mailbox;
    97 
    98  int m_log_connect_errors;
    99 } mrimap_t;
    100 
    101 
    102 mrimap_t* mrimap_new (mr_get_config_int_t, mr_set_config_int_t, mr_receive_imf_t, void* userData, mrmailbox_t*);
    103 void mrimap_unref (mrimap_t*);
    104 
    105 int mrimap_connect (mrimap_t*, const mrloginparam_t*);
    106 void mrimap_disconnect (mrimap_t*);
    107 int mrimap_is_connected (mrimap_t*);
    108 int mrimap_fetch (mrimap_t*);
    109 int mrimap_restore (mrimap_t*, time_t seconds_to_restore);
    110 
    111 int mrimap_append_msg (mrimap_t*, time_t timestamp, const char* data_not_terminated, size_t data_bytes, char** ret_server_folder, uint32_t* ret_server_uid);
    112 
    113 #define MR_MS_ALSO_MOVE 0x01
    114 #define MR_MS_SET_MDNSent_FLAG 0x02
    115 #define MR_MS_MDNSent_JUST_SET 0x10
    116 int mrimap_markseen_msg (mrimap_t*, const char* folder, uint32_t server_uid, int ms_flags, char** ret_server_folder, uint32_t* ret_server_uid, int* ret_ms_flags); /* only returns 0 on connection problems; we should try later again in this case */
    117 
    118 int mrimap_delete_msg (mrimap_t*, const char* rfc724_mid, const char* folder, uint32_t server_uid); /* only returns 0 on connection problems; we should try later again in this case */
    119 
    120 void mrimap_heartbeat (mrimap_t*);
    121 
    122 #ifdef __cplusplus
    123 } /* /extern "C" */
    124 #endif
    125 #endif /* __MRIMAP_H__ */
    126 
    An object representing a single mailbox.
    Definition: mrmailbox.h:143
    diff --git a/docs/html/mrjob_8h_source.html b/docs/html/mrjob_8h_source.html index 16c4f57c..b4f529db 100644 --- a/docs/html/mrjob_8h_source.html +++ b/docs/html/mrjob_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrjob.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrjob.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -88,12 +88,12 @@ 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:141
    +
    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:143
    An object for handling key=value parameter lists.
    Definition: mrparam.h:36
    diff --git a/docs/html/mrkey_8h_source.html b/docs/html/mrkey_8h_source.html index 933aaf75..4a977d3f 100644 --- a/docs/html/mrkey_8h_source.html +++ b/docs/html/mrkey_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrkey.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrkey.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -88,11 +88,11 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    mrkey.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 __MRKEY_H__
    24 #define __MRKEY_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 typedef struct mrmailbox_t mrmailbox_t;
    31 typedef struct sqlite3_stmt sqlite3_stmt;
    32 
    33 
    34 #define MR_PUBLIC 0
    35 #define MR_PRIVATE 1
    36 
    37 
    41 typedef struct mrkey_t
    42 {
    43  void* m_binary;
    44  int m_bytes;
    45  int m_type;
    46 
    48  int _m_heap_refcnt; /* !=0 for objects created with mrkey_new(), 0 for stack objects */
    49 } mrkey_t;
    50 
    51 
    52 mrkey_t* mrkey_new ();
    53 mrkey_t* mrkey_ref (mrkey_t*);
    54 void mrkey_unref (mrkey_t*);
    55 
    56 int mrkey_set_from_raw (mrkey_t*, const void* data, int bytes, int type);
    57 int mrkey_set_from_key (mrkey_t*, const mrkey_t*);
    58 int mrkey_set_from_stmt (mrkey_t*, sqlite3_stmt*, int index, int type);
    59 int mrkey_set_from_base64(mrkey_t*,const char* base64, int type);
    60 int mrkey_set_from_file (mrkey_t*, const char* file, mrmailbox_t* mailbox);
    61 
    62 int mrkey_equals (const mrkey_t*, const mrkey_t*);
    63 
    64 int mrkey_save_self_keypair__(const mrkey_t* public_key, const mrkey_t* private_key, const char* addr, int is_default, mrsqlite3_t* sql);
    65 int mrkey_load_self_public__ (mrkey_t*, const char* self_addr, mrsqlite3_t* sql);
    66 int mrkey_load_self_private__(mrkey_t*, const char* self_addr, mrsqlite3_t* sql);
    67 
    68 char* mr_render_base64 (const void* buf, size_t buf_bytes, int break_every, const char* break_chars, int add_checksum); /* the result must be freed */
    69 char* mrkey_render_base64(const mrkey_t* ths, int break_every, const char* break_chars, int add_checksum); /* the result must be freed */
    70 char* mrkey_render_asc (const mrkey_t*, const char* add_header_lines); /* each header line must be terminated by \r\n, the result must be freed */
    71 char* mrkey_render_fingerprint(const mrkey_t*, mrmailbox_t* mailbox);
    72 char* mr_render_fingerprint(const uint8_t* data, size_t bytes);
    73 void mr_wipe_secret_mem(void* buf, size_t buf_bytes);
    74 
    75 
    76 #ifdef __cplusplus
    77 } /* /extern "C" */
    78 #endif
    79 #endif /* __MRKEY_H__ */
    80 
    An object representing a single mailbox.
    Definition: mrmailbox.h:141
    +
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 #ifndef __MRKEY_H__
    24 #define __MRKEY_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 typedef struct mrmailbox_t mrmailbox_t;
    31 typedef struct sqlite3_stmt sqlite3_stmt;
    32 
    33 
    34 #define MR_PUBLIC 0
    35 #define MR_PRIVATE 1
    36 
    37 
    41 typedef struct mrkey_t
    42 {
    43  void* m_binary;
    44  int m_bytes;
    45  int m_type;
    46 
    48  int _m_heap_refcnt; /* !=0 for objects created with mrkey_new(), 0 for stack objects */
    49 } mrkey_t;
    50 
    51 
    52 mrkey_t* mrkey_new ();
    53 mrkey_t* mrkey_ref (mrkey_t*);
    54 void mrkey_unref (mrkey_t*);
    55 
    56 int mrkey_set_from_raw (mrkey_t*, const void* data, int bytes, int type);
    57 int mrkey_set_from_key (mrkey_t*, const mrkey_t*);
    58 int mrkey_set_from_stmt (mrkey_t*, sqlite3_stmt*, int index, int type);
    59 int mrkey_set_from_base64(mrkey_t*,const char* base64, int type);
    60 int mrkey_set_from_file (mrkey_t*, const char* file, mrmailbox_t* mailbox);
    61 
    62 int mrkey_equals (const mrkey_t*, const mrkey_t*);
    63 
    64 int mrkey_save_self_keypair__(const mrkey_t* public_key, const mrkey_t* private_key, const char* addr, int is_default, mrsqlite3_t* sql);
    65 int mrkey_load_self_public__ (mrkey_t*, const char* self_addr, mrsqlite3_t* sql);
    66 int mrkey_load_self_private__(mrkey_t*, const char* self_addr, mrsqlite3_t* sql);
    67 
    68 char* mr_render_base64 (const void* buf, size_t buf_bytes, int break_every, const char* break_chars, int add_checksum); /* the result must be freed */
    69 char* mrkey_render_base64(const mrkey_t* ths, int break_every, const char* break_chars, int add_checksum); /* the result must be freed */
    70 char* mrkey_render_asc (const mrkey_t*, const char* add_header_lines); /* each header line must be terminated by \r\n, the result must be freed */
    71 char* mrkey_render_fingerprint(const mrkey_t*, mrmailbox_t* mailbox);
    72 char* mr_render_fingerprint(const uint8_t* data, size_t bytes);
    73 void mr_wipe_secret_mem(void* buf, size_t buf_bytes);
    74 
    75 
    76 #ifdef __cplusplus
    77 } /* /extern "C" */
    78 #endif
    79 #endif /* __MRKEY_H__ */
    80 
    An object representing a single mailbox.
    Definition: mrmailbox.h:143
    diff --git a/docs/html/mrkeyring_8h_source.html b/docs/html/mrkeyring_8h_source.html index 84a44378..9d9d27f0 100644 --- a/docs/html/mrkeyring_8h_source.html +++ b/docs/html/mrkeyring_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrkeyring.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrkeyring.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -91,7 +91,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    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 __MRKEYRING_H__
    24 #define __MRKEYRING_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 typedef struct mrkey_t mrkey_t;
    31 
    32 
    36 typedef struct mrkeyring_t
    37 {
    40  mrkey_t** m_keys;
    41  int m_count;
    42  int m_allocated;
    43 } mrkeyring_t;
    44 
    45 mrkeyring_t* mrkeyring_new ();
    46 void mrkeyring_unref();
    47 
    48 void mrkeyring_add (mrkeyring_t*, mrkey_t*); /* the reference counter of the key is increased by one */
    49 
    50 int mrkeyring_load_self_private_for_decrypting__(mrkeyring_t*, const char* self_addr, mrsqlite3_t* sql);
    51 
    52 
    53 #ifdef __cplusplus
    54 } /* /extern "C" */
    55 #endif
    56 #endif /* __MRKEYRING_H__ */
    57 
    diff --git a/docs/html/mrloginparam_8h_source.html b/docs/html/mrloginparam_8h_source.html index b5d6c572..a9061340 100644 --- a/docs/html/mrloginparam_8h_source.html +++ b/docs/html/mrloginparam_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrloginparam.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrloginparam.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -91,7 +91,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    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 __MRLOGINPARAM_H__
    24 #define __MRLOGINPARAM_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    33 typedef struct mrloginparam_t
    34 {
    37  /* IMAP/POP3 - all pointers may be NULL if unset, public read */
    38  char* m_addr;
    39  char* m_mail_server;
    40  char* m_mail_user;
    41  char* m_mail_pw;
    42  uint16_t m_mail_port;
    43 
    44  /* SMTP - all pointers may be NULL if unset, public read */
    45  char* m_send_server;
    46  char* m_send_user;
    47  char* m_send_pw;
    48  int m_send_port;
    49 
    50  /* Server options*/
    51  #define MR_AUTH_XOAUTH2 0x2
    52  #define MR_AUTH_NORMAL 0x4
    53  #define MR_AUTH_FLAGS (MR_AUTH_XOAUTH2|MR_AUTH_NORMAL) /* if none of these flags are set, the default is choosen, even if MR_NO_AUTOCONFIG is set */
    54 
    55  #define MR_IMAP_SOCKET_STARTTLS 0x100
    56  #define MR_IMAP_SOCKET_SSL 0x200
    57  #define MR_IMAP_SOCKET_PLAIN 0x400
    58  #define MR_IMAP_SOCKET_FLAGS (MR_IMAP_SOCKET_STARTTLS|MR_IMAP_SOCKET_SSL|MR_IMAP_SOCKET_PLAIN) /* if none of these flags are set, the default is choosen, even if MR_NO_AUTOCONFIG is set */
    59 
    60  #define MR_SMTP_SOCKET_STARTTLS 0x10000
    61  #define MR_SMTP_SOCKET_SSL 0x20000
    62  #define MR_SMTP_SOCKET_PLAIN 0x40000
    63  #define MR_SMTP_SOCKET_FLAGS (MR_SMTP_SOCKET_STARTTLS|MR_SMTP_SOCKET_SSL|MR_SMTP_SOCKET_PLAIN) /* if none of these flags are set, the default is choosen, even if MR_NO_AUTOCONFIG is set */
    64 
    65  #define MR_NO_EXTRA_IMAP_UPLOAD 0x2000000
    66  #define MR_NO_MOVE_TO_CHATS 0x4000000
    67 
    68  int m_server_flags;
    69 } mrloginparam_t;
    70 
    71 
    72 mrloginparam_t* mrloginparam_new ();
    73 void mrloginparam_unref (mrloginparam_t*);
    74 void mrloginparam_empty (mrloginparam_t*); /* clears all data and frees its memory. All pointers are NULL after this function is called. */
    75 void mrloginparam_read__ (mrloginparam_t*, mrsqlite3_t*, const char* prefix);
    76 void mrloginparam_write__ (const mrloginparam_t*, mrsqlite3_t*, const char* prefix);
    77 char* mrloginparam_get_readable (const mrloginparam_t*);
    78 
    79 
    80 #ifdef __cplusplus
    81 } /* /extern "C" */
    82 #endif
    83 #endif /* __MRLOGINPARAM_H__ */
    84 
    diff --git a/docs/html/mrmailbox_8h_source.html b/docs/html/mrmailbox_8h_source.html index 577eeb08..8f2f2a93 100644 --- a/docs/html/mrmailbox_8h_source.html +++ b/docs/html/mrmailbox_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrmailbox.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrmailbox.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -88,7 +88,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 7
    33 
    34 
    100 #include <libetpan/libetpan.h> /* defines uint16_t etc. */
    101 #include "mrchatlist.h"
    102 #include "mrchat.h"
    103 #include "mrmsg.h"
    104 #include "mrcontact.h"
    105 #include "mrpoortext.h"
    106 #include "mrparam.h"
    107 
    108 typedef struct mrmailbox_t mrmailbox_t;
    109 typedef struct mrimap_t mrimap_t;
    110 typedef struct mrsmtp_t mrsmtp_t;
    111 typedef struct mrsqlite3_t mrsqlite3_t;
    112 typedef struct mrjob_t mrjob_t;
    113 typedef struct mrmimeparser_t mrmimeparser_t;
    114 
    115 
    131 typedef uintptr_t (*mrmailboxcb_t) (mrmailbox_t*, int event, uintptr_t data1, uintptr_t data2);
    132 
    133 
    141 typedef struct mrmailbox_t
    142 {
    143  void* m_userdata;
    144  char* m_dbfile;
    145  char* m_blobdir;
    148  mrsqlite3_t* m_sql;
    149  mrimap_t* m_imap;
    150  mrsmtp_t* m_smtp;
    152  pthread_t m_job_thread;
    153  pthread_cond_t m_job_cond;
    154  pthread_mutex_t m_job_condmutex;
    155  int m_job_condflag;
    156  int m_job_do_exit;
    158  mrmailboxcb_t m_cb;
    160  char* m_os_name;
    162  uint32_t m_cmdline_sel_chat_id;
    164  int m_wake_lock;
    165  pthread_mutex_t m_wake_lock_critical;
    167  int m_e2ee_enabled;
    169  #define MR_LOG_RINGBUF_SIZE 200
    170  pthread_mutex_t m_log_ringbuf_critical;
    171  char* m_log_ringbuf[MR_LOG_RINGBUF_SIZE];
    172  time_t m_log_ringbuf_times[MR_LOG_RINGBUF_SIZE];
    173  int m_log_ringbuf_pos;
    175 } mrmailbox_t;
    176 
    177 
    178 /* create/open/connect */
    179 mrmailbox_t* mrmailbox_new (mrmailboxcb_t, void* userdata, const char* os_name);
    180 void mrmailbox_unref (mrmailbox_t*);
    181 
    182 int mrmailbox_open (mrmailbox_t*, const char* dbfile, const char* blobdir);
    183 void mrmailbox_close (mrmailbox_t*);
    184 int mrmailbox_is_open (const mrmailbox_t*);
    185 
    186 int mrmailbox_set_config (mrmailbox_t*, const char* key, const char* value);
    187 char* mrmailbox_get_config (mrmailbox_t*, const char* key, const char* def);
    188 int mrmailbox_set_config_int (mrmailbox_t*, const char* key, int32_t value);
    189 int32_t mrmailbox_get_config_int (mrmailbox_t*, const char* key, int32_t def);
    190 char* mrmailbox_get_blobdir (mrmailbox_t*);
    191 char* mrmailbox_get_version_str (void);
    192 
    193 void mrmailbox_configure_and_connect(mrmailbox_t*);
    194 void mrmailbox_configure_cancel (mrmailbox_t*);
    195 int mrmailbox_is_configured (mrmailbox_t*);
    196 
    197 void mrmailbox_connect (mrmailbox_t*);
    198 void mrmailbox_disconnect (mrmailbox_t*);
    199 
    200 int mrmailbox_restore (mrmailbox_t*, time_t seconds_to_restore); /* not really implemented */
    201 char* mrmailbox_get_info (mrmailbox_t*);
    202 
    203 
    204 /* Handle chatlists */
    205 #define MR_GCL_ARCHIVED_ONLY 0x01
    206 #define MR_GCL_NO_SPECIALS 0x02
    207 mrchatlist_t* mrmailbox_get_chatlist (mrmailbox_t*, int flags, const char* query);
    208 
    209 
    210 /* Handle chats */
    211 uint32_t mrmailbox_create_chat_by_contact_id (mrmailbox_t*, uint32_t contact_id);
    212 uint32_t mrmailbox_get_chat_id_by_contact_id (mrmailbox_t*, uint32_t contact_id);
    213 
    214 uint32_t mrmailbox_send_text_msg (mrmailbox_t*, uint32_t chat_id, const char* text_to_send);
    215 uint32_t mrmailbox_send_msg (mrmailbox_t*, uint32_t chat_id, mrmsg_t*);
    216 void mrmailbox_set_draft (mrmailbox_t*, uint32_t chat_id, const char*);
    217 
    218 #define MR_GCM_ADDDAYMARKER 0x01
    219 carray* mrmailbox_get_chat_msgs (mrmailbox_t*, uint32_t chat_id, uint32_t flags, uint32_t marker1before);
    220 int mrmailbox_get_total_msg_count (mrmailbox_t*, uint32_t chat_id);
    221 int mrmailbox_get_fresh_msg_count (mrmailbox_t*, uint32_t chat_id);
    222 carray* mrmailbox_get_fresh_msgs (mrmailbox_t*);
    223 void mrmailbox_marknoticed_chat (mrmailbox_t*, uint32_t chat_id);
    224 carray* mrmailbox_get_chat_media (mrmailbox_t*, uint32_t chat_id, int msg_type, int or_msg_type);
    225 uint32_t mrmailbox_get_next_media (mrmailbox_t*, uint32_t curr_msg_id, int dir);
    226 
    227 void mrmailbox_archive_chat (mrmailbox_t*, uint32_t chat_id, int archive);
    228 void mrmailbox_delete_chat (mrmailbox_t*, uint32_t chat_id);
    229 
    230 carray* mrmailbox_get_chat_contacts (mrmailbox_t*, uint32_t chat_id);
    231 carray* mrmailbox_search_msgs (mrmailbox_t*, uint32_t chat_id, const char* query);
    232 
    233 mrchat_t* mrmailbox_get_chat (mrmailbox_t*, uint32_t chat_id);
    234 
    235 
    236 /* Handle group chats */
    237 uint32_t mrmailbox_create_group_chat (mrmailbox_t*, const char* name);
    238 int mrmailbox_is_contact_in_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    239 int mrmailbox_add_contact_to_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    240 int mrmailbox_remove_contact_from_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    241 int mrmailbox_set_chat_name (mrmailbox_t*, uint32_t chat_id, const char* name);
    242 int mrmailbox_set_chat_image (mrmailbox_t*, uint32_t chat_id, const char* image);
    243 
    244 
    245 /* Handle messages */
    246 char* mrmailbox_get_msg_info (mrmailbox_t*, uint32_t msg_id);
    247 void mrmailbox_delete_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt);
    248 void mrmailbox_forward_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt, uint32_t chat_id);
    249 void mrmailbox_marknoticed_contact (mrmailbox_t*, uint32_t contact_id);
    250 void mrmailbox_markseen_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt);
    251 void mrmailbox_star_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt, int star);
    252 mrmsg_t* mrmailbox_get_msg (mrmailbox_t*, uint32_t msg_id);
    253 
    254 
    255 
    256 /* Handle contacts */
    257 uint32_t mrmailbox_create_contact (mrmailbox_t*, const char* name, const char* addr);
    258 int mrmailbox_add_address_book (mrmailbox_t*, const char*);
    259 carray* mrmailbox_get_known_contacts (mrmailbox_t*, const char* query);
    260 int mrmailbox_get_blocked_count (mrmailbox_t*);
    261 carray* mrmailbox_get_blocked_contacts (mrmailbox_t*);
    262 void mrmailbox_block_contact (mrmailbox_t*, uint32_t contact_id, int block);
    263 char* mrmailbox_get_contact_encrinfo (mrmailbox_t*, uint32_t contact_id);
    264 int mrmailbox_delete_contact (mrmailbox_t*, uint32_t contact_id);
    265 mrcontact_t* mrmailbox_get_contact (mrmailbox_t*, uint32_t contact_id);
    266 
    267 
    268 /* logging */
    269 void mrmailbox_log_error (mrmailbox_t*, int code, const char* msg, ...);
    270 void mrmailbox_log_error_if (int* condition, mrmailbox_t*, int code, const char* msg, ...);
    271 void mrmailbox_log_warning (mrmailbox_t*, int code, const char* msg, ...);
    272 void mrmailbox_log_info (mrmailbox_t*, int code, const char* msg, ...);
    273 void mrmailbox_log_vprintf (mrmailbox_t*, int event, int code, const char* msg, va_list);
    274 int mrmailbox_get_thread_index (void);
    275 
    276 
    277 /* library private */
    278 uint32_t mrmailbox_send_msg_i__ (mrmailbox_t*, mrchat_t*, const mrmsg_t*, time_t);
    279 void mrmailbox_connect_to_imap (mrmailbox_t*, mrjob_t*);
    280 void mrmailbox_wake_lock (mrmailbox_t*);
    281 void mrmailbox_wake_unlock (mrmailbox_t*);
    282 int mrmailbox_poke_eml_file (mrmailbox_t*, const char* file);
    283 int mrmailbox_is_reply_to_known_message__ (mrmailbox_t*, mrmimeparser_t*);
    284 int mrmailbox_is_reply_to_messenger_message__ (mrmailbox_t*, mrmimeparser_t*);
    285 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);
    286 void mrmailbox_add_or_lookup_contacts_by_mailbox_list__(mrmailbox_t* ths, struct mailimf_mailbox_list* mb_list, int origin, carray* ids, int* check_self);
    287 void mrmailbox_add_or_lookup_contacts_by_address_list__(mrmailbox_t* ths, struct mailimf_address_list* adr_list, int origin, carray* ids, int* check_self);
    288 int mrmailbox_get_archived_count__ (mrmailbox_t*);
    289 int mrmailbox_reset_tables (mrmailbox_t*, int bits); /* reset tables but leaves server configuration, 1=jobs, 2=e2ee, 8=rest but server config */
    290 size_t mrmailbox_get_real_contact_cnt__ (mrmailbox_t*);
    291 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);
    292 int mrmailbox_get_contact_origin__ (mrmailbox_t*, uint32_t id, int* ret_blocked);
    293 int mrmailbox_is_contact_blocked__ (mrmailbox_t*, uint32_t id);
    294 int mrmailbox_real_contact_exists__ (mrmailbox_t*, uint32_t id);
    295 int mrmailbox_contact_addr_equals__ (mrmailbox_t*, uint32_t contact_id, const char* other_addr);
    296 void mrmailbox_scaleup_contact_origin__ (mrmailbox_t*, uint32_t contact_id, int origin);
    297 
    298 
    299 /* library private: end-to-end-encryption */
    300 #define MR_E2EE_DEFAULT_ENABLED 1
    301 #define MR_MDNS_DEFAULT_ENABLED 1
    302 
    303 typedef struct mrmailbox_e2ee_helper_t {
    304  int m_encryption_successfull;
    305  void* m_cdata_to_free;
    306 } mrmailbox_e2ee_helper_t;
    307 
    308 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*);
    309 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 */
    310 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! */
    311 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 */
    312 
    313 
    314 /*******************************************************************************
    315  * Events
    316  ******************************************************************************/
    317 
    318 
    319 /* The following events may be passed to the callback given to mrmailbox_new() */
    320 
    321 
    322 /* Information, should not be reported, can be logged,
    323 data1=0, data2=info string */
    324 #define MR_EVENT_INFO 100
    325 
    326 
    327 /* Warning, should not be reported, should be logged
    328 data1=0, data2=warning string */
    329 #define MR_EVENT_WARNING 300
    330 
    331 
    332 /* Error, must be reported to the user by a non-disturbing bubble or so.
    333 data1=error code MR_ERR_*, see below, data2=error string */
    334 #define MR_EVENT_ERROR 400
    335 
    336 
    337 /* one or more messages changed for some reasons in the database - added or
    338 removed. For added messages: data1=chat_id, data2=msg_id */
    339 #define MR_EVENT_MSGS_CHANGED 2000
    340 
    341 
    342 /* For fresh messages from the INBOX, MR_EVENT_INCOMING_MSG is send;
    343 data1=chat_id, data2=msg_id */
    344 #define MR_EVENT_INCOMING_MSG 2005
    345 
    346 
    347 /* a single message is send successfully (state changed from PENDING/SENDING to
    348 DELIVERED); data1=chat_id, data2=msg_id */
    349 #define MR_EVENT_MSG_DELIVERED 2010
    350 
    351 
    352 /* a single message is read by the receiver (state changed from DELIVERED to
    353 READ); data1=chat_id, data2=msg_id */
    354 #define MR_EVENT_MSG_READ 2015
    355 
    356 
    357 /* group name/image changed or members added/removed */
    358 #define MR_EVENT_CHAT_MODIFIED 2020
    359 
    360 
    361 /* contact(s) created, renamed, blocked or deleted */
    362 #define MR_EVENT_CONTACTS_CHANGED 2030
    363 
    364 
    365 /* connection state changed,
    366 data1=0:failed-not-connected, 1:configured-and-connected */
    367 #define MR_EVENT_CONFIGURE_ENDED 2040
    368 
    369 
    370 /* data1=percent */
    371 #define MR_EVENT_CONFIGURE_PROGRESS 2041
    372 
    373 
    374 /* mrmailbox_imex() done:
    375 data1=0:failed, 1=success */
    376 #define MR_EVENT_IMEX_ENDED 2050
    377 
    378 
    379 /* data1=permille */
    380 #define MR_EVENT_IMEX_PROGRESS 2051
    381 
    382 
    383 /* file written, event may be needed to make the file public to some system
    384 services. data1=file name, data2=mime type */
    385 #define MR_EVENT_IMEX_FILE_WRITTEN 2052
    386 
    387 
    388 /* The following events are functions that should be provided by the frontends */
    389 
    390 
    391 /* check, if the system is online currently
    392 ret=0: not online, ret=1: online */
    393 #define MR_EVENT_IS_ONLINE 2080
    394 
    395 
    396 /* get a string from the frontend, data1=MR_STR_*, ret=string which will be
    397 free()'d by the backend */
    398 #define MR_EVENT_GET_STRING 2091
    399 
    400 
    401 /* synchronous http/https(!) call, data1=url, ret=content which will be
    402 free()'d by the backend, 0 on errors */
    403 #define MR_EVENT_GET_QUANTITY_STRING 2092
    404 
    405 
    406 /* synchronous http/https(!) call, data1=url, ret=content which will be free()'d
    407 by the backend, 0 on errors */
    408 #define MR_EVENT_HTTP_GET 2100
    409 
    410 /* acquire wakeLock (data1=1) or release it (data1=0), the backend does not make
    411 nested or unsynchronized calls */
    412 #define MR_EVENT_WAKE_LOCK 2110
    413 
    414 
    415 /* Error codes */
    416 #define MR_ERR_SELF_NOT_IN_GROUP 1
    417 #define MR_ERR_NONETWORK 2
    418 
    419 
    420 /*******************************************************************************
    421  * Import/export and Tools
    422  ******************************************************************************/
    423 
    424 
    425 #define MR_IMEX_CANCEL 0
    426 #define MR_IMEX_EXPORT_SELF_KEYS 1
    427 #define MR_IMEX_IMPORT_SELF_KEYS 2
    428 #define MR_IMEX_EXPORT_BACKUP 11
    429 #define MR_IMEX_IMPORT_BACKUP 12
    430 #define MR_IMEX_EXPORT_SETUP_MESSAGE 20
    431 #define MR_BAK_PREFIX "delta-chat"
    432 #define MR_BAK_SUFFIX "bak"
    433 void mrmailbox_imex (mrmailbox_t*, int what, const char* param1, const char* setup_code);
    434 char* mrmailbox_imex_has_backup (mrmailbox_t*, const char* dir);
    435 
    436 
    437 
    438 int mrmailbox_check_password (mrmailbox_t*, const char* pw);
    439 
    440 
    441 
    442 char* mrmailbox_create_setup_code (mrmailbox_t*);
    443 
    444 
    445 
    446 int mrmailbox_poke_spec (mrmailbox_t*, const char* spec);
    447 
    448 
    449 /* The library tries itself to stay alive. For this purpose there is an additional
    450 "heartbeat" thread that checks if the IDLE-thread is up and working. This check is done about every minute.
    451 However, depending on the operating system, this thread may be delayed or stopped, if this is the case you can
    452 force additional checks manually by just calling mrmailbox_heartbeat() about every minute.
    453 If in doubt, call this function too often, not too less :-) */
    454 void mrmailbox_heartbeat (mrmailbox_t*);
    455 
    456 
    457 /* carray tools, already defined are things as
    458 unsigned unt carray_count() */
    459 uint32_t carray_get_uint32 (carray*, unsigned int index);
    460 
    461 
    462 /* deprecated functions */
    463 mrchat_t* mrchatlist_get_chat_by_index (mrchatlist_t*, size_t index); /* deprecated - use mrchatlist_get_chat_id_by_index() */
    464 mrmsg_t* mrchatlist_get_msg_by_index (mrchatlist_t*, size_t index); /* deprecated - use mrchatlist_get_msg_id_by_index() */
    465 int mrchat_set_draft (mrchat_t*, const char* msg); /* deprecated - use mrmailbox_set_draft() instead */
    466 
    467 
    468 /* library-internal */
    469 void mrmailbox_unarchive_chat__ (mrmailbox_t*, uint32_t chat_id);
    470 size_t mrmailbox_get_chat_cnt__ (mrmailbox_t*);
    471 uint32_t mrmailbox_create_or_lookup_nchat_by_contact_id__(mrmailbox_t*, uint32_t contact_id);
    472 uint32_t mrmailbox_lookup_real_nchat_by_contact_id__(mrmailbox_t*, uint32_t contact_id);
    473 int mrmailbox_get_total_msg_count__ (mrmailbox_t*, uint32_t chat_id);
    474 int mrmailbox_get_fresh_msg_count__ (mrmailbox_t*, uint32_t chat_id);
    475 uint32_t mrmailbox_get_last_deaddrop_fresh_msg__(mrmailbox_t*);
    476 void mrmailbox_send_msg_to_smtp (mrmailbox_t*, mrjob_t*);
    477 void mrmailbox_send_msg_to_imap (mrmailbox_t*, mrjob_t*);
    478 int mrmailbox_add_contact_to_chat__ (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    479 int mrmailbox_is_contact_in_chat__ (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    480 int mrmailbox_get_chat_contact_count__ (mrmailbox_t*, uint32_t chat_id);
    481 int mrmailbox_group_explicitly_left__ (mrmailbox_t*, const char* grpid);
    482 void mrmailbox_set_group_explicitly_left__ (mrmailbox_t*, const char* grpid);
    483 
    484 size_t mrmailbox_get_real_msg_cnt__ (mrmailbox_t*); /* the number of messages assigned to real chat (!=deaddrop, !=trash) */
    485 size_t mrmailbox_get_deaddrop_msg_cnt__ (mrmailbox_t*);
    486 int mrmailbox_rfc724_mid_cnt__ (mrmailbox_t*, const char* rfc724_mid);
    487 int mrmailbox_rfc724_mid_exists__ (mrmailbox_t*, const char* rfc724_mid, char** ret_server_folder, uint32_t* ret_server_uid);
    488 void mrmailbox_update_server_uid__ (mrmailbox_t*, const char* rfc724_mid, const char* server_folder, uint32_t server_uid);
    489 void mrmailbox_update_msg_chat_id__ (mrmailbox_t*, uint32_t msg_id, uint32_t chat_id);
    490 void mrmailbox_update_msg_state__ (mrmailbox_t*, uint32_t msg_id, int state);
    491 void mrmailbox_delete_msg_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    492 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 */
    493 void mrmailbox_send_mdn (mrmailbox_t*, mrjob_t* job);
    494 void mrmailbox_markseen_msg_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    495 void mrmailbox_markseen_mdn_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    496 
    497 
    498 #ifdef __cplusplus
    499 } /* /extern "C" */
    500 #endif
    501 #endif /* __MRMAILBOX_H__ */
    int mrmailbox_add_address_book(mrmailbox_t *mailbox, const char *adr_book)
    Add a number of contacts.
    Definition: mrmailbox.c:4021
    +
    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 7
    33 
    34 
    102 #include <libetpan/libetpan.h> /* defines uint16_t and carray */
    103 #include "mrchatlist.h"
    104 #include "mrchat.h"
    105 #include "mrmsg.h"
    106 #include "mrcontact.h"
    107 #include "mrpoortext.h"
    108 #include "mrparam.h"
    109 
    110 typedef struct mrmailbox_t mrmailbox_t;
    111 typedef struct mrimap_t mrimap_t;
    112 typedef struct mrsmtp_t mrsmtp_t;
    113 typedef struct mrsqlite3_t mrsqlite3_t;
    114 typedef struct mrjob_t mrjob_t;
    115 typedef struct mrmimeparser_t mrmimeparser_t;
    116 
    117 
    133 typedef uintptr_t (*mrmailboxcb_t) (mrmailbox_t*, int event, uintptr_t data1, uintptr_t data2);
    134 
    135 
    143 typedef struct mrmailbox_t
    144 {
    145  void* m_userdata;
    146  char* m_dbfile;
    147  char* m_blobdir;
    150  mrsqlite3_t* m_sql;
    151  mrimap_t* m_imap;
    152  mrsmtp_t* m_smtp;
    154  pthread_t m_job_thread;
    155  pthread_cond_t m_job_cond;
    156  pthread_mutex_t m_job_condmutex;
    157  int m_job_condflag;
    158  int m_job_do_exit;
    160  mrmailboxcb_t m_cb;
    162  char* m_os_name;
    164  uint32_t m_cmdline_sel_chat_id;
    166  int m_wake_lock;
    167  pthread_mutex_t m_wake_lock_critical;
    169  int m_e2ee_enabled;
    171  #define MR_LOG_RINGBUF_SIZE 200
    172  pthread_mutex_t m_log_ringbuf_critical;
    173  char* m_log_ringbuf[MR_LOG_RINGBUF_SIZE];
    175  time_t m_log_ringbuf_times[MR_LOG_RINGBUF_SIZE];
    177  int m_log_ringbuf_pos;
    179 } mrmailbox_t;
    180 
    181 
    182 /* create/open/connect */
    183 mrmailbox_t* mrmailbox_new (mrmailboxcb_t, void* userdata, const char* os_name);
    184 void mrmailbox_unref (mrmailbox_t*);
    185 
    186 int mrmailbox_open (mrmailbox_t*, const char* dbfile, const char* blobdir);
    187 void mrmailbox_close (mrmailbox_t*);
    188 int mrmailbox_is_open (const mrmailbox_t*);
    189 
    190 int mrmailbox_set_config (mrmailbox_t*, const char* key, const char* value);
    191 char* mrmailbox_get_config (mrmailbox_t*, const char* key, const char* def);
    192 int mrmailbox_set_config_int (mrmailbox_t*, const char* key, int32_t value);
    193 int32_t mrmailbox_get_config_int (mrmailbox_t*, const char* key, int32_t def);
    194 char* mrmailbox_get_blobdir (mrmailbox_t*);
    195 char* mrmailbox_get_version_str (void);
    196 
    197 void mrmailbox_configure_and_connect(mrmailbox_t*);
    198 void mrmailbox_configure_cancel (mrmailbox_t*);
    199 int mrmailbox_is_configured (mrmailbox_t*);
    200 
    201 void mrmailbox_connect (mrmailbox_t*);
    202 void mrmailbox_disconnect (mrmailbox_t*);
    203 
    204 int mrmailbox_restore (mrmailbox_t*, time_t seconds_to_restore); /* not really implemented */
    205 char* mrmailbox_get_info (mrmailbox_t*);
    206 
    207 
    208 /* Handle chatlists */
    209 #define MR_GCL_ARCHIVED_ONLY 0x01
    210 #define MR_GCL_NO_SPECIALS 0x02
    211 mrchatlist_t* mrmailbox_get_chatlist (mrmailbox_t*, int flags, const char* query);
    212 
    213 
    214 /* Handle chats */
    215 uint32_t mrmailbox_create_chat_by_contact_id (mrmailbox_t*, uint32_t contact_id);
    216 uint32_t mrmailbox_get_chat_id_by_contact_id (mrmailbox_t*, uint32_t contact_id);
    217 
    218 uint32_t mrmailbox_send_text_msg (mrmailbox_t*, uint32_t chat_id, const char* text_to_send);
    219 uint32_t mrmailbox_send_msg (mrmailbox_t*, uint32_t chat_id, mrmsg_t*);
    220 void mrmailbox_set_draft (mrmailbox_t*, uint32_t chat_id, const char*);
    221 
    222 #define MR_GCM_ADDDAYMARKER 0x01
    223 carray* mrmailbox_get_chat_msgs (mrmailbox_t*, uint32_t chat_id, uint32_t flags, uint32_t marker1before);
    224 int mrmailbox_get_total_msg_count (mrmailbox_t*, uint32_t chat_id);
    225 int mrmailbox_get_fresh_msg_count (mrmailbox_t*, uint32_t chat_id);
    226 carray* mrmailbox_get_fresh_msgs (mrmailbox_t*);
    227 void mrmailbox_marknoticed_chat (mrmailbox_t*, uint32_t chat_id);
    228 carray* mrmailbox_get_chat_media (mrmailbox_t*, uint32_t chat_id, int msg_type, int or_msg_type);
    229 uint32_t mrmailbox_get_next_media (mrmailbox_t*, uint32_t curr_msg_id, int dir);
    230 
    231 void mrmailbox_archive_chat (mrmailbox_t*, uint32_t chat_id, int archive);
    232 void mrmailbox_delete_chat (mrmailbox_t*, uint32_t chat_id);
    233 
    234 carray* mrmailbox_get_chat_contacts (mrmailbox_t*, uint32_t chat_id);
    235 carray* mrmailbox_search_msgs (mrmailbox_t*, uint32_t chat_id, const char* query);
    236 
    237 mrchat_t* mrmailbox_get_chat (mrmailbox_t*, uint32_t chat_id);
    238 
    239 
    240 /* Handle group chats */
    241 uint32_t mrmailbox_create_group_chat (mrmailbox_t*, const char* name);
    242 int mrmailbox_is_contact_in_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    243 int mrmailbox_add_contact_to_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    244 int mrmailbox_remove_contact_from_chat (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    245 int mrmailbox_set_chat_name (mrmailbox_t*, uint32_t chat_id, const char* name);
    246 int mrmailbox_set_chat_image (mrmailbox_t*, uint32_t chat_id, const char* image);
    247 
    248 
    249 /* Handle messages */
    250 char* mrmailbox_get_msg_info (mrmailbox_t*, uint32_t msg_id);
    251 void mrmailbox_delete_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt);
    252 void mrmailbox_forward_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt, uint32_t chat_id);
    253 void mrmailbox_marknoticed_contact (mrmailbox_t*, uint32_t contact_id);
    254 void mrmailbox_markseen_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt);
    255 void mrmailbox_star_msgs (mrmailbox_t*, const uint32_t* msg_ids, int msg_cnt, int star);
    256 mrmsg_t* mrmailbox_get_msg (mrmailbox_t*, uint32_t msg_id);
    257 
    258 
    259 
    260 /* Handle contacts */
    261 uint32_t mrmailbox_create_contact (mrmailbox_t*, const char* name, const char* addr);
    262 int mrmailbox_add_address_book (mrmailbox_t*, const char*);
    263 carray* mrmailbox_get_known_contacts (mrmailbox_t*, const char* query);
    264 int mrmailbox_get_blocked_count (mrmailbox_t*);
    265 carray* mrmailbox_get_blocked_contacts (mrmailbox_t*);
    266 void mrmailbox_block_contact (mrmailbox_t*, uint32_t contact_id, int block);
    267 char* mrmailbox_get_contact_encrinfo (mrmailbox_t*, uint32_t contact_id);
    268 int mrmailbox_delete_contact (mrmailbox_t*, uint32_t contact_id);
    269 mrcontact_t* mrmailbox_get_contact (mrmailbox_t*, uint32_t contact_id);
    270 
    271 
    272 /* logging */
    273 void mrmailbox_log_error (mrmailbox_t*, int code, const char* msg, ...);
    274 void mrmailbox_log_error_if (int* condition, mrmailbox_t*, int code, const char* msg, ...);
    275 void mrmailbox_log_warning (mrmailbox_t*, int code, const char* msg, ...);
    276 void mrmailbox_log_info (mrmailbox_t*, int code, const char* msg, ...);
    277 void mrmailbox_log_vprintf (mrmailbox_t*, int event, int code, const char* msg, va_list);
    278 int mrmailbox_get_thread_index (void);
    279 
    280 
    281 /* library private */
    282 uint32_t mrmailbox_send_msg_i__ (mrmailbox_t*, mrchat_t*, const mrmsg_t*, time_t);
    283 void mrmailbox_connect_to_imap (mrmailbox_t*, mrjob_t*);
    284 void mrmailbox_wake_lock (mrmailbox_t*);
    285 void mrmailbox_wake_unlock (mrmailbox_t*);
    286 int mrmailbox_poke_eml_file (mrmailbox_t*, const char* file);
    287 int mrmailbox_is_reply_to_known_message__ (mrmailbox_t*, mrmimeparser_t*);
    288 int mrmailbox_is_reply_to_messenger_message__ (mrmailbox_t*, mrmimeparser_t*);
    289 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);
    290 void mrmailbox_add_or_lookup_contacts_by_mailbox_list__(mrmailbox_t* ths, struct mailimf_mailbox_list* mb_list, int origin, carray* ids, int* check_self);
    291 void mrmailbox_add_or_lookup_contacts_by_address_list__(mrmailbox_t* ths, struct mailimf_address_list* adr_list, int origin, carray* ids, int* check_self);
    292 int mrmailbox_get_archived_count__ (mrmailbox_t*);
    293 int mrmailbox_reset_tables (mrmailbox_t*, int bits); /* reset tables but leaves server configuration, 1=jobs, 2=e2ee, 8=rest but server config */
    294 size_t mrmailbox_get_real_contact_cnt__ (mrmailbox_t*);
    295 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);
    296 int mrmailbox_get_contact_origin__ (mrmailbox_t*, uint32_t id, int* ret_blocked);
    297 int mrmailbox_is_contact_blocked__ (mrmailbox_t*, uint32_t id);
    298 int mrmailbox_real_contact_exists__ (mrmailbox_t*, uint32_t id);
    299 int mrmailbox_contact_addr_equals__ (mrmailbox_t*, uint32_t contact_id, const char* other_addr);
    300 void mrmailbox_scaleup_contact_origin__ (mrmailbox_t*, uint32_t contact_id, int origin);
    301 
    302 
    303 /* library private: end-to-end-encryption */
    304 #define MR_E2EE_DEFAULT_ENABLED 1
    305 #define MR_MDNS_DEFAULT_ENABLED 1
    306 
    307 typedef struct mrmailbox_e2ee_helper_t {
    308  int m_encryption_successfull;
    309  void* m_cdata_to_free;
    310 } mrmailbox_e2ee_helper_t;
    311 
    312 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*);
    313 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 */
    314 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! */
    315 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 */
    316 
    317 
    318 /*******************************************************************************
    319  * Events
    320  ******************************************************************************/
    321 
    322 
    323 /* The following events may be passed to the callback given to mrmailbox_new() */
    324 
    325 
    326 /* Information, should not be reported, can be logged,
    327 data1=0, data2=info string */
    328 #define MR_EVENT_INFO 100
    329 
    330 
    331 /* Warning, should not be reported, should be logged
    332 data1=0, data2=warning string */
    333 #define MR_EVENT_WARNING 300
    334 
    335 
    336 /* Error, must be reported to the user by a non-disturbing bubble or so.
    337 data1=error code MR_ERR_*, see below, data2=error string */
    338 #define MR_EVENT_ERROR 400
    339 
    340 
    341 /* one or more messages changed for some reasons in the database - added or
    342 removed. For added messages: data1=chat_id, data2=msg_id */
    343 #define MR_EVENT_MSGS_CHANGED 2000
    344 
    345 
    346 /* For fresh messages from the INBOX, MR_EVENT_INCOMING_MSG is send;
    347 data1=chat_id, data2=msg_id */
    348 #define MR_EVENT_INCOMING_MSG 2005
    349 
    350 
    351 /* a single message is send successfully (state changed from PENDING/SENDING to
    352 DELIVERED); data1=chat_id, data2=msg_id */
    353 #define MR_EVENT_MSG_DELIVERED 2010
    354 
    355 
    356 /* a single message is read by the receiver (state changed from DELIVERED to
    357 READ); data1=chat_id, data2=msg_id */
    358 #define MR_EVENT_MSG_READ 2015
    359 
    360 
    361 /* group name/image changed or members added/removed */
    362 #define MR_EVENT_CHAT_MODIFIED 2020
    363 
    364 
    365 /* contact(s) created, renamed, blocked or deleted */
    366 #define MR_EVENT_CONTACTS_CHANGED 2030
    367 
    368 
    369 /* connection state changed,
    370 data1=0:failed-not-connected, 1:configured-and-connected */
    371 #define MR_EVENT_CONFIGURE_ENDED 2040
    372 
    373 
    374 /* data1=percent */
    375 #define MR_EVENT_CONFIGURE_PROGRESS 2041
    376 
    377 
    378 /* mrmailbox_imex() done:
    379 data1=0:failed, 1=success */
    380 #define MR_EVENT_IMEX_ENDED 2050
    381 
    382 
    383 /* data1=permille */
    384 #define MR_EVENT_IMEX_PROGRESS 2051
    385 
    386 
    387 /* file written, event may be needed to make the file public to some system
    388 services. data1=file name, data2=mime type */
    389 #define MR_EVENT_IMEX_FILE_WRITTEN 2052
    390 
    391 
    392 /* The following events are functions that should be provided by the frontends */
    393 
    394 
    395 /* check, if the system is online currently
    396 ret=0: not online, ret=1: online */
    397 #define MR_EVENT_IS_ONLINE 2080
    398 
    399 
    400 /* get a string from the frontend, data1=MR_STR_*, ret=string which will be
    401 free()'d by the backend */
    402 #define MR_EVENT_GET_STRING 2091
    403 
    404 
    405 /* synchronous http/https(!) call, data1=url, ret=content which will be
    406 free()'d by the backend, 0 on errors */
    407 #define MR_EVENT_GET_QUANTITY_STRING 2092
    408 
    409 
    410 /* synchronous http/https(!) call, data1=url, ret=content which will be free()'d
    411 by the backend, 0 on errors */
    412 #define MR_EVENT_HTTP_GET 2100
    413 
    414 /* acquire wakeLock (data1=1) or release it (data1=0), the backend does not make
    415 nested or unsynchronized calls */
    416 #define MR_EVENT_WAKE_LOCK 2110
    417 
    418 
    419 /* Error codes */
    420 #define MR_ERR_SELF_NOT_IN_GROUP 1
    421 #define MR_ERR_NONETWORK 2
    422 
    423 
    424 /*******************************************************************************
    425  * Import/export and Tools
    426  ******************************************************************************/
    427 
    428 
    429 #define MR_IMEX_CANCEL 0
    430 #define MR_IMEX_EXPORT_SELF_KEYS 1
    431 #define MR_IMEX_IMPORT_SELF_KEYS 2
    432 #define MR_IMEX_EXPORT_BACKUP 11
    433 #define MR_IMEX_IMPORT_BACKUP 12
    434 #define MR_IMEX_EXPORT_SETUP_MESSAGE 20
    435 #define MR_BAK_PREFIX "delta-chat"
    436 #define MR_BAK_SUFFIX "bak"
    437 void mrmailbox_imex (mrmailbox_t*, int what, const char* param1, const char* setup_code);
    438 char* mrmailbox_imex_has_backup (mrmailbox_t*, const char* dir);
    439 
    440 
    441 
    442 int mrmailbox_check_password (mrmailbox_t*, const char* pw);
    443 
    444 
    445 
    446 char* mrmailbox_create_setup_code (mrmailbox_t*);
    447 
    448 
    449 
    450 int mrmailbox_poke_spec (mrmailbox_t*, const char* spec);
    451 
    452 
    453 /* The library tries itself to stay alive. For this purpose there is an additional
    454 "heartbeat" thread that checks if the IDLE-thread is up and working. This check is done about every minute.
    455 However, depending on the operating system, this thread may be delayed or stopped, if this is the case you can
    456 force additional checks manually by just calling mrmailbox_heartbeat() about every minute.
    457 If in doubt, call this function too often, not too less :-) */
    458 void mrmailbox_heartbeat (mrmailbox_t*);
    459 
    460 
    461 /* carray tools, already defined are things as
    462 unsigned unt carray_count() */
    463 uint32_t carray_get_uint32 (carray*, unsigned int index);
    464 
    465 
    466 /* deprecated functions */
    467 mrchat_t* mrchatlist_get_chat_by_index (mrchatlist_t*, size_t index); /* deprecated - use mrchatlist_get_chat_id_by_index() */
    468 mrmsg_t* mrchatlist_get_msg_by_index (mrchatlist_t*, size_t index); /* deprecated - use mrchatlist_get_msg_id_by_index() */
    469 int mrchat_set_draft (mrchat_t*, const char* msg); /* deprecated - use mrmailbox_set_draft() instead */
    470 
    471 
    472 /* library-internal */
    473 void mrmailbox_unarchive_chat__ (mrmailbox_t*, uint32_t chat_id);
    474 size_t mrmailbox_get_chat_cnt__ (mrmailbox_t*);
    475 uint32_t mrmailbox_create_or_lookup_nchat_by_contact_id__(mrmailbox_t*, uint32_t contact_id);
    476 uint32_t mrmailbox_lookup_real_nchat_by_contact_id__(mrmailbox_t*, uint32_t contact_id);
    477 int mrmailbox_get_total_msg_count__ (mrmailbox_t*, uint32_t chat_id);
    478 int mrmailbox_get_fresh_msg_count__ (mrmailbox_t*, uint32_t chat_id);
    479 uint32_t mrmailbox_get_last_deaddrop_fresh_msg__(mrmailbox_t*);
    480 void mrmailbox_send_msg_to_smtp (mrmailbox_t*, mrjob_t*);
    481 void mrmailbox_send_msg_to_imap (mrmailbox_t*, mrjob_t*);
    482 int mrmailbox_add_contact_to_chat__ (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    483 int mrmailbox_is_contact_in_chat__ (mrmailbox_t*, uint32_t chat_id, uint32_t contact_id);
    484 int mrmailbox_get_chat_contact_count__ (mrmailbox_t*, uint32_t chat_id);
    485 int mrmailbox_group_explicitly_left__ (mrmailbox_t*, const char* grpid);
    486 void mrmailbox_set_group_explicitly_left__ (mrmailbox_t*, const char* grpid);
    487 
    488 size_t mrmailbox_get_real_msg_cnt__ (mrmailbox_t*); /* the number of messages assigned to real chat (!=deaddrop, !=trash) */
    489 size_t mrmailbox_get_deaddrop_msg_cnt__ (mrmailbox_t*);
    490 int mrmailbox_rfc724_mid_cnt__ (mrmailbox_t*, const char* rfc724_mid);
    491 int mrmailbox_rfc724_mid_exists__ (mrmailbox_t*, const char* rfc724_mid, char** ret_server_folder, uint32_t* ret_server_uid);
    492 void mrmailbox_update_server_uid__ (mrmailbox_t*, const char* rfc724_mid, const char* server_folder, uint32_t server_uid);
    493 void mrmailbox_update_msg_chat_id__ (mrmailbox_t*, uint32_t msg_id, uint32_t chat_id);
    494 void mrmailbox_update_msg_state__ (mrmailbox_t*, uint32_t msg_id, int state);
    495 void mrmailbox_delete_msg_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    496 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 */
    497 void mrmailbox_send_mdn (mrmailbox_t*, mrjob_t* job);
    498 void mrmailbox_markseen_msg_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    499 void mrmailbox_markseen_mdn_on_imap (mrmailbox_t* mailbox, mrjob_t* job);
    500 
    501 
    502 #ifdef __cplusplus
    503 } /* /extern "C" */
    504 #endif
    505 #endif /* __MRMAILBOX_H__ */
    int mrmailbox_add_address_book(mrmailbox_t *mailbox, const char *adr_book)
    Add a number of contacts.
    Definition: mrmailbox.c:4021
    uint32_t mrmailbox_create_group_chat(mrmailbox_t *mailbox, const char *chat_name)
    Create a new group chat.
    Definition: mrmailbox.c:3333
    uint32_t mrmailbox_create_contact(mrmailbox_t *mailbox, const char *name, const char *addr)
    Add a single contact.
    Definition: mrmailbox.c:3985
    uint32_t mrmailbox_send_text_msg(mrmailbox_t *mailbox, uint32_t chat_id, const char *text_to_send)
    Send a simple text message to the given chat.
    Definition: mrmailbox.c:3101
    @@ -105,8 +105,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    void mrmailbox_star_msgs(mrmailbox_t *mailbox, const uint32_t *msg_ids, int msg_cnt, int star)
    Star/unstar messages by setting the last parameter to 0 (unstar) or 1(star).
    Definition: mrmailbox.c:4954
    carray * mrmailbox_search_msgs(mrmailbox_t *mailbox, uint32_t chat_id, const char *query)
    Search messages containing the given query string.
    Definition: mrmailbox.c:2224
    int mrmailbox_set_config(mrmailbox_t *ths, const char *key, const char *value)
    Configure the mailbox.
    Definition: mrmailbox.c:1176
    -
    char * m_dbfile
    the database file in file.
    Definition: mrmailbox.h:144
    -
    An object representing a single mailbox.
    Definition: mrmailbox.h:141
    +
    char * m_dbfile
    the database file in file.
    Definition: mrmailbox.h:146
    +
    An object representing a single mailbox.
    Definition: mrmailbox.h:143
    void mrmailbox_delete_msgs(mrmailbox_t *mailbox, const uint32_t *msg_ids, int msg_cnt)
    Delete a list of messages.
    Definition: mrmailbox.c:5096
    int mrmailbox_is_open(const mrmailbox_t *mailbox)
    Check if a given mailbox database is open.
    Definition: mrmailbox.c:1109
    void mrmailbox_archive_chat(mrmailbox_t *mailbox, uint32_t chat_id, int archive)
    Archive or unarchive a chat.
    Definition: mrmailbox.c:2652
    @@ -115,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    uint32_t mrmailbox_get_next_media(mrmailbox_t *mailbox, uint32_t curr_msg_id, int dir)
    Returns all message IDs of the given types in a chat.
    Definition: mrmailbox.c:1927
    char * mrmailbox_get_version_str(void)
    Find out the version of the Delta Chat core library.
    Definition: mrmailbox.c:1490
    void mrmailbox_disconnect(mrmailbox_t *mailbox)
    Disonnect the mailbox from the server.
    Definition: mrmailbox.c:1605
    -
    char * m_blobdir
    full path of the blob directory in use.
    Definition: mrmailbox.h:145
    +
    char * m_blobdir
    full path of the blob directory in use.
    Definition: mrmailbox.h:147
    carray * mrmailbox_get_fresh_msgs(mrmailbox_t *mailbox)
    Returns the message IDs of all fresh messages of any chat.
    Definition: mrmailbox.c:2052
    uint32_t mrmailbox_send_msg(mrmailbox_t *mailbox, uint32_t chat_id, mrmsg_t *msg)
    save message in database and send it, the given message object is not unref&#39;d by the function but som...
    Definition: mrmailbox.c:3142
    void mrmailbox_connect(mrmailbox_t *mailbox)
    Connect to the mailbox using the configured settings.
    Definition: mrmailbox.c:1578
    @@ -123,7 +123,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    carray * mrmailbox_get_chat_contacts(mrmailbox_t *mailbox, uint32_t chat_id)
    Get contact IDs belonging to a chat.
    Definition: mrmailbox.c:2003
    void mrmailbox_unref(mrmailbox_t *mailbox)
    Free a mailbox object.
    Definition: mrmailbox.c:954
    void mrmailbox_block_contact(mrmailbox_t *mailbox, uint32_t contact_id, int new_blocking)
    Block or unblock a contact.
    Definition: mrmailbox.c:4290
    -
    uintptr_t(* mrmailboxcb_t)(mrmailbox_t *, int event, uintptr_t data1, uintptr_t data2)
    Callback function that should be given to mrmailbox_new().
    Definition: mrmailbox.h:131
    +
    uintptr_t(* mrmailboxcb_t)(mrmailbox_t *, int event, uintptr_t data1, uintptr_t data2)
    Callback function that should be given to mrmailbox_new().
    Definition: mrmailbox.h:133
    mrchatlist_t * mrmailbox_get_chatlist(mrmailbox_t *mailbox, int listflags, const char *query)
    Get a list of chats.
    Definition: mrmailbox.c:1663
    An object representing a single message in memory.
    Definition: mrmsg.h:40
    void mrmailbox_configure_and_connect(mrmailbox_t *mailbox)
    Configure and connect a mailbox.
    Definition: mrmailbox_configure.c:665
    @@ -136,7 +136,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    carray * mrmailbox_get_known_contacts(mrmailbox_t *mailbox, const char *query)
    Returns known and unblocked contacts.
    Definition: mrmailbox.c:4076
    char * mrmailbox_get_blobdir(mrmailbox_t *mailbox)
    Get the blob directory.
    Definition: mrmailbox.c:1276
    mrmsg_t * mrmailbox_get_msg(mrmailbox_t *mailbox, uint32_t msg_id)
    Get a single message object of the type mrmsg_t.
    Definition: mrmailbox.c:4701
    -
    void * m_userdata
    the same pointer as given to mrmailbox_new(), may be used by the caller for any purpose ...
    Definition: mrmailbox.h:143
    +
    void * m_userdata
    the same pointer as given to mrmailbox_new(), may be used by the caller for any purpose ...
    Definition: mrmailbox.h:145
    int mrmailbox_is_configured(mrmailbox_t *mailbox)
    Check if the mailbox is already configured.
    Definition: mrmailbox_configure.c:735
    carray * mrmailbox_get_chat_media(mrmailbox_t *mailbox, uint32_t chat_id, int msg_type, int or_msg_type)
    Returns all message IDs of the given types in a chat.
    Definition: mrmailbox.c:1896
    uint32_t mrmailbox_create_chat_by_contact_id(mrmailbox_t *mailbox, uint32_t contact_id)
    Create a normal chat with a single user.
    Definition: mrmailbox.c:1816
    @@ -161,7 +161,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    diff --git a/docs/html/mrmailbox__internal_8h_source.html b/docs/html/mrmailbox__internal_8h_source.html index 30c607a1..b2fbd67a 100644 --- a/docs/html/mrmailbox__internal_8h_source.html +++ b/docs/html/mrmailbox__internal_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrmailbox_internal.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrmailbox_internal.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -91,7 +91,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    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_INTERNAL_H__
    24 #define __MRMAILBOX_INTERNAL_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 /* Includes that are used frequently. This file may also be used to create predefined headers. */
    31 #include "mrmailbox.h"
    32 #include <stdlib.h>
    33 #include <string.h>
    34 #include "mrsqlite3.h"
    35 #include "mrtools.h"
    36 #include "mrstock.h"
    37 
    38 
    39 #ifdef __cplusplus
    40 } /* /extern "C" */
    41 #endif
    42 #endif /* __MRMAILBOX_INTERNAL_H__ */
    43 
    diff --git a/docs/html/mrmimefactory_8h_source.html b/docs/html/mrmimefactory_8h_source.html index 3bc2e30d..4857eaa1 100644 --- a/docs/html/mrmimefactory_8h_source.html +++ b/docs/html/mrmimefactory_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrmimefactory.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrmimefactory.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -88,13 +88,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    mrmimefactory.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 __MRMIMEFACTORY_H__
    24 #define __MRMIMEFACTORY_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 
    31 
    32 typedef struct mrmsg_t mrmsg_t;
    33 typedef struct mrchat_t mrchat_t;
    34 typedef struct mrmailbox_t mrmailbox_t;
    35 
    36 
    37 #define MR_SYSTEM_GROUPNAME_CHANGED 2
    38 #define MR_SYSTEM_GROUPIMAGE_CHANGED 3
    39 #define MR_SYSTEM_MEMBER_ADDED_TO_GROUP 4
    40 #define MR_SYSTEM_MEMBER_REMOVED_FROM_GROUP 5
    41 
    42 
    43 typedef enum {
    44  MR_MF_NOTHING_LOADED = 0,
    45  MR_MF_MSG_LOADED,
    46  MR_MF_MDN_LOADED
    47 } mrmimefactory_loaded_t;
    48 
    49 
    53 typedef struct mrmimefactory_t {
    54 
    57  /* in: parameters, set eg. by mrmimefactory_load_msg() */
    58  char* m_from_addr;
    59  char* m_from_displayname;
    60  char* m_selfstatus;
    61  clist* m_recipients_names;
    62  clist* m_recipients_addr;
    63  time_t m_timestamp;
    64  char* m_rfc724_mid;
    65 
    66  /* what is loaded? */
    67  mrmimefactory_loaded_t m_loaded;
    68 
    69  mrmsg_t* m_msg;
    70  mrchat_t* m_chat;
    71  int m_increation;
    72  char* m_predecessor;
    73  char* m_references;
    74  int m_req_mdn;
    75 
    76  /* out: after a successfull mrmimefactory_create_mime(), here's the data */
    77  MMAPString* m_out;
    78  int m_out_encrypted;
    79 
    80  /* private */
    81  mrmailbox_t* m_mailbox;
    82 
    83 } mrmimefactory_t;
    84 
    85 
    86 void mrmimefactory_init (mrmimefactory_t*, mrmailbox_t*);
    87 void mrmimefactory_empty (mrmimefactory_t*);
    88 int mrmimefactory_load_msg (mrmimefactory_t*, uint32_t msg_id);
    89 int mrmimefactory_load_mdn (mrmimefactory_t*, uint32_t msg_id);
    90 int mrmimefactory_render (mrmimefactory_t*, int encrypt_to_self);
    91 
    92 
    93 #ifdef __cplusplus
    94 } /* /extern "C" */
    95 #endif
    96 #endif /* __MRMIMEFACTORY_H__ */
    97 
    An object representing a single mailbox.
    Definition: mrmailbox.h:141
    +
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 #ifndef __MRMIMEFACTORY_H__
    24 #define __MRMIMEFACTORY_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 
    31 
    32 typedef struct mrmsg_t mrmsg_t;
    33 typedef struct mrchat_t mrchat_t;
    34 typedef struct mrmailbox_t mrmailbox_t;
    35 
    36 
    37 #define MR_SYSTEM_GROUPNAME_CHANGED 2
    38 #define MR_SYSTEM_GROUPIMAGE_CHANGED 3
    39 #define MR_SYSTEM_MEMBER_ADDED_TO_GROUP 4
    40 #define MR_SYSTEM_MEMBER_REMOVED_FROM_GROUP 5
    41 
    42 
    43 typedef enum {
    44  MR_MF_NOTHING_LOADED = 0,
    45  MR_MF_MSG_LOADED,
    46  MR_MF_MDN_LOADED
    47 } mrmimefactory_loaded_t;
    48 
    49 
    53 typedef struct mrmimefactory_t {
    54 
    57  /* in: parameters, set eg. by mrmimefactory_load_msg() */
    58  char* m_from_addr;
    59  char* m_from_displayname;
    60  char* m_selfstatus;
    61  clist* m_recipients_names;
    62  clist* m_recipients_addr;
    63  time_t m_timestamp;
    64  char* m_rfc724_mid;
    65 
    66  /* what is loaded? */
    67  mrmimefactory_loaded_t m_loaded;
    68 
    69  mrmsg_t* m_msg;
    70  mrchat_t* m_chat;
    71  int m_increation;
    72  char* m_predecessor;
    73  char* m_references;
    74  int m_req_mdn;
    75 
    76  /* out: after a successfull mrmimefactory_create_mime(), here's the data */
    77  MMAPString* m_out;
    78  int m_out_encrypted;
    79 
    80  /* private */
    81  mrmailbox_t* m_mailbox;
    82 
    83 } mrmimefactory_t;
    84 
    85 
    86 void mrmimefactory_init (mrmimefactory_t*, mrmailbox_t*);
    87 void mrmimefactory_empty (mrmimefactory_t*);
    88 int mrmimefactory_load_msg (mrmimefactory_t*, uint32_t msg_id);
    89 int mrmimefactory_load_mdn (mrmimefactory_t*, uint32_t msg_id);
    90 int mrmimefactory_render (mrmimefactory_t*, int encrypt_to_self);
    91 
    92 
    93 #ifdef __cplusplus
    94 } /* /extern "C" */
    95 #endif
    96 #endif /* __MRMIMEFACTORY_H__ */
    97 
    An object representing a single mailbox.
    Definition: mrmailbox.h:143
    An object representing a single message in memory.
    Definition: mrmsg.h:40
    An object representing a single chat in memory.
    Definition: mrchat.h:39
    diff --git a/docs/html/mrmimeparser_8h_source.html b/docs/html/mrmimeparser_8h_source.html index 1ece85c4..7ed382e7 100644 --- a/docs/html/mrmimeparser_8h_source.html +++ b/docs/html/mrmimeparser_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrmimeparser.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrmimeparser.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -88,12 +88,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    mrmimeparser.h
    -
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 /* Parse MIME body; this is the text part of an IMF, see https://tools.ietf.org/html/rfc5322
    24 mrmimeparser_t has no deep dependencies to mrmailbox_t or to the database
    25 (mrmailbox_t is used for logging only). */
    26 
    27 
    28 #ifndef __MRMIMEPARSER_H__
    29 #define __MRMIMEPARSER_H__
    30 #ifdef __cplusplus
    31 extern "C" {
    32 #endif
    33 
    34 
    38 typedef struct mrmimepart_t
    39 {
    41  int m_type; /*one of MR_MSG_* */
    42  int m_is_meta; /*meta parts contain eg. profile or group images and are only present if there is at least one "normal" part*/
    43  char* m_msg;
    44  char* m_msg_raw;
    45  int m_bytes;
    46  mrparam_t* m_param;
    47 } mrmimepart_t;
    48 
    49 
    53 typedef struct mrmimeparser_t
    54 {
    57  /* data, read-only, must not be free()'d (it is free()'d when the MrMimeParser object gets destructed) */
    58  carray* m_parts; /*array of mrmimepart_t objects*/
    59  struct mailmime* m_mimeroot;
    60  struct mailimf_fields* m_header; /* a pointer somewhere to the MIME data, must not be freed */
    61  char* m_subject;
    62  int m_is_send_by_messenger;
    63  int m_decrypted_and_validated;
    64  int m_decrypted_with_validation_errors;
    65  int m_decrypting_failed; /* set, if there are multipart/encrypted parts left after decryption */
    66  const char* m_blobdir;
    67 
    68  int m_is_forwarded;
    69 
    70  mrmailbox_t* m_mailbox;
    71 
    72  carray* m_reports; /* array of mailmime objects */
    73 
    74  int m_is_system_message;
    75 
    76 } mrmimeparser_t;
    77 
    78 
    79 mrmimeparser_t* mrmimeparser_new (const char* blobdir, mrmailbox_t*);
    80 void mrmimeparser_unref (mrmimeparser_t*);
    81 void mrmimeparser_empty (mrmimeparser_t*);
    82 
    83 /* The data returned from Parse() must not be freed (it is free()'d when the MrMimeParser object gets destructed)
    84 Unless memory-allocation-errors occur, Parse() returns at least one empty part.
    85 (this is because we want to add even these message to our database to avoid reading them several times.
    86 of course, these empty messages are not added to any chat) */
    87 void mrmimeparser_parse (mrmimeparser_t*, const char* body_not_terminated, size_t body_bytes);
    88 
    89 /* mrmimeparser_get_last_nonmeta() gets the _last_ part _not_ flagged with m_is_meta. */
    90 mrmimepart_t* mrmimeparser_get_last_nonmeta (mrmimeparser_t*);
    91 #define mrmimeparser_has_nonmeta(a) (mrmimeparser_get_last_nonmeta((a))!=NULL)
    92 
    93 /* mrmimeparser_is_mailinglist_message() just checks if there is a `List-ID`-header. */
    94 int mrmimeparser_is_mailinglist_message (mrmimeparser_t*);
    95 
    96 /* low-level-tools for working with mailmime structures directly */
    97 char* mr_find_first_addr (const struct mailimf_mailbox_list*); /*the result must be freed*/
    98 char* mr_normalize_addr (const char*); /*the result must be freed*/
    99 struct mailimf_fields* mr_find_mailimf_fields(struct mailmime*); /*the result is a pointer to mime, must not be freed*/
    100 struct mailimf_field* mr_find_mailimf_field (struct mailimf_fields*, int wanted_fld_type); /*the result is a pointer to mime, must not be freed*/
    101 struct mailimf_optional_field* mr_find_mailimf_field2(struct mailimf_fields*, const char* wanted_fld_name);
    102 struct mailmime_parameter* mr_find_ct_parameter (struct mailmime*, const char* name);
    103 int mr_mime_transfer_decode(struct mailmime*, const char** ret_decoded_data, size_t* ret_decoded_data_bytes, char** ret_to_mmap_string_unref);
    104 
    105 
    106 #ifdef MR_USE_MIME_DEBUG
    107 void mr_print_mime(struct mailmime * mime);
    108 #endif
    109 
    110 
    111 #ifdef __cplusplus
    112 } /* /extern "C" */
    113 #endif
    114 #endif /* __MRMIMEPARSER_H__ */
    115 
    An object representing a single mailbox.
    Definition: mrmailbox.h:141
    +
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 /* 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:143
    An object for handling key=value parameter lists.
    Definition: mrparam.h:36
    diff --git a/docs/html/mrmsg_8h_source.html b/docs/html/mrmsg_8h_source.html index f275accf..9a067ff6 100644 --- a/docs/html/mrmsg_8h_source.html +++ b/docs/html/mrmsg_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrmsg.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrmsg.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -88,7 +88,7 @@ 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 {
    42  #define MR_MSG_ID_MARKER1 1
    43  #define MR_MSG_ID_DAYMARKER 9
    44  #define MR_MSG_ID_LAST_SPECIAL 9
    45  uint32_t m_id;
    47  uint32_t m_from_id;
    48  uint32_t m_to_id;
    49  uint32_t m_chat_id;
    50  time_t m_timestamp;
    52  #define MR_MSG_UNDEFINED 0
    53  #define MR_MSG_TEXT 10
    54  #define MR_MSG_IMAGE 20
    55  #define MR_MSG_GIF 21
    56  #define MR_MSG_AUDIO 40
    57  #define MR_MSG_VOICE 41
    58  #define MR_MSG_VIDEO 50
    59  #define MR_MSG_FILE 60
    60  int m_type;
    62  #define MR_STATE_UNDEFINED 0
    63  #define MR_STATE_IN_FRESH 10
    64  #define MR_STATE_IN_NOTICED 13
    65  #define MR_STATE_IN_SEEN 16
    66  #define MR_STATE_OUT_PENDING 20
    67  #define MR_STATE_OUT_ERROR 24
    68  #define MR_STATE_OUT_DELIVERED 26
    69  #define MR_STATE_OUT_MDN_RCVD 28
    70  int m_state;
    72  char* m_text;
    73  mrparam_t* m_param;
    74  int m_starred;
    75  int m_is_msgrmsg;
    78  mrmailbox_t* m_mailbox;
    79  char* m_rfc724_mid;
    80  char* m_server_folder;
    81  uint32_t m_server_uid;
    82 } mrmsg_t;
    83 
    84 
    85 mrmsg_t* mrmsg_new ();
    86 void mrmsg_unref (mrmsg_t*);
    87 void mrmsg_empty (mrmsg_t*);
    89 char* mrmsg_get_summarytext (mrmsg_t*, int approx_characters);
    91 char* mrmsg_get_fullpath (mrmsg_t*);
    92 char* mrmsg_get_filename (mrmsg_t*);
    94 int mrmsg_is_increation (mrmsg_t*);
    96 void mrmsg_set_text (mrmsg_t*, const char* text);
    97 
    98 /* library-private */
    99 #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 "
    100 int mrmsg_set_from_stmt__ (mrmsg_t*, sqlite3_stmt* row, int row_offset); /* row order is MR_MSG_FIELDS */
    101 int mrmsg_load_from_db__ (mrmsg_t*, mrmailbox_t*, uint32_t id);
    102 int mrmsg_is_increation__ (const mrmsg_t*);
    103 char* mrmsg_get_summarytext_by_raw (int type, const char* text, mrparam_t*, int approx_bytes); /* the returned value must be free()'d */
    104 void mrmsg_save_param_to_disk__ (mrmsg_t*);
    105 void mrmsg_guess_msgtype_from_suffix (const char* pathNfilename, int* ret_msgtype, char** ret_mime);
    106 void mrmsg_get_authorNtitle_from_filename (const char* pathNfilename, char** ret_author, char** ret_title);
    107 
    108 #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)
    109 #define MR_MSG_MAKE_FILENAME_SEARCHABLE(a) ((a)==MR_MSG_AUDIO || (a)==MR_MSG_FILE || (a)==MR_MSG_VIDEO ) /* add filename.ext (without path) to m_text? this is needed for the fulltext search. The extension is useful to get all PDF, all MP3 etc. */
    110 #define MR_MSG_MAKE_SUFFIX_SEARCHABLE(a) ((a)==MR_MSG_IMAGE || (a)==MR_MSG_GIF || (a)==MR_MSG_VOICE)
    111 
    112 #define APPROX_SUBJECT_CHARS 32 /* as we do not cut inside words, this results in about 32-42 characters.
    113  Do not use too long subjects - we add a tag after the subject which gets truncated by the clients otherwise.
    114  It should also be very clear, the subject is _not_ the whole message.
    115  The value is also used for CC:-summaries */
    116 
    117 
    118 #ifdef __cplusplus
    119 } /* /extern "C" */
    120 #endif
    121 #endif /* __MRMSG_H__ */
    An object representing a single mailbox.
    Definition: mrmailbox.h:141
    +
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 #ifndef __MRMSG_H__
    24 #define __MRMSG_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 typedef struct mrmailbox_t mrmailbox_t;
    31 typedef struct mrparam_t mrparam_t;
    32 typedef struct sqlite3_stmt sqlite3_stmt;
    33 
    34 
    40 typedef struct mrmsg_t
    41 {
    42  #define MR_MSG_ID_MARKER1 1
    43  #define MR_MSG_ID_DAYMARKER 9
    44  #define MR_MSG_ID_LAST_SPECIAL 9
    45  uint32_t m_id;
    47  uint32_t m_from_id;
    48  uint32_t m_to_id;
    49  uint32_t m_chat_id;
    50  time_t m_timestamp;
    52  #define MR_MSG_UNDEFINED 0
    53  #define MR_MSG_TEXT 10
    54  #define MR_MSG_IMAGE 20
    55  #define MR_MSG_GIF 21
    56  #define MR_MSG_AUDIO 40
    57  #define MR_MSG_VOICE 41
    58  #define MR_MSG_VIDEO 50
    59  #define MR_MSG_FILE 60
    60  int m_type;
    62  #define MR_STATE_UNDEFINED 0
    63  #define MR_STATE_IN_FRESH 10
    64  #define MR_STATE_IN_NOTICED 13
    65  #define MR_STATE_IN_SEEN 16
    66  #define MR_STATE_OUT_PENDING 20
    67  #define MR_STATE_OUT_ERROR 24
    68  #define MR_STATE_OUT_DELIVERED 26
    69  #define MR_STATE_OUT_MDN_RCVD 28
    70  int m_state;
    72  char* m_text;
    73  mrparam_t* m_param;
    74  int m_starred;
    75  int m_is_msgrmsg;
    78  mrmailbox_t* m_mailbox;
    79  char* m_rfc724_mid;
    80  char* m_server_folder;
    81  uint32_t m_server_uid;
    82 } mrmsg_t;
    83 
    84 
    85 mrmsg_t* mrmsg_new ();
    86 void mrmsg_unref (mrmsg_t*);
    87 void mrmsg_empty (mrmsg_t*);
    89 char* mrmsg_get_summarytext (mrmsg_t*, int approx_characters);
    91 char* mrmsg_get_fullpath (mrmsg_t*);
    92 char* mrmsg_get_filename (mrmsg_t*);
    94 int mrmsg_is_increation (mrmsg_t*);
    96 void mrmsg_set_text (mrmsg_t*, const char* text);
    97 
    98 /* library-private */
    99 #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 "
    100 int mrmsg_set_from_stmt__ (mrmsg_t*, sqlite3_stmt* row, int row_offset); /* row order is MR_MSG_FIELDS */
    101 int mrmsg_load_from_db__ (mrmsg_t*, mrmailbox_t*, uint32_t id);
    102 int mrmsg_is_increation__ (const mrmsg_t*);
    103 char* mrmsg_get_summarytext_by_raw (int type, const char* text, mrparam_t*, int approx_bytes); /* the returned value must be free()'d */
    104 void mrmsg_save_param_to_disk__ (mrmsg_t*);
    105 void mrmsg_guess_msgtype_from_suffix (const char* pathNfilename, int* ret_msgtype, char** ret_mime);
    106 void mrmsg_get_authorNtitle_from_filename (const char* pathNfilename, char** ret_author, char** ret_title);
    107 
    108 #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)
    109 #define MR_MSG_MAKE_FILENAME_SEARCHABLE(a) ((a)==MR_MSG_AUDIO || (a)==MR_MSG_FILE || (a)==MR_MSG_VIDEO ) /* add filename.ext (without path) to m_text? this is needed for the fulltext search. The extension is useful to get all PDF, all MP3 etc. */
    110 #define MR_MSG_MAKE_SUFFIX_SEARCHABLE(a) ((a)==MR_MSG_IMAGE || (a)==MR_MSG_GIF || (a)==MR_MSG_VOICE)
    111 
    112 #define APPROX_SUBJECT_CHARS 32 /* as we do not cut inside words, this results in about 32-42 characters.
    113  Do not use too long subjects - we add a tag after the subject which gets truncated by the clients otherwise.
    114  It should also be very clear, the subject is _not_ the whole message.
    115  The value is also used for CC:-summaries */
    116 
    117 
    118 #ifdef __cplusplus
    119 } /* /extern "C" */
    120 #endif
    121 #endif /* __MRMSG_H__ */
    An object representing a single mailbox.
    Definition: mrmailbox.h:143
    char * mrmsg_get_summarytext(mrmsg_t *msg, int approx_characters)
    Get a message summary as a single line of text.
    Definition: mrmsg.c:340
    uint32_t m_chat_id
    Chat ID the message belongs to.
    Definition: mrmsg.h:49
    mrmsg_t * mrmsg_new()
    Create new message object.
    Definition: mrmsg.c:41
    @@ -110,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    diff --git a/docs/html/mrosnative_8h_source.html b/docs/html/mrosnative_8h_source.html index 3b28f438..47d99776 100644 --- a/docs/html/mrosnative_8h_source.html +++ b/docs/html/mrosnative_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrosnative.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrosnative.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -88,11 +88,11 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    mrosnative.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 __MROSNATIVE_H__
    24 #define __MROSNATIVE_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 /*** library-private **********************************************************/
    31 
    32 
    33 typedef struct mrmailbox_t mrmailbox_t;
    34 
    35 int mrosnative_setup_thread (mrmailbox_t*); /*returns true/false*/
    36 void mrosnative_unsetup_thread (mrmailbox_t*);
    37 
    38 
    39 #ifdef __cplusplus
    40 } /* /extern "C" */
    41 #endif
    42 #endif /* __MROSNATIVE_H__ */
    An object representing a single mailbox.
    Definition: mrmailbox.h:141
    +
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 #ifndef __MROSNATIVE_H__
    24 #define __MROSNATIVE_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 /*** library-private **********************************************************/
    31 
    32 
    33 typedef struct mrmailbox_t mrmailbox_t;
    34 
    35 int mrosnative_setup_thread (mrmailbox_t*); /*returns true/false*/
    36 void mrosnative_unsetup_thread (mrmailbox_t*);
    37 
    38 
    39 #ifdef __cplusplus
    40 } /* /extern "C" */
    41 #endif
    42 #endif /* __MROSNATIVE_H__ */
    An object representing a single mailbox.
    Definition: mrmailbox.h:143
    diff --git a/docs/html/mrparam_8h_source.html b/docs/html/mrparam_8h_source.html index 3ad4de46..0e1ab425 100644 --- a/docs/html/mrparam_8h_source.html +++ b/docs/html/mrparam_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrparam.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrparam.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    diff --git a/docs/html/mrpgp_8h_source.html b/docs/html/mrpgp_8h_source.html index d13a46da..fa3fbe75 100644 --- a/docs/html/mrpgp_8h_source.html +++ b/docs/html/mrpgp_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrpgp.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrpgp.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -88,11 +88,11 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    mrpgp.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 __MRPGP_H__
    24 #define __MRPGP_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 /*** library-private **********************************************************/
    31 
    32 typedef struct mrkey_t mrkey_t;
    33 typedef struct mrkeyring_t mrkeyring_t;
    34 
    35 
    36 /* validation errors */
    37 #define MR_VALIDATE_NO_SIGNATURE 0x01
    38 #define MR_VALIDATE_UNKNOWN_SIGNATURE 0x02
    39 #define MR_VALIDATE_BAD_SIGNATURE 0x04
    40 #define MR_VALIDATE_NOT_MUTUAL 0x08
    41 
    42 /* misc. */
    43 void mrpgp_init (mrmailbox_t*);
    44 void mrpgp_exit (mrmailbox_t*);
    45 void mrpgp_rand_seed (mrmailbox_t*, const void* buf, size_t bytes);
    46 
    47 
    48 /* public key encryption */
    49 int mrpgp_create_keypair (mrmailbox_t*, const char* addr, mrkey_t* public_key, mrkey_t* private_key);
    50 int mrpgp_is_valid_key (mrmailbox_t*, const mrkey_t*);
    51 int mrpgp_calc_fingerprint (mrmailbox_t*, const mrkey_t*, uint8_t** fingerprint, size_t* fingerprint_bytes);
    52 int mrpgp_split_key (mrmailbox_t*, const mrkey_t* private_in, mrkey_t* public_out);
    53 
    54 int mrpgp_pk_encrypt (mrmailbox_t*, const void* plain, size_t plain_bytes, const mrkeyring_t*, const mrkey_t* sign_key, int use_armor, void** ret_ctext, size_t* ret_ctext_bytes);
    55 int mrpgp_pk_decrypt (mrmailbox_t*, const void* ctext, size_t ctext_bytes, const mrkeyring_t*, const mrkey_t* validate_key, int use_armor, void** plain, size_t* plain_bytes, int* ret_validation_errors);
    56 
    57 
    58 #ifdef __cplusplus
    59 } /* /extern "C" */
    60 #endif
    61 #endif /* __MRPGP_H__ */
    An object representing a single mailbox.
    Definition: mrmailbox.h:141
    +
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 #ifndef __MRPGP_H__
    24 #define __MRPGP_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 /*** library-private **********************************************************/
    31 
    32 typedef struct mrkey_t mrkey_t;
    33 typedef struct mrkeyring_t mrkeyring_t;
    34 
    35 
    36 /* validation errors */
    37 #define MR_VALIDATE_NO_SIGNATURE 0x01
    38 #define MR_VALIDATE_UNKNOWN_SIGNATURE 0x02
    39 #define MR_VALIDATE_BAD_SIGNATURE 0x04
    40 #define MR_VALIDATE_NOT_MUTUAL 0x08
    41 
    42 /* misc. */
    43 void mrpgp_init (mrmailbox_t*);
    44 void mrpgp_exit (mrmailbox_t*);
    45 void mrpgp_rand_seed (mrmailbox_t*, const void* buf, size_t bytes);
    46 
    47 
    48 /* public key encryption */
    49 int mrpgp_create_keypair (mrmailbox_t*, const char* addr, mrkey_t* public_key, mrkey_t* private_key);
    50 int mrpgp_is_valid_key (mrmailbox_t*, const mrkey_t*);
    51 int mrpgp_calc_fingerprint (mrmailbox_t*, const mrkey_t*, uint8_t** fingerprint, size_t* fingerprint_bytes);
    52 int mrpgp_split_key (mrmailbox_t*, const mrkey_t* private_in, mrkey_t* public_out);
    53 
    54 int mrpgp_pk_encrypt (mrmailbox_t*, const void* plain, size_t plain_bytes, const mrkeyring_t*, const mrkey_t* sign_key, int use_armor, void** ret_ctext, size_t* ret_ctext_bytes);
    55 int mrpgp_pk_decrypt (mrmailbox_t*, const void* ctext, size_t ctext_bytes, const mrkeyring_t*, const mrkey_t* validate_key, int use_armor, void** plain, size_t* plain_bytes, int* ret_validation_errors);
    56 
    57 
    58 #ifdef __cplusplus
    59 } /* /extern "C" */
    60 #endif
    61 #endif /* __MRPGP_H__ */
    An object representing a single mailbox.
    Definition: mrmailbox.h:143
    diff --git a/docs/html/mrpoortext_8h_source.html b/docs/html/mrpoortext_8h_source.html index a6b4c14b..dce8a464 100644 --- a/docs/html/mrpoortext_8h_source.html +++ b/docs/html/mrpoortext_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrpoortext.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrpoortext.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    diff --git a/docs/html/mrsaxparser_8h_source.html b/docs/html/mrsaxparser_8h_source.html index 68351d1a..1f35e7a8 100644 --- a/docs/html/mrsaxparser_8h_source.html +++ b/docs/html/mrsaxparser_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrsaxparser.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrsaxparser.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -91,7 +91,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    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 __MRSAXPARSER_H__
    24 #define __MRSAXPARSER_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 typedef void (*mrsaxparser_starttag_cb_t) (void* userdata, const char* tag, char** attr);
    31 typedef void (*mrsaxparser_endtag_cb_t) (void* userdata, const char* tag);
    32 typedef void (*mrsaxparser_text_cb_t) (void* userdata, const char* text, int len); /* len is only informational, text is already null-terminated */
    33 
    34 
    35 typedef struct mrsaxparser_t
    36 {
    37  mrsaxparser_starttag_cb_t m_starttag_cb;
    38  mrsaxparser_endtag_cb_t m_endtag_cb;
    39  mrsaxparser_text_cb_t m_text_cb;
    40  void* m_userdata;
    41 } mrsaxparser_t;
    42 
    43 
    44 void mrsaxparser_init (mrsaxparser_t*, void* userData);
    45 void mrsaxparser_set_tag_handler (mrsaxparser_t*, mrsaxparser_starttag_cb_t, mrsaxparser_endtag_cb_t);
    46 void mrsaxparser_set_text_handler (mrsaxparser_t*, mrsaxparser_text_cb_t);
    47 
    48 void mrsaxparser_parse (mrsaxparser_t*, const char* text);
    49 
    50 const char* mrattr_find (char** attr, const char* key);
    51 
    52 
    53 /*** library-private **********************************************************/
    54 
    55 
    56 #ifdef __cplusplus
    57 } /* /extern "C" */
    58 #endif
    59 #endif /* __MRSAXPARSER_H__ */
    60 
    diff --git a/docs/html/mrsimplify_8h_source.html b/docs/html/mrsimplify_8h_source.html index 440d8ad5..2a0d1b6b 100644 --- a/docs/html/mrsimplify_8h_source.html +++ b/docs/html/mrsimplify_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrsimplify.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrsimplify.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -91,7 +91,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    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 __MRSIMPLIFY_H__
    24 #define __MRSIMPLIFY_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 /*** library-private **********************************************************/
    31 
    32 typedef struct mrsimplify_t
    33 {
    34  int m_is_forwarded;
    35 } mrsimplify_t;
    36 
    37 
    38 mrsimplify_t* mrsimplify_new ();
    39 void mrsimplify_unref (mrsimplify_t*);
    40 
    41 /* Simplify and normalise text: Remove quotes, signatures, unnecessary
    42 lineends etc.
    43 The data returned from Simplify() must be free()'d when no longer used, private */
    44 char* mrsimplify_simplify (mrsimplify_t*, const char* txt_unterminated, int txt_bytes, int is_html);
    45 
    46 
    47 #ifdef __cplusplus
    48 } /* /extern "C" */
    49 #endif
    50 #endif /* __MRSIMPLIFY_H__ */
    51 
    diff --git a/docs/html/mrsmtp_8h_source.html b/docs/html/mrsmtp_8h_source.html index 64323eaa..8816eb6c 100644 --- a/docs/html/mrsmtp_8h_source.html +++ b/docs/html/mrsmtp_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrsmtp.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrsmtp.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -88,11 +88,11 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    mrsmtp.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 __MRSMTP_H__
    24 #define __MRSMTP_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 #include "mrloginparam.h"
    31 
    32 
    33 /*** library-private **********************************************************/
    34 
    35 typedef struct mrsmtp_t
    36 {
    37  mailsmtp* m_hEtpan;
    38  char* m_from;
    39  int m_esmtp;
    40  pthread_mutex_t m_mutex;
    41 
    42  int m_log_connect_errors;
    43  int m_log_usual_error;
    44 
    45  mrmailbox_t* m_mailbox; /* only for logging! */
    46 } mrsmtp_t;
    47 
    48 mrsmtp_t* mrsmtp_new (mrmailbox_t*);
    49 void mrsmtp_unref (mrsmtp_t*);
    50 int mrsmtp_is_connected (const mrsmtp_t*);
    51 int mrsmtp_connect (mrsmtp_t*, const mrloginparam_t*);
    52 void mrsmtp_disconnect (mrsmtp_t*);
    53 int mrsmtp_send_msg (mrsmtp_t*, const clist* recipients, const char* data, size_t data_bytes);
    54 
    55 
    56 #ifdef __cplusplus
    57 } /* /extern "C" */
    58 #endif
    59 #endif /* __MRPARAM_H__ */
    60 
    An object representing a single mailbox.
    Definition: mrmailbox.h:141
    +
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 #ifndef __MRSMTP_H__
    24 #define __MRSMTP_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 #include "mrloginparam.h"
    31 
    32 
    33 /*** library-private **********************************************************/
    34 
    35 typedef struct mrsmtp_t
    36 {
    37  mailsmtp* m_hEtpan;
    38  char* m_from;
    39  int m_esmtp;
    40  pthread_mutex_t m_mutex;
    41 
    42  int m_log_connect_errors;
    43  int m_log_usual_error;
    44 
    45  mrmailbox_t* m_mailbox; /* only for logging! */
    46 } mrsmtp_t;
    47 
    48 mrsmtp_t* mrsmtp_new (mrmailbox_t*);
    49 void mrsmtp_unref (mrsmtp_t*);
    50 int mrsmtp_is_connected (const mrsmtp_t*);
    51 int mrsmtp_connect (mrsmtp_t*, const mrloginparam_t*);
    52 void mrsmtp_disconnect (mrsmtp_t*);
    53 int mrsmtp_send_msg (mrsmtp_t*, const clist* recipients, const char* data, size_t data_bytes);
    54 
    55 
    56 #ifdef __cplusplus
    57 } /* /extern "C" */
    58 #endif
    59 #endif /* __MRPARAM_H__ */
    60 
    An object representing a single mailbox.
    Definition: mrmailbox.h:143
    diff --git a/docs/html/mrsqlite3_8h_source.html b/docs/html/mrsqlite3_8h_source.html index fff61c1d..0e0f9a10 100644 --- a/docs/html/mrsqlite3_8h_source.html +++ b/docs/html/mrsqlite3_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrsqlite3.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrsqlite3.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -88,11 +88,11 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    mrsqlite3.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 __MRSQLITE3_H__
    24 #define __MRSQLITE3_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 /*** library-private **********************************************************/
    31 
    32 #include <sqlite3.h>
    33 #include <libetpan/libetpan.h>
    34 #include <pthread.h>
    35 typedef struct mrmailbox_t mrmailbox_t;
    36 
    37 
    38 /* predefined statements */
    39 enum
    40 {
    41  BEGIN_transaction = 0 /* must be first */
    42  ,ROLLBACK_transaction
    43  ,COMMIT_transaction
    44 
    45  ,SELECT_v_FROM_config_k
    46  ,INSERT_INTO_config_kv
    47  ,UPDATE_config_vk
    48  ,DELETE_FROM_config_k
    49 
    50  ,SELECT_COUNT_FROM_contacts
    51  ,SELECT_naob_FROM_contacts_i
    52  ,SELECT_inao_FROM_contacts_a
    53  ,SELECT_id_FROM_contacts_WHERE_id
    54  ,SELECT_na_FROM_chats_contacs_JOIN_contacts_WHERE_cc
    55  ,SELECT_p_FROM_chats_contacs_JOIN_contacts_peerstates_WHERE_cc
    56  ,SELECT_id_FROM_contacts_WHERE_chat_id
    57  ,SELECT_id_FROM_contacts_ORDER_BY
    58  ,SELECT_id_FROM_contacts_WHERE_query_ORDER_BY
    59  ,SELECT_COUNT_FROM_contacts_WHERE_blocked
    60  ,SELECT_id_FROM_contacts_WHERE_blocked
    61  ,INSERT_INTO_contacts_neo
    62  ,UPDATE_contacts_nao_WHERE_i
    63  ,UPDATE_contacts_SET_origin_WHERE_id
    64  ,UPDATE_contacts_SET_b_WHERE_i
    65  ,DELETE_FROM_contacts_WHERE_id
    66 
    67  ,SELECT_COUNT_FROM_chats
    68  ,SELECT_COUNT_FROM_chats_WHERE_archived
    69  ,SELECT_ii_FROM_chats_LEFT_JOIN_msgs_WHERE_archived
    70  ,SELECT_ii_FROM_chats_LEFT_JOIN_msgs_WHERE_unarchived
    71  ,SELECT_ii_FROM_chats_LEFT_JOIN_msgs_WHERE_query
    72  ,SELECT_itndd_FROM_chats_WHERE_i
    73  ,SELECT_id_FROM_chats_WHERE_id
    74  ,SELECT_id_FROM_chats_WHERE_contact_id
    75  ,SELECT_id_FROM_CHATS_WHERE_grpid
    76  ,SELECT_timestamp_FROM_msgs_WHERE_timestamp
    77  ,SELECT_it_FROM_msgs_JOIN_chats_WHERE_rfc724
    78  ,SELECT_MAX_timestamp_FROM_msgs
    79  ,SELECT_rfc724_FROM_msgs_ORDER_BY_timestamp_LIMIT_1
    80  ,UPDATE_chats_SET_draft_WHERE_id
    81  ,UPDATE_chats_SET_n_WHERE_c
    82  ,UPDATE_chats_SET_blocked
    83  ,UPDATE_chats_SET_unarchived
    84 
    85  ,SELECT_a_FROM_chats_contacts_WHERE_i
    86  ,SELECT_COUNT_FROM_chats_contacts_WHERE_chat_id
    87  ,SELECT_COUNT_FROM_chats_contacts_WHERE_contact_id
    88  ,SELECT_c_FROM_chats_contacts_WHERE_c
    89  ,SELECT_c_FROM_chats_contacts_WHERE_c_ORDER_BY
    90  ,SELECT_void_FROM_chats_contacts_WHERE_chat_id_AND_contact_id
    91  ,INSERT_INTO_chats_contacts
    92 
    93  ,SELECT_COUNT_FROM_msgs_WHERE_assigned
    94  ,SELECT_COUNT_FROM_msgs_WHERE_unassigned
    95  ,SELECT_COUNT_FROM_msgs_WHERE_state_AND_chat_id
    96  ,SELECT_COUNT_FROM_msgs_WHERE_chat_id
    97  ,SELECT_COUNT_FROM_msgs_WHERE_rfc724_mid
    98  ,SELECT_COUNT_FROM_msgs_WHERE_ft
    99  ,SELECT_COUNT_DISTINCT_f_FROM_msgs_WHERE_c
    100  ,SELECT_i_FROM_msgs_WHERE_ctt
    101  ,SELECT_id_FROM_msgs_WHERE_cm
    102  ,SELECT_id_FROM_msgs_WHERE_mcm
    103  ,SELECT_id_FROM_msgs_WHERE_fresh_AND_deaddrop
    104  ,SELECT_txt_raw_FROM_msgs_WHERE_id
    105  ,SELECT_ircftttstpb_FROM_msg_WHERE_i
    106  ,SELECT_ss_FROM_msgs_WHERE_m
    107  ,SELECT_i_FROM_msgs_LEFT_JOIN_contacts_WHERE_c
    108  ,SELECT_i_FROM_msgs_LEFT_JOIN_contacts_WHERE_starred
    109  ,SELECT_i_FROM_msgs_LEFT_JOIN_contacts_WHERE_fresh
    110  ,SELECT_i_FROM_msgs_WHERE_query
    111  ,SELECT_i_FROM_msgs_WHERE_chat_id_AND_query
    112  ,INSERT_INTO_msgs_msscftttsmttpb
    113  ,INSERT_INTO_msgs_mcftttstpb
    114  ,UPDATE_msgs_SET_chat_id_WHERE_id
    115  ,UPDATE_msgs_SET_state_WHERE_id
    116  ,UPDATE_msgs_SET_seen_WHERE_id_AND_chat_id_AND_freshORnoticed
    117  ,UPDATE_msgs_SET_noticed_WHERE_id_AND_fresh
    118  ,UPDATE_msgs_SET_state_WHERE_chat_id_AND_state
    119  ,UPDATE_msgs_SET_state_WHERE_from_id_AND_state
    120  ,UPDATE_msgs_SET_ss_WHERE_rfc724_mid
    121  ,UPDATE_msgs_SET_param_WHERE_id
    122  ,UPDATE_msgs_SET_starred_WHERE_id
    123  ,DELETE_FROM_msgs_WHERE_id
    124  ,DELETE_FROM_msgs_WHERE_rfc724_mid
    125 
    126  ,SELECT_c_FROM_msgs_mdns_WHERE_mc
    127  ,INSERT_INTO_msgs_mdns
    128  ,SELECT_COUNT_FROM_msgs_mdns_WHERE_m
    129  ,DELETE_FROM_msgs_mdns_WHERE_m
    130 
    131  ,INSERT_INTO_jobs_aafp
    132  ,SELECT_MIN_d_FROM_jobs
    133  ,SELECT_iafp_FROM_jobs
    134  ,DELETE_FROM_jobs_WHERE_id
    135  ,DELETE_FROM_jobs_WHERE_action
    136  ,UPDATE_jobs_SET_dp_WHERE_id
    137 
    138  ,SELECT_FROM_leftgrps_WHERE_grpid
    139 
    140  ,INSERT_INTO_acpeerstates_a
    141  ,SELECT_aclpp_FROM_acpeerstates_WHERE_a
    142  ,UPDATE_acpeerstates_SET_l_WHERE_a
    143  ,UPDATE_acpeerstates_SET_lcpp_WHERE_a
    144 
    145  ,INSERT_INTO_keypairs_aippc
    146  ,SELECT_private_key_FROM_keypairs_WHERE_default
    147  ,SELECT_private_key_FROM_keypairs_ORDER_BY_default
    148  ,SELECT_public_key_FROM_keypairs_WHERE_default
    149 
    150  ,PREDEFINED_CNT /* must be last */
    151 };
    152 
    153 
    162 typedef struct mrsqlite3_t
    163 {
    165  sqlite3_stmt* m_pd[PREDEFINED_CNT];
    166  sqlite3* m_cobj;
    167  int m_transactionCount;
    168  mrmailbox_t* m_mailbox;
    169  pthread_mutex_t m_critical_;
    171 } mrsqlite3_t;
    172 
    173 
    174 mrsqlite3_t* mrsqlite3_new (mrmailbox_t*);
    175 void mrsqlite3_unref (mrsqlite3_t*);
    176 
    177 #define MR_OPEN_READONLY 0x01
    178 int mrsqlite3_open__ (mrsqlite3_t*, const char* dbfile, int flags);
    179 
    180 void mrsqlite3_close__ (mrsqlite3_t*);
    181 int mrsqlite3_is_open (const mrsqlite3_t*);
    182 
    183 /* handle configurations, private */
    184 int mrsqlite3_set_config__ (mrsqlite3_t*, const char* key, const char* value);
    185 int mrsqlite3_set_config_int__ (mrsqlite3_t*, const char* key, int32_t value);
    186 char* mrsqlite3_get_config__ (mrsqlite3_t*, const char* key, const char* def); /* the returned string must be free()'d, returns NULL on errors */
    187 int32_t mrsqlite3_get_config_int__ (mrsqlite3_t*, const char* key, int32_t def);
    188 
    189 /* tools, these functions are compatible to the corresponding sqlite3_* functions */
    190 sqlite3_stmt* mrsqlite3_predefine__ (mrsqlite3_t*, size_t idx, const char* sql); /*the result is resetted as needed and must not be freed. CAVE: you must not call this function with different strings for the same index!*/
    191 sqlite3_stmt* mrsqlite3_prepare_v2_ (mrsqlite3_t*, const char* sql); /* the result mus be freed using sqlite3_finalize() */
    192 int mrsqlite3_execute__ (mrsqlite3_t*, const char* sql);
    193 int mrsqlite3_table_exists__ (mrsqlite3_t*, const char* name);
    194 void mrsqlite3_log_error (mrsqlite3_t*, const char* msg, ...);
    195 
    196 /* reset all predefined statements, this is needed only in very rare cases, eg. when dropping a table and there are pending statements */
    197 void mrsqlite3_reset_all_predefinitions(mrsqlite3_t*);
    198 
    199 /* tools for locking, may be called nested, see also m_critical_ above.
    200 the user of MrSqlite3 must make sure that the MrSqlite3-object is only used by one thread at the same time.
    201 In general, we will lock the hightest level as possible - this avoids deadlocks and massive on/off lockings.
    202 Low-level-functions, eg. the MrSqlite3-methods, do not lock. */
    203 void mrsqlite3_lock (mrsqlite3_t*); /* lock or wait; these calls must not be nested in a single thread */
    204 void mrsqlite3_unlock (mrsqlite3_t*);
    205 
    206 /* nestable transactions, only the outest is really used */
    207 void mrsqlite3_begin_transaction__(mrsqlite3_t*);
    208 void mrsqlite3_commit__ (mrsqlite3_t*);
    209 void mrsqlite3_rollback__ (mrsqlite3_t*);
    210 
    211 #ifdef __cplusplus
    212 } /* /extern "C" */
    213 #endif
    214 #endif /* __MRSQLITE3_H__ */
    215 
    An object representing a single mailbox.
    Definition: mrmailbox.h:141
    +
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 #ifndef __MRSQLITE3_H__
    24 #define __MRSQLITE3_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 /*** library-private **********************************************************/
    31 
    32 #include <sqlite3.h>
    33 #include <libetpan/libetpan.h>
    34 #include <pthread.h>
    35 typedef struct mrmailbox_t mrmailbox_t;
    36 
    37 
    38 /* predefined statements */
    39 enum
    40 {
    41  BEGIN_transaction = 0 /* must be first */
    42  ,ROLLBACK_transaction
    43  ,COMMIT_transaction
    44 
    45  ,SELECT_v_FROM_config_k
    46  ,INSERT_INTO_config_kv
    47  ,UPDATE_config_vk
    48  ,DELETE_FROM_config_k
    49 
    50  ,SELECT_COUNT_FROM_contacts
    51  ,SELECT_naob_FROM_contacts_i
    52  ,SELECT_inao_FROM_contacts_a
    53  ,SELECT_id_FROM_contacts_WHERE_id
    54  ,SELECT_na_FROM_chats_contacs_JOIN_contacts_WHERE_cc
    55  ,SELECT_p_FROM_chats_contacs_JOIN_contacts_peerstates_WHERE_cc
    56  ,SELECT_id_FROM_contacts_WHERE_chat_id
    57  ,SELECT_id_FROM_contacts_ORDER_BY
    58  ,SELECT_id_FROM_contacts_WHERE_query_ORDER_BY
    59  ,SELECT_COUNT_FROM_contacts_WHERE_blocked
    60  ,SELECT_id_FROM_contacts_WHERE_blocked
    61  ,INSERT_INTO_contacts_neo
    62  ,UPDATE_contacts_nao_WHERE_i
    63  ,UPDATE_contacts_SET_origin_WHERE_id
    64  ,UPDATE_contacts_SET_b_WHERE_i
    65  ,DELETE_FROM_contacts_WHERE_id
    66 
    67  ,SELECT_COUNT_FROM_chats
    68  ,SELECT_COUNT_FROM_chats_WHERE_archived
    69  ,SELECT_ii_FROM_chats_LEFT_JOIN_msgs_WHERE_archived
    70  ,SELECT_ii_FROM_chats_LEFT_JOIN_msgs_WHERE_unarchived
    71  ,SELECT_ii_FROM_chats_LEFT_JOIN_msgs_WHERE_query
    72  ,SELECT_itndd_FROM_chats_WHERE_i
    73  ,SELECT_id_FROM_chats_WHERE_id
    74  ,SELECT_id_FROM_chats_WHERE_contact_id
    75  ,SELECT_id_FROM_CHATS_WHERE_grpid
    76  ,SELECT_timestamp_FROM_msgs_WHERE_timestamp
    77  ,SELECT_it_FROM_msgs_JOIN_chats_WHERE_rfc724
    78  ,SELECT_MAX_timestamp_FROM_msgs
    79  ,SELECT_rfc724_FROM_msgs_ORDER_BY_timestamp_LIMIT_1
    80  ,UPDATE_chats_SET_draft_WHERE_id
    81  ,UPDATE_chats_SET_n_WHERE_c
    82  ,UPDATE_chats_SET_blocked
    83  ,UPDATE_chats_SET_unarchived
    84 
    85  ,SELECT_a_FROM_chats_contacts_WHERE_i
    86  ,SELECT_COUNT_FROM_chats_contacts_WHERE_chat_id
    87  ,SELECT_COUNT_FROM_chats_contacts_WHERE_contact_id
    88  ,SELECT_c_FROM_chats_contacts_WHERE_c
    89  ,SELECT_c_FROM_chats_contacts_WHERE_c_ORDER_BY
    90  ,SELECT_void_FROM_chats_contacts_WHERE_chat_id_AND_contact_id
    91  ,INSERT_INTO_chats_contacts
    92 
    93  ,SELECT_COUNT_FROM_msgs_WHERE_assigned
    94  ,SELECT_COUNT_FROM_msgs_WHERE_unassigned
    95  ,SELECT_COUNT_FROM_msgs_WHERE_state_AND_chat_id
    96  ,SELECT_COUNT_FROM_msgs_WHERE_chat_id
    97  ,SELECT_COUNT_FROM_msgs_WHERE_rfc724_mid
    98  ,SELECT_COUNT_FROM_msgs_WHERE_ft
    99  ,SELECT_COUNT_DISTINCT_f_FROM_msgs_WHERE_c
    100  ,SELECT_i_FROM_msgs_WHERE_ctt
    101  ,SELECT_id_FROM_msgs_WHERE_cm
    102  ,SELECT_id_FROM_msgs_WHERE_mcm
    103  ,SELECT_id_FROM_msgs_WHERE_fresh_AND_deaddrop
    104  ,SELECT_txt_raw_FROM_msgs_WHERE_id
    105  ,SELECT_ircftttstpb_FROM_msg_WHERE_i
    106  ,SELECT_ss_FROM_msgs_WHERE_m
    107  ,SELECT_i_FROM_msgs_LEFT_JOIN_contacts_WHERE_c
    108  ,SELECT_i_FROM_msgs_LEFT_JOIN_contacts_WHERE_starred
    109  ,SELECT_i_FROM_msgs_LEFT_JOIN_contacts_WHERE_fresh
    110  ,SELECT_i_FROM_msgs_WHERE_query
    111  ,SELECT_i_FROM_msgs_WHERE_chat_id_AND_query
    112  ,INSERT_INTO_msgs_msscftttsmttpb
    113  ,INSERT_INTO_msgs_mcftttstpb
    114  ,UPDATE_msgs_SET_chat_id_WHERE_id
    115  ,UPDATE_msgs_SET_state_WHERE_id
    116  ,UPDATE_msgs_SET_seen_WHERE_id_AND_chat_id_AND_freshORnoticed
    117  ,UPDATE_msgs_SET_noticed_WHERE_id_AND_fresh
    118  ,UPDATE_msgs_SET_state_WHERE_chat_id_AND_state
    119  ,UPDATE_msgs_SET_state_WHERE_from_id_AND_state
    120  ,UPDATE_msgs_SET_ss_WHERE_rfc724_mid
    121  ,UPDATE_msgs_SET_param_WHERE_id
    122  ,UPDATE_msgs_SET_starred_WHERE_id
    123  ,DELETE_FROM_msgs_WHERE_id
    124  ,DELETE_FROM_msgs_WHERE_rfc724_mid
    125 
    126  ,SELECT_c_FROM_msgs_mdns_WHERE_mc
    127  ,INSERT_INTO_msgs_mdns
    128  ,SELECT_COUNT_FROM_msgs_mdns_WHERE_m
    129  ,DELETE_FROM_msgs_mdns_WHERE_m
    130 
    131  ,INSERT_INTO_jobs_aafp
    132  ,SELECT_MIN_d_FROM_jobs
    133  ,SELECT_iafp_FROM_jobs
    134  ,DELETE_FROM_jobs_WHERE_id
    135  ,DELETE_FROM_jobs_WHERE_action
    136  ,UPDATE_jobs_SET_dp_WHERE_id
    137 
    138  ,SELECT_FROM_leftgrps_WHERE_grpid
    139 
    140  ,INSERT_INTO_acpeerstates_a
    141  ,SELECT_aclpp_FROM_acpeerstates_WHERE_a
    142  ,UPDATE_acpeerstates_SET_l_WHERE_a
    143  ,UPDATE_acpeerstates_SET_lcpp_WHERE_a
    144 
    145  ,INSERT_INTO_keypairs_aippc
    146  ,SELECT_private_key_FROM_keypairs_WHERE_default
    147  ,SELECT_private_key_FROM_keypairs_ORDER_BY_default
    148  ,SELECT_public_key_FROM_keypairs_WHERE_default
    149 
    150  ,PREDEFINED_CNT /* must be last */
    151 };
    152 
    153 
    162 typedef struct mrsqlite3_t
    163 {
    165  sqlite3_stmt* m_pd[PREDEFINED_CNT];
    166  sqlite3* m_cobj;
    167  int m_transactionCount;
    168  mrmailbox_t* m_mailbox;
    169  pthread_mutex_t m_critical_;
    171 } mrsqlite3_t;
    172 
    173 
    174 mrsqlite3_t* mrsqlite3_new (mrmailbox_t*);
    175 void mrsqlite3_unref (mrsqlite3_t*);
    176 
    177 #define MR_OPEN_READONLY 0x01
    178 int mrsqlite3_open__ (mrsqlite3_t*, const char* dbfile, int flags);
    179 
    180 void mrsqlite3_close__ (mrsqlite3_t*);
    181 int mrsqlite3_is_open (const mrsqlite3_t*);
    182 
    183 /* handle configurations, private */
    184 int mrsqlite3_set_config__ (mrsqlite3_t*, const char* key, const char* value);
    185 int mrsqlite3_set_config_int__ (mrsqlite3_t*, const char* key, int32_t value);
    186 char* mrsqlite3_get_config__ (mrsqlite3_t*, const char* key, const char* def); /* the returned string must be free()'d, returns NULL on errors */
    187 int32_t mrsqlite3_get_config_int__ (mrsqlite3_t*, const char* key, int32_t def);
    188 
    189 /* tools, these functions are compatible to the corresponding sqlite3_* functions */
    190 sqlite3_stmt* mrsqlite3_predefine__ (mrsqlite3_t*, size_t idx, const char* sql); /*the result is resetted as needed and must not be freed. CAVE: you must not call this function with different strings for the same index!*/
    191 sqlite3_stmt* mrsqlite3_prepare_v2_ (mrsqlite3_t*, const char* sql); /* the result mus be freed using sqlite3_finalize() */
    192 int mrsqlite3_execute__ (mrsqlite3_t*, const char* sql);
    193 int mrsqlite3_table_exists__ (mrsqlite3_t*, const char* name);
    194 void mrsqlite3_log_error (mrsqlite3_t*, const char* msg, ...);
    195 
    196 /* reset all predefined statements, this is needed only in very rare cases, eg. when dropping a table and there are pending statements */
    197 void mrsqlite3_reset_all_predefinitions(mrsqlite3_t*);
    198 
    199 /* tools for locking, may be called nested, see also m_critical_ above.
    200 the user of MrSqlite3 must make sure that the MrSqlite3-object is only used by one thread at the same time.
    201 In general, we will lock the hightest level as possible - this avoids deadlocks and massive on/off lockings.
    202 Low-level-functions, eg. the MrSqlite3-methods, do not lock. */
    203 void mrsqlite3_lock (mrsqlite3_t*); /* lock or wait; these calls must not be nested in a single thread */
    204 void mrsqlite3_unlock (mrsqlite3_t*);
    205 
    206 /* nestable transactions, only the outest is really used */
    207 void mrsqlite3_begin_transaction__(mrsqlite3_t*);
    208 void mrsqlite3_commit__ (mrsqlite3_t*);
    209 void mrsqlite3_rollback__ (mrsqlite3_t*);
    210 
    211 #ifdef __cplusplus
    212 } /* /extern "C" */
    213 #endif
    214 #endif /* __MRSQLITE3_H__ */
    215 
    An object representing a single mailbox.
    Definition: mrmailbox.h:143
    diff --git a/docs/html/mrstock_8h_source.html b/docs/html/mrstock_8h_source.html index 54fb1024..7cb0ba94 100644 --- a/docs/html/mrstock_8h_source.html +++ b/docs/html/mrstock_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrstock.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrstock.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -88,11 +88,11 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    mrstock.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 __MRSTOCK_H__
    24 #define __MRSTOCK_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 #include "mrmailbox.h"
    31 #include <stdlib.h>
    32 #include <string.h>
    33 
    34 
    35 /* Strings requested by MR_EVENT_GET_STRING and MR_EVENT_GET_QUANTITY_STRING */
    36 #define MR_STR_FREE_ 0
    37 #define MR_STR_NOMESSAGES 1
    38 #define MR_STR_SELF 2
    39 #define MR_STR_DRAFT 3
    40 #define MR_STR_MEMBER 4
    41 #define MR_STR_CONTACT 6
    42 #define MR_STR_VOICEMESSAGE 7
    43 #define MR_STR_DEADDROP 8
    44 #define MR_STR_IMAGE 9
    45 #define MR_STR_VIDEO 10
    46 #define MR_STR_AUDIO 11
    47 #define MR_STR_FILE 12
    48 #define MR_STR_STATUSLINE 13
    49 #define MR_STR_NEWGROUPDRAFT 14
    50 #define MR_STR_MSGGRPNAME 15
    51 #define MR_STR_MSGGRPIMGCHANGED 16
    52 #define MR_STR_MSGADDMEMBER 17
    53 #define MR_STR_MSGDELMEMBER 18
    54 #define MR_STR_MSGGROUPLEFT 19
    55 #define MR_STR_ERROR 20
    56 #define MR_STR_SELFNOTINGRP 21
    57 #define MR_STR_NONETWORK 22
    58 #define MR_STR_GIF 23
    59 #define MR_STR_ENCRYPTEDMSG 24
    60 #define MR_STR_ENCR_E2E 25
    61 #define MR_STR_ENCR_TRANSP 27
    62 #define MR_STR_ENCR_NONE 28
    63 #define MR_STR_FINGERPRINTS 30
    64 #define MR_STR_READRCPT 31
    65 #define MR_STR_READRCPT_MAILBODY 32
    66 #define MR_STR_MSGGRPIMGDELETED 33
    67 #define MR_STR_E2E_FINE 34
    68 #define MR_STR_E2E_NO_AUTOCRYPT 35
    69 #define MR_STR_E2E_DIS_BY_YOU 36
    70 #define MR_STR_E2E_DIS_BY_RCPT 37
    71 #define MR_STR_ARCHIVEDCHATS 40
    72 #define MR_STR_STARREDMSGS 41
    73 
    74 
    75 /* should be set up by mrmailbox_new() */
    76 extern mrmailbox_t* s_localize_mb_obj;
    77 
    78 
    79 /* Return the string with the given ID by calling MR_EVENT_GET_STRING.
    80 The result must be free()'d! */
    81 char* mrstock_str (int id);
    82 
    83 
    84 /* Replaces the first `%1$s` in the given String-ID by the given value.
    85 The result must be free()'d! */
    86 char* mrstock_str_repl_string (int id, const char* value);
    87 char* mrstock_str_repl_int (int id, int value);
    88 
    89 
    90 /* Replaces the first `%1$s` and `%2$s` in the given String-ID by the two given strings.
    91 The result must be free()'d! */
    92 char* mrstock_str_repl_string2 (int id, const char*, const char*);
    93 
    94 
    95 /* Return a string with a correct plural form by callint MR_EVENT_GET_QUANTITY_STRING.
    96 The result must be free()'d! */
    97 char* mrstock_str_repl_pl (int id, int cnt);
    98 
    99 
    100 #ifdef __cplusplus
    101 } /* /extern "C" */
    102 #endif
    103 #endif /* __MRSTOCK_H__ */
    104 
    An object representing a single mailbox.
    Definition: mrmailbox.h:141
    +
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 #ifndef __MRSTOCK_H__
    24 #define __MRSTOCK_H__
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    28 
    29 
    30 #include "mrmailbox.h"
    31 #include <stdlib.h>
    32 #include <string.h>
    33 
    34 
    35 /* Strings requested by MR_EVENT_GET_STRING and MR_EVENT_GET_QUANTITY_STRING */
    36 #define MR_STR_FREE_ 0
    37 #define MR_STR_NOMESSAGES 1
    38 #define MR_STR_SELF 2
    39 #define MR_STR_DRAFT 3
    40 #define MR_STR_MEMBER 4
    41 #define MR_STR_CONTACT 6
    42 #define MR_STR_VOICEMESSAGE 7
    43 #define MR_STR_DEADDROP 8
    44 #define MR_STR_IMAGE 9
    45 #define MR_STR_VIDEO 10
    46 #define MR_STR_AUDIO 11
    47 #define MR_STR_FILE 12
    48 #define MR_STR_STATUSLINE 13
    49 #define MR_STR_NEWGROUPDRAFT 14
    50 #define MR_STR_MSGGRPNAME 15
    51 #define MR_STR_MSGGRPIMGCHANGED 16
    52 #define MR_STR_MSGADDMEMBER 17
    53 #define MR_STR_MSGDELMEMBER 18
    54 #define MR_STR_MSGGROUPLEFT 19
    55 #define MR_STR_ERROR 20
    56 #define MR_STR_SELFNOTINGRP 21
    57 #define MR_STR_NONETWORK 22
    58 #define MR_STR_GIF 23
    59 #define MR_STR_ENCRYPTEDMSG 24
    60 #define MR_STR_ENCR_E2E 25
    61 #define MR_STR_ENCR_TRANSP 27
    62 #define MR_STR_ENCR_NONE 28
    63 #define MR_STR_FINGERPRINTS 30
    64 #define MR_STR_READRCPT 31
    65 #define MR_STR_READRCPT_MAILBODY 32
    66 #define MR_STR_MSGGRPIMGDELETED 33
    67 #define MR_STR_E2E_FINE 34
    68 #define MR_STR_E2E_NO_AUTOCRYPT 35
    69 #define MR_STR_E2E_DIS_BY_YOU 36
    70 #define MR_STR_E2E_DIS_BY_RCPT 37
    71 #define MR_STR_ARCHIVEDCHATS 40
    72 #define MR_STR_STARREDMSGS 41
    73 
    74 
    75 /* should be set up by mrmailbox_new() */
    76 extern mrmailbox_t* s_localize_mb_obj;
    77 
    78 
    79 /* Return the string with the given ID by calling MR_EVENT_GET_STRING.
    80 The result must be free()'d! */
    81 char* mrstock_str (int id);
    82 
    83 
    84 /* Replaces the first `%1$s` in the given String-ID by the given value.
    85 The result must be free()'d! */
    86 char* mrstock_str_repl_string (int id, const char* value);
    87 char* mrstock_str_repl_int (int id, int value);
    88 
    89 
    90 /* Replaces the first `%1$s` and `%2$s` in the given String-ID by the two given strings.
    91 The result must be free()'d! */
    92 char* mrstock_str_repl_string2 (int id, const char*, const char*);
    93 
    94 
    95 /* Return a string with a correct plural form by callint MR_EVENT_GET_QUANTITY_STRING.
    96 The result must be free()'d! */
    97 char* mrstock_str_repl_pl (int id, int cnt);
    98 
    99 
    100 #ifdef __cplusplus
    101 } /* /extern "C" */
    102 #endif
    103 #endif /* __MRSTOCK_H__ */
    104 
    An object representing a single mailbox.
    Definition: mrmailbox.h:143
    diff --git a/docs/html/mrtools_8h_source.html b/docs/html/mrtools_8h_source.html index f5cc38d3..ab560556 100644 --- a/docs/html/mrtools_8h_source.html +++ b/docs/html/mrtools_8h_source.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: /home/bpetersen/projects/deltachat-core/src/mrtools.h Source File +Delta Chat Core C-API: /home/bpetersen/projects/deltachat-core/src/mrtools.h Source File @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -88,11 +88,11 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    mrtools.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 /* Some tools and enhancements to the used libraries, there should be
    24 no references to mrmailbox_t and other "larger" classes here. */
    25 
    26 
    27 #ifndef __MRTOOLS_H__
    28 #define __MRTOOLS_H__
    29 #ifdef __cplusplus
    30 extern "C" {
    31 #endif
    32 
    33 
    34 /*** library-private **********************************************************/
    35 
    36 /* match tools */
    37 int mr_exactly_one_bit_set (int v);
    38 
    39 /* string tools */
    40 char* safe_strdup (const char*); /* safe_strdup() returns empty string if NULL is given, never returns NULL (exists on errors) */
    41 char* strdup_keep_null (const char*); /* strdup(NULL) is undefined, safe_strdup_keep_null(NULL) returns NULL in this case */
    42 int atoi_null_is_0 (const char*);
    43 void mr_ltrim (char*);
    44 void mr_rtrim (char*);
    45 void mr_trim (char*);
    46 char* mr_strlower (const char*); /* the result must be free()'d */
    47 void mr_strlower_in_place (char*);
    48 int mr_str_replace (char** haystack, const char* needle, const char* replacement); /* haystack may be realloc()'d, returns the number of replacements */
    49 char* mr_null_terminate (const char*, int bytes); /* the result must be free()'d */
    50 char* mr_mprintf (const char* format, ...); /* The result must be free()'d. */
    51 void mr_remove_cr_chars (char*); /* remove all \r characters from string */
    52 void mr_replace_bad_utf8_chars (char*); /* replace bad UTF-8 characters by sequences of `_` (to avoid problems in filenames, we do not use eg. `?`) the function is useful if strings are unexpectingly encoded eg. as ISO-8859-1 */
    53 void mr_truncate_n_unwrap_str (char*, int approx_characters, int do_unwrap);
    54 carray* mr_split_into_lines (const char* buf_terminated); /* split string into lines*/
    55 void mr_free_splitted_lines (carray* lines);
    56 char* mr_insert_breaks (const char*, int break_every, const char* break_chars); /* insert a break every n characters, the return must be free()'d */
    57 char* mr_arr_to_string (const uint32_t*, int cnt);
    58 char* mr_decode_header_string (const char*); /* the result must be free()'d */
    59 char* mr_encode_header_string (const char*); /* the result must be free()'d */
    60 char* imap_modified_utf7_to_utf8 (const char *mbox, int change_spaces);
    61 char* imap_utf8_to_modified_utf7 (const char *src, int change_spaces);
    62 char* mr_url_encode (const char*); /* the result must be free()'d */
    63 char* encode_base64 (const char * in, int len); /* prototype, from libetpan/src/data-types/base64.h which cannot be included without adding libetpan/src/... to the include-search-paths, which would result in double-file-name-errors */
    64 
    65 /* string builder */
    66 typedef struct mrstrbuilder_t
    67 {
    68  char* m_buf;
    69  int m_allocated;
    70  int m_free;
    71  char* m_eos;
    72 } mrstrbuilder_t;
    73 void mrstrbuilder_init (mrstrbuilder_t* ths);
    74 char* mrstrbuilder_cat (mrstrbuilder_t* ths, const char* text);
    75 void mrstrbuilder_empty(mrstrbuilder_t* ths); /* set the string to a lenght of 0, does not free the buffer */
    76 
    77 
    78 /* carray/clist tools */
    79 int carray_search (carray*, void* needle, unsigned int* indx); /* returns 1/0 and the index if `indx` is not NULL */
    80 void clist_free_content (const clist*); /* calls free() for each item content */
    81 int clist_search_string_nocase (const clist*, const char* str);
    82 
    83 /* date/time tools */
    84 #define MR_INVALID_TIMESTAMP (-1)
    85 time_t mr_timestamp_from_date (struct mailimf_date_time * date_time); /* the result is UTC or MR_INVALID_TIMESTAMP */
    86 char* mr_timestamp_to_str (time_t); /* the return value must be free()'d */
    87 struct mailimap_date_time* mr_timestamp_to_mailimap_date_time (time_t);
    88 long mr_gm2local_offset (void);
    89 
    90 /* timesmearing */
    91 time_t mr_smeared_time__ (void);
    92 time_t mr_create_smeared_timestamp__ (void);
    93 time_t mr_create_smeared_timestamps__(int count);
    94 
    95 /* Message-ID tools */
    96 #define MR_VALID_ID_LEN 11
    97 char* mr_create_id (void);
    98 char* mr_create_dummy_references_mid (void);
    99 char* mr_create_incoming_rfc724_mid (time_t message_timestamp, uint32_t contact_id_from, carray* contact_ids_to);
    100 char* mr_create_outgoing_rfc724_mid (const char* grpid, const char* addr);
    101 char* mr_extract_grpid_from_rfc724_mid (const char* rfc724_mid);
    102 char* mr_extract_grpid_from_rfc724_mid_list(const clist* rfc724_mid_list);
    103 
    104 
    105 /* file tools */
    106 int mr_file_exist (const char* pathNfilename);
    107 size_t mr_get_filebytes (const char* pathNfilename);
    108 char* mr_get_filename (const char* pathNfilename); /* the return value must be free()'d */
    109 int mr_delete_file (const char* pathNFilename, mrmailbox_t* log);
    110 int mr_copy_file (const char* src_pathNFilename, const char* dest_pathNFilename, mrmailbox_t* log);
    111 int mr_create_folder (const char* pathNfilename, mrmailbox_t* log);
    112 int mr_write_file (const char* pathNfilename, const void* buf, size_t buf_bytes, mrmailbox_t* log);
    113 int mr_read_file (const char* pathNfilename, void** buf, size_t* buf_bytes, mrmailbox_t* log);
    114 char* mr_get_filesuffix_lc (const char* pathNfilename); /* the returned suffix is lower-case */
    115 void mr_split_filename (const char* pathNfilename, char** ret_basename, char** ret_all_suffixes_incl_dot); /* the case of the suffix is preserved! */
    116 int mr_get_filemeta (const void* buf, size_t buf_bytes, uint32_t* ret_width, uint32_t *ret_height);
    117 char* mr_get_fine_pathNfilename (const char* folder, const char* desired_name);
    118 
    119 /* macros */
    120 #define MR_QUOTEHELPER(name) #name
    121 #define MR_STRINGIFY(macro) MR_QUOTEHELPER(macro)
    122 #define MR_MIN(X, Y) (((X) < (Y))? (X) : (Y))
    123 #define MR_MAX(X, Y) (((X) > (Y))? (X) : (Y))
    124 
    125 
    126 #ifdef __cplusplus
    127 } /* /extern "C" */
    128 #endif
    129 #endif /* __MRTOOLS_H__ */
    An object representing a single mailbox.
    Definition: mrmailbox.h:141
    +
    1 /*******************************************************************************
    2  *
    3  * Delta Chat Core
    4  * Copyright (C) 2017 Björn Petersen
    5  * Contact: r10s@b44t.com, http://b44t.com
    6  *
    7  * This program is free software: you can redistribute it and/or modify it under
    8  * the terms of the GNU General Public License as published by the Free Software
    9  * Foundation, either version 3 of the License, or (at your option) any later
    10  * version.
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program. If not, see http://www.gnu.org/licenses/ .
    19  *
    20  ******************************************************************************/
    21 
    22 
    23 /* Some tools and enhancements to the used libraries, there should be
    24 no references to mrmailbox_t and other "larger" classes here. */
    25 
    26 
    27 #ifndef __MRTOOLS_H__
    28 #define __MRTOOLS_H__
    29 #ifdef __cplusplus
    30 extern "C" {
    31 #endif
    32 
    33 
    34 /*** library-private **********************************************************/
    35 
    36 /* match tools */
    37 int mr_exactly_one_bit_set (int v);
    38 
    39 /* string tools */
    40 char* safe_strdup (const char*); /* safe_strdup() returns empty string if NULL is given, never returns NULL (exists on errors) */
    41 char* strdup_keep_null (const char*); /* strdup(NULL) is undefined, safe_strdup_keep_null(NULL) returns NULL in this case */
    42 int atoi_null_is_0 (const char*);
    43 void mr_ltrim (char*);
    44 void mr_rtrim (char*);
    45 void mr_trim (char*);
    46 char* mr_strlower (const char*); /* the result must be free()'d */
    47 void mr_strlower_in_place (char*);
    48 int mr_str_replace (char** haystack, const char* needle, const char* replacement); /* haystack may be realloc()'d, returns the number of replacements */
    49 char* mr_null_terminate (const char*, int bytes); /* the result must be free()'d */
    50 char* mr_mprintf (const char* format, ...); /* The result must be free()'d. */
    51 void mr_remove_cr_chars (char*); /* remove all \r characters from string */
    52 void mr_replace_bad_utf8_chars (char*); /* replace bad UTF-8 characters by sequences of `_` (to avoid problems in filenames, we do not use eg. `?`) the function is useful if strings are unexpectingly encoded eg. as ISO-8859-1 */
    53 void mr_truncate_n_unwrap_str (char*, int approx_characters, int do_unwrap);
    54 carray* mr_split_into_lines (const char* buf_terminated); /* split string into lines*/
    55 void mr_free_splitted_lines (carray* lines);
    56 char* mr_insert_breaks (const char*, int break_every, const char* break_chars); /* insert a break every n characters, the return must be free()'d */
    57 char* mr_arr_to_string (const uint32_t*, int cnt);
    58 char* mr_decode_header_string (const char*); /* the result must be free()'d */
    59 char* mr_encode_header_string (const char*); /* the result must be free()'d */
    60 char* imap_modified_utf7_to_utf8 (const char *mbox, int change_spaces);
    61 char* imap_utf8_to_modified_utf7 (const char *src, int change_spaces);
    62 char* mr_url_encode (const char*); /* the result must be free()'d */
    63 char* encode_base64 (const char * in, int len); /* prototype, from libetpan/src/data-types/base64.h which cannot be included without adding libetpan/src/... to the include-search-paths, which would result in double-file-name-errors */
    64 
    65 /* string builder */
    66 typedef struct mrstrbuilder_t
    67 {
    68  char* m_buf;
    69  int m_allocated;
    70  int m_free;
    71  char* m_eos;
    72 } mrstrbuilder_t;
    73 void mrstrbuilder_init (mrstrbuilder_t* ths);
    74 char* mrstrbuilder_cat (mrstrbuilder_t* ths, const char* text);
    75 void mrstrbuilder_empty(mrstrbuilder_t* ths); /* set the string to a lenght of 0, does not free the buffer */
    76 
    77 
    78 /* carray/clist tools */
    79 int carray_search (carray*, void* needle, unsigned int* indx); /* returns 1/0 and the index if `indx` is not NULL */
    80 void clist_free_content (const clist*); /* calls free() for each item content */
    81 int clist_search_string_nocase (const clist*, const char* str);
    82 
    83 /* date/time tools */
    84 #define MR_INVALID_TIMESTAMP (-1)
    85 time_t mr_timestamp_from_date (struct mailimf_date_time * date_time); /* the result is UTC or MR_INVALID_TIMESTAMP */
    86 char* mr_timestamp_to_str (time_t); /* the return value must be free()'d */
    87 struct mailimap_date_time* mr_timestamp_to_mailimap_date_time (time_t);
    88 long mr_gm2local_offset (void);
    89 
    90 /* timesmearing */
    91 time_t mr_smeared_time__ (void);
    92 time_t mr_create_smeared_timestamp__ (void);
    93 time_t mr_create_smeared_timestamps__(int count);
    94 
    95 /* Message-ID tools */
    96 #define MR_VALID_ID_LEN 11
    97 char* mr_create_id (void);
    98 char* mr_create_dummy_references_mid (void);
    99 char* mr_create_incoming_rfc724_mid (time_t message_timestamp, uint32_t contact_id_from, carray* contact_ids_to);
    100 char* mr_create_outgoing_rfc724_mid (const char* grpid, const char* addr);
    101 char* mr_extract_grpid_from_rfc724_mid (const char* rfc724_mid);
    102 char* mr_extract_grpid_from_rfc724_mid_list(const clist* rfc724_mid_list);
    103 
    104 
    105 /* file tools */
    106 int mr_file_exist (const char* pathNfilename);
    107 size_t mr_get_filebytes (const char* pathNfilename);
    108 char* mr_get_filename (const char* pathNfilename); /* the return value must be free()'d */
    109 int mr_delete_file (const char* pathNFilename, mrmailbox_t* log);
    110 int mr_copy_file (const char* src_pathNFilename, const char* dest_pathNFilename, mrmailbox_t* log);
    111 int mr_create_folder (const char* pathNfilename, mrmailbox_t* log);
    112 int mr_write_file (const char* pathNfilename, const void* buf, size_t buf_bytes, mrmailbox_t* log);
    113 int mr_read_file (const char* pathNfilename, void** buf, size_t* buf_bytes, mrmailbox_t* log);
    114 char* mr_get_filesuffix_lc (const char* pathNfilename); /* the returned suffix is lower-case */
    115 void mr_split_filename (const char* pathNfilename, char** ret_basename, char** ret_all_suffixes_incl_dot); /* the case of the suffix is preserved! */
    116 int mr_get_filemeta (const void* buf, size_t buf_bytes, uint32_t* ret_width, uint32_t *ret_height);
    117 char* mr_get_fine_pathNfilename (const char* folder, const char* desired_name);
    118 
    119 /* macros */
    120 #define MR_QUOTEHELPER(name) #name
    121 #define MR_STRINGIFY(macro) MR_QUOTEHELPER(macro)
    122 #define MR_MIN(X, Y) (((X) < (Y))? (X) : (Y))
    123 #define MR_MAX(X, Y) (((X) > (Y))? (X) : (Y))
    124 
    125 
    126 #ifdef __cplusplus
    127 } /* /extern "C" */
    128 #endif
    129 #endif /* __MRTOOLS_H__ */
    An object representing a single mailbox.
    Definition: mrmailbox.h:143
    diff --git a/docs/html/search/all_0.js b/docs/html/search/all_0.js index e9d797fb..0415d74e 100644 --- a/docs/html/search/all_0.js +++ b/docs/html/search/all_0.js @@ -10,7 +10,7 @@ var searchData= ['m_5fdraft_5ftext',['m_draft_text',['../structmrchat__t.html#abe916f48ac83c2ca6476312eae084cfa',1,'mrchat_t']]], ['m_5fdraft_5ftimestamp',['m_draft_timestamp',['../structmrchat__t.html#a565101f53278f5ab1ff58317ffc9555c',1,'mrchat_t']]], ['m_5ffrom_5fid',['m_from_id',['../structmrmsg__t.html#a299981cb89b25ebaaedf7a8486a86ee6',1,'mrmsg_t']]], - ['m_5fid',['m_id',['../structmrcontact__t.html#ab2ee31297c327e04ed14673adbd49716',1,'mrcontact_t::m_id()'],['../structmrmsg__t.html#a793898c8da24c717dc2bb1d91faac801',1,'mrmsg_t::m_id()']]], + ['m_5fid',['m_id',['../structmrchat__t.html#a1591431716413350eaffce0b588e4911',1,'mrchat_t::m_id()'],['../structmrcontact__t.html#ab2ee31297c327e04ed14673adbd49716',1,'mrcontact_t::m_id()'],['../structmrmsg__t.html#a793898c8da24c717dc2bb1d91faac801',1,'mrmsg_t::m_id()']]], ['m_5fis_5fmsgrmsg',['m_is_msgrmsg',['../structmrmsg__t.html#aa4fbc319d61c755ce929e658ad75b21e',1,'mrmsg_t']]], ['m_5fmailbox',['m_mailbox',['../structmrchat__t.html#abf3e1a34f567e168bc0597f9a544a50d',1,'mrchat_t::m_mailbox()'],['../structmrchatlist__t.html#a025d213cde2fa547b2f3cae4e1facbf7',1,'mrchatlist_t::m_mailbox()']]], ['m_5fname',['m_name',['../structmrchat__t.html#abbd344d8d361a1a4d14bfc9b5dc57140',1,'mrchat_t::m_name()'],['../structmrcontact__t.html#a48fba862b41f7da3b8c6193c0554654b',1,'mrcontact_t::m_name()']]], @@ -23,20 +23,20 @@ var searchData= ['m_5ftext2',['m_text2',['../structmrpoortext__t.html#a54e10365f38dddd070a2ab68f4177331',1,'mrpoortext_t']]], ['m_5ftimestamp',['m_timestamp',['../structmrmsg__t.html#aba09cb77cdabd1e2b2e6262d25388801',1,'mrmsg_t::m_timestamp()'],['../structmrpoortext__t.html#a372913d9a39616e48722ea04c759f887',1,'mrpoortext_t::m_timestamp()']]], ['m_5fto_5fid',['m_to_id',['../structmrmsg__t.html#ad549fc02587ba284fda2bbecd162b16a',1,'mrmsg_t']]], - ['m_5ftype',['m_type',['../structmrmsg__t.html#a3896e269c90cbf0f563ab0848fb44c65',1,'mrmsg_t']]], + ['m_5ftype',['m_type',['../structmrchat__t.html#a568c4e6fb9633ffe9a76428db16e0201',1,'mrchat_t::m_type()'],['../structmrmsg__t.html#a3896e269c90cbf0f563ab0848fb44c65',1,'mrmsg_t::m_type()']]], ['m_5fuserdata',['m_userdata',['../structmrmailbox__t.html#a6c557153209e128b69301246dbf9e230',1,'mrmailbox_t']]], ['mr_5ftext1_5fdraft',['MR_TEXT1_DRAFT',['../structmrpoortext__t.html#aac967a349b1d5057fc1ebfcc58b64214',1,'mrpoortext_t']]], ['mr_5ftext1_5fnormal',['MR_TEXT1_NORMAL',['../structmrpoortext__t.html#a7cd93f6589a7db24561d73ad9160073a',1,'mrpoortext_t']]], ['mr_5ftext1_5fself',['MR_TEXT1_SELF',['../structmrpoortext__t.html#a11aaf4806949f8d5028a55df5278ecda',1,'mrpoortext_t']]], ['mr_5ftext1_5fusername',['MR_TEXT1_USERNAME',['../structmrpoortext__t.html#af92bade56df97efaeb45b8d48d8cf743',1,'mrpoortext_t']]], - ['mrchat_5fempty',['mrchat_empty',['../structmrchat__t.html#af0d39be9ac9885810d8765053cfb81eb',1,'mrchat_t']]], + ['mrchat_5fempty',['mrchat_empty',['../structmrchat__t.html#ae5c507c3944e38afe7584d59d9ece3cc',1,'mrchat_t']]], ['mrchat_5fget_5fsubtitle',['mrchat_get_subtitle',['../structmrchat__t.html#ae1e9920618c9f6cb8ad66d5bb6962a08',1,'mrchat_t']]], ['mrchat_5ft',['mrchat_t',['../structmrchat__t.html',1,'']]], ['mrchat_5funref',['mrchat_unref',['../structmrchat__t.html#a3b1befb4542c1bad915f2175c7c2a2b9',1,'mrchat_t']]], ['mrchatlist_5fempty',['mrchatlist_empty',['../structmrchatlist__t.html#abadeb636721fe5a021db74c1d63a0844',1,'mrchatlist_t']]], - ['mrchatlist_5fget_5fchat_5fid',['mrchatlist_get_chat_id',['../structmrchatlist__t.html#a1b944c248901b701902d9b0ce6ee0b8c',1,'mrchatlist_t']]], + ['mrchatlist_5fget_5fchat_5fid',['mrchatlist_get_chat_id',['../structmrchatlist__t.html#a8c8360c76b31057322199e8c51cadfa5',1,'mrchatlist_t']]], ['mrchatlist_5fget_5fcnt',['mrchatlist_get_cnt',['../structmrchatlist__t.html#aa132119f18e40e3151ac5fe0299daab7',1,'mrchatlist_t']]], - ['mrchatlist_5fget_5fmsg_5fid',['mrchatlist_get_msg_id',['../structmrchatlist__t.html#abba9b5f6b43c3755cc3a65ace159bf8e',1,'mrchatlist_t']]], + ['mrchatlist_5fget_5fmsg_5fid',['mrchatlist_get_msg_id',['../structmrchatlist__t.html#a69b67135eeadbdbe9b4a60e645ef22b0',1,'mrchatlist_t']]], ['mrchatlist_5fget_5fsummary',['mrchatlist_get_summary',['../structmrchatlist__t.html#ae7670d62ab7fc83aff18f299f26853d8',1,'mrchatlist_t']]], ['mrchatlist_5ft',['mrchatlist_t',['../structmrchatlist__t.html',1,'']]], ['mrchatlist_5funref',['mrchatlist_unref',['../structmrchatlist__t.html#ab036d6e066b5ff78779f36711c9ab2f9',1,'mrchatlist_t']]], diff --git a/docs/html/search/functions_0.js b/docs/html/search/functions_0.js index d59fdaff..23ed392b 100644 --- a/docs/html/search/functions_0.js +++ b/docs/html/search/functions_0.js @@ -1,12 +1,12 @@ var searchData= [ - ['mrchat_5fempty',['mrchat_empty',['../structmrchat__t.html#af0d39be9ac9885810d8765053cfb81eb',1,'mrchat_t']]], + ['mrchat_5fempty',['mrchat_empty',['../structmrchat__t.html#ae5c507c3944e38afe7584d59d9ece3cc',1,'mrchat_t']]], ['mrchat_5fget_5fsubtitle',['mrchat_get_subtitle',['../structmrchat__t.html#ae1e9920618c9f6cb8ad66d5bb6962a08',1,'mrchat_t']]], ['mrchat_5funref',['mrchat_unref',['../structmrchat__t.html#a3b1befb4542c1bad915f2175c7c2a2b9',1,'mrchat_t']]], ['mrchatlist_5fempty',['mrchatlist_empty',['../structmrchatlist__t.html#abadeb636721fe5a021db74c1d63a0844',1,'mrchatlist_t']]], - ['mrchatlist_5fget_5fchat_5fid',['mrchatlist_get_chat_id',['../structmrchatlist__t.html#a1b944c248901b701902d9b0ce6ee0b8c',1,'mrchatlist_t']]], + ['mrchatlist_5fget_5fchat_5fid',['mrchatlist_get_chat_id',['../structmrchatlist__t.html#a8c8360c76b31057322199e8c51cadfa5',1,'mrchatlist_t']]], ['mrchatlist_5fget_5fcnt',['mrchatlist_get_cnt',['../structmrchatlist__t.html#aa132119f18e40e3151ac5fe0299daab7',1,'mrchatlist_t']]], - ['mrchatlist_5fget_5fmsg_5fid',['mrchatlist_get_msg_id',['../structmrchatlist__t.html#abba9b5f6b43c3755cc3a65ace159bf8e',1,'mrchatlist_t']]], + ['mrchatlist_5fget_5fmsg_5fid',['mrchatlist_get_msg_id',['../structmrchatlist__t.html#a69b67135eeadbdbe9b4a60e645ef22b0',1,'mrchatlist_t']]], ['mrchatlist_5fget_5fsummary',['mrchatlist_get_summary',['../structmrchatlist__t.html#ae7670d62ab7fc83aff18f299f26853d8',1,'mrchatlist_t']]], ['mrchatlist_5funref',['mrchatlist_unref',['../structmrchatlist__t.html#ab036d6e066b5ff78779f36711c9ab2f9',1,'mrchatlist_t']]], ['mrcontact_5fempty',['mrcontact_empty',['../structmrcontact__t.html#ac40bd5673e132c31a21ee742dee30696',1,'mrcontact_t']]], diff --git a/docs/html/search/variables_0.js b/docs/html/search/variables_0.js index eab9518b..710b2df9 100644 --- a/docs/html/search/variables_0.js +++ b/docs/html/search/variables_0.js @@ -10,7 +10,7 @@ var searchData= ['m_5fdraft_5ftext',['m_draft_text',['../structmrchat__t.html#abe916f48ac83c2ca6476312eae084cfa',1,'mrchat_t']]], ['m_5fdraft_5ftimestamp',['m_draft_timestamp',['../structmrchat__t.html#a565101f53278f5ab1ff58317ffc9555c',1,'mrchat_t']]], ['m_5ffrom_5fid',['m_from_id',['../structmrmsg__t.html#a299981cb89b25ebaaedf7a8486a86ee6',1,'mrmsg_t']]], - ['m_5fid',['m_id',['../structmrcontact__t.html#ab2ee31297c327e04ed14673adbd49716',1,'mrcontact_t::m_id()'],['../structmrmsg__t.html#a793898c8da24c717dc2bb1d91faac801',1,'mrmsg_t::m_id()']]], + ['m_5fid',['m_id',['../structmrchat__t.html#a1591431716413350eaffce0b588e4911',1,'mrchat_t::m_id()'],['../structmrcontact__t.html#ab2ee31297c327e04ed14673adbd49716',1,'mrcontact_t::m_id()'],['../structmrmsg__t.html#a793898c8da24c717dc2bb1d91faac801',1,'mrmsg_t::m_id()']]], ['m_5fis_5fmsgrmsg',['m_is_msgrmsg',['../structmrmsg__t.html#aa4fbc319d61c755ce929e658ad75b21e',1,'mrmsg_t']]], ['m_5fmailbox',['m_mailbox',['../structmrchat__t.html#abf3e1a34f567e168bc0597f9a544a50d',1,'mrchat_t::m_mailbox()'],['../structmrchatlist__t.html#a025d213cde2fa547b2f3cae4e1facbf7',1,'mrchatlist_t::m_mailbox()']]], ['m_5fname',['m_name',['../structmrchat__t.html#abbd344d8d361a1a4d14bfc9b5dc57140',1,'mrchat_t::m_name()'],['../structmrcontact__t.html#a48fba862b41f7da3b8c6193c0554654b',1,'mrcontact_t::m_name()']]], @@ -23,6 +23,6 @@ var searchData= ['m_5ftext2',['m_text2',['../structmrpoortext__t.html#a54e10365f38dddd070a2ab68f4177331',1,'mrpoortext_t']]], ['m_5ftimestamp',['m_timestamp',['../structmrmsg__t.html#aba09cb77cdabd1e2b2e6262d25388801',1,'mrmsg_t::m_timestamp()'],['../structmrpoortext__t.html#a372913d9a39616e48722ea04c759f887',1,'mrpoortext_t::m_timestamp()']]], ['m_5fto_5fid',['m_to_id',['../structmrmsg__t.html#ad549fc02587ba284fda2bbecd162b16a',1,'mrmsg_t']]], - ['m_5ftype',['m_type',['../structmrmsg__t.html#a3896e269c90cbf0f563ab0848fb44c65',1,'mrmsg_t']]], + ['m_5ftype',['m_type',['../structmrchat__t.html#a568c4e6fb9633ffe9a76428db16e0201',1,'mrchat_t::m_type()'],['../structmrmsg__t.html#a3896e269c90cbf0f563ab0848fb44c65',1,'mrmsg_t::m_type()']]], ['m_5fuserdata',['m_userdata',['../structmrmailbox__t.html#a6c557153209e128b69301246dbf9e230',1,'mrmailbox_t']]] ]; diff --git a/docs/html/structmrchat__t-members.html b/docs/html/structmrchat__t-members.html index 7df7d2e0..d86bbe35 100644 --- a/docs/html/structmrchat__t-members.html +++ b/docs/html/structmrchat__t-members.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: Member List +Delta Chat Core C-API: Member List @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -91,18 +91,18 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); m_archivedmrchat_t m_draft_textmrchat_t m_draft_timestampmrchat_t - m_id (defined in mrchat_t)mrchat_t + m_idmrchat_t m_mailboxmrchat_t m_namemrchat_t m_parammrchat_t - m_type (defined in mrchat_t)mrchat_t - mrchat_empty(mrchat_t *ths)mrchat_t + m_typemrchat_t + mrchat_empty(mrchat_t *chat)mrchat_t mrchat_get_subtitle(mrchat_t *chat)mrchat_t mrchat_unref(mrchat_t *chat)mrchat_t
    diff --git a/docs/html/structmrchat__t.html b/docs/html/structmrchat__t.html index 92e07f50..ca76c9fc 100644 --- a/docs/html/structmrchat__t.html +++ b/docs/html/structmrchat__t.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: mrchat_t Struct Reference +Delta Chat Core C-API: mrchat_t Struct Reference @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -100,20 +100,20 @@ Public Member Functions void mrchat_unref (mrchat_t *chat)  Free a chat object. More...
      -void mrchat_empty (mrchat_t *ths) - Empty a chat object. More...
    -  +void mrchat_empty (mrchat_t *chat) + Empty a chat object. More...
    +  char * mrchat_get_subtitle (mrchat_t *chat)  Get a subtitle for a chat. More...
      - + + - + + @@ -143,7 +143,7 @@ char *  @@ -90,15 +90,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

    Public Attributes

    -uint32_t m_id
    uint32_t m_id
     Chat ID under which this object is available in the database. More...
     
    -int m_type
    int m_type
     Chat type, one of the MR_CHAT_TYPE_* constants. More...
     
    char * m_name

    An object representing a single chat in memory.

    Chat objects are created using eg. mrmailbox_get_chat() and are not updated on database changes; if you want an update, you have to recreate the object.

    Member Function Documentation

    - +
    @@ -151,7 +151,7 @@ char *  - +
    void mrchat_empty ( mrchat_tths)chat)
    @@ -233,6 +233,34 @@ char * 
    +
    +
    + + + + +
    uint32_t mrchat_t::m_id
    +
    + +

    Chat ID under which this object is available in the database.

    + +
    +
    + +
    +
    + + + + +
    int mrchat_t::m_type
    +
    + +

    Chat type, one of the MR_CHAT_TYPE_* constants.

    +

    The documentation for this struct was generated from the following files:
      @@ -242,7 +270,7 @@ char * 
    diff --git a/docs/html/structmrchatlist__t-members.html b/docs/html/structmrchatlist__t-members.html index 6c748aa3..94a669dae 100644 --- a/docs/html/structmrchatlist__t-members.html +++ b/docs/html/structmrchatlist__t-members.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: Member List +Delta Chat Core C-API: Member List @@ -24,7 +24,7 @@
    -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    - + - +
    m_mailboxmrchatlist_t
    mrchatlist_empty(mrchatlist_t *chatlist)mrchatlist_t
    mrchatlist_get_chat_id(mrchatlist_t *ths, size_t index)mrchatlist_t
    mrchatlist_get_chat_id(mrchatlist_t *chatlist, size_t index)mrchatlist_t
    mrchatlist_get_cnt(mrchatlist_t *chatlist)mrchatlist_t
    mrchatlist_get_msg_id(mrchatlist_t *ths, size_t index)mrchatlist_t
    mrchatlist_get_msg_id(mrchatlist_t *chatlist, size_t index)mrchatlist_t
    mrchatlist_get_summary(mrchatlist_t *chatlist, size_t index, mrchat_t *chat)mrchatlist_t
    mrchatlist_unref(mrchatlist_t *chatlist)mrchatlist_t
    diff --git a/docs/html/structmrchatlist__t.html b/docs/html/structmrchatlist__t.html index 1999057b..ac6e3bd4 100644 --- a/docs/html/structmrchatlist__t.html +++ b/docs/html/structmrchatlist__t.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: mrchatlist_t Struct Reference +Delta Chat Core C-API: mrchatlist_t Struct Reference @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -106,12 +106,12 @@ Public Member Functions size_t mrchatlist_get_cnt (mrchatlist_t *chatlist)  Find out the number of chats in a chatlist. More...
      -uint32_t mrchatlist_get_chat_id (mrchatlist_t *ths, size_t index) - Get a single chat ID of a chatlist. More...
    -  -uint32_t mrchatlist_get_msg_id (mrchatlist_t *ths, size_t index) - Get a single message ID of a chatlist. More...
    -  +uint32_t mrchatlist_get_chat_id (mrchatlist_t *chatlist, size_t index) + Get a single chat ID of a chatlist. More...
    +  +uint32_t mrchatlist_get_msg_id (mrchatlist_t *chatlist, size_t index) + Get a single message ID of a chatlist. More...
    mrpoortext_tmrchatlist_get_summary (mrchatlist_t *chatlist, size_t index, mrchat_t *chat)  Get a summary for a chatlist index. More...
      @@ -152,7 +152,7 @@ Public Attributes
    - +
    @@ -160,7 +160,7 @@ Public Attributes - + @@ -180,6 +180,7 @@ Public Attributes
    Parameters
    uint32_t mrchatlist_get_chat_id ( mrchatlist_tths, chatlist,
    +
    chatlistThe chatlist object as created eg. by mrmailbox_get_chatlist().
    indexThe index to get the chat ID for.
    @@ -212,7 +213,7 @@ Public Attributes
    - +
    @@ -220,7 +221,7 @@ Public Attributes - + @@ -240,6 +241,7 @@ Public Attributes
    Parameters
    uint32_t mrchatlist_get_msg_id ( mrchatlist_tths, chatlist,
    +
    chatlistThe chatlist object as created eg. by mrmailbox_get_chatlist().
    indexThe index to get the chat ID for.
    @@ -331,7 +333,7 @@ Public Attributes
    diff --git a/docs/html/structmrcontact__t-members.html b/docs/html/structmrcontact__t-members.html index dc74f38c..877bb9c5 100644 --- a/docs/html/structmrcontact__t-members.html +++ b/docs/html/structmrcontact__t-members.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: Member List +Delta Chat Core C-API: Member List @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    diff --git a/docs/html/structmrcontact__t.html b/docs/html/structmrcontact__t.html index 3f158a5d..6972ed5e 100644 --- a/docs/html/structmrcontact__t.html +++ b/docs/html/structmrcontact__t.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: mrcontact_t Struct Reference +Delta Chat Core C-API: mrcontact_t Struct Reference @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -235,7 +235,7 @@ char *  diff --git a/docs/html/structmrmailbox__t-members.html b/docs/html/structmrmailbox__t-members.html index 049a6b3f..ee4316c1 100644 --- a/docs/html/structmrmailbox__t-members.html +++ b/docs/html/structmrmailbox__t-members.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: Member List +Delta Chat Core C-API: Member List @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -156,7 +156,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    diff --git a/docs/html/structmrmailbox__t.html b/docs/html/structmrmailbox__t.html index 002d462e..6cec8aec 100644 --- a/docs/html/structmrmailbox__t.html +++ b/docs/html/structmrmailbox__t.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: mrmailbox_t Struct Reference +Delta Chat Core C-API: mrmailbox_t Struct Reference @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -2690,7 +2690,7 @@ void *  diff --git a/docs/html/structmrmsg__t-members.html b/docs/html/structmrmsg__t-members.html index 5f643817..87768eff 100644 --- a/docs/html/structmrmsg__t-members.html +++ b/docs/html/structmrmsg__t-members.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: Member List +Delta Chat Core C-API: Member List @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -111,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    diff --git a/docs/html/structmrmsg__t.html b/docs/html/structmrmsg__t.html index 23a3370a..da8b1ba1 100644 --- a/docs/html/structmrmsg__t.html +++ b/docs/html/structmrmsg__t.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: mrmsg_t Struct Reference +Delta Chat Core C-API: mrmsg_t Struct Reference @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -538,7 +538,7 @@ char *  diff --git a/docs/html/structmrparam__t-members.html b/docs/html/structmrparam__t-members.html index 76193da8..95f995d6 100644 --- a/docs/html/structmrparam__t-members.html +++ b/docs/html/structmrparam__t-members.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: Member List +Delta Chat Core C-API: Member List @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    diff --git a/docs/html/structmrparam__t.html b/docs/html/structmrparam__t.html index de5d1050..5cba2e0d 100644 --- a/docs/html/structmrparam__t.html +++ b/docs/html/structmrparam__t.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: mrparam_t Struct Reference +Delta Chat Core C-API: mrparam_t Struct Reference @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -408,7 +408,7 @@ Public Member Functions
    diff --git a/docs/html/structmrpoortext__t-members.html b/docs/html/structmrpoortext__t-members.html index 985c8774..43f75fc0 100644 --- a/docs/html/structmrpoortext__t-members.html +++ b/docs/html/structmrpoortext__t-members.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: Member List +Delta Chat Core C-API: Member List @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    diff --git a/docs/html/structmrpoortext__t.html b/docs/html/structmrpoortext__t.html index 68acf628..9d5490aa 100644 --- a/docs/html/structmrpoortext__t.html +++ b/docs/html/structmrpoortext__t.html @@ -4,7 +4,7 @@ -Delta Chat Core C-Library: mrpoortext_t Struct Reference +Delta Chat Core C-API: mrpoortext_t Struct Reference @@ -24,7 +24,7 @@ -
    Delta Chat Core C-Library +
    Delta Chat Core C-API
    @@ -169,7 +169,7 @@ int  diff --git a/src/mrchat.c b/src/mrchat.c index c9269ef7..88417b89 100644 --- a/src/mrchat.c +++ b/src/mrchat.c @@ -28,101 +28,6 @@ #include "mrmimefactory.h" -int mrchat_update_param__(mrchat_t* ths) -{ - int success = 0; - sqlite3_stmt* stmt = mrsqlite3_prepare_v2_(ths->m_mailbox->m_sql, "UPDATE chats SET param=? WHERE id=?"); - sqlite3_bind_text(stmt, 1, ths->m_param->m_packed, -1, SQLITE_STATIC); - sqlite3_bind_int (stmt, 2, ths->m_id); - success = sqlite3_step(stmt)==SQLITE_DONE? 1 : 0; - sqlite3_finalize(stmt); - return success; -} - - -static int mrchat_set_from_stmt__(mrchat_t* ths, sqlite3_stmt* row) -{ - int row_offset = 0; - const char* draft_text; - - if( ths == NULL || row == NULL ) { - return 0; - } - - mrchat_empty(ths); - - #define MR_CHAT_FIELDS " c.id,c.type,c.name, c.draft_timestamp,c.draft_txt,c.grpid,c.param,c.archived " - ths->m_id = sqlite3_column_int (row, row_offset++); /* the columns are defined in MR_CHAT_FIELDS */ - ths->m_type = sqlite3_column_int (row, row_offset++); - ths->m_name = safe_strdup((char*)sqlite3_column_text (row, row_offset++)); - ths->m_draft_timestamp = sqlite3_column_int64(row, row_offset++); - draft_text = (const char*)sqlite3_column_text (row, row_offset++); - ths->m_grpid = safe_strdup((char*)sqlite3_column_text (row, row_offset++)); - mrparam_set_packed(ths->m_param, (char*)sqlite3_column_text (row, row_offset++)); - ths->m_archived = sqlite3_column_int (row, row_offset++); - - /* We leave a NULL-pointer for the very usual situation of "no draft". - Also make sure, m_draft_text and m_draft_timestamp are set together */ - if( ths->m_draft_timestamp && draft_text && draft_text[0] ) { - ths->m_draft_text = safe_strdup(draft_text); - } - else { - ths->m_draft_timestamp = 0; - } - - /* correct the title of some special groups */ - if( ths->m_id == MR_CHAT_ID_DEADDROP ) { - free(ths->m_name); - ths->m_name = mrstock_str(MR_STR_DEADDROP); - } - else if( ths->m_id == MR_CHAT_ID_ARCHIVED_LINK ) { - free(ths->m_name); - char* tempname = mrstock_str(MR_STR_ARCHIVEDCHATS); - ths->m_name = mr_mprintf("%s (%i)", tempname, mrmailbox_get_archived_count__(ths->m_mailbox)); - free(tempname); - } - else if( ths->m_id == MR_CHAT_ID_STARRED ) { - free(ths->m_name); - ths->m_name = mrstock_str(MR_STR_STARREDMSGS); - } - - return row_offset; /* success, return the next row offset */ -} - - -/** - * Library-internal. - * - * Calling this function is not thread-safe, locking is up to the caller. - * - * @private @memberof mrchat_t - */ -int mrchat_load_from_db__(mrchat_t* ths, uint32_t id) -{ - sqlite3_stmt* stmt; - - if( ths==NULL ) { - return 0; - } - - mrchat_empty(ths); - - stmt = mrsqlite3_predefine__(ths->m_mailbox->m_sql, SELECT_itndd_FROM_chats_WHERE_i, - "SELECT " MR_CHAT_FIELDS " FROM chats c WHERE c.id=?;"); - sqlite3_bind_int(stmt, 1, id); - - if( sqlite3_step(stmt) != SQLITE_ROW ) { - return 0; - } - - if( !mrchat_set_from_stmt__(ths, stmt) ) { - return 0; - } - - return 1; -} - - /** * Create a chat object in memory. * @@ -178,27 +83,27 @@ void mrchat_unref(mrchat_t* chat) * * @return None. */ -void mrchat_empty(mrchat_t* ths) +void mrchat_empty(mrchat_t* chat) { - if( ths == NULL ) { + if( chat == NULL ) { return; } - free(ths->m_name); - ths->m_name = NULL; + free(chat->m_name); + chat->m_name = NULL; - ths->m_draft_timestamp = 0; + chat->m_draft_timestamp = 0; - free(ths->m_draft_text); - ths->m_draft_text = NULL; + free(chat->m_draft_text); + chat->m_draft_text = NULL; - ths->m_type = MR_CHAT_TYPE_UNDEFINED; - ths->m_id = 0; + chat->m_type = MR_CHAT_TYPE_UNDEFINED; + chat->m_id = 0; - free(ths->m_grpid); - ths->m_grpid = NULL; + free(chat->m_grpid); + chat->m_grpid = NULL; - mrparam_set_packed(ths->m_param, NULL); + mrparam_set_packed(chat->m_param, NULL); } @@ -272,4 +177,108 @@ char* mrchat_get_subtitle(mrchat_t* chat) } +int mrchat_update_param__(mrchat_t* ths) +{ + int success = 0; + sqlite3_stmt* stmt = mrsqlite3_prepare_v2_(ths->m_mailbox->m_sql, "UPDATE chats SET param=? WHERE id=?"); + sqlite3_bind_text(stmt, 1, ths->m_param->m_packed, -1, SQLITE_STATIC); + sqlite3_bind_int (stmt, 2, ths->m_id); + success = sqlite3_step(stmt)==SQLITE_DONE? 1 : 0; + sqlite3_finalize(stmt); + return success; +} + + +static int mrchat_set_from_stmt__(mrchat_t* ths, sqlite3_stmt* row) +{ + int row_offset = 0; + const char* draft_text; + + if( ths == NULL || row == NULL ) { + return 0; + } + + mrchat_empty(ths); + + #define MR_CHAT_FIELDS " c.id,c.type,c.name, c.draft_timestamp,c.draft_txt,c.grpid,c.param,c.archived " + ths->m_id = sqlite3_column_int (row, row_offset++); /* the columns are defined in MR_CHAT_FIELDS */ + ths->m_type = sqlite3_column_int (row, row_offset++); + ths->m_name = safe_strdup((char*)sqlite3_column_text (row, row_offset++)); + ths->m_draft_timestamp = sqlite3_column_int64(row, row_offset++); + draft_text = (const char*)sqlite3_column_text (row, row_offset++); + ths->m_grpid = safe_strdup((char*)sqlite3_column_text (row, row_offset++)); + mrparam_set_packed(ths->m_param, (char*)sqlite3_column_text (row, row_offset++)); + ths->m_archived = sqlite3_column_int (row, row_offset++); + + /* We leave a NULL-pointer for the very usual situation of "no draft". + Also make sure, m_draft_text and m_draft_timestamp are set together */ + if( ths->m_draft_timestamp && draft_text && draft_text[0] ) { + ths->m_draft_text = safe_strdup(draft_text); + } + else { + ths->m_draft_timestamp = 0; + } + + /* correct the title of some special groups */ + if( ths->m_id == MR_CHAT_ID_DEADDROP ) { + free(ths->m_name); + ths->m_name = mrstock_str(MR_STR_DEADDROP); + } + else if( ths->m_id == MR_CHAT_ID_ARCHIVED_LINK ) { + free(ths->m_name); + char* tempname = mrstock_str(MR_STR_ARCHIVEDCHATS); + ths->m_name = mr_mprintf("%s (%i)", tempname, mrmailbox_get_archived_count__(ths->m_mailbox)); + free(tempname); + } + else if( ths->m_id == MR_CHAT_ID_STARRED ) { + free(ths->m_name); + ths->m_name = mrstock_str(MR_STR_STARREDMSGS); + } + + return row_offset; /* success, return the next row offset */ +} + + +/** + * Library-internal. + * + * Calling this function is not thread-safe, locking is up to the caller. + * + * @private @memberof mrchat_t + * + * @param chat The chat object that should be filled with the data from the database. + * Existing data are free()'d before using mrchat_empty(). + * + * @param chat_id Chat ID that should be loaded from the database. + * + * @return 1=success, 0=error. + */ +int mrchat_load_from_db__(mrchat_t* chat, uint32_t chat_id) +{ + sqlite3_stmt* stmt; + + if( chat==NULL ) { + return 0; + } + + mrchat_empty(chat); + + stmt = mrsqlite3_predefine__(chat->m_mailbox->m_sql, SELECT_itndd_FROM_chats_WHERE_i, + "SELECT " MR_CHAT_FIELDS " FROM chats c WHERE c.id=?;"); + sqlite3_bind_int(stmt, 1, chat_id); + + if( sqlite3_step(stmt) != SQLITE_ROW ) { + return 0; + } + + if( !mrchat_set_from_stmt__(chat, stmt) ) { + return 0; + } + + return 1; +} + + + + diff --git a/src/mrchat.h b/src/mrchat.h index 2503df44..bf6dd9df 100644 --- a/src/mrchat.h +++ b/src/mrchat.h @@ -45,12 +45,12 @@ typedef struct mrchat_t #define MR_CHAT_ID_STARRED 5 /* virtual chat containing all starred messages */ #define MR_CHAT_ID_ARCHIVED_LINK 6 /* a link at the end of the chatlist, if present the UI should show the button "Archived chats" */ #define MR_CHAT_ID_LAST_SPECIAL 9 /* larger chat IDs are "real" chats, their messages are "real" messages. */ - uint32_t m_id; + uint32_t m_id; /**< Chat ID under which this object is available in the database. */ #define MR_CHAT_TYPE_UNDEFINED 0 #define MR_CHAT_TYPE_NORMAL 100 /* a normal chat is a chat with a single contact, chats_contacts contains one record for the user, MR_CONTACT_ID_SELF is not added. */ #define MR_CHAT_TYPE_GROUP 120 /* a group chat, chats_contacts conain all group members, incl. MR_CONTACT_ID_SELF */ - int m_type; + int m_type; /**< Chat type, one of the MR_CHAT_TYPE_* constants. */ char* m_name; /**< NULL if unset */ time_t m_draft_timestamp; /**< 0 if there is no draft */ diff --git a/src/mrchatlist.c b/src/mrchatlist.c index 1afdcac5..61b1e443 100644 --- a/src/mrchatlist.c +++ b/src/mrchatlist.c @@ -115,16 +115,18 @@ size_t mrchatlist_get_cnt(mrchatlist_t* chatlist) * * @param chatlist The chatlist object as created eg. by mrmailbox_get_chatlist(). * + * @param index The index to get the chat ID for. + * * @return Returns the chat_id of the item at the given index. Index must be between * 0 and mrchatlist_get_cnt()-1. */ -uint32_t mrchatlist_get_chat_id(mrchatlist_t* ths, size_t index) +uint32_t mrchatlist_get_chat_id(mrchatlist_t* chatlist, size_t index) { - if( ths == NULL || ths->m_chatNlastmsg_ids == NULL || index >= ths->m_cnt ) { + if( chatlist == NULL || chatlist->m_chatNlastmsg_ids == NULL || index >= chatlist->m_cnt ) { return 0; } - return (uint32_t)(uintptr_t)carray_get(ths->m_chatNlastmsg_ids, index*MR_CHATLIST_IDS_PER_RESULT); + return (uint32_t)(uintptr_t)carray_get(chatlist->m_chatNlastmsg_ids, index*MR_CHATLIST_IDS_PER_RESULT); } @@ -145,16 +147,18 @@ mrchat_t* mrchatlist_get_chat_by_index(mrchatlist_t* ths, size_t index) /* depre * * @param chatlist The chatlist object as created eg. by mrmailbox_get_chatlist(). * + * @param index The index to get the chat ID for. + * * @return Returns the message_id of the item at the given index. Index must be between * 0 and mrchatlist_get_cnt()-1. If there is no message at the given index (eg. the chat may be empty), 0 is returned. */ -uint32_t mrchatlist_get_msg_id(mrchatlist_t* ths, size_t index) +uint32_t mrchatlist_get_msg_id(mrchatlist_t* chatlist, size_t index) { - if( ths == NULL || ths->m_chatNlastmsg_ids == NULL || index >= ths->m_cnt ) { + if( chatlist == NULL || chatlist->m_chatNlastmsg_ids == NULL || index >= chatlist->m_cnt ) { return 0; } - return (uint32_t)(uintptr_t)carray_get(ths->m_chatNlastmsg_ids, index*MR_CHATLIST_IDS_PER_RESULT+1); + return (uint32_t)(uintptr_t)carray_get(chatlist->m_chatNlastmsg_ids, index*MR_CHATLIST_IDS_PER_RESULT+1); } diff --git a/src/mrmailbox.h b/src/mrmailbox.h index 07ee4035..f38a9970 100644 --- a/src/mrmailbox.h +++ b/src/mrmailbox.h @@ -45,6 +45,8 @@ extern "C" { * Your function should look like the following: * * ``` + * #include + * * uintptr_t my_delta_handler(mrmailbox_t* nb, int event, uintptr_t data1, uintptr_t data2) * { * return 0; // for unhandled events, it is always safe to return 0 @@ -97,7 +99,7 @@ extern "C" { */ -#include /* defines uint16_t etc. */ +#include /* defines uint16_t and carray */ #include "mrchatlist.h" #include "mrchat.h" #include "mrmsg.h" @@ -140,37 +142,39 @@ typedef uintptr_t (*mrmailboxcb_t) (mrmailbox_t*, int event, uintptr_t data1, ui */ typedef struct mrmailbox_t { - void* m_userdata; /**< the same pointer as given to mrmailbox_new(), may be used by the caller for any purpose */ - char* m_dbfile; /**< the database file in file. */ - char* m_blobdir; /**< full path of the blob directory in use. */ + void* m_userdata; /**< the same pointer as given to mrmailbox_new(), may be used by the caller for any purpose */ + char* m_dbfile; /**< the database file in file. */ + char* m_blobdir; /**< full path of the blob directory in use. */ /** @privatesection */ - mrsqlite3_t* m_sql; /**< Internal SQL object, never NULL */ - mrimap_t* m_imap; /**< Internal IMAP object, never NULL */ - mrsmtp_t* m_smtp; /**< Internal SMTP object, never NULL */ + mrsqlite3_t* m_sql; /**< Internal SQL object, never NULL */ + mrimap_t* m_imap; /**< Internal IMAP object, never NULL */ + mrsmtp_t* m_smtp; /**< Internal SMTP object, never NULL */ - pthread_t m_job_thread; /**< Internal */ - pthread_cond_t m_job_cond; /**< Internal */ - pthread_mutex_t m_job_condmutex; /**< Internal */ - int m_job_condflag; /**< Internal */ - int m_job_do_exit; /**< Internal */ + pthread_t m_job_thread; /**< Internal */ + pthread_cond_t m_job_cond; /**< Internal */ + pthread_mutex_t m_job_condmutex; /**< Internal */ + int m_job_condflag; /**< Internal */ + int m_job_do_exit; /**< Internal */ - mrmailboxcb_t m_cb; /**< Internal */ + mrmailboxcb_t m_cb; /**< Internal */ - char* m_os_name; /**< Internal */ + char* m_os_name; /**< Internal */ - uint32_t m_cmdline_sel_chat_id; /**< Internal */ + uint32_t m_cmdline_sel_chat_id; /**< Internal */ - int m_wake_lock; /**< Internal */ - pthread_mutex_t m_wake_lock_critical; /**< Internal */ + int m_wake_lock; /**< Internal */ + pthread_mutex_t m_wake_lock_critical; /**< Internal */ - int m_e2ee_enabled; /**< Internal */ + int m_e2ee_enabled; /**< Internal */ #define MR_LOG_RINGBUF_SIZE 200 pthread_mutex_t m_log_ringbuf_critical; /**< Internal */ - char* m_log_ringbuf[MR_LOG_RINGBUF_SIZE]; /**< Internal */ - time_t m_log_ringbuf_times[MR_LOG_RINGBUF_SIZE]; /**< Internal */ - int m_log_ringbuf_pos; /**< Internal. The oldest position resp. the position that is overwritten next */ + char* m_log_ringbuf[MR_LOG_RINGBUF_SIZE]; + /**< Internal */ + time_t m_log_ringbuf_times[MR_LOG_RINGBUF_SIZE]; + /**< Internal */ + int m_log_ringbuf_pos; /**< Internal. The oldest position resp. the position that is overwritten next */ } mrmailbox_t;