From 2b8e2eeaf9f69edeaf46f0e40edbafee6c36cd9a Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 30 Oct 2000 03:24:29 +0000 Subject: Simplify this a lot by making IMAP and NNTP use the same code, now that * mail-tools.c (mail_tool_uri_to_folder): Simplify this a lot by making IMAP and NNTP use the same code, now that the IMAP namespace doesn't need special magic handling. svn path=/trunk/; revision=6257 --- mail/ChangeLog | 4 ++++ mail/mail-tools.c | 51 +++++---------------------------------------------- 2 files changed, 9 insertions(+), 46 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index b47e1a85ac..91f1a4ecab 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,9 @@ 2000-10-29 Dan Winship + * mail-tools.c (mail_tool_uri_to_folder): Simplify this a lot by + making IMAP and NNTP use the same code, now that the IMAP + namespace doesn't need special magic handling. + * message-list.c (mail_do_regenerate_messagelist): Don't try to regenerate the message list if there is no folder. (The Bonobo UI code will call this as the callback for the "Threaded View" diff --git a/mail/mail-tools.c b/mail/mail-tools.c index 11e15012bb..e12331819d 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -492,58 +492,17 @@ mail_tool_uri_to_folder (const char *uri, CamelException *ex) if (!strncmp (uri, "vfolder:", 8)) { folder = vfolder_uri_to_folder (uri, ex); - } else if (!strncmp (uri, "imap:", 5)) { - char *service, *ptr; - - service = g_strdup_printf ("%s/", uri); - for (ptr = service + 7; *ptr && *ptr != '/'; ptr++); - ptr++; - *ptr = '\0'; - + } else if (!strncmp (uri, "imap:", 5) || !strncmp (uri, "nntp:", 5)) { mail_tool_camel_lock_up (); - store = camel_session_get_store (session, service, ex); - g_free (service); - if (store) { - CamelURL *url = CAMEL_SERVICE (store)->url; - char *folder_uri; - - for (ptr = (char *)(uri + 7); *ptr && *ptr != '/'; ptr++); - if (*ptr == '/') { - if (url && url->path) { - ptr += strlen (url->path); - printf ("ptr = %s\n", ptr); - if (*ptr == '/') - ptr++; - } - - if (*ptr == '/') - ptr++; - /*for ( ; *ptr && *ptr == '/'; ptr++);*/ - - folder_uri = g_strdup (ptr); - folder = camel_store_get_folder (store, folder_uri, CAMEL_STORE_FOLDER_CREATE, ex); - g_free (folder_uri); - } - } - - mail_tool_camel_lock_down (); - - } else if (!strncmp (uri, "nntp:", 5)) { - mail_tool_camel_lock_up(); store = camel_session_get_store (session, uri, ex); if (store) { - const char *folder_path, *ptr; + char *ptr; for (ptr = (char *)(uri + 7); *ptr && *ptr != '/'; ptr++); - if (*ptr == '/') { - ptr++; - folder_path = ptr; - folder = camel_store_get_folder (store, folder_path, 0, ex); - } + if (*ptr == '/') + folder = camel_store_get_folder (store, ptr + 1, CAMEL_STORE_FOLDER_CREATE, ex); } - - mail_tool_camel_lock_down(); - + mail_tool_camel_lock_down (); } else if (!strncmp (uri, "file:", 5)) { folder = mail_tool_local_uri_to_folder (uri, ex); } else { -- cgit v1.2.3