Delta Chat Core C-API
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 mrmailbox_t;
31 
32 
33 #define MR_CHAT_ID_DEADDROP 1
34 #define MR_CHAT_ID_TO_DEADDROP 2 /* messages sent from us to unknown/unwanted users (this may happen when deleting chats or when using CC: in the email-program) */
35 #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) */
36 #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 sent and shown) */
37 #define MR_CHAT_ID_STARRED 5
38 #define MR_CHAT_ID_ARCHIVED_LINK 6
39 #define MR_CHAT_ID_LAST_SPECIAL 9 /* larger chat IDs are "real" chats, their messages are "real" messages. */
40 #define MR_CHAT_TYPE_UNDEFINED 0
41 #define MR_CHAT_TYPE_NORMAL 100
42 #define MR_CHAT_TYPE_GROUP 120
43 
44 
52 typedef struct _mrchat mrchat_t;
53 
54 
55 mrchat_t* mrchat_new (mrmailbox_t*);
56 void mrchat_empty (mrchat_t*);
57 void mrchat_unref (mrchat_t*);
58 
59 uint32_t mrchat_get_id (mrchat_t*);
61 char* mrchat_get_name (mrchat_t*);
64 char* mrchat_get_draft (mrchat_t*);
69 
70 
71 #ifdef __cplusplus
72 } /* /extern "C" */
73 #endif
74 #endif /* __MRCHAT_H__ */
int mrchat_is_unpromoted(mrchat_t *chat)
Check if a chat is still unpromoted.
Definition: mrchat.c:379
int mrchat_is_self_talk(mrchat_t *chat)
Check if a chat is a self talk.
Definition: mrchat.c:398
char * mrchat_get_draft(mrchat_t *chat)
Get draft for the chat, if any.
Definition: mrchat.c:308
char * mrchat_get_name(mrchat_t *chat)
Get name of a chat.
Definition: mrchat.c:187
time_t mrchat_get_draft_timestamp(mrchat_t *chat)
Get timestamp of the draft.
Definition: mrchat.c:329
int mrchat_get_archived(mrchat_t *chat)
Get archived state.
Definition: mrchat.c:355
An object representing a single mailbox.
uint32_t mrchat_get_id(mrchat_t *chat)
Get chat ID.
Definition: mrchat.c:134
void mrchat_unref(mrchat_t *chat)
Free a chat object.
Definition: mrchat.c:68
char * mrchat_get_profile_image(mrchat_t *chat)
Get the chat's profile image.
Definition: mrchat.c:285
int mrchat_get_type(mrchat_t *chat)
Get chat type.
Definition: mrchat.c:163
An object representing a single chat in memory.
char * mrchat_get_subtitle(mrchat_t *chat)
Get a subtitle for a chat.
Definition: mrchat.c:209