+/*
+ * 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 <me@mutt.org>
#include <lib-lib/str.h>
#include <lib-lib/ascii.h>
+#include <lib-mime/mime.h>
+
#include "mutt.h"
-#include "mime.h"
#include "charset.h"
-#include "rfc2047.h"
#include "thread.h"
-
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#define CONTINUATION_BYTE(c) (((c) & 0xc0) == 0x80)
-extern char RFC822Specials[];
-
typedef size_t (*encoder_t) (char *, const char *, size_t,
const char *);
if (!dlen)
break;
else if (dlen == 1) {
- *s++ = B64Chars[(*d >> 2) & 0x3f];
- *s++ = B64Chars[(*d & 0x03) << 4];
+ *s++ = __m_b64chars[(*d >> 2) & 0x3f];
+ *s++ = __m_b64chars[(*d & 0x03) << 4];
*s++ = '=';
*s++ = '=';
break;
}
else if (dlen == 2) {
- *s++ = B64Chars[(*d >> 2) & 0x3f];
- *s++ = B64Chars[((*d & 0x03) << 4) | ((d[1] >> 4) & 0x0f)];
- *s++ = B64Chars[(d[1] & 0x0f) << 2];
+ *s++ = __m_b64chars[(*d >> 2) & 0x3f];
+ *s++ = __m_b64chars[((*d & 0x03) << 4) | ((d[1] >> 4) & 0x0f)];
+ *s++ = __m_b64chars[(d[1] & 0x0f) << 2];
*s++ = '=';
break;
}
else {
- *s++ = B64Chars[(*d >> 2) & 0x3f];
- *s++ = B64Chars[((*d & 0x03) << 4) | ((d[1] >> 4) & 0x0f)];
- *s++ = B64Chars[((d[1] & 0x0f) << 2) | ((d[2] >> 6) & 0x03)];
- *s++ = B64Chars[d[2] & 0x3f];
+ *s++ = __m_b64chars[(*d >> 2) & 0x3f];
+ *s++ = __m_b64chars[((*d & 0x03) << 4) | ((d[1] >> 4) & 0x0f)];
+ *s++ = __m_b64chars[((d[1] & 0x0f) << 2) | ((d[2] >> 6) & 0x03)];
+ *s++ = __m_b64chars[d[2] & 0x3f];
d += 3, dlen -= 3;
}
}
*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) {
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;
}
str_adjust (pd);
}
-void rfc2047_decode_adrlist (ADDRESS * a)
+void rfc2047_decode_adrlist (address_t * a)
{
while (a) {
if (a->personal)