annotate src/message.c @ 434:f2a7271746d1 default tip

Removes Freshmeat.net from the docs The site, which was later renamed to freecode.com, is no longer maintained (contains only a static copy).
author markus schnalke <meillo@marmaro.de>
date Sat, 07 Feb 2015 11:45:07 +0100 (2015-02-07)
parents b27f66555ba8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
1 /*
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
2 ** MasqMail
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
3 ** Copyright (C) 1999-2001 Oliver Kurth
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
4 ** Copyright (C) 2010 markus schnalke <meillo@marmaro.de>
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
5 **
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
6 ** This program is free software; you can redistribute it and/or modify
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
7 ** it under the terms of the GNU General Public License as published by
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
8 ** the Free Software Foundation; either version 2 of the License, or
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
9 ** (at your option) any later version.
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
10 **
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
11 ** This program is distributed in the hope that it will be useful,
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
14 ** GNU General Public License for more details.
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
15 **
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
16 ** You should have received a copy of the GNU General Public License
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
17 ** along with this program; if not, write to the Free Software
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
18 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
19 */
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
20
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
21 #include "masqmail.h"
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
22
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
23 message*
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
24 create_message()
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
25 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
26 message *msg = (message *) g_malloc(sizeof(message));
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
27 if (msg) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
28 memset(msg, 0, sizeof(message));
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
29 msg->data_size = -1;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
30 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
31 return msg;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
32 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
33
118
7f1f364c2a29 annotations at msg_calc_size()
meillo@marmaro.de
parents: 81
diff changeset
34 /*
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
35 ** This function is currently (0.2.24) only used for client side SMTP
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
36 ** SIZE support (RFC 1870). The flag is_smtp is always true therefore.
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
37 **
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
38 ** Their definition of the message size in RFC 1870 is:
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
39 **
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
40 ** The message size is defined as the number of octets, including
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
41 ** CR-LF pairs, but not the SMTP DATA command's terminating dot
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
42 ** or doubled quoting dots, to be transmitted by the SMTP client
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
43 ** after receiving reply code 354 to the DATA command.
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
44 **
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
45 ** l_cnt (line count) covers '\r' characters which are not present in
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
46 ** masqmail's internal format. Dots are also not stuffed in the
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
47 ** internal format. Dot-stuffing is ignored in the size.
118
7f1f364c2a29 annotations at msg_calc_size()
meillo@marmaro.de
parents: 81
diff changeset
48 */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
49 gint
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 351
diff changeset
50 msg_calc_size(message *msg, gboolean is_smtp)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
51 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
52 GList *node;
118
7f1f364c2a29 annotations at msg_calc_size()
meillo@marmaro.de
parents: 81
diff changeset
53 gint l_cnt = 0; /* line count (we need to add so many '\r' for SMTP) */
7f1f364c2a29 annotations at msg_calc_size()
meillo@marmaro.de
parents: 81
diff changeset
54 gint c_cnt = 0; /* character count */
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
55
118
7f1f364c2a29 annotations at msg_calc_size()
meillo@marmaro.de
parents: 81
diff changeset
56 /* message header size */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
57 if (msg->hdr_list) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
58 for (node = g_list_first(msg->hdr_list); node; node = g_list_next(node)) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
59 if (node->data) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
60 header *hdr = (header *) (node->data);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
61 if (hdr->header) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
62 char *p = hdr->header;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
63 while (*p) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
64 if (*p++ == '\n')
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
65 l_cnt++;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
66 c_cnt++;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
67 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
68 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
69 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
70 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
71 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
72
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
73 /* empty line separating headers from data: */
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
74 c_cnt++;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
75 l_cnt++;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
76
118
7f1f364c2a29 annotations at msg_calc_size()
meillo@marmaro.de
parents: 81
diff changeset
77 /* message data size */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
78 if (msg->data_list) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
79 for (node = g_list_first(msg->data_list); node; node = g_list_next(node)) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
80 if (node->data) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
81 char *p = node->data;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
82 while (*p) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
83 if (*p++ == '\n')
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
84 l_cnt++;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
85 c_cnt++;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
86 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
87 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
88 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
89 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
90
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
91 return is_smtp ? c_cnt + l_cnt : c_cnt;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
92 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
93
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
94 void
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 351
diff changeset
95 msg_free_data(message *msg)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
96 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
97 GList *node;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
98
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
99 if (msg->data_list) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
100 for (node = g_list_first(msg->data_list); node; node = g_list_next(node)) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
101 if (node->data)
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
102 g_free(node->data);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
103 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
104 g_list_free(msg->data_list);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
105 msg->data_list = NULL;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
106 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
107 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
108
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
109 void
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 351
diff changeset
110 destroy_message(message *msg)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
111 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
112 GList *node;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
113
81
71ce3a1568e9 moved check for NULL into destroy_message()
meillo@marmaro.de
parents: 10
diff changeset
114 if (!msg) {
71ce3a1568e9 moved check for NULL into destroy_message()
meillo@marmaro.de
parents: 10
diff changeset
115 return;
71ce3a1568e9 moved check for NULL into destroy_message()
meillo@marmaro.de
parents: 10
diff changeset
116 }
71ce3a1568e9 moved check for NULL into destroy_message()
meillo@marmaro.de
parents: 10
diff changeset
117
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
118 if (msg->uid)
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
119 g_free(msg->uid);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
120 if (msg->ident)
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
121 g_free(msg->ident);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
122 if (msg->return_path)
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
123 g_free(msg->return_path);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
124
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
125 if (msg->rcpt_list) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
126 for (node = g_list_first(msg->rcpt_list); node; node = g_list_next(node)) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
127 if (node->data)
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
128 g_free(node->data);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
129 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
130 g_list_free(msg->rcpt_list);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
131 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
132 if (msg->hdr_list) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
133 for (node = g_list_first(msg->hdr_list); node; node = g_list_next(node)) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
134 if (node->data) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
135 header *hdr = (header *) (node->data);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
136 if (hdr->header)
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
137 g_free(hdr->header);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
138 g_free(node->data);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
139 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
140 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
141 g_list_free(msg->hdr_list);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
142 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
143
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
144 if (msg->full_sender_name)
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
145 g_free(msg->full_sender_name);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
146
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
147 msg_free_data(msg);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
148
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
149 g_free(msg);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
150 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
151
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
152 void
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 351
diff changeset
153 destroy_msg_list(GList *msg_list)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
154 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
155 GList *msg_node;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
156
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
157 foreach(msg_list, msg_node) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
158 message *msg = (message *) (msg_node->data);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
159 destroy_message(msg);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
160 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
161 g_list_free(msg_list);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
162 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
163
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
164 msg_out*
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 351
diff changeset
165 create_msg_out(message *msg)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
166 {
351
4c046561582a Minor refactoring
markus schnalke <meillo@marmaro.de>
parents: 343
diff changeset
167 msg_out *msgout = g_malloc0(sizeof(msg_out));
4c046561582a Minor refactoring
markus schnalke <meillo@marmaro.de>
parents: 343
diff changeset
168 msgout->msg = msg;
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
169 return msgout;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
170 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
171
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
172 msg_out*
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 351
diff changeset
173 clone_msg_out(msg_out *msgout_orig)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
174 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
175 if (msgout_orig) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
176 msg_out *msgout = create_msg_out(msgout_orig->msg);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
177 if (msgout) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
178 msgout->msg = msgout_orig->msg;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
179 if (msgout_orig->return_path)
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
180 msgout->return_path = copy_address(msgout_orig->return_path);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
181 if (msgout_orig->hdr_list)
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
182 msgout->hdr_list = g_list_copy(msgout_orig->hdr_list);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
183 /* FIXME: if this lives longer than the original
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
184 and we access one of the xtra hdrs, we will segfault
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
185 or cause some weird bugs: */
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
186 msgout->xtra_hdr_list = NULL;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
187 if (msgout_orig->rcpt_list)
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
188 msgout->rcpt_list = g_list_copy(msgout_orig->rcpt_list);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
189 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
190 return msgout;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
191 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
192 return NULL;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
193 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
194
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
195 void
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 351
diff changeset
196 destroy_msg_out(msg_out *msgout)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
197 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
198 if (msgout) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
199 if (msgout->return_path)
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
200 destroy_address(msgout->return_path);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
201 if (msgout->hdr_list)
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
202 g_list_free(msgout->hdr_list);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
203 if (msgout->xtra_hdr_list) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
204 GList *hdr_node;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
205 foreach(msgout->xtra_hdr_list, hdr_node) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
206 header *hdr = (header *) (hdr_node->data);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
207 destroy_header(hdr);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
208 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
209 g_list_free(msgout->xtra_hdr_list);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
210 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
211 g_free(msgout);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
212 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
213 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
214
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
215 void
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 351
diff changeset
216 destroy_msg_out_list(GList *msgout_list)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
217 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
218 GList *msgout_node;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
219
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
220 foreach(msgout_list, msgout_node) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
221 msg_out *msgout = (msg_out *) (msgout_node->data);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
222 destroy_msg_out(msgout);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
223 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
224 g_list_free(msgout_list);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
225 }