From: Chenthill Palanisamy Date: Tue, 9 Feb 2010 13:05:25 +0000 (+0530) Subject: Bug 609393 - evolution crashed when clicked on search folder X-Git-Tag: upstream/3.7.4~3390 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ab39045afaabf183b18821f2744c6958a403ab72;p=platform%2Fupstream%2Fevolution-data-server.git Bug 609393 - evolution crashed when clicked on search folder Change the function signatures adhering to the provider namespace. --- diff --git a/camel/providers/imapx/Makefile.am b/camel/providers/imapx/Makefile.am index b0ae1b9..3749f78 100644 --- a/camel/providers/imapx/Makefile.am +++ b/camel/providers/imapx/Makefile.am @@ -34,7 +34,7 @@ noinst_HEADERS = \ camel-imapx-utils.h camel-imapx-tokenise.h: camel-imapx-tokens.txt - gperf -H imap_hash -N imap_tokenise_struct -L ANSI-C -o -t -k1,$$ $< > $@ + gperf -H imapx_hash -N imapx_tokenise_struct -L ANSI-C -o -t -k1,$$ $< > $@ libcamelimapx_la_LIBADD = \ $(top_builddir)/libedataserver/libedataserver-${API_VERSION}.la \ diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c index 7dc8d57..d17689f 100644 --- a/camel/providers/imapx/camel-imapx-server.c +++ b/camel/providers/imapx/camel-imapx-server.c @@ -585,7 +585,7 @@ imapx_command_addv(CamelIMAPXCommand *ic, const gchar *fmt, va_list ap) case 'F': /* IMAP flags set */ f = va_arg(ap, guint32); F = va_arg(ap, CamelFlag *); - imap_write_flags((CamelStream *)ic->mem, f, F, &ex); + imapx_write_flags((CamelStream *)ic->mem, f, F, &ex); break; case 'c': d = va_arg(ap, gint); @@ -675,7 +675,7 @@ camel_imapx_command_free(CamelIMAPXCommand *ic) if (ic->mem) camel_object_unref((CamelObject *)ic->mem); - imap_free_status(ic->status); + imapx_free_status(ic->status); g_free(ic->select); while ((cp = ((CamelIMAPXCommandPart *)camel_dlist_remhead(&ic->parts)))) { @@ -1005,7 +1005,7 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex) if (camel_exception_is_set (ex)) return -1; - if (tok == IMAP_TOK_INT) { + if (tok == IMAPX_TOK_INT) { id = strtoul((gchar *) token, NULL, 10); tok = camel_imapx_stream_token(imap->stream, &token, &len, ex); } @@ -1020,14 +1020,14 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex) while ((c = *p)) *p++ = toupper((gchar) c); - switch (imap_tokenise ((const gchar *) token, len)) { - case IMAP_CAPABILITY: + switch (imapx_tokenise ((const gchar *) token, len)) { + case IMAPX_CAPABILITY: if (imap->cinfo) - imap_free_capability(imap->cinfo); - imap->cinfo = imap_parse_capability(imap->stream, ex); + imapx_free_capability(imap->cinfo); + imap->cinfo = imapx_parse_capability(imap->stream, ex); printf("got capability flags %08x\n", imap->cinfo->capa); return 0; - case IMAP_EXPUNGE: { + case IMAPX_EXPUNGE: { guint32 expunge = id; printf("expunged: %d\n", id); @@ -1041,7 +1041,7 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex) uid = camel_folder_summary_uid_from_index (imap->select_folder->summary, expunge - 1); mi = camel_folder_summary_uid (imap->select_folder->summary, uid); if (mi) { - imap_update_summary_for_removed_message (mi, imap->select_folder); + imapx_update_summary_for_removed_message (mi, imap->select_folder); camel_message_info_free (mi); } @@ -1052,7 +1052,7 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex) if (imapx_idle_supported (imap) && imapx_in_idle (imap)) { camel_db_delete_uids (imap->store->cdb_w, imap->select_folder->full_name, imap->expunged, NULL); - imap_update_store_summary (imap->select_folder); + imapx_update_store_summary (imap->select_folder); camel_object_trigger_event(imap->select_folder, "folder_changed", imap->changes); g_slist_foreach (imap->expunged, (GFunc) g_free, NULL); @@ -1063,10 +1063,10 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex) break; } - case IMAP_NAMESPACE: { + case IMAPX_NAMESPACE: { CamelIMAPXNamespaceList *nsl = NULL; - nsl = imap_parse_namespace_list (imap->stream, ex); + nsl = imapx_parse_namespace_list (imap->stream, ex); if (nsl != NULL) { CamelIMAPXStore *imapx_store = (CamelIMAPXStore *) imap->store; @@ -1076,7 +1076,7 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex) return 0; } - case IMAP_EXISTS: + case IMAPX_EXISTS: c(printf("exists: %d\n", id)); imap->exists = id; @@ -1089,20 +1089,20 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex) } break; - case IMAP_FLAGS: { + case IMAPX_FLAGS: { guint32 flags; - imap_parse_flags(imap->stream, &flags, NULL, ex); + imapx_parse_flags(imap->stream, &flags, NULL, ex); c(printf("flags: %08x\n", flags)); break; } - case IMAP_FETCH: { + case IMAPX_FETCH: { struct _fetch_info *finfo; - finfo = imap_parse_fetch(imap->stream, ex); + finfo = imapx_parse_fetch(imap->stream, ex); if (camel_exception_is_set (ex)) { - imap_free_fetch(finfo); + imapx_free_fetch(finfo); return -1; } @@ -1143,7 +1143,7 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex) { mi = camel_folder_summary_uid (folder->summary, uid); if (mi) - changed = imap_update_message_info_flags (mi, finfo->flags, finfo->user_flags, folder); + changed = imapx_update_message_info_flags (mi, finfo->flags, finfo->user_flags, folder); finfo->user_flags = NULL; } @@ -1157,7 +1157,7 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex) if (imapx_idle_supported (imap) && changed && imapx_in_idle (imap)) { camel_folder_summary_save_to_db (imap->select_folder->summary, NULL); - imap_update_store_summary (imap->select_folder); + imapx_update_store_summary (imap->select_folder); camel_object_trigger_event(imap->select_folder, "folder_changed", imap->changes); camel_folder_change_info_clear (imap->changes); } @@ -1253,7 +1253,7 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex) if (!camel_folder_summary_check_uid (job->folder->summary, mi->uid)) { camel_folder_summary_add(job->folder->summary, mi); - imap_set_message_info_flags_for_new_message (mi, server_flags, server_user_flags, job->folder); + imapx_set_message_info_flags_for_new_message (mi, server_flags, server_user_flags, job->folder); camel_folder_change_info_add_uid (job->u.refresh_info.changes, mi->uid); camel_operation_progress (job->op, (camel_folder_summary_count (job->folder->summary) * 100)/imap->exists); @@ -1262,13 +1262,13 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex) } } - imap_free_fetch(finfo); + imapx_free_fetch(finfo); break; } - case IMAP_LSUB: + case IMAPX_LSUB: lsub = TRUE; - case IMAP_LIST: { - struct _list_info *linfo = imap_parse_list(imap->stream, ex); + case IMAPX_LIST: { + struct _list_info *linfo = imapx_parse_list(imap->stream, ex); CamelIMAPXJob *job = imapx_match_active_job(imap, IMAPX_JOB_LIST, linfo->name); // TODO: we want to make sure the names match? @@ -1280,16 +1280,16 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex) g_hash_table_insert(job->u.list.folders, linfo->name, linfo); } else { g_warning("got list response but no current listing job happening?\n"); - imap_free_list(linfo); + imapx_free_list(linfo); } break; } - case IMAP_RECENT: + case IMAPX_RECENT: printf("recent: %d\n", id); imap->recent = id; break; - case IMAP_STATUS: { - struct _state_info *sinfo = imap_parse_status_info (imap->stream, ex); + case IMAPX_STATUS: { + struct _state_info *sinfo = imapx_parse_status_info (imap->stream, ex); if (sinfo) { /* this is what we use atm */ imap->exists = sinfo->messages; @@ -1299,40 +1299,40 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex) } break; } - case IMAP_BYE: case IMAP_OK: case IMAP_NO: case IMAP_BAD: case IMAP_PREAUTH: + case IMAPX_BYE: case IMAPX_OK: case IMAPX_NO: case IMAPX_BAD: case IMAPX_PREAUTH: /* TODO: validate which ones of these can happen as unsolicited responses */ /* TODO: handle bye/preauth differently */ camel_imapx_stream_ungettoken(imap->stream, tok, token, len); - sinfo = imap_parse_status(imap->stream, ex); + sinfo = imapx_parse_status(imap->stream, ex); camel_object_trigger_event(imap, "status", sinfo); switch (sinfo->condition) { - case IMAP_READ_WRITE: + case IMAPX_READ_WRITE: imap->mode = IMAPX_MODE_READ|IMAPX_MODE_WRITE; printf("folder is read-write\n"); break; - case IMAP_READ_ONLY: + case IMAPX_READ_ONLY: imap->mode = IMAPX_MODE_READ; printf("folder is read-only\n"); break; - case IMAP_UIDVALIDITY: + case IMAPX_UIDVALIDITY: imap->uidvalidity = sinfo->u.uidvalidity; break; - case IMAP_UNSEEN: + case IMAPX_UNSEEN: imap->unseen = sinfo->u.unseen; break; - case IMAP_PERMANENTFLAGS: + case IMAPX_PERMANENTFLAGS: imap->permanentflags = sinfo->u.permanentflags; break; - case IMAP_ALERT: + case IMAPX_ALERT: printf("ALERT!: %s\n", sinfo->text); break; - case IMAP_PARSE: + case IMAPX_PARSE: printf("PARSE: %s\n", sinfo->text); break; default: break; } - imap_free_status(sinfo); + imapx_free_status(sinfo); return 0; default: /* unknown response, just ignore it */ @@ -1490,7 +1490,7 @@ imapx_completion(CamelIMAPXServer *imap, guchar *token, gint len, CamelException imap->expunged = NULL; } - imap_update_store_summary (imap->select_folder); + imapx_update_store_summary (imap->select_folder); camel_object_trigger_event(imap->select_folder, "folder_changed", imap->changes); camel_folder_change_info_clear (imap->changes); } @@ -1517,7 +1517,7 @@ imapx_completion(CamelIMAPXServer *imap, guchar *token, gint len, CamelException camel_dlist_remove ((CamelDListNode *) ic); QUEUE_UNLOCK(imap); - ic->status = imap_parse_status(imap->stream, ex); + ic->status = imapx_parse_status(imap->stream, ex); if (ic->complete) ic->complete (imap, ic); @@ -1543,7 +1543,7 @@ imapx_step(CamelIMAPXServer *is, CamelException *ex) if (tok == '*') imapx_untagged (is, ex); - else if (tok == IMAP_TOK_TOKEN) + else if (tok == IMAPX_TOK_TOKEN) imapx_completion (is, token, len, ex); else if (tok == '+') imapx_continuation (is, ex); @@ -1631,7 +1631,7 @@ imapx_command_idle_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic) { CamelIMAPXIdle *idle = is->idle; - if (camel_exception_is_set (ic->ex) || ic->status->result != IMAP_OK) { + if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) { if (!camel_exception_is_set (ic->ex)) camel_exception_setv(ic->job->ex, 1, "Error performing IDLE: %s", ic->status->text); else @@ -1816,7 +1816,7 @@ imapx_in_idle (CamelIMAPXServer *is) static gboolean imapx_idle_supported (CamelIMAPXServer *is) { - return (is->cinfo && is->cinfo->capa & IMAP_CAPABILITY_IDLE && is->use_idle); + return (is->cinfo && is->cinfo->capa & IMAPX_CAPABILITY_IDLE && is->use_idle); } // end IDLE @@ -1825,7 +1825,7 @@ static void imapx_command_select_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic) { - if (camel_exception_is_set (ic->ex) || ic->status->result != IMAP_OK) { + if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) { CamelDList failed; CamelIMAPXCommand *cw, *cn; @@ -1849,7 +1849,7 @@ imapx_command_select_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic) if (cw) { cn = cw->next; while (cn) { - cw->status = imap_copy_status(ic->status); + cw->status = imapx_copy_status(ic->status); camel_exception_setv (cw->ex, 1, "select %s failed", cw->select); cw->complete(is, cw); cw = cn; @@ -2034,7 +2034,7 @@ imapx_connect (CamelIMAPXServer *is, gint ssl_mode, gint try_starttls, CamelExce if (ssl_mode == 2) { - if (!(is->cinfo->capa & IMAP_CAPABILITY_STARTTLS)) { + if (!(is->cinfo->capa & IMAPX_CAPABILITY_STARTTLS)) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Failed to connect to IMAP server %s in secure mode: %s"), is->url->host, _("STARTTLS not supported")); @@ -2116,7 +2116,7 @@ retry: /* After login we re-capa */ if (is->cinfo) { - imap_free_capability(is->cinfo); + imapx_free_capability(is->cinfo); is->cinfo = NULL; } @@ -2134,7 +2134,7 @@ retry: imapx_init_idle (is); /* Fetch namespaces */ - if (is->cinfo->capa & IMAP_CAPABILITY_NAMESPACE) { + if (is->cinfo->capa & IMAPX_CAPABILITY_NAMESPACE) { ic = camel_imapx_command_new ("NAMESPACE", NULL, "NAMESPACE"); imapx_command_run (is, ic, ex); camel_imapx_command_free (ic); @@ -2204,7 +2204,7 @@ imapx_command_fetch_message_done(CamelIMAPXServer *is, CamelIMAPXCommand *ic) job->commands--; - if (camel_exception_is_set (ic->ex) || ic->status->result != IMAP_OK) { + if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) { failed = TRUE; job->u.get_message.body_len = -1; if (job->u.get_message.stream) { @@ -2329,7 +2329,7 @@ imapx_command_copy_messages_step_done (CamelIMAPXServer *is, CamelIMAPXCommand * gint i = job->u.copy_messages.index; GPtrArray *uids = job->u.copy_messages.uids; - if (camel_exception_is_set (ic->ex) || ic->status->result != IMAP_OK) { + if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) { if (!camel_exception_is_set (ic->ex)) camel_exception_set (job->ex, 1, "Error copying messages"); else @@ -2346,7 +2346,7 @@ imapx_command_copy_messages_step_done (CamelIMAPXServer *is, CamelIMAPXCommand * } /* TODO copy the summary and cached messages to the new folder. We might need a sorted insert to avoid refreshing the dest folder */ - if (ic->status->condition == IMAP_COPYUID) { + if (ic->status->condition == IMAPX_COPYUID) { } @@ -2389,8 +2389,8 @@ imapx_command_append_message_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic) mi = camel_message_info_clone(job->u.append_message.info); old_uid = g_strdup (mi->uid); - if (!camel_exception_is_set (ic->ex) && ic->status->result == IMAP_OK) { - if (ic->status->condition == IMAP_APPENDUID) { + if (!camel_exception_is_set (ic->ex) && ic->status->result == IMAPX_OK) { + if (ic->status->condition == IMAPX_APPENDUID) { printf("Got appenduid %d %d\n", (gint)ic->status->u.appenduid.uidvalidity, (gint)ic->status->u.appenduid.uid); if (ic->status->u.appenduid.uidvalidity == is->uidvalidity) { CamelFolderChangeInfo *changes; @@ -2512,7 +2512,7 @@ imapx_command_step_fetch_done(CamelIMAPXServer *is, CamelIMAPXCommand *ic) gint i = job->u.refresh_info.index; GArray *infos = job->u.refresh_info.infos; - if (camel_exception_is_set (ic->ex) || ic->status->result != IMAP_OK) { + if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) { if (!camel_exception_is_set (ic->ex)) camel_exception_set (job->ex, 1, "Error fetching message headers"); else @@ -2522,7 +2522,7 @@ imapx_command_step_fetch_done(CamelIMAPXServer *is, CamelIMAPXCommand *ic) } if (camel_folder_change_info_changed(job->u.refresh_info.changes)) { - imap_update_store_summary (job->folder); + imapx_update_store_summary (job->folder); camel_folder_summary_save_to_db (job->folder->summary, NULL); camel_object_trigger_event(job->folder, "folder_changed", job->u.refresh_info.changes); } @@ -2605,7 +2605,7 @@ imapx_job_refresh_info_done(CamelIMAPXServer *is, CamelIMAPXCommand *ic) gint i; GArray *infos = job->u.refresh_info.infos; - if (!camel_exception_is_set (ic->ex) && ic->status->result == IMAP_OK) { + if (!camel_exception_is_set (ic->ex) && ic->status->result == IMAPX_OK) { GCompareDataFunc uid_cmp = imapx_uid_cmp; const CamelMessageInfo *s_minfo = NULL; CamelIMAPXMessageInfo *info; @@ -2645,7 +2645,7 @@ imapx_job_refresh_info_done(CamelIMAPXServer *is, CamelIMAPXCommand *ic) info = (CamelIMAPXMessageInfo *)s_minfo; if (info->server_flags != r->server_flags - && imap_update_message_info_flags ((CamelMessageInfo *) info, r->server_flags, r->server_user_flags, job->folder)) + && imapx_update_message_info_flags ((CamelMessageInfo *) info, r->server_flags, r->server_user_flags, job->folder)) camel_folder_change_info_change_uid (job->u.refresh_info.changes, camel_message_info_uid (s_minfo)); r->exists = TRUE; } else @@ -2677,7 +2677,7 @@ imapx_job_refresh_info_done(CamelIMAPXServer *is, CamelIMAPXCommand *ic) mi = camel_folder_summary_uid (is->select_folder->summary, uid); if (mi) { - imap_update_summary_for_removed_message (mi, is->select_folder); + imapx_update_summary_for_removed_message (mi, is->select_folder); camel_message_info_free (mi); } @@ -2686,7 +2686,7 @@ imapx_job_refresh_info_done(CamelIMAPXServer *is, CamelIMAPXCommand *ic) } camel_db_delete_uids (is->store->cdb_w, s->folder->full_name, removed, NULL); - imap_update_store_summary (job->folder); + imapx_update_store_summary (job->folder); if (camel_folder_change_info_changed(job->u.refresh_info.changes)) camel_object_trigger_event(job->folder, "folder_changed", job->u.refresh_info.changes); @@ -2737,7 +2737,7 @@ imapx_job_refresh_info_start(CamelIMAPXServer *is, CamelIMAPXJob *job) static void imapx_command_fetch_new_messages_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic) { - if (camel_exception_is_set (ic->ex) || ic->status->result != IMAP_OK) { + if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) { if (!camel_exception_is_set (ic->ex)) camel_exception_setv(ic->job->ex, 1, "Error fetching new messages : %s", ic->status->text); else @@ -2746,7 +2746,7 @@ imapx_command_fetch_new_messages_done (CamelIMAPXServer *is, CamelIMAPXCommand * } if (camel_folder_change_info_changed(ic->job->u.refresh_info.changes)) { - imap_update_store_summary (ic->job->folder); + imapx_update_store_summary (ic->job->folder); camel_folder_summary_save_to_db (ic->job->folder->summary, NULL); camel_object_trigger_event(ic->job->folder, "folder_changed", ic->job->u.refresh_info.changes); } @@ -2803,7 +2803,7 @@ imapx_job_fetch_new_messages_start (CamelIMAPXServer *is, CamelIMAPXJob *job) static void imapx_command_expunge_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic) { - if (camel_exception_is_set (ic->ex) || ic->status->result != IMAP_OK) { + if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) { if (!camel_exception_is_set (ic->ex)) camel_exception_setv(ic->job->ex, 1, "Error expunging message : %s", ic->status->text); else @@ -2830,7 +2830,7 @@ imapx_job_expunge_start(CamelIMAPXServer *is, CamelIMAPXJob *job) static void imapx_command_list_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic) { - if (camel_exception_is_set (ic->ex) || ic->status->result != IMAP_OK) { + if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) { if (!camel_exception_is_set (ic->ex)) camel_exception_setv(ic->job->ex, 1, "Error fetching folders : %s", ic->status->text); else @@ -2858,7 +2858,7 @@ imapx_job_list_start(CamelIMAPXServer *is, CamelIMAPXJob *job) static void imapx_command_noop_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic) { - if (camel_exception_is_set (ic->ex) || ic->status->result != IMAP_OK) { + if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) { if (!camel_exception_is_set (ic->ex)) camel_exception_setv(ic->job->ex, 1, "Error performing NOOP: %s", ic->status->text); else @@ -2926,7 +2926,7 @@ imapx_command_sync_changes_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic) that what we just set is actually what is on the server now .. but if it isn't, i guess we'll fix up next refresh */ - if (camel_exception_is_set (ic->ex) || ic->status->result != IMAP_OK) { + if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) { if (!camel_exception_is_set (ic->ex)) camel_exception_setv(job->ex, 1, "Error syncing changes: %s", ic->status->text); else @@ -3711,7 +3711,7 @@ camel_imapx_server_refresh_info (CamelIMAPXServer *is, CamelFolder *folder, Came ic->complete = imapx_command_status_done; imapx_command_run_sync (is, ic); - if (camel_exception_is_set (ic->ex) || ic->status->result != IMAP_OK) { + if (camel_exception_is_set (ic->ex) || ic->status->result != IMAPX_OK) { if (!camel_exception_is_set (ic->ex)) camel_exception_setv(job->ex, 1, "Error refreshing folder: %s", ic->status->text); else diff --git a/camel/providers/imapx/camel-imapx-store.c b/camel/providers/imapx/camel-imapx-store.c index 1b6ece4..e010341 100644 --- a/camel/providers/imapx/camel-imapx-store.c +++ b/camel/providers/imapx/camel-imapx-store.c @@ -741,7 +741,7 @@ static void free_list (gpointer data, gpointer user_data) { struct _list_info *li = data; - imap_free_list (li); + imapx_free_list (li); } static void diff --git a/camel/providers/imapx/camel-imapx-stream.c b/camel/providers/imapx/camel-imapx-stream.c index 7f0977f..64f3fe7 100644 --- a/camel/providers/imapx/camel-imapx-stream.c +++ b/camel/providers/imapx/camel-imapx-stream.c @@ -235,8 +235,8 @@ skip_ws(CamelIMAPXStream *is, guchar *pp, guchar *pe) do { while (p >= e ) { is->ptr = p; - if (stream_fill(is) == IMAP_TOK_ERROR) - return IMAP_TOK_ERROR; + if (stream_fill(is) == IMAPX_TOK_ERROR) + return IMAPX_TOK_ERROR; p = is->ptr; e = is->end; } @@ -259,18 +259,18 @@ camel_imapx_stream_atom(CamelIMAPXStream *is, guchar **data, guint *lenp, CamelE /* this is only 'approximate' atom */ switch (camel_imapx_stream_token(is, data, lenp, ex)) { - case IMAP_TOK_TOKEN: + case IMAPX_TOK_TOKEN: p = *data; while ((c = *p)) *p++ = toupper(c); - case IMAP_TOK_INT: + case IMAPX_TOK_INT: return 0; - case IMAP_TOK_ERROR: - return IMAP_TOK_ERROR; + case IMAPX_TOK_ERROR: + return IMAPX_TOK_ERROR; default: camel_exception_set (ex, 1, "expecting atom"); printf("expecting atom!\n"); - return IMAP_TOK_PROTOCOL; + return IMAPX_TOK_PROTOCOL; } } @@ -283,16 +283,16 @@ camel_imapx_stream_astring(CamelIMAPXStream *is, guchar **data, CamelException * gint ret; switch (camel_imapx_stream_token(is, data, &len, ex)) { - case IMAP_TOK_TOKEN: - case IMAP_TOK_INT: - case IMAP_TOK_STRING: + case IMAPX_TOK_TOKEN: + case IMAPX_TOK_INT: + case IMAPX_TOK_STRING: return 0; - case IMAP_TOK_LITERAL: + case IMAPX_TOK_LITERAL: /* FIXME: just grow buffer */ if (len >= CAMEL_IMAPX_STREAM_TOKEN) { camel_exception_set (ex, 1, "astring: literal too long"); printf("astring too long\n"); - return IMAP_TOK_PROTOCOL; + return IMAPX_TOK_PROTOCOL; } p = is->tokenptr; camel_imapx_stream_set_literal(is, len); @@ -305,13 +305,13 @@ camel_imapx_stream_astring(CamelIMAPXStream *is, guchar **data, CamelException * } while (ret > 0); *data = is->tokenptr; return 0; - case IMAP_TOK_ERROR: + case IMAPX_TOK_ERROR: /* wont get unless no exception hanlder*/ - return IMAP_TOK_ERROR; + return IMAPX_TOK_ERROR; default: camel_exception_set (ex, 1, "expecting astring"); printf("expecting astring!\n"); - return IMAP_TOK_PROTOCOL; + return IMAPX_TOK_PROTOCOL; } } @@ -324,13 +324,13 @@ camel_imapx_stream_nstring(CamelIMAPXStream *is, guchar **data, CamelException * gint ret; switch (camel_imapx_stream_token(is, data, &len, ex)) { - case IMAP_TOK_STRING: + case IMAPX_TOK_STRING: return 0; - case IMAP_TOK_LITERAL: + case IMAPX_TOK_LITERAL: /* FIXME: just grow buffer */ if (len >= CAMEL_IMAPX_STREAM_TOKEN) { camel_exception_set (ex, 1, "nstring: literal too long"); - return IMAP_TOK_PROTOCOL; + return IMAPX_TOK_PROTOCOL; } p = is->tokenptr; camel_imapx_stream_set_literal(is, len); @@ -343,7 +343,7 @@ camel_imapx_stream_nstring(CamelIMAPXStream *is, guchar **data, CamelException * } while (ret > 0); *data = is->tokenptr; return 0; - case IMAP_TOK_TOKEN: + case IMAPX_TOK_TOKEN: p = *data; if (toupper(p[0]) == 'N' && toupper(p[1]) == 'I' && toupper(p[2]) == 'L' && p[3] == 0) { *data = NULL; @@ -351,10 +351,10 @@ camel_imapx_stream_nstring(CamelIMAPXStream *is, guchar **data, CamelException * } default: camel_exception_set (ex, 1, "expecting nstring"); - return IMAP_TOK_PROTOCOL; - case IMAP_TOK_ERROR: + return IMAPX_TOK_PROTOCOL; + case IMAPX_TOK_ERROR: /* we'll never get this unless there are no exception handlers anyway */ - return IMAP_TOK_ERROR; + return IMAPX_TOK_ERROR; } } @@ -372,11 +372,11 @@ camel_imapx_stream_nstring_stream(CamelIMAPXStream *is, CamelStream **stream, Ca *stream = NULL; switch (camel_imapx_stream_token(is, &token, &len, ex)) { - case IMAP_TOK_STRING: + case IMAPX_TOK_STRING: mem = camel_stream_mem_new_with_buffer((gchar *)token, len); *stream = mem; break; - case IMAP_TOK_LITERAL: + case IMAPX_TOK_LITERAL: /* if len is big, we could automatically use a file backing */ camel_imapx_stream_set_literal(is, len); mem = camel_stream_mem_new(); @@ -389,7 +389,7 @@ camel_imapx_stream_nstring_stream(CamelIMAPXStream *is, CamelStream **stream, Ca camel_stream_reset(mem); *stream = mem; break; - case IMAP_TOK_TOKEN: + case IMAPX_TOK_TOKEN: if (toupper(token[0]) == 'N' && toupper(token[1]) == 'I' && toupper(token[2]) == 'L' && token[3] == 0) { *stream = NULL; break; @@ -408,7 +408,7 @@ camel_imapx_stream_number(CamelIMAPXStream *is, CamelException *ex) guchar *token; guint len; - if (camel_imapx_stream_token(is, &token, &len, ex) != IMAP_TOK_INT) { + if (camel_imapx_stream_token(is, &token, &len, ex) != IMAPX_TOK_INT) { camel_exception_set (ex, 1, "expecting number"); return 0; } @@ -426,9 +426,9 @@ camel_imapx_stream_text(CamelIMAPXStream *is, guchar **text, CamelException *ex) while (is->unget > 0) { switch (is->unget_tok) { - case IMAP_TOK_TOKEN: - case IMAP_TOK_STRING: - case IMAP_TOK_INT: + case IMAPX_TOK_TOKEN: + case IMAPX_TOK_STRING: + case IMAPX_TOK_INT: g_byte_array_append(build, (guint8 *) is->unget_token, is->unget_len); g_byte_array_append(build, (guint8 *) " ", 1); default: /* invalid, but we'll ignore */ @@ -484,7 +484,7 @@ camel_imapx_stream_token(CamelIMAPXStream *is, guchar **data, guint *len, CamelE do { while (p >= e ) { is->ptr = p; - if (stream_fill(is) == IMAP_TOK_ERROR) + if (stream_fill(is) == IMAPX_TOK_ERROR) goto io_error; p = is->ptr; e = is->end; @@ -514,11 +514,11 @@ camel_imapx_stream_token(CamelIMAPXStream *is, guchar **data, guint *len, CamelE is->ptr = p; is->literal = literal; t(printf("token LITERAL %d\n", literal)); - return IMAP_TOK_LITERAL; + return IMAPX_TOK_LITERAL; } } is->ptr = p; - if (stream_fill(is) == IMAP_TOK_ERROR) + if (stream_fill(is) == IMAPX_TOK_ERROR) goto io_error; p = is->ptr; e = is->end; @@ -532,7 +532,7 @@ camel_imapx_stream_token(CamelIMAPXStream *is, guchar **data, guint *len, CamelE } } is->ptr = p; - if (stream_fill(is) == IMAP_TOK_ERROR) + if (stream_fill(is) == IMAPX_TOK_ERROR) goto io_error; p = is->ptr; e = is->end; @@ -546,7 +546,7 @@ camel_imapx_stream_token(CamelIMAPXStream *is, guchar **data, guint *len, CamelE if (c == '\\') { while (p >= e) { is->ptr = p; - if (stream_fill(is) == IMAP_TOK_ERROR) + if (stream_fill(is) == IMAPX_TOK_ERROR) goto io_error; p = is->ptr; e = is->end; @@ -558,7 +558,7 @@ camel_imapx_stream_token(CamelIMAPXStream *is, guchar **data, guint *len, CamelE *data = is->tokenbuf; *len = o - is->tokenbuf; t(printf("token STRING '%s'\n", is->tokenbuf)); - return IMAP_TOK_STRING; + return IMAPX_TOK_STRING; } if (c == '\n' || c == '\r' || o>=oe) { @@ -572,7 +572,7 @@ camel_imapx_stream_token(CamelIMAPXStream *is, guchar **data, guint *len, CamelE } } is->ptr = p; - if (stream_fill(is) == IMAP_TOK_ERROR) + if (stream_fill(is) == IMAPX_TOK_ERROR) goto io_error; p = is->ptr; e = is->end; @@ -595,7 +595,7 @@ camel_imapx_stream_token(CamelIMAPXStream *is, guchar **data, guint *len, CamelE *data = is->tokenbuf; *len = o - is->tokenbuf; t(printf("token TOKEN '%s'\n", is->tokenbuf)); - return digits?IMAP_TOK_INT:IMAP_TOK_TOKEN; + return digits?IMAPX_TOK_INT:IMAPX_TOK_TOKEN; } else if (o < oe) { digits &= isdigit(c); *o++ = c; @@ -605,7 +605,7 @@ camel_imapx_stream_token(CamelIMAPXStream *is, guchar **data, guint *len, CamelE } } is->ptr = p; - if (stream_fill(is) == IMAP_TOK_ERROR) + if (stream_fill(is) == IMAPX_TOK_ERROR) goto io_error; p = is->ptr; e = is->end; @@ -615,7 +615,7 @@ camel_imapx_stream_token(CamelIMAPXStream *is, guchar **data, guint *len, CamelE /* Had an i/o erorr */ io_error: camel_exception_set (ex, 1, "io error"); - return IMAP_TOK_ERROR; + return IMAPX_TOK_ERROR; /* Protocol error, skip until next lf? */ protocol_error: @@ -627,7 +627,7 @@ protocol_error: is->ptr = p; camel_exception_set (ex, 1, "protocol error"); - return IMAP_TOK_PROTOCOL; + return IMAPX_TOK_PROTOCOL; } void @@ -709,7 +709,7 @@ camel_imapx_stream_skip(CamelIMAPXStream *is, CamelException *ex) do { tok = camel_imapx_stream_token(is, &token, &len, ex); - if (tok == IMAP_TOK_LITERAL) { + if (tok == IMAPX_TOK_LITERAL) { camel_imapx_stream_set_literal(is, len); while ((tok = camel_imapx_stream_getl(is, &token, &len)) > 0) { printf("Skip literal data '%.*s'\n", (gint)len, token); diff --git a/camel/providers/imapx/camel-imapx-stream.h b/camel/providers/imapx/camel-imapx-stream.h index 8a8ce67..174c2cf 100644 --- a/camel/providers/imapx/camel-imapx-stream.h +++ b/camel/providers/imapx/camel-imapx-stream.h @@ -31,12 +31,12 @@ typedef struct _CamelIMAPXStreamClass CamelIMAPXStreamClass; typedef struct _CamelIMAPXStream CamelIMAPXStream; typedef enum { - IMAP_TOK_PROTOCOL = -2, - IMAP_TOK_ERROR = -1, - IMAP_TOK_TOKEN = 256, - IMAP_TOK_STRING, - IMAP_TOK_INT, - IMAP_TOK_LITERAL, + IMAPX_TOK_PROTOCOL = -2, + IMAPX_TOK_ERROR = -1, + IMAPX_TOK_TOKEN = 256, + IMAPX_TOK_STRING, + IMAPX_TOK_INT, + IMAPX_TOK_LITERAL, } camel_imapx_token_t; struct _CamelIMAPXStream { diff --git a/camel/providers/imapx/camel-imapx-tokenise.h b/camel/providers/imapx/camel-imapx-tokenise.h index 770a740..61feed3 100644 --- a/camel/providers/imapx/camel-imapx-tokenise.h +++ b/camel/providers/imapx/camel-imapx-tokenise.h @@ -1,5 +1,5 @@ /* ANSI-C code produced by gperf version 3.0.2 */ -/* Command-line: gperf -H imap_hash -N imap_tokenise_struct -L ANSI-C -o -t -k'1,$' camel-imapx-tokens.txt */ +/* Command-line: gperf -H imapx_hash -N imapx_tokenise_struct -L ANSI-C -o -t -k'1,$' camel-imapx-tokens.txt */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ @@ -29,7 +29,7 @@ #endif #line 3 "camel-imapx-tokens.txt" -struct _imap_keyword {const gchar *name; camel_imapx_id_t id; }; +struct _imapx_keyword {const gchar *name; camel_imapx_id_t id; }; #define TOTAL_KEYWORDS 36 #define MIN_WORD_LENGTH 2 @@ -45,10 +45,10 @@ __inline inline #endif #endif -static guint -imap_hash (register const gchar *str, register guint len) +static unsigned int +imapx_hash (register const char *str, register unsigned int len) { - static guchar asso_values[] = + static unsigned char asso_values[] = { 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, @@ -77,108 +77,108 @@ imap_hash (register const gchar *str, register guint len) 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57 }; - return len + asso_values[(guchar)str[len - 1]] + asso_values[(guchar)str[0]]; + return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]]; } #ifdef __GNUC__ __inline #endif -struct _imap_keyword * -imap_tokenise_struct (register const gchar *str, register guint len) +struct _imapx_keyword * +imapx_tokenise_struct (register const char *str, register unsigned int len) { - static struct _imap_keyword wordlist[] = + static struct _imapx_keyword wordlist[] = { {""}, {""}, {""}, {""}, {""}, #line 26 "camel-imapx-tokens.txt" - {"PARSE", IMAP_PARSE}, + {"PARSE", IMAPX_PARSE}, {""}, #line 15 "camel-imapx-tokens.txt" - {"EXPUNGE", IMAP_EXPUNGE}, + {"EXPUNGE", IMAPX_EXPUNGE}, #line 13 "camel-imapx-tokens.txt" - {"ENVELOPE", IMAP_ENVELOPE}, + {"ENVELOPE", IMAPX_ENVELOPE}, {""}, #line 30 "camel-imapx-tokens.txt" - {"READ-WRITE", IMAP_READ_WRITE}, + {"READ-WRITE", IMAPX_READ_WRITE}, #line 33 "camel-imapx-tokens.txt" - {"RFC822.SIZE", IMAP_RFC822_SIZE}, + {"RFC822.SIZE", IMAPX_RFC822_SIZE}, #line 28 "camel-imapx-tokens.txt" - {"PREAUTH", IMAP_PREAUTH}, + {"PREAUTH", IMAPX_PREAUTH}, #line 32 "camel-imapx-tokens.txt" - {"RFC822.HEADER", IMAP_RFC822_HEADER}, + {"RFC822.HEADER", IMAPX_RFC822_HEADER}, #line 29 "camel-imapx-tokens.txt" - {"READ-ONLY", IMAP_READ_ONLY}, + {"READ-ONLY", IMAPX_READ_ONLY}, #line 16 "camel-imapx-tokens.txt" - {"FETCH", IMAP_FETCH}, + {"FETCH", IMAPX_FETCH}, #line 31 "camel-imapx-tokens.txt" - {"RECENT", IMAP_RECENT}, + {"RECENT", IMAPX_RECENT}, #line 25 "camel-imapx-tokens.txt" - {"OK", IMAP_OK}, + {"OK", IMAPX_OK}, #line 10 "camel-imapx-tokens.txt" - {"BYE", IMAP_BYE}, + {"BYE", IMAPX_BYE}, #line 36 "camel-imapx-tokens.txt" - {"TRYCREATE", IMAP_TRYCREATE}, + {"TRYCREATE", IMAPX_TRYCREATE}, {""}, #line 34 "camel-imapx-tokens.txt" - {"RFC822.TEXT", IMAP_RFC822_TEXT}, + {"RFC822.TEXT", IMAPX_RFC822_TEXT}, #line 18 "camel-imapx-tokens.txt" - {"INTERNALDATE", IMAP_INTERNALDATE}, + {"INTERNALDATE", IMAPX_INTERNALDATE}, {""}, #line 8 "camel-imapx-tokens.txt" - {"BODY", IMAP_BODY}, + {"BODY", IMAPX_BODY}, #line 11 "camel-imapx-tokens.txt" - {"CAPABILITY", IMAP_CAPABILITY}, + {"CAPABILITY", IMAPX_CAPABILITY}, #line 38 "camel-imapx-tokens.txt" - {"UIDVALIDITY", IMAP_UIDVALIDITY}, + {"UIDVALIDITY", IMAPX_UIDVALIDITY}, #line 40 "camel-imapx-tokens.txt" - {"UIDNEXT", IMAP_UIDNEXT}, + {"UIDNEXT", IMAPX_UIDNEXT}, #line 9 "camel-imapx-tokens.txt" - {"BODYSTRUCTURE", IMAP_BODYSTRUCTURE}, + {"BODYSTRUCTURE", IMAPX_BODYSTRUCTURE}, {""}, {""}, #line 14 "camel-imapx-tokens.txt" - {"EXISTS", IMAP_EXISTS}, + {"EXISTS", IMAPX_EXISTS}, #line 23 "camel-imapx-tokens.txt" - {"NEWNAME", IMAP_NEWNAME}, + {"NEWNAME", IMAPX_NEWNAME}, #line 37 "camel-imapx-tokens.txt" - {"UID", IMAP_UID}, + {"UID", IMAPX_UID}, #line 22 "camel-imapx-tokens.txt" - {"NAMESPACE", IMAP_NAMESPACE}, + {"NAMESPACE", IMAPX_NAMESPACE}, #line 17 "camel-imapx-tokens.txt" - {"FLAGS", IMAP_FLAGS}, + {"FLAGS", IMAPX_FLAGS}, {""}, #line 12 "camel-imapx-tokens.txt" - {"COPYUID", IMAP_COPYUID}, + {"COPYUID", IMAPX_COPYUID}, #line 7 "camel-imapx-tokens.txt" - {"BAD", IMAP_BAD}, + {"BAD", IMAPX_BAD}, #line 27 "camel-imapx-tokens.txt" - {"PERMANENTFLAGS", IMAP_PERMANENTFLAGS}, + {"PERMANENTFLAGS", IMAPX_PERMANENTFLAGS}, #line 5 "camel-imapx-tokens.txt" - {"ALERT", IMAP_ALERT}, + {"ALERT", IMAPX_ALERT}, #line 39 "camel-imapx-tokens.txt" - {"UNSEEN", IMAP_UNSEEN}, + {"UNSEEN", IMAPX_UNSEEN}, #line 24 "camel-imapx-tokens.txt" - {"NO", IMAP_NO}, + {"NO", IMAPX_NO}, #line 21 "camel-imapx-tokens.txt" - {"MESSAGES", IMAP_MESSAGES}, + {"MESSAGES", IMAPX_MESSAGES}, #line 19 "camel-imapx-tokens.txt" - {"LIST", IMAP_LIST}, + {"LIST", IMAPX_LIST}, {""}, {""}, {""}, {""}, #line 20 "camel-imapx-tokens.txt" - {"LSUB", IMAP_LSUB}, + {"LSUB", IMAPX_LSUB}, {""}, {""}, {""}, {""}, #line 6 "camel-imapx-tokens.txt" - {"APPENDUID", IMAP_APPENDUID}, + {"APPENDUID", IMAPX_APPENDUID}, {""}, #line 35 "camel-imapx-tokens.txt" - {"STATUS", IMAP_STATUS} + {"STATUS", IMAPX_STATUS} }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { - register gint key = imap_hash (str, len); + register int key = imapx_hash (str, len); if (key <= MAX_HASH_VALUE && key >= 0) { - register const gchar *s = wordlist[key].name; + register const char *s = wordlist[key].name; if (*str == *s && !strcmp (str + 1, s + 1)) return &wordlist[key]; diff --git a/camel/providers/imapx/camel-imapx-tokens.txt b/camel/providers/imapx/camel-imapx-tokens.txt index e84ecf7..8156e01 100644 --- a/camel/providers/imapx/camel-imapx-tokens.txt +++ b/camel/providers/imapx/camel-imapx-tokens.txt @@ -1,40 +1,40 @@ /* This contains all of the keywords we care about. These can be converted to an id very efficiently */ -struct _imap_keyword {const gchar *name; camel_imapx_id_t id; }; +struct _imapx_keyword {const gchar *name; camel_imapx_id_t id; }; %% -ALERT, IMAP_ALERT -APPENDUID, IMAP_APPENDUID -BAD, IMAP_BAD -BODY, IMAP_BODY -BODYSTRUCTURE, IMAP_BODYSTRUCTURE -BYE, IMAP_BYE -CAPABILITY, IMAP_CAPABILITY -COPYUID, IMAP_COPYUID -ENVELOPE, IMAP_ENVELOPE -EXISTS, IMAP_EXISTS -EXPUNGE, IMAP_EXPUNGE -FETCH, IMAP_FETCH -FLAGS, IMAP_FLAGS -INTERNALDATE, IMAP_INTERNALDATE -LIST, IMAP_LIST -LSUB, IMAP_LSUB -MESSAGES, IMAP_MESSAGES -NAMESPACE, IMAP_NAMESPACE -NEWNAME, IMAP_NEWNAME -NO, IMAP_NO -OK, IMAP_OK -PARSE, IMAP_PARSE -PERMANENTFLAGS, IMAP_PERMANENTFLAGS -PREAUTH, IMAP_PREAUTH -READ-ONLY, IMAP_READ_ONLY -READ-WRITE, IMAP_READ_WRITE -RECENT, IMAP_RECENT -RFC822.HEADER, IMAP_RFC822_HEADER -RFC822.SIZE, IMAP_RFC822_SIZE -RFC822.TEXT, IMAP_RFC822_TEXT -STATUS, IMAP_STATUS -TRYCREATE, IMAP_TRYCREATE -UID, IMAP_UID -UIDVALIDITY, IMAP_UIDVALIDITY -UNSEEN, IMAP_UNSEEN -UIDNEXT, IMAP_UIDNEXT +ALERT, IMAPX_ALERT +APPENDUID, IMAPX_APPENDUID +BAD, IMAPX_BAD +BODY, IMAPX_BODY +BODYSTRUCTURE, IMAPX_BODYSTRUCTURE +BYE, IMAPX_BYE +CAPABILITY, IMAPX_CAPABILITY +COPYUID, IMAPX_COPYUID +ENVELOPE, IMAPX_ENVELOPE +EXISTS, IMAPX_EXISTS +EXPUNGE, IMAPX_EXPUNGE +FETCH, IMAPX_FETCH +FLAGS, IMAPX_FLAGS +INTERNALDATE, IMAPX_INTERNALDATE +LIST, IMAPX_LIST +LSUB, IMAPX_LSUB +MESSAGES, IMAPX_MESSAGES +NAMESPACE, IMAPX_NAMESPACE +NEWNAME, IMAPX_NEWNAME +NO, IMAPX_NO +OK, IMAPX_OK +PARSE, IMAPX_PARSE +PERMANENTFLAGS, IMAPX_PERMANENTFLAGS +PREAUTH, IMAPX_PREAUTH +READ-ONLY, IMAPX_READ_ONLY +READ-WRITE, IMAPX_READ_WRITE +RECENT, IMAPX_RECENT +RFC822.HEADER, IMAPX_RFC822_HEADER +RFC822.SIZE, IMAPX_RFC822_SIZE +RFC822.TEXT, IMAPX_RFC822_TEXT +STATUS, IMAPX_STATUS +TRYCREATE, IMAPX_TRYCREATE +UID, IMAPX_UID +UIDVALIDITY, IMAPX_UIDVALIDITY +UNSEEN, IMAPX_UNSEEN +UIDNEXT, IMAPX_UIDNEXT diff --git a/camel/providers/imapx/camel-imapx-utils.c b/camel/providers/imapx/camel-imapx-utils.c index 8a52841..98ee536 100644 --- a/camel/providers/imapx/camel-imapx-utils.c +++ b/camel/providers/imapx/camel-imapx-utils.c @@ -28,9 +28,9 @@ __inline #endif camel_imapx_id_t -imap_tokenise (register const gchar *str, register guint len) +imapx_tokenise (register const gchar *str, register guint len) { - struct _imap_keyword *k = imap_tokenise_struct(str, len); + struct _imapx_keyword *k = imapx_tokenise_struct(str, len); if (k) return k->id; @@ -58,7 +58,7 @@ static struct { shoudl this be part of imapx-driver? */ /* mabye this should be a stream op? */ void -imap_parse_flags(CamelIMAPXStream *stream, guint32 *flagsp, CamelFlag **user_flagsp, CamelException *ex) +imapx_parse_flags(CamelIMAPXStream *stream, guint32 *flagsp, CamelFlag **user_flagsp, CamelException *ex) /* throws IO,PARSE exception */ { gint tok, i; @@ -72,7 +72,7 @@ imap_parse_flags(CamelIMAPXStream *stream, guint32 *flagsp, CamelFlag **user_fla if (tok == '(') { do { tok = camel_imapx_stream_token(stream, &token, &len, ex); - if (tok == IMAP_TOK_TOKEN) { + if (tok == IMAPX_TOK_TOKEN) { p = token; // FIXME: ascii_toupper while ((c=*p)) @@ -139,7 +139,7 @@ rename_label_flag (const gchar *flag, gint len, gboolean server_to_evo) } void -imap_write_flags(CamelStream *stream, guint32 flags, CamelFlag *user_flags, CamelException *ex) +imapx_write_flags(CamelStream *stream, guint32 flags, CamelFlag *user_flags, CamelException *ex) /* throws IO exception */ { gint i; @@ -191,7 +191,7 @@ imap_write_flags(CamelStream *stream, guint32 flags, CamelFlag *user_flags, Came } static gboolean -imap_update_user_flags (CamelMessageInfo *info, CamelFlag *server_user_flags) +imapx_update_user_flags (CamelMessageInfo *info, CamelFlag *server_user_flags) { gboolean changed = FALSE; CamelMessageInfoBase *binfo = (CamelMessageInfoBase *) info; @@ -210,7 +210,7 @@ imap_update_user_flags (CamelMessageInfo *info, CamelFlag *server_user_flags) } gboolean -imap_update_message_info_flags (CamelMessageInfo *info, guint32 server_flags, CamelFlag *server_user_flags, CamelFolder *folder) +imapx_update_message_info_flags (CamelMessageInfo *info, guint32 server_flags, CamelFlag *server_user_flags, CamelFolder *folder) { gboolean changed = FALSE; CamelIMAPXMessageInfo *xinfo = (CamelIMAPXMessageInfo *) info; @@ -261,14 +261,14 @@ imap_update_message_info_flags (CamelMessageInfo *info, guint32 server_flags, Ca changed = TRUE; } - if ((folder->permanent_flags & CAMEL_MESSAGE_USER) != 0 && imap_update_user_flags (info, server_user_flags)) + if ((folder->permanent_flags & CAMEL_MESSAGE_USER) != 0 && imapx_update_user_flags (info, server_user_flags)) changed = TRUE; return changed; } void -imap_set_message_info_flags_for_new_message (CamelMessageInfo *info, guint32 server_flags, CamelFlag *server_user_flags, CamelFolder *folder) +imapx_set_message_info_flags_for_new_message (CamelMessageInfo *info, guint32 server_flags, CamelFlag *server_user_flags, CamelFolder *folder) { CamelMessageInfoBase *binfo = (CamelMessageInfoBase *) info; CamelIMAPXMessageInfo *xinfo = (CamelIMAPXMessageInfo *) info; @@ -279,7 +279,7 @@ imap_set_message_info_flags_for_new_message (CamelMessageInfo *info, guint32 ser xinfo->server_flags = server_flags; if (folder->permanent_flags & CAMEL_MESSAGE_USER) - imap_update_user_flags (info, server_user_flags); + imapx_update_user_flags (info, server_user_flags); /* update the summary count */ flags = binfo->flags; @@ -315,7 +315,7 @@ imap_set_message_info_flags_for_new_message (CamelMessageInfo *info, guint32 ser } void -imap_update_summary_for_removed_message (CamelMessageInfo *info, CamelFolder *folder) +imapx_update_summary_for_removed_message (CamelMessageInfo *info, CamelFolder *folder) { CamelMessageInfoBase *dinfo = (CamelMessageInfoBase *) info; gint unread=0, deleted=0, junk=0; @@ -349,7 +349,7 @@ imap_update_summary_for_removed_message (CamelMessageInfo *info, CamelFolder *fo } void -imap_update_store_summary (CamelFolder *folder) +imapx_update_store_summary (CamelFolder *folder) { CamelStoreInfo *si; @@ -380,18 +380,18 @@ struct { const gchar *name; guint32 flag; } capa_table[] = { - { "IMAP4", IMAP_CAPABILITY_IMAP4 }, - { "IMAP4REV1", IMAP_CAPABILITY_IMAP4REV1 }, - { "STATUS", IMAP_CAPABILITY_STATUS } , - { "NAMESPACE", IMAP_CAPABILITY_NAMESPACE }, - { "UIDPLUS", IMAP_CAPABILITY_UIDPLUS }, - { "LITERAL+", IMAP_CAPABILITY_LITERALPLUS }, - { "STARTTLS", IMAP_CAPABILITY_STARTTLS }, - { "IDLE", IMAP_CAPABILITY_IDLE }, + { "IMAP4", IMAPX_CAPABILITY_IMAP4 }, + { "IMAP4REV1", IMAPX_CAPABILITY_IMAP4REV1 }, + { "STATUS", IMAPX_CAPABILITY_STATUS } , + { "NAMESPACE", IMAPX_CAPABILITY_NAMESPACE }, + { "UIDPLUS", IMAPX_CAPABILITY_UIDPLUS }, + { "LITERAL+", IMAPX_CAPABILITY_LITERALPLUS }, + { "STARTTLS", IMAPX_CAPABILITY_STARTTLS }, + { "IDLE", IMAPX_CAPABILITY_IDLE }, }; struct _capability_info * -imap_parse_capability(CamelIMAPXStream *stream, CamelException *ex) +imapx_parse_capability(CamelIMAPXStream *stream, CamelException *ex) { gint tok, i; guint len; @@ -407,12 +407,12 @@ imap_parse_capability(CamelIMAPXStream *stream, CamelException *ex) case 43: token = (guchar *) g_strconcat ((gchar *)token, "+", NULL); free_token = TRUE; - case IMAP_TOK_TOKEN: - case IMAP_TOK_STRING: + case IMAPX_TOK_TOKEN: + case IMAPX_TOK_STRING: p = token; while ((c = *p)) *p++ = toupper(c); - case IMAP_TOK_INT: + case IMAPX_TOK_INT: printf(" cap: '%s'\n", token); for (i = 0; i < G_N_ELEMENTS (capa_table); i++) if (!strcmp((gchar *) token, capa_table[i].name)) @@ -430,20 +430,20 @@ imap_parse_capability(CamelIMAPXStream *stream, CamelException *ex) } if (camel_exception_is_set (ex)) { - imap_free_capability(cinfo); + imapx_free_capability(cinfo); cinfo = NULL; } return cinfo; } -void imap_free_capability(struct _capability_info *cinfo) +void imapx_free_capability(struct _capability_info *cinfo) { g_free(cinfo); } struct _CamelIMAPXNamespaceList * -imap_parse_namespace_list (CamelIMAPXStream *stream, CamelException *ex) +imapx_parse_namespace_list (CamelIMAPXStream *stream, CamelException *ex) { CamelIMAPXStoreNamespace *namespaces[3], *node, *tail; CamelIMAPXNamespaceList *nsl = NULL; @@ -467,7 +467,7 @@ imap_parse_namespace_list (CamelIMAPXStream *stream, CamelException *ex) while (tok == '(') { tok = camel_imapx_stream_token (stream, &token, &len, ex); - if (tok != IMAP_TOK_STRING) { + if (tok != IMAPX_TOK_STRING) { camel_exception_set (ex, 1, "namespace: expected a string path name"); goto exception; } @@ -480,7 +480,7 @@ imap_parse_namespace_list (CamelIMAPXStream *stream, CamelException *ex) tok = camel_imapx_stream_token (stream, &token, &len, ex); - if (tok == IMAP_TOK_STRING) { + if (tok == IMAPX_TOK_STRING) { if (strlen ((gchar *) token) == 1) { node->sep = *token; } else { @@ -489,7 +489,7 @@ imap_parse_namespace_list (CamelIMAPXStream *stream, CamelException *ex) else node->sep = '\0'; } - } else if (tok == IMAP_TOK_TOKEN) { + } else if (tok == IMAPX_TOK_TOKEN) { /* will a NIL be possible here? */ node->sep = '\0'; } else { @@ -522,7 +522,7 @@ imap_parse_namespace_list (CamelIMAPXStream *stream, CamelException *ex) goto exception; } - } else if (tok == IMAP_TOK_TOKEN && !strcmp ((gchar *) token, "NIL")) { + } else if (tok == IMAPX_TOK_TOKEN && !strcmp ((gchar *) token, "NIL")) { namespaces [n] = NULL; } else { camel_exception_set (ex, 1, "namespace: expected either a '(' or NIL"); @@ -665,14 +665,14 @@ struct _body_fields { };*/ void -imap_free_body(struct _CamelMessageContentInfo *cinfo) +imapx_free_body(struct _CamelMessageContentInfo *cinfo) { struct _CamelMessageContentInfo *list, *next; list = cinfo->childs; while (list) { next = list->next; - imap_free_body(list); + imapx_free_body(list); list = next; } @@ -685,7 +685,7 @@ imap_free_body(struct _CamelMessageContentInfo *cinfo) } void -imap_parse_param_list(CamelIMAPXStream *is, struct _camel_header_param **plist, CamelException *ex) +imapx_parse_param_list(CamelIMAPXStream *is, struct _camel_header_param **plist, CamelException *ex) { gint tok; guint len; @@ -713,7 +713,7 @@ imap_parse_param_list(CamelIMAPXStream *is, struct _camel_header_param **plist, } struct _CamelContentDisposition * -imap_parse_ext_optional(CamelIMAPXStream *is, CamelException *ex) +imapx_parse_ext_optional(CamelIMAPXStream *is, CamelException *ex) { gint tok; guint len; @@ -746,8 +746,8 @@ imap_parse_ext_optional(CamelIMAPXStream *is, CamelException *ex) camel_imapx_stream_astring(is, &token, ex); dinfo->disposition = g_strdup((gchar *) token); - imap_parse_param_list(is, &dinfo->params, ex); - case IMAP_TOK_TOKEN: + imapx_parse_param_list(is, &dinfo->params, ex); + case IMAPX_TOK_TOKEN: d(printf("body_fld_dsp: NIL\n")); break; default: @@ -768,20 +768,20 @@ imap_parse_ext_optional(CamelIMAPXStream *is, CamelException *ex) tok = camel_imapx_stream_token(is, &token, &len, ex); if (tok == ')') { break; - } else if (tok != IMAP_TOK_STRING) { + } else if (tok != IMAPX_TOK_STRING) { camel_exception_set (ex, 1, "expecting string"); break; } } break; - case IMAP_TOK_TOKEN: + case IMAPX_TOK_TOKEN: d(printf("body_fld_lang = nil\n")); /* treat as 'nil' */ break; - case IMAP_TOK_STRING: + case IMAPX_TOK_STRING: /* we have a string */ break; - case IMAP_TOK_LITERAL: + case IMAPX_TOK_LITERAL: /* we have a literal string */ camel_imapx_stream_set_literal(is, len); while ((tok = camel_imapx_stream_getl(is, &token, &len)) > 0) { @@ -800,7 +800,7 @@ imap_parse_ext_optional(CamelIMAPXStream *is, CamelException *ex) } struct _CamelMessageContentInfo * -imap_parse_body_fields(CamelIMAPXStream *is, CamelException *ex) +imapx_parse_body_fields(CamelIMAPXStream *is, CamelException *ex) { guchar *token; gchar *type; @@ -824,7 +824,7 @@ imap_parse_body_fields(CamelIMAPXStream *is, CamelException *ex) if (camel_exception_is_set (ex)) goto error; cinfo->type = camel_content_type_new(type, (gchar *) token); - imap_parse_param_list(is, &cinfo->type->params, ex); + imapx_parse_param_list(is, &cinfo->type->params, ex); if (camel_exception_is_set (ex)) goto error; @@ -854,12 +854,12 @@ imap_parse_body_fields(CamelIMAPXStream *is, CamelException *ex) return cinfo; error: - imap_free_body(cinfo); + imapx_free_body(cinfo); return cinfo; } struct _camel_header_address * -imap_parse_address_list(CamelIMAPXStream *is, CamelException *ex) +imapx_parse_address_list(CamelIMAPXStream *is, CamelException *ex) /* throws PARSE,IO exception */ { gint tok; @@ -938,7 +938,7 @@ imap_parse_address_list(CamelIMAPXStream *is, CamelException *ex) } struct _CamelMessageInfo * -imap_parse_envelope(CamelIMAPXStream *is, CamelException *ex) +imapx_parse_envelope(CamelIMAPXStream *is, CamelException *ex) { gint tok; guint len; @@ -974,10 +974,10 @@ imap_parse_envelope(CamelIMAPXStream *is, CamelException *ex) /* we merge from/sender into from, append should probably merge more smartly? */ /* env_from ::= "(" 1*address ")" / nil */ - addr_from = imap_parse_address_list(is, ex); + addr_from = imapx_parse_address_list(is, ex); /* env_sender ::= "(" 1*address ")" / nil */ - addr = imap_parse_address_list(is, ex); + addr = imapx_parse_address_list(is, ex); if (addr_from) { camel_header_address_list_clear(&addr); #if 0 @@ -999,11 +999,11 @@ imap_parse_envelope(CamelIMAPXStream *is, CamelException *ex) /* we dont keep reply_to */ /* env_reply_to ::= "(" 1*address ")" / nil */ - addr = imap_parse_address_list(is, ex); + addr = imapx_parse_address_list(is, ex); camel_header_address_list_clear(&addr); /* env_to ::= "(" 1*address ")" / nil */ - addr = imap_parse_address_list(is, ex); + addr = imapx_parse_address_list(is, ex); if (addr) { addrstr = camel_header_address_list_format(addr); minfo->to = camel_pstring_strdup(addrstr); @@ -1012,7 +1012,7 @@ imap_parse_envelope(CamelIMAPXStream *is, CamelException *ex) } /* env_cc ::= "(" 1*address ")" / nil */ - addr = imap_parse_address_list(is, ex); + addr = imapx_parse_address_list(is, ex); if (addr) { addrstr = camel_header_address_list_format(addr); minfo->cc = camel_pstring_strdup(addrstr); @@ -1023,7 +1023,7 @@ imap_parse_envelope(CamelIMAPXStream *is, CamelException *ex) /* we dont keep bcc either */ /* env_bcc ::= "(" 1*address ")" / nil */ - addr = imap_parse_address_list(is, ex); + addr = imapx_parse_address_list(is, ex); camel_header_address_list_clear(&addr); /* FIXME: need to put in-reply-to into references hash list */ @@ -1049,7 +1049,7 @@ imap_parse_envelope(CamelIMAPXStream *is, CamelException *ex) } struct _CamelMessageContentInfo * -imap_parse_body(CamelIMAPXStream *is, CamelException *ex) +imapx_parse_body(CamelIMAPXStream *is, CamelException *ex) { gint tok; guint len; @@ -1079,7 +1079,7 @@ imap_parse_body(CamelIMAPXStream *is, CamelException *ex) cinfo = g_malloc0(sizeof(*cinfo)); last = (struct _CamelMessageContentInfo *)&cinfo->childs; do { - subinfo = imap_parse_body(is, ex); + subinfo = imapx_parse_body(is, ex); last->next = subinfo; last = subinfo; subinfo->parent = cinfo; @@ -1103,14 +1103,14 @@ imap_parse_body(CamelIMAPXStream *is, CamelException *ex) tok = camel_imapx_stream_token(is, &token, &len, ex); camel_imapx_stream_ungettoken(is, tok, token, len); if (tok == '(') { - imap_parse_param_list(is, &cinfo->type->params, ex); + imapx_parse_param_list(is, &cinfo->type->params, ex); /* body_fld_dsp ::= "(" string SPACE body_fld_param ")" / nil */ tok = camel_imapx_stream_token(is, &token, &len, ex); camel_imapx_stream_ungettoken(is, tok, token, len); - if (tok == '(' || tok == IMAP_TOK_TOKEN) { - dinfo = imap_parse_ext_optional(is, ex); + if (tok == '(' || tok == IMAPX_TOK_TOKEN) { + dinfo = imapx_parse_ext_optional(is, ex); /* other extension fields?, soaked up below */ } else { camel_imapx_stream_ungettoken(is, tok, token, len); @@ -1127,7 +1127,7 @@ imap_parse_body(CamelIMAPXStream *is, CamelException *ex) d(printf("Single part body\n")); - cinfo = imap_parse_body_fields(is, ex); + cinfo = imapx_parse_body_fields(is, ex); d(printf("envelope?\n")); @@ -1136,9 +1136,9 @@ imap_parse_body(CamelIMAPXStream *is, CamelException *ex) camel_imapx_stream_ungettoken(is, tok, token, len); if (tok == '(') { /* what do we do with the envelope?? */ - minfo = imap_parse_envelope(is, ex); + minfo = imapx_parse_envelope(is, ex); /* what do we do with the message content info?? */ - //((CamelMessageInfoBase *)minfo)->content = imap_parse_body(is); + //((CamelMessageInfoBase *)minfo)->content = imapx_parse_body(is); camel_message_info_free(minfo); minfo = NULL; d(printf("Scanned envelope - what do i do with it?\n")); @@ -1148,7 +1148,7 @@ imap_parse_body(CamelIMAPXStream *is, CamelException *ex) /* do we have fld_lines following? */ tok = camel_imapx_stream_token(is, &token, &len, ex); - if (tok == IMAP_TOK_INT) { + if (tok == IMAPX_TOK_INT) { d(printf("field lines: %s\n", token)); tok = camel_imapx_stream_token(is, &token, &len, ex); } @@ -1171,8 +1171,8 @@ imap_parse_body(CamelIMAPXStream *is, CamelException *ex) tok = camel_imapx_stream_token(is, &token, &len, ex); camel_imapx_stream_ungettoken(is, tok, token, len); - if (tok == '(' || tok == IMAP_TOK_TOKEN) { - dinfo = imap_parse_ext_optional(is, ex); + if (tok == '(' || tok == IMAPX_TOK_TOKEN) { + dinfo = imapx_parse_ext_optional(is, ex); /* then other extension fields, soaked up below */ } } @@ -1190,7 +1190,7 @@ imap_parse_body(CamelIMAPXStream *is, CamelException *ex) /* CHEN TODO handle exceptions better */ if (camel_exception_is_set (ex)) { if (cinfo) - imap_free_body(cinfo); + imapx_free_body(cinfo); if (dinfo) camel_content_disposition_unref(dinfo); if (minfo) @@ -1206,7 +1206,7 @@ imap_parse_body(CamelIMAPXStream *is, CamelException *ex) } gchar * -imap_parse_section(CamelIMAPXStream *is, CamelException *ex) +imapx_parse_section(CamelIMAPXStream *is, CamelException *ex) { gint tok; guint len; @@ -1231,7 +1231,7 @@ imap_parse_section(CamelIMAPXStream *is, CamelException *ex) } tok = camel_imapx_stream_token(is, &token, &len, ex); - if (tok == IMAP_TOK_INT || tok == IMAP_TOK_TOKEN) + if (tok == IMAPX_TOK_INT || tok == IMAPX_TOK_TOKEN) section = g_strdup((gchar *) token); else if (tok == ']') { section = g_strdup(""); @@ -1249,7 +1249,7 @@ imap_parse_section(CamelIMAPXStream *is, CamelException *ex) if (tok == '(') { do { tok = camel_imapx_stream_token(is, &token, &len, ex); - if (tok == IMAP_TOK_STRING || tok == IMAP_TOK_TOKEN || tok == IMAP_TOK_INT) { + if (tok == IMAPX_TOK_STRING || tok == IMAPX_TOK_TOKEN || tok == IMAPX_TOK_INT) { /* ?do something? */ } else if (tok != ')') { camel_exception_set (ex, 1, "section: header fields: expecting string"); @@ -1270,7 +1270,7 @@ imap_parse_section(CamelIMAPXStream *is, CamelException *ex) } void -imap_free_fetch(struct _fetch_info *finfo) +imapx_free_fetch(struct _fetch_info *finfo) { if (finfo == NULL) return; @@ -1284,7 +1284,7 @@ imap_free_fetch(struct _fetch_info *finfo) if (finfo->minfo) camel_message_info_free(finfo->minfo); if (finfo->cinfo) - imap_free_body(finfo->cinfo); + imapx_free_body(finfo->cinfo); camel_flag_list_free(&finfo->user_flags); g_free(finfo->date); g_free(finfo->section); @@ -1296,7 +1296,7 @@ imap_free_fetch(struct _fetch_info *finfo) /* debug, dump one out */ void -imap_dump_fetch(struct _fetch_info *finfo) +imapx_dump_fetch(struct _fetch_info *finfo) { CamelStream *sout; gint fd; @@ -1348,7 +1348,7 @@ imap_dump_fetch(struct _fetch_info *finfo) } struct _fetch_info * -imap_parse_fetch(CamelIMAPXStream *is, CamelException *ex) +imapx_parse_fetch(CamelIMAPXStream *is, CamelException *ex) { gint tok; guint len; @@ -1364,51 +1364,51 @@ imap_parse_fetch(CamelIMAPXStream *is, CamelException *ex) return NULL; } - while ((tok = camel_imapx_stream_token(is, &token, &len, ex)) == IMAP_TOK_TOKEN) { + while ((tok = camel_imapx_stream_token(is, &token, &len, ex)) == IMAPX_TOK_TOKEN) { p = token; while ((c=*p)) *p++ = toupper(c); - switch (imap_tokenise((gchar *) token, len)) { - case IMAP_ENVELOPE: - finfo->minfo = imap_parse_envelope(is, ex); + switch (imapx_tokenise((gchar *) token, len)) { + case IMAPX_ENVELOPE: + finfo->minfo = imapx_parse_envelope(is, ex); finfo->got |= FETCH_MINFO; break; - case IMAP_FLAGS: - imap_parse_flags(is, &finfo->flags, &finfo->user_flags, ex); + case IMAPX_FLAGS: + imapx_parse_flags(is, &finfo->flags, &finfo->user_flags, ex); finfo->got |= FETCH_FLAGS; break; - case IMAP_INTERNALDATE: + case IMAPX_INTERNALDATE: camel_imapx_stream_nstring(is, &token, ex); /* TODO: convert to camel format? */ finfo->date = g_strdup((gchar *) token); finfo->got |= FETCH_DATE; break; - case IMAP_RFC822_HEADER: + case IMAPX_RFC822_HEADER: camel_imapx_stream_nstring_stream(is, &finfo->header, ex); finfo->got |= FETCH_HEADER; break; - case IMAP_RFC822_TEXT: + case IMAPX_RFC822_TEXT: camel_imapx_stream_nstring_stream(is, &finfo->text, ex); finfo->got |= FETCH_TEXT; break; - case IMAP_RFC822_SIZE: + case IMAPX_RFC822_SIZE: finfo->size = camel_imapx_stream_number(is, ex); finfo->got |= FETCH_SIZE; break; - case IMAP_BODYSTRUCTURE: - finfo->cinfo = imap_parse_body(is, ex); + case IMAPX_BODYSTRUCTURE: + finfo->cinfo = imapx_parse_body(is, ex); finfo->got |= FETCH_CINFO; break; - case IMAP_BODY: + case IMAPX_BODY: tok = camel_imapx_stream_token(is, &token, &len, ex); camel_imapx_stream_ungettoken(is, tok, token, len); if (tok == '(') { - finfo->cinfo = imap_parse_body(is, ex); + finfo->cinfo = imapx_parse_body(is, ex); finfo->got |= FETCH_CINFO; } else if (tok == '[') { - finfo->section = imap_parse_section(is, ex); + finfo->section = imapx_parse_section(is, ex); finfo->got |= FETCH_SECTION; tok = camel_imapx_stream_token(is, &token, &len, ex); if (token[0] == '<') { @@ -1420,13 +1420,13 @@ imap_parse_fetch(CamelIMAPXStream *is, CamelException *ex) finfo->got |= FETCH_BODY; } else { camel_exception_set (ex, 1, "unknown body response"); - imap_free_fetch(finfo); + imapx_free_fetch(finfo); return NULL; } break; - case IMAP_UID: + case IMAPX_UID: tok = camel_imapx_stream_token(is, &token, &len, ex); - if (tok != IMAP_TOK_INT) { + if (tok != IMAPX_TOK_INT) { camel_exception_set (ex, 1, "uid not integer"); } @@ -1434,7 +1434,7 @@ imap_parse_fetch(CamelIMAPXStream *is, CamelException *ex) finfo->got |= FETCH_UID; break; default: - imap_free_fetch(finfo); + imapx_free_fetch(finfo); camel_exception_set (ex, 1, "unknown body response"); return NULL; } @@ -1442,7 +1442,7 @@ imap_parse_fetch(CamelIMAPXStream *is, CamelException *ex) if (tok != ')') { camel_exception_set (ex, 1, "missing closing ')' on fetch response"); - imap_free_fetch (finfo); + imapx_free_fetch (finfo); return NULL; } @@ -1450,7 +1450,7 @@ imap_parse_fetch(CamelIMAPXStream *is, CamelException *ex) } struct _state_info * -imap_parse_status_info (struct _CamelIMAPXStream *is, CamelException *ex) +imapx_parse_status_info (struct _CamelIMAPXStream *is, CamelException *ex) { struct _state_info *sinfo; gint tok; @@ -1469,21 +1469,21 @@ imap_parse_status_info (struct _CamelIMAPXStream *is, CamelException *ex) return NULL; } - while ((tok = camel_imapx_stream_token(is, &token, &len, ex)) == IMAP_TOK_TOKEN) { - switch (imap_tokenise((gchar *) token, len)) { - case IMAP_MESSAGES: + while ((tok = camel_imapx_stream_token(is, &token, &len, ex)) == IMAPX_TOK_TOKEN) { + switch (imapx_tokenise((gchar *) token, len)) { + case IMAPX_MESSAGES: sinfo->messages = camel_imapx_stream_number (is, ex); break; - case IMAP_RECENT: + case IMAPX_RECENT: sinfo->recent = camel_imapx_stream_number (is, ex); break; - case IMAP_UIDNEXT: + case IMAPX_UIDNEXT: sinfo->uidnext = camel_imapx_stream_number (is, ex); break; - case IMAP_UIDVALIDITY: + case IMAPX_UIDVALIDITY: sinfo->uidvalidity = camel_imapx_stream_number (is, ex); break; - case IMAP_UNSEEN: + case IMAPX_UNSEEN: sinfo->unseen = camel_imapx_stream_number (is, ex); break; default: @@ -1515,7 +1515,7 @@ generate_uids_from_sequence (GPtrArray *uids, guint32 end_uid) } static GPtrArray * -imap_parse_uids (CamelIMAPXStream *is, CamelException *ex) +imapx_parse_uids (CamelIMAPXStream *is, CamelException *ex) { GPtrArray *uids = g_ptr_array_new (); gboolean is_prev_number = FALSE, sequence = FALSE; @@ -1524,7 +1524,7 @@ imap_parse_uids (CamelIMAPXStream *is, CamelException *ex) gint tok; tok = camel_imapx_stream_token (is, &token, &len, ex); - while (tok != ']'|| !(is_prev_number && tok == IMAP_TOK_INT)) { + while (tok != ']'|| !(is_prev_number && tok == IMAPX_TOK_INT)) { if (tok == ',') { is_prev_number = FALSE; sequence = FALSE; @@ -1545,7 +1545,7 @@ imap_parse_uids (CamelIMAPXStream *is, CamelException *ex) camel_imapx_stream_token (is, &token, &len, ex); } - if (is_prev_number && tok == IMAP_TOK_INT) + if (is_prev_number && tok == IMAPX_TOK_INT) camel_imapx_stream_ungettoken (is, tok, token, len); return uids; @@ -1554,7 +1554,7 @@ imap_parse_uids (CamelIMAPXStream *is, CamelException *ex) /* rfc 2060 section 7.1 Status Responses */ /* shoudl this start after [ or before the [? token_unget anyone? */ struct _status_info * -imap_parse_status(CamelIMAPXStream *is, CamelException *ex) +imapx_parse_status(CamelIMAPXStream *is, CamelException *ex) { gint tok; guint len; @@ -1575,13 +1575,13 @@ imap_parse_status(CamelIMAPXStream *is, CamelException *ex) ;; Status condition */ - sinfo->result = imap_tokenise((gchar *) token, len); + sinfo->result = imapx_tokenise((gchar *) token, len); switch (sinfo->result) { - case IMAP_OK: - case IMAP_NO: - case IMAP_BAD: - case IMAP_PREAUTH: - case IMAP_BYE: + case IMAPX_OK: + case IMAPX_NO: + case IMAPX_BAD: + case IMAPX_PREAUTH: + case IMAPX_BYE: break; default: camel_exception_set (ex, 1, "expecting OK/NO/BAD"); @@ -1592,47 +1592,47 @@ imap_parse_status(CamelIMAPXStream *is, CamelException *ex) tok = camel_imapx_stream_token(is, &token, &len, ex); if (tok == '[') { camel_imapx_stream_atom(is, &token, &len, ex); - sinfo->condition = imap_tokenise((gchar *) token, len); + sinfo->condition = imapx_tokenise((gchar *) token, len); /* parse any details */ switch (sinfo->condition) { - case IMAP_READ_ONLY: - case IMAP_READ_WRITE: - case IMAP_ALERT: - case IMAP_PARSE: - case IMAP_TRYCREATE: + case IMAPX_READ_ONLY: + case IMAPX_READ_WRITE: + case IMAPX_ALERT: + case IMAPX_PARSE: + case IMAPX_TRYCREATE: break; - case IMAP_APPENDUID: + case IMAPX_APPENDUID: sinfo->u.appenduid.uidvalidity = camel_imapx_stream_number(is, ex); sinfo->u.appenduid.uid = camel_imapx_stream_number(is, ex); break; - case IMAP_COPYUID: + case IMAPX_COPYUID: sinfo->u.copyuid.uidvalidity = camel_imapx_stream_number(is, ex); - sinfo->u.copyuid.uids = imap_parse_uids (is, ex); - sinfo->u.copyuid.copied_uids = imap_parse_uids (is, ex); + sinfo->u.copyuid.uids = imapx_parse_uids (is, ex); + sinfo->u.copyuid.copied_uids = imapx_parse_uids (is, ex); break; - case IMAP_NEWNAME: + case IMAPX_NEWNAME: /* the rfc doesn't specify the bnf for this */ camel_imapx_stream_astring(is, &token, ex); sinfo->u.newname.oldname = g_strdup((gchar *) token); camel_imapx_stream_astring(is, &token, ex); sinfo->u.newname.newname = g_strdup((gchar *) token); break; - case IMAP_PERMANENTFLAGS: + case IMAPX_PERMANENTFLAGS: /* we only care about \* for permanent flags, not user flags */ - imap_parse_flags(is, &sinfo->u.permanentflags, NULL, ex); + imapx_parse_flags(is, &sinfo->u.permanentflags, NULL, ex); break; - case IMAP_UIDVALIDITY: + case IMAPX_UIDVALIDITY: sinfo->u.uidvalidity = camel_imapx_stream_number(is, ex); break; - case IMAP_UIDNEXT: + case IMAPX_UIDNEXT: sinfo->u.uidnext = camel_imapx_stream_number (is, ex); break; - case IMAP_UNSEEN: + case IMAPX_UNSEEN: sinfo->u.unseen = camel_imapx_stream_number(is, ex); break; default: - sinfo->condition = IMAP_UNKNOWN; + sinfo->condition = IMAPX_UNKNOWN; printf("Got unknown response code: %s: ignored\n", token); } @@ -1641,7 +1641,7 @@ imap_parse_status(CamelIMAPXStream *is, CamelException *ex) tok = camel_imapx_stream_token(is, &token, &len, ex); if (tok == '\n') { camel_exception_set (ex, 1, "server response truncated"); - imap_free_status(sinfo); + imapx_free_status(sinfo); return NULL; } } while (tok != ']'); @@ -1656,14 +1656,14 @@ imap_parse_status(CamelIMAPXStream *is, CamelException *ex) } struct _status_info * -imap_copy_status(struct _status_info *sinfo) +imapx_copy_status(struct _status_info *sinfo) { struct _status_info *out; out = g_malloc(sizeof(*out)); memcpy(out, sinfo, sizeof(*out)); out->text = g_strdup(out->text); - if (out->condition == IMAP_NEWNAME) { + if (out->condition == IMAPX_NEWNAME) { out->u.newname.oldname = g_strdup(out->u.newname.oldname); out->u.newname.newname = g_strdup(out->u.newname.newname); } @@ -1672,17 +1672,17 @@ imap_copy_status(struct _status_info *sinfo) } void -imap_free_status(struct _status_info *sinfo) +imapx_free_status(struct _status_info *sinfo) { if (sinfo == NULL) return; switch (sinfo->condition) { - case IMAP_NEWNAME: + case IMAPX_NEWNAME: g_free(sinfo->u.newname.oldname); g_free(sinfo->u.newname.newname); break; - case IMAP_COPYUID: + case IMAPX_COPYUID: g_ptr_array_free (sinfo->u.copyuid.uids, FALSE); g_ptr_array_free (sinfo->u.copyuid.copied_uids, FALSE); break; @@ -1707,7 +1707,7 @@ static struct { }; struct _list_info * -imap_parse_list(CamelIMAPXStream *is, CamelException *ex) +imapx_parse_list(CamelIMAPXStream *is, CamelException *ex) /* throws io, parse */ { gint tok, i; @@ -1729,7 +1729,7 @@ imap_parse_list(CamelIMAPXStream *is, CamelException *ex) } while ((tok = camel_imapx_stream_token(is, &token, &len, ex)) != ')') { - if (tok == IMAP_TOK_STRING || tok == IMAP_TOK_TOKEN) { + if (tok == IMAPX_TOK_STRING || tok == IMAPX_TOK_TOKEN) { p = token; while ((c=*p)) *p++ = toupper(c); @@ -1737,7 +1737,7 @@ imap_parse_list(CamelIMAPXStream *is, CamelException *ex) if (!strcmp((gchar *) token, list_flag_table[i].name)) linfo->flags |= list_flag_table[i].flag; } else { - imap_free_list(linfo); + imapx_free_list(linfo); camel_exception_set (ex, 1, "list: expecting flag or ')'"); return NULL; } @@ -1777,7 +1777,7 @@ imapx_list_get_path(struct _list_info *li) } void -imap_free_list(struct _list_info *linfo) +imapx_free_list(struct _list_info *linfo) { if (linfo) { g_free(linfo->name); @@ -1920,15 +1920,15 @@ imapx_path_to_physical (const gchar *prefix, const gchar *vpath) } gchar * -imapx_concat (CamelIMAPXStore *imap_store, const gchar *prefix, const gchar *suffix) +imapx_concat (CamelIMAPXStore *imapx_store, const gchar *prefix, const gchar *suffix) { gsize len; len = strlen (prefix); - if (len == 0 || prefix[len - 1] == imap_store->dir_sep) + if (len == 0 || prefix[len - 1] == imapx_store->dir_sep) return g_strdup_printf ("%s%s", prefix, suffix); else - return g_strdup_printf ("%s%c%s", prefix, imap_store->dir_sep, suffix); + return g_strdup_printf ("%s%c%s", prefix, imapx_store->dir_sep, suffix); } static void diff --git a/camel/providers/imapx/camel-imapx-utils.h b/camel/providers/imapx/camel-imapx-utils.h index f793cd6..1c13aa8 100644 --- a/camel/providers/imapx/camel-imapx-utils.h +++ b/camel/providers/imapx/camel-imapx-utils.h @@ -12,47 +12,47 @@ struct _CamelIMAPXNamespaceList; /* list of strings we know about that can be *quickly* tokenised */ typedef enum _camel_imapx_id_t { - IMAP_UNKNOWN = 0, - IMAP_ALERT, - IMAP_APPENDUID, - IMAP_BAD, - IMAP_BODY, - IMAP_BODYSTRUCTURE, - IMAP_BYE, - IMAP_CAPABILITY, - IMAP_COPYUID, - IMAP_ENVELOPE, - IMAP_EXISTS, - IMAP_EXPUNGE, - IMAP_FETCH, - IMAP_FLAGS, - IMAP_INTERNALDATE, - IMAP_LIST, - IMAP_LSUB, - IMAP_MESSAGES, - IMAP_NAMESPACE, - IMAP_NEWNAME, - IMAP_NO, - IMAP_OK, - IMAP_PARSE, - IMAP_PERMANENTFLAGS, - IMAP_PREAUTH, - IMAP_READ_ONLY, - IMAP_READ_WRITE, - IMAP_RECENT, - IMAP_RFC822_HEADER, - IMAP_RFC822_SIZE, - IMAP_RFC822_TEXT, - IMAP_STATUS, - IMAP_TRYCREATE, - IMAP_UID, - IMAP_UIDVALIDITY, - IMAP_UNSEEN, - IMAP_UIDNEXT, + IMAPX_UNKNOWN = 0, + IMAPX_ALERT, + IMAPX_APPENDUID, + IMAPX_BAD, + IMAPX_BODY, + IMAPX_BODYSTRUCTURE, + IMAPX_BYE, + IMAPX_CAPABILITY, + IMAPX_COPYUID, + IMAPX_ENVELOPE, + IMAPX_EXISTS, + IMAPX_EXPUNGE, + IMAPX_FETCH, + IMAPX_FLAGS, + IMAPX_INTERNALDATE, + IMAPX_LIST, + IMAPX_LSUB, + IMAPX_MESSAGES, + IMAPX_NAMESPACE, + IMAPX_NEWNAME, + IMAPX_NO, + IMAPX_OK, + IMAPX_PARSE, + IMAPX_PERMANENTFLAGS, + IMAPX_PREAUTH, + IMAPX_READ_ONLY, + IMAPX_READ_WRITE, + IMAPX_RECENT, + IMAPX_RFC822_HEADER, + IMAPX_RFC822_SIZE, + IMAPX_RFC822_TEXT, + IMAPX_STATUS, + IMAPX_TRYCREATE, + IMAPX_UID, + IMAPX_UIDVALIDITY, + IMAPX_UNSEEN, + IMAPX_UIDNEXT, } camel_imapx_id_t; /* str MUST be in upper case, tokenised using gperf function */ -camel_imapx_id_t imap_tokenise(register const gchar *str, register guint len); +camel_imapx_id_t imapx_tokenise(register const gchar *str, register guint len); /* this flag should be part of imapfoldersummary */ enum { @@ -61,24 +61,24 @@ enum { /* ********************************************************************** */ -void imap_parse_flags(struct _CamelIMAPXStream *stream, guint32 *flagsp, struct _CamelFlag **user_flagsp, CamelException *ex); -void imap_write_flags(CamelStream *stream, guint32 flags, struct _CamelFlag *user_flags, CamelException *ex); -gboolean imap_update_message_info_flags (CamelMessageInfo *info, guint32 server_flags, CamelFlag *server_user_flags, CamelFolder *folder); -void imap_set_message_info_flags_for_new_message (CamelMessageInfo *info, guint32 server_flags, CamelFlag *server_user_flags, +void imapx_parse_flags(struct _CamelIMAPXStream *stream, guint32 *flagsp, struct _CamelFlag **user_flagsp, CamelException *ex); +void imapx_write_flags(CamelStream *stream, guint32 flags, struct _CamelFlag *user_flags, CamelException *ex); +gboolean imapx_update_message_info_flags (CamelMessageInfo *info, guint32 server_flags, CamelFlag *server_user_flags, CamelFolder *folder); +void imapx_set_message_info_flags_for_new_message (CamelMessageInfo *info, guint32 server_flags, CamelFlag *server_user_flags, CamelFolder *folder); -void imap_update_summary_for_removed_message (CamelMessageInfo *info, CamelFolder *folder); -void imap_update_store_summary (CamelFolder *folder); +void imapx_update_summary_for_removed_message (CamelMessageInfo *info, CamelFolder *folder); +void imapx_update_store_summary (CamelFolder *folder); /* ********************************************************************** */ enum { - IMAP_CAPABILITY_IMAP4 = (1 << 0), - IMAP_CAPABILITY_IMAP4REV1 = (1 << 1), - IMAP_CAPABILITY_STATUS = (1 << 2), - IMAP_CAPABILITY_NAMESPACE = (1 << 3), - IMAP_CAPABILITY_UIDPLUS = (1 << 4), - IMAP_CAPABILITY_LITERALPLUS = (1 << 5), - IMAP_CAPABILITY_STARTTLS = (1 << 6), - IMAP_CAPABILITY_IDLE = (1 << 7), + IMAPX_CAPABILITY_IMAP4 = (1 << 0), + IMAPX_CAPABILITY_IMAP4REV1 = (1 << 1), + IMAPX_CAPABILITY_STATUS = (1 << 2), + IMAPX_CAPABILITY_NAMESPACE = (1 << 3), + IMAPX_CAPABILITY_UIDPLUS = (1 << 4), + IMAPX_CAPABILITY_LITERALPLUS = (1 << 5), + IMAPX_CAPABILITY_STARTTLS = (1 << 6), + IMAPX_CAPABILITY_IDLE = (1 << 7), }; struct _capability_info { @@ -86,17 +86,17 @@ struct _capability_info { /* auth stuff here */ }; -struct _capability_info *imap_parse_capability(struct _CamelIMAPXStream *stream, CamelException *ex); -void imap_free_capability(struct _capability_info *); +struct _capability_info *imapx_parse_capability(struct _CamelIMAPXStream *stream, CamelException *ex); +void imapx_free_capability(struct _capability_info *); -void imap_parse_param_list(struct _CamelIMAPXStream *is, struct _camel_header_param **plist, CamelException *ex) /* IO,PARSE */; -struct _CamelContentDisposition *imap_parse_ext_optional(struct _CamelIMAPXStream *is, CamelException *ex) /* IO,PARSE */; -struct _CamelMessageContentInfo *imap_parse_body_fields(struct _CamelIMAPXStream *is, CamelException *ex) /* IO,PARSE */; -struct _camel_header_address *imap_parse_address_list(struct _CamelIMAPXStream *is, CamelException *ex) /* IO,PARSE */; -struct _CamelMessageInfo *imap_parse_envelope(struct _CamelIMAPXStream *is, CamelException *ex) /* IO, PARSE */; -struct _CamelMessageContentInfo *imap_parse_body(struct _CamelIMAPXStream *is, CamelException *ex) /* IO,PARSE */; -gchar *imap_parse_section(struct _CamelIMAPXStream *is, CamelException *ex) /* IO,PARSE */; -void imap_free_body(struct _CamelMessageContentInfo *cinfo); +void imapx_parse_param_list(struct _CamelIMAPXStream *is, struct _camel_header_param **plist, CamelException *ex) /* IO,PARSE */; +struct _CamelContentDisposition *imapx_parse_ext_optional(struct _CamelIMAPXStream *is, CamelException *ex) /* IO,PARSE */; +struct _CamelMessageContentInfo *imapx_parse_body_fields(struct _CamelIMAPXStream *is, CamelException *ex) /* IO,PARSE */; +struct _camel_header_address *imapx_parse_address_list(struct _CamelIMAPXStream *is, CamelException *ex) /* IO,PARSE */; +struct _CamelMessageInfo *imapx_parse_envelope(struct _CamelIMAPXStream *is, CamelException *ex) /* IO, PARSE */; +struct _CamelMessageContentInfo *imapx_parse_body(struct _CamelIMAPXStream *is, CamelException *ex) /* IO,PARSE */; +gchar *imapx_parse_section(struct _CamelIMAPXStream *is, CamelException *ex) /* IO,PARSE */; +void imapx_free_body(struct _CamelMessageContentInfo *cinfo); /* ********************************************************************** */ /* all the possible stuff we might get from a fetch request */ @@ -129,9 +129,9 @@ struct _fetch_info { #define FETCH_SECTION (1<<9) #define FETCH_UID (1<<10) -struct _fetch_info *imap_parse_fetch(struct _CamelIMAPXStream *is, CamelException *ex); -void imap_free_fetch(struct _fetch_info *finfo); -void imap_dump_fetch(struct _fetch_info *finfo); +struct _fetch_info *imapx_parse_fetch(struct _CamelIMAPXStream *is, CamelException *ex); +void imapx_free_fetch(struct _fetch_info *finfo); +void imapx_dump_fetch(struct _fetch_info *finfo); /* ********************************************************************** */ @@ -162,9 +162,9 @@ struct _status_info { gchar *text; }; -struct _status_info *imap_parse_status(struct _CamelIMAPXStream *is, CamelException *ex); -struct _status_info *imap_copy_status(struct _status_info *sinfo); -void imap_free_status(struct _status_info *sinfo); +struct _status_info *imapx_parse_status(struct _CamelIMAPXStream *is, CamelException *ex); +struct _status_info *imapx_copy_status(struct _status_info *sinfo); +void imapx_free_status(struct _status_info *sinfo); /* ********************************************************************** */ /* parses the response from the status command */ @@ -177,7 +177,7 @@ struct _state_info { }; /* use g_free to free the return value */ -struct _state_info *imap_parse_status_info (struct _CamelIMAPXStream *is, CamelException *ex); +struct _state_info *imapx_parse_status_info (struct _CamelIMAPXStream *is, CamelException *ex); /* ********************************************************************** */ @@ -189,9 +189,9 @@ struct _list_info { gchar *name; }; -struct _list_info *imap_parse_list(struct _CamelIMAPXStream *is, CamelException *ex); +struct _list_info *imapx_parse_list(struct _CamelIMAPXStream *is, CamelException *ex); gchar *imapx_list_get_path(struct _list_info *li); -void imap_free_list(struct _list_info *linfo); +void imapx_free_list(struct _list_info *linfo); /* ********************************************************************** */ @@ -220,11 +220,11 @@ void imapx_utils_init(void); /* chen adds from old imap provider - place it in right place */ gchar *imapx_path_to_physical (const gchar *prefix, const gchar *vpath); -gchar *imapx_concat (CamelIMAPXStore *imap_store, const gchar *prefix, const gchar *suffix); +gchar *imapx_concat (CamelIMAPXStore *imapx_store, const gchar *prefix, const gchar *suffix); gchar * imapx_get_temp_uid (void); void camel_imapx_namespace_list_clear (struct _CamelIMAPXNamespaceList *nsl); -struct _CamelIMAPXNamespaceList * imap_parse_namespace_list (struct _CamelIMAPXStream *stream, CamelException *ex); +struct _CamelIMAPXNamespaceList * imapx_parse_namespace_list (struct _CamelIMAPXStream *stream, CamelException *ex); struct _CamelIMAPXNamespaceList *camel_imapx_namespace_list_copy (const struct _CamelIMAPXNamespaceList *nsl); #endif