From df5bede1f424f7829ddee0ec3d93e0bc47283c75 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 9 Nov 2004 16:53:29 +0000 Subject: Handle not getting the CRLF pair together. Also don't require that we have 2004-11-09 Jeffrey Stedfast * providers/imap4/camel-imap4-stream.c (camel_imap4_stream_line): Handle not getting the CRLF pair together. Also don't require that we have at least 3 bytes in the read buffer as it is possible we don't have that much (see bug #69160). 2004-11-08 Jeffrey Stedfast * providers/imap4/camel-imap4-store.c (imap4_subscribe_folder): Note the folder-info just subscribed. (imap4_unsubscribe_folder): Unnote the folder-info. svn path=/trunk/; revision=27875 --- camel/ChangeLog | 13 +++++++++++++ camel/providers/imap4/camel-imap4-command.c | 8 ++++++-- camel/providers/imap4/camel-imap4-store-summary.c | 2 +- camel/providers/imap4/camel-imap4-store.c | 4 ++++ camel/providers/imap4/camel-imap4-stream.c | 14 +++++++------- 5 files changed, 31 insertions(+), 10 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index 847815130d..f343b0439b 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,16 @@ +2004-11-09 Jeffrey Stedfast + + * providers/imap4/camel-imap4-stream.c (camel_imap4_stream_line): + Handle not getting the CRLF pair together. Also don't require that + we have at least 3 bytes in the read buffer as it is possible we + don't have that much (see bug #69160). + +2004-11-08 Jeffrey Stedfast + + * providers/imap4/camel-imap4-store.c (imap4_subscribe_folder): + Note the folder-info just subscribed. + (imap4_unsubscribe_folder): Unnote the folder-info. + 2004-11-04 Jeffrey Stedfast * providers/imap4/camel-imap4-engine.c: Added much in-line diff --git a/camel/providers/imap4/camel-imap4-command.c b/camel/providers/imap4/camel-imap4-command.c index b01abe9141..e869bee9c3 100644 --- a/camel/providers/imap4/camel-imap4-command.c +++ b/camel/providers/imap4/camel-imap4-command.c @@ -602,7 +602,7 @@ camel_imap4_command_step (CamelIMAP4Command *ic) goto exception; } else if (token.token == CAMEL_IMAP4_TOKEN_ATOM && !strcmp (token.v.atom, ic->tag)) { /* we got " OK/NO/BAD" */ - fprintf (stderr, "got %s response\n", token.v.atom); + d(fprintf (stderr, "got %s response\n", token.v.atom)); if (camel_imap4_engine_next_token (engine, &token, &ic->ex) == -1) goto exception; @@ -616,7 +616,7 @@ camel_imap4_command_step (CamelIMAP4Command *ic) result = CAMEL_IMAP4_RESULT_BAD; if (result == CAMEL_IMAP4_RESULT_NONE) { - fprintf (stderr, "expected OK/NO/BAD but got %s\n", token.v.atom); + d(fprintf (stderr, "expected OK/NO/BAD but got %s\n", token.v.atom)); goto unexpected; } @@ -634,18 +634,22 @@ camel_imap4_command_step (CamelIMAP4Command *ic) goto exception; } } else { +#if d(!)0 fprintf (stderr, "expected anything but this: "); unexpected_token (&token); fprintf (stderr, "\n"); +#endif goto unexpected; } break; } else { +#if d(!)0 fprintf (stderr, "wtf is this: "); unexpected_token (&token); fprintf (stderr, "\n"); +#endif unexpected: diff --git a/camel/providers/imap4/camel-imap4-store-summary.c b/camel/providers/imap4/camel-imap4-store-summary.c index 7c08469acf..ffa4bd05f1 100644 --- a/camel/providers/imap4/camel-imap4-store-summary.c +++ b/camel/providers/imap4/camel-imap4-store-summary.c @@ -180,7 +180,7 @@ summary_header_load (CamelStoreSummary *s, FILE *in) is->version = version; if (version < CAMEL_IMAP4_STORE_SUMMARY_VERSION_0) { - g_warning ("Store summary header version too low"); + g_warning ("IMAP4 store summary header version too low"); errno = EINVAL; return -1; } diff --git a/camel/providers/imap4/camel-imap4-store.c b/camel/providers/imap4/camel-imap4-store.c index adf8ffbbe4..890ff4797d 100644 --- a/camel/providers/imap4/camel-imap4-store.c +++ b/camel/providers/imap4/camel-imap4-store.c @@ -1323,6 +1323,8 @@ imap4_subscribe_folder (CamelStore *store, const char *folder_name, CamelExcepti fi->unread = -1; fi->total = -1; + camel_imap4_store_summary_note_info (((CamelIMAP4Store *) store)->summary, fi); + camel_object_trigger_event (store, "folder_subscribed", fi); camel_folder_info_free (fi); break; @@ -1394,6 +1396,8 @@ imap4_unsubscribe_folder (CamelStore *store, const char *folder_name, CamelExcep fi->unread = -1; fi->total = -1; + camel_imap4_store_summary_unnote_info (((CamelIMAP4Store *) store)->summary, fi); + camel_object_trigger_event (store, "folder_unsubscribed", fi); camel_folder_info_free (fi); break; diff --git a/camel/providers/imap4/camel-imap4-stream.c b/camel/providers/imap4/camel-imap4-stream.c index 42100b04de..32d1a20b40 100644 --- a/camel/providers/imap4/camel-imap4-stream.c +++ b/camel/providers/imap4/camel-imap4-stream.c @@ -631,8 +631,7 @@ camel_imap4_stream_line (CamelIMAP4Stream *stream, unsigned char **line, size_t g_return_val_if_fail (line != NULL, -1); g_return_val_if_fail (len != NULL, -1); - if ((stream->inend - stream->inptr) < 3) { - /* keep our buffer full to the optimal size */ + if ((stream->inend - stream->inptr) < 2 && *stream->inptr != '\n') { if (imap4_fill (stream) == -1 && stream->inptr == stream->inend) return -1; } @@ -646,15 +645,16 @@ camel_imap4_stream_line (CamelIMAP4Stream *stream, unsigned char **line, size_t inptr++; *len = (inptr - stream->inptr); + + if (inptr > stream->inptr && inptr[-1] == '\r') + inptr[-1] = '\0'; + if (inptr < inend) { /* got the eoln */ - if (inptr > stream->inptr && inptr[-1] == '\r') - inptr[-1] = '\0'; - else - inptr[0] = '\0'; + inptr[0] = '\0'; + *len += 1; stream->inptr = inptr + 1; - *len += 1; return 0; } -- cgit v1.2.3