masqmail

diff 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
line diff
     1.1 --- a/src/route.c	Sat Sep 03 18:32:37 2011 +0200
     1.2 +++ b/src/route.c	Sat Sep 03 18:53:54 2011 +0200
     1.3 @@ -237,6 +237,52 @@
     1.4  	}
     1.5  }
     1.6  
     1.7 +/*
     1.8 +Return a new list of the local rcpts in the rcpt_list
     1.9 +TODO: This function is almost exactly the same as remote_rcpts(). Merge?
    1.10 +*/
    1.11 +GList*
    1.12 +local_rcpts(GList* rcpt_list)
    1.13 +{
    1.14 +	GList *rcpt_node;
    1.15 +	GList *local_rcpts = NULL;
    1.16 +	address *rcpt = NULL;
    1.17 +
    1.18 +	if (!rcpt_list) {
    1.19 +		return NULL;
    1.20 +	}
    1.21 +	foreach(rcpt_list, rcpt_node) {
    1.22 +		rcpt = (address *) (rcpt_node->data);
    1.23 +		if (addr_is_local(rcpt)) {
    1.24 +			local_rcpts = g_list_append(local_rcpts, rcpt);
    1.25 +		}
    1.26 +	}
    1.27 +	return local_rcpts;
    1.28 +}
    1.29 +
    1.30 +/*
    1.31 +Return a new list of non-local rcpts in the rcpt_list
    1.32 +TODO: This function is almost exactly the same as local_rcpts(). Merge?
    1.33 +*/
    1.34 +GList*
    1.35 +remote_rcpts(GList* rcpt_list)
    1.36 +{
    1.37 +	GList *rcpt_node;
    1.38 +	GList *remote_rcpts = NULL;
    1.39 +	address *rcpt = NULL;
    1.40 +
    1.41 +	if (!rcpt_list) {
    1.42 +		return NULL;
    1.43 +	}
    1.44 +	foreach(rcpt_list, rcpt_node) {
    1.45 +		rcpt = (address *) (rcpt_node->data);
    1.46 +		if (!addr_is_local(rcpt)) {
    1.47 +			remote_rcpts = g_list_append(remote_rcpts, rcpt);
    1.48 +		}
    1.49 +	}
    1.50 +	return remote_rcpts;
    1.51 +}
    1.52 +
    1.53  static gint
    1.54  _g_list_addrcmp(gconstpointer pattern, gconstpointer addr)
    1.55  {