diff options
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 7 | ||||
-rw-r--r-- | camel/providers/imap/Makefile.am | 4 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 198 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-folder.h | 5 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 10 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-store.h | 2 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-summary.h | 7 | ||||
-rw-r--r-- | camel/providers/smtp/camel-smtp-transport.c | 230 |
8 files changed, 263 insertions, 200 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 1d2a31e8f5..5c6e410388 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,10 @@ +2000-06-06 Jeffrey Stedfast <fejj@helixcode.com> + + * providers/imap/camel-imap-*.[c,h]: Started on getting + imap to build cleanly (tho some work has not been completed + so it still won't build until camel-imap-summary is finished + along with a few methods in camel-imap-folder) + 2000-06-05 Dan Winship <danw@helixcode.com> * camel-mime-part.c (camel_mime_part_set_disposition): fix diff --git a/camel/providers/imap/Makefile.am b/camel/providers/imap/Makefile.am index 00cad46ec2..2243841bd9 100644 --- a/camel/providers/imap/Makefile.am +++ b/camel/providers/imap/Makefile.am @@ -39,3 +39,7 @@ libcamelimap_la_LIBADD = $(top_builddir)/e-util/libeutil.la $(top_builddir)/libi EXTRA_DIST = libcamelimap.urls + + + + diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index ef4df4b4ce..443e1b8fbf 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -37,7 +37,10 @@ #include "camel-imap-folder.h" #include "camel-imap-store.h" #include "string-utils.h" +#include "camel-stream.h" #include "camel-stream-fs.h" +#include "camel-stream-mem.h" +#include "camel-stream-buffer.h" #include "camel-data-wrapper.h" #include "camel-mime-message.h" #include "camel-stream-filter.h" @@ -49,8 +52,8 @@ static CamelFolderClass *parent_class = NULL; static void imap_init (CamelFolder *folder, CamelStore *parent_store, - CamelFolder *parent_folder, const gchar *name, - gchar separator, CamelException *ex); + CamelFolder *parent_folder, const gchar *name, + gchar separator, CamelException *ex); static void imap_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex); static void imap_close (CamelFolder *folder, gboolean expunge, CamelException *ex); @@ -164,10 +167,10 @@ camel_imap_folder_get_type (void) CamelFolder * camel_imap_folder_new (CamelStore *parent, CamelException *ex) { - /* TODO: code this */ + /* TODO: code this - do we need this? */ CamelFolder *folder = CAMEL_FOLDER (gtk_object_new (camel_imap_folder_get_type (), NULL)); - CF_CLASS (folder)->init (folder, parent, NULL, "inbox", '/', ex); + CAMEL_FOLDER_CLASS (folder)->init (folder, parent, NULL, "inbox", '/', ex); return folder; } @@ -224,8 +227,10 @@ imap_init (CamelFolder *folder, CamelStore *parent_store, CamelFolder *parent_fo root_dir_path = camel_imap_store_get_toplevel_dir (CAMEL_IMAP_STORE(folder->parent_store)); imap_folder->folder_file_path = g_strdup_printf ("%s/%s", root_dir_path, folder->full_name); +#if 0 imap_folder->folder_dir_path = g_strdup_printf ("%s/%s.sdb", root_dir_path, folder->full_name); imap_folder->index_file_path = g_strdup_printf ("%s/%s.ibex", root_dir_path, folder->full_name); +#endif } static void @@ -242,7 +247,7 @@ imap_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex) /* SELECT the IMAP mail spool */ status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), &result, - "SELECT %s", imap_folder->folder_file_path); + "SELECT %s", imap_folder->folder_file_path); if (status != CAMEL_IMAP_OK) { CamelService *service = CAMEL_SERVICE (folder->parent_store); @@ -267,12 +272,14 @@ imap_close (CamelFolder *folder, gboolean expunge, CamelException *ex) camel_imap_store_close (CAMEL_IMAP_STORE (folder->parent_store), expunge, ex); if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_NONE) parent_class->close (folder, expunge, ex); + + } static void imap_expunge (CamelFolder *folder, CamelException *ex) { - CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); + /*CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);*/ gchar *result; gint status; @@ -298,9 +305,11 @@ imap_expunge (CamelFolder *folder, CamelException *ex) static gboolean imap_exists (CamelFolder *folder, CamelException *ex) { - /* TODO: look at Mbox code and figure out exactly what needs to be done here */ - CamelImapFolder *imap_folder; - gboolean exists; + /* make sure the folder exists */ + CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); + GPtrArray *lsub; + gboolean exists = FALSE; + int i, max; g_return_val_if_fail (folder != NULL, FALSE); @@ -320,7 +329,21 @@ imap_exists (CamelFolder *folder, CamelException *ex) return FALSE; } - /* TODO: Finish coding this. */ + /* Get a listing of the folders that exist */ + lsub = imap_get_subfolder_names (folder, ex); + + /* look to see if any of those subfolders match... */ + max = lsub->len; + for (i = 0; i < max; i++) + if (!strcmp(g_ptr_array_index(lsub, i), imap_folder->folder_file_path)) + { + exists = TRUE; + break; + } + + g_ptr_array_free (lsub, TRUE); + + return exists; } static gboolean @@ -348,7 +371,6 @@ imap_create (CamelFolder *folder, CamelException *ex) "invalid folder path. Use set_name ?"); return FALSE; } - /* if the folder already exists, simply return */ folder_already_exists = camel_folder_exists (folder, ex); @@ -358,7 +380,6 @@ imap_create (CamelFolder *folder, CamelException *ex) if (folder_already_exists) return TRUE; - /* create the directory for the subfolder */ status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), &result, "CREATE %s", imap_folder->folder_file_path); @@ -427,18 +448,19 @@ imap_delete (CamelFolder *folder, gboolean recurse, CamelException *ex) return TRUE; } -/* TODO: remove this */ +/* TODO: remove this - don't bother coding, it'll be moved/removed */ gboolean imap_delete_messages (CamelFolder *folder, CamelException *ex) { /* TODO: delete the messages (mark as deleted/whatever) */ +#if 0 CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); gchar *result; gint status; +#endif g_return_val_if_fail (folder != NULL, FALSE); - return TRUE; } @@ -453,10 +475,10 @@ imap_get_message_count (CamelFolder *folder, CamelException *ex) /* If we already have a count, return */ if (imap_folder->count != -1) - imap_folder->count; + return imap_folder->count; status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), &result, - "STATUS %s (MESSAGES)", imap_folder->folder_file_path); + "STATUS %s (MESSAGES)", imap_folder->folder_file_path); if (status != CAMEL_IMAP_OK) { CamelService *service = CAMEL_SERVICE (folder->parent_store); @@ -471,10 +493,11 @@ imap_get_message_count (CamelFolder *folder, CamelException *ex) /* parse out the message count - should come in the form: "* STATUS <folder> (MESSAGES <count>)\r\n" */ if (result && *result == '*') { - /* FIXME: This should really be rewritten to not depend on absolute spacing */ - if (msg_count = strstr(result, "MESSAGES")) { + if ((msg_count = strstr(result, "MESSAGES")) != NULL) { msg_count += strlen("MESSAGES") + 1; + for ( ; *msg_count == ' '; msg_count++); + /* we should now be pointing to the message count */ imap_folder->count = atoi(msg_count); } @@ -490,17 +513,17 @@ static void imap_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex) { CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); - CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store); - CamelStreamBuffer *stream = CAMEL_STREAM_BUFFER (store->istream); CamelStreamMem *mem; - gchar *cmdid, *respbuf; + gchar *result; + gint status; g_return_if_fail (folder != NULL); g_return_if_fail (message != NULL); /* write the message to a CamelStreamMem so we can get it's size */ - mem = CAMEL_STREAM_MEM (camel_stream_mem_new()); + mem = camel_stream_mem_new(); if (camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), CAMEL_STREAM (mem)) == -1) { + CamelService *service = CAMEL_SERVICE (folder->parent_store); camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "Could not APPEND message to IMAP server %s: %s.", service->url->host, @@ -509,8 +532,9 @@ imap_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelExcept return; } - mem->buffer = g_byte_array_append(mem->buffer, g_strdup("\n")); + mem->buffer = g_byte_array_append(mem->buffer, g_strdup("\n"), 2); status = camel_imap_command(CAMEL_IMAP_STORE (folder->parent_store), + &result, "APPEND %s (\\Seen) {%d}\r\n%s", imap_folder->folder_file_path, mem->buffer->len, @@ -534,43 +558,38 @@ imap_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelExcept static GPtrArray * imap_get_uids (CamelFolder *folder, CamelException *ex) { - return g_ptr_array_new(); -#if 0 - /* TODO: Find out what this is actually supposed to do */ - GPtrArray *array; CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); + CamelImapMessageInfo *info; + GPtrArray *array; gint i, count; - count = camel_folder_summary_count((CamelFolderSummary *)imap_folder->summary); + count = camel_folder_summary_count(CAMEL_FOLDER_SUMMARY (imap_folder->summary)); array = g_ptr_array_new (); g_ptr_array_set_size (array, count); for (i = 0; i < count; i++) { - CamelImapMessageInfo *info = - (CamelImapMessageInfo *)camel_folder_summary_index((CamelFolderSummary *)imap_folder->summary, i); + info = CAMEL_IMAP_MESSAGE_INFO (camel_folder_summary_index(CAMEL_FOLDER_SUMMARY (imap_folder->summary), i)); array->pdata[i] = g_strdup(info->info.uid); } return array; -#endif } static GPtrArray * imap_get_subfolder_names (CamelFolder *folder, CamelException *ex) { - /* NOTE: use LSUB or LIST - preferably LSUB but I managed with LIST in Spruce */ CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); GPtrArray *listing; gint status; gchar *result; - + g_return_val_if_fail (folder != NULL, g_ptr_array_new()); - + if (imap_folder->count != -1) - imap_folder->count; - + return g_ptr_array_new (); + status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), &result, - "LSUB \"\" \"%s\"", imap_folder->folder_file_path); - + "LSUB \"\" \"%s\"", imap_folder->folder_file_path); + if (status != CAMEL_IMAP_OK) { CamelService *service = CAMEL_SERVICE (folder->parent_store); camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, @@ -581,18 +600,20 @@ imap_get_subfolder_names (CamelFolder *folder, CamelException *ex) g_free (result); return g_ptr_array_new (); } - + /* parse out the subfolders */ listing = g_ptr_array_new (); + g_ptr_array_add(listing, g_strdup("INBOX")); if (result) { - ptr = result; + char *ptr = result; + while (*ptr == '*') { - gchar *flags, *param, *end, *dir_sep; - + gchar *flags, *end, *dir_sep, *param = NULL; + ptr = flags = strchr(ptr, '(') + 1; /* jump to the flags section */ end = strchr(flags, ')'); /* locate end of flags */ - flags = strndup(flags, (gint)(end - flags)); - + flags = g_strndup(flags, (gint)(end - flags)); + if (strstr(flags, "\\NoSelect")) { g_free(flags); continue; @@ -608,7 +629,7 @@ imap_get_subfolder_names (CamelFolder *folder, CamelException *ex) for (end = ptr; *end && *end != '\n'; end++); param = g_strndup(ptr, (gint)(end - ptr)); - g_ptr_array_add (listing, param); + g_ptr_array_add(listing, param); g_free(dir_sep); /* TODO: decide if we really need dir_sep */ @@ -624,19 +645,20 @@ imap_get_subfolder_names (CamelFolder *folder, CamelException *ex) } static void -imap_delete_message_by_uid(CamelFolder *folder, const gchar *uid, CamelException *ex) +imap_delete_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex) { - CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); + /*CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);*/ gchar *result; gint status; status = camel_imap_command_extended(CAMEL_IMAP_STORE (folder->parent_store), - "STORE %s +FLAGS.SILENT (\\Deleted)", uid); + &result, "UID STORE %s +FLAGS.SILENT (\\Deleted)", uid); if (status != CAMEL_IMAP_OK) { CamelService *service = CAMEL_SERVICE (folder->parent_store); + camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, - "Could not mark message %s as 'Deleted' on IMAP server %s: %s" + "Could not mark message %s as 'Deleted' on IMAP server %s: %s", uid, service->url->host, status == CAMEL_IMAP_ERR ? result : "Unknown error"); @@ -650,19 +672,15 @@ imap_delete_message_by_uid(CamelFolder *folder, const gchar *uid, CamelException /* track flag changes in the summary */ static void -message_changed(CamelMimeMessage *m, int type, CamelImapFolder *mf) +message_changed (CamelMimeMessage *m, int type, CamelImapFolder *mf) { - return; - -#if 0 - /* TODO: find a way to do this in IMAP - will probably not be easy */ CamelMessageInfo *info; CamelFlag *flag; printf("Message changed: %s: %d\n", m->message_uid, type); switch (type) { case MESSAGE_FLAGS_CHANGED: - info = camel_folder_summary_uid((CamelFolderSummary *)mf->summary, m->message_uid); + info = camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY (mf->summary), m->message_uid); if (info) { info->flags = m->flags | CAMEL_MESSAGE_FOLDER_FLAGGED; camel_flag_list_free(&info->user_flags); @@ -671,7 +689,7 @@ message_changed(CamelMimeMessage *m, int type, CamelImapFolder *mf) camel_flag_set(&info->user_flags, flag->name, TRUE); flag = flag->next; } - camel_folder_summary_touch((CamelFolderSummary *)mf->summary); + camel_folder_summary_touch(CAMEL_FOLDER_SUMMARY (mf->summary)); } else g_warning("Message changed event on message not in summary: %s", m->message_uid); break; @@ -679,7 +697,6 @@ message_changed(CamelMimeMessage *m, int type, CamelImapFolder *mf) printf("Unhandled message change event: %d\n", type); break; } -#endif } static CamelMimeMessage * @@ -687,15 +704,15 @@ imap_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException * { /* NOTE: extremely easy to do in IMAP - just needa code it ;-) */ CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); - CamelStream *message_stream = NULL; + CamelStreamMem *message_stream = NULL; CamelMimeMessage *message = NULL; CamelImapMessageInfo *info; CamelMimeParser *parser = NULL; - gchar *buffer; - gint len; + gchar *buffer, *result; + gint len, status; /* get the message summary info */ - info = (CamelImapMessageInfo *)camel_folder_summary_uid((CamelFolderSummary *)imap_folder->summary, uid); + info = (CamelImapMessageInfo *)camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY (imap_folder->summary), uid); if (info == NULL) { errno = ENOENT; @@ -706,8 +723,24 @@ imap_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException * g_assert(info->info.content); g_assert(info->frompos != -1); + /* get our message buffer */ + status = camel_imap_command_extended(CAMEL_IMAP_STORE (folder->parent_store), + &result, "UID FETCH %s (FLAGS BODY[])", uid); + + if (status != CAMEL_IMAP_OK) { + CamelService *service = CAMEL_SERVICE (folder->parent_store); + + camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, + "Could not mark message %s as 'Deleted' on IMAP server %s: %s", + uid, service->url->host, + status == CAMEL_IMAP_ERR ? result : + "Unknown error"); + g_free (result); + return; + } + /* where we read from */ - message_stream = camel_stream_fs_new_with_name (imap_folder->folder_file_path, O_RDONLY, 0); + message_stream = camel_stream_mem_new_with_buffer (result, strlen(result)); if (message_stream == NULL) goto fail; @@ -724,13 +757,15 @@ imap_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException * } if (camel_mime_parser_tell_start_from(parser) != info->frompos) { - g_warning("Summary doesn't match the folder contents! eek!"); + g_warning("Summary doesn't match the folder contents! eek!" + " expecting offset %ld got %ld", (long int)info->frompos, + (long int)camel_mime_parser_tell_start_from(parser)); errno = EINVAL; goto fail; } message = camel_mime_message_new(); - if (camel_mime_part_construct_from_parser((CamelMimePart *)message, parser) == -1) { + if (camel_mime_part_construct_from_parser(CAMEL_MIME_PART (message), parser) == -1) { g_warning("Construction failed"); goto fail; } @@ -746,15 +781,15 @@ imap_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException * return message; -fail: + fail: camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, "Cannot get message: %s", g_strerror(errno)); if (parser) - gtk_object_unref((GtkObject *)parser); + gtk_object_unref(GTK_OBJECT (parser)); if (message) - gtk_object_unref((GtkObject *)message); + gtk_object_unref(GTK_OBJECT (message)); return NULL; } @@ -763,33 +798,33 @@ GPtrArray * imap_get_summary (CamelFolder *folder, CamelException *ex) { /* TODO: what should we do here?? */ - CamelImapFolder *imap_folder = (CamelImapFolder *)folder; + CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); - return ((CamelFolderSummary *)imap_folder->summary)->messages; + return CAMEL_FOLDER_SUMMARY (imap_folder->summary)->messages; } void imap_free_summary (CamelFolder *folder, GPtrArray *array) { - /* This is IMAP dude, no need to free a summary */ + /* no-op */ return; } /* get a single message info, by uid */ static const CamelMessageInfo * -imap_summary_get_by_uid(CamelFolder *f, const char *uid) +imap_summary_get_by_uid (CamelFolder *f, const char *uid) { /* TODO: what do we do here? */ - CamelImapFolder *imap_folder = (CamelImapFolder *)f; + CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (f); - return camel_folder_summary_uid((CamelFolderSummary *)imap_folder->summary, uid); + return camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY (imap_folder->summary), uid); } static GList * -imap_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex) +imap_search_by_expression (CamelFolder *folder, const char *expression, CamelException *ex) { /* TODO: find a good way of doing this */ - CamelImapFolder *imap_folder = (CamelImapFolder *)folder; + CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); if (imap_folder->search == NULL) { imap_folder->search = camel_folder_search_new(); @@ -798,7 +833,8 @@ imap_search_by_expression(CamelFolder *folder, const char *expression, CamelExce camel_folder_search_set_folder(imap_folder->search, folder); if (imap_folder->summary) /* FIXME: dont access summary array directly? */ - camel_folder_search_set_summary(imap_folder->search, ((CamelFolderSummary *)imap_folder->summary)->messages); + camel_folder_search_set_summary(imap_folder->search, + CAMEL_FOLDER_SUMMARY (imap_folder->summary)->messages); camel_folder_search_set_body_index(imap_folder->search, imap_folder->index); return camel_folder_search_execute_expression(imap_folder->search, expression, ex); @@ -808,3 +844,13 @@ imap_search_by_expression(CamelFolder *folder, const char *expression, CamelExce + + + + + + + + + + diff --git a/camel/providers/imap/camel-imap-folder.h b/camel/providers/imap/camel-imap-folder.h index 54605cfb35..479a43c45c 100644 --- a/camel/providers/imap/camel-imap-folder.h +++ b/camel/providers/imap/camel-imap-folder.h @@ -35,6 +35,9 @@ extern "C" { #include <gtk/gtk.h> #include "camel-folder.h" +#include "camel-imap-summary.h" +#include <camel/camel-folder-search.h> +#include <libibex/ibex.h> #define CAMEL_IMAP_FOLDER_TYPE (camel_imap_folder_get_type ()) #define CAMEL_IMAP_FOLDER(obj) (GTK_CHECK_CAST((obj), CAMEL_IMAP_FOLDER_TYPE, CamelImapFolder)) @@ -51,6 +54,8 @@ typedef struct { ibex *index; /* index for this folder */ CamelImapSummary *summary; CamelFolderSearch *search; /* used to run searches, we just use the real thing (tm) */ + + gint count; } CamelImapFolder; diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 2e6c2b3d9c..54ce3c570c 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -334,7 +334,7 @@ static CamelFolder * what was there before, and there's no * CamelImapFolder::get_subfolder yet anyway... */ - CF_CLASS (new_folder)->init (new_folder, store, NULL, + CAMEL_FOLDER_CLASS (new_folder)->init (new_folder, store, NULL, folder_name, '/', ex); return new_folder; @@ -464,9 +464,9 @@ camel_imap_command_extended (CamelImapStore *store, char **ret, char *fmt, ...) /* Create the command */ cmdid = g_strdup_printf("A%.5d", store->command++); - va_start (ap, fmt); - cmdbuf = g_strdup_vprintf (fmt, ap); - va_end (ap); + va_start (app, fmt); + cmdbuf = g_strdup_vprintf (fmt, app); + va_end (app); fprintf(stderr, "sending : %s %s\r\n", cmdid, cmdbuf); @@ -518,7 +518,7 @@ camel_imap_command_extended (CamelImapStore *store, char **ret, char *fmt, ...) *ret = g_strjoinv ("\n", (gchar **)data->pdata); } else { if (status != CAMEL_IMAP_FAIL) - *ret = g_strdup (strchr (respbuf, ' ' + 1); + *ret = g_strdup (strchr (respbuf, ' ' + 1)); else *ret = NULL; } diff --git a/camel/providers/imap/camel-imap-store.h b/camel/providers/imap/camel-imap-store.h index fc6ac9b61c..5ea6eca09e 100644 --- a/camel/providers/imap/camel-imap-store.h +++ b/camel/providers/imap/camel-imap-store.h @@ -68,7 +68,7 @@ void camel_imap_store_close (CamelImapStore *store, gboolean expunge, enum { CAMEL_IMAP_OK, CAMEL_IMAP_ERR, CAMEL_IMAP_FAIL }; gint camel_imap_command (CamelImapStore *store, char **ret, char *fmt, ...); -gchar *camel_imap_command_extended (CamelImapStore *store, char **ret, char *fmt, ...); +gint camel_imap_command_extended (CamelImapStore *store, char **ret, char *fmt, ...); /* Standard Gtk function */ GtkType camel_imap_store_get_type (void); diff --git a/camel/providers/imap/camel-imap-summary.h b/camel/providers/imap/camel-imap-summary.h index 437331ce30..d17a5ebcd6 100644 --- a/camel/providers/imap/camel-imap-summary.h +++ b/camel/providers/imap/camel-imap-summary.h @@ -1,3 +1,4 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* * Copyright (C) 2000 Helix Code Inc. * @@ -70,12 +71,12 @@ guint camel_imap_summary_get_type (void); CamelImapSummary *camel_imap_summary_new (const char *filename, const char *imap_name, ibex *index); /* load/check the summary */ -int camel_imap_summary_load(CamelImapSummary *mbs, int forceindex); +int camel_imap_summary_load (CamelImapSummary *mbs, int forceindex); /* incremental update */ -int camel_imap_summary_update(CamelImapSummary *mbs, off_t offset); +int camel_imap_summary_update (CamelImapSummary *mbs, off_t offset); /* perform a folder expunge */ -int camel_imap_summary_expunge(CamelImapSummary *mbs); +int camel_imap_summary_expunge (CamelImapSummary *mbs); #endif /* ! _CAMEL_IMAP_SUMMARY_H */ diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index c1523f4142..1ce7d8b0f3 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -163,8 +163,8 @@ smtp_connect (CamelService *service, CamelException *ex) } /* get the localaddr - needed later by smtp_helo */ - addrlen = sizeof(transport->localaddr); - getsockname(fd, (struct sockaddr*)&transport->localaddr, &addrlen); + addrlen = sizeof (transport->localaddr); + getsockname (fd, (struct sockaddr*)&transport->localaddr, &addrlen); transport->ostream = camel_stream_fs_new_with_fd (fd); transport->istream = camel_stream_buffer_new (transport->ostream, @@ -173,37 +173,37 @@ smtp_connect (CamelService *service, CamelException *ex) /* Read the greeting, note whether the server is ESMTP and if it requests AUTH. */ do { /* Check for "220" */ - g_free(respbuf); + g_free (respbuf); respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream)); - if ( !respbuf || strncmp(respbuf, "220", 3) ) { + if ( !respbuf || strncmp (respbuf, "220", 3) ) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "Welcome response error: " "%s: possibly non-fatal", g_strerror (errno)); return FALSE; } - if (strstr(respbuf, "ESMTP")) + if (strstr (respbuf, "ESMTP")) transport->smtp_is_esmtp = TRUE; } while ( *(respbuf+3) == '-' ); /* if we got "220-" then loop again */ - g_free(respbuf); + g_free (respbuf); /* send HELO (or EHLO, depending on the service type) */ - smtp_helo(transport, ex); + smtp_helo (transport, ex); /* check to see if AUTH is required, if so...then AUTH ourselves */ if (transport->smtp_is_esmtp && transport->esmtp_supported_authtypes) { /* not really supported yet, but we can at least show what auth types are supported */ - fprintf(stderr, "camel-smtp-transport::connect(): %s requires AUTH\n", service->url->host); - num = g_list_length(transport->esmtp_supported_authtypes); + fprintf (stderr, "camel-smtp-transport::connect(): %s requires AUTH\n", service->url->host); + num = g_list_length (transport->esmtp_supported_authtypes); for (i = 0; i < num; i++) - fprintf(stderr, "\nSupported AUTH: %s\n\n", - (gchar *) g_list_nth_data(transport->esmtp_supported_authtypes, i)); + fprintf (stderr, "\nSupported AUTH: %s\n\n", + (gchar *) g_list_nth_data (transport->esmtp_supported_authtypes, i)); - g_list_free(transport->esmtp_supported_authtypes); + g_list_free (transport->esmtp_supported_authtypes); transport->esmtp_supported_authtypes = NULL; } else { - fprintf(stderr, "\ncamel-smtp-transport::connect(): provider does not use AUTH\n\n"); + fprintf (stderr, "\ncamel-smtp-transport::connect(): provider does not use AUTH\n\n"); } return TRUE; @@ -223,7 +223,7 @@ smtp_disconnect (CamelService *service, CamelException *ex) if (!service_class->disconnect (service, ex)) return FALSE; - g_free(transport->esmtp_supported_authtypes); + g_free (transport->esmtp_supported_authtypes); transport->esmtp_supported_authtypes = NULL; gtk_object_unref (GTK_OBJECT (transport->ostream)); gtk_object_unref (GTK_OBJECT (transport->istream)); @@ -234,12 +234,12 @@ smtp_disconnect (CamelService *service, CamelException *ex) } static GList -*esmtp_get_authtypes(gchar *buffer) +*esmtp_get_authtypes (gchar *buffer) { GList *ret = NULL; gchar *start, *end; - if (!(start = strstr(buffer, " AUTH "))) + if (!(start = strstr (buffer, " AUTH "))) return NULL; /* advance to the first token */ @@ -249,7 +249,7 @@ static GList /* advance to the end of the token */ for (end = start; *end && *end != ' '; end++); - ret = g_list_append(ret, g_strndup(start, end - start)); + ret = g_list_append (ret, g_strndup (start, end - start)); /* advance to the next token */ for (start = end; *start && *start != ' '; start++); @@ -308,9 +308,9 @@ _send_to (CamelTransport *transport, CamelMedium *message, GList *r; gchar *recipient, *s, *sender; guint i, len; - CamelSmtpTransport *smtp_transport = CAMEL_SMTP_TRANSPORT(transport); + CamelSmtpTransport *smtp_transport = CAMEL_SMTP_TRANSPORT (transport); - s = g_strdup(camel_mime_message_get_from (CAMEL_MIME_MESSAGE(message))); + s = g_strdup(camel_mime_message_get_from (CAMEL_MIME_MESSAGE (message))); if (!s) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "Cannot send message: " @@ -318,10 +318,10 @@ _send_to (CamelTransport *transport, CamelMedium *message, return FALSE; } - sender = smtp_get_email_addr_from_text(s); - smtp_mail(smtp_transport, sender, ex); - g_free(sender); - g_free(s); + sender = smtp_get_email_addr_from_text (s); + smtp_mail (smtp_transport, sender, ex); + g_free (sender); + g_free (s); if (!(len = g_list_length(recipients))) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, @@ -331,19 +331,19 @@ _send_to (CamelTransport *transport, CamelMedium *message, } for (i = 0, r = recipients; i < len; i++, r = r->next) { - recipient = smtp_get_email_addr_from_text(r->data); - if (!smtp_rcpt(smtp_transport, recipient, ex)) { - g_free(recipient); + recipient = smtp_get_email_addr_from_text (r->data); + if (!smtp_rcpt (smtp_transport, recipient, ex)) { + g_free (recipient); return FALSE; } - g_free(recipient); + g_free (recipient); } - if (!smtp_data(smtp_transport, message, ex)) + if (!smtp_data (smtp_transport, message, ex)) return FALSE; /* reset the service for our next transfer session */ - smtp_rset(smtp_transport, ex); + smtp_rset (smtp_transport, ex); return TRUE; } @@ -356,35 +356,35 @@ _send (CamelTransport *transport, CamelMedium *message, GList *recipients = NULL; guint index, len; - to = camel_mime_message_get_recipients ((CamelMimeMessage *) message, CAMEL_RECIPIENT_TYPE_TO); - cc = camel_mime_message_get_recipients ((CamelMimeMessage *) message, CAMEL_RECIPIENT_TYPE_CC); - bcc = camel_mime_message_get_recipients ((CamelMimeMessage *) message, CAMEL_RECIPIENT_TYPE_BCC); + to = camel_mime_message_get_recipients (CAMEL_MIME_MESSAGE (message), CAMEL_RECIPIENT_TYPE_TO); + cc = camel_mime_message_get_recipients (CAMEL_MIME_MESSAGE (message), CAMEL_RECIPIENT_TYPE_CC); + bcc = camel_mime_message_get_recipients (CAMEL_MIME_MESSAGE (message), CAMEL_RECIPIENT_TYPE_BCC); /* get all of the To addresses into our recipient list */ - len = ((CamelAddress *)to)->addresses->len; + len = CAMEL_ADDRESS (to)->addresses->len; for (index = 0; index < len; index++) { const char *addr; - if (camel_internet_address_get(to, index, NULL, &addr)) - recipients = g_list_append(recipients, g_strdup(addr)); + if (camel_internet_address_get (to, index, NULL, &addr)) + recipients = g_list_append (recipients, g_strdup (addr)); } /* get all of the Cc addresses into our recipient list */ - len = ((CamelAddress *)cc)->addresses->len; + len = CAMEL_ADDRESS (cc)->addresses->len; for (index = 0; index < len; index++) { const char *addr; - if (camel_internet_address_get(cc, index, NULL, &addr)) - recipients = g_list_append(recipients, g_strdup(addr)); + if (camel_internet_address_get (cc, index, NULL, &addr)) + recipients = g_list_append (recipients, g_strdup (addr)); } /* get all of the Bcc addresses into our recipient list */ - len = ((CamelAddress *)bcc)->addresses->len; + len = CAMEL_ADDRESS (bcc)->addresses->len; for (index = 0; index < len; index++) { const char *addr; - if (camel_internet_address_get(bcc, index, NULL, &addr)) - recipients = g_list_append(recipients, g_strdup(addr)); + if (camel_internet_address_get (bcc, index, NULL, &addr)) + recipients = g_list_append (recipients, g_strdup (addr)); } return _send_to (transport, message, recipients, ex); @@ -445,7 +445,7 @@ static gchar /* now addr_strt & addr_end point to the beginning & ending of the email addy */ /* copy the string into addr */ - addr = g_strndup(addr_strt, (gint)(addr_end - addr_strt + 1)); + addr = g_strndup (addr_strt, (gint)(addr_end - addr_strt + 1)); for (ptr1 = addr_strt; ptr1 <= addr_end; ptr1++) /* look for an '@' sign */ if (*ptr1 == '@') @@ -457,13 +457,13 @@ static gchar */ gchar hostname[MAXHOSTNAMELEN]; - if (gethostname(hostname, MAXHOSTNAMELEN)) { - g_free(addr); + if (gethostname (hostname, MAXHOSTNAMELEN)) { + g_free (addr); return NULL; } tmp = addr; - addr = g_strconcat(tmp, "@", hostname, NULL); - g_free(tmp); + addr = g_strconcat (tmp, "@", hostname, NULL); + g_free (tmp); } return addr; @@ -477,48 +477,48 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex) struct hostent *host; /* get the local host name */ - host = gethostbyaddr((gchar *)&transport->localaddr.sin_addr, sizeof(transport->localaddr.sin_addr), AF_INET); + host = gethostbyaddr ((gchar *)&transport->localaddr.sin_addr, sizeof (transport->localaddr.sin_addr), AF_INET); /* hiya server! how are you today? */ if (transport->smtp_is_esmtp) cmdbuf = g_strdup_printf ("EHLO %s\r\n", host && host->h_name ? host->h_name : - inet_ntoa(transport->localaddr.sin_addr)); + inet_ntoa (transport->localaddr.sin_addr)); else cmdbuf = g_strdup_printf ("HELO %s\r\n", host && host->h_name ? host->h_name : - inet_ntoa(transport->localaddr.sin_addr)); + inet_ntoa (transport->localaddr.sin_addr)); - fprintf(stderr, "sending : %s", cmdbuf); - if ( camel_stream_write (transport->ostream, cmdbuf, strlen(cmdbuf)) == -1) { - g_free(cmdbuf); + fprintf (stderr, "sending : %s", cmdbuf); + if ( camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) { + g_free (cmdbuf); camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "HELO request timed out: " "%s: non-fatal", g_strerror (errno)); return FALSE; } - g_free(cmdbuf); + g_free (cmdbuf); do { /* Check for "250" */ - g_free(respbuf); + g_free (respbuf); respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream)); - fprintf(stderr, "received: %s\n", respbuf ? respbuf : "(null)"); + 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, "HELO response error: " "%s: non-fatal", g_strerror (errno)); return FALSE; } - if (transport->smtp_is_esmtp && strstr(respbuf, "AUTH")) { + if (transport->smtp_is_esmtp && strstr (respbuf, "AUTH")) { /* parse for supported AUTH types */ - g_strchomp(respbuf); - transport->esmtp_supported_authtypes = esmtp_get_authtypes(respbuf); + g_strchomp (respbuf); + transport->esmtp_supported_authtypes = esmtp_get_authtypes (respbuf); } } while ( *(respbuf+3) == '-' ); /* if we got "250-" then loop again */ - g_free(respbuf); + g_free (respbuf); return TRUE; } @@ -530,28 +530,28 @@ smtp_mail (CamelSmtpTransport *transport, gchar *sender, CamelException *ex) gchar *cmdbuf, *respbuf = NULL; /* enclose address in <>'s since some SMTP daemons *require* that */ - cmdbuf = g_strdup_printf("MAIL FROM: <%s>\r\n", sender); + cmdbuf = g_strdup_printf ("MAIL FROM: <%s>\r\n", sender); - fprintf(stderr, "sending : %s", cmdbuf); + fprintf (stderr, "sending : %s", cmdbuf); - if ( camel_stream_write (transport->ostream, cmdbuf, strlen(cmdbuf)) == -1) { - g_free(cmdbuf); + if ( camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) { + g_free (cmdbuf); camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "MAIL FROM request timed out: " "%s: mail not sent", g_strerror (errno)); return FALSE; } - g_free(cmdbuf); + g_free (cmdbuf); do { /* Check for "250 Sender OK..." */ - g_free(respbuf); + g_free (respbuf); respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream)); - fprintf(stderr, "received: %s\n", respbuf ? respbuf : "(null)"); + 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, "MAIL FROM response error: " "%s: mail not sent", @@ -559,7 +559,7 @@ smtp_mail (CamelSmtpTransport *transport, gchar *sender, CamelException *ex) return FALSE; } } while ( *(respbuf+3) == '-' ); /* if we got "250-" then loop again */ - g_free(respbuf); + g_free (respbuf); return TRUE; } @@ -572,28 +572,28 @@ smtp_rcpt (CamelSmtpTransport *transport, gchar *recipient, CamelException *ex) gchar *cmdbuf, *respbuf = NULL; /* enclose address in <>'s since some SMTP daemons *require* that */ - cmdbuf = g_strdup_printf("RCPT TO: <%s>\r\n", recipient); + cmdbuf = g_strdup_printf ("RCPT TO: <%s>\r\n", recipient); - fprintf(stderr, "sending : %s", cmdbuf); + fprintf (stderr, "sending : %s", cmdbuf); - if ( camel_stream_write (transport->ostream, cmdbuf, strlen(cmdbuf)) == -1) { - g_free(cmdbuf); + if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) { + g_free (cmdbuf); camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "RCPT TO request timed out: " "%s: mail not sent", g_strerror (errno)); return FALSE; } - g_free(cmdbuf); + g_free (cmdbuf); do { /* Check for "250 Sender OK..." */ - g_free(respbuf); + g_free (respbuf); respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream)); - fprintf(stderr, "received: %s\n", respbuf ? respbuf : "(null)"); + 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, "RCPT TO response error: " "%s: mail not sent", @@ -601,7 +601,7 @@ smtp_rcpt (CamelSmtpTransport *transport, gchar *recipient, CamelException *ex) return FALSE; } } while ( *(respbuf+3) == '-' ); /* if we got "250-" then loop again */ - g_free(respbuf); + g_free (respbuf); return TRUE; } @@ -616,29 +616,29 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException * gint id; /* enclose address in <>'s since some SMTP daemons *require* that */ - cmdbuf = g_strdup("DATA\r\n"); + cmdbuf = g_strdup ("DATA\r\n"); - fprintf(stderr, "sending : %s", cmdbuf); + fprintf (stderr, "sending : %s", cmdbuf); - if ( camel_stream_write (transport->ostream, cmdbuf, strlen(cmdbuf)) == -1) { - g_free(cmdbuf); + if ( camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) { + g_free (cmdbuf); camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "DATA request timed out: " "%s: mail not sent", g_strerror (errno)); return FALSE; } - g_free(cmdbuf); + g_free (cmdbuf); respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream)); - fprintf(stderr, "received: %s\n", respbuf ? respbuf : "(null)"); + 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 */ - g_free(respbuf); + g_free (respbuf); camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "DATA response error: " "%s: mail not sent", @@ -647,11 +647,11 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException * } /* setup stream filtering */ - mimefilter = camel_mime_filter_smtp_new(); - filtered_stream = camel_stream_filter_new_with_stream(transport->ostream); - id = camel_stream_filter_add(filtered_stream, CAMEL_MIME_FILTER(mimefilter)); + mimefilter = camel_mime_filter_smtp_new (); + filtered_stream = camel_stream_filter_new_with_stream (transport->ostream); + id = camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (mimefilter)); - if (camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER(message), CAMEL_STREAM(filtered_stream)) == -1) { + if (camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), CAMEL_STREAM (filtered_stream)) == -1) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "DATA send timed out: message termination: " "%s: mail not sent", @@ -659,15 +659,15 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException * return FALSE; } - camel_stream_filter_remove(filtered_stream, id); - camel_stream_close(CAMEL_STREAM(filtered_stream)); - gtk_object_unref(GTK_OBJECT(filtered_stream)); + camel_stream_filter_remove (filtered_stream, id); + camel_stream_close (CAMEL_STREAM(filtered_stream)); + gtk_object_unref (GTK_OBJECT(filtered_stream)); /* terminate the message body */ - fprintf(stderr, "sending : \\r\\n.\\r\\n\n"); + fprintf (stderr, "sending : \\r\\n.\\r\\n\n"); - if ( camel_stream_write (transport->ostream, "\r\n.\r\n", 5) == -1) { + if (camel_stream_write (transport->ostream, "\r\n.\r\n", 5) == -1) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "DATA send timed out: message termination: " "%s: mail not sent", @@ -677,12 +677,12 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException * do { /* Check for "250 Sender OK..." */ - g_free(respbuf); + g_free (respbuf); respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream)); - fprintf(stderr, "received: %s\n", respbuf ? respbuf : "(null)"); + 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", @@ -690,7 +690,7 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException * return FALSE; } } while ( *(respbuf+3) == '-' ); /* if we got "250-" then loop again */ - g_free(respbuf); + g_free (respbuf); return TRUE; } @@ -703,26 +703,26 @@ smtp_rset (CamelSmtpTransport *transport, CamelException *ex) cmdbuf = g_strdup ("RSET\r\n"); - fprintf(stderr, "sending : %s", cmdbuf); + fprintf (stderr, "sending : %s", cmdbuf); - if ( camel_stream_write (transport->ostream, cmdbuf, strlen(cmdbuf)) == -1) { - g_free(cmdbuf); + if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) { + g_free (cmdbuf); camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "RSET request timed out: " "%s", g_strerror (errno)); return FALSE; } - g_free(cmdbuf); + g_free (cmdbuf); do { /* Check for "250" */ - g_free(respbuf); + g_free (respbuf); respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream)); - fprintf(stderr, "received: %s\n", respbuf ? respbuf : "(null)"); + 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", @@ -730,7 +730,7 @@ smtp_rset (CamelSmtpTransport *transport, CamelException *ex) return FALSE; } } while ( *(respbuf+3) == '-' ); /* if we got "250-" then loop again */ - g_free(respbuf); + g_free (respbuf); return TRUE; } @@ -743,26 +743,26 @@ smtp_quit (CamelSmtpTransport *transport, CamelException *ex) cmdbuf = g_strdup ("QUIT\r\n"); - fprintf(stderr, "sending : %s", cmdbuf); + fprintf (stderr, "sending : %s", cmdbuf); - if ( camel_stream_write (transport->ostream, cmdbuf, strlen(cmdbuf)) == -1) { - g_free(cmdbuf); + if ( camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) { + g_free (cmdbuf); camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "QUIT request timed out: " "%s: non-fatal", g_strerror (errno)); return FALSE; } - g_free(cmdbuf); + g_free (cmdbuf); do { /* Check for "221" */ - g_free(respbuf); + g_free (respbuf); respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream)); - fprintf(stderr, "received: %s\n", respbuf ? respbuf : "(null)"); + fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"); - if ( !respbuf || strncmp(respbuf, "221", 3) ) { + if ( !respbuf || strncmp (respbuf, "221", 3) ) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "QUIT response error: " "%s: non-fatal", @@ -770,7 +770,7 @@ smtp_quit (CamelSmtpTransport *transport, CamelException *ex) return FALSE; } } while ( *(respbuf+3) == '-' ); /* if we got "221-" then loop again */ - g_free(respbuf); + g_free (respbuf); return TRUE; } |