here's my first set of patches fixing nntp related issues.. this is
primarily confined to libcamel interaction/bugfixes... other UI canges
to follow in a later patch....
this patch is relative to current cvs head.
-- cut here, obviously --
Index: camel/providers/nntp/camel-nntp-folder.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/nntp/camel-nntp-folder.c,v
retrieving revision 1.30
diff -u -r1.30 camel-nntp-folder.c
--- camel/providers/nntp/camel-nntp-folder.c 2000/12/24 00:46:18 1.30
+++ camel/providers/nntp/camel-nntp-folder.c 2001/04/27 02:15:39
@@ -248,18 +248,18 @@
camel_folder_summary_set_filename (folder->summary,
nntp_folder->summary_file_path);
- if (-1 == camel_folder_summary_load (folder->summary)) {
- /* Bad or nonexistant summary file */
- camel_nntp_get_headers (CAMEL_FOLDER( folder )->parent_store,
- nntp_folder, ex);
- if (camel_exception_get_id (ex)) {
- camel_object_unref (CAMEL_OBJECT (folder));
- return NULL;
- }
-
- /* XXX check return value */
- camel_folder_summary_save (folder->summary);
+ camel_folder_summary_load (folder->summary);
+
+ /* Bad or nonexistant summary file */
+ camel_nntp_get_headers (CAMEL_FOLDER( folder )->parent_store,
+ nntp_folder, ex);
+ if (camel_exception_get_id (ex)) {
+ camel_object_unref (CAMEL_OBJECT (folder));
+ return NULL;
}
+ /* XXX check return value */
+ camel_folder_summary_save (folder->summary);
+
return folder;
}
Index: camel/providers/nntp/camel-nntp-newsrc.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/nntp/camel-nntp-newsrc.c,v
retrieving revision 1.9
diff -u -r1.9 camel-nntp-newsrc.c
--- camel/providers/nntp/camel-nntp-newsrc.c 2000/12/24 00:46:18 1.9
+++ camel/providers/nntp/camel-nntp-newsrc.c 2001/04/27 02:15:39
@@ -225,9 +225,7 @@
void
camel_nntp_newsrc_mark_article_read (CamelNNTPNewsrc *newsrc, const char *group_name,
int num)
{
- NEWSRC_LOCK(newsrc, lock);
camel_nntp_newsrc_mark_range_read (newsrc, group_name, num, num);
- NEWSRC_UNLOCK(newsrc, lock);
}
void
@@ -474,8 +472,10 @@
NEWSRC_LOCK(newsrc, lock);
- if (!newsrc->dirty)
+ if (!newsrc->dirty) {
+ NEWSRC_UNLOCK(newsrc, lock);
return;
+ }
if ((fp = fopen(newsrc->filename, "w")) == NULL) {
g_warning ("Couldn't open newsrc file '%s'.\n", newsrc->filename);
Index: camel/providers/nntp/camel-nntp-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/nntp/camel-nntp-utils.c,v
retrieving revision 1.16
diff -u -r1.16 camel-nntp-utils.c
--- camel/providers/nntp/camel-nntp-utils.c 2000/11/30 11:05:35 1.16
+++ camel/providers/nntp/camel-nntp-utils.c 2001/04/27 02:15:39
@@ -64,7 +64,7 @@
g_print ("done\n");
}
else {
- CamelMessageInfo *new_info =
camel_folder_summary_info_new(nntp_folder->summary);
+ CamelMessageInfo *new_info =
+camel_folder_summary_info_new(folder->summary);
char **split_line = g_strsplit (line, "\t", 7);
char *subject, *from, *date, *message_id, *bytes;
char *uid;
@@ -74,7 +74,7 @@
date = split_line [nntp_store->overview_field
[CAMEL_NNTP_OVER_DATE].index];
message_id = split_line [nntp_store->overview_field
[CAMEL_NNTP_OVER_MESSAGE_ID].index];
bytes = split_line [nntp_store->overview_field
[CAMEL_NNTP_OVER_BYTES].index];
-
+
/* if the overview format flagged this
field as "full", skip over the
preceding field name and colon */
@@ -109,7 +109,7 @@
atoi
(split_line[0])))
new_info->flags |= CAMEL_MESSAGE_SEEN;
- camel_folder_summary_add (nntp_folder->summary,
new_info);
+ camel_folder_summary_add (folder->summary, new_info);
g_strfreev (split_line);
}
g_free (line);
@@ -217,6 +217,33 @@
}
#endif
+static inline int
+uid_num (CamelFolderSummary *summary, int index)
+{
+ char *tmp;
+ char *brk;
+ CamelMessageInfo *minfo;
+ int ret;
+
+ minfo = camel_folder_summary_index(summary, index);
+ if(minfo == NULL)
+ return 0;
+
+ tmp = g_strdup(camel_message_info_uid(minfo));
+ camel_message_info_free(minfo);
+
+ if((brk = strchr(tmp, ',')) == NULL)
+ ret = 0;
+ else {
+ *brk = 0;
+ ret = atoi(tmp);
+ }
+
+ g_free(tmp);
+
+ return ret;
+}
+
void
camel_nntp_get_headers (CamelStore *store,
CamelNNTPFolder *nntp_folder,
@@ -225,15 +252,30 @@
CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE (store);
CamelFolder *folder = CAMEL_FOLDER (nntp_folder);
char *ret;
- int first_message, nb_message, last_message;
+ int first_message, nb_message, last_message, last_summary;
int status;
+ int i;
status = camel_nntp_command (nntp_store, ex, &ret,
"GROUP %s", folder->name);
-
sscanf (ret, "%d %d %d", &nb_message, &first_message, &last_message);
g_free (ret);
+ i = camel_folder_summary_count(folder->summary);
+ if(i != 0) {
+ last_summary = uid_num(folder->summary, i-1);
+
+ while(uid_num(folder->summary, 0) < first_message)
+ camel_folder_summary_remove_index(folder->summary, 0);
+
+
+
+ if(last_summary >= last_message)
+ return;
+
+ first_message = last_summary;
+ }
+
if (status == NNTP_NO_SUCH_GROUP) {
/* XXX throw invalid group exception */
camel_exception_setv (ex,
@@ -253,4 +295,5 @@
get_HEAD_headers (nntp_store, folder, first_message, last_message, ex);
#endif
}
+
}
Index: mail/folder-browser.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/folder-browser.c,v
retrieving revision 1.142
diff -u -r1.142 folder-browser.c
--- mail/folder-browser.c 2001/04/24 20:56:56 1.142
+++ mail/folder-browser.c 2001/04/27 02:15:40
@@ -49,6 +49,7 @@
#define PARENT_TYPE (gtk_table_get_type ())
static void fb_resize_cb (GtkWidget *w, GtkAllocation *a);
+static void update_unread_count(CamelObject *object, gpointer event_data, gpointer
+user_data);
static GtkObjectClass *folder_browser_parent_class;
@@ -76,10 +77,18 @@
if (folder_browser->shell != CORBA_OBJECT_NIL)
CORBA_Object_release (folder_browser->shell, &ev);
- g_free (folder_browser->uri);
+ if(folder_browser->uri)
+ g_free (folder_browser->uri);
if (folder_browser->folder) {
mail_sync_folder (folder_browser->folder, NULL, NULL);
+ camel_object_unhook_event(CAMEL_OBJECT(folder_browser->folder),
+ "message_changed", update_unread_count,
+ folder_browser);
+ camel_object_unhook_event(CAMEL_OBJECT(folder_browser->folder),
+ "folder_changed", update_unread_count,
+ folder_browser);
+
camel_object_unref (CAMEL_OBJECT (folder_browser->folder));
}
@@ -186,7 +195,8 @@
if (fb->folder)
camel_object_unref((CamelObject *)fb->folder);
- g_free(fb->uri);
+ if(fb->uri)
+ g_free(fb->uri);
fb->uri = g_strdup(uri);
fb->folder = folder;
Index: mail/message-browser.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/message-browser.c,v
retrieving revision 1.3
diff -u -r1.3 message-browser.c
--- mail/message-browser.c 2001/04/24 20:56:56 1.3
+++ mail/message-browser.c 2001/04/27 02:15:41
@@ -235,6 +235,14 @@
};
static void
+message_browser_size_allocate_cb (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ last_allocation = *allocation;
+
+}
+
+static void
set_default_size (GtkWidget *widget)
{
int width, height;
@@ -278,6 +286,9 @@
gnome_app_set_contents (GNOME_APP (new), vbox);
gtk_widget_grab_focus (GTK_WIDGET (MAIL_DISPLAY (fb->mail_display)->html));
+
+ gtk_signal_connect(GTK_OBJECT(new), "size_allocate",
+ GTK_SIGNAL_FUNC(message_browser_size_allocate_cb), NULL);
set_default_size (GTK_WIDGET (new));
_______________________________________________
evolution-hackers maillist - [EMAIL PROTECTED]
http://lists.helixcode.com/mailman/listinfo/evolution-hackers