annotate src/header.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
parents 0430194f7ef8
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) 2000 Oliver Kurth
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
4 **
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
5 ** 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
6 ** 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
7 ** 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
8 ** (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
9 **
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
10 ** 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
11 ** 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
12 ** 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
13 ** 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
14 **
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
15 ** 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
16 ** 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
17 ** 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
18 */
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
19 #include "masqmail.h"
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
20
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
21 header_name header_names[] = {
15
f671821d8222 code beautifying; 0 -> \0 if appropriate
meillo@marmaro.de
parents: 10
diff changeset
22 {"From", HEAD_FROM,},
f671821d8222 code beautifying; 0 -> \0 if appropriate
meillo@marmaro.de
parents: 10
diff changeset
23 {"Sender", HEAD_SENDER,},
f671821d8222 code beautifying; 0 -> \0 if appropriate
meillo@marmaro.de
parents: 10
diff changeset
24 {"To", HEAD_TO,},
f671821d8222 code beautifying; 0 -> \0 if appropriate
meillo@marmaro.de
parents: 10
diff changeset
25 {"Cc", HEAD_CC,},
f671821d8222 code beautifying; 0 -> \0 if appropriate
meillo@marmaro.de
parents: 10
diff changeset
26 {"Bcc", HEAD_BCC,},
f671821d8222 code beautifying; 0 -> \0 if appropriate
meillo@marmaro.de
parents: 10
diff changeset
27 {"Date", HEAD_DATE,},
f671821d8222 code beautifying; 0 -> \0 if appropriate
meillo@marmaro.de
parents: 10
diff changeset
28 {"Message-Id", HEAD_MESSAGE_ID,},
f671821d8222 code beautifying; 0 -> \0 if appropriate
meillo@marmaro.de
parents: 10
diff changeset
29 {"Reply-To", HEAD_REPLY_TO,},
f671821d8222 code beautifying; 0 -> \0 if appropriate
meillo@marmaro.de
parents: 10
diff changeset
30 {"Subject", HEAD_SUBJECT,},
f671821d8222 code beautifying; 0 -> \0 if appropriate
meillo@marmaro.de
parents: 10
diff changeset
31 {"Return-Path", HEAD_RETURN_PATH,},
f671821d8222 code beautifying; 0 -> \0 if appropriate
meillo@marmaro.de
parents: 10
diff changeset
32 {"Envelope-To", HEAD_ENVELOPE_TO,},
f671821d8222 code beautifying; 0 -> \0 if appropriate
meillo@marmaro.de
parents: 10
diff changeset
33 {"Received", HEAD_RECEIVED},
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
34 };
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
35
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
36 /* this was borrowed from exim and slightly changed */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
37 gchar*
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
38 rec_timestamp()
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
39 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
40 static gchar buf[64];
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
41 int len;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
42
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
43 time_t now = time(NULL);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
44 struct tm *t = localtime(&now);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
45
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
46 int diff_hour, diff_min;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
47 struct tm local;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
48 struct tm *gmt;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
49
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
50 memcpy(&local, t, sizeof(struct tm));
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
51 gmt = gmtime(&now);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
52 diff_min = 60 * (local.tm_hour - gmt->tm_hour) + local.tm_min - gmt->tm_min;
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
53 if (local.tm_year != gmt->tm_year) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
54 diff_min += (local.tm_year > gmt->tm_year) ? 1440 : -1440;
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
55 } else if (local.tm_yday != gmt->tm_yday) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
56 diff_min += (local.tm_yday > gmt->tm_yday) ? 1440 : -1440;
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
57 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
58 diff_hour = diff_min / 60;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
59 diff_min = abs(diff_min - diff_hour * 60);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
60
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
61 len = strftime(buf, sizeof(buf), "%a, ", &local);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
62 g_snprintf(buf + len, sizeof(buf) - len, "%02d ", local.tm_mday);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
63 len += strlen(buf + len);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
64 len += strftime(buf + len, sizeof(buf) - len, "%b %Y %H:%M:%S", &local);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
65 g_snprintf(buf + len, sizeof(buf) - len, " %+03d%02d", diff_hour, diff_min);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
66
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
67 return buf;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
68 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
69
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
70 /*
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
71 ** finds list of headers matching id
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
72 ** if id == HEAD_UNKNOWN and header == NULL finds all unknown headers
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
73 ** else finds all headers matching header
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
74 */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
75 GList*
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 322
diff changeset
76 find_header(GList *hdr_list, header_id id, gchar *hdr_str)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
77 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
78 GList *found_list = NULL;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
79 GList *node;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
80
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
81 if ((id != HEAD_UNKNOWN) || !hdr_str) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
82 foreach(hdr_list, node) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
83 header *hdr = (header *) (node->data);
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
84 if (hdr->id == id) {
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
85 found_list = g_list_append(found_list, hdr);
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
86 }
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
87 }
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
88 return found_list;
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
89 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
90
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
91 foreach(hdr_list, node) {
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
92 header *hdr = (header *) (node->data);
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
93 gchar buf[64], *q = buf, *p = hdr->header;
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
94
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
95 while (*p != ':' && q < buf+sizeof(buf)-1 && *p) {
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
96 *(q++) = *(p++);
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
97 }
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
98 *q = '\0';
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
99
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
100 if (strcasecmp(buf, hdr_str) == 0) {
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
101 found_list = g_list_append(found_list, hdr);
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
102 }
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 return found_list;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
105 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
106
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
107 void
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 322
diff changeset
108 header_unfold(header *hdr)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
109 {
302
2ffcd38ccf53 improved unused function header_fold()
markus schnalke <meillo@marmaro.de>
parents: 301
diff changeset
110 char *src = hdr->header;
2ffcd38ccf53 improved unused function header_fold()
markus schnalke <meillo@marmaro.de>
parents: 301
diff changeset
111 char *dest = src;
2ffcd38ccf53 improved unused function header_fold()
markus schnalke <meillo@marmaro.de>
parents: 301
diff changeset
112 char *p;
2ffcd38ccf53 improved unused function header_fold()
markus schnalke <meillo@marmaro.de>
parents: 301
diff changeset
113
2ffcd38ccf53 improved unused function header_fold()
markus schnalke <meillo@marmaro.de>
parents: 301
diff changeset
114 p = strchr(src, '\n');
2ffcd38ccf53 improved unused function header_fold()
markus schnalke <meillo@marmaro.de>
parents: 301
diff changeset
115 if (!p || !p[1]) {
2ffcd38ccf53 improved unused function header_fold()
markus schnalke <meillo@marmaro.de>
parents: 301
diff changeset
116 /* no folded header */
2ffcd38ccf53 improved unused function header_fold()
markus schnalke <meillo@marmaro.de>
parents: 301
diff changeset
117 return;
2ffcd38ccf53 improved unused function header_fold()
markus schnalke <meillo@marmaro.de>
parents: 301
diff changeset
118 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
119
302
2ffcd38ccf53 improved unused function header_fold()
markus schnalke <meillo@marmaro.de>
parents: 301
diff changeset
120 while (*src) {
2ffcd38ccf53 improved unused function header_fold()
markus schnalke <meillo@marmaro.de>
parents: 301
diff changeset
121 if (*src == '\n') {
2ffcd38ccf53 improved unused function header_fold()
markus schnalke <meillo@marmaro.de>
parents: 301
diff changeset
122 /* ignore */
2ffcd38ccf53 improved unused function header_fold()
markus schnalke <meillo@marmaro.de>
parents: 301
diff changeset
123 src++;
2ffcd38ccf53 improved unused function header_fold()
markus schnalke <meillo@marmaro.de>
parents: 301
diff changeset
124 } else {
2ffcd38ccf53 improved unused function header_fold()
markus schnalke <meillo@marmaro.de>
parents: 301
diff changeset
125 /* copy */
2ffcd38ccf53 improved unused function header_fold()
markus schnalke <meillo@marmaro.de>
parents: 301
diff changeset
126 *(dest++) = *(src++);
2ffcd38ccf53 improved unused function header_fold()
markus schnalke <meillo@marmaro.de>
parents: 301
diff changeset
127 }
2ffcd38ccf53 improved unused function header_fold()
markus schnalke <meillo@marmaro.de>
parents: 301
diff changeset
128 }
2ffcd38ccf53 improved unused function header_fold()
markus schnalke <meillo@marmaro.de>
parents: 301
diff changeset
129 *(dest++) = '\n';
2ffcd38ccf53 improved unused function header_fold()
markus schnalke <meillo@marmaro.de>
parents: 301
diff changeset
130 *(dest++) = '\0';
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
131 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
132
303
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
133 /*
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
134 ** fold the header at maxlen chars (newline excluded)
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
135 ** (We exclude the newline because the RFCs deal with it this way)
303
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
136 */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
137 void
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 322
diff changeset
138 header_fold(header *hdr, unsigned int maxlen)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
139 {
303
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
140 int len = strlen(hdr->header);
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 322
diff changeset
141 char *src = hdr->header;
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 322
diff changeset
142 char *dest;
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 322
diff changeset
143 char *tmp;
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 322
diff changeset
144 char *p;
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
145 int valueoffset;
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
146
303
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
147 if (len <= maxlen) {
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
148 /* we don't need to do anything */
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
149 return;
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
150 }
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
151
303
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
152 /* strip trailing whitespace */
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
153 for (p=src+len-1; *p==' '||*p=='\t'||*p=='\n'; p--) {
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
154 *p = '\0';
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
155 len--;
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
156 printf(" trailing whitespace\n");
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
157 }
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
158 printf("stripped len: %d\n", len);
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
159
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
160 /*
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
161 ** FIXME: would be nice to have a better size calculation
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
162 ** (the current size + what we insert as break, twice as often as
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
163 ** we have breaks in the optimal case)
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
164 */
303
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
165 tmp = malloc(len + 2 * (len/maxlen) * strlen("\n\t"));
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
166 dest = tmp;
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
167
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
168 /* the position in hdr->header where the value part start */
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
169 valueoffset = hdr->value - hdr->header;
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
170
303
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
171 while (strlen(src) > maxlen) {
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
172 char *pp;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
173
303
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
174 for (pp=src+maxlen; pp>src; pp--) {
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
175 if (*pp==' ' || *pp=='\t' || *p=='\n') {
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
176 break;
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
177 }
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
178 }
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
179
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
180 if (src == pp) {
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
181 /* no potential break point was found within
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
182 maxlen so advance further until the next */
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
183 for (pp=src+maxlen; *pp; pp++) {
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
184 if (*pp==' ' || *pp=='\t' || *p=='\n') {
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
185 break;
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
186 }
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
187 }
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
188 }
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
189 if (!*pp) {
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
190 break;
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
191 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
192
303
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
193 memcpy(dest, src, pp-src);
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
194 dest += pp-src;
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
195 *(dest++) = '\n';
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
196 *(dest++) = '\t';
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
197 while (*pp == ' ' || *pp == '\t' || *p=='\n') {
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
198 pp++;
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
199 }
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
200 src = pp;
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
201 }
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
202 memcpy(dest, src, strlen(src));
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
203 dest += strlen(src);
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
204
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
205 if (*(dest-1) != '\n') {
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
206 *dest = '\n';
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
207 *(dest+1) = '\0';
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
208 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
209
303
3e3c280ca5b2 replaced header_fold() with a better implementation
markus schnalke <meillo@marmaro.de>
parents: 302
diff changeset
210 hdr->header = tmp;
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
211 hdr->value = hdr->header + valueoffset;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
212 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
213
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
214 header*
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 322
diff changeset
215 create_header(header_id id, gchar *fmt, ...)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
216 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
217 gchar *p;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
218 header *hdr;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
219 va_list args;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
220 va_start(args, fmt);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
221
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
222 /* g_malloc() calls exit on failure */
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
223 hdr = g_malloc(sizeof(header));
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
224
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
225 hdr->id = id;
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
226 hdr->header = g_strdup_vprintf(fmt, args);
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
227 hdr->value = NULL;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
228
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
229 /*
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
230 ** value shall point to the first non-whitespace char in the
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
231 ** value part of the header line (i.e. after the first colon)
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
232 */
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
233 p = strchr(hdr->header, ':');
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
234 if (p) {
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
235 p++;
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
236 while (*p == ' ' || *p == '\t' || *p == '\n') {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
237 p++;
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
238 }
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
239 hdr->value = (*p) ? p : NULL;
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
240 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
241
415
0430194f7ef8 Debug message cosmetic.
markus schnalke <meillo@marmaro.de>
parents: 376
diff changeset
242 DEBUG(3) debugf("create_header(): %s", hdr->header);
0430194f7ef8 Debug message cosmetic.
markus schnalke <meillo@marmaro.de>
parents: 376
diff changeset
243 /* DEBUG(3) debugf("create_header(): val: `%s'\n", hdr->value); */
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
244
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
245 va_end(args);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
246 return hdr;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
247 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
248
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
249 void
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 322
diff changeset
250 destroy_header(header *hdr)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
251 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
252 if (hdr) {
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
253 if (hdr->header) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
254 g_free(hdr->header);
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
255 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
256 g_free(hdr);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
257 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
258 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
259
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
260 header*
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 322
diff changeset
261 copy_header(header *hdr)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
262 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
263 header *new_hdr = NULL;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
264
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
265 if (hdr) {
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
266 new_hdr = g_malloc(sizeof(header));
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
267 new_hdr->id = hdr->id;
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
268 new_hdr->header = g_strdup(hdr->header);
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
269 new_hdr->value = new_hdr->header + (hdr->value - hdr->header);
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
270 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
271 return new_hdr;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
272 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
273
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
274 header*
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 322
diff changeset
275 get_header(gchar *line)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
276 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
277 gchar *p = line;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
278 gchar buf[64], *q = buf;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
279 gint i;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
280 header *hdr;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
281
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
282 while (*p && (*p != ':') && (q < buf+sizeof(buf)-1)) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
283 *(q++) = *(p++);
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
284 }
15
f671821d8222 code beautifying; 0 -> \0 if appropriate
meillo@marmaro.de
parents: 10
diff changeset
285 *q = '\0';
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
286
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
287 if (*p != ':') {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
288 return NULL;
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
289 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
290
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
291 hdr = g_malloc(sizeof(header));
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
292
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
293 hdr->value = NULL;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
294 p++;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
295
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
296 while (*p && (*p == ' ' || *p == '\t')) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
297 p++;
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
298 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
299 hdr->value = p;
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
300 /*
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
301 ** Note: an empty value can also mean that it's only the first part
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
302 ** of a folded header line
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
303 */
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
304
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
305 for (i = 0; i < HEAD_NUM_IDS; i++) {
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
306 if (strcasecmp(header_names[i].header, buf) == 0) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
307 break;
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
308 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
309 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
310 hdr->id = (header_id) i;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
311 hdr->header = g_strdup(line);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
312 hdr->value = hdr->header + (hdr->value - line);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
313
415
0430194f7ef8 Debug message cosmetic.
markus schnalke <meillo@marmaro.de>
parents: 376
diff changeset
314 DEBUG(4) debugf("header: %d = %s", hdr->id, hdr->header);
301
55c530a83d51 refactoring
markus schnalke <meillo@marmaro.de>
parents: 235
diff changeset
315 /* Note: This only outputs the first line if the header is folded */
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
316
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
317 return hdr;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
318 }