Delta Chat Core C-API
mrparam.h
1 /*******************************************************************************
2  *
3  * Delta Chat Core
4  * Copyright (C) 2017 Björn Petersen
5  * Contact: r10s@b44t.com, http://b44t.com
6  *
7  * This program is free software: you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License as published by the Free Software
9  * Foundation, either version 3 of the License, or (at your option) any later
10  * version.
11  *
12  * This program is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15  * details.
16  *
17  * You should have received a copy of the GNU General Public License along with
18  * this program. If not, see http://www.gnu.org/licenses/ .
19  *
20  ******************************************************************************/
21 
22 
23 #ifndef __MRPARAM_H__
24 #define __MRPARAM_H__
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 
36 typedef struct mrparam_t
37 {
39  char* m_packed;
40 } mrparam_t;
41 
42 
43 #define MRP_FILE 'f' /* for msgs */
44 #define MRP_WIDTH 'w' /* for msgs */
45 #define MRP_HEIGHT 'h' /* for msgs */
46 #define MRP_DURATION 'd' /* for msgs */
47 #define MRP_MIMETYPE 'm' /* for msgs */
48 #define MRP_AUTHORNAME 'N' /* for msgs: name of author or artist */
49 #define MRP_TRACKNAME 'n' /* for msgs: name of author or artist */
50 #define MRP_GUARANTEE_E2EE 'c' /* for msgs: 'c'rypted in original/guarantee E2EE or the message is not send */
51 #define MRP_ERRONEOUS_E2EE 'e' /* for msgs: decrypted with validation errors or without mutual set, if neither 'c' nor 'e' are preset, the messages is only transport encrypted */
52 #define MRP_WANTS_MDN 'r' /* for msgs: an incoming message which requestes a MDN (aka read receipt) */
53 #define MRP_FORWARDED 'a' /* for msgs */
54 #define MRP_SYSTEM_CMD 'S' /* for msgs */
55 #define MRP_SYSTEM_CMD_PARAM 'E' /* for msgs */
56 
57 #define MRP_SERVER_FOLDER 'Z' /* for jobs */
58 #define MRP_SERVER_UID 'z' /* for jobs */
59 #define MRP_TIMES 't' /* for jobs: times a job was tried */
60 #define MRP_TIMES_INCREATION 'T' /* for jobs: times a job was tried, used for increation */
61 
62 #define MRP_REFERENCES 'R' /* for groups and chats: References-header last used for a chat */
63 #define MRP_UNPROMOTED 'U' /* for groups */
64 #define MRP_PROFILE_IMAGE 'i' /* for groups and contacts */
65 #define MRP_DEL_AFTER_SEND 'P' /* for groups and msgs: physically delete group after message sending if msg-value matches group-value */
66 
67 
68 /* user functions */
69 int mrparam_exists (mrparam_t*, int key);
70 char* mrparam_get (mrparam_t*, int key, const char* def); /* the value may be an empty string, "def" is returned only if the value unset. The result must be free()'d in any case. */
71 int32_t mrparam_get_int (mrparam_t*, int key, int32_t def);
72 void mrparam_set (mrparam_t*, int key, const char* value);
73 void mrparam_set_int (mrparam_t*, int key, int32_t value);
74 
75 /* library-private */
77 void mrparam_empty (mrparam_t*);
78 void mrparam_unref (mrparam_t*);
79 void mrparam_set_packed (mrparam_t*, const char*);
80 
81 
82 
83 
84 #ifdef __cplusplus
85 } /* /extern "C" */
86 #endif
87 #endif /* __MRPARAM_H__ */
int mrparam_exists(mrparam_t *param, int key)
Check if a parameter exists.
Definition: mrparam.c:161
void mrparam_unref(mrparam_t *param)
Free an parameter list object created eg.
Definition: mrparam.c:90
char * mrparam_get(mrparam_t *param, int key, const char *def)
Get value of a parameter.
Definition: mrparam.c:186
void mrparam_set(mrparam_t *param, int key, const char *value)
Set parameter to a string.
Definition: mrparam.c:253
mrparam_t * mrparam_new()
Create new parameter list object.
Definition: mrparam.c:69
void mrparam_set_int(mrparam_t *param, int key, int32_t value)
Set parameter to an integer.
Definition: mrparam.c:318
int32_t mrparam_get_int(mrparam_t *param, int key, int32_t def)
Get value of a parameter.
Definition: mrparam.c:223
An object for handling key=value parameter lists.
Definition: mrparam.h:36
void mrparam_empty(mrparam_t *param)
Delete all parameters.
Definition: mrparam.c:111