annotate src/address.c @ 434:f2a7271746d1 default tip

Removes Freshmeat.net from the docs The site, which was later renamed to freecode.com, is no longer maintained (contains only a static copy).
author markus schnalke <meillo@marmaro.de>
date Sat, 07 Feb 2015 11:45:07 +0100
parents 9b93c0a3bd8c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
1 /*
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
2 ** MasqMail
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
3 ** Copyright (C) 1999-2001 Oliver Kurth
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
4 **
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
5 ** This program is free software; you can redistribute it and/or modify
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
6 ** it under the terms of the GNU General Public License as published by
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
7 ** the Free Software Foundation; either version 2 of the License, or
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
8 ** (at your option) any later version.
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
9 **
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
10 ** This program is distributed in the hope that it will be useful,
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
13 ** GNU General Public License for more details.
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
14 **
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
15 ** You should have received a copy of the GNU General Public License
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
16 ** along with this program; if not, write to the Free Software
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
17 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
18 */
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
19
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
20 #include "masqmail.h"
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
21
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
22 address*
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 317
diff changeset
23 create_address(gchar *path, gboolean is_rfc821)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
24 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
25 address *addr;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
26 addr = _create_address(path, NULL, is_rfc821);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
27
389
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
28 if (addr) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
29 addr_unmark_delivered(addr);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
30 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
31 return addr;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
32 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
33
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
34 address*
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 317
diff changeset
35 create_address_qualified(gchar *path, gboolean is_rfc821, gchar *domain)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
36 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
37 address *addr = create_address(path, is_rfc821);
23
4a3bc3a7afbe refactoring: early exit instead of deep if levels
meillo@marmaro.de
parents: 14
diff changeset
38
389
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
39 if (addr && !addr->domain) {
411
9b93c0a3bd8c Ensure lvals, rvals and components of address strucs are stripped.
markus schnalke <meillo@marmaro.de>
parents: 389
diff changeset
40 addr->domain = g_strstrip(g_strdup(domain));
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
41 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
42 return addr;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
43 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
44
13
49dab67fe461 code beautifying
meillo@marmaro.de
parents: 10
diff changeset
45 /* nothing special about pipes here, but its only called for that purpose */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
46 address*
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 317
diff changeset
47 create_address_pipe(gchar *path)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
48 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
49 address *addr = g_malloc(sizeof(address));
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
50
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
51 if (addr) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
52 memset(addr, 0, sizeof(address));
411
9b93c0a3bd8c Ensure lvals, rvals and components of address strucs are stripped.
markus schnalke <meillo@marmaro.de>
parents: 389
diff changeset
53 addr->address = g_strstrip(g_strdup(path));
9b93c0a3bd8c Ensure lvals, rvals and components of address strucs are stripped.
markus schnalke <meillo@marmaro.de>
parents: 389
diff changeset
54 addr->local_part = g_strstrip(g_strdup(addr->address));
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
55 addr->domain = g_strdup("localhost"); /* quick hack */
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
56 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
57 return addr;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
58 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
59
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
60 void
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 317
diff changeset
61 destroy_address(address *addr)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
62 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
63 DEBUG(6) debugf("destroy_address entered\n");
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
64 g_free(addr->address);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
65 g_free(addr->local_part);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
66 g_free(addr->domain);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
67 g_free(addr);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
68 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
69
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
70 address*
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 317
diff changeset
71 copy_modify_address(const address *orig, gchar *l_part, gchar *dom)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
72 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
73 address *addr = NULL;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
74
23
4a3bc3a7afbe refactoring: early exit instead of deep if levels
meillo@marmaro.de
parents: 14
diff changeset
75 if (!orig) {
4a3bc3a7afbe refactoring: early exit instead of deep if levels
meillo@marmaro.de
parents: 14
diff changeset
76 return NULL;
4a3bc3a7afbe refactoring: early exit instead of deep if levels
meillo@marmaro.de
parents: 14
diff changeset
77 }
389
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
78 if (!(addr = g_malloc(sizeof(address)))) {
23
4a3bc3a7afbe refactoring: early exit instead of deep if levels
meillo@marmaro.de
parents: 14
diff changeset
79 return NULL;
4a3bc3a7afbe refactoring: early exit instead of deep if levels
meillo@marmaro.de
parents: 14
diff changeset
80 }
411
9b93c0a3bd8c Ensure lvals, rvals and components of address strucs are stripped.
markus schnalke <meillo@marmaro.de>
parents: 389
diff changeset
81 addr->address = g_strstrip(g_strdup(orig->address));
9b93c0a3bd8c Ensure lvals, rvals and components of address strucs are stripped.
markus schnalke <meillo@marmaro.de>
parents: 389
diff changeset
82 addr->local_part = g_strstrip(l_part ? g_strdup(l_part) :
9b93c0a3bd8c Ensure lvals, rvals and components of address strucs are stripped.
markus schnalke <meillo@marmaro.de>
parents: 389
diff changeset
83 g_strdup(orig->local_part));
9b93c0a3bd8c Ensure lvals, rvals and components of address strucs are stripped.
markus schnalke <meillo@marmaro.de>
parents: 389
diff changeset
84 addr->domain = g_strstrip(dom ? g_strdup(dom) :
9b93c0a3bd8c Ensure lvals, rvals and components of address strucs are stripped.
markus schnalke <meillo@marmaro.de>
parents: 389
diff changeset
85 g_strdup(orig->domain));
23
4a3bc3a7afbe refactoring: early exit instead of deep if levels
meillo@marmaro.de
parents: 14
diff changeset
86 addr->flags = 0;
4a3bc3a7afbe refactoring: early exit instead of deep if levels
meillo@marmaro.de
parents: 14
diff changeset
87 addr->children = NULL;
4a3bc3a7afbe refactoring: early exit instead of deep if levels
meillo@marmaro.de
parents: 14
diff changeset
88 addr->parent = NULL;
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
89 return addr;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
90 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
91
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
92 gboolean
389
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
93 addr_isequal(address *addr1, address *addr2,
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
94 int (*cmpfunc) (const char*, const char*))
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
95 {
389
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
96 return (cmpfunc(addr1->local_part, addr2->local_part)==0) &&
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
97 (strcasecmp(addr1->domain, addr2->domain)==0);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
98 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
99
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
100 /* searches in ancestors of addr1 */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
101 gboolean
389
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
102 addr_isequal_parent(address *addr1, address *addr2,
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
103 int (*cmpfunc) (const char*, const char*))
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
104 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
105 address *addr;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
106
389
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
107 for (addr = addr1; addr; addr = addr->parent) {
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
108 if (addr_isequal(addr, addr2, cmpfunc)) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
109 return TRUE;
389
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
110 }
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
111 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
112 return FALSE;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
113 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
114
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
115 /* careful, this is recursive */
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
116 /* returns TRUE if ALL children have been delivered */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
117 gboolean
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 317
diff changeset
118 addr_is_delivered_children(address *addr)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
119 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
120 GList *addr_node;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
121
389
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
122 if (!addr->children) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
123 return addr_is_delivered(addr);
389
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
124 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
125 foreach(addr->children, addr_node) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
126 address *addr = (address *) (addr_node->data);
389
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
127 if (!addr_is_delivered_children(addr)) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
128 return FALSE;
389
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
129 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
130 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
131 return TRUE;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
132 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
133
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
134 /* careful, this is recursive */
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
135 /* returns TRUE if ALL children have been either delivered or have failed */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
136 gboolean
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 317
diff changeset
137 addr_is_finished_children(address *addr)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
138 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
139 GList *addr_node;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
140
389
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
141 if (!addr->children) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
142 return (addr_is_failed(addr) || addr_is_delivered(addr));
389
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
143 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
144 foreach(addr->children, addr_node) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
145 address *addr = (address *) (addr_node->data);
389
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
146 if (!addr_is_finished_children(addr)) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
147 return FALSE;
389
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
148 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
149 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
150 return TRUE;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
151 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
152
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
153 /* find original address */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
154 address*
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 317
diff changeset
155 addr_find_ancestor(address *addr)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
156 {
389
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
157 while (addr->parent) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
158 addr = addr->parent;
389
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
159 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
160 return addr;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
161 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
162
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
163 gchar*
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 317
diff changeset
164 addr_string(address *addr)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
165 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
166 static gchar *buffer = NULL;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
167
389
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
168 if (buffer) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
169 g_free(buffer);
389
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
170 }
411
9b93c0a3bd8c Ensure lvals, rvals and components of address strucs are stripped.
markus schnalke <meillo@marmaro.de>
parents: 389
diff changeset
171 if (!addr) {
9b93c0a3bd8c Ensure lvals, rvals and components of address strucs are stripped.
markus schnalke <meillo@marmaro.de>
parents: 389
diff changeset
172 return NULL;
9b93c0a3bd8c Ensure lvals, rvals and components of address strucs are stripped.
markus schnalke <meillo@marmaro.de>
parents: 389
diff changeset
173 }
389
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
174 if (!*addr->local_part) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
175 buffer = g_strdup("<>");
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
176 } else {
389
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
177 buffer = g_strdup_printf("<%s@%s>",
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
178 addr->local_part ? addr->local_part : "",
bc9a7845b53a Refactoring and code layouting.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
179 addr->domain ? addr->domain : "");
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
180 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
181 return buffer;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
182 }