# HG changeset patch # User markus schnalke # Date 1315068834 -7200 # Node ID 257ffce6c1cd0a13041d65f92786214771dac48e # Parent 0410c8aabac203b1d11ee02526c401d5361cd916 added local_rcpts() and remote_rcpts() for later use diff -r 0410c8aabac2 -r 257ffce6c1cd src/masqmail.h --- a/src/masqmail.h Sat Sep 03 18:32:37 2011 +0200 +++ b/src/masqmail.h Sat Sep 03 18:53:54 2011 +0200 @@ -480,6 +480,8 @@ void destroy_msgout_perhost(msgout_perhost * mo_ph); void rewrite_headers(msg_out * msgout, connect_route * route); void split_rcpts(GList* rcpt_list, GList* localnets, GList** rl_local, GList** rl_localnet, GList** rl_others); +GList* local_rcpts(GList* rcpt_list); +GList* remote_rcpts(GList* rcpt_list); gboolean route_strip_msgout(connect_route * route, msg_out * msgout); msg_out *route_prepare_msgout(connect_route * route, msg_out * msgout); GList *route_msgout_list(connect_route * route, GList * msgout_list); diff -r 0410c8aabac2 -r 257ffce6c1cd src/route.c --- a/src/route.c Sat Sep 03 18:32:37 2011 +0200 +++ b/src/route.c Sat Sep 03 18:53:54 2011 +0200 @@ -237,6 +237,52 @@ } } +/* +Return a new list of the local rcpts in the rcpt_list +TODO: This function is almost exactly the same as remote_rcpts(). Merge? +*/ +GList* +local_rcpts(GList* rcpt_list) +{ + GList *rcpt_node; + GList *local_rcpts = NULL; + address *rcpt = NULL; + + if (!rcpt_list) { + return NULL; + } + foreach(rcpt_list, rcpt_node) { + rcpt = (address *) (rcpt_node->data); + if (addr_is_local(rcpt)) { + local_rcpts = g_list_append(local_rcpts, rcpt); + } + } + return local_rcpts; +} + +/* +Return a new list of non-local rcpts in the rcpt_list +TODO: This function is almost exactly the same as local_rcpts(). Merge? +*/ +GList* +remote_rcpts(GList* rcpt_list) +{ + GList *rcpt_node; + GList *remote_rcpts = NULL; + address *rcpt = NULL; + + if (!rcpt_list) { + return NULL; + } + foreach(rcpt_list, rcpt_node) { + rcpt = (address *) (rcpt_node->data); + if (!addr_is_local(rcpt)) { + remote_rcpts = g_list_append(remote_rcpts, rcpt); + } + } + return remote_rcpts; +} + static gint _g_list_addrcmp(gconstpointer pattern, gconstpointer addr) {