aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-07-09 08:22:54 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-07-09 08:22:54 +0800
commitd1bc4936d699830da46e384d32d9f60f3f8dc3fa (patch)
tree440f8f09bcfbbbee7e2df93d4f5618c86020eb9d /camel/providers
parentce3c2273262985f373126cc7fe4041c5da94d362 (diff)
downloadgsoc2013-evolution-d1bc4936d699830da46e384d32d9f60f3f8dc3fa.tar
gsoc2013-evolution-d1bc4936d699830da46e384d32d9f60f3f8dc3fa.tar.gz
gsoc2013-evolution-d1bc4936d699830da46e384d32d9f60f3f8dc3fa.tar.bz2
gsoc2013-evolution-d1bc4936d699830da46e384d32d9f60f3f8dc3fa.tar.lz
gsoc2013-evolution-d1bc4936d699830da46e384d32d9f60f3f8dc3fa.tar.xz
gsoc2013-evolution-d1bc4936d699830da46e384d32d9f60f3f8dc3fa.tar.zst
gsoc2013-evolution-d1bc4936d699830da46e384d32d9f60f3f8dc3fa.zip
Update to reflect past changes in the Camel API. Use gtk macro casts
2000-07-08 Jeffrey Stedfast <fejj@helixcode.com> * providers/nntp/camel-nntp-folder.c: * providers/nntp/camel-nntp-utils.c: * providers/nntp/camel-nntp-store.c: Update to reflect past changes in the Camel API. Use gtk macro casts wherever possible and use glib's memory functions instead of standard c's (since they are not compatable) * providers/smtp/camel-smtp-transport.c: * providers/imap/camel-imap-store.c: Wrap debug print statements in a macro * providers/imap/camel-imap-stream.c (stream_read): Make sure that we get up to and including the last \n of the mime part. * providers/imap/camel-imap-folder.c (imap_get_message): Make sure that we get up to and including the last \n of the mime part. Wrap debug print statements in a macro. svn path=/trunk/; revision=3984
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/imap/camel-imap-folder.c36
-rw-r--r--camel/providers/imap/camel-imap-store.c17
-rw-r--r--camel/providers/imap/camel-imap-stream.c2
-rw-r--r--camel/providers/nntp/camel-nntp-folder.c26
-rw-r--r--camel/providers/nntp/camel-nntp-store.c4
-rw-r--r--camel/providers/nntp/camel-nntp-utils.c4
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c68
7 files changed, 83 insertions, 74 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 8922d0dd4d..d92f260870 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -50,7 +50,7 @@
#include "camel-exception.h"
#include "camel-mime-utils.h"
-#define d(x)
+#define d(x) x
#define CF_CLASS(o) (CAMEL_FOLDER_CLASS (GTK_OBJECT (o)->klass))
@@ -714,7 +714,7 @@ imap_get_subfolder_names (CamelFolder *folder, CamelException *ex)
f = folder + strlen (folder_path) + 1;
memmove (folder, f, strlen (f) + 1);
}
- printf ("adding folder: %s\n", folder);
+ d(fprintf (stderr, "adding folder: %s\n", folder));
g_ptr_array_add (listing, folder);
@@ -791,11 +791,13 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
if (*q == '\n')
part_len--;
}
+ /* we want to make sure we get up to the last \n */
+ for ( ; *q && *q != '\n'; q++, part_len++);
header = g_strndup (p, part_len);
g_free (result);
- printf ("*** We got the header ***\n");
+ d(fprintf (stderr, "*** We got the header ***\n"));
status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), folder,
&result, "UID FETCH %s BODY[TEXT]", uid);
@@ -833,18 +835,20 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
if (*q == '\n')
part_len--;
}
+ /* we want to make sure we get up to the last \n */
+ for ( ; *q && *q != '\n'; q++, part_len++);
body = g_strndup (p, part_len);
g_free (result);
- printf ("*** We got the body ***\n");
+ d(fprintf (stderr, "*** We got the body ***\n"));
mesg = g_strdup_printf ("%s\n%s", header, body);
g_free (header);
g_free (body);
- printf ("*** We got the mesg ***\n");
+ d(fprintf (stderr, "*** We got the mesg ***\n"));
- fprintf (stderr, "Message:\n%s\n", mesg);
+ d(fprintf (stderr, "Message:\n%s\n", mesg));
msgstream = camel_stream_mem_new_with_buffer (mesg, strlen (mesg) + 1);
#if 0
@@ -853,7 +857,7 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
id = camel_stream_filter_add (f_stream, CAMEL_MIME_FILTER (filter));
#endif
msg = camel_mime_message_new ();
- printf ("*** We created the camel_mime_message ***\n");
+ d(fprintf (stderr, "*** We created the camel_mime_message ***\n"));
camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg), msgstream);
#if 0
@@ -863,7 +867,7 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
gtk_object_unref (GTK_OBJECT (msgstream));
/*gtk_object_unref (GTK_OBJECT (f_stream));*/
- printf ("*** We're returning... ***\n");
+ d(fprintf (stderr, "*** We're returning... ***\n"));
return msg;
@@ -1067,7 +1071,7 @@ imap_get_summary (CamelFolder *folder, CamelException *ex)
if (!result || *result != '*') {
g_free (result);
- fprintf (stderr, "Warning: UID for message %d not found\n", i);
+ d(fprintf (stderr, "Warning: UID for message %d not found\n", i));
g_free (info->subject);
g_free (info->from);
@@ -1084,7 +1088,7 @@ imap_get_summary (CamelFolder *folder, CamelException *ex)
p = strchr (result, '(');
if (!p || strncasecmp (p + 1, "UID", 3)) {
g_free (result);
- fprintf (stderr, "Warning: UID for message %d not found\n", i);
+ d(fprintf (stderr, "Warning: UID for message %d not found\n", i));
g_free (info->subject);
g_free (info->from);
@@ -1101,7 +1105,7 @@ imap_get_summary (CamelFolder *folder, CamelException *ex)
for (p += 4; *p && (*p < '0' || *p > '9'); p++); /* advance to <uid> */
for (q = p; *q && *q != ')' && *q != ' '; q++); /* find the end of the <uid> */
info->uid = g_strndup (p, (gint)(q - p));
- printf ("*** info->uid = %s\n", info->uid);
+ d(fprintf (stderr, "*** info->uid = %s\n", info->uid));
g_free (result);
/* now to get the flags */
@@ -1133,7 +1137,7 @@ imap_get_summary (CamelFolder *folder, CamelException *ex)
if (!result || *result != '*') {
g_free (result);
- fprintf (stderr, "Warning: FLAGS for message %d not found\n", i);
+ d(fprintf (stderr, "Warning: FLAGS for message %d not found\n", i));
g_free (info->subject);
g_free (info->from);
@@ -1151,7 +1155,7 @@ imap_get_summary (CamelFolder *folder, CamelException *ex)
p = strchr (result, '(') + 1;
if (strncasecmp (p, "FLAGS", 5)) {
g_free (result);
- fprintf (stderr, "Warning: FLAGS for message %d not found\n", i);
+ d(fprintf (stderr, "Warning: FLAGS for message %d not found\n", i));
g_free (info->subject);
g_free (info->from);
@@ -1295,14 +1299,14 @@ imap_get_message_info (CamelFolder *folder, const char *uid)
if (status != CAMEL_IMAP_OK) {
g_free (result);
- fprintf (stderr, "Warning: Error getting FLAGS for message %s\n", uid);
+ d(fprintf (stderr, "Warning: Error getting FLAGS for message %s\n", uid));
return info; /* I guess we should return what we got so far? */
}
if (!result || *result != '*') {
g_free (result);
- fprintf (stderr, "Warning: FLAGS for message %s not found\n", uid);
+ d(fprintf (stderr, "Warning: FLAGS for message %s not found\n", uid));
return info; /* I guess we should return what we got so far? */
}
@@ -1310,7 +1314,7 @@ imap_get_message_info (CamelFolder *folder, const char *uid)
p = strchr (result, '(') + 1;
if (strncasecmp (p, "FLAGS", 5)) {
g_free (result);
- fprintf (stderr, "Warning: FLAGS for message %s not found\n", uid);
+ d(fprintf (stderr, "Warning: FLAGS for message %s not found\n", uid));
return info; /* I guess we should return what we got so far? */
}
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 75da7529b3..e7c9d98673 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -47,6 +47,8 @@
#include "camel-url.h"
#include "string-utils.h"
+#define d(x) x
+
/* Specified in RFC 2060 */
#define IMAP_PORT 143
@@ -336,7 +338,7 @@ imap_connect (CamelService *service, CamelException *ex)
g_free (result);
- fprintf (stderr, "IMAP provider does%shave SEARCH support\n", store->has_search_capability ? " " : "n't ");
+ d(fprintf (stderr, "IMAP provider does%shave SEARCH support\n", store->has_search_capability ? " " : "n't "));
service_class->connect (service, ex);
@@ -384,7 +386,7 @@ imap_folder_exists (CamelFolder *folder)
else
folder_path = g_strdup (folder->full_name);
- printf ("doing an EXAMINE...\n");
+ d(fprintf (stderr, "doing an EXAMINE...\n"));
status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), NULL,
&result, "EXAMINE %s", folder_path);
@@ -570,7 +572,7 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder, char **ret, char
cmdbuf = g_strdup_vprintf (fmt, ap);
va_end (ap);
- fprintf (stderr, "sending : %s %s\r\n", cmdid, cmdbuf);
+ d(fprintf (stderr, "sending : %s %s\r\n", cmdid, cmdbuf));
fflush (stderr);
if (camel_stream_printf (store->ostream, "%s %s\r\n", cmdid, cmdbuf) == -1) {
@@ -590,8 +592,7 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder, char **ret, char
return CAMEL_IMAP_FAIL;
}
- fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)");
- fflush (stderr);
+ d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
status = camel_imap_status (cmdid, respbuf);
g_free (cmdid);
@@ -672,7 +673,7 @@ camel_imap_command_extended (CamelImapStore *store, CamelFolder *folder, char **
cmdbuf = g_strdup_vprintf (fmt, app);
va_end (app);
- fprintf (stderr, "sending : %s %s\r\n", cmdid, cmdbuf);
+ d(fprintf (stderr, "sending : %s %s\r\n", cmdid, cmdbuf));
if (camel_stream_printf (store->ostream, "%s %s\r\n", cmdid, cmdbuf) == -1) {
g_free (cmdbuf);
@@ -690,11 +691,11 @@ camel_imap_command_extended (CamelImapStore *store, CamelFolder *folder, char **
respbuf = camel_stream_buffer_read_line (stream);
if (!respbuf || !strncmp(respbuf, cmdid, strlen(cmdid)) ) {
/* IMAP's last response starts with our command id */
- fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)");
+ d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
break;
}
- fprintf (stderr, "received: %s\n", respbuf);
+ d(fprintf (stderr, "received: %s\n", respbuf));
g_ptr_array_add (data, respbuf);
len += strlen (respbuf) + 1;
diff --git a/camel/providers/imap/camel-imap-stream.c b/camel/providers/imap/camel-imap-stream.c
index d7fb0ee75c..9f45ed2291 100644
--- a/camel/providers/imap/camel-imap-stream.c
+++ b/camel/providers/imap/camel-imap-stream.c
@@ -168,6 +168,8 @@ stream_read (CamelStream *stream, char *buffer, size_t n)
if (*q == '\n')
part_len--;
}
+ /* we want to make sure we get up to the last \n */
+ for ( ; *q && *q != '\n'; q++, part_len++);
imap_stream->cache = g_strndup (p, part_len);
g_free (result);
diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c
index 033259a1cd..ae5e371fb1 100644
--- a/camel/providers/nntp/camel-nntp-folder.c
+++ b/camel/providers/nntp/camel-nntp-folder.c
@@ -188,7 +188,7 @@ nntp_folder_get_message_uid (CamelFolder *folder,
}
static CamelMimeMessage *
-nntp_folder_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex)
+nntp_folder_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
{
CamelStream *nntp_istream;
CamelStream *message_stream;
@@ -223,7 +223,7 @@ nntp_folder_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelExce
then create a stream_mem for it. */
buf_alloc = 2048;
buf_len = 0;
- buf = malloc(buf_alloc);
+ buf = g_malloc(buf_alloc);
done = FALSE;
buf[0] = 0;
@@ -243,7 +243,7 @@ nntp_folder_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelExce
else {
if (buf_len + line_length > buf_alloc) {
buf_alloc *= 2;
- buf = realloc (buf, buf_alloc);
+ buf = g_realloc (buf, buf_alloc);
}
strcat(buf, line);
strcat(buf, "\n");
@@ -257,28 +257,28 @@ nntp_folder_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelExce
message = camel_mime_message_new ();
if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)message, message_stream) == -1) {
- gtk_object_unref ((GtkObject *)message);
- gtk_object_unref ((GtkObject *)message_stream);
+ gtk_object_unref (GTK_OBJECT (message));
+ gtk_object_unref (GTK_OBJECT (message_stream));
camel_exception_setv (ex,
CAMEL_EXCEPTION_FOLDER_INVALID_UID, /* XXX */
"Could not create message for uid %s.", uid);
return NULL;
}
- gtk_object_unref ((GtkObject *)message_stream);
+ gtk_object_unref (GTK_OBJECT (message_stream));
/* init other fields? */
- gtk_object_ref((GtkObject *)folder);
+ gtk_object_ref (GTK_OBJECT (folder));
#if 0
- gtk_signal_connect((GtkObject *)message, "message_changed", message_changed, folder);
+ gtk_signal_connect (GTK_OBJECT (message), "message_changed", message_changed, folder);
#endif
return message;
}
static void
-nntp_folder_delete_message_by_uid (CamelFolder *folder,
+nntp_folder_delete_message (CamelFolder *folder,
const gchar *uid,
CamelException *ex)
{
@@ -367,7 +367,7 @@ nntp_folder_search_by_expression (CamelFolder *folder, const char *expression, C
}
static const CamelMessageInfo*
-nntp_folder_summary_get_by_uid (CamelFolder *folder, const char *uid)
+nntp_folder_get_message_info (CamelFolder *folder, const char *uid)
{
g_assert(0);
return NULL;
@@ -403,8 +403,8 @@ camel_nntp_folder_class_init (CamelNNTPFolderClass *camel_nntp_folder_class)
camel_folder_class->set_message_flags = nntp_folder_set_message_flags;
camel_folder_class->get_message_flags = nntp_folder_get_message_flags;
camel_folder_class->get_message_uid = nntp_folder_get_message_uid;
- camel_folder_class->get_message_by_uid = nntp_folder_get_message_by_uid;
- camel_folder_class->delete_message_by_uid = nntp_folder_delete_message_by_uid;
+ camel_folder_class->get_message = nntp_folder_get_message;
+ camel_folder_class->delete_message = nntp_folder_delete_message;
camel_folder_class->get_uids = nntp_folder_get_uids;
camel_folder_class->free_uids = nntp_folder_free_uids;
camel_folder_class->get_summary = nntp_folder_get_summary;
@@ -412,7 +412,7 @@ camel_nntp_folder_class_init (CamelNNTPFolderClass *camel_nntp_folder_class)
camel_folder_class->get_subfolder_names = nntp_folder_get_subfolder_names;
camel_folder_class->free_subfolder_names = nntp_folder_free_subfolder_names;
camel_folder_class->search_by_expression = nntp_folder_search_by_expression;
- camel_folder_class->summary_get_by_uid = nntp_folder_summary_get_by_uid;
+ camel_folder_class->get_message_info = nntp_folder_get_message_info;
gtk_object_class->finalize = nntp_folder_finalize;
diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c
index 03ab14ccdb..96d11b4915 100644
--- a/camel/providers/nntp/camel-nntp-store.c
+++ b/camel/providers/nntp/camel-nntp-store.c
@@ -99,7 +99,7 @@ static char *
nntp_store_get_name (CamelService *service, gboolean brief)
{
/* Same info for long and brief... */
- return g_strdup_sprintf ("USENET news via %s", service->url->host);
+ return g_strdup_printf ("USENET news via %s", service->url->host);
}
@@ -107,7 +107,7 @@ static void
camel_nntp_store_class_init (CamelNNTPStoreClass *camel_nntp_store_class)
{
CamelStoreClass *camel_store_class = CAMEL_STORE_CLASS (camel_nntp_store_class);
- CamelServiceClass *camel_store_class = CAMEL_SERVICE_CLASS (camel_nntp_store_class);
+ CamelServiceClass *camel_service_class = CAMEL_SERVICE_CLASS (camel_nntp_store_class);
service_class = gtk_type_class (camel_service_get_type ());
diff --git a/camel/providers/nntp/camel-nntp-utils.c b/camel/providers/nntp/camel-nntp-utils.c
index ae1f676cc3..d4c2cda771 100644
--- a/camel/providers/nntp/camel-nntp-utils.c
+++ b/camel/providers/nntp/camel-nntp-utils.c
@@ -104,7 +104,7 @@ get_HEAD_headers(CamelNNTPStore *nntp_store, CamelFolder *folder,
buf_alloc = 2048;
buf_len = 0;
- buf = malloc(buf_alloc);
+ buf = g_malloc(buf_alloc);
done = FALSE;
buf[0] = 0;
@@ -125,7 +125,7 @@ get_HEAD_headers(CamelNNTPStore *nntp_store, CamelFolder *folder,
else {
if (buf_len + line_length > buf_alloc) {
buf_alloc *= 2;
- buf = realloc (buf, buf_alloc);
+ buf = g_realloc (buf, buf_alloc);
}
strcat(buf, line);
strcat(buf, "\n");
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index cf2649f78c..59ee2457f0 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -47,6 +47,8 @@
#include "camel-exception.h"
#include "md5-utils.h"
+#define d(x) x
+
/* Specified in RFC 821 */
#define SMTP_PORT 25
@@ -179,7 +181,7 @@ smtp_connect (CamelService *service, CamelException *ex)
/* Check for "220" */
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",
@@ -188,7 +190,7 @@ smtp_connect (CamelService *service, CamelException *ex)
}
if (strstr (respbuf, "ESMTP"))
transport->smtp_is_esmtp = TRUE;
- } while ( *(respbuf+3) == '-' ); /* if we got "220-" then loop again */
+ } while (*(respbuf+3) == '-'); /* if we got "220-" then loop again */
g_free (respbuf);
/* send HELO (or EHLO, depending on the service type) */
@@ -207,17 +209,17 @@ smtp_connect (CamelService *service, CamelException *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);
+ d(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));
+ d(fprintf (stderr, "\nSupported AUTH: %s\n\n",
+ (gchar *) g_list_nth_data (transport->esmtp_supported_authtypes, i)));
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");
+ d(fprintf (stderr, "\ncamel-smtp-transport::connect(): provider does not use AUTH\n\n"));
}
return TRUE;
@@ -509,8 +511,8 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex)
cmdbuf = g_strdup_printf ("HELO %s\r\n", host && host->h_name ? host->h_name :
inet_ntoa (transport->localaddr.sin_addr));
- fprintf (stderr, "sending : %s", cmdbuf);
- if ( camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) {
+ d(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: "
@@ -525,9 +527,9 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex)
g_free (respbuf);
respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream));
- fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)");
+ d(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",
@@ -540,7 +542,7 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex)
transport->esmtp_supported_authtypes = esmtp_get_authtypes (auths);
}
- } 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;
@@ -555,9 +557,9 @@ smtp_mail (CamelSmtpTransport *transport, gchar *sender, CamelException *ex)
/* enclose address in <>'s since some SMTP daemons *require* that */
cmdbuf = g_strdup_printf ("MAIL FROM: <%s>\r\n", sender);
- fprintf (stderr, "sending : %s", cmdbuf);
+ d(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,
"MAIL FROM request timed out: "
@@ -572,16 +574,16 @@ smtp_mail (CamelSmtpTransport *transport, gchar *sender, CamelException *ex)
g_free (respbuf);
respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream));
- fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)");
+ d(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",
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;
@@ -597,7 +599,7 @@ smtp_rcpt (CamelSmtpTransport *transport, gchar *recipient, CamelException *ex)
/* enclose address in <>'s since some SMTP daemons *require* that */
cmdbuf = g_strdup_printf ("RCPT TO: <%s>\r\n", recipient);
- fprintf (stderr, "sending : %s", cmdbuf);
+ d(fprintf (stderr, "sending : %s", cmdbuf));
if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) {
g_free (cmdbuf);
@@ -614,16 +616,16 @@ smtp_rcpt (CamelSmtpTransport *transport, gchar *recipient, CamelException *ex)
g_free (respbuf);
respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream));
- fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)");
+ d(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",
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;
@@ -641,7 +643,7 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException *
/* enclose address in <>'s since some SMTP daemons *require* that */
cmdbuf = g_strdup ("DATA\r\n");
- fprintf (stderr, "sending : %s", cmdbuf);
+ d(fprintf (stderr, "sending : %s", cmdbuf));
if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) {
g_free (cmdbuf);
@@ -655,9 +657,9 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException *
respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream));
- fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)");
+ d(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
*/
@@ -688,7 +690,7 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException *
/* terminate the message body */
- fprintf (stderr, "sending : \\r\\n.\\r\\n\n");
+ d(fprintf (stderr, "sending : \\r\\n.\\r\\n\n"));
if (camel_stream_write (transport->ostream, "\r\n.\r\n", 5) == -1) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
@@ -703,7 +705,7 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException *
g_free (respbuf);
respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream));
- fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)");
+ d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
if (!respbuf || strncmp (respbuf, "250", 3)) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
@@ -726,7 +728,7 @@ smtp_rset (CamelSmtpTransport *transport, CamelException *ex)
cmdbuf = g_strdup ("RSET\r\n");
- fprintf (stderr, "sending : %s", cmdbuf);
+ d(fprintf (stderr, "sending : %s", cmdbuf));
if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) {
g_free (cmdbuf);
@@ -743,7 +745,7 @@ smtp_rset (CamelSmtpTransport *transport, CamelException *ex)
g_free (respbuf);
respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream));
- fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)");
+ d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
if (!respbuf || strncmp (respbuf, "250", 3)) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
@@ -752,7 +754,7 @@ smtp_rset (CamelSmtpTransport *transport, CamelException *ex)
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;
@@ -766,9 +768,9 @@ smtp_quit (CamelSmtpTransport *transport, CamelException *ex)
cmdbuf = g_strdup ("QUIT\r\n");
- fprintf (stderr, "sending : %s", cmdbuf);
+ d(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,
"QUIT request timed out: "
@@ -783,16 +785,16 @@ smtp_quit (CamelSmtpTransport *transport, CamelException *ex)
g_free (respbuf);
respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream));
- fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)");
+ d(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",
g_strerror (errno));
return FALSE;
}
- } while ( *(respbuf+3) == '-' ); /* if we got "221-" then loop again */
+ } while (*(respbuf+3) == '-'); /* if we got "221-" then loop again */
g_free (respbuf);
return TRUE;