forked from neomutt/neomutt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rfc2047.c
60 lines (55 loc) · 1.73 KB
/
rfc2047.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
* @file
* RFC2047 MIME extensions routines
*
* @authors
* Copyright (C) 1996-2000,2010 Michael R. Elkins <[email protected]>
* Copyright (C) 2000-2002 Edmund Grimley Evans <[email protected]>
*
* @copyright
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 2 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "mutt/address.h"
#include "mutt/charset.h"
#include "mutt/rfc2047.h"
#include "globals.h"
#include <string.h>
void rfc2047_encode_addrlist(struct Address *addr, const char *tag)
{
struct Address *ptr = addr;
int col = tag ? strlen(tag) + 2 : 32;
while (ptr)
{
if (ptr->personal)
mutt_rfc2047_encode(&ptr->personal, AddressSpecials, col, SendCharset);
else if (ptr->group && ptr->mailbox)
mutt_rfc2047_encode(&ptr->mailbox, AddressSpecials, col, SendCharset);
ptr = ptr->next;
}
}
void rfc2047_decode_addrlist(struct Address *a)
{
while (a)
{
if (a->personal &&
((strstr(a->personal, "=?") != NULL) || (AssumedCharset && *AssumedCharset)))
{
mutt_rfc2047_decode(&a->personal);
}
else if (a->group && a->mailbox && (strstr(a->mailbox, "=?") != NULL))
mutt_rfc2047_decode(&a->mailbox);
a = a->next;
}
}