aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/imap/camel-imap-command.c33
-rw-r--r--camel/providers/imap/camel-imap-search.h2
-rw-r--r--camel/providers/imap/camel-imap-store.c2
-rw-r--r--camel/providers/imap/camel-imap-summary.c4
-rw-r--r--camel/providers/imap/camel-imap-summary.h2
-rw-r--r--camel/providers/imap/camel-imap-utils.c58
-rw-r--r--camel/providers/imap/camel-imap-utils.h1
-rw-r--r--camel/providers/local/camel-local-store.c4
-rw-r--r--camel/providers/local/camel-local-summary.h2
-rw-r--r--camel/providers/local/camel-mbox-summary.h2
-rw-r--r--camel/providers/local/camel-spool-summary.h2
-rw-r--r--camel/providers/nntp/camel-nntp-stream.h2
-rw-r--r--camel/providers/nntp/camel-nntp-summary.h2
-rw-r--r--camel/providers/pop3/camel-pop3-engine.h2
-rw-r--r--camel/providers/pop3/camel-pop3-stream.h2
15 files changed, 90 insertions, 30 deletions
diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c
index 6a2382b3c8..f8ea456439 100644
--- a/camel/providers/imap/camel-imap-command.c
+++ b/camel/providers/imap/camel-imap-command.c
@@ -696,10 +696,14 @@ imap_command_strdup_vprintf (CamelImapStore *store, const char *fmt,
arglen += strlen (store->namespace) + 1;
}
g_ptr_array_add (args, string);
- if (store->capabilities & IMAP_CAPABILITY_LITERALPLUS)
- len += arglen + 15;
- else
- len += arglen * 2;
+ if (imap_is_atom(string)) {
+ len += arglen;
+ } else {
+ if (store->capabilities & IMAP_CAPABILITY_LITERALPLUS)
+ len += arglen + 15;
+ else
+ len += arglen * 2;
+ }
start = p + 1;
break;
@@ -750,16 +754,21 @@ imap_command_strdup_vprintf (CamelImapStore *store, const char *fmt,
string = imap_mailbox_encode (mailbox, strlen (mailbox));
g_free (mailbox);
}
-
- if (store->capabilities & IMAP_CAPABILITY_LITERALPLUS) {
- op += sprintf (op, "{%d+}\r\n%s",
- strlen (string), string);
+
+ if (imap_is_atom(string)) {
+ op += sprintf(op, "%s", string);
} else {
- char *quoted = imap_quote_string (string);
-
- op += sprintf (op, "%s", quoted);
- g_free (quoted);
+ if (store->capabilities & IMAP_CAPABILITY_LITERALPLUS) {
+ op += sprintf (op, "{%d+}\r\n%s",
+ strlen (string), string);
+ } else {
+ char *quoted = imap_quote_string (string);
+
+ op += sprintf (op, "%s", quoted);
+ g_free (quoted);
+ }
}
+
if (*p == 'F')
g_free (string);
break;
diff --git a/camel/providers/imap/camel-imap-search.h b/camel/providers/imap/camel-imap-search.h
index 9d1694c2c9..7664c4c2ed 100644
--- a/camel/providers/imap/camel-imap-search.h
+++ b/camel/providers/imap/camel-imap-search.h
@@ -56,7 +56,7 @@ struct _CamelImapSearchClass {
};
-guint camel_imap_search_get_type (void);
+CamelType camel_imap_search_get_type (void);
CamelFolderSearch *camel_imap_search_new (const char *cachedir);
#endif /* ! _CAMEL_IMAP_SEARCH_H */
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index ce87174486..316ab6980e 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -1184,7 +1184,7 @@ rename_folder (CamelStore *store, const char *old_name, const char *new_name, Ca
flags = CAMEL_STORE_FOLDER_INFO_FAST | CAMEL_STORE_FOLDER_INFO_RECURSIVE |
(store->flags & CAMEL_STORE_SUBSCRIPTIONS ? CAMEL_STORE_FOLDER_INFO_SUBSCRIBED : 0);
- fi = ((CamelStoreClass *)((CamelObject *)store)->classfuncs)->get_folder_info (store, old_name, flags, ex);
+ fi = ((CamelStoreClass *)((CamelObject *)store)->klass)->get_folder_info (store, old_name, flags, ex);
if (fi && store->flags & CAMEL_STORE_SUBSCRIPTIONS)
unsubscribe_folders (store, fi);
diff --git a/camel/providers/imap/camel-imap-summary.c b/camel/providers/imap/camel-imap-summary.c
index b6c048f299..f64cc00c19 100644
--- a/camel/providers/imap/camel-imap-summary.c
+++ b/camel/providers/imap/camel-imap-summary.c
@@ -21,6 +21,10 @@
* Boston, MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <sys/stat.h>
#include <sys/uio.h>
#include <unistd.h>
diff --git a/camel/providers/imap/camel-imap-summary.h b/camel/providers/imap/camel-imap-summary.h
index 14f5dd2433..3b203f639b 100644
--- a/camel/providers/imap/camel-imap-summary.h
+++ b/camel/providers/imap/camel-imap-summary.h
@@ -63,7 +63,7 @@ struct _CamelImapSummaryClass {
};
-guint camel_imap_summary_get_type (void);
+CamelType camel_imap_summary_get_type (void);
CamelFolderSummary *camel_imap_summary_new (const char *filename);
void camel_imap_summary_add_offline (CamelFolderSummary *summary,
diff --git a/camel/providers/imap/camel-imap-utils.c b/camel/providers/imap/camel-imap-utils.c
index 91d2efb702..7ee7ff807d 100644
--- a/camel/providers/imap/camel-imap-utils.c
+++ b/camel/providers/imap/camel-imap-utils.c
@@ -271,17 +271,63 @@ imap_parse_flag_list (char **flag_list_p)
return flags;
}
-static char imap_atom_specials[128] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0,
+/*
+ From rfc2060
+
+ATOM_CHAR ::= <any CHAR except atom_specials>
+
+atom_specials ::= "(" / ")" / "{" / SPACE / CTL / list_wildcards /
+ quoted_specials
+
+CHAR ::= <any 7-bit US-ASCII character except NUL,
+ 0x01 - 0x7f>
+
+CTL ::= <any ASCII control character and DEL,
+ 0x00 - 0x1f, 0x7f>
+
+SPACE ::= <ASCII SP, space, 0x20>
+
+list_wildcards ::= "%" / "*"
+
+quoted_specials ::= <"> / "\"
+*/
+
+static unsigned char imap_atom_specials[256] = {
+/* 00 */0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+/* 10 */0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+/* 20 */0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1,
+/* 30 */1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+/* 40 */1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+/* 50 */1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
+/* 60 */1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+/* 70 */1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
};
-#define imap_is_atom_char(ch) (isprint (ch) && !imap_atom_specials[ch])
+
+#define imap_is_atom_char(c) ((imap_atom_specials[(c)&0xff] & 0x01) != 0)
+
+gboolean
+imap_is_atom(const char *in)
+{
+ register unsigned char c;
+ register const char *p = in;
+
+ while ((c = (unsigned char)*p)) {
+ if (!imap_is_atom_char(c))
+ return FALSE;
+ p++;
+ }
+
+ /* check for empty string */
+ return p!=in;
+}
/**
* imap_parse_string_generic:
diff --git a/camel/providers/imap/camel-imap-utils.h b/camel/providers/imap/camel-imap-utils.h
index 924b71c119..7078e12335 100644
--- a/camel/providers/imap/camel-imap-utils.h
+++ b/camel/providers/imap/camel-imap-utils.h
@@ -63,6 +63,7 @@ char *imap_parse_string_generic (char **str_p, size_t *len, int type);
void imap_parse_body (char **body_p, CamelFolder *folder,
CamelMessageContentInfo *ci);
+gboolean imap_is_atom (const char *in);
char *imap_quote_string (const char *str);
void imap_skip_list (char **str_p);
diff --git a/camel/providers/local/camel-local-store.c b/camel/providers/local/camel-local-store.c
index 6a51046814..a0d3708346 100644
--- a/camel/providers/local/camel-local-store.c
+++ b/camel/providers/local/camel-local-store.c
@@ -242,10 +242,10 @@ create_folder(CamelStore *store, const char *parent_name, const char *folder_nam
name = g_strdup_printf("%s/%s", parent_name, folder_name);
- folder = ((CamelStoreClass *)((CamelObject *)store)->classfuncs)->get_folder(store, name, CAMEL_STORE_FOLDER_CREATE, ex);
+ folder = ((CamelStoreClass *)((CamelObject *)store)->klass)->get_folder(store, name, CAMEL_STORE_FOLDER_CREATE, ex);
if (folder) {
camel_object_unref((CamelObject *)folder);
- info = ((CamelStoreClass *)((CamelObject *)store)->classfuncs)->get_folder_info(store, name, 0, ex);
+ info = ((CamelStoreClass *)((CamelObject *)store)->klass)->get_folder_info(store, name, 0, ex);
/* get_folder(CREATE) will emit a folder_created event for us */
/*if (info)
diff --git a/camel/providers/local/camel-local-summary.h b/camel/providers/local/camel-local-summary.h
index 4a4db952d2..d1153fa8c6 100644
--- a/camel/providers/local/camel-local-summary.h
+++ b/camel/providers/local/camel-local-summary.h
@@ -62,7 +62,7 @@ struct _CamelLocalSummaryClass {
int (*decode_x_evolution)(CamelLocalSummary *cls, const char *xev, CamelMessageInfo *info);
};
-guint camel_local_summary_get_type (void);
+CamelType camel_local_summary_get_type (void);
void camel_local_summary_construct (CamelLocalSummary *new, const char *filename, const char *local_name, CamelIndex *index);
/* load/check the summary */
diff --git a/camel/providers/local/camel-mbox-summary.h b/camel/providers/local/camel-mbox-summary.h
index ec4d015489..6c61da21e5 100644
--- a/camel/providers/local/camel-mbox-summary.h
+++ b/camel/providers/local/camel-mbox-summary.h
@@ -52,7 +52,7 @@ struct _CamelMboxSummaryClass {
CamelLocalSummaryClass parent_class;
};
-guint camel_mbox_summary_get_type (void);
+CamelType camel_mbox_summary_get_type (void);
CamelMboxSummary *camel_mbox_summary_new (const char *filename, const char *mbox_name, CamelIndex *index);
/* generate a From line from headers */
diff --git a/camel/providers/local/camel-spool-summary.h b/camel/providers/local/camel-spool-summary.h
index 5b20e1dfbe..77fa6bdb3e 100644
--- a/camel/providers/local/camel-spool-summary.h
+++ b/camel/providers/local/camel-spool-summary.h
@@ -67,7 +67,7 @@ struct _CamelSpoolSummaryClass {
int (*decode_x_evolution)(CamelSpoolSummary *cls, const char *xev, CamelMessageInfo *info);
};
-guint camel_spool_summary_get_type (void);
+CamelType camel_spool_summary_get_type (void);
void camel_spool_summary_construct (CamelSpoolSummary *new, const char *filename, const char *spool_name, CamelIndex *index);
/* create the summary, in-memory only */
diff --git a/camel/providers/nntp/camel-nntp-stream.h b/camel/providers/nntp/camel-nntp-stream.h
index e7b732beff..eef217cef2 100644
--- a/camel/providers/nntp/camel-nntp-stream.h
+++ b/camel/providers/nntp/camel-nntp-stream.h
@@ -52,7 +52,7 @@ struct _CamelNNTPStreamClass {
CamelStreamClass parent_class;
};
-guint camel_nntp_stream_get_type (void);
+CamelType camel_nntp_stream_get_type (void);
CamelStream *camel_nntp_stream_new (CamelStream *source);
diff --git a/camel/providers/nntp/camel-nntp-summary.h b/camel/providers/nntp/camel-nntp-summary.h
index b82283452e..82070cdc31 100644
--- a/camel/providers/nntp/camel-nntp-summary.h
+++ b/camel/providers/nntp/camel-nntp-summary.h
@@ -47,7 +47,7 @@ struct _CamelNNTPSummaryClass {
CamelFolderSummaryClass parent_class;
};
-guint camel_nntp_summary_get_type (void);
+CamelType camel_nntp_summary_get_type (void);
CamelNNTPSummary *camel_nntp_summary_new(struct _CamelNNTPFolder *folder);
int camel_nntp_summary_check(CamelNNTPSummary *cns, CamelFolderChangeInfo *, CamelException *ex);
diff --git a/camel/providers/pop3/camel-pop3-engine.h b/camel/providers/pop3/camel-pop3-engine.h
index 6b1f0cee1e..caf6ca1d2a 100644
--- a/camel/providers/pop3/camel-pop3-engine.h
+++ b/camel/providers/pop3/camel-pop3-engine.h
@@ -112,7 +112,7 @@ struct _CamelPOP3EngineClass {
CamelObjectClass parent_class;
};
-guint camel_pop3_engine_get_type (void);
+CamelType camel_pop3_engine_get_type (void);
CamelPOP3Engine *camel_pop3_engine_new (CamelStream *source);
diff --git a/camel/providers/pop3/camel-pop3-stream.h b/camel/providers/pop3/camel-pop3-stream.h
index 2baf48d21d..2a4ebc01f2 100644
--- a/camel/providers/pop3/camel-pop3-stream.h
+++ b/camel/providers/pop3/camel-pop3-stream.h
@@ -55,7 +55,7 @@ struct _CamelPOP3StreamClass {
CamelStreamClass parent_class;
};
-guint camel_pop3_stream_get_type (void);
+CamelType camel_pop3_stream_get_type (void);
CamelStream *camel_pop3_stream_new (CamelStream *source);