Baytown, LA 30314=0D=0AUnited States of America
EMAIL:forrestgump@example.com
REV:20080424T195243Z
+X-TEST:Test for private extension
END:VCARD
BEGIN:VCARD
EMAIL:forrestgump@example.com
REV:20080424T195243Z
SORT-STRING:alibaba
+X-TEST:Test for private extension
END:VCARD
BEGIN:VCARD
ORG-DIRECTORY:test af ORG-DIRECTORY
SORT-STRING:alibaba
VERSION:4.0
+X-TEST:Test for private extension
END:VCARD
}
static Property get_property(const gchar* property) {
-/* Property p = VCARD_PROPERTIES;
- gchar* lookup = NULL;
-
- if (g_strcmp0("ORG-DIRECTORY", property) == 0)
- lookup = g_strdup("ORG_DIRECTORY");
- else if (g_strcmp0("SORT-STRING", property) == 0)
- lookup = g_strdup("SORT_STRING");
- else
- lookup = g_strdup(property);
-
- for (int i = 0; i < VCARD_PROPERTIES; i++) {
- if (g_strcmp0(Properties[i], lookup) == 0) {
- p = i;
- break;
- }
- }
- g_free(lookup);*/
for (Property i = N; i < VCARD_PROPERTIES; i++) {
if (g_strcmp0(Properties[i], property) == 0) return i;
}
support = property <= IMPP ? TRUE : FALSE;
} else if (version == VCARD_VERSION_4_0) {
support = property <= VCARD_PROPERTIES ? TRUE : FALSE;
- };
+ }
return support;
}
static VCardParserResponse vcard_parse(gchar** text, VCardVersion version, GHashTable** vcard) {
VCardParserResponse r = VCARD_PARSER_ERROR;
guint l = g_strv_length(text);
+ gboolean support;
for (guint i = 0; i < l; i++) {
gchar** b = g_strsplit(text[i], ":", 2);
g_strfreev(b);
continue;
}
- Property property = get_property(c[0]);
- if (check_support(property, version)) {
+ if (g_str_has_prefix(c[0], "X-")) {
+ support = TRUE;
+ } else {
+ Property property = get_property(c[0]);
+ support = check_support(property, version);
+ }
+ if (support) {
GSList* value = g_hash_table_lookup(*vcard, c[0]);
VCardProperty* vp = g_new(VCardProperty, 1);
vp->name = g_strdup(b[0]);