Sun, 14 Aug 2011 21:30:08 +0200
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
64
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 | local t_insert, t_concat = table.insert, table.concat; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 | |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 | local vCard_dtd = { |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 | VERSION = "ignore", --MUST be 3.0, so parsing is redundant |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 | FN = "text", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 | N = { |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 | values = { |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 | "FAMILY", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 | "GIVEN", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 | "MIDDLE", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 | "PREFIX", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 | "SUFFIX", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 | }, |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 | }, |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 | NICKNAME = "text", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 | PHOTO = { |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 | props_verbatim = { ENCODING = { "b" } }, |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
18 | props = { "TYPE" }, |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
19 | value = "BINVAL", --{ "EXTVAL", }, |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
20 | }, |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
21 | BDAY = "text", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
22 | ADR = { |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
23 | types = { |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
24 | "HOME", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
25 | "WORK", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
26 | "POSTAL", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
27 | "PARCEL", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
28 | "DOM", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
29 | "INTL", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
30 | "PREF", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
31 | }, |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
32 | values = { |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
33 | "POBOX", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
34 | "EXTADD", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
35 | "STREET", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
36 | "LOCALITY", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
37 | "REGION", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
38 | "PCODE", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
39 | "CTRY", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
40 | } |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
41 | }, |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
42 | LABEL = { |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
43 | types = { |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
44 | "HOME", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
45 | "WORK", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
46 | "POSTAL", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
47 | "PARCEL", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
48 | "DOM", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
49 | "INTL", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
50 | "PREF", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
51 | }, |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
52 | value = "LINE", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
53 | }, |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
54 | TEL = { |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
55 | types = { |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
56 | "HOME", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
57 | "WORK", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
58 | "VOICE", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
59 | "FAX", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
60 | "PAGER", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
61 | "MSG", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
62 | "CELL", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
63 | "VIDEO", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
64 | "BBS", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
65 | "MODEM", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
66 | "ISDN", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
67 | "PCS", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
68 | "PREF", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
69 | }, |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
70 | value = "NUMBER", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
71 | }, |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
72 | EMAIL = { |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
73 | types = { |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
74 | "HOME", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
75 | "WORK", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
76 | "INTERNET", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
77 | "PREF", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
78 | "X400", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
79 | }, |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
80 | value = "USERID", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
81 | }, |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
82 | JABBERID = "text", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
83 | MAILER = "text", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
84 | TZ = "text", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
85 | GEO = { |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
86 | values = { |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
87 | "LAT", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
88 | "LON", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
89 | }, |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
90 | }, |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
91 | TITLE = "text", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
92 | ROLE = "text", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
93 | LOGO = "copy of PHOTO", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
94 | AGENT = "text", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
95 | ORG = { |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
96 | values = { |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
97 | behaviour = "repeat-last", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
98 | "ORGNAME", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
99 | "ORGUNIT", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
100 | } |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
101 | }, |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
102 | CATEGORIES = { |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
103 | values = "KEYWORD", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
104 | }, |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
105 | NOTE = "text", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
106 | PRODID = "text", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
107 | REV = "text", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
108 | SORTSTRING = "text", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
109 | SOUND = "copy of PHOTO", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
110 | UID = "text", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
111 | URL = "text", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
112 | CLASS = { |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
113 | names = { -- The item.name is the value if it's one of these. |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
114 | "PUBLIC", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
115 | "PRIVATE", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
116 | "CONFIDENTIAL", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
117 | }, |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
118 | }, |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
119 | KEY = { |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
120 | props = { "TYPE" }, |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
121 | value = "CRED", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
122 | }, |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
123 | DESC = "text", |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
124 | }; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
125 | vCard_dtd.LOGO = vCard_dtd.PHOTO; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
126 | vCard_dtd.SOUND = vCard_dtd.PHOTO; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
127 | |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
128 | --TODO BINVAL OR EXTVAL |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
129 | |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
130 | local function vCard_esc(s) |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
131 | return s:gsub("[,;\\]", "\\%1"):gsub("\n","\\n"); |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
132 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
133 | |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
134 | local function vCard_prop(item) |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
135 | local prop_name = item.name; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
136 | local prop_def = vCard_dtd[prop_name]; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
137 | if not prop_def then return nil end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
138 | |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
139 | local value, params = "", {}; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
140 | |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
141 | if prop_def == "text" then |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
142 | value = item:get_text(); |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
143 | elseif type(prop_def) == "table" then |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
144 | if prop_def.value then --single item |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
145 | value = item:get_child_text(prop_def.value) or ""; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
146 | elseif prop_def.values then --array |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
147 | local value_names = prop_def.values; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
148 | value = {}; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
149 | for i=1,#value_names do |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
150 | t_insert(value, item:get_child_text(value_names[i]) or ""); |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
151 | --TODO ORG with >1 sub items |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
152 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
153 | elseif prop_def.names then |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
154 | local names = prop_def.names; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
155 | for i=1,#names do |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
156 | if item:get_child(names[i]) then |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
157 | value = names[i]; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
158 | break; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
159 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
160 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
161 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
162 | |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
163 | if prop_def.props_verbatim then |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
164 | for k,v in pairs(prop_def.props_verbatim) do |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
165 | params[k] = v; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
166 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
167 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
168 | |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
169 | if prop_def.types then |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
170 | local types = prop_def.types; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
171 | params.TYPE = {}; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
172 | for i=1,#types do |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
173 | if item:get_child(types[i]) then |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
174 | t_insert(params.TYPE, types[i]:lower()); |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
175 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
176 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
177 | if #params.TYPE == 0 then |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
178 | params.TYPE = nil; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
179 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
180 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
181 | |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
182 | if prop_def.props then |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
183 | local props = prop_def.props; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
184 | for i=1,#props do |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
185 | local prop = props[i] |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
186 | local p = item:get_child_text(prop); |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
187 | if p then |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
188 | params[prop] = params[prop] or {}; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
189 | t_insert(params[prop], p); |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
190 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
191 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
192 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
193 | else |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
194 | return nil |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
195 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
196 | |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
197 | if type(value) == "table" then |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
198 | for i=1,#value do |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
199 | value[i]=vCard_esc(value[i]); |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
200 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
201 | value = t_concat(value, ";"); |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
202 | else |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
203 | value = vCard_esc(value); |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
204 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
205 | |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
206 | if next(params) then |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
207 | local sparams = ""; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
208 | for k,v in pairs(params) do |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
209 | sparams = sparams .. (";%s=%s"):format(k, t_concat(v,",")); |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
210 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
211 | params = sparams; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
212 | else |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
213 | params = ""; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
214 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
215 | |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
216 | --TODO: Split long lines |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
217 | return ("%s%s:%s"):format(item.name, params, value); |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
218 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
219 | |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
220 | return function (opts, arg) |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
221 | if opts.short_help then |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
222 | print("Fetch someones vCard"); |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
223 | return; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
224 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
225 | if (#arg == 0 or opts.help) then |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
226 | return 0; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
227 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
228 | local function on_connect(conn) |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
229 | conn:add_plugin("vcard"); |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
230 | conn:get_vcard(arg[1], function(reply) |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
231 | local vCard = reply:get_child("vCard", "vcard-temp"); |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
232 | if vCard then |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
233 | print("BEGIN:VCARD"); |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
234 | print("VERSION:3.0"); |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
235 | for i = 1,#vCard do |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
236 | local item = vCard[i]; |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
237 | if item.name then |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
238 | local s = vCard_prop(item); |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
239 | if s then print(s); end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
240 | else |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
241 | conn:debug("Unhandled vCard field: %s", item.name); |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
242 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
243 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
244 | print("END:VCARD"); |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
245 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
246 | verse.quit(); |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
247 | end); |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
248 | end |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
249 | clix_connect(opts, on_connect); |
582afbb2b23d
clix.vcard, squishy: Add plugin that fetches and converts peoples vCards to the text format.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
250 | end |