evolution-data-server r9729 - trunk/camel/providers/nntp
- From: sragavan svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r9729 - trunk/camel/providers/nntp
- Date: Tue, 4 Nov 2008 02:48:17 +0000 (UTC)
Author: sragavan
Date: Tue Nov 4 02:48:17 2008
New Revision: 9729
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9729&view=rev
Log:
2008-10-21 Srinivasa Ragavan <sragavan novell com>
** Fix for bug #556119
* camel/providers/nntp/camel-nntp-summary.c: Do things in bulk
* camel/providers/nntp/camel-nntp-utils.c:
Modified:
trunk/camel/providers/nntp/ChangeLog
trunk/camel/providers/nntp/camel-nntp-summary.c
trunk/camel/providers/nntp/camel-nntp-utils.c
Modified: trunk/camel/providers/nntp/camel-nntp-summary.c
==============================================================================
--- trunk/camel/providers/nntp/camel-nntp-summary.c (original)
+++ trunk/camel/providers/nntp/camel-nntp-summary.c Tue Nov 4 02:48:17 2008
@@ -155,9 +155,6 @@
if (cns->priv->uid == NULL)
return NULL;
- /* we shouldn't be here if we already have this uid */
- g_assert(camel_folder_summary_uid(s, cns->priv->uid) == NULL);
-
mi = (CamelMessageInfoBase *)((CamelFolderSummaryClass *)camel_nntp_summary_parent)->message_info_new_from_header(s, h);
if (mi) {
camel_pstring_free(mi->uid);
@@ -326,16 +323,13 @@
/* truncated line? ignore? */
if (xover == NULL) {
- mi = (CamelMessageInfoBase *)camel_folder_summary_uid(s, cns->priv->uid);
- if (mi == NULL) {
+ if (!camel_folder_summary_check_uid (s, cns->priv->uid)) {
mi = (CamelMessageInfoBase *)camel_folder_summary_add_from_header(s, headers);
if (mi) {
mi->size = size;
cns->high = n;
camel_folder_change_info_add_uid(changes, camel_message_info_uid(mi));
}
- } else {
- camel_message_info_free(mi);
}
}
@@ -393,8 +387,7 @@
if ((msgid = strchr(line, '<')) && (line = strchr(msgid+1, '>'))){
line[1] = 0;
cns->priv->uid = g_strdup_printf("%u,%s\n", n, msgid);
- mi = camel_folder_summary_uid(s, cns->priv->uid);
- if (mi == NULL) {
+ if (!camel_folder_summary_check_uid (s, cns->priv->uid)) {
if (camel_mime_parser_init_with_stream(mp, (CamelStream *)store->stream) == -1)
goto error;
mi = camel_folder_summary_add_from_parser(s, mp);
@@ -405,9 +398,6 @@
}
cns->high = i;
camel_folder_change_info_add_uid(changes, camel_message_info_uid(mi));
- } else {
- /* already have, ignore */
- camel_message_info_free(mi);
}
if (cns->priv->uid) {
g_free(cns->priv->uid);
@@ -449,6 +439,7 @@
int count;
char *folder = NULL;
CamelNNTPStoreInfo *si;
+ GSList *del = NULL;
s = (CamelFolderSummary *)cns;
@@ -479,7 +470,7 @@
if (cns->low != f) {
count = camel_folder_summary_count(s);
for (i = 0; i < count; i++) {
- const char *uid;
+ char *uid;
const char *msgid;
uid = camel_folder_summary_uid_from_index(s, i);
@@ -494,10 +485,13 @@
if (msgid)
camel_data_cache_remove(store->cache, "cache", msgid+1, NULL);
camel_folder_change_info_remove_uid(changes, uid);
- camel_folder_summary_remove_uid (s, uid);
+ del = g_slist_prepend (del, uid);
+ camel_folder_summary_remove_uid_fast (s, uid);
+ uid = NULL; /*Lets not free it */
count--;
i--;
}
+ g_free (uid);
}
cns->low = f;
}
@@ -513,25 +507,22 @@
}
}
+ camel_db_delete_uids (s->folder->parent_store->cdb_w, s->folder->full_name, del, ex);
+ g_slist_foreach (del, (GFunc) g_free, NULL);
+ g_slist_free (del);
+
/* TODO: not from here */
camel_folder_summary_touch(s);
camel_folder_summary_save_to_db (s, ex);
+
update:
/* update store summary if we have it */
if (folder
&& (si = (CamelNNTPStoreInfo *)camel_store_summary_path((CamelStoreSummary *)store->summary, folder))) {
- int unread = 0;
-
- count = camel_folder_summary_count(s);
- for (i = 0; i < count; i++) {
- CamelMessageInfoBase *mi = (CamelMessageInfoBase *)camel_folder_summary_index(s, i);
+ guint32 unread = 0;
- if (mi) {
- if ((mi->flags & CAMEL_MESSAGE_SEEN) == 0)
- unread++;
- camel_message_info_free(mi);
- }
- }
+ count = camel_folder_summary_count (s);
+ camel_db_count_unread_message_info (s->folder->parent_store->cdb_r, s->folder->full_name, &unread, ex);
if (si->info.unread != unread
|| si->info.total != count
Modified: trunk/camel/providers/nntp/camel-nntp-utils.c
==============================================================================
--- trunk/camel/providers/nntp/camel-nntp-utils.c (original)
+++ trunk/camel/providers/nntp/camel-nntp-utils.c Tue Nov 4 02:48:17 2008
@@ -96,7 +96,8 @@
camel_message_info_set_subject(new_info, g_strdup(subject));
camel_message_info_set_from(new_info, g_strdup(from));
camel_message_info_set_to(new_info, g_strdup(folder->name));
- camel_message_info_set_uid(new_info, uid);
+ new_info->uid = camel_pstring_strdup (uid);
+ g_free (uid);
new_info->date_sent = camel_header_decode_date(date, NULL);
#if 0
@@ -199,7 +200,10 @@
else if (!g_ascii_strcasecmp(header->name, "Subject"))
new_info->subject = g_strdup(header->value);
else if (!g_ascii_strcasecmp(header->name, "Message-ID")) {
- new_info->uid = g_strdup_printf("%d,%s", i, header->value);
+ char *uid = g_strdup_printf("%d,%s", i, header->value);
+
+ new_info->uid = camel_pstring_strdup (uid);
+ g_free (uid);
new_info->message_id = g_strdup(header->value);
}
else if (!g_ascii_strcasecmp(header->name, "Date")) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]