masqmail-0.2

diff src/message.c @ 118:7f1f364c2a29

annotations at msg_calc_size()
author meillo@marmaro.de
date Thu, 01 Jul 2010 13:09:40 +0200
parents 71ce3a1568e9
children 087e99c7702a
line diff
     1.1 --- a/src/message.c	Thu Jul 01 13:08:53 2010 +0200
     1.2 +++ b/src/message.c	Thu Jul 01 13:09:40 2010 +0200
     1.3 @@ -29,13 +29,29 @@
     1.4  	return msg;
     1.5  }
     1.6  
     1.7 +/*
     1.8 +   This function is currently (0.2.24) only used for client side SMTP
     1.9 +   SIZE support (RFC 1870). The flag is_smtp is always true therefore.
    1.10 +
    1.11 +   Their definition of the message size in RFC 1870 is:
    1.12 +
    1.13 +       The message size is defined as the number of octets, including
    1.14 +       CR-LF pairs, but not the SMTP DATA command's terminating dot
    1.15 +       or doubled quoting dots, to be transmitted by the SMTP client
    1.16 +       after receiving reply code 354 to the DATA command.
    1.17 +
    1.18 +   l_cnt (line count) covers '\r' characters which are not present in
    1.19 +   masqmail's internal format. Dots are also not stuffed in the
    1.20 +   internal format. Dot-stuffing is ignored in the size.
    1.21 +*/
    1.22  gint
    1.23  msg_calc_size(message * msg, gboolean is_smtp)
    1.24  {
    1.25  	GList *node;
    1.26 -	gint l_cnt = 0, c_cnt = 0;
    1.27 +	gint l_cnt = 0;  /* line count (we need to add so many '\r' for SMTP) */
    1.28 +	gint c_cnt = 0;  /* character count */
    1.29  
    1.30 -	/* header size */
    1.31 +	/* message header size */
    1.32  	if (msg->hdr_list) {
    1.33  		for (node = g_list_first(msg->hdr_list); node; node = g_list_next(node)) {
    1.34  			if (node->data) {
    1.35 @@ -56,7 +72,7 @@
    1.36  	c_cnt++;
    1.37  	l_cnt++;
    1.38  
    1.39 -	/* data size */
    1.40 +	/* message data size */
    1.41  	if (msg->data_list) {
    1.42  		for (node = g_list_first(msg->data_list); node; node = g_list_next(node)) {
    1.43  			if (node->data) {