aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2001-11-28 07:05:30 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-11-28 07:05:30 +0800
commit4b89a1c6b25b16241b216531a1c70ccb95e55d6d (patch)
treec59fbce05405e55d4fd01b8754a37f160a7ccec3
parent45aa3c76643dfc428fc9eaf19857239f71e16dc5 (diff)
downloadgsoc2013-evolution-4b89a1c6b25b16241b216531a1c70ccb95e55d6d.tar
gsoc2013-evolution-4b89a1c6b25b16241b216531a1c70ccb95e55d6d.tar.gz
gsoc2013-evolution-4b89a1c6b25b16241b216531a1c70ccb95e55d6d.tar.bz2
gsoc2013-evolution-4b89a1c6b25b16241b216531a1c70ccb95e55d6d.tar.lz
gsoc2013-evolution-4b89a1c6b25b16241b216531a1c70ccb95e55d6d.tar.xz
gsoc2013-evolution-4b89a1c6b25b16241b216531a1c70ccb95e55d6d.tar.zst
gsoc2013-evolution-4b89a1c6b25b16241b216531a1c70ccb95e55d6d.zip
If the uid doesn't have a ',' in it, fail to crash.
2001-11-25 Not Zed <NotZed@Ximian.com> * providers/nntp/camel-nntp-folder.c (nntp_folder_get_message): If the uid doesn't have a ',' in it, fail to crash. * providers/nntp/camel-nntp-newsrc.c (camel_nntp_newsrc_article_is_read): check group != NULL before scanning. (camel_nntp_newsrc_get_highest_article_read): " (camel_nntp_newsrc_get_num_articles_read): " (camel_nntp_newsrc_mark_range_read): " * providers/nntp/camel-nntp-store.c (camel_nntp_store_get_overview_fmt): IF we dont have nntp_list_follows, dont try and get a list response. (nntp_store_get_folder_info): Set path part of folderinfo. svn path=/trunk/; revision=14799
-rw-r--r--camel/ChangeLog16
-rw-r--r--camel/providers/nntp/camel-nntp-folder.c11
-rw-r--r--camel/providers/nntp/camel-nntp-newsrc.c29
-rw-r--r--camel/providers/nntp/camel-nntp-store.c21
4 files changed, 63 insertions, 14 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index a0f424ee55..fbe1c03181 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,19 @@
+2001-11-25 Not Zed <NotZed@Ximian.com>
+
+ * providers/nntp/camel-nntp-folder.c (nntp_folder_get_message): If
+ the uid doesn't have a ',' in it, fail to crash.
+
+ * providers/nntp/camel-nntp-newsrc.c
+ (camel_nntp_newsrc_article_is_read): check group != NULL before scanning.
+ (camel_nntp_newsrc_get_highest_article_read): "
+ (camel_nntp_newsrc_get_num_articles_read): "
+ (camel_nntp_newsrc_mark_range_read): "
+
+ * providers/nntp/camel-nntp-store.c
+ (camel_nntp_store_get_overview_fmt): IF we dont have
+ nntp_list_follows, dont try and get a list response.
+ (nntp_store_get_folder_info): Set path part of folderinfo.
+
2001-11-20 Jeffrey Stedfast <fejj@ximian.com>
* providers/smtp/camel-smtp-transport.c (get_smtp_error_string):
diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c
index 9f291d9fb8..e3b4da6b40 100644
--- a/camel/providers/nntp/camel-nntp-folder.c
+++ b/camel/providers/nntp/camel-nntp-folder.c
@@ -105,15 +105,18 @@ nntp_folder_get_message (CamelFolder *folder, const gchar *uid, CamelException *
/* get the parent store */
parent_store = camel_folder_get_parent_store (folder);
- message_id = strchr (uid, ',') + 1;
- status = camel_nntp_command (CAMEL_NNTP_STORE( parent_store ), ex, NULL, "ARTICLE %s", message_id);
+ message_id = strchr (uid, ',');
+ if (message_id) {
+ message_id++;
+ status = camel_nntp_command (CAMEL_NNTP_STORE( parent_store ), ex, NULL, "ARTICLE %s", message_id);
+ }
/* if the message_id was not found, raise an exception and return */
- if (status == NNTP_NO_SUCH_ARTICLE) {
+ if (message_id == NULL || status == NNTP_NO_SUCH_ARTICLE) {
camel_exception_setv (ex,
CAMEL_EXCEPTION_FOLDER_INVALID_UID,
_("Message %s not found."),
- message_id);
+ uid);
return NULL;
}
else if (status != NNTP_ARTICLE_FOLLOWS) {
diff --git a/camel/providers/nntp/camel-nntp-newsrc.c b/camel/providers/nntp/camel-nntp-newsrc.c
index 8c7ef1d5cd..8475a137a2 100644
--- a/camel/providers/nntp/camel-nntp-newsrc.c
+++ b/camel/providers/nntp/camel-nntp-newsrc.c
@@ -198,7 +198,11 @@ camel_nntp_newsrc_get_highest_article_read (CamelNNTPNewsrc *newsrc, const char
NEWSRC_LOCK(newsrc, lock);
group = g_hash_table_lookup (newsrc->groups, group_name);
- ret = camel_nntp_newsrc_group_get_highest_article_read (newsrc, group);
+
+ if (group)
+ ret = camel_nntp_newsrc_group_get_highest_article_read (newsrc, group);
+ else
+ ret = 0;
NEWSRC_UNLOCK(newsrc, lock);
@@ -214,7 +218,11 @@ camel_nntp_newsrc_get_num_articles_read (CamelNNTPNewsrc *newsrc, const char *gr
NEWSRC_LOCK(newsrc, lock);
group = g_hash_table_lookup (newsrc->groups, group_name);
- ret = camel_nntp_newsrc_group_get_num_articles_read (newsrc, group);
+
+ if (group)
+ ret = camel_nntp_newsrc_group_get_num_articles_read (newsrc, group);
+ else
+ ret = 0;
NEWSRC_UNLOCK(newsrc, lock);
@@ -244,7 +252,8 @@ camel_nntp_newsrc_mark_range_read(CamelNNTPNewsrc *newsrc, const char *group_nam
NEWSRC_LOCK(newsrc, lock);
group = g_hash_table_lookup (newsrc->groups, group_name);
- camel_nntp_newsrc_group_mark_range_read (newsrc, group, low, high);
+ if (group)
+ camel_nntp_newsrc_group_mark_range_read (newsrc, group, low, high);
NEWSRC_UNLOCK(newsrc, lock);
}
@@ -257,12 +266,14 @@ camel_nntp_newsrc_article_is_read (CamelNNTPNewsrc *newsrc, const char *group_na
NEWSRC_LOCK(newsrc, lock);
group = g_hash_table_lookup (newsrc->groups, group_name);
-
- for (i = 0; i < group->ranges->len; i++) {
- if (num >= g_array_index (group->ranges, ArticleRange, i).low &&
- num <= g_array_index (group->ranges, ArticleRange, i).high) {
- ret = TRUE;
- break;
+
+ if (group) {
+ for (i = 0; i < group->ranges->len; i++) {
+ if (num >= g_array_index (group->ranges, ArticleRange, i).low &&
+ num <= g_array_index (group->ranges, ArticleRange, i).high) {
+ ret = TRUE;
+ break;
+ }
}
}
diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c
index 9ff097f7f5..7ac3fcdc82 100644
--- a/camel/providers/nntp/camel-nntp-store.c
+++ b/camel/providers/nntp/camel-nntp-store.c
@@ -59,6 +59,18 @@ static CamelServiceClass *service_class = NULL;
static gboolean ensure_news_dir_exists (CamelNNTPStore *store);
+static int
+camel_nntp_store_set_mode (CamelNNTPStore *store, CamelException *ex)
+{
+ int rc;
+
+ CAMEL_NNTP_STORE_LOCK(store);
+ rc = camel_nntp_command(store, ex, NULL, "MODE READER");
+ CAMEL_NNTP_STORE_UNLOCK(store);
+
+ return rc;
+}
+
static void
camel_nntp_store_get_extensions (CamelNNTPStore *store, CamelException *ex)
{
@@ -137,8 +149,9 @@ camel_nntp_store_get_overview_fmt (CamelNNTPStore *store, CamelException *ex)
g_warning ("server reported support of OVER but LIST OVERVIEW.FMT failed."
" disabling OVER.\n");
store->extensions &= ~CAMEL_NNTP_EXT_OVER;
- return;
}
+ CAMEL_NNTP_STORE_UNLOCK(store);
+ return;
}
else {
if (!(store->extensions & CAMEL_NNTP_EXT_OVER)) {
@@ -261,6 +274,9 @@ nntp_store_connect (CamelService *service, CamelException *ex)
g_free (buf);
+ /* set 'reader' mode */
+ camel_nntp_store_set_mode(store, ex);
+
/* get a list of extensions that the server supports */
camel_nntp_store_get_extensions (store, ex);
@@ -461,6 +477,7 @@ build_folder_info_from_grouplist (CamelNNTPStore *nntp_store, const char *top)
fi->unread_message_count = (entry->high - entry->low -
camel_nntp_newsrc_get_num_articles_read (
nntp_store->newsrc, entry->group_name));
+ camel_folder_info_build_path(fi, '/');
if (last)
last->sibling = fi;
@@ -523,6 +540,7 @@ nntp_store_get_folder_info (CamelStore *store, const char *top,
url->host, (char *)names->pdata[i]);
/* FIXME */
fi->unread_message_count = -1;
+ camel_folder_info_build_path(fi, '/');
if (last)
last->sibling = fi;
@@ -543,6 +561,7 @@ nntp_store_get_folder_info (CamelStore *store, const char *top,
fi->url = g_strdup_printf ("nntp://%s/%s", url->host, top);
/* FIXME */
fi->unread_message_count = -1;
+ camel_folder_info_build_path(fi, '/');
return fi;
}