aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap/camel-imap-command.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-05-23 04:17:48 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-05-23 04:17:48 +0800
commita9fc56de69a8b63316d2c0ffeb673facd2befea3 (patch)
tree33be53a23de70735ade36777248bb2cb96bd2f1d /camel/providers/imap/camel-imap-command.c
parente7ad5d121bca3ba68221582ea56b0feed8b7881e (diff)
downloadgsoc2013-evolution-a9fc56de69a8b63316d2c0ffeb673facd2befea3.tar
gsoc2013-evolution-a9fc56de69a8b63316d2c0ffeb673facd2befea3.tar.gz
gsoc2013-evolution-a9fc56de69a8b63316d2c0ffeb673facd2befea3.tar.bz2
gsoc2013-evolution-a9fc56de69a8b63316d2c0ffeb673facd2befea3.tar.lz
gsoc2013-evolution-a9fc56de69a8b63316d2c0ffeb673facd2befea3.tar.xz
gsoc2013-evolution-a9fc56de69a8b63316d2c0ffeb673facd2befea3.tar.zst
gsoc2013-evolution-a9fc56de69a8b63316d2c0ffeb673facd2befea3.zip
Removed from the build. Glory glory hallelujah.
2002-05-22 Jeffrey Stedfast <fejj@ximian.com> * camel-remote-store.c: Removed from the build. Glory glory hallelujah. * camel-disco-store.c: Updated to inherit from CamelStore rather than CamelRemoteStore. * providers/imap/camel-imap-command.c (imap_command_start): Don't use the camel-remote-store shit to send a string. Just use camel_stream_printf for chrissakes. * providers/imap/camel-imap-store.c: Updated to not depend on CamelRemoteStore and to handle STARTTLS. (imap_disconnect_online): Unref the streams. (imap_keepalive): Removed. (camel_imap_store_connected): New function to replace camel_remote_store_connected(). (camel_imap_store_finalize): Unref the streams. (camel_imap_store_recv_line): New function to replace camel_remote_store_recv_line(). (imap_get_capability): Renamed from connect_to_server (connect_to_server): New function to try and connect to the server. (connect_to_server_wrapper): New wrapper function around connect_to_server that takes the ssl modes into consideration. (query_auth_types): Don't bother calling our parent's implementation of query_auth_types() since CamelDiscoStore doesn't have any anyway. (imap_get_name): New method to implement CamelService::get_name svn path=/trunk/; revision=16975
Diffstat (limited to 'camel/providers/imap/camel-imap-command.c')
-rw-r--r--camel/providers/imap/camel-imap-command.c64
1 files changed, 46 insertions, 18 deletions
diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c
index f8ea456439..b0df0deefc 100644
--- a/camel/providers/imap/camel-imap-command.c
+++ b/camel/providers/imap/camel-imap-command.c
@@ -40,6 +40,10 @@
#include "camel-imap-private.h"
#include <camel/camel-exception.h>
+#define d(x) x
+
+extern int camel_verbose_debug;
+
static gboolean imap_command_start (CamelImapStore *store, CamelFolder *folder,
const char *cmd, CamelException *ex);
CamelImapResponse *imap_read_response (CamelImapStore *store,
@@ -170,6 +174,8 @@ static gboolean
imap_command_start (CamelImapStore *store, CamelFolder *folder,
const char *cmd, CamelException *ex)
{
+ ssize_t nwritten;
+
/* Check for current folder */
if (folder && folder != store->current_folder) {
CamelImapResponse *response;
@@ -188,10 +194,39 @@ imap_command_start (CamelImapStore *store, CamelFolder *folder,
}
/* Send the command */
- return camel_remote_store_send_string (CAMEL_REMOTE_STORE (store), ex,
- "%c%.5d %s\r\n",
- store->tag_prefix,
- store->command++, cmd) != -1;
+#if d(!)0
+ if (camel_verbose_debug) {
+ const char *mask;
+
+ if (!strncmp ("LOGIN \"", cmd, 7))
+ mask = "LOGIN \"xxx\" xxx";
+ else if (!strncmp ("LOGIN {", cmd, 7))
+ mask = "LOGIN {N+}\r\nxxx {N+}\r\nxxx";
+ else if (!strncmp ("LOGIN ", cmd, 6))
+ mask = "LOGIN xxx xxx";
+ else
+ mask = cmd;
+
+ fprintf (stderr, "sending : %c%.5d %s\r\n", store->tag_prefix, store->command, mask);
+ }
+#endif
+
+ nwritten = camel_stream_printf (store->ostream, "%c%.5d %s\r\n",
+ store->tag_prefix, store->command++, cmd);
+
+ if (nwritten == -1) {
+ if (errno == EINTR)
+ camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
+ _("Operation cancelled"));
+ else
+ camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+ g_strerror (errno));
+
+ camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
+ return FALSE;
+ }
+
+ return TRUE;
}
/**
@@ -205,7 +240,7 @@ imap_command_start (CamelImapStore *store, CamelFolder *folder,
* after camel_imap_command() or camel_imap_command_response() returns
* a continuation response.
*
- * This function assumes you have an exclusive lock on the remote stream.
+ * This function assumes you have an exclusive lock on the imap stream.
*
* Return value: as for camel_imap_command(). On failure, the store's
* command_lock will be released.
@@ -214,15 +249,11 @@ CamelImapResponse *
camel_imap_command_continuation (CamelImapStore *store, const char *cmd,
size_t cmdlen, CamelException *ex)
{
- CamelStream *stream;
-
- if (!camel_remote_store_connected (CAMEL_REMOTE_STORE (store), ex))
+ if (!camel_imap_store_connected (store, ex))
return NULL;
- stream = CAMEL_REMOTE_STORE (store)->ostream;
-
- if (camel_stream_write (stream, cmd, cmdlen) == -1 ||
- camel_stream_write (stream, "\r\n", 2) == -1) {
+ if (camel_stream_write (store->ostream, cmd, cmdlen) == -1 ||
+ camel_stream_write (store->ostream, "\r\n", 2) == -1) {
if (errno == EINTR)
camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
_("Operation cancelled"));
@@ -259,8 +290,7 @@ camel_imap_command_response (CamelImapStore *store, char **response,
CamelImapResponseType type;
char *respbuf;
- if (camel_remote_store_recv_line (CAMEL_REMOTE_STORE (store),
- &respbuf, ex) < 0) {
+ if (camel_imap_store_recv_line (store, &respbuf, ex) < 0) {
CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
return CAMEL_IMAP_RESPONSE_ERROR;
}
@@ -402,8 +432,7 @@ imap_read_untagged (CamelImapStore *store, char *line, CamelException *ex)
/* Read the literal */
str = g_string_sized_new (length + 2);
str->str[0] = '\n';
- nread = camel_stream_read (CAMEL_REMOTE_STORE (store)->istream,
- str->str + 1, length);
+ nread = camel_stream_read (store->istream, str->str + 1, length);
if (nread == -1) {
if (errno == EINTR)
camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, _("Operation cancelled"));
@@ -464,8 +493,7 @@ imap_read_untagged (CamelImapStore *store, char *line, CamelException *ex)
g_ptr_array_add (data, str);
/* Read the next line. */
- if (camel_remote_store_recv_line (CAMEL_REMOTE_STORE (store),
- &line, ex) < 0)
+ if (camel_imap_store_recv_line (store, &line, ex) < 0)
goto lose;
}