comparison src/route.c @ 355:ddb7b3fd3d08

found further appearences of ``localnet'' in the code
author markus schnalke <meillo@marmaro.de>
date Sun, 04 Sep 2011 11:33:31 +0200
parents 257ffce6c1cd
children 41958685480d
comparison
equal deleted inserted replaced
354:08932c629849 355:ddb7b3fd3d08
191 } 191 }
192 192
193 /* 193 /*
194 Split a recipient list into the three groups: 194 Split a recipient list into the three groups:
195 - local recipients 195 - local recipients
196 - local net recipients 196 - those maching the patterns
197 - other/remote/online recipients 197 - those not matching the patterns
198 It should be possible to call the function like: 198 If patterns is NULL: only splitting between local and others is done.
199 split_rcpts(rcpts, hostlist, local, others, others);
200 This would split online between local and localnet+online recipients.
201 (untested yet; remove this line if you saw it worked -- meillo 2010-10-21)
202 If host_list is NULL, only splitting between local and other is done.
203 */ 199 */
204 void 200 void
205 split_rcpts(GList* rcpt_list, GList* localnets, GList** rl_local, GList** rl_localnet, GList** rl_others) 201 split_rcpts(GList* rcpt_list, GList* patterns, GList** rl_local, GList** rl_matching, GList** rl_others)
206 { 202 {
207 GList *rcpt_node; 203 GList *rcpt_node;
208 GList *host_node = NULL; 204 GList *host_node = NULL;
209 address *rcpt = NULL; 205 address *rcpt = NULL;
210 206
217 213
218 if (addr_is_local(rcpt)) { 214 if (addr_is_local(rcpt)) {
219 if (rl_local) 215 if (rl_local)
220 *rl_local = g_list_append(*rl_local, rcpt); 216 *rl_local = g_list_append(*rl_local, rcpt);
221 } else { 217 } else {
222 /* if localnets is NULL, host_node will be NULL, 218 /* if patterns is NULL, host_node will be NULL,
223 hence all non-locals are put to others */ 219 hence all non-locals are put to others */
224 foreach(localnets, host_node) { 220 foreach(patterns, host_node) {
225 gchar *host = (gchar *) (host_node->data); 221 gchar *host = (gchar *) (host_node->data);
226 if (fnmatch(host, rcpt->domain, FNM_CASEFOLD) == 0) 222 if (fnmatch(host, rcpt->domain, FNM_CASEFOLD) == 0)
227 break; 223 break;
228 } 224 }
229 if (host_node) { 225 if (host_node) {
230 if (rl_localnet) 226 if (rl_matching)
231 *rl_localnet = g_list_append(*rl_localnet, rcpt); 227 *rl_matching = g_list_append(*rl_matching, rcpt);
232 } else { 228 } else {
233 if (rl_others) 229 if (rl_others)
234 *rl_others = g_list_append(*rl_others, rcpt); 230 *rl_others = g_list_append(*rl_others, rcpt);
235 } 231 }
236 } 232 }