Delta Chat Core C-API
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 mrmailbox_t;
31 
32 
40 typedef struct _mrmsg 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 
46 #define MR_MSG_UNDEFINED 0
47 #define MR_MSG_TEXT 10
48 #define MR_MSG_IMAGE 20 /* m_param may contain MRP_FILE, MRP_WIDTH, MRP_HEIGHT */
49 #define MR_MSG_GIF 21 /* - " - */
50 #define MR_MSG_AUDIO 40 /* m_param may contain MRP_FILE, MRP_DURATION */
51 #define MR_MSG_VOICE 41 /* - " - */
52 #define MR_MSG_VIDEO 50 /* m_param may contain MRP_FILE, MRP_WIDTH, MRP_HEIGHT, MRP_DURATION */
53 #define MR_MSG_FILE 60 /* m_param may contain MRP_FILE */
54 
55 #define MR_STATE_UNDEFINED 0
56 #define MR_STATE_IN_FRESH 10
57 #define MR_STATE_IN_NOTICED 13
58 #define MR_STATE_IN_SEEN 16
59 #define MR_STATE_OUT_PENDING 20
60 #define MR_STATE_OUT_ERROR 24
61 #define MR_STATE_OUT_DELIVERED 26 /* to check if a mail was sent, use mrmsg_is_sent() */
62 #define MR_STATE_OUT_MDN_RCVD 28
63 
64 
65 mrmsg_t* mrmsg_new ();
66 void mrmsg_unref (mrmsg_t*);
67 void mrmsg_empty (mrmsg_t*);
68 
69 uint32_t mrmsg_get_id (mrmsg_t*);
70 uint32_t mrmsg_get_from_id (mrmsg_t*);
71 uint32_t mrmsg_get_chat_id (mrmsg_t*);
72 int mrmsg_get_type (mrmsg_t*);
75 char* mrmsg_get_text (mrmsg_t*);
76 char* mrmsg_get_file (mrmsg_t*);
79 uint64_t mrmsg_get_filebytes (mrmsg_t*);
86 char* mrmsg_get_summarytext (mrmsg_t*, int approx_characters);
87 int mrmsg_is_sent (mrmsg_t*);
92 
95 
96 void mrmsg_latefiling_mediasize (mrmsg_t*, int width, int height, int duration);
97 
98 
99 
100 
101 #ifdef __cplusplus
102 } /* /extern "C" */
103 #endif
104 #endif /* __MRMSG_H__ */
int mrmsg_get_height(mrmsg_t *msg)
Get height of image or video.
Definition: mrmsg.c:512
int mrmsg_is_starred(mrmsg_t *msg)
Check if a message is starred.
Definition: mrmsg.c:686
void mrmsg_unref(mrmsg_t *msg)
Free a message object.
Definition: mrmsg.c:69
int mrmsg_get_duration(mrmsg_t *msg)
Get duration of audio or video.
Definition: mrmsg.c:534
char * mrmsg_get_filemime(mrmsg_t *msg)
Get mime type of the file.
Definition: mrmsg.c:343
uint32_t mrmsg_get_chat_id(mrmsg_t *msg)
Get the ID of chat the message belongs to.
Definition: mrmsg.c:163
char * mrmsg_get_summarytext(mrmsg_t *msg, int approx_characters)
Get a message summary as a single line of text.
Definition: mrmsg.c:641
int mrmsg_is_increation(mrmsg_t *msg)
Check if a message is still in creation.
Definition: mrmsg.c:1065
mrlot_t * mrmsg_get_summary(mrmsg_t *msg, mrchat_t *chat)
Get a summary for a message.
Definition: mrmsg.c:598
int mrmsg_is_systemcmd(mrmsg_t *msg)
Check if the message is a system command.
Definition: mrmsg.c:741
uint32_t mrmsg_get_from_id(mrmsg_t *msg)
Get the ID of contact who wrote the message.
Definition: mrmsg.c:144
int mrmsg_is_forwarded(mrmsg_t *msg)
Check if the message is a forwarded message.
Definition: mrmsg.c:714
int mrmsg_is_setupmessage(mrmsg_t *msg)
Check if the message is an Autocrypt Setup Message.
Definition: mrmsg.c:767
int mrmsg_get_width(mrmsg_t *msg)
Get width of image or video.
Definition: mrmsg.c:487
time_t mrmsg_get_timestamp(mrmsg_t *msg)
Get message time.
Definition: mrmsg.c:239
int mrmsg_get_showpadlock(mrmsg_t *msg)
Check if a padlock should be shown beside the message.
Definition: mrmsg.c:552
mrlot_t * mrmsg_get_mediainfo(mrmsg_t *msg)
Get real author and title.
Definition: mrmsg.c:426
char * mrmsg_get_file(mrmsg_t *msg)
Find out full path, file name and extension of the file associated with a message.
Definition: mrmsg.c:284
char * mrmsg_get_text(mrmsg_t *msg)
Get the text of the message.
Definition: mrmsg.c:259
An object representing a single message in memory.
void mrmsg_latefiling_mediasize(mrmsg_t *msg, int width, int height, int duration)
Late filing information to a message.
Definition: mrmsg.c:1123
An object representing a single mailbox.
char * mrmsg_get_filename(mrmsg_t *msg)
Get base file name without path.
Definition: mrmsg.c:311
int mrmsg_get_state(mrmsg_t *msg)
Get the state of a message.
Definition: mrmsg.c:221
uint64_t mrmsg_get_filebytes(mrmsg_t *msg)
Get the size of the file.
Definition: mrmsg.c:384
char * mrmsg_get_setupcodebegin(mrmsg_t *msg)
Get the first characters of the setup code.
Definition: mrmsg.c:793
uint32_t mrmsg_get_id(mrmsg_t *msg)
Get the ID of the message.
Definition: mrmsg.c:125
int mrmsg_get_type(mrmsg_t *msg)
Get the type of the message.
Definition: mrmsg.c:183
An object containing a set of values.
An object representing a single chat in memory.
int mrmsg_is_sent(mrmsg_t *msg)
Check if a message was sent successfully.
Definition: mrmsg.c:663