Delta Chat Core C-API
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 mrlot_t mrlot_t;
32 typedef struct mrchat_t mrchat_t;
33 typedef struct mrarray_t mrarray_t;
34 
35 
43 typedef struct mrchatlist_t
44 {
46  uint32_t m_magic;
47  mrmailbox_t* m_mailbox;
48  #define MR_CHATLIST_IDS_PER_RESULT 2
49  size_t m_cnt;
50  mrarray_t* m_chatNlastmsg_ids;
51 } mrchatlist_t;
52 
53 
54 mrchatlist_t* mrchatlist_new (mrmailbox_t*);
55 void mrchatlist_empty (mrchatlist_t*);
58 uint32_t mrchatlist_get_chat_id (mrchatlist_t*, size_t index);
59 uint32_t mrchatlist_get_msg_id (mrchatlist_t*, size_t index);
61 
62 /* library-internal */
63 int mrchatlist_load_from_db__ (mrchatlist_t*, int listflags, const char* query);
64 
65 
66 #ifdef __cplusplus
67 } /* /extern "C" */
68 #endif
69 #endif /* __MRCHATLIST_H__ */
An object containing a simple array.
Definition: mrarray.h:39
An object representing a single chatlist in memory.
Definition: mrchatlist.h:43
An object representing a single mailbox.
Definition: mrmailbox.h:194
uint32_t mrchatlist_get_msg_id(mrchatlist_t *chatlist, size_t index)
Get a single message ID of a chatlist.
Definition: mrchatlist.c:154
An object containing a set of values.
Definition: mrlot.h:36
size_t mrchatlist_get_cnt(mrchatlist_t *chatlist)
Find out the number of chats in a chatlist.
Definition: mrchatlist.c:106
uint32_t mrchatlist_get_chat_id(mrchatlist_t *chatlist, size_t index)
Get a single chat ID of a chatlist.
Definition: mrchatlist.c:130
void mrchatlist_unref(mrchatlist_t *chatlist)
Free a chatlist object.
Definition: mrchatlist.c:65
mrlot_t * mrchatlist_get_summary(mrchatlist_t *chatlist, size_t index, mrchat_t *chat)
Get a summary for a chatlist index.
Definition: mrchatlist.c:192
An object representing a single chat in memory.
Definition: mrchat.h:39