X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=rfc2047.c;h=bed0353d52b2fe993b7ab82710eafe5571ae22b5;hp=9ac1cd7a8d3e0e2da0588cede3468bf198eb4e99;hb=d0dc8fb657cff90709c15d4b106415b868857f6a;hpb=bec523bb3ad78ec9100efb18fb58d43d38b304de diff --git a/rfc2047.c b/rfc2047.c index 9ac1cd7..bed0353 100644 --- a/rfc2047.c +++ b/rfc2047.c @@ -1,3 +1,22 @@ +/* + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * Copyright © 2006 Pierre Habouzit + */ + /* * Copyright notice from original mutt: * Copyright (C) 1996-2000 Michael R. Elkins @@ -16,13 +35,12 @@ #include #include +#include + #include "mutt.h" -#include "mime.h" #include "charset.h" -#include "rfc2047.h" #include "thread.h" - #include #include #include @@ -45,8 +63,6 @@ #define CONTINUATION_BYTE(c) (((c) & 0xc0) == 0x80) -extern char RFC822Specials[]; - typedef size_t (*encoder_t) (char *, const char *, size_t, const char *); @@ -534,9 +550,9 @@ void _rfc2047_encode_string (char **pd, int encode_specials, int col) *pd = e; } -void rfc2047_encode_adrlist (ADDRESS * addr, const char *tag) +void rfc2047_encode_adrlist (address_t * addr, const char *tag) { - ADDRESS *ptr = addr; + address_t *ptr = addr; int col = tag ? m_strlen(tag) + 2 : 32; while (ptr) { @@ -582,9 +598,7 @@ static int rfc2047_decode_word (char *d, const char *s, size_t len) for (; pp < pp1; pp++) { if (*pp == '_') *pd++ = ' '; - else if (*pp == '=' && - (!(pp[1] & ~127) && hexval (pp[1]) != -1) && - (!(pp[2] & ~127) && hexval (pp[2]) != -1)) { + else if (*pp == '=' && hexval(pp[1]) >= 0 && hexval(pp[2]) >= 0) { *pd++ = (hexval (pp[1]) << 4) | hexval (pp[2]); pp += 2; } @@ -788,7 +802,7 @@ void rfc2047_decode (char **pd) str_adjust (pd); } -void rfc2047_decode_adrlist (ADDRESS * a) +void rfc2047_decode_adrlist (address_t * a) { while (a) { if (a->personal)