aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap/camel-imap-store.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-08-12 11:42:42 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-08-12 11:42:42 +0800
commit4430ec83ec3ae4770c08d74bd9434b694e7ee628 (patch)
tree30ca38f428619d52649150e90cad2ef64ad2f835 /camel/providers/imap/camel-imap-store.c
parent2a447586b3f32fc42c3032ec489a8660426c7eac (diff)
downloadgsoc2013-evolution-4430ec83ec3ae4770c08d74bd9434b694e7ee628.tar
gsoc2013-evolution-4430ec83ec3ae4770c08d74bd9434b694e7ee628.tar.gz
gsoc2013-evolution-4430ec83ec3ae4770c08d74bd9434b694e7ee628.tar.bz2
gsoc2013-evolution-4430ec83ec3ae4770c08d74bd9434b694e7ee628.tar.lz
gsoc2013-evolution-4430ec83ec3ae4770c08d74bd9434b694e7ee628.tar.xz
gsoc2013-evolution-4430ec83ec3ae4770c08d74bd9434b694e7ee628.tar.zst
gsoc2013-evolution-4430ec83ec3ae4770c08d74bd9434b694e7ee628.zip
Changed param order a bit and fixed some logic
2000-08-11 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-store.c (camel_imap_command_continuation): Changed param order a bit and fixed some logic * providers/imap/camel-imap-folder.c (imap_append_message): Use the new multi-transactional convenience functions svn path=/trunk/; revision=4766
Diffstat (limited to 'camel/providers/imap/camel-imap-store.c')
-rw-r--r--camel/providers/imap/camel-imap-store.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 6eb03e9db4..d5985bb9ea 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -1023,6 +1023,7 @@ camel_imap_command_preliminary (CamelImapStore *store, char **ret, char **cmdid,
if (respbuf) {
switch (*respbuf) {
case '+':
+ /* continuation request */
status = CAMEL_IMAP_PLUS;
break;
default:
@@ -1050,6 +1051,9 @@ camel_imap_command_preliminary (CamelImapStore *store, char **ret, char **cmdid,
*
* This method is for sending continuing responses to the IMAP server. Meant
* to be used as a followup to camel_imap_command_preliminary.
+ * camel_imap_command_continuation will set @ret to point to a buffer
+ * containing the rest of the response from the IMAP server. The
+ * caller function is responsible for freeing @ret.
*
* Return value: one of CAMEL_IMAP_PLUS (command requires additional data),
* CAMEL_IMAP_OK (command executed successfully),
@@ -1059,7 +1063,7 @@ camel_imap_command_preliminary (CamelImapStore *store, char **ret, char **cmdid,
* of the result of the command.)
**/
gint
-camel_imap_command_continuation (CamelImapStore *store, char *cmdid, char **ret, CamelStream *cstream)
+camel_imap_command_continuation (CamelImapStore *store, char **ret, char *cmdid, CamelStream *cstream)
{
gint len = 0, status = CAMEL_IMAP_OK;
gchar *respbuf;
@@ -1069,19 +1073,22 @@ camel_imap_command_continuation (CamelImapStore *store, char *cmdid, char **ret,
d(fprintf (stderr, "sending continuation stream\r\n"));
if (camel_stream_write_to_stream (cstream, store->ostream) == -1) {
+ d(fprintf (stderr, "failed to send continuation stream\r\n"));
+
*ret = g_strdup (strerror (errno));
return CAMEL_IMAP_FAIL;
}
+ d(fprintf (stderr, "okie dokie...\r\n"));
data = g_ptr_array_new ();
- while (TRUE) {
+ while (1) {
CamelStreamBuffer *stream = CAMEL_STREAM_BUFFER (store->istream);
respbuf = camel_stream_buffer_read_line (stream);
if (!respbuf || *respbuf == '+' || !strncmp (respbuf, cmdid, strlen (cmdid))) {
- /* IMAP's last response starts with our command id */
+ /* IMAP's last response starts with our command id or a continuation request */
d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
break;
@@ -1094,14 +1101,14 @@ camel_imap_command_continuation (CamelImapStore *store, char *cmdid, char **ret,
}
if (respbuf) {
+ g_ptr_array_add (data, respbuf);
+ len += strlen (respbuf) + 1;
+
switch (*respbuf) {
case '+':
status = CAMEL_IMAP_PLUS;
break;
default:
- g_ptr_array_add (data, respbuf);
- len += strlen (respbuf) + 1;
-
status = camel_imap_status (cmdid, respbuf);
}
} else {