diff options
Diffstat (limited to 'camel/providers')
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 24 | ||||
-rw-r--r-- | camel/providers/smtp/camel-smtp-transport.c | 16 |
2 files changed, 28 insertions, 12 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 722b6bbd9e..4e6e184c48 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -436,7 +436,7 @@ imap_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelExcept return; } - mem->buffer = g_byte_array_append(mem->buffer, g_strdup("\n"), 2); + mem->buffer = g_byte_array_append(mem->buffer, g_strdup("\r\n"), 3); status = camel_imap_command(CAMEL_IMAP_STORE (folder->parent_store), folder, &result, "APPEND %s (\\Seen) {%d}\r\n%s", @@ -605,13 +605,29 @@ message_changed (CamelMimeMessage *m, int type, CamelImapFolder *mf) static CamelMimeMessage * imap_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex) { - CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); - CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store); CamelImapStream *imap_stream; CamelMimeMessage *message; - gchar *cmdid, *cmdbuf; + CamelMimePart *part; + CamelDataWrapper *cdw; + gchar *cmdbuf; + + /* TODO: fetch the correct part, get rid of the hard-coded stuff */ + cmdbuf = g_strdup_printf("UID FETCH %s BODY[TEXT]", uid); + imap_stream = camel_imap_stream_new(folder, cmdbuf); + g_free(cmdbuf); + message = camel_mime_message_new(); + + cdw = camel_data_wrapper_new(); + camel_data_wrapper_construct_from_stream(cdw, imap_stream); + gtk_object_unref(GTK_OBJECT (imap_stream)); + camel_data_wrapper_set_mime_type (cdw, "text/plain"); + + camel_medium_set_content_object (CAMEL_MEDIUM (message), CAMEL_DATA_WRAPPER (cdw)); + gtk_object_unref (GTK_OBJECT (cdw)); + + return message; } #if 0 diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index 74ab08dc99..ed5f0416b3 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -37,7 +37,7 @@ #include <unistd.h> #undef MIN #undef MAX -#include "camel-mime-filter-smtp.h" +#include "camel-mime-filter-crlf.h" #include "camel-stream-filter.h" #include "camel-smtp-transport.h" #include "camel-mime-message.h" @@ -623,7 +623,7 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException * /* now we can actually send what's important :p */ gchar *cmdbuf, *respbuf = NULL; CamelStreamFilter *filtered_stream; - CamelMimeFilterSmtp *mimefilter; + CamelMimeFilter *mimefilter; gint id; /* enclose address in <>'s since some SMTP daemons *require* that */ @@ -631,7 +631,7 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException * fprintf (stderr, "sending : %s", cmdbuf); - if ( camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) { + if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) { g_free (cmdbuf); camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "DATA request timed out: " @@ -645,7 +645,7 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException * fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"); - if ( !respbuf || strncmp (respbuf, "354", 3) ) { + if (!respbuf || strncmp (respbuf, "354", 3) ) { /* we should have gotten instructions on how to use the DATA command: * 354 Enter mail, end with "." on a line by itself */ @@ -658,7 +658,7 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException * } /* setup stream filtering */ - mimefilter = camel_mime_filter_smtp_new (); + mimefilter = camel_mime_filter_crlf_new (CAMEL_MIME_FILTER_CRLF_ENCODE, CAMEL_MIME_FILTER_CRLF_MODE_CRLF_DOTS); filtered_stream = camel_stream_filter_new_with_stream (transport->ostream); id = camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (mimefilter)); @@ -693,14 +693,14 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException * fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"); - if ( !respbuf || strncmp (respbuf, "250", 3) ) { + if (!respbuf || strncmp (respbuf, "250", 3)) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "DATA response error: message termination: " "%s: mail not sent", g_strerror (errno)); return FALSE; } - } while ( *(respbuf+3) == '-' ); /* if we got "250-" then loop again */ + } while (*(respbuf+3) == '-'); /* if we got "250-" then loop again */ g_free (respbuf); return TRUE; @@ -733,7 +733,7 @@ smtp_rset (CamelSmtpTransport *transport, CamelException *ex) fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"); - if ( !respbuf || strncmp (respbuf, "250", 3) ) { + if (!respbuf || strncmp (respbuf, "250", 3)) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "RSET response error: " "%s", |