rev |
line source |
meillo@0
|
1 /* MasqMail
|
meillo@0
|
2 Copyright (C) 1999-2001 Oliver Kurth
|
meillo@271
|
3 Copyright (C) 2010 markus schnalke <meillo@marmaro.de>
|
meillo@0
|
4
|
meillo@0
|
5 This program is free software; you can redistribute it and/or modify
|
meillo@0
|
6 it under the terms of the GNU General Public License as published by
|
meillo@0
|
7 the Free Software Foundation; either version 2 of the License, or
|
meillo@0
|
8 (at your option) any later version.
|
meillo@0
|
9
|
meillo@0
|
10 This program is distributed in the hope that it will be useful,
|
meillo@0
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
meillo@0
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
meillo@0
|
13 GNU General Public License for more details.
|
meillo@0
|
14
|
meillo@0
|
15 You should have received a copy of the GNU General Public License
|
meillo@0
|
16 along with this program; if not, write to the Free Software
|
meillo@0
|
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
meillo@0
|
18 */
|
meillo@0
|
19
|
meillo@0
|
20 #ifndef PARSE_TEST
|
meillo@0
|
21 #include "masqmail.h"
|
meillo@0
|
22 #endif
|
meillo@0
|
23
|
meillo@0
|
24 /* This is really dangerous. I hope that I was careful enough,
|
meillo@0
|
25 but maybe there is some malformed address possible that causes
|
meillo@0
|
26 this to segfault or be caught in endless loops.
|
meillo@0
|
27
|
meillo@0
|
28 If you find something like that, PLEASE mail the string to me
|
meillo@0
|
29 (no matter how idiotic it is), so that I can debug that.
|
meillo@0
|
30 Those things really should not happen.
|
meillo@0
|
31 */
|
meillo@0
|
32
|
meillo@0
|
33 static gchar *specials = "()<>@,;:\\\".[]`";
|
meillo@0
|
34
|
meillo@0
|
35 char *parse_error = NULL;
|
meillo@0
|
36
|
meillo@10
|
37 static gchar*
|
meillo@10
|
38 skip_comment(gchar * p)
|
meillo@0
|
39 {
|
meillo@0
|
40
|
meillo@0
|
41 #ifdef PARSE_TEST
|
meillo@10
|
42 g_print("skip_comment: %s\n", p);
|
meillo@0
|
43 #endif
|
meillo@0
|
44
|
meillo@10
|
45 p++;
|
meillo@10
|
46 while (*p && *p != ')') {
|
meillo@10
|
47 p++;
|
meillo@271
|
48 if (*p == '(') {
|
meillo@10
|
49 p = skip_comment(p);
|
meillo@271
|
50 }
|
meillo@10
|
51 }
|
meillo@10
|
52 p++;
|
meillo@0
|
53
|
meillo@10
|
54 return p;
|
meillo@0
|
55 }
|
meillo@0
|
56
|
meillo@10
|
57 static gboolean
|
meillo@10
|
58 read_word(gchar * p, gchar ** b, gchar ** e)
|
meillo@0
|
59 {
|
meillo@0
|
60 #ifdef PARSE_TEST
|
meillo@10
|
61 g_print("read_word: %s\n", p);
|
meillo@0
|
62 #endif
|
meillo@10
|
63 /* eat leading spaces */
|
meillo@271
|
64 while (*p && isspace(*p)) {
|
meillo@10
|
65 p++;
|
meillo@271
|
66 }
|
meillo@10
|
67
|
meillo@10
|
68 *b = p;
|
meillo@10
|
69 /* b = &p; */
|
meillo@10
|
70 if (*p == '\"') {
|
meillo@10
|
71 /* quoted-string */
|
meillo@10
|
72 p++;
|
meillo@271
|
73 while (*p && (*p != '\"')) {
|
meillo@10
|
74 p++;
|
meillo@271
|
75 }
|
meillo@10
|
76 p++;
|
meillo@10
|
77 } else {
|
meillo@10
|
78 /* atom */
|
meillo@271
|
79 while (*p && !strchr(specials, *p) && !iscntrl(*p) && !isspace(*p)) {
|
meillo@10
|
80 p++;
|
meillo@271
|
81 }
|
meillo@10
|
82 }
|
meillo@10
|
83 *e = p;
|
meillo@10
|
84 return TRUE;
|
meillo@0
|
85 }
|
meillo@0
|
86
|
meillo@10
|
87 static gboolean
|
meillo@10
|
88 read_word_with_dots(gchar * p, gchar ** b, gchar ** e)
|
meillo@0
|
89 {
|
meillo@10
|
90 gchar *b0 = p;
|
meillo@0
|
91
|
meillo@0
|
92 #ifdef PARSE_TEST
|
meillo@10
|
93 g_print("read_word_with_dots: %s\n", p);
|
meillo@0
|
94 #endif
|
meillo@10
|
95 while (TRUE) {
|
meillo@271
|
96 if (!read_word(p, b, e)) {
|
meillo@10
|
97 return FALSE;
|
meillo@271
|
98 }
|
meillo@10
|
99 p = *e;
|
meillo@271
|
100 if (*p != '.') {
|
meillo@10
|
101 break;
|
meillo@271
|
102 }
|
meillo@10
|
103 p++;
|
meillo@10
|
104 }
|
meillo@10
|
105 *b = b0;
|
meillo@10
|
106 *e = p;
|
meillo@10
|
107 return TRUE;
|
meillo@0
|
108 }
|
meillo@0
|
109
|
meillo@10
|
110 static gboolean
|
meillo@10
|
111 read_domain(gchar * p, gchar ** b, gchar ** e)
|
meillo@0
|
112 {
|
meillo@0
|
113 #ifdef PARSE_TEST
|
meillo@10
|
114 g_print("read_domain: %s\n", p);
|
meillo@0
|
115 #endif
|
meillo@10
|
116 *b = p;
|
meillo@10
|
117 if (*p != '[') {
|
meillo@271
|
118 while (isalnum(*p) || (*p == '-') || (*p == '.')) {
|
meillo@10
|
119 p++;
|
meillo@271
|
120 }
|
meillo@10
|
121 } else {
|
meillo@10
|
122 p++;
|
meillo@271
|
123 while (isalpha(*p) || (*p == '.')) {
|
meillo@10
|
124 p++;
|
meillo@271
|
125 }
|
meillo@10
|
126 if (*p != ']') {
|
meillo@10
|
127 parse_error = g_strdup_printf("']' expected at end of literal address %s", *b);
|
meillo@10
|
128 return FALSE;
|
meillo@10
|
129 }
|
meillo@10
|
130 p++;
|
meillo@10
|
131 }
|
meillo@10
|
132 *e = p;
|
meillo@10
|
133 return TRUE;
|
meillo@0
|
134 }
|
meillo@0
|
135
|
meillo@10
|
136 gboolean
|
meillo@15
|
137 parse_address_rfc822(gchar* string, gchar** local_begin, gchar** local_end, gchar** domain_begin,
|
meillo@15
|
138 gchar** domain_end, gchar** address_end)
|
meillo@0
|
139 {
|
meillo@10
|
140 gint angle_brackets = 0;
|
meillo@0
|
141
|
meillo@10
|
142 gchar *p = string;
|
meillo@10
|
143 gchar *b, *e;
|
meillo@0
|
144
|
meillo@10
|
145 *local_begin = *local_end = NULL;
|
meillo@10
|
146 *domain_begin = *domain_end = NULL;
|
meillo@0
|
147
|
meillo@10
|
148 /* might be some memory left from previous call: */
|
meillo@273
|
149 if (parse_error) {
|
meillo@10
|
150 g_free(parse_error);
|
meillo@10
|
151 parse_error = NULL;
|
meillo@10
|
152 }
|
meillo@0
|
153
|
meillo@10
|
154 /* leading spaces and angle brackets */
|
meillo@10
|
155 while (*p && (isspace(*p) || (*p == '<'))) {
|
meillo@271
|
156 if (*p == '<') {
|
meillo@10
|
157 angle_brackets++;
|
meillo@271
|
158 }
|
meillo@10
|
159 p++;
|
meillo@10
|
160 }
|
meillo@10
|
161
|
meillo@271
|
162 if (!*p) {
|
meillo@271
|
163 return FALSE;
|
meillo@271
|
164 }
|
meillo@271
|
165
|
meillo@271
|
166 while (TRUE) {
|
meillo@271
|
167 if (!read_word_with_dots(p, &b, &e)) {
|
meillo@271
|
168 return FALSE;
|
meillo@271
|
169 }
|
meillo@271
|
170
|
meillo@271
|
171 p = e;
|
meillo@0
|
172 #ifdef PARSE_TEST
|
meillo@271
|
173 g_print("after read_word_with_dots: %s\n", p);
|
meillo@0
|
174 #endif
|
meillo@271
|
175 /* eat white spaces and comments */
|
meillo@271
|
176 while ((*p && (isspace(*p))) || (*p == '(')) {
|
meillo@271
|
177 if (*p == '(') {
|
meillo@271
|
178 if (!(p = skip_comment(p))) {
|
meillo@271
|
179 parse_error = g_strdup("missing right bracket ')'");
|
meillo@10
|
180 return FALSE;
|
meillo@10
|
181 }
|
meillo@271
|
182 } else {
|
meillo@271
|
183 p++;
|
meillo@271
|
184 }
|
meillo@271
|
185 }
|
meillo@271
|
186 /* we now have a non-space char that is not
|
meillo@271
|
187 the beginning of a comment */
|
meillo@271
|
188
|
meillo@271
|
189 if (*p == '@') {
|
meillo@271
|
190 /* the last word was the local_part of an addr-spec */
|
meillo@271
|
191 *local_begin = b;
|
meillo@271
|
192 *local_end = e;
|
meillo@271
|
193 #ifdef PARSE_TEST
|
meillo@271
|
194 g_print("found local part: %s\n", *local_begin);
|
meillo@271
|
195 #endif
|
meillo@271
|
196 if (*p == '@') {
|
meillo@271
|
197 p++; /* skip @ */
|
meillo@271
|
198 /* now the domain */
|
meillo@271
|
199 if (!read_domain(p, &b, &e)) {
|
meillo@271
|
200 return FALSE;
|
meillo@271
|
201 }
|
meillo@271
|
202 p = e;
|
meillo@271
|
203 *domain_begin = b;
|
meillo@271
|
204 *domain_end = e;
|
meillo@271
|
205 } else {
|
meillo@271
|
206 /* unqualified? */
|
meillo@271
|
207 *domain_begin = *domain_end = NULL;
|
meillo@271
|
208 }
|
meillo@271
|
209 break;
|
meillo@271
|
210
|
meillo@271
|
211 } else if (*p == '<') {
|
meillo@271
|
212 /* addr-spec follows */
|
meillo@271
|
213 while (isspace(*p) || (*p == '<')) {
|
meillo@271
|
214 if (*p == '<') {
|
meillo@271
|
215 angle_brackets++;
|
meillo@271
|
216 }
|
meillo@271
|
217 p++;
|
meillo@271
|
218 }
|
meillo@271
|
219 if (!read_word_with_dots(p, &b, &e)) {
|
meillo@10
|
220 return FALSE;
|
meillo@271
|
221 }
|
meillo@271
|
222 p = e;
|
meillo@271
|
223 *local_begin = b;
|
meillo@271
|
224 *local_end = e;
|
meillo@271
|
225 #ifdef PARSE_TEST
|
meillo@271
|
226 g_print("found local part: %s\n", *local_begin);
|
meillo@271
|
227 #endif
|
meillo@271
|
228 if (*p == '@') {
|
meillo@271
|
229 p++;
|
meillo@271
|
230 if (!read_domain(p, &b, &e)) {
|
meillo@271
|
231 return FALSE;
|
meillo@271
|
232 }
|
meillo@271
|
233 p = e;
|
meillo@271
|
234 *domain_begin = b;
|
meillo@271
|
235 *domain_end = e;
|
meillo@271
|
236 } else {
|
meillo@271
|
237 /* may be unqualified address */
|
meillo@271
|
238 *domain_begin = *domain_end = NULL;
|
meillo@271
|
239 }
|
meillo@271
|
240 break;
|
meillo@271
|
241
|
meillo@271
|
242 } else if (!*p || *p == '>') {
|
meillo@271
|
243 *local_begin = b;
|
meillo@271
|
244 *local_end = e;
|
meillo@271
|
245 #ifdef PARSE_TEST
|
meillo@271
|
246 g_print("found local part: %s\n", *local_begin);
|
meillo@271
|
247 #endif
|
meillo@271
|
248 *domain_begin = *domain_end = NULL;
|
meillo@271
|
249 break;
|
meillo@271
|
250
|
meillo@271
|
251 } else if (strchr(specials, *p) || iscntrl(*p) || isspace(*p)) {
|
meillo@271
|
252 parse_error = g_strdup_printf("unexpected character: %c", *p);
|
meillo@273
|
253 #ifdef PARSE_TEST
|
meillo@273
|
254 g_print("unexpected character: %c", *p);
|
meillo@273
|
255 #endif
|
meillo@271
|
256 return FALSE;
|
meillo@10
|
257 }
|
meillo@271
|
258 }
|
meillo@271
|
259
|
meillo@271
|
260 /* trailing spaces and angle brackets */
|
meillo@10
|
261 #ifdef PARSE_TEST
|
meillo@271
|
262 g_print("down counting trailing '>'\n");
|
meillo@10
|
263 #endif
|
meillo@271
|
264 while (*p && (isspace(*p) || (*p == '>'))) {
|
meillo@271
|
265 if (*p == '>') {
|
meillo@271
|
266 angle_brackets--;
|
meillo@10
|
267 }
|
meillo@271
|
268 p++;
|
meillo@271
|
269 }
|
meillo@10
|
270
|
meillo@271
|
271 *address_end = p;
|
meillo@10
|
272
|
meillo@271
|
273 if (angle_brackets > 0) {
|
meillo@271
|
274 parse_error = g_strdup("missing '>' at end of string");
|
meillo@271
|
275 return FALSE;
|
meillo@271
|
276 } else if (angle_brackets < 0) {
|
meillo@271
|
277 parse_error = g_strdup("superfluous '>' at end of string");
|
meillo@271
|
278 return FALSE;
|
meillo@0
|
279 }
|
meillo@271
|
280
|
meillo@271
|
281 /* we successfully parsed the address */
|
meillo@271
|
282 return TRUE;
|
meillo@0
|
283 }
|
meillo@0
|
284
|
meillo@10
|
285 gboolean
|
meillo@15
|
286 parse_address_rfc821(gchar* string, gchar** local_begin, gchar** local_end, gchar** domain_begin,
|
meillo@15
|
287 gchar** domain_end, gchar** address_end)
|
meillo@0
|
288 {
|
meillo@10
|
289 gint angle_brackets = 0;
|
meillo@0
|
290
|
meillo@10
|
291 gchar *p = string;
|
meillo@10
|
292 gchar *b, *e;
|
meillo@0
|
293
|
meillo@10
|
294 *local_begin = *local_end = NULL;
|
meillo@10
|
295 *domain_begin = *domain_end = NULL;
|
meillo@0
|
296
|
meillo@10
|
297 /* might be some memory left from previous call: */
|
meillo@10
|
298 if (parse_error != NULL) {
|
meillo@10
|
299 g_free(parse_error);
|
meillo@10
|
300 parse_error = NULL;
|
meillo@10
|
301 }
|
meillo@0
|
302
|
meillo@10
|
303 /* leading spaces and angle brackets */
|
meillo@10
|
304 while (*p && (isspace(*p) || (*p == '<'))) {
|
meillo@271
|
305 if (*p == '<') {
|
meillo@10
|
306 angle_brackets++;
|
meillo@271
|
307 }
|
meillo@10
|
308 p++;
|
meillo@10
|
309 }
|
meillo@10
|
310
|
meillo@271
|
311 if (!*p) {
|
meillo@271
|
312 return FALSE;
|
meillo@271
|
313 }
|
meillo@271
|
314
|
meillo@271
|
315 while (TRUE) {
|
meillo@271
|
316 if (!read_word_with_dots(p, &b, &e)) {
|
meillo@271
|
317 return FALSE;
|
meillo@10
|
318 }
|
meillo@10
|
319
|
meillo@271
|
320 p = e;
|
meillo@10
|
321 #ifdef PARSE_TEST
|
meillo@271
|
322 g_print("after read_word_with_dots: %s\n", p);
|
meillo@10
|
323 #endif
|
meillo@271
|
324 *local_begin = b;
|
meillo@271
|
325 *local_end = e;
|
meillo@271
|
326 #ifdef PARSE_TEST
|
meillo@271
|
327 g_print("found local part: %s\n", *local_begin);
|
meillo@271
|
328 g_print("local_end = %s\n", *local_end);
|
meillo@271
|
329 #endif
|
meillo@271
|
330 if (!(*p) || isspace(*p) || (*p == '>')) {
|
meillo@271
|
331 /* unqualified ? */
|
meillo@271
|
332 domain_begin = domain_end = NULL;
|
meillo@271
|
333 break;
|
meillo@271
|
334 } else if (*p == '@') {
|
meillo@10
|
335 p++;
|
meillo@271
|
336 if (read_domain(p, &b, &e)) {
|
meillo@271
|
337 p = e;
|
meillo@271
|
338 *domain_begin = b;
|
meillo@271
|
339 *domain_end = e;
|
meillo@271
|
340 }
|
meillo@271
|
341 break;
|
meillo@271
|
342 } else {
|
meillo@271
|
343 parse_error = g_strdup_printf ("unexpected character after local part '%c'", *p);
|
meillo@271
|
344 return FALSE;
|
meillo@10
|
345 }
|
meillo@271
|
346 }
|
meillo@10
|
347
|
meillo@271
|
348 /* trailing spaces and angle brackets */
|
meillo@271
|
349 #ifdef PARSE_TEST
|
meillo@271
|
350 g_print("down counting trailing '>'\n");
|
meillo@271
|
351 #endif
|
meillo@271
|
352 while (*p && (isspace(*p) || (*p == '>'))) {
|
meillo@271
|
353 if (*p == '>') {
|
meillo@271
|
354 angle_brackets--;
|
meillo@10
|
355 }
|
meillo@271
|
356 p++;
|
meillo@0
|
357 }
|
meillo@271
|
358 *address_end = p;
|
meillo@271
|
359
|
meillo@271
|
360 if (angle_brackets > 0) {
|
meillo@271
|
361 parse_error = g_strdup("missing '>' at end of string");
|
meillo@271
|
362 return FALSE;
|
meillo@271
|
363 } else if (angle_brackets < 0) {
|
meillo@271
|
364 parse_error = g_strdup("superfluous '>' at end of string");
|
meillo@271
|
365 return FALSE;
|
meillo@271
|
366 }
|
meillo@271
|
367
|
meillo@271
|
368 /* we successfully parsed the address */
|
meillo@271
|
369 return TRUE;
|
meillo@0
|
370 }
|
meillo@0
|
371
|
meillo@0
|
372 /*
|
meillo@0
|
373 allocate address, reading from string.
|
meillo@0
|
374 On failure, returns NULL.
|
meillo@114
|
375 after call, end contains a pointer to the end of the parsed string
|
meillo@0
|
376 end may be NULL, if we are not interested.
|
meillo@0
|
377
|
meillo@0
|
378 parses both rfc 821 and rfc 822 addresses, depending on flag is_rfc821
|
meillo@0
|
379 */
|
meillo@10
|
380 address*
|
meillo@10
|
381 _create_address(gchar * string, gchar ** end, gboolean is_rfc821)
|
meillo@0
|
382 {
|
meillo@10
|
383 gchar *loc_beg, *loc_end;
|
meillo@10
|
384 gchar *dom_beg, *dom_end;
|
meillo@10
|
385 gchar *addr_end;
|
meillo@271
|
386 gboolean ret;
|
meillo@0
|
387
|
meillo@273
|
388 /* TODO: what about (string == NULL)? */
|
meillo@271
|
389 if (string && (string[0] == '\0')) {
|
meillo@10
|
390 address *addr = g_malloc(sizeof(address));
|
meillo@10
|
391 addr->address = g_strdup("");
|
meillo@10
|
392 addr->local_part = g_strdup("");
|
meillo@271
|
393 /* 'NULL' address (failure notice),
|
meillo@271
|
394 "" makes sure it will not be qualified with a hostname */
|
meillo@271
|
395 addr->domain = g_strdup("");
|
meillo@10
|
396 return addr;
|
meillo@10
|
397 }
|
meillo@0
|
398
|
meillo@271
|
399 if (is_rfc821) {
|
meillo@271
|
400 ret = parse_address_rfc821(string, &loc_beg, &loc_end, &dom_beg, &dom_end, &addr_end);
|
meillo@271
|
401 } else {
|
meillo@271
|
402 ret = parse_address_rfc822(string, &loc_beg, &loc_end, &dom_beg, &dom_end, &addr_end);
|
meillo@271
|
403 }
|
meillo@271
|
404 if (!ret) {
|
meillo@271
|
405 return NULL;
|
meillo@271
|
406 }
|
meillo@0
|
407
|
meillo@271
|
408 address *addr = g_malloc(sizeof(address));
|
meillo@271
|
409 gchar *p = addr_end;
|
meillo@0
|
410
|
meillo@271
|
411 memset(addr, 0, sizeof(address));
|
meillo@0
|
412
|
meillo@271
|
413 if (loc_beg[0] == '|') {
|
meillo@271
|
414 parse_error = g_strdup("no pipe allowed for RFC 822/821 address");
|
meillo@271
|
415 return NULL;
|
meillo@271
|
416 }
|
meillo@10
|
417
|
meillo@271
|
418 while (*p && (*p != ',')) {
|
meillo@271
|
419 p++;
|
meillo@271
|
420 }
|
meillo@271
|
421 addr->address = g_strndup(string, p - string);
|
meillo@271
|
422 addr->local_part = g_strndup(loc_beg, loc_end - loc_beg);
|
meillo@0
|
423
|
meillo@0
|
424 #ifdef PARSE_TEST
|
meillo@271
|
425 g_print("addr->local_part = %s\n", addr->local_part);
|
meillo@0
|
426 #endif
|
meillo@0
|
427
|
meillo@271
|
428 if (dom_beg != NULL) {
|
meillo@271
|
429 addr->domain = g_strndup(dom_beg, dom_end - dom_beg);
|
meillo@273
|
430 } else if (addr->local_part[0] == '\0') {
|
meillo@271
|
431 /* 'NULL' address (failure notice),
|
meillo@271
|
432 "" makes sure it will not be qualified with a hostname */
|
meillo@271
|
433 addr->domain = g_strdup("");
|
meillo@271
|
434 } else {
|
meillo@271
|
435 addr->domain = NULL;
|
meillo@271
|
436 }
|
meillo@0
|
437
|
meillo@273
|
438 if (end) {
|
meillo@271
|
439 *end = p;
|
meillo@271
|
440 }
|
meillo@0
|
441
|
meillo@0
|
442 #ifndef PARSE_TEST
|
meillo@271
|
443 addr_unmark_delivered(addr);
|
meillo@0
|
444 #endif
|
meillo@0
|
445
|
meillo@271
|
446 return addr;
|
meillo@0
|
447 }
|
meillo@0
|
448
|
meillo@10
|
449 address*
|
meillo@10
|
450 create_address_rfc822(gchar * string, gchar ** end)
|
meillo@10
|
451 {
|
meillo@10
|
452 return _create_address(string, end, FALSE);
|
meillo@0
|
453 }
|
meillo@0
|
454
|
meillo@10
|
455 address*
|
meillo@10
|
456 create_address_rfc821(gchar * string, gchar ** end)
|
meillo@10
|
457 {
|
meillo@10
|
458 return _create_address(string, end, TRUE);
|
meillo@0
|
459 }
|
meillo@0
|
460
|
meillo@10
|
461 GList*
|
meillo@10
|
462 addr_list_append_rfc822(GList * addr_list, gchar * string, gchar * domain)
|
meillo@0
|
463 {
|
meillo@10
|
464 gchar *p = string;
|
meillo@10
|
465 gchar *end;
|
meillo@0
|
466
|
meillo@10
|
467 while (*p) {
|
meillo@273
|
468 #ifdef PARSE_TEST
|
meillo@273
|
469 g_print("string: %s\n", p);
|
meillo@273
|
470 #endif
|
meillo@273
|
471
|
meillo@10
|
472 address *addr = _create_address(p, &end, FALSE);
|
meillo@271
|
473 if (!addr) {
|
meillo@10
|
474 break;
|
meillo@271
|
475 }
|
meillo@271
|
476
|
meillo@273
|
477 #ifdef PARSE_TEST
|
meillo@273
|
478 g_print("addr: %s (%s<@>%s)", addr->address, addr->local_part, addr->domain);
|
meillo@273
|
479 #endif
|
meillo@271
|
480 if (domain && !addr->domain) {
|
meillo@271
|
481 addr->domain = g_strdup(domain);
|
meillo@271
|
482 }
|
meillo@273
|
483 #ifdef PARSE_TEST
|
meillo@273
|
484 g_print(" (%s<@>%s)\n", addr->local_part, addr->domain);
|
meillo@273
|
485 #endif
|
meillo@271
|
486
|
meillo@271
|
487 addr_list = g_list_append(addr_list, addr);
|
meillo@271
|
488 p = end;
|
meillo@271
|
489
|
meillo@271
|
490 while (*p == ',' || isspace(*p)) {
|
meillo@10
|
491 p++;
|
meillo@271
|
492 }
|
meillo@10
|
493 }
|
meillo@10
|
494 return addr_list;
|
meillo@0
|
495 }
|