From 1907e8767d37ca3fd04482eaa5635cefe41732e4 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Tue, 9 Dec 2003 00:58:46 +0000 Subject: encode the address before sending it out, rather than using the raw/utf8 2003-12-09 Not Zed * providers/smtp/camel-smtp-transport.c (smtp_send_to): encode the address before sending it out, rather than using the raw/utf8 version. * camel-internet-address.c (camel_internet_address_encode_address): check for quoting the local part of the address before outputting it. (cia_encode_addrspec): quote local part if need be. (camel_internet_address_encode_address): make folding optional based on whether inlen is null or not. * camel-mime-utils.[ch]: rename is_* to camel_mime_is_* and export the type functions. 2003-12-08 Not Zed * providers/imap/camel-imap-utils.c (imap_atom_specials): add } to the atom specials list. This isn't correct, but some busted servers expect it. Bug #50728. 2003-12-02 Not Zed * providers/local/camel-local-folder.c (local_setv): remove some debug printfs. ** See bug #51576. * camel-url.c (camel_url_decode): robustify url decoding for bad input, addresses a crash. svn path=/trunk/; revision=23676 --- camel/camel-mime-utils.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'camel/camel-mime-utils.h') diff --git a/camel/camel-mime-utils.h b/camel/camel-mime-utils.h index d6274d5e2e..efa5b7835a 100644 --- a/camel/camel-mime-utils.h +++ b/camel/camel-mime-utils.h @@ -239,6 +239,33 @@ size_t camel_quoted_decode_close (unsigned char *in, size_t len, unsigned char * char *camel_base64_encode_simple (const char *data, size_t len); size_t camel_base64_decode_simple (char *data, size_t len); +/* camel ctype type functions for rfc822/rfc2047/other, which are non-locale specific */ +enum { + CAMEL_MIME_IS_CTRL = 1<<0, + CAMEL_MIME_IS_LWSP = 1<<1, + CAMEL_MIME_IS_TSPECIAL = 1<<2, + CAMEL_MIME_IS_SPECIAL = 1<<3, + CAMEL_MIME_IS_SPACE = 1<<4, + CAMEL_MIME_IS_DSPECIAL = 1<<5, + CAMEL_MIME_IS_QPSAFE = 1<<6, + CAMEL_MIME_IS_ESAFE = 1<<7, /* encoded word safe */ + CAMEL_MIME_IS_PSAFE = 1<<8, /* encoded word in phrase safe */ +}; + +extern unsigned short camel_mime_special_table[256]; + +#define camel_mime_is_ctrl(x) ((camel_mime_special_table[(unsigned char)(x)] & CAMEL_MIME_IS_CTRL) != 0) +#define camel_mime_is_lwsp(x) ((camel_mime_special_table[(unsigned char)(x)] & CAMEL_MIME_IS_LWSP) != 0) +#define camel_mime_is_tspecial(x) ((camel_mime_special_table[(unsigned char)(x)] & CAMEL_MIME_IS_TSPECIAL) != 0) +#define camel_mime_is_type(x, t) ((camel_mime_special_table[(unsigned char)(x)] & (t)) != 0) +#define camel_mime_is_ttoken(x) ((camel_mime_special_table[(unsigned char)(x)] & (CAMEL_MIME_IS_TSPECIAL|CAMEL_MIME_IS_LWSP|CAMEL_MIME_IS_CTRL)) == 0) +#define camel_mime_is_atom(x) ((camel_mime_special_table[(unsigned char)(x)] & (CAMEL_MIME_IS_SPECIAL|CAMEL_MIME_IS_SPACE|CAMEL_MIME_IS_CTRL)) == 0) +#define camel_mime_is_dtext(x) ((camel_mime_special_table[(unsigned char)(x)] & CAMEL_MIME_IS_DSPECIAL) == 0) +#define camel_mime_is_fieldname(x) ((camel_mime_special_table[(unsigned char)(x)] & (CAMEL_MIME_IS_CTRL|CAMEL_MIME_IS_SPACE)) == 0) +#define camel_mime_is_qpsafe(x) ((camel_mime_special_table[(unsigned char)(x)] & CAMEL_MIME_IS_QPSAFE) != 0) +#define camel_mime_is_especial(x) ((camel_mime_special_table[(unsigned char)(x)] & CAMEL_MIME_IS_ESPECIAL) != 0) +#define camel_mime_is_psafe(x) ((camel_mime_special_table[(unsigned char)(x)] & CAMEL_MIME_IS_PSAFE) != 0) + #ifdef __cplusplus } #endif /* __cplusplus */ -- cgit v1.2.3