From 828a1077206a22132eccb3138d937d5c255d7f10 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 21 Aug 2002 19:23:44 +0000 Subject: Don't bother overloading the timeout virtual methods since they don't 2002-08-21 Jeffrey Stedfast * mail-session.c (class_init): Don't bother overloading the timeout virtual methods since they don't exist anymore. * mail-folder-cache.c (mail_note_store): Register a ping timeout callback to ping each store to keep the connections alive. svn path=/trunk/; revision=17831 --- mail/ChangeLog | 8 ++++++++ mail/mail-folder-cache.c | 36 +++++++++++++++++++++++++++++++++--- mail/mail-format.c | 4 ++-- mail/mail-session.c | 2 -- mail/message-list.c | 4 ++-- 5 files changed, 45 insertions(+), 9 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 341768ffaf..c12c7a5815 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,11 @@ +2002-08-21 Jeffrey Stedfast + + * mail-session.c (class_init): Don't bother overloading the + timeout virtual methods since they don't exist anymore. + + * mail-folder-cache.c (mail_note_store): Register a ping timeout + callback to ping each store to keep the connections alive. + 2002-08-20 Radek Doulik * mail-callbacks.c (do_mail_print): be sure that widget is diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index ab49fd0c25..ac88aa9442 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -106,8 +106,13 @@ static void folder_changed(CamelObject *o, gpointer event_data, gpointer user_da static void folder_renamed(CamelObject *o, gpointer event_data, gpointer user_data); static void folder_finalised(CamelObject *o, gpointer event_data, gpointer user_data); + +static guint ping_id = 0; +static gboolean ping_cb (gpointer user_data); + + /* Store to storeinfo table, active stores */ -static GHashTable *stores; +static GHashTable *stores = NULL; /* List of folder changes to be executed in gui thread */ static EDList updates = E_DLIST_INITIALISER(updates); @@ -721,13 +726,36 @@ update_folders(CamelStore *store, CamelFolderInfo *fi, void *data) g_free(ud); } +static void +ping_store (gpointer key, gpointer val, gpointer user_data) +{ + CamelStore *store = (CamelStore *) key; + CamelException ex; + + camel_exception_init (&ex); + camel_store_noop (store, &ex); + camel_exception_clear (&ex); +} + +static gboolean +ping_cb (gpointer user_data) +{ + LOCK (info_lock); + + g_hash_table_foreach (stores, ping_store, NULL); + + UNLOCK (info_lock); +} + void mail_note_store(CamelStore *store, EvolutionStorage *storage, GNOME_Evolution_Storage corba_storage, void (*done)(CamelStore *store, CamelFolderInfo *info, void *data), void *data) { struct _store_info *si; struct _update_data *ud; - + const char *buf; + guint timeout; + g_assert(CAMEL_IS_STORE(store)); g_assert(pthread_self() == mail_gui_thread); g_assert(storage == NULL || corba_storage == CORBA_OBJECT_NIL); @@ -738,11 +766,13 @@ mail_note_store(CamelStore *store, EvolutionStorage *storage, GNOME_Evolution_St stores = g_hash_table_new(NULL, NULL); count_sent = getenv("EVOLUTION_COUNT_SENT") != NULL; count_trash = getenv("EVOLUTION_COUNT_TRASH") != NULL; + buf = getenv ("EVOLUTION_PING_TIMEOUT"); + timeout = buf ? strtoul (buf, NULL, 10) * 1000 : 600000; + ping_id = g_timeout_add (timeout, ping_cb, NULL); } si = g_hash_table_lookup(stores, store); if (si == NULL) { - d(printf("Noting a new store: %p: %s\n", store, camel_url_to_string(((CamelService *)store)->url, 0))); /* FIXME: Need to ref the storages & store or something?? */ diff --git a/mail/mail-format.c b/mail/mail-format.c index 5e41298c32..00e4c4ee23 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -1505,8 +1505,8 @@ handle_text_enriched (CamelMimePart *part, const char *mime_type, GString *string; if (!translations) { - translations = g_hash_table_new (g_strcase_hash, - g_strcase_equal); + translations = g_hash_table_new (g_strcase_hash, g_strcase_equal); + g_hash_table_insert (translations, "bold", ""); g_hash_table_insert (translations, "/bold", ""); g_hash_table_insert (translations, "italic", ""); diff --git a/mail/mail-session.c b/mail/mail-session.c index 15221eba34..4dda167884 100644 --- a/mail/mail-session.c +++ b/mail/mail-session.c @@ -111,8 +111,6 @@ class_init (MailSessionClass *mail_session_class) camel_session_class->get_password = get_password; camel_session_class->forget_password = forget_password; camel_session_class->alert_user = alert_user; - camel_session_class->register_timeout = register_timeout; - camel_session_class->remove_timeout = remove_timeout; camel_session_class->get_filter_driver = get_filter_driver; } diff --git a/mail/message-list.c b/mail/message-list.c index eb2115f763..14624f57f2 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -119,7 +119,7 @@ enum { #ifdef SMART_ADDRESS_COMPARE struct _EMailAddress { ENameWestern *wname; - gchar *address; + char *address; }; typedef struct _EMailAddress EMailAddress; @@ -304,7 +304,7 @@ address_compare (gconstpointer address1, gconstpointer address2) return retval; } -static gchar * +static char * filter_size (gint size) { gfloat fsize; -- cgit