aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-08-07 06:17:18 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-08-07 06:17:18 +0800
commitee486f95dcd45fdd4acc5a1893f37e64310f8f15 (patch)
tree707c91170e7af4daf22fab11dd6f969a2980d9b9 /camel
parentba57a90d939acce8ddc2b480f22de64be5c7a7f8 (diff)
downloadgsoc2013-evolution-ee486f95dcd45fdd4acc5a1893f37e64310f8f15.tar.gz
gsoc2013-evolution-ee486f95dcd45fdd4acc5a1893f37e64310f8f15.tar.zst
gsoc2013-evolution-ee486f95dcd45fdd4acc5a1893f37e64310f8f15.zip
Don't strstr for noselect=yes, that's just plain broken.
2001-08-06 Jeffrey Stedfast <fejj@ximian.com> * providers/imap/camel-imap-store.c (get_folder_info_online): Don't strstr for noselect=yes, that's just plain broken. svn path=/trunk/; revision=11714
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog5
-rw-r--r--camel/providers/imap/camel-imap-store.c52
-rw-r--r--camel/providers/pop3/camel-pop3-folder.c27
3 files changed, 51 insertions, 33 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 728e0192c1..fd46fc93c1 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,8 @@
+2001-08-06 Jeffrey Stedfast <fejj@ximian.com>
+
+ * providers/imap/camel-imap-store.c (get_folder_info_online):
+ Don't strstr for noselect=yes, that's just plain broken.
+
2001-08-06 Dan Winship <danw@ximian.com>
* providers/imap/camel-imap-folder.c (imap_rescan): Fix off-by-one
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 62df070f2a..b1baaf718f 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -1188,31 +1188,36 @@ get_folder_info_online (CamelStore *store, const char *top,
char *pattern;
CamelFolderInfo *fi, *tree;
int i;
-
+
if (!camel_remote_store_connected (CAMEL_REMOTE_STORE (store), ex))
return NULL;
-
+
name = top;
if (!name || name[0] == '\0') {
need_inbox = TRUE;
name = "";
}
-
+
folders = g_ptr_array_new ();
-
+
/* Get top-level */
get_folders_online (imap_store, name, folders, FALSE, ex);
if (camel_exception_is_set (ex))
goto lose;
if (folders->len) {
+ const char *noselect;
+ CamelURL *url;
+
fi = folders->pdata[0];
- if (strstr (fi->url, "noselect=yes") &&
- name[0] == '\0') {
+ url = camel_url_new (fi->url, NULL);
+ noselect = url ? camel_url_get_param (url, "noselect") : NULL;
+ if (noselect && !g_strcasecmp (noselect, "yes") && name[0] == '\0') {
camel_folder_info_free (fi);
g_ptr_array_remove_index (folders, 0);
}
+ camel_url_free (url);
}
-
+
/* If we want to look at only subscribed folders AND check if
* any of them have new mail, AND the server doesn't return
* Marked/UnMarked with LSUB, then use
@@ -1235,7 +1240,7 @@ get_folder_info_online (CamelStore *store, const char *top,
g_ptr_array_free (folders, TRUE);
return NULL;
}
-
+
/* Add INBOX, if necessary */
if (need_inbox) {
for (i = 0; i < folders->len; i++) {
@@ -1245,54 +1250,62 @@ get_folder_info_online (CamelStore *store, const char *top,
break;
}
}
-
+
if (need_inbox) {
CamelURL *url;
char *uri;
-
+
url = camel_url_new (imap_store->base_url, NULL);
g_free (url->path);
url->path = g_strdup ("/INBOX");
uri = camel_url_to_string (url, 0);
camel_url_free (url);
-
+
fi = g_new0 (CamelFolderInfo, 1);
fi->full_name = g_strdup ("INBOX");
fi->name = g_strdup ("INBOX");
fi->url = uri;
fi->unread_message_count = -1;
-
+
g_ptr_array_add (folders, fi);
}
}
-
+
/* Assemble. */
tree = camel_folder_info_build (folders, name, imap_store->dir_sep, TRUE);
if (flags & CAMEL_STORE_FOLDER_INFO_FAST) {
g_ptr_array_free (folders, TRUE);
return tree;
}
-
+
/* Get unread counts. Sync flag changes to the server first so
* it has the same ideas about read/unread as we do.
*/
camel_store_sync (store, NULL);
for (i = 0; i < folders->len; i++) {
+ const char *noselect;
+ CamelURL *url;
+
fi = folders->pdata[i];
-
+
/* Don't check if it doesn't contain messages or if it
* was \UnMarked.
*/
- if (fi->unread_message_count != -1 || strstr (fi->url, "noselect=yes"))
+ url = camel_url_new (fi->url, NULL);
+ noselect = url ? camel_url_get_param (url, "noselect") : NULL;
+ if (fi->unread_message_count != -1 || (noselect && !g_strcasecmp (noselect, "yes"))) {
+ camel_url_free (url);
continue;
-
+ }
+ camel_url_free (url);
+
/* Don't check if it's not INBOX and we're only
* checking INBOX.
*/
if ((!(imap_store->parameters & IMAP_PARAM_CHECK_ALL))
&& (g_strcasecmp (fi->name, "INBOX") != 0))
continue;
-
+
/* For the current folder, poke it to check for new
* messages and then report that number, rather than
* doing a STATUS command.
@@ -1304,8 +1317,9 @@ get_folder_info_online (CamelStore *store, const char *top,
} else
fi->unread_message_count = get_folder_status (imap_store, fi->full_name, "UNSEEN");
}
-
+
g_ptr_array_free (folders, TRUE);
+
return tree;
}
diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c
index b33a9f1569..0032077fd6 100644
--- a/camel/providers/pop3/camel-pop3-folder.c
+++ b/camel/providers/pop3/camel-pop3-folder.c
@@ -285,16 +285,16 @@ pop3_get_message (CamelFolder *folder, const char *uid, CamelException *ex)
char *result, *body;
CamelStream *msgstream;
CamelMimeMessage *msg;
-
+
num = uid_to_number (CAMEL_POP3_FOLDER (folder), uid);
if (num == -1) {
camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
_("No message with uid %s"), uid);
return NULL;
}
-
- camel_operation_start_transient(NULL, _("Retrieving POP message %d"), num);
-
+
+ camel_operation_start_transient (NULL, _("Retrieving POP message %d"), num);
+
status = camel_pop3_command (CAMEL_POP3_STORE (folder->parent_store),
&result, ex, "RETR %d", num);
switch (status) {
@@ -304,14 +304,13 @@ pop3_get_message (CamelFolder *folder, const char *uid, CamelException *ex)
g_free (result);
/* fall through */
case CAMEL_POP3_FAIL:
- camel_operation_end(NULL);
+ camel_operation_end (NULL);
return NULL;
}
-
- /* this should be "nnn octets" ? No. RTFRFC. FIXME. */
+
if (result && sscanf (result, "%d", &total) != 1)
total = 0;
-
+
g_free (result);
body = camel_pop3_command_get_additional_data (CAMEL_POP3_STORE (folder->parent_store), total, ex);
if (!body) {
@@ -320,21 +319,21 @@ pop3_get_message (CamelFolder *folder, const char *uid, CamelException *ex)
_("Could not retrieve message from POP "
"server %s: %s"), service->url->host,
camel_exception_get_description (ex));
- camel_operation_end(NULL);
+ camel_operation_end (NULL);
return NULL;
}
-
+
msgstream = camel_stream_mem_new_with_buffer (body, strlen (body));
g_free (body);
msg = camel_mime_message_new ();
camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg),
CAMEL_STREAM (msgstream));
-
+
camel_object_unref (CAMEL_OBJECT (msgstream));
-
- camel_operation_end(NULL);
-
+
+ camel_operation_end (NULL);
+
return msg;
}