masqmail

changeset 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 0410c8aabac2
children 1ca9bc4c6552
files src/masqmail.h src/route.c
diffstat 2 files changed, 48 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/src/masqmail.h	Sat Sep 03 18:32:37 2011 +0200
     1.2 +++ b/src/masqmail.h	Sat Sep 03 18:53:54 2011 +0200
     1.3 @@ -480,6 +480,8 @@
     1.4  void destroy_msgout_perhost(msgout_perhost * mo_ph);
     1.5  void rewrite_headers(msg_out * msgout, connect_route * route);
     1.6  void split_rcpts(GList* rcpt_list, GList* localnets, GList** rl_local, GList** rl_localnet, GList** rl_others);
     1.7 +GList* local_rcpts(GList* rcpt_list);
     1.8 +GList* remote_rcpts(GList* rcpt_list);
     1.9  gboolean route_strip_msgout(connect_route * route, msg_out * msgout);
    1.10  msg_out *route_prepare_msgout(connect_route * route, msg_out * msgout);
    1.11  GList *route_msgout_list(connect_route * route, GList * msgout_list);
     2.1 --- a/src/route.c	Sat Sep 03 18:32:37 2011 +0200
     2.2 +++ b/src/route.c	Sat Sep 03 18:53:54 2011 +0200
     2.3 @@ -237,6 +237,52 @@
     2.4  	}
     2.5  }
     2.6  
     2.7 +/*
     2.8 +Return a new list of the local rcpts in the rcpt_list
     2.9 +TODO: This function is almost exactly the same as remote_rcpts(). Merge?
    2.10 +*/
    2.11 +GList*
    2.12 +local_rcpts(GList* rcpt_list)
    2.13 +{
    2.14 +	GList *rcpt_node;
    2.15 +	GList *local_rcpts = NULL;
    2.16 +	address *rcpt = NULL;
    2.17 +
    2.18 +	if (!rcpt_list) {
    2.19 +		return NULL;
    2.20 +	}
    2.21 +	foreach(rcpt_list, rcpt_node) {
    2.22 +		rcpt = (address *) (rcpt_node->data);
    2.23 +		if (addr_is_local(rcpt)) {
    2.24 +			local_rcpts = g_list_append(local_rcpts, rcpt);
    2.25 +		}
    2.26 +	}
    2.27 +	return local_rcpts;
    2.28 +}
    2.29 +
    2.30 +/*
    2.31 +Return a new list of non-local rcpts in the rcpt_list
    2.32 +TODO: This function is almost exactly the same as local_rcpts(). Merge?
    2.33 +*/
    2.34 +GList*
    2.35 +remote_rcpts(GList* rcpt_list)
    2.36 +{
    2.37 +	GList *rcpt_node;
    2.38 +	GList *remote_rcpts = NULL;
    2.39 +	address *rcpt = NULL;
    2.40 +
    2.41 +	if (!rcpt_list) {
    2.42 +		return NULL;
    2.43 +	}
    2.44 +	foreach(rcpt_list, rcpt_node) {
    2.45 +		rcpt = (address *) (rcpt_node->data);
    2.46 +		if (!addr_is_local(rcpt)) {
    2.47 +			remote_rcpts = g_list_append(remote_rcpts, rcpt);
    2.48 +		}
    2.49 +	}
    2.50 +	return remote_rcpts;
    2.51 +}
    2.52 +
    2.53  static gint
    2.54  _g_list_addrcmp(gconstpointer pattern, gconstpointer addr)
    2.55  {