1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
|
/*
* x-evo - A plugin for evolution extensions for the opensync framework
* Copyright (C) 2004-2005 Armin Bauer <armin.bauer@opensync.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "xml-support.h"
#include "vformat.h"
#include <glib.h>
#include "xml-vcard.h"
static xmlNode *handle_x_aim_attribute(xmlNode *root, VFormatAttribute *attr)
{
osync_trace(TRACE_INTERNAL, "Handling x-aim attribute");
xmlNode *current = xmlNewTextChild(root, NULL, (xmlChar*)"IM-AIM", NULL);
osxml_node_add(current, "Content", vformat_attribute_get_nth_value(attr, 0));
return current;
}
static xmlNode *handle_file_as_attribute(xmlNode *root, VFormatAttribute *attr)
{
osync_trace(TRACE_INTERNAL, "Handling file_as attribute");
xmlNode *current = xmlNewTextChild(root, NULL, (xmlChar*)"FileAs", NULL);
osxml_node_add(current, "Content", vformat_attribute_get_nth_value(attr, 0));
return current;
}
static xmlNode *handle_manager_attribute(xmlNode *root, VFormatAttribute *attr)
{
osync_trace(TRACE_INTERNAL, "Handling Manager attribute");
xmlNode *current = xmlNewTextChild(root, NULL, (xmlChar*)"Manager", NULL);
osxml_node_add(current, "Content", vformat_attribute_get_nth_value(attr, 0));
return current;
}
static xmlNode *handle_assistant_attribute(xmlNode *root, VFormatAttribute *attr)
{
osync_trace(TRACE_INTERNAL, "Handling Assistant attribute");
xmlNode *current = xmlNewTextChild(root, NULL, (xmlChar*)"Assistant", NULL);
osxml_node_add(current, "Content", vformat_attribute_get_nth_value(attr, 0));
return current;
}
static xmlNode *handle_anniversary_attribute(xmlNode *root, VFormatAttribute *attr)
{
osync_trace(TRACE_INTERNAL, "Handling Anniversary attribute");
xmlNode *current = xmlNewTextChild(root, NULL, (xmlChar*)"Anniversary", NULL);
osxml_node_add(current, "Content", vformat_attribute_get_nth_value(attr, 0));
return current;
}
static xmlNode *handle_spouse_attribute(xmlNode *root, VFormatAttribute *attr)
{
osync_trace(TRACE_INTERNAL, "Handling Spouse attribute");
xmlNode *current = xmlNewTextChild(root, NULL, (xmlChar*)"Spouse", NULL);
osxml_node_add(current, "Content", vformat_attribute_get_nth_value(attr, 0));
return current;
}
static xmlNode *handle_blog_attribute(xmlNode *root, VFormatAttribute *attr)
{
osync_trace(TRACE_INTERNAL, "Handling BlogUrl attribute");
xmlNode *current = xmlNewTextChild(root, NULL, (xmlChar*)"BlogUrl", NULL);
osxml_node_add(current, "Content", vformat_attribute_get_nth_value(attr, 0));
return current;
}
static xmlNode *handle_calendar_url_attribute(xmlNode *root, VFormatAttribute *attr)
{
osync_trace(TRACE_INTERNAL, "Handling CalendarUrl attribute");
xmlNode *current = xmlNewTextChild(root, NULL, (xmlChar*)"CalendarUrl", NULL);
osxml_node_add(current, "Content", vformat_attribute_get_nth_value(attr, 0));
return current;
}
static xmlNode *handle_free_busy_url_attribute(xmlNode *root, VFormatAttribute *attr)
{
osync_trace(TRACE_INTERNAL, "Handling FreeBusyUrl attribute");
xmlNode *current = xmlNewTextChild(root, NULL, (xmlChar*)"FreeBusyUrl", NULL);
osxml_node_add(current, "Content", vformat_attribute_get_nth_value(attr, 0));
return current;
}
static xmlNode *handle_video_chat_attribute(xmlNode *root, VFormatAttribute *attr)
{
osync_trace(TRACE_INTERNAL, "Handling VideoUrl attribute");
xmlNode *current = xmlNewTextChild(root, NULL, (xmlChar*)"VideoUrl", NULL);
osxml_node_add(current, "Content", vformat_attribute_get_nth_value(attr, 0));
return current;
}
static xmlNode *handle_wants_html_attribute(xmlNode *root, VFormatAttribute *attr)
{
osync_trace(TRACE_INTERNAL, "Handling WantsHtml attribute");
xmlNode *current = xmlNewTextChild(root, NULL, (xmlChar*)"WantsHtml", NULL);
osxml_node_add(current, "Content", vformat_attribute_get_nth_value(attr, 0));
return current;
}
static xmlNode *handle_yahoo_attribute(xmlNode *root, VFormatAttribute *attr)
{
osync_trace(TRACE_INTERNAL, "Handling IM-Yahoo attribute");
xmlNode *current = xmlNewTextChild(root, NULL, (xmlChar*)"IM-Yahoo", NULL);
osxml_node_add(current, "Content", vformat_attribute_get_nth_value(attr, 0));
return current;
}
static xmlNode *handle_icq_attribute(xmlNode *root, VFormatAttribute *attr)
{
osync_trace(TRACE_INTERNAL, "Handling IM-ICQ attribute");
xmlNode *current = xmlNewTextChild(root, NULL, (xmlChar*)"IM-ICQ", NULL);
osxml_node_add(current, "Content", vformat_attribute_get_nth_value(attr, 0));
return current;
}
static xmlNode *handle_groupwise_attribute(xmlNode *root, VFormatAttribute *attr)
{
osync_trace(TRACE_INTERNAL, "Handling GroupwiseDirectory attribute");
xmlNode *current = xmlNewTextChild(root, NULL, (xmlChar*)"GroupwiseDirectory", NULL);
osxml_node_add(current, "Content", vformat_attribute_get_nth_value(attr, 0));
return current;
}
static xmlNode *handle_jabber_attribute(xmlNode *root, VFormatAttribute *attr)
{
osync_trace(TRACE_INTERNAL, "Handling Jabber attribute");
xmlNode *current = xmlNewTextChild(root, NULL, (xmlChar*)"IM-Jabber", NULL);
osxml_node_add(current, "Content", vformat_attribute_get_nth_value(attr, 0));
return current;
}
static xmlNode *handle_msn_attribute(xmlNode *root, VFormatAttribute *attr)
{
osync_trace(TRACE_INTERNAL, "Handling MSN attribute");
xmlNode *current = xmlNewTextChild(root, NULL, (xmlChar*)"IM-MSN", NULL);
osxml_node_add(current, "Content", vformat_attribute_get_nth_value(attr, 0));
return current;
}
//evo2s role is more like a profession so we map it there
static xmlNode *handle_role_attribute(xmlNode *root, VFormatAttribute *attr)
{
osync_trace(TRACE_INTERNAL, "Handling role attribute");
xmlNode *current = xmlNewTextChild(root, NULL, (xmlChar*)"Profession", NULL);
osxml_node_add(current, "Content", vformat_attribute_get_nth_value(attr, 0));
return current;
}
static void handle_slot_parameter(xmlNode *current, VFormatParam *param)
{
osync_trace(TRACE_INTERNAL, "Handling Slot parameter %s", vformat_attribute_param_get_name(param));
xmlNewTextChild(current, NULL, (xmlChar*)"Slot",
(xmlChar*)vformat_attribute_param_get_nth_value(param, 0));
}
static void handle_assistant_parameter(xmlNode *current, VFormatParam *param)
{
osync_trace(TRACE_INTERNAL, "Handling Assistant parameter %s", vformat_attribute_param_get_name(param));
xmlNewTextChild(current, NULL, (xmlChar*)"Type", (xmlChar*)"Assistant");
}
static void handle_callback_parameter(xmlNode *current, VFormatParam *param)
{
osync_trace(TRACE_INTERNAL, "Handling Callback parameter %s", vformat_attribute_param_get_name(param));
xmlNewTextChild(current, NULL, (xmlChar*)"Type", (xmlChar*)"Callback");
}
static void handle_company_parameter(xmlNode *current, VFormatParam *param)
{
osync_trace(TRACE_INTERNAL, "Handling Company parameter %s", vformat_attribute_param_get_name(param));
xmlNewTextChild(current, NULL, (xmlChar*)"Type", (xmlChar*)"Company");
}
static void handle_telex_parameter(xmlNode *current, VFormatParam *param)
{
osync_trace(TRACE_INTERNAL, "Handling Telex parameter %s", vformat_attribute_param_get_name(param));
xmlNewTextChild(current, NULL, (xmlChar*)"Type", (xmlChar*)"Telex");
}
static void handle_radio_parameter(xmlNode *current, VFormatParam *param)
{
osync_trace(TRACE_INTERNAL, "Handling Radio parameter %s", vformat_attribute_param_get_name(param));
xmlNewTextChild(current, NULL, (xmlChar*)"Type", (xmlChar*)"Radio");
}
static osync_bool init_x_evo_to_xml(void *input)
{
osync_trace(TRACE_ENTRY, "%s(%p)", __func__, input);
GHashTable *table = (GHashTable *)input;
g_hash_table_insert(table, "X-EVOLUTION-FILE-AS", handle_file_as_attribute);
g_hash_table_insert(table, "X-EVOLUTION-MANAGER", handle_manager_attribute);
g_hash_table_insert(table, "X-EVOLUTION-ASSISTANT", handle_assistant_attribute);
g_hash_table_insert(table, "X-EVOLUTION-ANNIVERSARY", handle_anniversary_attribute);
g_hash_table_insert(table, "X-EVOLUTION-SPOUSE", handle_spouse_attribute);
g_hash_table_insert(table, "X-EVOLUTION-BLOG-URL", handle_blog_attribute);
g_hash_table_insert(table, "CALURI", handle_calendar_url_attribute);
g_hash_table_insert(table, "FBURL", handle_free_busy_url_attribute);
g_hash_table_insert(table, "X-EVOLUTION-VIDEO-URL", handle_video_chat_attribute);
g_hash_table_insert(table, "X-MOZILLA-HTML", handle_wants_html_attribute);
g_hash_table_insert(table, "X-YAHOO", handle_yahoo_attribute);
g_hash_table_insert(table, "X-ICQ", handle_icq_attribute);
g_hash_table_insert(table, "X-GROUPWISE", handle_groupwise_attribute);
g_hash_table_insert(table, "X-AIM", handle_x_aim_attribute);
g_hash_table_insert(table, "X-JABBER", handle_jabber_attribute);
g_hash_table_insert(table, "X-MSN", handle_msn_attribute);
g_hash_table_insert(table, "X-EVOLUTION-UI-SLOT", handle_slot_parameter);
g_hash_table_insert(table, "TYPE=X-EVOLUTION-ASSISTANT", handle_assistant_parameter);
g_hash_table_insert(table, "TYPE=X-EVOLUTION-CALLBACK", handle_callback_parameter);
g_hash_table_insert(table, "TYPE=X-EVOLUTION-COMPANY", handle_company_parameter);
g_hash_table_insert(table, "TYPE=X-EVOLUTION-TELEX", handle_telex_parameter);
g_hash_table_insert(table, "TYPE=X-EVOLUTION-RADIO", handle_radio_parameter);
//Overwrite Role
g_hash_table_insert(table, "ROLE", handle_role_attribute);
osync_trace(TRACE_EXIT, "%s: TRUE", __func__);
return TRUE;
}
static osync_bool needs_encoding(const unsigned char *tmp, const char *encoding)
{
int i = 0;
if (!strcmp(encoding, "QUOTED-PRINTABLE")) {
while (tmp[i] != 0) {
if (tmp[i] > 127 || tmp[i] == 10 || tmp[i] == 13)
return TRUE;
i++;
}
} else {
return !g_utf8_validate((gchar*)tmp, -1, NULL);
}
return FALSE;
}
static osync_bool needs_charset(const unsigned char *tmp)
{
int i = 0;
while (tmp[i] != 0) {
if (tmp[i] > 127)
return TRUE;
i++;
}
return FALSE;
}
static void add_value(VFormatAttribute *attr, xmlNode *parent, const char *name, const char *encoding)
{
char *tmp = osxml_find_node(parent, name);
if (!tmp)
return;
if (needs_charset((unsigned char*)tmp))
if (!vformat_attribute_has_param (attr, "CHARSET"))
vformat_attribute_add_param_with_value(attr, "CHARSET", "UTF-8");
if (needs_encoding((unsigned char*)tmp, encoding)) {
if (!vformat_attribute_has_param (attr, "ENCODING"))
vformat_attribute_add_param_with_value(attr, "ENCODING", encoding);
vformat_attribute_add_value_decoded(attr, tmp, strlen(tmp) + 1);
} else
vformat_attribute_add_value(attr, tmp);
g_free(tmp);
}
static VFormatAttribute *handle_xml_file_as_attribute(VFormat *vcard, xmlNode *root, const char *encoding)
{
osync_trace(TRACE_INTERNAL, "Handling file_as xml attribute");
VFormatAttribute *attr = vformat_attribute_new(NULL, "X-EVOLUTION-FILE-AS");
add_value(attr, root, "Content", encoding);
vformat_add_attribute(vcard, attr);
return attr;
}
static VFormatAttribute *handle_xml_manager_attribute(VFormat *vcard, xmlNode *root, const char *encoding)
{
osync_trace(TRACE_INTERNAL, "Handling manager xml attribute");
VFormatAttribute *attr = vformat_attribute_new(NULL, "X-EVOLUTION-MANAGER");
add_value(attr, root, "Content", encoding);
vformat_add_attribute(vcard, attr);
return attr;
}
static VFormatAttribute *handle_xml_assistant_attribute(VFormat *vcard, xmlNode *root, const char *encoding)
{
osync_trace(TRACE_INTERNAL, "Handling assistant xml attribute");
VFormatAttribute *attr = vformat_attribute_new(NULL, "X-EVOLUTION-ASSISTANT");
add_value(attr, root, "Content", encoding);
vformat_add_attribute(vcard, attr);
return attr;
}
static VFormatAttribute *handle_xml_anniversary_attribute(VFormat *vcard, xmlNode *root, const char *encoding)
{
osync_trace(TRACE_INTERNAL, "Handling anniversary xml attribute");
VFormatAttribute *attr = vformat_attribute_new(NULL, "X-EVOLUTION-ANNIVERSARY");
add_value(attr, root, "Content", encoding);
vformat_add_attribute(vcard, attr);
return attr;
}
static VFormatAttribute *handle_xml_spouse_attribute(VFormat *vcard, xmlNode *root, const char *encoding)
{
osync_trace(TRACE_INTERNAL, "Handling spouse xml attribute");
VFormatAttribute *attr = vformat_attribute_new(NULL, "X-EVOLUTION-SPOUSE");
add_value(attr, root, "Content", encoding);
vformat_add_attribute(vcard, attr);
return attr;
}
static VFormatAttribute *handle_xml_blog_url_attribute(VFormat *vcard, xmlNode *root, const char *encoding)
{
osync_trace(TRACE_INTERNAL, "Handling blog_url xml attribute");
VFormatAttribute *attr = vformat_attribute_new(NULL, "X-EVOLUTION-BLOG-URL");
add_value(attr, root, "Content", encoding);
vformat_add_attribute(vcard, attr);
return attr;
}
static VFormatAttribute *handle_xml_calendar_url_attribute(VFormat *vcard, xmlNode *root, const char *encoding)
{
osync_trace(TRACE_INTERNAL, "Handling calendar_url xml attribute");
VFormatAttribute *attr = vformat_attribute_new(NULL, "CALURI");
add_value(attr, root, "Content", encoding);
vformat_add_attribute(vcard, attr);
return attr;
}
static VFormatAttribute *handle_xml_free_busy_url_attribute(VFormat *vcard, xmlNode *root, const char *encoding)
{
osync_trace(TRACE_INTERNAL, "Handling free_busy_url xml attribute");
VFormatAttribute *attr = vformat_attribute_new(NULL, "FBURL");
add_value(attr, root, "Content", encoding);
vformat_add_attribute(vcard, attr);
return attr;
}
static VFormatAttribute *handle_xml_video_url_attribute(VFormat *vcard, xmlNode *root, const char *encoding)
{
osync_trace(TRACE_INTERNAL, "Handling videourl xml attribute");
VFormatAttribute *attr = vformat_attribute_new(NULL, "X-EVOLUTION-VIDEO-URL");
add_value(attr, root, "Content", encoding);
vformat_add_attribute(vcard, attr);
return attr;
}
static VFormatAttribute *handle_xml_wants_html_attribute(VFormat *vcard, xmlNode *root, const char *encoding)
{
osync_trace(TRACE_INTERNAL, "Handling wants_html xml attribute");
VFormatAttribute *attr = vformat_attribute_new(NULL, "X-MOZILLA-HTML");
add_value(attr, root, "Content", encoding);
vformat_add_attribute(vcard, attr);
return attr;
}
static VFormatAttribute *handle_xml_yahoo_attribute(VFormat *vcard, xmlNode *root, const char *encoding)
{
osync_trace(TRACE_INTERNAL, "Handling yahoo xml attribute");
VFormatAttribute *attr = vformat_attribute_new(NULL, "X-YAHOO");
add_value(attr, root, "Content", encoding);
vformat_add_attribute(vcard, attr);
return attr;
}
static VFormatAttribute *handle_xml_icq_attribute(VFormat *vcard, xmlNode *root, const char *encoding)
{
osync_trace(TRACE_INTERNAL, "Handling icq xml attribute");
VFormatAttribute *attr = vformat_attribute_new(NULL, "X-ICQ");
add_value(attr, root, "Content", encoding);
vformat_add_attribute(vcard, attr);
return attr;
}
static VFormatAttribute *handle_xml_groupwise_attribute(VFormat *vcard, xmlNode *root, const char *encoding)
{
osync_trace(TRACE_INTERNAL, "Handling groupwise xml attribute");
VFormatAttribute *attr = vformat_attribute_new(NULL, "X-GROUPWISE");
add_value(attr, root, "Content", encoding);
vformat_add_attribute(vcard, attr);
return attr;
}
static VFormatAttribute *handle_xml_aim_attribute(VFormat *vcard, xmlNode *root, const char *encoding)
{
osync_trace(TRACE_INTERNAL, "Handling aim xml attribute");
VFormatAttribute *attr = vformat_attribute_new(NULL, "X-AIM");
add_value(attr, root, "Content", encoding);
vformat_add_attribute(vcard, attr);
return attr;
}
static VFormatAttribute *handle_xml_jabber_attribute(VFormat *vcard, xmlNode *root, const char *encoding)
{
osync_trace(TRACE_INTERNAL, "Handling jabber xml attribute");
VFormatAttribute *attr = vformat_attribute_new(NULL, "X-JABBER");
add_value(attr, root, "Content", encoding);
vformat_add_attribute(vcard, attr);
return attr;
}
static VFormatAttribute *handle_xml_msn_attribute(VFormat *vcard, xmlNode *root, const char *encoding)
{
osync_trace(TRACE_INTERNAL, "Handling msn xml attribute");
VFormatAttribute *attr = vformat_attribute_new(NULL, "X-MSN");
add_value(attr, root, "Content", encoding);
vformat_add_attribute(vcard, attr);
return attr;
}
//We map the profession to the ROLE
static VFormatAttribute *handle_xml_profession_attribute(VFormat *vcard, xmlNode *root, const char *encoding)
{
osync_trace(TRACE_INTERNAL, "Handling profession xml attribute");
VFormatAttribute *attr = vformat_attribute_new(NULL, "ROLE");
add_value(attr, root, "Content", encoding);
vformat_add_attribute(vcard, attr);
return attr;
}
static void handle_xml_slot_parameter(VFormatAttribute *attr, xmlNode *current)
{
osync_trace(TRACE_INTERNAL, "Handling slot xml parameter");
char *content = (char*)xmlNodeGetContent(current);
vformat_attribute_add_param_with_value(attr, "X-EVOLUTION-UI-SLOT", content);
g_free(content);
}
static void handle_xml_assistant_parameter(VFormatAttribute *attr, xmlNode *current)
{
osync_trace(TRACE_INTERNAL, "Handling assistant xml parameter");
vformat_attribute_add_param_with_value(attr, "TYPE", "X-EVOLUTION-ASSISTANT");
}
static void handle_xml_callback_parameter(VFormatAttribute *attr, xmlNode *current)
{
osync_trace(TRACE_INTERNAL, "Handling callback xml parameter");
vformat_attribute_add_param_with_value(attr, "TYPE", "X-EVOLUTION-CALLBACK");
}
static void handle_xml_company_parameter(VFormatAttribute *attr, xmlNode *current)
{
osync_trace(TRACE_INTERNAL, "Handling company xml parameter");
vformat_attribute_add_param_with_value(attr, "TYPE", "X-EVOLUTION-COMPANY");
}
static void handle_xml_telex_parameter(VFormatAttribute *attr, xmlNode *current)
{
osync_trace(TRACE_INTERNAL, "Handling telex xml parameter");
vformat_attribute_add_param_with_value(attr, "TYPE", "X-EVOLUTION-TELEX");
}
static void handle_xml_radio_parameter(VFormatAttribute *attr, xmlNode *current)
{
osync_trace(TRACE_INTERNAL, "Handling radio xml parameter");
vformat_attribute_add_param_with_value(attr, "TYPE", "X-EVOLUTION-RADIO");
}
static osync_bool init_xml_to_x_evo(void *input)
{
osync_trace(TRACE_ENTRY, "%s(%p)", __func__, input);
OSyncHookTables *hooks = (OSyncHookTables *)input;
g_hash_table_insert(hooks->attributes, "FileAs", handle_xml_file_as_attribute);
g_hash_table_insert(hooks->attributes, "Manager", handle_xml_manager_attribute);
g_hash_table_insert(hooks->attributes, "Assistant", handle_xml_assistant_attribute);
g_hash_table_insert(hooks->attributes, "Anniversary", handle_xml_anniversary_attribute);
g_hash_table_insert(hooks->attributes, "Spouse", handle_xml_spouse_attribute);
g_hash_table_insert(hooks->attributes, "BlogUrl", handle_xml_blog_url_attribute);
g_hash_table_insert(hooks->attributes, "CalendarUrl", handle_xml_calendar_url_attribute);
g_hash_table_insert(hooks->attributes, "FreeBusyUrl", handle_xml_free_busy_url_attribute);
g_hash_table_insert(hooks->attributes, "VideoUrl", handle_xml_video_url_attribute);
g_hash_table_insert(hooks->attributes, "WantsHtml", handle_xml_wants_html_attribute);
g_hash_table_insert(hooks->attributes, "IM-Yahoo", handle_xml_yahoo_attribute);
g_hash_table_insert(hooks->attributes, "IM-ICQ", handle_xml_icq_attribute);
g_hash_table_insert(hooks->attributes, "GroupwiseDirectory", handle_xml_groupwise_attribute);
g_hash_table_insert(hooks->attributes, "IM-AIM", handle_xml_aim_attribute);
g_hash_table_insert(hooks->attributes, "IM-Jabber", handle_xml_jabber_attribute);
g_hash_table_insert(hooks->attributes, "IM-MSN", handle_xml_msn_attribute);
//Overwrite Profession handler
g_hash_table_insert(hooks->attributes, "Profession", handle_xml_profession_attribute);
g_hash_table_insert(hooks->parameters, "Slot", handle_xml_slot_parameter);
g_hash_table_insert(hooks->parameters, "Type=Assistant", handle_xml_assistant_parameter);
g_hash_table_insert(hooks->parameters, "Type=Callback", handle_xml_callback_parameter);
g_hash_table_insert(hooks->parameters, "Type=Company", handle_xml_company_parameter);
g_hash_table_insert(hooks->parameters, "Type=Telex", handle_xml_telex_parameter);
g_hash_table_insert(hooks->parameters, "Type=Radio", handle_xml_radio_parameter);
osync_trace(TRACE_EXIT, "%s: TRUE", __func__);
return TRUE;
}
void get_info(OSyncEnv *env)
{
osync_env_register_objtype(env, "contact");
osync_env_register_objformat(env, "contact", "xml-contact");
osync_env_register_extension(env, "vcard21", "xml-contact", "evolution", init_x_evo_to_xml);
osync_env_register_extension(env, "xml-contact", "vcard21", "evolution", init_xml_to_x_evo);
osync_env_register_extension(env, "vcard30", "xml-contact", "evolution", init_x_evo_to_xml);
osync_env_register_extension(env, "xml-contact", "vcard30", "evolution", init_xml_to_x_evo);
}
|