Mercurial > masqmail-0.2
comparison 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 |
comparison
equal
deleted
inserted
replaced
117:5ec5e6637049 | 118:7f1f364c2a29 |
---|---|
27 msg->data_size = -1; | 27 msg->data_size = -1; |
28 } | 28 } |
29 return msg; | 29 return msg; |
30 } | 30 } |
31 | 31 |
32 /* | |
33 This function is currently (0.2.24) only used for client side SMTP | |
34 SIZE support (RFC 1870). The flag is_smtp is always true therefore. | |
35 | |
36 Their definition of the message size in RFC 1870 is: | |
37 | |
38 The message size is defined as the number of octets, including | |
39 CR-LF pairs, but not the SMTP DATA command's terminating dot | |
40 or doubled quoting dots, to be transmitted by the SMTP client | |
41 after receiving reply code 354 to the DATA command. | |
42 | |
43 l_cnt (line count) covers '\r' characters which are not present in | |
44 masqmail's internal format. Dots are also not stuffed in the | |
45 internal format. Dot-stuffing is ignored in the size. | |
46 */ | |
32 gint | 47 gint |
33 msg_calc_size(message * msg, gboolean is_smtp) | 48 msg_calc_size(message * msg, gboolean is_smtp) |
34 { | 49 { |
35 GList *node; | 50 GList *node; |
36 gint l_cnt = 0, c_cnt = 0; | 51 gint l_cnt = 0; /* line count (we need to add so many '\r' for SMTP) */ |
37 | 52 gint c_cnt = 0; /* character count */ |
38 /* header size */ | 53 |
54 /* message header size */ | |
39 if (msg->hdr_list) { | 55 if (msg->hdr_list) { |
40 for (node = g_list_first(msg->hdr_list); node; node = g_list_next(node)) { | 56 for (node = g_list_first(msg->hdr_list); node; node = g_list_next(node)) { |
41 if (node->data) { | 57 if (node->data) { |
42 header *hdr = (header *) (node->data); | 58 header *hdr = (header *) (node->data); |
43 if (hdr->header) { | 59 if (hdr->header) { |
54 | 70 |
55 /* empty line separating headers from data: */ | 71 /* empty line separating headers from data: */ |
56 c_cnt++; | 72 c_cnt++; |
57 l_cnt++; | 73 l_cnt++; |
58 | 74 |
59 /* data size */ | 75 /* message data size */ |
60 if (msg->data_list) { | 76 if (msg->data_list) { |
61 for (node = g_list_first(msg->data_list); node; node = g_list_next(node)) { | 77 for (node = g_list_first(msg->data_list); node; node = g_list_next(node)) { |
62 if (node->data) { | 78 if (node->data) { |
63 char *p = node->data; | 79 char *p = node->data; |
64 while (*p) { | 80 while (*p) { |