Delta Chat Core C-API
mrcontact-private.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 __MRCONTACT_PRIVATE_H__
24 #define __MRCONTACT_PRIVATE_H__
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 
30 typedef struct mrsqlite3_t mrsqlite3_t;
31 
32 
34 struct _mrcontact
35 {
38  uint32_t m_magic;
39 
48  uint32_t m_id;
49  char* m_name;
50  char* m_authname;
51  char* m_addr;
52  int m_blocked;
53  int m_origin;
54 };
55 
56 
57 /* library-internal */
58 #define MR_ORIGIN_UNSET 0
59 #define MR_ORIGIN_INCOMING_UNKNOWN_FROM 0x10 /* From: of incoming messages of unknown sender */
60 #define MR_ORIGIN_INCOMING_UNKNOWN_CC 0x20 /* Cc: of incoming messages of unknown sender */
61 #define MR_ORIGIN_INCOMING_UNKNOWN_TO 0x40 /* To: of incoming messages of unknown sender */
62 #define MR_ORIGIN_INCOMING_REPLY_TO 0x100 /* Reply-To: of incoming message of known sender */
63 #define MR_ORIGIN_INCOMING_CC 0x200 /* Cc: of incoming message of known sender */
64 #define MR_ORIGIN_INCOMING_TO 0x400 /* additional To:'s of incoming message of known sender */
65 #define MR_ORIGIN_CREATE_CHAT 0x800 /* a chat was manually created for this user, but no message yet sent */
66 #define MR_ORIGIN_OUTGOING_BCC 0x1000 /* message sent by us */
67 #define MR_ORIGIN_OUTGOING_CC 0x2000 /* message sent by us */
68 #define MR_ORIGIN_OUTGOING_TO 0x4000 /* message sent by us */
69 #define MR_ORIGIN_INTERNAL 0x40000 /* internal use */
70 #define MR_ORIGIN_ADRESS_BOOK 0x80000 /* address is in our address book */
71 #define MR_ORIGIN_MANUALLY_CREATED 0x100000 /* contact added by mrmailbox_create_contact() */
72 
73 #define MR_ORIGIN_MIN_CONTACT_LIST (MR_ORIGIN_INCOMING_REPLY_TO) /* contacts with at least this origin value are shown in the contact list */
74 #define MR_ORIGIN_MIN_VERIFIED (MR_ORIGIN_INCOMING_REPLY_TO) /* contacts with at least this origin value are verified and known not to be spam */
75 #define MR_ORIGIN_MIN_START_NEW_NCHAT (0x7FFFFFFF) /* contacts with at least this origin value start a new "normal" chat, defaults to off */
76 
77 int mrcontact_load_from_db__ (mrcontact_t*, mrsqlite3_t*, uint32_t contact_id);
78 void mr_normalize_name (char* full_name);
79 char* mr_normalize_addr (const char* email_addr);
80 char* mr_get_first_name (const char* full_name);
81 
82 
83 #ifdef __cplusplus
84 } /* /extern "C" */
85 #endif
86 #endif /* __MRCONTACT_PRIVATE_H__ */
An object representing a single contact in memory.