summaryrefslogtreecommitdiff
path: root/src/dm_misc.c
diff options
context:
space:
mode:
authorPaul J Stevens <paul@nfg.nl>2010-05-22 22:59:44 +0200
committerPaul J Stevens <paul@nfg.nl>2010-05-22 22:59:44 +0200
commitbe6cdee2f0c5a5fb483c46ad4a3df09e98db518a (patch)
tree155b736b9f1c09e09abd2800603cd62673375e4b /src/dm_misc.c
parent1e2458c3aaa9817778adeff3d86e5c0bf395dc50 (diff)
re-instate crlf encoding of all output from imap
Diffstat (limited to 'src/dm_misc.c')
-rw-r--r--src/dm_misc.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/dm_misc.c b/src/dm_misc.c
index 3919babb..fd319cf3 100644
--- a/src/dm_misc.c
+++ b/src/dm_misc.c
@@ -1934,24 +1934,27 @@ char * imap_get_envelope(GMimeMessage *message)
char * imap_get_logical_part(const GMimeObject *object, const char * specifier)
{
- gchar *t=NULL;
- GString *s = g_string_new("");
-
- if (strcasecmp(specifier,"HEADER")==0 || strcasecmp(specifier,"MIME")==0) {
+ gchar *s = NULL, *t=NULL;
+
+ if (specifier == NULL) {
+ t = g_mime_object_to_string(GMIME_OBJECT(object));
+ s = get_crlf_encoded(t);
+ g_free(t);
+ }
+
+ else if (strcasecmp(specifier,"HEADER")==0 || strcasecmp(specifier,"MIME")==0) {
t = g_mime_object_get_headers(GMIME_OBJECT(object));
- g_string_printf(s,"%s\n", t);
+ s = get_crlf_encoded(t);
g_free(t);
}
else if (strcasecmp(specifier,"TEXT")==0) {
t = g_mime_object_get_body(GMIME_OBJECT(object));
- g_string_printf(s,"%s",t);
+ s = get_crlf_encoded(t);
g_free(t);
- }
+ }
- t = s->str;
- g_string_free(s,FALSE);
- return t;
+ return s;
}