diff options
-rw-r--r-- | camel/ChangeLog | 12 | ||||
-rw-r--r-- | camel/camel-session.c | 8 | ||||
-rw-r--r-- | camel/camel-url.c | 17 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 51 | ||||
-rw-r--r-- | mail/component-factory.c | 7 | ||||
-rw-r--r-- | mail/folder-browser.c | 3 |
6 files changed, 62 insertions, 36 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 255f80ab8c..baed02d1f8 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,15 @@ +2000-06-20 Jeffrey Stedfast <fejj@helixcode.com> + + * providers/imap/camel-imap-folder.c (imap_get_summary): Only + fetch the summary if the folder summary doesn't already exist. + When the summary *does* exist, start fetching from 1, not 0. + (imap_free_summary): Don't do anything here. + (imap_finalize): Free the summary here instead of in + imap_free_summary(). + + * camel-url.c (check_equal): No need to check s1 if s2 is NULL + (camel_url_equal): Don't check the passwd component of the url. + 2000-06-20 Dan Winship <danw@helixcode.com> * camel-folder-summary.c (camel_folder_summary_add): mark the diff --git a/camel/camel-session.c b/camel/camel-session.c index 82334c978c..0df50c2906 100644 --- a/camel/camel-session.c +++ b/camel/camel-session.c @@ -183,7 +183,7 @@ camel_session_list_providers (CamelSession *session, gboolean load) } static void -service_cache_remove(CamelService *service, CamelSession *session) +service_cache_remove (CamelService *service, CamelSession *session) { g_hash_table_remove(session->service_cache, service->url); } @@ -201,7 +201,7 @@ camel_session_get_service (CamelSession *session, const char *url_string, return NULL; /* lookup in cache first */ - printf("looking up service in cache: %s\n", url_string); + printf("looking up service in cache: \"%s\"\n", camel_url_to_string (url, FALSE)); service = g_hash_table_lookup(session->service_cache, url); if (service != NULL) { printf("found!!\n"); @@ -225,8 +225,7 @@ camel_session_get_service (CamelSession *session, const char *url_string, return NULL; } } - provider = g_hash_table_lookup (session->providers, - url->protocol); + provider = g_hash_table_lookup (session->providers, url->protocol); } if (!provider || !provider->object_types[type]) { @@ -243,6 +242,7 @@ camel_session_get_service (CamelSession *session, const char *url_string, g_hash_table_insert(session->service_cache, url, service); gtk_signal_connect((GtkObject *)service, "destroy", service_cache_remove, session); } + return service; } diff --git a/camel/camel-url.c b/camel/camel-url.c index c0707dcbb1..cb3f5a1408 100644 --- a/camel/camel-url.c +++ b/camel/camel-url.c @@ -315,7 +315,7 @@ guint camel_url_hash (const void *v) } static int -check_equal(char *s1, char *s2) +check_equal (char *s1, char *s2) { if (s1 == NULL) { if (s2 == NULL) @@ -323,23 +323,20 @@ check_equal(char *s1, char *s2) else return FALSE; } - if (s2 == NULL) { - if (s1 == NULL) - return TRUE; - else - return FALSE; - } - return strcmp(s1, s2) == 0; + + if (s2 == NULL) + return FALSE; + + return strcmp (s1, s2) == 0; } int camel_url_equal(const void *v, const void *v2) { const CamelURL *u1 = v, *u2 = v2; - + return check_equal(u1->protocol, u2->protocol) && check_equal(u1->user, u2->user) && check_equal(u1->authmech, u2->authmech) - && check_equal(u1->passwd, u2->passwd) && check_equal(u1->host, u2->host) && check_equal(u1->path, u2->path) && u1->port == u2->port; diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 0d67c2fa7f..fd005f82ba 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -209,7 +209,27 @@ static void imap_finalize (GtkObject *object) { /* TODO: do we need to do more here? */ + CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (object); + CamelMessageInfo *info; + gint i, max; + GTK_OBJECT_CLASS (parent_class)->finalize (object); + + g_return_if_fail (imap_folder->summary != NULL); + + max = imap_folder->summary->len; + for (i = 0; i < max; i++) { + info = g_ptr_array_index (imap_folder->summary, i); + g_free (info->subject); + g_free (info->to); + g_free (info->from); + g_free (info->uid); + g_free (info); + info = NULL; + } + + g_ptr_array_free (imap_folder->summary, TRUE); + imap_folder->summary = NULL; } static void @@ -745,16 +765,17 @@ imap_get_summary (CamelFolder *folder, CamelException *ex) CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); GPtrArray *array = NULL; CamelMessageInfo *info; - int i, num, status; + gint num, i = 0, status = 0; char *result, *datestr, *p, *q; - imap_free_summary (folder, imap_folder->summary); + if (imap_folder->summary) + return imap_folder->summary; num = imap_get_message_count (folder, ex); array = g_ptr_array_new (); - for (i = 0; i < num; i++) { + for (i = 1; i <= num; i++) { status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), folder, &result, "FETCH %d BODY.PEEK[HEADER]", i); @@ -798,6 +819,7 @@ imap_get_summary (CamelFolder *folder, CamelException *ex) g_free (info->to); g_free (info->from); g_free (info); + info = NULL; break; } @@ -810,6 +832,7 @@ imap_get_summary (CamelFolder *folder, CamelException *ex) g_free (info->to); g_free (info->from); g_free (info); + info = NULL; break; } @@ -823,6 +846,7 @@ imap_get_summary (CamelFolder *folder, CamelException *ex) g_free (info->to); g_free (info->from); g_free (info); + info = NULL; break; } @@ -850,6 +874,7 @@ imap_get_summary (CamelFolder *folder, CamelException *ex) g_free (info->to); g_free (info->from); g_free (info); + info = NULL; break; } @@ -862,6 +887,7 @@ imap_get_summary (CamelFolder *folder, CamelException *ex) g_free (info->to); g_free (info->from); g_free (info); + info = NULL; break; } @@ -875,6 +901,7 @@ imap_get_summary (CamelFolder *folder, CamelException *ex) g_free (info->to); g_free (info->from); g_free (info); + info = NULL; break; } @@ -905,23 +932,7 @@ imap_get_summary (CamelFolder *folder, CamelException *ex) void imap_free_summary (CamelFolder *folder, GPtrArray *array) { - CamelMessageInfo *info; - gint i, max; - - max = array->len; - for (i = 0; i < max; i++) { - info = g_ptr_array_index (array, i); - g_free (info->subject); - g_free (info->to); - g_free (info->from); - g_free (info->uid); - g_free (info); - info = NULL; - } - - g_ptr_array_free (array, TRUE); - array = NULL; - + /* no-op */ return; } diff --git a/mail/component-factory.c b/mail/component-factory.c index 4681d93365..b1bdc09d18 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -270,11 +270,15 @@ create_imap_storage (EvolutionShellComponent *shell_component) corba_shell = evolution_shell_component_get_owner (shell_component); if (corba_shell == CORBA_OBJECT_NIL) { g_warning ("We have no shell!?"); + g_free (source); return; } - if (!(server = strchr (source, '@'))) + if (!(server = strchr (source, '@'))) { + g_free (source); return; + } + server++; for (p = server; *p && *p != '/'; p++); @@ -285,6 +289,7 @@ create_imap_storage (EvolutionShellComponent *shell_component) if (evolution_storage_register_on_shell (storage, corba_shell) != EVOLUTION_STORAGE_OK) { g_warning ("Cannot register storage"); + g_free (source); return; } diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 613a3b00fa..b8b9287d08 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -105,8 +105,9 @@ folder_browser_load_folder (FolderBrowser *fb, const char *name) char *service, *ptr; fprintf (stderr, "\n****** name = %s ******\n\n", name); - service = g_strdup (name); + service = g_strdup_printf ("%s/", name); for (ptr = service + 7; *ptr && *ptr != '/'; ptr++); + ptr++; *ptr = '\0'; fprintf (stderr, "\n****** service = %s ******\n\n", service); store = camel_session_get_store (session, service, ex); |