]>
Commit | Line | Data |
---|---|---|
aa039bee MR |
1 | /* |
2 | * vcard-parser.h | |
3 | * | |
4 | * Copyright 2019 Michael Rasmussen <mir@datanom.net> | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation; either version 2 of the License, or | |
9 | * (at your option) any later version. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
19 | * MA 02110-1301, USA. | |
20 | */ | |
21 | ||
0d68a955 MR |
22 | #ifndef __VCARD_PARSER_H__ |
23 | #define __VCARD_PARSER_H__ | |
aa039bee MR |
24 | |
25 | #include <glib.h> | |
26 | ||
27 | G_BEGIN_DECLS | |
28 | ||
0d68a955 MR |
29 | #include <globals.h> |
30 | ||
aa039bee MR |
31 | typedef enum { |
32 | // vCard 2.1 properties and up | |
0d68a955 | 33 | // https://github.com/emacsmirror/addressbook/blob/master/vcard-21.txt |
aa039bee MR |
34 | N = 0, |
35 | FN, | |
36 | PHOTO, | |
37 | BDAY, | |
38 | ADR, | |
39 | LABEL, // Removed in vCard 4.0 | |
40 | TEL, | |
41 | EMAIL, | |
42 | MAILER, // Removed in vCard 4.0 | |
43 | GEO, | |
44 | TITLE, | |
45 | ROLE, | |
46 | LOGO, | |
47 | ORG, | |
48 | NOTE, | |
49 | REV, | |
50 | SOUND, | |
51 | URL, | |
52 | UID, | |
53 | VERSION, | |
54 | KEY, | |
55 | TZ, | |
0d68a955 MR |
56 | SOURCE, |
57 | AGENT, // Removed in vCard 4.0 | |
58 | PROFILE, // Removed in vCard 4.0 | |
aa039bee | 59 | // vCard 3.0 properties |
0d68a955 | 60 | // https://tools.ietf.org/html/rfc2426 |
aa039bee MR |
61 | CATEGORIES, |
62 | SORT_STRING, | |
63 | PRODID, | |
64 | NICKNAME, | |
0d68a955 | 65 | NAME, // Removed in vCard 4.0 |
aa039bee MR |
66 | CLASS, // Removed in vCard 4.0 |
67 | // rfc2739 properties | |
68 | FBURL, | |
69 | CAPURI, | |
70 | CALURI, | |
71 | CALADRURI, | |
72 | // rfc4770 properties | |
73 | IMPP, | |
74 | // vCard 4.0 properties | |
0d68a955 | 75 | // https://tools.ietf.org/html/rfc6350 |
aa039bee MR |
76 | XML, |
77 | ANNIVERSARY, | |
78 | CLIENTPIDMAP, | |
79 | LANG, | |
80 | GENDER, | |
81 | KIND, | |
82 | MEMBER, | |
83 | RELATED, | |
84 | // rfc6474 properties | |
85 | BIRTHPLACE, | |
86 | DEATHPLACE, | |
87 | DEATHDATE, | |
88 | // rfc6715 properties | |
89 | EXPERTISE, | |
90 | HOBBY, | |
91 | INTEREST, | |
92 | ORG_DIRECTORY, | |
93 | VCARD_PROPERTIES, | |
94 | } Property; | |
95 | ||
0d68a955 MR |
96 | typedef enum { |
97 | VCARD_PARSER_OK, | |
98 | VCARD_PARSER_VERSION_MISSING, | |
99 | VCARD_PARSER_VERSION_MISMATCH, | |
100 | VCARD_PARSER_ATTRIBUTE_VERSION_MISMATCH, | |
101 | VCARD_PARSER_BAD_FORMAT, | |
102 | VCARD_PARSER_ERROR, | |
103 | } VCardParserResponse; | |
aa039bee | 104 | |
0d68a955 MR |
105 | typedef struct { |
106 | gchar* name; | |
107 | gchar* value; | |
108 | } VCardProperty; | |
109 | ||
110 | VCardVersion str_2_vcard_version(const gchar* version); | |
111 | gchar* vcard_version_2_str(VCardVersion version); | |
112 | Property vcard_max_property(VCardVersion version); | |
113 | VCardParserResponse vcard_parse_text(const gchar* text, VCardVersion* version, GHashTable** vcard); | |
114 | void destroy_hash_table(GHashTable* ht); | |
aa039bee | 115 | |
0d68a955 | 116 | G_END_DECLS |
aa039bee MR |
117 | |
118 | #endif |