comparison src/route.c @ 345:257ffce6c1cd

added local_rcpts() and remote_rcpts() for later use
author markus schnalke <meillo@marmaro.de>
date Sat, 03 Sep 2011 18:53:54 +0200
parents 55b7bde95d37
children ddb7b3fd3d08
comparison
equal deleted inserted replaced
344:0410c8aabac2 345:257ffce6c1cd
235 } 235 }
236 } 236 }
237 } 237 }
238 } 238 }
239 239
240 /*
241 Return a new list of the local rcpts in the rcpt_list
242 TODO: This function is almost exactly the same as remote_rcpts(). Merge?
243 */
244 GList*
245 local_rcpts(GList* rcpt_list)
246 {
247 GList *rcpt_node;
248 GList *local_rcpts = NULL;
249 address *rcpt = NULL;
250
251 if (!rcpt_list) {
252 return NULL;
253 }
254 foreach(rcpt_list, rcpt_node) {
255 rcpt = (address *) (rcpt_node->data);
256 if (addr_is_local(rcpt)) {
257 local_rcpts = g_list_append(local_rcpts, rcpt);
258 }
259 }
260 return local_rcpts;
261 }
262
263 /*
264 Return a new list of non-local rcpts in the rcpt_list
265 TODO: This function is almost exactly the same as local_rcpts(). Merge?
266 */
267 GList*
268 remote_rcpts(GList* rcpt_list)
269 {
270 GList *rcpt_node;
271 GList *remote_rcpts = NULL;
272 address *rcpt = NULL;
273
274 if (!rcpt_list) {
275 return NULL;
276 }
277 foreach(rcpt_list, rcpt_node) {
278 rcpt = (address *) (rcpt_node->data);
279 if (!addr_is_local(rcpt)) {
280 remote_rcpts = g_list_append(remote_rcpts, rcpt);
281 }
282 }
283 return remote_rcpts;
284 }
285
240 static gint 286 static gint
241 _g_list_addrcmp(gconstpointer pattern, gconstpointer addr) 287 _g_list_addrcmp(gconstpointer pattern, gconstpointer addr)
242 { 288 {
243 int res; 289 int res;
244 address* patternaddr = (address*) pattern; 290 address* patternaddr = (address*) pattern;