From 1a56775f4b0b8423a1c28efa8aeacbb05e1fcfd5 Mon Sep 17 00:00:00 2001 From: nobody Date: Fri, 2 Mar 2001 01:33:29 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'GHEX_1_2_1'. svn path=/tags/GHEX_1_2_1/; revision=8484 --- mail/.cvsignore | 19 - mail/ChangeLog | 9418 ------------------------------------- mail/GNOME_Evolution_Mail.oaf.in | 157 - mail/GNOME_Evolution_Mail.oafinfo | 157 - mail/Mail.idl | 32 - mail/Makefile.am | 190 - mail/README.async | 360 -- mail/component-factory.c | 475 -- mail/component-factory.h | 29 - mail/e-attchmt.png | Bin 169 -> 0 bytes mail/evolution-mbox-importer.c | 222 - mail/evolution-mbox-importer.h | 35 - mail/evolution-outlook-importer.c | 287 -- mail/evolution-outlook-importer.h | 35 - mail/folder-browser-factory.c | 365 -- mail/folder-browser-factory.h | 22 - mail/folder-browser.c | 946 ---- mail/folder-browser.h | 114 - mail/local-config.glade | 221 - mail/mail-account-editor.c | 815 ---- mail/mail-account-editor.h | 100 - mail/mail-accounts.c | 519 -- mail/mail-accounts.h | 89 - mail/mail-autofilter.c | 358 -- mail/mail-autofilter.h | 51 - mail/mail-callbacks.c | 1432 ------ mail/mail-callbacks.h | 100 - mail/mail-config-druid.c | 1303 ----- mail/mail-config-druid.h | 139 - mail/mail-config.c | 912 ---- mail/mail-config.glade | 3413 -------------- mail/mail-config.h | 136 - mail/mail-crypto.c | 446 -- mail/mail-crypto.h | 58 - mail/mail-display.c | 1044 ---- mail/mail-display.h | 65 - mail/mail-format.c | 1787 ------- mail/mail-identify.c | 94 - mail/mail-importer.c | 153 - mail/mail-importer.h | 48 - mail/mail-local.c | 1006 ---- mail/mail-local.h | 38 - mail/mail-mlist-magic.c | 271 -- mail/mail-mlist-magic.h | 33 - mail/mail-mt.c | 993 ---- mail/mail-mt.h | 87 - mail/mail-ops.c | 1833 -------- mail/mail-ops.h | 116 - mail/mail-search-dialogue.c | 170 - mail/mail-search-dialogue.h | 61 - mail/mail-send-recv.c | 785 ---- mail/mail-send-recv.h | 44 - mail/mail-session.h | 53 - mail/mail-summary.c | 525 --- mail/mail-summary.h | 32 - mail/mail-tools.c | 386 -- mail/mail-tools.h | 79 - mail/mail-types.h | 40 - mail/mail-vfolder.c | 377 -- mail/mail-vfolder.h | 28 - mail/mail-view.c | 250 - mail/mail-vtrash.c | 173 - mail/mail-vtrash.h | 42 - mail/mail.h | 72 - mail/main.c | 141 - mail/message-list.c | 2705 ----------- mail/message-list.h | 132 - mail/netscape-importer.c | 277 -- mail/openpgp-utils.c | 1274 ----- mail/openpgp-utils.h | 90 - mail/session.c | 311 -- mail/subscribe-dialog.c | 1102 ----- mail/subscribe-dialog.glade | 298 -- mail/subscribe-dialog.h | 77 - mail/test-mail.c | 73 - mail/test-thread.c | 230 - 76 files changed, 40350 deletions(-) delete mode 100644 mail/.cvsignore delete mode 100644 mail/ChangeLog delete mode 100644 mail/GNOME_Evolution_Mail.oaf.in delete mode 100644 mail/GNOME_Evolution_Mail.oafinfo delete mode 100644 mail/Mail.idl delete mode 100644 mail/Makefile.am delete mode 100644 mail/README.async delete mode 100644 mail/component-factory.c delete mode 100644 mail/component-factory.h delete mode 100644 mail/e-attchmt.png delete mode 100644 mail/evolution-mbox-importer.c delete mode 100644 mail/evolution-mbox-importer.h delete mode 100644 mail/evolution-outlook-importer.c delete mode 100644 mail/evolution-outlook-importer.h delete mode 100644 mail/folder-browser-factory.c delete mode 100644 mail/folder-browser-factory.h delete mode 100644 mail/folder-browser.c delete mode 100644 mail/folder-browser.h delete mode 100644 mail/local-config.glade delete mode 100644 mail/mail-account-editor.c delete mode 100644 mail/mail-account-editor.h delete mode 100644 mail/mail-accounts.c delete mode 100644 mail/mail-accounts.h delete mode 100644 mail/mail-autofilter.c delete mode 100644 mail/mail-autofilter.h delete mode 100644 mail/mail-callbacks.c delete mode 100644 mail/mail-callbacks.h delete mode 100644 mail/mail-config-druid.c delete mode 100644 mail/mail-config-druid.h delete mode 100644 mail/mail-config.c delete mode 100644 mail/mail-config.glade delete mode 100644 mail/mail-config.h delete mode 100644 mail/mail-crypto.c delete mode 100644 mail/mail-crypto.h delete mode 100644 mail/mail-display.c delete mode 100644 mail/mail-display.h delete mode 100644 mail/mail-format.c delete mode 100644 mail/mail-identify.c delete mode 100644 mail/mail-importer.c delete mode 100644 mail/mail-importer.h delete mode 100644 mail/mail-local.c delete mode 100644 mail/mail-local.h delete mode 100644 mail/mail-mlist-magic.c delete mode 100644 mail/mail-mlist-magic.h delete mode 100644 mail/mail-mt.c delete mode 100644 mail/mail-mt.h delete mode 100644 mail/mail-ops.c delete mode 100644 mail/mail-ops.h delete mode 100644 mail/mail-search-dialogue.c delete mode 100644 mail/mail-search-dialogue.h delete mode 100644 mail/mail-send-recv.c delete mode 100644 mail/mail-send-recv.h delete mode 100644 mail/mail-session.h delete mode 100644 mail/mail-summary.c delete mode 100644 mail/mail-summary.h delete mode 100644 mail/mail-tools.c delete mode 100644 mail/mail-tools.h delete mode 100644 mail/mail-types.h delete mode 100644 mail/mail-vfolder.c delete mode 100644 mail/mail-vfolder.h delete mode 100644 mail/mail-view.c delete mode 100644 mail/mail-vtrash.c delete mode 100644 mail/mail-vtrash.h delete mode 100644 mail/mail.h delete mode 100644 mail/main.c delete mode 100644 mail/message-list.c delete mode 100644 mail/message-list.h delete mode 100644 mail/netscape-importer.c delete mode 100644 mail/openpgp-utils.c delete mode 100644 mail/openpgp-utils.h delete mode 100644 mail/session.c delete mode 100644 mail/subscribe-dialog.c delete mode 100644 mail/subscribe-dialog.glade delete mode 100644 mail/subscribe-dialog.h delete mode 100644 mail/test-mail.c delete mode 100644 mail/test-thread.c (limited to 'mail') diff --git a/mail/.cvsignore b/mail/.cvsignore deleted file mode 100644 index dd1d902aa2..0000000000 --- a/mail/.cvsignore +++ /dev/null @@ -1,19 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -Mail-stubs.c -Mail-skels.c -Mail-common.c -Mail.h -evolution-mail -evolution-mail.pure -test-mail -test-sources -test-thread -*.bb -*.bbg -*.da -*.gcov -GNOME_Evolution_Mail.oaf diff --git a/mail/ChangeLog b/mail/ChangeLog deleted file mode 100644 index 703f843a28..0000000000 --- a/mail/ChangeLog +++ /dev/null @@ -1,9418 +0,0 @@ -2001-03-02 Not Zed - - * mail-mt.c (set_stop): Check the container is not NIL before - trying to set thje prop. - -2001-03-01 Not Zed - - * folder-browser.c (folder_browser_search_menu_activated): Fixes - for changes to search bar. - (search_save): Removed. - (search_full): Removed. - (search_full_clicked): Removed. - (folder_browser_search_option_items[]): Removed. - (folder_browser_search_query_changed): Changed for search bar - changes. - (folder_browser_clear_search): Removed. - - * mail-vfolder.c (vfolder_clone_rule): New function to clone a - filter/search rule into a matching vfolder rule. - - * mail-send-recv.c (mail_receive_uri): Setup a timeout for status - updates. - (build_dialogue): Setup timeout id for status updates. - (operation_status_timeout): New function to set the status via a - timeout. - (receive_done): Remove the timeout handler if we need to. - (operation_status): - (receive_status): Just update the info, and let the timeout - handler update the gui. - (do_free_status): - (do_show_status): Removed gui thread status message processing. - -2001-02-28 Not Zed - - * folder-browser.c (folder_browser_config_search): New function to - configure the FilterRule for the search mechanism. - -2001-02-27 Not Zed - - * folder-browser.c (folder_browser_gui_init): Setup the search bar - as a filterbar. - (got_folder): Set the whole search bar sensitive or not based on - the search capability of the folder. - - * folder-browser.h: Changed to use efilterbar instead of esearchbar. - -2001-02-27 Jeffrey Stedfast - - * mail-callbacks.c (configure_mail): Return TRUE if the user - configured his/her settings, else return FALSE. - (check_send_configuration): If configure_mail() returns TRUE, then - continue otherwise quit. - (send_receive_mail): Same. - -2001-02-26 Jeffrey Stedfast - - * mail-callbacks.c (mail_generate_reply): Set a "References" - header no matter what if we are able to get a Message-Id. Fixes - bug #1583. - - * mail-accounts.c (mail_delete): Confirm that the user REALLY - wants to delete this account. - (news_delete): Same. - - * mail-ops.c (mail_send_message): Changed the product string - - will change it to use User-Agent once I get the RFC/DRUMS draft or - whatever. Until then I'll stick with User-Agent. - -2001-02-26 Dan Winship - - * mail-callbacks.c (delete_msg): Mark deleted messages as "seen" - as well so they don't count towards the unread count. - - * mail-view.c (view_delete_msg): ditto - -2001-02-25 Jeffrey Stedfast - - * component-factory.c (owner_set_cb): Re-add the - mail_vtrash_create() hack back in for LocalStores since there's no - better way to register a vTrash folder on the Local Storage yet. - - * mail-local.c (register_folder_registered): Add folders to the - vTrash folder here since the LocalStore does not let the parent - CamelStore class keep it's own hash of the folders. - -2001-02-25 Jeffrey Stedfast - - * session.c (mail_session_forget_password): New function to force - the removal of a given password. - - * openpgp-utils.c (openpgp_decrypt): On failure, forget the - passphrase. - (openpgp_encrypt): Here too. (cleaned this up a bit too) - (openpgp_clearsign): And here. - (openpgp_sign): Again... - - * mail-callbacks.c (composer_postpone_cb): Abort if the message is - NULL (which is valid if an error occured). - (composer_send_cb): Same. - -2001-02-24 Jeffrey Stedfast - - * folder-browser.c: Toss the mail_tool_camel_lock* stuff. - * mail-ops.c: Same. - * mail-summary.c: Here too. - - * mail-tools.c (mail_tool_uri_to_folder_noex): Blown away! - (mail_tool_filter_get_folder_func): *kapoosh* - (mail_tool_camel_lock_up): Same. - (mail_tool_camel_lock_down): Same. - (mail_tool_set_uid_flags): Don't need this rubbish anymore either. - -2001-02-24 Jeffrey Stedfast - - * component-factory.c (mail_load_storages): No longer need to - construct the vTrash here. - (owner_set_cb): Don't make the vTrash for the local store here. - - * mail-ops.c (add_vtrash_info): New function to add a vTrash - folder info to a pre-constructed CamelFolderInfo for use in the - get_folder_info async function. - -2001-02-23 Jeffrey Stedfast - - * main.c (main): No longer need to do a vtrash_cleanup() (it also - doesn't exist anymore). - - * component-factory.c (mail_load_storages): Updated to use the new - vtrash code. - (owner_set_cb): Same. - - * mail-tools.c (mail_tool_uri_to_folder): Update to handle the - "vtrash:" url prefix so that we can extract the REAL uri and know - to get the trash folder. - - * mail-vtrash.c (mail_vtrash_add): Add the vTrash folder to the - EvolutionStorage. - (mail_vtrash_create): Get the store based on the uri (async) and - then call mail_trash_add. - (vtrash_cleanup): Removed. - (vtrash_uri_to_folder): Removed. - (vtrash_create): Replaced by mail_vtrash_create() - -2001-02-23 Iain Holmes - - * component-factory.c (owner_set_cb): Init the importer here. - - * mail-importer.[ch] (mail_importer_create_folder): Add a function - that creates new folders in the shell. - (mail_importer_init): Take in an EvolutionShellClient, and get the - local_storage corba_object from it. - -2001-02-22 Jeffrey Stedfast - - * mail-vtrash.c (create_trash_vfolder): Come up with a unique - store uri for each vtrash (using %p and the CamelStore we're gonna - place it on). - (get_trash_get): Pass in the store so we can use it for %p. - -2001-02-23 Not Zed - - * mail-vfolder.c (vfolder_gui_add_from_mlist): Rule to add mlist - vfolder. - - * mail-autofilter.c (filter_gui_add_for_mailing_list): Removed. - (rule_from_mlist): Build a generic match rule from an mlist. - (vfolder_rule_from_mlist): Setup the vfolder rule for an mlist. - (filter_rule_from_mlist): Setup a filter rule fro an mlist. - (filter_gui_add_from_mlist): GUI thingy to do the work. - - * folder-browser.c (on_right_click): Added vfolder on mailing list - to filter menu. - (on_right_click): Use header_raw_check_mailign_list instead of - mlist magic to get the mailing list name. - (filter_mlist): Changed to use new add_from_mlist() call. - (vfolder_mlist): New function for vfolder from mlist. - - * mail-send-recv.c (build_dialogue): Only allow downloading if the - source is enabled at this time. - (mail_autoreceive_setup): Check for enabled sources before setting - up autodownload. - -2001-02-22 Jeffrey Stedfast - - * mail-accounts.c (construct): Construct the PGP Path - GnomeFileEntry widget. - (pgp_path_changed): Try to auto-detect which PGP type the binary - file is based on the basename (yuck). - -2001-02-23 Not Zed - - * mail-ops.c (create_folder_get): Make op cancellable/report - internals. - (get_folder_get): - (sync_folder_sync): - (get_folderinfo_get): Make op cancellable/report internals. - - * mail-vtrash.c (get_trash_get): Setup the operation registration, - and create a pseudo "start/stop" operation. - (get_trash_free): Free store if we have it. - (get_trash_got): Move vtrash add into here, so we execute in the - right thread. - - * component-factory.c (owner_set_cb): Make trash creation async. - - * mail-local.c (register_folder_desc): A description of what we're - doing. - - * mail-mt.c (mail_msg_new): Set status callback to operation_new. - (mail_operation_status): Operation status function, proxy messages - to main thread, and attempt to present a meaningful ui experience - for operations. - -2001-02-22 Jeffrey Stedfast - - * openpgp-utils.c (openpgp_verify): Fixed memory corruption bug. - - * mail-format.c (try_inline_pgp_sig): Check to make sure the - validity isn't NULL. - (handle_multipart_signed): Check for NULL validities. - -2001-02-21 Jeffrey Stedfast - - * mail-tools.c (mail_tool_uri_to_folder): Protect against NULL - uri's. - - * mail-vtrash.c: Do mutex locking on the global hash table - this - should clear up some segfaults ;-) - - * mail-config-druid.c (druid_finish): Set the 'enabled' member of - the source to TRUE if the URL exists else set to FALSE. - (incoming_type_changed): If the provider chosen is "None" then - gray-out the auto-check widgets and the check-settings, otherwise - sensitize them. - - * mail-account-editor.c (construct): Added a few more settings. - (apply_changes): Save the new settings. - - * mail-config.c (service_copy): Updated. - (config_read): Read in whether or not the account is enabled. - (mail_config_write): Save if the account is enabled or not. - -2001-02-22 Jeffrey Stedfast - - * mail-ops.c (mail_send_message): Updated to reflect changes to - the filter-driver code. - -2001-02-22 Not Zed - - * Makefile.am (CAMEL_OBJS_EXTRA): Removed, no longer link with - libcamelvee. - (evolution_mail_LDADD): Ditto. - - * mail-vtrash.c: Moved camel-vee-store header ot camel levle. - - * mail-tools.c: Moved camel-vee-folder header to camel. - - * mail-local.c (local_storage_new_folder_cb): started hack for - progress reporting, which is currently to the console. - - * mail-mt.c (set_stop): Set the stop button sensitivity. - (mail_msg_received): enable/disable stop button while we're - processing stuff in another thread. - - * message-list.c (ml_tree_value_at): If our uid entry vanishes - before w'ere ready, then make a fake. - -2001-02-21 Jeffrey Stedfast - - * mail-crypto.c (pgp_mime_part_verify): Changed to use - PgpValidity. - - * openpgp-utils.c (openpgp_verify): Return a PgpValidity and set - the description as UTF-8 for later use in mail-format.c when - writing to GtkHTML. - - * mail-format.c (try_inline_pgp_sig): Updated to use the new - PgpValidity code. - (handle_multipart_signed): Updated. - -2001-02-21 Not Zed - - * mail-callbacks.c (composer_postpone_cb): Fix for api changes to - append_mail. - - * Makefile.am (evolution_mail_SOURCES): Removed mail-threads.[ch]. - - * mail-threads.[ch]: Removed. - - * subscribe-dialog.c (subscribe_do_get_store): Chagned to use new - thread stuff. This is really getting boring. - (subscribe_do_subscribe_folder): Changed to use new thread stuff. - Last one at last, phew. - - * session.c (register_callback): Changed to use new thread stuff. - YUCK. I dropped some functionality, now the timeout callback - return is ignored, so basically it keeps running till finished. - - * mail-ops.c (mail_operation_run): Removed, no longer used/needed. - (mail_do_append_mail): Changed to use new thread stuff. - (mail_do_transfer_messages): ditto. - - * mail-local.c (local_storage_new_folder_cb): Use new thread - stuff, also only run synchronous for this operation. - (mail_local_reconfigure_folder): - (reconfigure_clicked): Changed to use new mail thread stuff. - - * mail-config.c (mail_config_check_service): Changed to use new - thread stuff. - -2001-02-20 Dan Winship - - * mail-vtrash.c (get_trash_get): Pass NULL, not "/" for @top. - - * mail-callbacks.c (create_folders): Make this work with - CamelStores where the separator character isn't /. folder_created - and folder_deleted are still broken. - -2001-02-20 Not Zed - - * mail-vtrash.c: Include the camel-vee-store.h header from the - uninstalled copy. - -2001-02-19 Jeffrey Stedfast - - * component-factory.c (mail_load_storages): Create vTrash folders - for all remote stores as well. - -2001-02-20 Not Zed - - * mail-vtrash.c (create_trash_vfolder): Add the auto-update flag - to the folder open flags. - -2001-02-19 Jeffrey Stedfast - - * mail-vfolder.c (mail_vfolder_get_vfolder_storage): New handy - dandy function to ref and return the vfolder storage (will - probably be disavowed once I figure out how to get the vTrash - folder to show up in the EvolutionLocalStorage). - - * main.c (main): Call vtrash_cleanup(). - - * mail-vtrash.c: New file. - (vtrash_uri_to_folder): vtrash: URI handler - (vtrash_create): Replacement async vtrash function for the old one - in mail-ops.c - (vtrash_cleanup): Cleanup code - unrefs the cached vtrash folders - and free's the hashtable. - - * Makefile.am: Added mail-vtrash.[c,h]. - - * mail-tools.c (mail_tool_uri_to_folder): If we have a vtrash: - URI, call the vtrash URI handler function rather than continuing - on. Yes, I know this is a hack and it needs to be fixed. - - * mail-ops.c (mail_do_setup_trash): Removed. - (mail_trash_get): Removed. - - * component-factory.c (owner_set_cb): Create the vTrash folder for - the LocalStore here. - - * mail-local.c (get_folder_info): Implement. - -2001-02-20 Not Zed - - * mail-ops.c (fetch_mail_fetch): Unref the driver here, in the - subthread, so we dont block the gui while it sync's all the - folders. - (fetch_mail_fetched): Rewmoved above code from here. - -2001-02-16 Not Zed - - * mail-send-recv.c (receive_status): Dont do the thaw/freeze set here. - (update_folders): " - - * mail-vfolder.c (vfolder_refresh): Setup the virtual - 'unmatched' folder by default. - (vfolder_uri_to_folder): HAndle UNMATCHED folder specially, it has - no explicit sources. - -2001-02-16 Jeffrey Stedfast - - * mail-send-recv.c (receive_get_folder): Not sure it makes any - difference, but lets ref the folder while the hash table is locked - rather than after we unlock it. - -2001-02-16 Jeffrey Stedfast - - * main.c: * component-factory.c: Reverse the changes I made - yesterday. - -2001-02-15 Jeffrey Stedfast - - * main.c (main): Have the mail-config and openpgp initialize here - instead. - - * component-factory.c (owner_set_cb): No need to have mail-config - and openpgp init here. - -2001-02-15 Jeffrey Stedfast - - * mail-ops.c (do_scan_subfolders): Use mail_storage_create_folder - - * mail-callbacks.c (mail_storage_create_folder): Convenience - function so we can keep all the evolution_storage_add_new_folder() - code in one place as much as possible. - - * subscribe-dialog.c (recursive_add_folder): Use 'name' rather - than the no-description bs since that's what all the other places - do. - - * mail-callbacks.c (folder_created): New callback to handle the - "folder_created" signal - handles CamelFolderInfo's recursively. - (folder_deleted): Same but for "folder_deleted". - - * component-factory.c (storage_create_folder): Instead of doing - the evolution_storage_new_folder() stuff by hand, pass it off to - the new callback: folder_created(). At some point this will be - unecessary as we'll attach this callback to the "folder_created" - signal. - -2001-02-15 Jeffrey Stedfast - - * message-list.c: Wrapped the address compare functions in a - #ifdef - (address_compare): #ifdef the use of the smart address sorting - code and provide a #else for using g_strcasecmp(). - -2001-02-14 Jeffrey Stedfast - - * openpgp-utils.c (openpgp_verify): Add the --no-tty flag. - -2001-02-14 Dan Winship - - * mail-mlist-magic.c: Rewrite explanatory comments to use normal - regexps rather than procmail weirdness. - (check_sender): match "foo-owner" as well as "owner-foo". - (check_list_post): (New) Check for "List-Post: - - * component-factory.c (owner_set_cb): Setup the Trash folder. - - * mail-ops.c (create_trash_vfolder): Do better error handling. - (populate_folder_urls): Oops, helps to strdup the url into the - array if we plan on freeing the data. - (mail_get_trash): New async function that may eventually replace - mail_do_setup_trash(). - (do_setup_trash): Do better error handling. - - * mail-local.c (mail_local_store_class_init): Override - get_folder_info. - (get_folder_info): Implement. - -2001-02-13 Christopher James Lahey - - * mail-local.c (do_reconfigure_folder): Fix some uninitialized - variables. - -2001-02-12 Not Zed - - * message-list.c (build_tree): if doing a full update, save the - cursor pos and restore it afterwards. - (on_cursor_activated_cmd): Copy the current_uid to a new string. - I dont know why this is required, but it is. - (message_list_destroy): Free the cursor_uid as we're done with it. - (build_flat): IF the current uid disappeared from the list, then - unset the message. - (build_tree): Likewise. - -2001-02-12 Jeffrey Stedfast - - * mail-config.c (mail_config_write): Clean out the cruft in the - Accounts section before writing the current accounts out to the - config file. - - * mail-account-editor.c (construct): Strip the leading "/" from - the Namespace/Path entry if the provider doesn't require absolute - pathnames. - -2001-02-12 Kjartan Maraas - - * Makefile.am: xml-i18n-tools setup. - * GNOME_Evolution_Mail.oaf.in: Mark strings for translation. - -2001-02-11 Dan Winship - - * mail-callbacks.[ch]: Re-add non-static forward_messages. - mail-view.c needs it. - -2001-02-11 Jeffrey Stedfast - - * mail-callbacks.c (forward_inlined): Don't leak memory. - (forward_messages): change doinline to be a gboolean argument. - -2001-02-10 Jeffrey Stedfast - - * mail-callbacks.c (list_add_addresses): Check the full list of - IDs instead of just the default id and if we find an address - matching one of the user's ids, then save it. - (mail_generate_reply): Try to guess which account to use based - upon the list of To and Cc addresses and pass that as the 'From' - address to e_msg_composer_set_headers(). - (forward_get_composer): Updated to reflect changes to - e-msg-composer. - -2001-02-11 Gediminas Paulauskas - - * mail-config.glade.h: removed, xml-i18n-extract's the strings itself. - * *.glade: do not output_translatable_strings - * Makefile.am: removed *.glade.h from EXTRA_DIST. - -2001-02-09 Dan Winship - - * mail-local.c: Updates for CamelStore changes, small memory leak - fixes. - (lookup_folder): Removed (and moved into the reconfigure code) - since this method no longer exists in CamelStore. - (do_reconfigure_folder, etc): Update the info in the - MailLocalStore after reconfiguring. - (mail_local_lookup_folder): Removed - - * local-config.glade: fix padding of the label_format - - * message-list.c (ml_tree_value_at): Don't keep message infos - reffed across calls, since this can cause badness after a - reconfigure. Instead, just strdup the needed values and free those - on the next call. - - * mail-tools.c (mail_tool_get_root_of_store): Unused, remove. - (mail_tool_get_inbox): use camel_store_get_inbox. - - * evolution-outlook-importer.c (load_file_fn): - * evolution-mbox-importer.c (load_file_fn): Use - mail_tool_get_local_inbox() instead of mail_importer_get_folder() - - * mail-importer.c (mail_importer_get_folder): Removed - -2001-02-08 Jeffrey Stedfast - - * mail-callbacks.c (mail_generate_reply): New location for this - function. - - * mail-format.c: Removed mail_generate_reply as it's ONLY ever - used in mail-callbacks.c. - - * mail-ops.c (fetch_mail_fetch): Reworked some keep-mail-on-server - logic so that we ALWAYS look for a cached array of UIDs that we - may have downloaded previously so as not to download them again - even if we will be deleting them off the server. This fixes bug - #1344. - -2001-02-09 Not Zed - - * mail-ops.c (filter_folder_free): only free driver, if set. - (fetch_mail_fetched): Unref the driver here, so it can cleanup - before we call the 'done' callback. - - * component-factory.c (owner_set_cb): Add setup for mail - autoreceive stuff. - - * mail-send-recv.c (free_info_data): Free the send info's from teh - active hash, not the running list. - (receive_done): As we finish downloads, remove them and clean them - up, and also close the window. - (mail_autoreceive_setup): New function to setup & maintain - automatic download stuff. - -2001-02-08 Jeffrey Stedfast - - * mail-config-druid.c (construct): Set the sensitivity of the spin - button based on the state of the checkbox. - - * mail-config.c (config_read): Properly do defaults here. - (mail_config_write): Removed some of the settings being saved - here. - (mail_config_write_on_exit): Save those settings here instead. - -2001-02-08 Jeffrey Stedfast - - * mail-display.c (on_object_requested): Cast the CamelMedium to a - CamelMimePart before performing actions on it as if it were a - CamelMimePart. - - * mail-config-druid.c (druid_finish): Save the auto-check settings. - (construct): Initialize auto-check widgets. - (mail_config_druid_get_auto_check): New function - (mail_config_druid_get_auto_check_minutes): New functions - - * mail-config.c (config_read): Read in whether or not to check - every x minutes. - (mail_config_write): Save auto-check config data and SSL. - -2001-02-07 Jeffrey Stedfast - - * mail-autofilter.c (rule_add_subject): Use "contains" because the - subject might be broken into subparts and using the "is" rule will - then fail ;-) - -2001-02-08 Not Zed - - * mail-send-recv.c (mail_send_receive): - (mail_receive_uri): Init active_downloads hash if it hasn't been yet. - -2001-02-07 Not Zed - - * mail-send-recv.c (operation_status): Handle internal camel status return. - (receive_done): Remove active download when done. - (mail_receive_uri): Initiate download of a single source, with no gui. - (build_dialogue): Mark any new items as real active downloads. - (do_show_status): Make the progress bar optional. - -2001-02-06 Not Zed - - * mail-send-recv.c: camel_cancel->camel_operation. - - * mail-ops.old.c: camel_cancel->camel_operation. - - * mail-ops.c: camel_cancel->camel_operation. - - * mail-mt.c: camel_cancel->camel_operation. - - * mail-callbacks.c (stop_threads): camel_cancel->camel_operation. - - * mail-mt.h: CamelCancel->CamelOperation. - -2001-02-07 Jeffrey Stedfast - - * mail-mt.c (set_view_data): Check current_message for NULL - this - fixes a bug running under SunOS (not a major deal tho as it's in a - debug printf). - -2001-02-06 Jeffrey Stedfast - - * mail-config.c (mail_config_write_on_exit): Oops, save the - seen_timeout variable. - -2001-02-06 Christopher James Lahey - - * Makefile.am (evolution_mail_LDADD): Added libmenus.la. - - * folder-browser-factory.c (control_activate): Added GalView menus - here. - - * message-list.c, message-list.h (message_list_get_layout): Made - message_list_get_layout export. - -2001-02-06 Iain Holmes - - * mail-display.c (pixbuf_gen_idle): Set the size of the icon to 24x24 - always. - (button_press): Function to toggle the disposition of an attachment. - (on_object_requested): New way to indicate functions on attachments. - - * message-list.c (hide_load_state): Free the olduid. - -2001-02-06 Jeffrey Stedfast - - * mail-config-druid.c (set_defaults): Updated to checkfor - "(none)". - - * mail-account-editor.c (entry_changed): Make sure the email - address is valid. - - * mail-config-druid.c (identity_check): Check to make sure we have - a valid email address. - (is_email): New function to check a string to see if it's a valid - email address. - -2001-02-05 Jeffrey Stedfast - - * evolution-mbox-importer.c: We are now going to use a file - descriptor and a CamelMimeParser rather than a FILE pointer. - (load_file_fn): Open the file descriptor and initialize the - CamelMimeParser. - (importer_destroy_cb): Unref the mime parser. - (support_format_fn): Use an fd and use a case-insensitive - comparison as well as elimate a buffer overrun. - (process_item_fn): Process 1 CamelMimeMessage per invocation so as - to not lock up Iain's GUI and to work similar to the way Iain - originally coded it. - -2001-02-05 Christopher James Lahey - - * evolution-mbox-importer.c, evolution-mbox-importer.h: Moved - bonobo includes from the .c to the .h. Include - evolution-mbox-importer.h in evolution-mbox-importer.c. - - * evolution-outlook-importer.c, evolution-outlook-importer.h: - Moved bonobo includes from the .c to the .h. Include - evolution-outlook-importer.h in evolution-outlook-importer.c. - - * mail-callbacks.c: Include mail-send-recv.h. - - * mail-local.c (mail_local_lookup_folder): Cast local_store to - CAMEL_STORE. - - * mail-mt.c (mail_msg_cleanup): Make this function static. - - * mail-send-recv.c, mail-send-recv.h: Created mail_send_recv.h. - Included it in mail-send-recv.c. Added a #include - . - (mail_send_receive): Added a cast. - - * mail-summary.c (new_folder_cb, removed_folder_cb, - create_summary_view): Cast the source func in calling g_idle_add. - -2001-02-05 Jeffrey Stedfast - - * mail-format.c (try_inline_pgp_sig): New function to handle - inline pgp-signatures. - - * mail-config-druid.c (construct): Keep track of the CheckSettings - check boxes. - (transport_next): Connect if the user says so. - (incoming_next): Same. Also, don't jump to the next page if - test-settings fails. - -2001-02-05 Jeffrey Stedfast - - * mail-config-druid.c (incoming_next): Updated to not connect when - getting a list of authtypes. - (transport_next): No longer connects - again, this is - useless. Read the apply_changes argument for the reason why. - - * mail-account-editor.c (apply_changes): Updated. Set the - 'connect' argument to FALSE for now, this basically means that the - call is worthless tho so it may be best to either get rid of the - checks altogether or else make it connect. - (source_auth_init): Don't connect here, it's just plain annoying. - (transport_construct_authmenu): Same here. - - * mail-config.c (mail_config_check_service): Now takes a connect - argument. - -2001-02-03 Michael Meeks - - * mail-local.c (load_metainfo): Fix dodgy libxml allocation - pollution, and potential faults on NULL attributes. - -2001-02-02 Not Zed - - * mail-send-recv.c (mail_send_receive): Cleaned up so we dont add - an unecessary level of indenting. - - * message-list.c (ml_tree_value_at): For collapsed tree nodes, - scan the collapses nodes for the unread and status information. - Since we dont really have fake nodes anymore. - -2001-01-30 Ian Campbell - - * message-list.c: Add support for new icons for being - read/unread for fake root messages on threads. - -2001-01-30 Iain Holmes - - * mail-send-recv.c (mail_send_receive): Only allow one send and - receive to be running at once. - (build_dialogue): Set the icon for the window. - - * evolution-mbox-importer.c (support_format_fn): Only compare the first - 5 bytes of the signature. - -2001-01-30 Kjartan Maraas - - * folder-browser.c: Fix typo. - -2001-01-29 Jeffrey Stedfast - - * mail-importer.c (mail_importer_add_line): Cast the - camel_stream_mem_new() to a CamelStreamMem. - -2001-01-29 JP Rosevear - - * main.c: Return efence ifdefs to 0 for solaris build - -2001-01-29 Not Zed - - * message-list.c (tree_equal): Debug function to compare the tree - we think we have, after an incremental update. - (build_tree): Check the tree after we've built it. - (build_tree): Oops, turn on BROKEN_ETREE again. - - * mail-mt.c (mail_get_password): If we are being called from the - main gui thread, then just call the dialogue directly. Ideally we - dont want this anyway but lets handle the case nicely. - (mail_get_password): Try locking around the password request, to - single-queue any password requests. - (mail_msg_init): Push an exit handler to clean it up on completion. - - * mail-send-recv.c (receive_update_got_store): New function called - when the store has been retrieved asynchronously. - (mail_send_receive): Get the store asynchronously. This was - causing problems where the password dialogue would try and be - called from the main thread via a message. - - * mail-ops.c (mail_get_store): New function to get a store - (a)synchronously. More or less taken from subscribe-dialog, which - i will remove later. - (mail_scan_subfolders): Try running the scan subfolder thing - asynchronously, to help startup time. Not sure if this will work, - but presumably the shell can handle the folders appearing later - ok. - -2001-01-28 Jeffrey Stedfast - - * mail-config-druid.c (set_defaults): Turns out that I was wrong - about the g_get_real_name mem leak, god damn glib for not - following the const char* standard. - -2001-01-28 Jeffrey Stedfast - - * mail-config-druid.c (management_prepare): Use UTF-8. - (set_defaults): Use UTF-8 and also fixed a memory leak by freeing - the string returned by g_get_real_name(). - (mail_config_druid_get_account_name): Use UTF-8. - (mail_config_druid_get_full_name): Same. - (mail_config_druid_get_email_address): Same. - (mail_config_druid_get_organization): Same. - - * mail-account-editor.c (apply_changes): Save UTF-8 strings rather - than gtk strings. - (construct): Use the UTF-8 convenience functions to set the gtk - entries for the ID fields. - -2001-01-28 Ettore Perazzoli - - * mail-vfolder.c (vfolder_gui_add_rule): Make the OK button the - default one. - - * mail-search-dialogue.c (mail_search_dialogue_init): Use stock - buttons for OK and Cancel. Make the OK button the default one. - -2001-01-28 Ettore Perazzoli - - * mail-vfolder.c (vfolder_gui_add_rule): Set a default size for - the window so that more rules are visible. - - * mail-search-dialogue.c (mail_search_dialogue_construct): Set a - default size for the window so that more rules are visible. - -2001-01-28 Not Zed - - * mail-display.c (write_data_to_file): Changed to use - mail_save_part to save the data in another thread. - (save_data_cb): Hide the fileselector once we have a button press, - and are saving stuff. - - * mail-ops.c (mail_save_part): New function to save a part content - asynchronously. - -2001-01-27 Christopher James Lahey - - * folder-browser.c (etable_key): Don't handle home and end keys - since %ETable deals with them now. - -2001-01-27 Jeffrey Stedfast - - * message-list.c (address_compare): Protect against NULL address - pointers. - (subject_compare): Same but for subject pointers. - -2001-01-27 Iain Holmes - - * mail-summary.c (create_summary_view): Applied patch from John R Sheets - to fix some warnings. - (idle_check): Fixed the prototype to fix some warnngs as well. - -2001-01-26 Ettore Perazzoli - - * mail-display.c (get_embedded_for_component): Try a control - first, instead of an embeddable. - -2001-01-26 Jeffrey Stedfast - - * subscribe-dialog.c (populate_store_foreach): Check for a NULL - service->url as we obviously can't subscribe to folders on a - non-existant mail source :-) - (subscribe_do_get_store): Check for a NULL url here too, not that - we should need it anymore (due to the above fix) but it doesn't - hurt. Also, should we wait on the thread? Probably doesn't matter. - -2001-01-26 Iain Holmes - - * evolution-outlook-importer.c (load_file_fn): Replace fsetpos with - fseek and use a long instead of fpos_t. - (process_item_fn): Same. - - * mail-importer.h: Add a frozen item to tell when the folder is frozen. - - * evolution-mbox-importer.c (process_item_fn): Fix the blank message. - Set the frozen element. - (importer_destroy_cb): Thaw the folder if frozen. - -2001-01-26 Dan Winship - - * mail-identify.c (mail_identify_mime_part): Fix an uninitialized - variable use. - -2001-01-26 Jason Leach - - (Fixing an old FIXME) - - * component-factory.c (create_vfolder_storage): removing - create_vfolder_storage, replacing call to it with - vfolder_create_storage. - -2001-01-26 Not Zed - - * message-list.c (build_tree): Define BROKEN_ETREE again, till we - get this stuff fixed better. - -2001-01-25 Not Zed - - * folder-browser.c: Moved teh "sender contains" item to the end of - the list, so the gui doesn't suddenly change on everyone. Fixed - the sender-contains search string to be a valid s-exp (ha, didn't - test it even once eh ettore?!) - (search_save): Dont have the sender contains as the default case - (which well, never gets called anyway), oops i guess i should've - reviewed the patch a little more. - -2001-01-26 Ettore Perazzoli - - * folder-browser.c: Add a missing parenthesis to the "from - contains" rule. Also make it the last item instead of the first - one. - -2001-01-25 Iain Holmes - - * component-factory.c (component_factory_init): Init the mail - mail importers. - - * mail-local.[ch] (mail_local_lookup_folder): retrieve the local - folder given by the name. - - * mail-importer.[ch]: Basic functions for all importers to use. - - * evolution-mbox-importer.[ch]: Mbox importer. - -2001-01-25 Jeffrey Stedfast - The following fixes seem to clear up the problem of new mail not - being shown in the Inbox and/or other folders where mail had been - delivered. - - * mail-send-recv.c (build_dialogue): Freeze the inbox. - (receive_get_folder): Freeze folders before dumping them into the - hash table. - (free_folder_info): Thaw the folder. - (free_info_data): Thaw the Inbox. - -2001-01-25 Jason Leach - - (Don't prompt about unsaved changes for replies/forwards that have - not actually been modified) - - * mail-callbacks.c (do_forward_inline): Unset the has_changed for - the message composer. - (do_forward_attach): Same here. - (mail_reply): And here. - -2001-01-25 Dan Winship - - * mail-format.c (mail_content_loaded): Check if a message part's - content is available, and if it's not, queue a thread that will - load it and then queue an idle-handler redisplay of the message. - (call_handler_function): Call mail_content_loaded() on the part - and don't try to display it if it's currently offline. - (get_data_wrapper_text): Simplify a bit - - * mail-display.c (mail_display_queue_redisplay): rename and make - non-static. - (mail_display_redisplay): Use a "new and improved" way of - preserving the GtkHTML scroll location. ("new and improved" is - code for "gross and hackish", but there should be a real interface - for this eventually.) - (on_url_requested): Use mail_content_loaded() and don't write out - offline cid: URLs - - * mail-identify.c (mail_identify_mime_part): Use - mail_content_loaded and don't try to identify the data if it's - offline. - -2001-01-25 Christopher James Lahey - - * message-list.c: Made the message list pay attention to the - "cursor_activated" signal instead of the "cursor_change" signal. - -2001-01-25 Ettore Perazzoli - - * folder-browser-factory.c (update_pixmaps): Set the print icon - for various other items. - (set_pixmap): Be a bit more verbose in the warning message if the - icon isn't found [i.e. report the name of the file too]. - -2001-01-25 Ettore Perazzoli - - * folder-browser-factory.c (update_pixmaps): Set the pixmaps for - the "/menu/Folder/FolderConfig" and "/menu/Settings/SetMailConfig" - items. - (set_pixmap): Don't prepend the "buttons" prefix. - (update_pixmaps): Update accordingly. - -2001-01-24 Not Zed - - * folder-browser.c (search_string[]): Fix the subject match - expression, which was missing a closing ). - - * mail-send-recv.c (do_show_status): Escape any % signs in the - string before setting the format string. - -2001-01-24 Jeffrey Stedfast - - * mail-config.glade: Added a 3rd page to the account editor to - allow users to set their HTML sending preference and also allow - them to change their message status timeout. - - * mail-accounts.c (construct): Added handlers for the send-html - checkbox and for the mark-message-as timeout spinbutton. - -2001-01-23 Jeffrey Stedfast - - * mail-account-editor.c (apply_changes): Save the source and - transport changes whether the user can connect to the host or not. - -2001-01-23 Ettore Perazzoli - - [Applied patch from Tuomas Kuosmanen ] - - * folder-browser.c: Added enum value `ESB_SENDER_CONTAINS' as well - as a "Sender contains" item to the search menu. Also add a - corresponding "(match-all)" rule to the `search_string' array. - (search_save): Handle `ESB_SENDER_CONTAINS' here. - -2001-01-23 Ettore Perazzoli - - * GNOME_Evolution_Mail.oafinfo: Fixed the repo_ids so that they - use the right syntax. - -2001-01-23 Dan Winship - - * folder-browser-factory.c: - * mail-callbacks.c (send_receive_mail): Fix spelling. - -2001-01-24 Not Zed - - * mail-ops.c (fetch_mail_fetch): Set the default folder when - copying to mbox. This is a quick fix, i might need to do a slight - redesign to clean it up. - -2001-01-23 Jeffrey Stedfast - - * mail-send-recv.c (build_dialogue): Make sure the source->url is - not NULL (which is perfectly valid). - (mail_send_receive): Where oh where should my prototype be? - (receive_get_folder): Make sure to ref the folder before you add - it to the hash table. - - * openpgp-utils.c: - * mail-crypto.c: A few minor tweaks. - -2001-01-23 Not Zed - - * message-list.c (build_tree): Try turning off the BROKEN_ETREE - thing. It seems to work ok (better?) now, but if its still broken - i'll remove it again for the next release. - -2001-01-22 Jeffrey Stedfast - - * mail-config-druid.c (set_defaults): Automagically fill in the - user's default transport if he/she has setup previous accounts. - - * mail-format.c (handle_multipart_signed): Just wrote a temp way - of reporting success/fail of PGP/MIME signature verification - status. - -2001-01-22 Iain Holmes - - * evolution-outlook-importer.c: Outlook Express 4 .mbx importer. - - * component-factory.c (component_factory_init): initialise the - outlook importer. - - * GNOME_Evolution_Mail.oafinfo: Add the details for the Outlook - importer. - -2001-01-22 Dan Winship - - * mail-mt.[ch]: make mail_gui_thread non-static. - - * main.c (main): Set up signal handler for SEGV, BUS, FPE - (segv_redirect): if a gnome-segv'ing signal is received in - a thread other than mail_gui_thread, re-deliver it to that - thread to work around a problem with the gnome segv handler. - -2001-01-22 Jeffrey Stedfast - - * mail-format.c (handle_multipart_signed): Fixed to display - subparts (other than the signature part) and started to write a - pretty way to show if the signature verified or not. - -2001-01-23 Not Zed - - * mail-crypto.c (pgp_mime_part_verify): Fix a double-free problem. - -2001-01-22 Jeffrey Stedfast - - * mail-config-druid.c (incoming_type_changed): Oops, danw didn't - know 'provider' could be NULL :-) - -2001-01-22 Dan Winship - - * mail-config-druid.c (incoming_type_changed): Change "Path:" - label to "Namespace:" for IMAP. Use $MAILDIR rather than $MAIL for - Maildir. If $MAIL isn't set, guess. - - * component-factory.c (mail_hash_storage): Function to add a - store/storage mapping. - (add_storage): Use it. - - * mail-vfolder.c (vfolder_uri_to_folder): Use the vfolder name - rather than the string "mbox" (which wasn't ever used for - anything) in the vfolder URL. (Combined with the CamelVeeFolder - change, this makes camel_folder_get_name() return a pretty name - for vfolders now.) Call mail_hash_storage() to record the - CamelVeeStore/vfolder_storage mapping. (Ideally, there'd only be a - single CamelVeeStore... this is just a quick hack.) - - vfolders now display their unread count once you've looked at them - once. - -2001-01-22 Dan Winship - - * mail-tools.h: s/filter-driver.h/camel-filter-driver.h/ and - update first arg of mail_too_filter_get_folder_func - - * mail-tools.c (mail_tool_filter_get_folder_func): Update first - arg to CamelFilterDriver * - - * mail-send-recv.c (receive_status): - * mail-ops.c (send_queue_send): s/FILTER/CAMEL_FILTER/ - - * mail-callbacks.c: Remove filter-driver.h include - - * mail-accounts.c: Put the news functions inside #ifdef - ENABLE_NNTP to prevent warnings about unused statis functions. - - * subscribe-dialog.c (subscribe_folders, unsubscribe_folders, - subscribe_refresh_list): Update prototype to match BONOBO_UI_VERB. - (populate_store_list): add a de-constifying cast - -2001-01-22 Not Zed - - * .cvsignore: Added temp profiling files. - - * component-factory.c (owner_set_cb): remove a warning with - conditional news compilation. - - * mail-ops.h: Cleaned up the header list. - -2001-01-22 Jeffrey Stedfast - - * mail-crypto.c (mail_crypto_is_rfc2015_signed): Helps if I spell - stuff correctly so it can pass the tests ;-) - -2001-01-22 Not Zed - - * folder-browser-factory.c: Replace the old get_send mail with the - new one (button). - - * mail-ops.c (set_x_mailer): - (mail_load_evolution_rule_context): - (mail_do_fetch_mail): - (mail_do_filter_ondemand): - (mail_send_mail_old): - (mail_do_send_queue): All removed, (for) now lives in mail-send-recv.c. - (load_context): - (setup_filter_driver): - (filter_get_folder): - (mail_filter_folder): - (mail_fetch_mail): - (mail_update_subfolders): - (mail_send_mail): - (mail_send_queue): New equivalents of all these fundtions, moved - from mail-send-recv.c ... - (mail_filter_on_demand): Moved here too. - (mail_load_filter_context): Export this. - - * mail-callbacks.c (apply_filters): Use the new - mail_filter_on_demand() call. - (send_receieve_mail): Use mail_send_receive to do the work. Add a - little error handling here that used to be elsewhere. - (send_queued_mail): Removed. - (fetch_mail): Removed. - (select_first_unread): #ifdef'd this out. Not sure if this still - makes sense, but it doesn't get run right now anyway. - (composer_postpone_cb): Fix the setting of message flags. You - dont need to get them first, ever. - - * mail-send-recv.c (mail_send_message): Dont use - mail_tool_send_via_transport anymore (it does nothing useful). - - * mail-tools.c (mail_tool_camel_lock_up): Turned into a noop. - (mail_tool_camel_lock_down): And here too. - (mail_tool_move_folder_contents): Removed from the code (hasn't - bene used for ages). - (mail_tool_send_via_transport): Removed, it doesn't save anything. - -2001-01-21 Jeffrey Stedfast - - * component-factory.c (owner_set_cb): Initialize OpenPGP. - - * openpgp-utils.c (openpgp_init): No longer takes a passphrase - callback, we'll just use the mail-session one. Makes life simpler. - (pgp_get_passphrase): Use mail_session_request_dialog(). - - * mail-ops.c (do_send_queue): Remove the X-Evolution header before - we send. - - * mail-crypto.c (pgp_mime_part_sign): Don't forget to unref the - filters. - (pgp_mime_part_verify): Same. - (pgp_mime_part_encrypt): Same. - (pgp_mime_part_decrypt): Take NotZed's advice and use - camel_stream_mem_new_with_buffer instead of writing to a new - stream_mem. Also use camel_data_wrapper_construct_from_stream - instead of creating a parser and using that. - -2001-01-21 Jeffrey Stedfast - - * mail-crypto.c: Updated header comment and fixed some ref/unref - count problems in the various functions. Also fixed some other - little things. - (pgp_mime_part_encrypt): Do some canonical CRLF action before - encrypting. - (pgp_mime_part_sign): Make sure we are the owners of the byte - array. - (pgp_mime_part_verify): Same. - (pgp_mime_part_encrypt): Same. - (pgp_mime_part_decrypt): Same. - -2001-01-21 Christopher James Lahey - - * message-list.c (message_list_get_layout): Added - draw-focus="true" and selection-mode="browse" attributes to the - ETableSpecification. - (message_list_construct): Removed setting the "draw_focus" - argument since it doesn't exist any more. - -2001-01-21 Not Zed - - * mail-mt.c (mail_msg_new): Init a cancel field in the message. - (mail_msg_free): Free it. - (mail_msg_cancel): New function to attempt to cancel an operation - by id. Impelementation functions can still be uncancellable by - not registering for cancellation, etc, or do it themselves as - well. - - * mail-send-recv.c (fetch_mail_filter_folder): set folder_uid's - properly, so we can save it later. - (filter_folder_filter): Renamed from fetch_mail_filter_folder, - since its going to be used for all filtering. - (mail_fetch_mail): Changed from mail_filter_mail. - (mail_filter_folder): New function, replaces - mail_do_filter_ondemand functionality. - (mail_filter_on_demand): New function, actually replaces - mail_do_filter_ondemand. - (receive_get_folder): Added an exception arg. - (mail_send_message): New function to just send a message. - (send_mail_send): Use mail_send_message. - (send_queue_send): New send qeue code, use mail_send_message, and - clean up some stuff. - (mail_send_receive): Changed from mail_receive. - (build_dialogue): Setup the sending data, as well. - (mail_update_subfolders): New function to update folder info. - (send_mail_send): hook into cancellation if we want. - -2001-01-20 Jeffrey Stedfast - - * mail-ops.c (do_send_queue): Strip leading space from the - transport url gotten from the message. - -2001-01-19 Jeffrey Stedfast - - * mail-format.c (mail_generate_reply): If the name is empty - string, use the address. - -2001-01-19 Dan Winship - - * mail-display.c (pixmap_press): Update for e_popup_menu_run - change. - - * folder-browser.c (etable_key): On GDK_Menu (the menu key on - 105-key keyboards), pop up the right-click menu. - (on_right_click): update for e_popup_menu_run change. - - * subscribe-dialog.c (recursive_add_folder): New function to add a - folder and any parents of it that don't yet exist. Fixes bugzilla - #1028. - -2001-01-19 Not Zed - - * mail-send-recv.c: New swanky send/recieve thingy, well it so far - only receives (pop/mbox). Ignore all the warnings for now, and - the ugly 'button' to run it. - -2001-01-18 Jeffrey Stedfast - - * folder-browser-factory.c: Added the next/previous toolbar - buttons. - - * mail-callbacks.c (next_msg): New callback so we can have a next - toolbar button. - (previous_msg): Same but for previous. - -2001-01-17 Jeffrey Stedfast - - * mail-account-editor.c (construct): Anna's dialog now supports - SSL so we can get rid of the ssl-support checks. Also work around - the fact that Anna's dialog doesn't have an optionmenu for the - transport type, it's a label instead. - (transport_type_init): Cast the transport_type widget to a - GtkOptionMenu where appropriate as the widget that stores it is - now generic. - (apply_changes): Modify code to work with anna's dialog...*sigh* - (ok_clicked): Alert the user that one or more servers failed to - validate and allow him to continue anyway. - -2001-01-17 Jeffrey Stedfast - - * mail-config.c (mail_config_set_pgp_path): New config function to - set the path to the pgp binary. - (mail_config_get_pgp_path): Gee I wonder... - (mail_config_set_pgp_type): This one sets the type (ie PGP5, PGP2, - or GnuPG - see openpgp-utils.h for values) - (mail_config_get_pgp_type): Der. - -2001-01-17 Jeffrey Stedfast - - * mail-account-editor.c (construct): Handle NULL source and, while - we're at it, transport URLs. Apparently camel_url_new() and/or - camel-url_free() don't handle NULL input well. - - * mail-accounts.c (load_accounts): Handle NULL source URLs. - -2001-01-17 Jeffrey Stedfast - - * mail-account-editor.c (construct): Oops. "url && url->host" - doesn't do much without the '?' and ':' ;-) - -2001-01-17 Ettore Perazzoli - - * mail-ops.c (set_x_mailer): New function. - (send_mail_send): Use it. - (do_send_queue): Use it. - -2001-01-17 Martin Norbäck - - * openpgp-utils.c (pgp_get_passphrase): Changed the word entry - to enter, which is the correct word to use. - -2001-01-17 Jeffrey Stedfast - - * mail-callbacks.c (ask_confirm_for_empty_subject): Update to use - EMessageBox and to record if the user doesn't want to ever see - this dialog again. - - * mail-config.c (mail_config_get_prompt_empty_subject): New config - function. - (mail_config_set_prompt_empty_subject): Another new one. - -2001-01-16 Jeffrey Stedfast - - * mail-account-editor.c (apply_changes): Modify to be able to - handle a NULL source_url. - (source_auth_init): Allow for a NULL source url. - (source_check): Same. - - * mail-config.c (mail_config_write): Allow for NULL source - URLs. And while we're at it, NULL transport URLs as well. Might as - well save the use_ssl variable too. - (config_read): Same. - - * mail-config-druid.c (druid_finish): Modify to allow a NULL - source url. - (incoming_next): Modify to check for a NULL source and jump to the - transport page if one is encountered (this means the user decided - not to config a source). - (incoming_type_changed): Modify to set all widgets insensitive if - the user selected the "None" source menu item (aka NULL provider). - (incoming_check): Modify to allow the user to go to the next page - when he/she has chosen "None" for their source type. - (mail_config_druid_get_source_url): Return NULL if the provider is - NULL. - (mail_config_druid_get_transport_url): Same. - -2001-01-16 Dan Winship - - * mail-display.c (on_object_requested): Don't do thumbnails for - offline images - -2001-01-16 Jeffrey Stedfast - - * mail-callbacks.c (save_msg_ok): If the user hits "No", then - don't destroy the filesel window. - - * mail-ops.c (save_messages_save): Open with mode 0666 as danw - suggests. - -2001-01-16 Chris Toshok - - * component-factory.c (owner_set_cb): only load the news storage - if ENABLE_NNTP. - - * mail-accounts.c (construct): if !ENABLE_NNTP, remove the news - page from the dialog. - -2001-01-16 Radek Doulik - - * mail-format.c (mail_generate_reply): use - e_msg_composer_mark_text_orig - -2001-01-16 Dan Winship - - * mail-ops.c (send_mail_send, do_send_queue): Update the X-Mailer - header to use the string specified by configure. - -2001-01-16 Jason Leach - - * subscribe-dialog.c: removed unecessary #inlcude "e-title-bar.h" - -2001-01-16 Jason Leach - - * openpgp-utils.c (pgp_get_passphrase): Fix a string causing - translation problems. Bug #1147. - -2001-01-16 Not Zed - - * mail-ops.c (mail_do_fetch_mail): Setup a cancellation handle. - (do_fetch_mail): REgister for cancellation here. - (cleanup_fetch_mail): And unregister for cancellation here. - (mail_get_message): Add a cancel handle. - (get_message_get): Register/deregister for cancel. - (get_message_free): & clean up. - - * mail-mt.c (mail_msg_received): Removed debuggng. - - * mail-callbacks.c (stop_threads): Callback for stopping. - - * folder-browser-factory.c: Add a stop button verb thingy. - (control_activate): Disable the stop button by default. - -2001-01-15 Christopher James Lahey - - * message-list.c, message-list.h: Change from using filters for - date and size to using e_cell_date and e_cell_size. Moved a bunch - of includes from the message-list.h to the message-list.c. - -2001-01-15 Miguel de Icaza - - * mail-callbacks.c (configure_mail): Set the default button to - `Yes' here. - -2001-01-13 Jeffrey Stedfast - - * mail-account-editor.c (source_auth_init): If the preferred - authmech isn't found, default to the first one in the list. - (transport_construct_authmenu): This function already did the - above but I made it simpler. - (apply_changes): A number of cleanups. - -2001-01-13 Jeffrey Stedfast - - * mail-config-druid.c (druid_finish): Fixed mail_load_storages to - make a mini GSList of the account, not the account->source. Oops. - - * mail-accounts.c (news_delete): Updated to use the remove_news() - function. - - * mail-config.c (mail_config_remove_news): New convenience - function for removing news accounts. - (mail_config_remove_account): Pretty much the same thing. - - * mail-ops.c (do_send_queue): Get the X-Evolution-Transport URL - and use that if it exists, else fall back on the default - transport. - - * mail-callbacks.c (composer_postpone_cb): Set an - X-Evolution-Transport header. - -2001-01-12 Jeffrey Stedfast - - * Makefile.am: Removed GPG_* variables. - - * component-factory.c (mail_load_storages): Now takes a - 'is_account_data' variable to specify whether the sources is a - list of accounts of a list of services. Basically, the only time - you should pass in FALSE is when you are setting up NNTP storages. - (add_storage): Now takes a 'name' argument that specifies the name - to use in the storage. - (owner_set_cb): Updated to pass TRUE for accounts and FALSE for - news servers into mail_load_storages. - -2001-01-12 Christopher James Lahey - - * message-list.c: Changed filter_date and filter_size to match the - changes in gal. - -2001-01-12 Jeffrey Stedfast - - * mail-config.glade: Anna's dialogs. - - * mail-config.c (mail_config_get_account_by_address): - Removed. Danw and I decided on setting a X-Evolution-Transport - header on messages going to the Outbox so we can later guess which - transport to use when sending it. - - * mail-account-editor.c (apply_changes): Update to some day be - able to support SSL. - (construct): Update for Anna's dialogs... - - * subscribe-dialog.c (populate_store_list): Updated to reflect - past changes to the mail-config API. - -2001-01-12 Jeffrey Stedfast - - * mail-callbacks.c (composer_send_cb): Get the account by using - the new e_msg_composer_get_preferred_account() function. Also - check to make sure everything is configured (in case they deleted - their accounts while composing mail?). - - * mail-config.c (mail_config_get_account_by_address): New - convenience function. - -2001-01-12 Ettore Perazzoli - - * component-factory.c (component_fn): Pass NULL as the - @copy_folder_fn arg to `evolution_shell_component_new()'. - - * folder-browser.c (on_right_click): Removed hide menu. It - belongs to the view menu now. - -2001-01-12 Miguel de Icaza - - * message-list.c: Add strings for localization - - * folder-browser.c: Rename "Save" to "Store search as vFolder". - -2001-01-11 Miguel de Icaza - - * mail-display.c (on_object_requested): Unref the property bag - when we are done with it. - (get_embedded_for_component): Moved the code to request the - embeddable/control to a separate function. - -2001-01-12 Jeffrey Stedfast - - * mail-config.c (mail_config_get_account_by_name): New convenience - function that I will need later when I redo the composer From - field. - - * mail-display.c (on_object_requested): Update to reflect past - changes to the mail-config API. - - * session.c (mail_session_set_password): strdup() the key. - - * mail-config-druid.c (construct): We don't want to be able to set - the reply-to in the config druid. - (druid_finish): Don't set a reply-to anymore. - (mail_config_druid_finalise): Don't unref the providers. - - * mail-config.glade: Took out the Reply-To field in the druid. - -2001-01-11 Miguel de Icaza - - * mail-config-druid.c (incoming_type_changed): Guess the default - MAIL value for MBOX and Maildir files. - - * mail-callbacks.c (configure_mail): Force finalization of the - function before returning fixing the FIXME that was there. - -2001-01-11 Jeffrey Stedfast - - * mail-config-druid.c (transport_next): If the service_check - fails, pop-up a warning dialog letting the user know he or she may - have problems and then let them continue on with their lives. - (incoming_next): Same (+ jump them over the auth page to the - transport page). - - * mail-account-editor.c (apply_changes): Eek! Don't destroy the - account if the connection fails, duh. This is what is causing the - segfaults. - -2001-01-11 Dan Winship - - * folder-browser.c (got_folder): Connect to folder_changed as well - as message_changed for updating unread count - -2001-01-10 Miguel de Icaza - - * GNOME_Evolution_Mail.oafinfo: Add Bonobo/ItemContainer as the - set of supported interfaces in GNOME_Evolution_Mail_Composer - component. - -2001-01-11 Dan Winship - - * mail-format.c (write_field_to_stream): Translate the header name - to UTF8. - -2001-01-10 Jeffrey Stedfast - - * mail-callbacks.c (configure_mail): New function that explains to - the user why he can't do the action he requested and then procedes - to ask if he'd like to configure his accounts now. - (check_send_configuration): If the user doesn't have configured - accounts, don't let him continue and call configure_mail(). - (fetch_mail): Same. - (send_queued_mail): Same. - (send_receieve_mail): Same. - - * mail-config.c (mail_config_write): Don't save a "is_configured" - variable. Instead we'll just check to see if we have accounts - if - yes, then configured == TRUE. - (mail_config_is_configured): return accounts != NULL. - (mail_config_get_default_account): Mark the first account as the - default if none are marked. - -2001-01-10 Jeffrey Stedfast - - * mail-account-editor.c (source_auth_type_changed): Set the - sensitivity of the Password label too. - - * mail-config-druid.c (transport_back): New callback to handle - when the user hits the "back" button when on the transport - page. This is needed to handle the case where we don't want to - show the user the auth page (due to there being no auth choices). - (incoming_next): If we are going to skip over the auth page, set - the 'have_auth_page' variable to FALSE. - (construct): Initialize the have_auth_page to TRUE. - -2001-01-10 Jeffrey Stedfast - - * mail-config-druid.c (incoming_type_changed): Grab the focus of - the first widget that is sensitive. - (transport_type_changed): Same. - (identity_prepare): Grab the focus of the name entry. - - * mail-callbacks.c (send_queued_mail): Prevent Federico's segfault. - -2001-01-10 Jeffrey Stedfast - - * mail-config-druid.c (auth_type_changed): Clear the password - entry if it's not allowed. - (transport_type_changed): Clear the hostname if it is not allowed - by the provider type. - - * mail-account-editor.c (transport_type_changed): If the hostname - is allowed, clear it. - - * mail-config-druid.c (incoming_type_changed): Clear the contents - of the entry boxes that are not to be used. - (mail_config_druid_get_source_url): If the text in the entry is - emptry string, don't set it' contents in the url. - -2001-01-10 Miguel de Icaza - - * mail-callbacks.c (print_msg): Fix proto. - (print_preview_msg): Fix proto. - - * subscribe-dialog.c: Remove more UNSAFE macros. - -2001-01-09 Jason Leach - - * mail-display.c (pixmap_press): Bugfix for #1077: scrollwheel - doesn't work while hovering over an attachment icon. - -2001-01-09 Jeffrey Stedfast - - * mail-config-druid.glade: Moved to mail-config.glade - - * mail-accounts.c (construct): Updated to use mail-config.glade. - - * mail-account-editor.c (construct): Updated to use - mail-config.glade. - - * mail-config-druid.c (construct): Updated to use - mail-config.glade. - - * mail.h: Added the new mail config headers. - -2001-01-09 Dan Winship - - * mail-local.c (local_folder_changed_proxy): Change - mail_op_forward_event to mail_proxy_event. - -2001-01-09 Jeffrey Stedfast - - * mail-ops.c (save_messages_save): Let the system umask determine - the permissions of this file. - - * mail-config-druid.c (incoming_type_changed): Gray out the - appropriate labels too. - (auth_type_changed): And here. - (transport_type_changed): Here too... - - * mail-account-editor.c (source_check): Gray out the appropriate - labels too. - (transport_type_changed): And here too. - -2001-01-09 Jeffrey Stedfast - - * mail-account-editor.c: For all optionmenu's, set the appropriate - 'history'. - (keep_mail_check): Set the keep-on-server checkbutton sensitivity - based on whether or not the store is a storage or not. - (construct): Call keep_mail_check(). - - * mail-config-druid.c (incoming_type_changed): Set the - keep-on-server checkbutton sensitivity based on whether or not the - store is a storage or not. - - * mail-accounts.c (construct): Make sure the dialog isn't a - scrunched little thingy. - -2001-01-09 Dan Winship - - * Makefile.am (evolution_mail_LDFLAGS): Add -export-dynamic, so - libglade can resolve evolution-mail symbols. - -2001-01-09 Jeffrey Stedfast - - * mail-format.c: Updated. - (decode_pgp): Get rid of #ifdef PGP_PROGRAM's and handle - appropriately. - (handle_multipart_signed): Same. - (handle_multipart_encrypted): Same. - - * Makefile.am: Added openpgp-utils.[c,h] to the build. - - * openpgp-utils.c: New source file containing all of the pgp - interface code. - - * mail-crypto.c: Removed all of the openpgp funtions as they are - being moved to a new file. - (mail_crypto_is_rfc2015_signed): Renamed. - (mail_crypto_is_rfc2015_encrypted): Renamed. - -2001-01-09 Jeffrey Stedfast - - * session.c (mail_session_set_password): New function to set the - password for a given url. - - * mail-config-druid.c (druid_finish): Don't save the password in - the source url, instead insert it into the save-password hash. - (mail_config_druid_get_source_url): Check to make sure the - authmech isn't "", if it is then don't set the authmech. - - * mail-account-editor.c (apply_changes): Don't save the password - in the source url, instead insert it into the save-password - hash. Also check to make sure we don't set an empty string as the - authmech for the source or transport. - - * mail-accounts.c (mail_default): After reloading the accounts, - reselect the previously selected account. - (mail_delete): Same. - - * mail-config-druid.c (druid_cancel): Fixed segfault bug. - -2001-01-09 Radek Doulik - - * mail-format.c (write_headers): remove

- (handle_text_plain): add  
before - msg text - (handle_text_plain_flowed): ditto - -2001-01-09 Jeffrey Stedfast - - * mail-accounts.c (mail_default): Write the config data and reload - the accounts list so the "default" tag is relocated. - (mail_delete): Write the config data here too. - -2001-01-08 Jeffrey Stedfast - - * Makefile.am: - * component-factory.c: - * folder-browser-factory.c: - * folder-browser.c: - * mail-accounts.[c,h]: - * mail-account-editor.[c,h]: - * mail-callbacks.c: - * mail-config.[c,h]: - * mail-config-druid.[c,h]: - * mail-config-druid.glade: - * mail-display.c: - * mail-format.c: - * mail-tools.c: Brand spankin' new config druid, editor, - and manager. - -2001-01-08 Dan Winship - - * mail-ops.c: Add an #include - -2001-01-08 Jeffrey Stedfast - - * Makefile.am: - * component-factory.c: - * folder-browser-factory.c: - * folder-browser.c: - * mail-callbacks.c: - * mail-config.[c,h]: - * mail-display.c: - * mail-format.c: - * mail-tools.c: Reverted mail-config changes temporarily until - I get it working correctly. - -2001-01-08 Jeffrey Stedfast - - * mail-config-druid.c: More lovely fixes... - - * mail-callbacks.c: Don't segfault if a default account doesn't - exist. - -2001-01-08 Jeffrey Stedfast - - * mail-config-druid.c: A bunch of fixes. - - * mail-accounts.c: More fixes... - - * mail-account-editor.c (construct): Reparent the notebook to the - editor->vbox and set the resize policy. - -2001-01-07 Jeffrey Stedfast - - * mail-callbacks.c (providers_config): Use a - gnome_dialog_run_and_close(). - - * mail-accounts.c (construct): Reparent the notebook to the - dialog->vbox not to the dialog itself. Also set the resize policy - to allow the user to stretch it. - -2001-01-07 Jeffrey Stedfast - - * mail-tools.c (mail_tool_quote_message): Updated to reflect - changes to the mail-config API. - - * mail-display.c (redisplay): Updated to reflect changes to the - mail-config API. - - * mail-callbacks.c (providers_config): Use the new account dialog. - - * mail-config-druid.c (druid_finish): Load the new storage into - the shell. - (mail_config_druid_new): Take a shell argument. - - * mail-format.c (mail_generate_reply): Updated to reflect changes - to the mail-config API. - - * mail-config-druid.c: Fixed this to build. - - * mail-callbacks.c (check_send_configuration): Updated to reflect - changes to the mail-config API. - (create_msg_composer): Same. - (forward_get_composer): Same. - (send_queued_mail): Same. - (composer_send_cb): Same. - - * mail-account-editor.c: Updated to build cleanly. * - mail-config-druid.c: Same. * mail-accounts.c: Same. - - * folder-browser-factory.c (control_activate): Updated for API - changes in mail-config. - - * folder-browser.c (done_message_selected): Updated for API - changed in mail-config. - (folder_browser_gui_init): Same. - (got_folder): Same. - - * component-factory.c (owner_set_cb): After using the sources - list, free it as it is no longer a const GSList as with the older - mail-config code. - - * mail-config.c: Totally rewritten. - -2001-01-07 Jeffrey Stedfast - - * mail-accounts.c (mail_edit): Implemented. - - * mail-account-editor.c (apply_clicked): Implemented. - (ok_clicked): Implemented. - (cancel_clicked): Implemented. - (source_auth_type_changed): Implemented. - (source_auth_init): Implemented. - (transport_construct_authmenu): Implemented. - (transport_type_changed): Updated to change regenerate the auth - option menu. - (construct): Attached callbacks to OK, Apply and Cancel buttons. - - * mail-account-editor.c (source_auth_init): Use the new - mail_config_check_service(). - - * mail-config-druid.c: Remove check_service() as it will be moved - into mail-config. - -2001-01-06 Christopher James Lahey - - * message-list.c (message_list_select): Made it so that going to - the next or previous message in the list will at least move one - message, even if the current message matches the query. This - makes 'n' go to the next unread message, even if the current - message is unread. - -2001-01-06 Jeffrey Stedfast - - * mail-account-editor.c: Coded a bunch of the methods. - -2001-01-04 Iain Holmes - - * mail-summary.c (idle_check): Check if the HTML for the current - summary has been created, and if not then keep trying until it - has. - (new_folder_cb) - (removed_folder_cb) - (create_summary_view): Use the idle_check function to generate the - summary. - (create_summary_view): Don't set the HTML here. Set it via the - pipe. - -2001-01-05 Jeffrey Stedfast - - * mail-account-editor.[c,h]: New source files to provide an - account editor widget. - - * mail-config-druid.c (auth_type_changed): Set the authproto on - the druid so we can look it up later. - -2001-01-05 Jeffrey Stedfast - - * mail-accounts.c (mail_add): Since the druid now handles adding - the new account to the config, we'll just connect to the destroy - event and show the druid. - (mail_add_finished): Just reload the account list here. - - * mail-config-druid.c (druid_finish): New callback to handle the - "finish" signal. On second thought, it seems it would be best for - the finish callback to be here rather than in mail-accounts.c. - - * mail-accounts.[c,h]: Added. Contains source for the Account manager - window. And just like mail-config-druid.c, it's not yet complete. - - * mail-config-druid.c (mail_config_druid_get_incoming_keep_mail): - Renamed from _delete_mail - (mail_config_druid_get_transport_url): New convenience function - that replaces the get_hostname, get_protocol, etc. - (mail_config_druid_get_source_url): Same. - - * mail-config-druid.glade: Changed "Delete mail from server" to - "Keep mail on server" as this has a more positive ring to it. Both - I and Aaron agree this is the better phrase. - -2001-01-04 Jeffrey Stedfast - - * mail-config-druid.c: Fixed a few 'Oops'es. - - * mail-config-druid.glade: Added a "Default" button for marking an - account as the default. - -2001-01-04 Jeffrey Stedfast - - * mail-config-druid.glade: Updated. What else can I say? - -2001-01-04 Dan Winship - - * folder-browser.c (got_folder): Connect to "message_changed" on - the folder if it's on a remote storage. - (update_unread_count): Update the folder unread count / highlight - in the shell when the unread message count changes - -2001-01-04 Not Zed - - * mail-ops.c (mail_do_send_mail): Removed old implementation. - - * folder-browser.c (do_message_selected): If we haven't got a real - uid, then clear the display instead. - - * message-list.c (message_list_drag_data_get): Use new save - message function, and also wait for it to finish before - continuing. - (folder_changed): - (message_changed): Use mail_proxy_event instead of - mail_do_forward. - (mail_regen_list): New iplementation to replace the old. - : remove from headers. Dont define timeit by default. - (main_folder_changed): - (message_list_set_folder): - (message_list_set_threaded): - (message_list_set_search): - (message_list_hide_add): - (message_list_hide_uids): - (message_list_hide_clear): Use mail_regen_list instead of - mail_do_regenerate_messagelist. - (mail_do_regenerate_messagelist): Removed the old stuff. No - functionality changed yet, just using different thread stuff. - - * mail-callbacks.c (save_msg_ok): Use new save message function. - - * component-factory.c (create_view): - (add_storage): Use mail_scan_subfolders to build the folder info. - (create_folder): Use new implementation with our own callback. - (owner_set_cb): Changed b ack to use mail_get_folder, but now wait - for it to finish. This will let any gui still run, but also gives - us the required synchronous operation. - (got_folder): Callback for when the folder has been opened. - - * mail-ops.c (mail_get_folderinfo): New function to just get the - folder info in another thread. - (mail_scan_subfolders): New scan subfolder implementation that - uses mail_get_folderinfo. - (mail_do_scan_subfolders): Removed old implementation. - (mail_create_folder): Nerw implementation to create a folder, only. - (mail_do_create_folder): Removed old implementation. - (mail_save_messages): New implementation, fixes a couple of minor - problems, and now provides a return so it can be waited on. Also - check that the writes worked, etc. - (mail_do_save_messages): Remove previous implementation. - (mail_do_flag_messages): Removed, nothing uses it. - (mail_do_flag_messages): Removed, nothing uses it anymore. - (mail_get_folder): REturn the operation id, so callers can wait - for it. - (sync_folder_desc): - (expunge_folder_desc): Add describe functions so we know what its - doing. - (mail_send_mail): More generic implementation of sending mail. - - * mail-mt.c (mail_msg_new): Lock around seq increment. And insert - each new message into a hash table of active messages. - (mail_msg_init): Init the active message table. - (mail_msg_free): Remove the message from the active message table. - (mail_msg_wait): New function, waits for a message to be - processed, by id. - (mail_msg_check_error): Dont display the error if it is a - user-cancelled operation. - (mail_proxy_event): new implementation of mail_op_forward_event. - Only real difference is it uses the new thread stuff, and you can - wait for it to finish if you want. - (mail_proxy_event): If we're already in the main thread, just call - the function. - -2001-01-03 Jeffrey Stedfast - - * mail-config-druid.c: New source file that implements - mail-config-druid. Note: this is not yet complete. - -2001-01-03 Not Zed - - * mail-view.c (view_forward_msg): Call - mail-callbacks.c:forward_messages(), so the behaviour is the same - as from the folder browser. - - * mail-callbacks.c (forward_messages): New function to forward - messages, attached or not. - (forward_inlined): Changed to use new forward-messages - implementation. - (forward_attached): Likewise. - (do_forward_attach): Callback for forwarding as attachment, once - we have built it. - (do_forward_inline): Likewise, for inline, once we have retrieved - the message. - (forward_message): Removed. - - * mail-ops.c (mail_build_attachment): New function to build an - attachment of messages. - (mail_do_attach_message): Removed, functionality superceeded by - above. - (mail_do_forward_message): Removed. Likewise. - (mail_create_folder): Started work on an alternative - implementation of create_folder, but not sure about it yet. - - * mail-tools.c (mail_tool_generate_forward_subject): Remove locking. - (mail_tool_make_message_attachment): Free the description when done. - -2001-01-03 Radek Doulik - - * mail-format.c (write_headers): add font color setting for table, - changed border behavior - - * mail-display.c (redisplay): don't set body bg and text color - -2001-01-02 Not Zed - - * mail-callbacks.c (view_msg): Fix for mail_get_message change, - use queue thread. - - * folder-browser.c (done_message_selected): Fix mail_Get_message - calls, use new thread. - (do_message_selected): " - - * mail-ops.c (mail_get_message): Add a thread argument so callers - can specify which queue it executes on. - - * mail-mt.c (mail_msg_free): Fix a free order problem. - (mail_msg_destroy): Call mail_msg_free to do the work. - (mail_msgport_replied): " - (mail_msgport_replied): Check/display errors if we get them. - (mail_msgport_received): If we have a describe function, say what - we're doing, also set busy/unbusy. - (mail_msgport_replied): Clear busy when we get a reply. - (mail_get_password): Unset busy. - (mail_msg_received): Set busy as we go. - (mail_msg_destroy): Unset busy when done. - (mail_status): Blah blah, new status interface, the other wans't - workable with the way the shell api works. - -2000-12-29 Not Zed - - * folder-browser.c (do_message_selected): If we are reconfiguring, - just keep polling till we are done (yeah kinda shitty, but easy). - (folder_browser_set_uri): Clear reconfigure flag here. ick. - (got_folder): And here too. - (on_right_click): Remove locking. - (hide_sender): and here too. - (hide_subject): And here. - (on_right_click): If we are in reconfigure, then the whole menu is disabled. - - * mail-mt.c (status_busy_timeout): Clear the status_busy_timeout_id. - - * mail-local.c (local_storage_new_folder_cb): Made getting folders - completely synchronous. The shell expects it, and it was only - synchronous before by a sideeffect. - (do_reconfigure_folder): Remove locking stuff. - (do_reconfigure_folder): Use our own much simpler copying routine - than that stupid move_folder_contents thing. - (update_progress): Use mail_status_message() instead. - (do_reconfigure_folder): Set the reconfigure flag during - reconfigure & set busy flag. - (cleanup_reconfigure_folder): clear busy flag. - - * mail-tools.c (mail_tool_uri_to_folder): Remove the tool_lock - stuff. - (mail_tool_uri_to_folder_noex): Clear exception on exit. - (mail_tool_move_folder_contents): Get rid of this really stupid - function that is only used in one place. - - * component-factory.c (owner_set_cb): Use direct calls to get the - folders, as this code must run synchronous. Remove the event wait - stuff. - - * mail-callbacks.c (edit_msg): Call mail_get_messages, and create - the composers ourself. - (do_edit_messages): get_messages callback, create the composers - and connect to signals we need. - (view_msg): Dont call do_view_messages, just call - mail_get_messge for each to get them in parallel. - (do_view_message): view a single message. - - * mail-ops.c (mail_edit_messages): Just use mail_get_messages - for this operation. Removed the other async operation stuff. - Changed my mind, just removed entirely. - (mail_do_view_messages): Removed. - (mail_do_setup_folder): Removed. - (mail_do_scan_subfolders): Make this run synchronously, as every - caller expects it to (even if they didn't realise). - -2000-12-28 Not Zed - - * mail-callbacks.c (send_queued_mail): Dont expunge the folder - here, but in send_queue, otherwise it might execute out of order. - (expunge_folder): Remove the talbe prechange stuff, and infact - references to the message_list folder, as we have our own folder. - Also, dont allow expunge if we're already expunging. - (expunged_folder): Clkear the expunging flag if we're finished. - - * folder-browser-factory.c (control_deactivate): Likewise here. - Hrm, i thought this function required a callback, silly me. - - * mail-tools.c (mail_tool_make_message_attachment): Remov e - locking. - - * folder-browser.c (on_message_selected): Use a timeout handler so - we dont select immediately. - (folder_browser_set_uri): Changed to use mail_get_folder. - (got_folder): New callback called when get_folder is finished. - (folder_browser_destroy): Use new sync interface. - - * mail-ops.c (mail_get_message): New function to asynchrounously - get a message. - : #define out mail_tool_camel_lock stuff entirely. - (mail_get_folder): New function to asynchrounously get a folder. - (mail_do_load_folder): Removed, replaced by more generic function - above. - (mail_do_display_message): Removed, replaced by the more generic - funciton get_message. - (mail_get_messages): New function to get a list of messages - asynchronously. - (mail_sync_folder): New interface to sync a folder async. - (mail_expunge_folder): New interface for expunging folder, with - callback. - (do_send_queue): Remove lock stuff, and expunge if (and only if) - successful, also sync the sent folder while we're at it. - - * session.c (mail_session_request_dialog): Changed to use new - mail_get_password call. - - * mail-mt.[ch]: New threading/interthread messaging framework. - - * main.c (main): Init the message/thread system. - -2001-01-02 Dan Winship - - * mail-format.c (mail_part_is_inline): - (find_preferred_alternative): - * mail-display.c (launch_cb): Use header_content_type_simple, not - header_content_type_format. - -2000-12-26 Jeffrey Stedfast - - * mail-crypto.c (mail_crypto_openpgp_verify): Implemented. - -2000-12-23 Jeffrey Stedfast - - * mail-ops.c (mail_do_setup_trash): New function similar to - mail_do_setup_folder() except that this creates the Trash VFolder - (special-case). - -2000-12-21 Jeffrey Stedfast - - * mail-ops.c (do_send_mail): Don't free info inside the last - if-statement, if sent_folder doesn't exist we'll have a memory - leak. Instead free it afterward. - -2000-12-29 Dan Winship - - * mail-crypto.c: Oops. Update this for CamelContentType stuff too. - -2000-12-28 Dan Winship - - * mail-format.c (mail_part_is_inline, mail_get_message_body): Use - CamelContentType, and use header_content_type_is instead of doing - it by hand. - - (handle_text_plain): - (handle_multipart_related): - (find_preferred_alternative): - (handle_message_external_body): Use CamelContentType and - header_content_type_* functions instead of GMimeContentField. - - * mail-display.c (write_data_to_file, launch_cb): Use - CamelContentType and header_content_type_* functions instead of - GMimeContentField. - -2000-12-26 Iain Holmes - - * mail-display.c (mail_display_init): Initialise the thumbnail cache. - (mail_display_destroy): Free the cache. - (pixbuf_gen_idle): Check the cache for a pixbuf, add the pixbuf to the - cache if it's not there. - -2000-12-26 Iain Holmes - - * mail-summary.c (create_summary_view): Create a shared - BonoboEventSource object and use it for all the objects that - aggregate Bonobo::EventSource. - -2000-12-27 Dan Winship - - * subscribe-dialog.c (setup_subscribe_folder): Use info->name, not - input->full_name. Fixes #1029 in bugzilla.helixcode.com. - ({setup,do,cleanup}_subscribe_folder): Update previous fix: Jeff - had changed it to use ->full_name instead of ->name because that's - what camel_store_subscribe_folder needed. So we need to have - *both* names available, one for Camel, one for the shell. - -2000-12-24 Christopher James Lahey - - * message-list.c (filter_date): Changed this to format times in 12 - hour time instead of 24 hour time. - -2000-12-24 Christopher James Lahey - - * message-list.c (filter_date): Changed this to do different - formatting of dates within the last week. - -2000-12-24 Not Zed - - * Merge from camel-mt-branch. - -2000-12-23 Christopher James Lahey - - * message-list.c (filter_date): Changed this to do different - formatting of dates based on the current time. - -2000-12-23 Christopher James Lahey - - * message-list.c (message_list_get_layout): Added titles to the - pixbuf columns. - -2000-12-21 Iain Holmes - - * mail-summary.c: Added code to detect and regenerate the summary - when a new vfolder is created or removed. - - * mail-vfolder.c: Export the vfolder_storage variable, so that - the summary can add a listener to it. - -2000-12-05 Iain Holmes - - * component-factory.c (factory_destroy): Wait till all views have - gone and then destroy both factories. - -2000-12-21 Dan Winship - - * mail-display.c (pixbuf_for_mime_type): Deal with the possibility - that we have an icon-filename listed for a MIME type, but the icon - file doesn't actually exist. Also, if gnome-unknown.png can't be - found, fall back. Might fix a crash people have been reporting... - -2000-12-18 Chris Toshok - - * mail-format.c (handle_multipart_encrypted): for now #ifdef - PGP_PROGRAM falling back to handle_multipart_mixed. - (handle_multipart_signed): same. - -2000-12-18 Dan Winship - - * message-list.c (hide_save_state): Unlock camel when done to - prevent a hang later. - -2000-12-18 Miguel de Icaza - - * mail-tools.c (mail_tool_move_folder_contents): Only update - display every 2 seconds. - - * mail-ops.c (do_view_messages): Only update display every 2 seconds. - -2000-12-23 Not Zed - - * message-list.h (MessageList): Add a specific hide data lock. - - * message-list.c (message_list_drag_data_get): Do not use - cursor_uid, but get all currentlys elected messages directly off - the message-list. - (message_list_destroy): Removed mail_tool_camel_lock stuff. - (on_click): " - (message_list_hide_add, message_list_hide_uids, hide_load_state, - hide_save_state, message_list_hide_clear): ", but use a specfic - lock for the hide data. - (do_regenerate_messagelist): remove mail_tool_camel_lock stuff, - add hide_lock where required. - (message_list_init): Setup the hide_lock. - (message_list_destroy): Free the hide_lock. - -2000-12-22 Not Zed - - * mail-ops.c (mail_do_sync_folder): Run sync in different thread - each time. Just a quick litlte hack to check multithreading. - There are now few operations that single-queue. Need to work out - a way to make the allocation of threads & resources easier, so we - dont get overwhelmed with threads, but we dont block when we dont - have to, either. - - * message-list.c (main_folder_changed): If we have only changed - events, then process them directly. - (mail_do_regenerate_messagelist): Run regenerate in a new thread - each time, another quick hack to check mutlithreading. - - * mail-view.c (view_delete_msg): Call camel folder set message - flags directly. mail_do_set_message_flags() is now completely - unused. - - * folder-browser.c (mark_msg_seen): Call camel folder - set_message_flags directly. - - * mail-callbacks.c (flag_messages): New function, that just sets - flags of all selected messages, without all that messy thread - stuff (setting flags is in-memory). - (mark_as_seen): Use flag_messages(). - (mark_as_unseen): " - (undelete_msg): " - (delete_msg): " - -2000-12-20 Not Zed - - * message-list.c (message_list_select): Free messageinfo lookups. - (message_list_drag_data_get): " - (subtree_unread): " - (subtree_size): " - (subtree_earliest): " - (ml_tree_value_at): " Also, keep the message info around in a - static variable, and ref'd, so that any internal references we - have to it dont vanish while we're not looking. This has a couple - of problems ... esp since we never unref the last access, although - camel-folder-summary wont check this when its unref'd, so we're - 'safe'. - (save_node_state): free messageinfo lookups. - (on_click): " - (get_message_info): deconstify return. - - * mail-tools.c (mail_tool_move_folder_contents): Free messageinfo - lookups. - - * mail-ops.c (do_filter_ondemand): Free messageinfo lookups. - (do_flag_messages): " - (do_fetch_mail): Remove mail_tool_lock stuff. - (mail_operation_run): Quick hack to run an operation - asynchrounously, in a brand-new thread. - - * folder-browser.c (on_right_click): Free messageinfo lookups. - -2000-12-16 Not Zed - - * message-list.c (build_tree): Always use the slow (full-update) - version of the tree update code, to get around a bug(?) in etree. - (build_flat): Likewise. - -2000-12-15 Not Zed - - * mail-display.c (write_data_to_file): Dont blindly convert all - parts to utf8, e.g. image/jpg. We only convert text/* parts, and - only then if required. - -2000-12-14 Not Zed - - * component-factory.c (create_view): cast over a warning. - - * folder-browser-factory.c: Add verbs for hide functions. - - * message-list.c (message_list_hide_clear): - (message_list_hide_uids): - (message_list_hide_add): Some api renaming. - (message_list_hide_add): Allow ML_HIDE_SAME to be passed to mean - not to change the upper/lower range at all. - (hide_save_state): Save the state of the hide list to stable - storage. - (hide_load_state): Load the state of hte hide list. - (message_list_set_folder): Load/save the state of the folder if it - is changed/set. - (message_list_destroy): Save the state of the folder hide list - when done. - (save_tree_state): If we wrote out an empty state file, simply - remove it instead. - - * folder-browser.c (on_right_click): Add some hide menus. - (hide_read): Hide read messages. - (hide_deleted): Hide deleted messages. - (hide_selected): Hide selected/current message. - (hide_none): Show all hidden messages. - (on_right_click): Lock around accesses to the message (inside - mlist_detect_magic). - (on_right_click): Free the mailing list name. - -2000-12-13 Not Zed - - * folder-browser.c (on_right_click): Add camel locking since we - call it directly. Whoever heard of a lock you 'down' to unlock? - - * message-list.c (mail_do_regenerate_messagelist): Added hide - expression, messages to hide. Fixed all callers. - (do_regenerate_messagelist): IF we have a hide expression, search - and remove those from the uid list. If we have a hide range, - apply that afterwards. - (cleanup_regenerate_messagelist): Handle freeing the hide uid - temporary data, if required. - (message_list_destroy): Free hide data, also lock around all camel - object stuff. - (message_list_length): New function to get the number of messages - avaialble to be hidden by range. - (message_list_set_hide): Set the hide expression and range. - Issue: Should hiding be remembered? - (message_list_unhide_all): Turn off all hiding. - (message_list_hide_uids): Hide a list of uid's. - -2000-12-15 Dan Winship - - * subscribe-dialog.c (folder_toggle_cb): Update this for the new - signal handler prototype. Fixes the crash on double-click. - -2000-12-15 Jeffrey Stedfast - - * mail-format.c (handle_multipart_signed): New callback to handle - multipart/signed parts. - (decode_pgp): Update to account for the cipherlen argument needed - for openpgp_decrypt. - (is_rfc2015): Removed as we now have a better version in - mail-crypto. - (handle_multipart_encrypted): Updated to use the PGP/MIME utility - functions. - - * mail-crypto.c (mail_crypto_openpgp_decrypt): Don't check - (!*plaintext) as it could be a binary stream. Now also takes a - cipherlen argument. - (mail_crypto_openpgp_sign): New function. - (pgp_mime_part_sign): New function to replace a mime part with the - pgp signed equivalent. - (pgp_mime_part_encrypt): New function to replace a mime part with - the pgp encrypted equivalent. - (pgp_mime_part_decrypt): New function to decrypt a pgp encrypted - mime part (like from pgp_mime_part_encrypt) and replace it. - (is_rfc2015_signed): New function to determine if a mime part is - an rfc2015 signed part. - (is_rfc2015_encrypted): New function to determine if a mime part - is an rfc2015 encrypted part. - (mail_crypto_openpgp_verify): New openpgp function to verify a - signature. - -2000-12-14 Christopher James Lahey - - * mail-threads.c (update_active_views): Unref the iterator when - we're done with it. - -2000-12-14 Larry Ewing - - * mail-display.c (mail_display_new): call - gtk_html_set_default_content_type to make gkthtml default to utf-8 - when parsing. This requires gtkhtml >= the released 0.8. - -2000-12-14 Ettore Perazzoli - - * mail-threads.c (read_msg): Call `ui_set_busy()' before - `ui_set_message()' so that we are sure that the - set_busy/unset_busy calls always happen in order. - -2000-12-13 Christopher James Lahey - - * folder-browser.c (my_folder_browser_init): Made the vertical - scrollbar always be there. - - * message-list.c (message_list_get_layout): Changed the minimum - width of some of the pixmap column headers. - -2000-12-12 Christopher James Lahey - - * component-factory.c (create_view): Added a cast. - - * mail-summary.c: Added #include "mail-summary.h". Commented out - folder_free, summary_free, and view_destroy_cb since they're not - used. - (do_changed): Added a cast. - (create_summary_view): Changed some types so that casting would be - easier. - - * session.c (mail_session_remember_password): Added a cast. - -2000-12-12 Dan Winship - - * mail-summary.h: Fix to use the right .h instead of the - deprecated one. - -2000-12-12 Jeffrey Stedfast - - * mail-callbacks.c (forward_message): Attach a signature when - forwarding, fixes bug #826. - -2000-12-11 Dan Winship - - * session.c (mail_session_enable_interaction): New function to - tell the code that it's ok (or not) to interact with the user when - trying to authenticate to a service. Starts out turned off. - (mail_session_request_dialog): If interaction is disabled, fail if - the password isn't in the cache. - - * component-factory.c (owner_set_cb): Call - mail_session_enable_interaction() after everything else. (This - means that the IMAP password dialog will no longer pop up [under - the splash screen] at startup.) - -2000-12-11 Dan Winship - - * component-factory.c (create_view): Deal with "mailstorage" type - views (top-level mail storages) by trying to fill the storage's - folder tree again if we failed before. - (add_storage): Create new storages with a URI and type - "mailstorage". - - * mail-ops.c (cleanup_scan_subfolders): On success, mark the - storage as having been loaded, so create_view won't try again. - -2000-12-11 Jeffrey Stedfast - - * mail-format.c (decode_pgp): Updated to reflect arguments to the - openpgp functions - now also takes an outlen argument. - (try_inline_pgp): Updated. - (handle_multipart_encrypted): Updated here too. - - * mail-crypto.c (crypto_exec_with_passwd): Updated to handle - binary streams and such. - (mail_crypto_openpgp_encrypt): Always initialize the passwd_fds - even if we don't plan on signing. Added an 'inlen' to specify the - length of the input data (as it could be binary). Also added a - 'userid' argument for cases when we want to sign as well as - encrypt. - (mail_crypto_openpgp_decrypt): Updated to take an outlen argument - in case the ciphertext is encrypted binary data. - (mail_crypto_openpgp_clearsign): Added a 'hash' and 'detach' - arguments. 'hash' allows the program to specify the preferred hash - function (which will come in handy when generating - PGP/MIME). 'detach' allows the program to specify whether it wants - a detached signature or the entire signed text. - -2000-12-11 Dan Winship - - * message-list.c: Remove the never-once-used BonoboObject stuff - and make MessageList be a GtkWidget instead. Also, keep track of - the ETable directly rather than repeatedly calling - e_table_scrolled_get_table. - - * folder-browser.c (folder_browser_destroy): Use gtk methods - rather than bonobo methods to destroy the message list. - (on_right_click, on_double_click): These are being attached to the - ETable directly now, so fix the first argument (which isn't being - used anyway, but...). Ignore double-clicks on "active" columns - (the ones where clicking does something beyond "select"), fixing - bug #811, which is what got me started on this to begin with... - (folder_browser_gui_init): simplify now that MessageList itself is - a widget. Also use message_list->table rather than - e_table_scrolled_get_table. - - * mail-local.c (mail_local_reconfigure_folder): Add "mail_" to - the beginning of this function name to match its prototype and the - other vague namespace conventions in the mailer. - - * mail-callbacks.c (select_all, invert_selection): Use ml->table. - (configure_folder): s/local_reconfigure_folder/mail_&/ - - * mail-ops.c (do_flag_messages): clean up the cleanup a bit - - * mail-tools.c (mail_tool_quote_message): Remove an unused - variable. - -2000-12-11 Not Zed - - * local-config.glade: reordered the options and added maildir, - mbox, maildir, mh, in that order. - - * mail-local.c (reconfigure_clicked): Added maildir, re-ordered to - match the changed xml file too. - (do_reconfigure_folder): WHoever 'threaded' this code forgot to - check that folder_browser functions shouldn't be called here. - (cleanup_reconfigure_folder): Call it here instead. - (lookup_folder): Blah blah, we have to lookup the folder and - verify its still the same format, joy. Becaause someone thought - it would be wise to make the code 5x more complicated for no - reason, and totally break 'mail reconfigure' in the process. i'm - really happy about that one. - (cleanup_register_folder): Uh, yeah, so like, the - local_store->folders hashtable is supposed to point to like, - LocalFolders, not CamelFolders. - (free_local_folder): Free the localfolder struct properly. - (free_folder): Call above to free data properly. - (get_folder): Fix for fixing folders hashtable. - (local_storage_removed_folder_cb): Same here. - (local_storage_new_folder_cb): Ref the local_store when putting it - in the local_folder. - (cleanup_register_folder): Properly free the local_folder if the - op failed. - (free_local_folder): Unhook events also. - (d): Oops, left debug turned on. - -2000-12-09 Christopher James Lahey - - * message-list.c (message_list_init): Change the "drawfocus" - argument on e_table_scrolled_get_table(etable) instead of on - etable (etable is an ETableScrolled.) - -2000-12-08 Jeffrey Stedfast - - * mail-callbacks.c (save_msg_ok): Check to see if the file already - exists, if it does prompt the user to for permission to overwrite - the file. - (forward_message): g_strdup the cursor_uid if there is only a - single message to be forwarded or we'll segfault later. - - * mail-ops.c (do_save_messages): Rewrote yet again. I'm back to - almost an identical implementation as the first time I wrote this - except now we write the From line which I had forgotten last - time. This means that we no longer have to unlink the .ev-summary - file created and we also use fewer resources (no need to create a - CamelMboxFolder object). - -2000-12-08 JP Rosevear - - * folder-browser.c (on_double_click): the e-table double-click - signal now has extra params - -2000-12-07 Ettore Perazzoli - - * component-factory.c (add_storage): Pass `NULL' as the - @toplevel_node_handler_id arg in `evolution_storage_new()'. - FIXME: We should be passing the ID of the mail component here. - * mail-vfolder.c (vfolder_create_storage): Likewise. - -2000-12-08 Jeffrey Stedfast - - * message-list.c (message_list_get_layout): Set the "Size" field - to sort using integer comparison instead of string. - (filter_size): New function to transform a integer size into a - more readable form. - (ml_value_to_string): Use filter_size. - (ml_value_is_empty): COL_SIZE is no longer a string, so handle - this as an integer. - (ml_initialize_value): Here too. - (ml_free_value): And here. - (ml_duplicate_value): And here too. - (message_list_create_extras): Setup the size etable cell. - -2000-12-08 Christopher James Lahey - - * folder-browser.c: Connect to signals on the ETable instead of - the ETableScrolled. - - * subscribe-dialog.c: Used the e_table_scrolled_get_table function - instead of accessing the variable directly. - -2000-12-08 Christopher James Lahey - - * message-list.c: Connect to signals on the ETable instead of the - ETableScrolled. - -2000-12-07 Christopher James Lahey - - * message-list.c: Got rid of code referencing the ETableScrolled - proxy functions. Changed the call to e_table_set_cursor_row to - send a model row instead of a view row. - -2000-12-07 Jeffrey Stedfast - - * mail-callbacks.c (forward_message): Only do a - message_list_foreach if we plan on attaching messages, otherwise - just use ml->cursor_uid. - - * mail-ops.c (cleanup_forward_messages): If attaching multiple - forwarded message, wrap them in a multipart/digest otherwise just - attach the single message as a message/rfc822. - -2000-12-07 Dan Winship - - * mail-display.c (on_object_requested): Make the iTip hack spew a - g_warning and not crash if you have no identity configured. To be - revisited. - - * mail-callbacks.c: (various) - * folder-browser.c (filter_mlist): - * mail-autofilter.c (filter_gui_add_from_message): - * mail-vfolder.c (vfolder_gui_add_from_message): Add some - g_return_if_fail()s to protect from crashes until the code to - enable/disable commands based on how many messages are selected is - done. - -2000-12-06 Jeffrey Stedfast - - * mail-vfolder.c (vfolder_gui_add_rule): Make the vfolder editor - resize correctly. Fixes bug #835. - -2000-12-06 Dan Winship - - Fix up shutdown so that things that should be destroyed get - destroyed. Among other things, this fixes the bug where IMAP - stores weren't disconnected at shutdown. - - * mail-threads.c (update_active_views): Update for - folder_browser_factory_get_control_list change to EList. - - * folder-browser-factory.c: Turn control_list into an EList so - that we can safely remove items from it while it's being iterated - (which will happen as FolderBrowsers are destroyed at shutdown - while the thread code is trying to update the status bars). - (control_destroy_cb): Just destroy the folder_browser. - (browser_destroy_cb): New callback for FolderBrowser destroy. - Remove the control from control_list here instead of - control_destroy_cb, because the controls don't seem to get - destroyed reliably... - - * component-factory.c: Clean up stuff. - (factory_destroy): Get rid of this. - (owner_unset_cb): Schedule an idle handler to quit. - (idle_quit): Wait for all of the FolderBrowsers to be destroyed - and then destroy the storages and quit. - - * mail-summary.h (create_summary_view): Fix prototype - -2000-12-06 Jeffrey Stedfast - - * mail-config.c (mail_config_folder_to_cachename): Use - e_filename_make_safe (which used to be e_str_make_safe). - - * mail-display.c (make_safe_filename): And here. - - * message-list.c (message_list_drag_data_get): Here too. - -2000-12-06 Dan Winship - - * mail-local.c (cleanup_register_folder): Run the folder_changed - code on message_changed as well, so the unread message counts - update as messages are read. - - * folder-browser.c: Remove bits of filter-on-demand and toolbar - bug workaround cruft that don't do anything useful any more. - - * mail-ops.c (cleanup_load_folder): unref the ref we added in - setup_load_folder. - -2000-12-05 Jeffrey Stedfast - - * mail-display.c (write_data_to_file): Use a charset filter to - make sure the data is written out in the charset it was meant to - be in instead of UTF-8. - - * mail-format.c (mail_format_raw_message): Don't use the raw - message body as the format argument, use "%s" instead. If the raw - message contains %'s then it will segfault otherwise. - -2000-12-04 Dan Winship - - * mail-config-gui.c (service_page_item_new): Fix a typo so that - toggling the "remember password" checkbox will activate the "OK" - button if it was inactive. - -2000-12-05 Ettore Perazzoli - - * mail-vfolder.c (vfolder_create_storage): Updated the call to - `evolution_storage_new()': pass NULL for @toplevel_node_uri. - - * component-factory.c (add_storage): Updated the call to - `evolution_storage_new()': pass NULL for @toplevel_node_uri. - -2000-12-04 Jeffrey Stedfast - - * subscribe-dialog.c (setup_subscribe_folder): Use info->full_name - rather than info->name so that we get the namespace part of the - folder path as well. - -2000-12-04 Ettore Perazzoli - - * folder-browser-factory.c: Updated to define verbs - "MessageForwardInlined" and "MessageForwardAttached" instead of - "MessageForwardInline" and "MessageForwardAttach". - - * folder-browser.c (on_right_click): Make forwarding as an - attachment the default. - - * mail-callbacks.c (forward_inlined): Renamed from `forward_msg'. - (forward_attached): Renamed from `forward_attach'. - * mail-callbacks.h: Updated accordingly. - -2000-12-01 Dan Winship - - * session.c (mail_session_remember_password): Writes out passwords - (to .gnome_private) in our patented proprietary "Best Awesome - Super Encryption 64" ("BASE64") format which could not possibly - ever be cracked by even the most cryptographically knowledgeable - five-year-olds. - (mail_session_init): Load remembered passwords at startup. - (mail_session_forget_passwords): Erase them from disk as well as - memory. - - * mail-config.c: Add "remember_password" field to - MailConfigService. - (mail_config_write_on_exit): Call mail_session_remember_password - for services with "remember_password" set. - * mail-config-gui.c: Add "remember password" checkbox to the - dialogs, and make it appear and disappear as appropriate. - - * component-factory.c (mail_load_storages): Unref the store - regardless of whether or not we're using it, so we don't leak - references to non-storage stores. - -2000-12-01 Jeffrey Stedfast - - * message-list.c (e_mail_address_new): Perform better - error-handling. - -2000-12-01 Radek Doulik - - * mail-ops.c (mail_op_report_status): use mail_op_set_message_plain - - * mail-threads.c (mail_op_set_message_plain): plain version of - mail_op_set_message, doesn't use printf, passes message untouched, - use set_message - (mail_op_set_message): set_message - (set_message): helper function - -2000-11-30 Jeffrey Stedfast - - * mail-ops.c (cleanup_fetch_mail): Don't display a dialog, instead - inform the user that there was no new mail by setting a status - message. - - * message-list.c (message_list_drag_data_get): Use the new - e_str_make_safe function. - - * mail-display.c (make_safe_filename): And here. - - * mail-config.c (mail_config_folder_to_cachename): Here too. - -2000-11-30 Not Zed - - * mail-ops.c (cleanup_load_folder): Set threaded view before - setting the folder (cleanup some flash ons tartup). - - * message-list.c (message_list_init): Initialise a mempool for uid - string storage. - (new_id_from_uid): Added messagelist arg, allocate strings from - uid_pool. - (new_id_from_subject): Same. Fixed all callers. - (remove_node_diff): Dont free uid here. - (build_flat_diff): Nor here. - (clear_tree): Flush the mempool, rather than freeing the id's - directly. - (free_tree_ids): Removed, no longer required. - (free_tree_ids): Likewise. - (message_list_init): Dont connect to the table destroy signal - anymore to free the uid table. - (message_list_destroy): Free the uid pool here. - (*): Use accessors for messageid stuff. - (content_is_attachment): Removed, no longer required. - (ml_tree_value_at): Get the attachment flag directly from the - summary. - (ml_tree_value_at): For 'fake' nodes, try and do something better - than "?" for from, to, and size. - (subtree_size): New function, add up the total size of a subtree. - (subtree_earliest): Get the earliest date from a subtree. - (ml_tree_value_at): Return earliest date sent/received for fake - nodes. - (ml_tree_value_at): Return something to mark a fake subject line - as a fake subject, although i dont know, i guess this buggers up - sorting ... - (subtree_size): Check the info node is still there. - (subtree_earliest): Same here. - (subtree_unread): And here. The info node might vanish if the - folder has changed/is changing and we try and redraw stuff while - its doing it. - (message_list_drag_data_get): Use accessors. - -2000-11-29 Jeffrey Stedfast - - * message-list.c (message_list_drag_data_get): Implement. - (message_list_init): Connect the d&d signal. - - * mail-ops.c (do_save_messages): Use camel a bit more to help us - out. Don't create the file ourselves, treat it as a CamelFolder so - we don't have to worry about formatting. - -2000-11-29 Dan Winship - - * main.c (main): Remove no-longer-needed e_unicode_init. - - * mail-tools.c (mail_tool_quote_message): Fix the allocation here - (again) and put a comment explaining it. (Fixes a crash when - replying.) - -2000-11-28 Dan Winship - - * component-factory.c (owner_set_cb): Wait until after setting up - the local storage to find the Drafts/Outbox/Sent folders. - - * mail-ops.c (do_setup_folder): Use the file: store rather than - mbox:. - -2000-11-28 Jeffrey Stedfast - - * folder-browser-factory.c: Added the SaveAs bonobo menu verb - thingy. - - * mail-callbacks.c (save_msg): New callback for saving messages. - (save_msg_ok): - - * folder-browser.c (on_right_click): Add a Save Ass menu item. - - * mail-ops.c (cleanup_save_messages): Save all emails to the path - given. - -2000-11-28 Dan Winship - - * mail-local.c (cleanup_register_folder): Fix the initial unread - counts after the last patch. - -2000-11-27 Dan Winship - - * mail-local.c (local_folder_changed): This needs to run from the - main thread, not the camel thread, so add a proxy signal handler - to call mail_op_forward_event. Fixes hangs (eg bugzilla #909). - -2000-11-27 Jeffrey Stedfast - - * mail-display.c: Removed some unecessary debugging printf's - -2000-11-27 Dan Winship - - * mail-config-druid.glade: Revert the new druid for now, until the - corresponding code is done, so that the druid will work again. - -2000-11-21 Iain Holmes - - * mail-config-gui.c (mail_config): Don't use the "delete-event" - signal. - -2000-11-21 Iain Holmes - - * mail-display.c (pixbuf_for_mime_type): free fm_icon. - - * component-factory (summary_fn): Remove the configure param. - (factory_destroy): Made into a generic function so that the - summary_factory can be ref-counted as well as the normal - factory. - -2000-11-21 Dan Winship - - * Makefile.am: add GPGME_CFLAGS and GPGME_LIBS - -2000-11-21 Jeffrey Stedfast - - * mail-config.c (mail_config_view_source): New function to return - if user wants to view message source. - (mail_config_set_view_source): New function to set whether the - view wants to view source. - - * mail-ops.c (mail_do_view_message_sources): Removed. We're not - gonna view-source this way anymore. - - * folder-browser-factory.c: Removed the ViewSource bonobo verb - from the Message menu. - (control_activate): Added ViewSource. - - * folder-browser.c (on_right_click): Removed Message menu item to - view message source. - (folder_browser_toggle_view_source): New callback to set whether - or not the MailDisplay shows the raw message or the pretty-ified - message. - - * mail-callbacks.c: Removed view_source. - - * mail-display.c (redisplay): If toggle_raw is set then display - the raw message else display the pretty formatted message. - (mail_display_redisplay): New function to force the redisplay of a - message. - - * mail-format.c (mail_format_raw_message): New function to - write the raw message data. - -2000-11-21 Not Zed - - * mail-vfolder.c (vfolder_uri_to_folder): IF we dont find a - source, clear the exception and ignore it silently. for e.g. if - the user reconfigured their mailboxes and one of them no longer - exists. - -2000-11-21 Radek Doulik - - * mail-display.c: #include - -2000-11-21 Not Zed - - * message-thread.[ch]: Removed. No longer serves a purpose. - - * Makefile.am (evolution_mail_SOURCES): Removed message-thread.[ch]. - - * message-list.c (build_subtree): - (node_equal): - (add_node_diff): - (build_subtree_diff): - (do_regenerate_messagelist): - (cleanup_regenerate_messagelist): Changed to use camel-folder-thread. - (message_list_set_folder): If we get set a new folder, unhook any - events before unrefing the folder too (the folder is never reset - currently, but this would cause problems). - (subtree_unread): Check for uid null, wont crash, but its a bug. - (ml_tree_value_at): If the uid is null, then fake an obviously bad - line. - (build_subtree): Yeah well, we can't like freeze/thaw here, - because this is called recursive, and freeze/thaw isn't - recursive, like pre model and post model change was. - (build_tree): Maybe we can try it here, although i dont think - it'll help much. - (build_flat): And this is also a tree. yes a tree. - (build_tree): Added changes arg. If set, then try the 'diff' - approach, unless the tree is already empty. - (message_list_set_threaded): Dont clear the tree here. - (message_list_set_search): Or here. - -2000-11-20 Not Zed - - * message-list.c (save_node_state): Save out the md5 hash of the - messageid as hex, since thats all we have for those nodes. - (build_subtree): Expand the messageid to a hex string first, then - check it. - (add_node_diff): And the same here. - - * message-thread.c (thread_messages): Changed for changes to - messageid/references items. - (id_hash, id_equal): New functions to hash on the binary message id hash. - (thread_messages): removed some more no longer used dead code. - -2000-11-20 Jeffrey Stedfast - - * message-list.c (e_mail_address_compare): New comparison function - that will replace address_compare if/when we ever go to save the - preparsed addresses in the ETable rather than parsing them each - time. Also fixed it so that we should get better sorting when - addresses don't contain name parts (I was checking for NULL but - not '\0'). - (address_compare): Use e_mail_address_compare. - -2000-11-19 Peter Williams - - * mail-ops.c (update_changed_folders): Instead of making the CORBA - call in the dispatch thread, store the new display names and have - cleanup_fetch_mail make the CORBA calls. Fixes deadlocks. - (cleanup_fech_mail): Loop through the update_infos and make the - CORBA calls. - (setup_fetch_mail): Clear some new data items. - -2000-11-17 Jeffrey Stedfast - - * mail-format.c (mail_generate_reply): Use the new quote_message - function and make it start with "On %s, %s wrote:" since people - seem to want that. - - * mail-ops.c (cleanup_forward_messages): Use the new quote_message - function. - - * mail-tools.c (mail_tool_quote_message): New convenience function - to quote a message body (since both the reply and forward code do - similar quoting) - -2000-11-17 Not Zed - - * message-list.c (message_list_destroy): Before we destroy - ourselves, unhook ourselves from the folder update events. Should - fix a common crash on exit case. - -2000-11-16 Jeffrey Stedfast - - * folder-browser-factory.c: Added the MessageViewSource bonobo - menu verb. - - * mail-ops.c (mail_do_save_messages): New async function to save - messages as individual files in a given path. - -2000-11-15 Jeffrey Stedfast - - * folder-browser-factory.c: Added a new Forward as Attachment - bonobo menu item verb. - - * mail-view.c (view_forward_msg): Updated to reflect changes to - mail_do_forward_message(). It now forwards the message without - attaching it - is this what we want? - - * mail-ops.c (mail_do_view_message_sources): New async function to - display message source dialog windows. - (setup_forward_messages): If we were asked not to forward the - message(s) as attachment(s) and the user chose more than a single - message, then default to making each message an attachment. - (cleanup_forward_messages): If we aren't forwarding the message as - an attachment, then quote the text and set the composer's body - with it. - - * mail-callbacks.c (view_source): New callback to view the message - source of all messages that are currently selected. - (forward_attach): New callback to forward a message as an - attachment (forward_msg is now for forwarding a message without it - being an attachment). - (forward_message): Convenience function for forwarding messages. - -2000-11-13 Jeffrey Stedfast - - * subscribe-dialog.c (subscribe_do_subscribe_folder): Take a - 'subscribe' argument so that this can function as a subscribe AND - unsibscribe method. - (describe_subscribe_folder): Updated. - (do_subscribe_folder): Updated. - (cleanup_subscribe_folder): Updated. - (subscribe_folder_info): Pass along a TRUE as the 'subscribe' - param. - (unsubscribe_folder_info): Pass along a FALSE as the 'subscribe' - param. - -2000-11-13 Christopher James Lahey - - * message-list.c: Removed some e_table_model calls and replaced - them with e_tree_model calls. - -2000-11-12 Dan Winship - - * mail-local.c (mail_do_register_folder): Do this the normal way - rather than calling mail_operation_wait_for_finish. There was some - reason for it originally, but it no longer applies. This makes - adding new folders from the folder selection dialog no longer - hang. - -2000-11-12 Jeffrey Stedfast - - * mail-ops.c (do_filter_ondemand): Sync the source folder. - -2000-11-11 Matt Bissiri - - * evolution-mail.oafinfo: - * mail-threads.c: (retrieve_shell_view_interface_from_control): - Update the remaining "IDL:Evolution*" to "IDL:GNOME/Evolution*" - to sync up with yesterday's IDL re-scoping. - -2000-11-10 Michael Meeks - - * Makefile.am ($(EVOLUTION_MAIL_CORBA_GENERATED)): sort include order. - -2000-11-09 Jeffrey Stedfast - - * subscribe-dialog.glade[.h]: New glade file for possibly using to - create the subscribe dialog. - -2000-11-08 Radek Doulik - - * mail-format.c (mail_generate_reply): likewise - - * mail-callbacks.c (create_msg_composer): added send_html arg to - e_msg_composer_new_with_sig_file call - -2000-11-07 Jeffrey Stedfast - - * mail-search-dialogue.c (mail_search_dialogue_construct): Allow - rule part to expand when the user resizes the dialog. - -2000-11-07 Jeffrey Stedfast - - * folder-browser.c (search_save): Don't handle custom searching - anymore... we don't want this. - (search_full): Same. - (folder_browser_search_menu_activated): Set the search entry - widget sensitive. - (folder_browser_search_query_changed): Same. - -2000-11-07 Jeffrey Stedfast - - * folder-browser.c (search_full_clicked): Updated to use the - ESearchBar object rather than the previously used search widgets. - (search_full): Same. - (search_save): Same. Also use enums to make it a little easier to - read now that we have to have enums anyway. - (folder_browser_search_menu_activated): New ESearchBar menu - callback. - (folder_browser_search_query_changed): New ESearchBar query - callback. Replaces search_set() - (folder_browser_clear_search): Updated to use the ESearchBar - object rather than the previously used search widgets. - (folder_browser_gui_init): Don't hand construct a search widget, - use the new ESearchBar convenience widget. - - * mail-ops.c (cleanup_load_folder): Updated to reflect changes to - FolderBrowser. - -2000-11-07 Jesse Pavel - - * mail-display.c (pixmap_press): modified some of the EPopupMenu - structures to account for differences in the popup menu API (as - informed by Jeff. - (on_object_requested): passed the user's default email address - to the iTip control. - -2000-11-07 Ettore Perazzoli - - * Makefile.am (INCLUDES): Add the composer dirs. - -2000-11-07 Not Zed - - * mail-display.c (on_object_requested): God, I sure wish people - would listen when i'm saying i'm changing and API. I mean - I even mailed everyone and everything. Can't see any changelog - either. - -2000-11-06 Not Zed - - * mail-autofilter.c (rule_from_message): Updates for api changes. - - * mail-tools.c (mail_tool_generate_forward_subject): Fixed for api - changes. Sigh, whoever wrote the multithread code of the mailer, - had little idea. You can't just lock for getting a const value, - until you are finished with it, cause the owner still owns it. - Fixed this too. Yuck, what a horrid forwarding format, can we - change this, or make it configurable? The mail headers show who - forwarded it, we dont need to duplicate it in that UGLY subject. - - * mail-format.c (write_field_to_stream): Removed some jeffness. - dont g_strdup stuff we dont need to, and remove the - value_is_encoded thing since we can get the unencoded address - now. - (write_address): New function to write an address field. - (write_headers): Uses write_address to write addresses, cleaner, - fixed the god-awful unreadable indenting too. - (handle_text_plain): Use a 'smarter' printf format, so we dont - need to allocate and copy substrings unecessarily (esp since - they're about to be allocated any copied another few times - anyway *sigh*). - (write_field_to_stream): Commented out the isprint check, which - afaik serves no purpose. - (list_add_addresses): New function to build a list of - display-ready addresses. Although I think the composer then uses - these as internet-ready addresses. It should probably take a list - of CamelAddress's if thats what it wants. - (mail_generate_reply): Cleaned up the address list creation stuff - a heap, and fixes for camel api changes. Also fixed a small - memory leak as a side effect (fulladdr wasn't freed if it was the - same as the sender). - - * mail-display.c (on_object_requested): Changed for interface - changes to the from address. I think passing the encoded - (internet version) of the address is right here. - -2000-11-06 Jeffrey Stedfast - - * folder-browser.c (on_right_click): Move filter stuff into a - submenu of the popup menu. - -2000-11-06 Jesse Pavel - - * mail-display.c: used Camel to parse the full address before - passing the email address to my iTip control. - -2000-11-06 Dan Winship - - First draft of folder tree unread message indication for /local - mail folders. - - * mail-local.c: Add a new CamelStore subclass, MailLocalStore, - which attaches to an Evolution_LocalStorage on one side and - CamelSession on the other, and keeps track of local folders. Some - of this code was previously in mail-local-storage.c, which no - longer exists. - (local_reconfigure_folder, etc): Various mail_op-related cleanups, - and wrap d() around a bunch of printfs. - - * mail-tools.c (mail_tool_get_local_inbox_url, - mail_tool_get_local_movemail_url): Removed - (mail_tool_get_local_inbox): Simplified. - (mail_tool_do_movemail): Remove unused dest_url variable. - (mail_tool_uri_to_folder): Simplify. Now down to two cases - (vfolder, and everything else). - - * component-factory.c (owner_set_cb): Pass evolution_dir to - mail_local_storage_startup. - - * Makefile.am (evolution_mail_SOURCES): Remove - mail-local-storage.[ch] - - * mail-summary.c: Remove mail-local-storage.h include - -2000-11-06 Kjartan Maraas - - * mail-autofilter.c: Fix up #include - * mail-crypto.c: Same here. - * mail-search-dialog.c: Here too. - * main.c: Fix indentation of #ifdef - * message-thread.c: Fix include. - -2000-11-06 Jeffrey Stedfast - - * mail-callbacks.c (delete_msg): Don't invert the flag. - (undelete_msg): Same (when multiple messages are selected). - -2000-11-06 Jeffrey Stedfast - - * folder-browser-factory.c: Updated to have the same menu items as - the new right-click menu - eventually these 2 menus should be the - same. - - * folder-browser.c (on_right_click): Now correctly handles the - case of multiple selection. - - * mail-callbacks.c (enumerate_msg): Make public so it can be used - in other source files (it's a useful function!) - -2000-11-05 Jeffrey Stedfast - - * folder-browser.c (on_right_click): Added an "Undelete" option to - the right-click menu and also set a mask so it was only selectable - if the message is marked as deleted. Also set a mask for "Mark as - Read" and "Mark as Unread". - - * mail-callbacks.c (undelete_msg): New callback to undelete - messages. - -2000-11-03 Dan Winship - - * message-list.c (cleanup_regenerate_messagelist): don't free the - MessageList search when it's being reused - -2000-11-03 Jeffrey Stedfast - - * mail-local.c (mail_local_map_uri): Don't show the passwd in the - url string. - (mail_tool_local_uri_to_folder): Same. - (do_reconfigure_folder): Same. - -2000-11-03 Jeffrey Stedfast - - * Makefile.am: Added new header files. - - * component-factory.c (owner_set_cb): - s/session_init/mail_session_init - - * session.c: Renamed public functions to mail_session_*. - FIXME: Rename session.c to mail-session.c - - * folder-browser-factory.c: #include "mail-callbacks.h", #include - "mail-session.h" and replace forget_passwords with - mail_session_forget_passwords - - * mail.h: Move session prototypes to mail-session.h, Move - mail-crypto prototypes to mail-crypto.h, Move mail-callback - prototypes to mail-callbacks.h - - * mail-session.h: New header file containing public prototypes - for session.c - - * mail-format.c: #include "mail-crypto.h" - - * mail-view.c: - * folder-browser.c: #include "mail-callbacks.h" - - * mail-crypto.h: New header file containing public prototypes - for mail-crypto.c - - * mail-callbacks.h: New header file containing public prototypes - for mail-callbacks.c - - * message-list.c (message_list_get_layout): Set useful defaults. - (message_list_setup_etable): Don't set the Outbox defaults on a - folder just because it doesn't have a corresponding saved file. - -2000-11-03 Dan Winship - - * mail-config-gui.c (service_page_item_new): url_flags are now on - CamelProvider, not CamelService - - * main.c: - * subscribe-dialog.c: - * mail-threads.c: Kill warnings - -2000-11-03 Federico Mena Quintero - - * Makefile.am: Clean the idl-generated files properly. - -2000-11-03 Not Zed - - * mail-view.c: Added mail-display.h. - - * mail-autofilter.c: Removed unecessary headers. Who ran indent - over this code? Sigh. - - * mail-ops.c (display_message_input_s): Added messagedisplay. - (mail_do_display_message): Added messagedisplay arg. - (mail_do_display_message): Dont bother doing another thread when - we know we dont have a uid. - (): Added folder-browser.h to headers. Sigh. - - * folder-browser-factory.c (control_activate): Setup the - viewthreaded callback to the folder_browser function. - - * folder-browser.c (my_folder_browser_init): Connect to - right_click of etable of the messagelist here. - (on_right_click): Changed for argument changes. - (folder_browser_toggle_threads): Changed to take a fb, and to set - threaded mode on the messagelist. - (my_folder_browser_init): Connect also to the double_click signal. - (my_folder_browser_init): Connect to the message_selected signal - of the message_list. - (on_message_selected): Signal handler for message selected. - (my_folder_browser_init): Fix for change to message_list_new(). - - * message-list.h: Dont include folder-browser.h. - (message_list_toggle_threads): Moved into folder-browser.h. - (struct _MessageList): Removed folderbrowser. - - * mail.h: Dont include folder-browser.h here either, but - mail-types.h instead. - Moved prototypes moved into folder-browser.c into - folder-browser.h. (vfolder_*, filter_*). - - * mail-display.h: Dont include folder-browser.h here, but - mail-types.h and specific camel headers. - - * message-thread.c (sort_node): Invert the sort order logic so the - list is sorted in mailbox order, not reverse mailbox order. - - * message-list.c (free_tree_ids): Fix a merge foo. - (remove_node_diff): Removed unused row argument. Fixed - callers/prototype. - (clear_tree): pre_change on the removal of the root node. - (build_flat): Only perform pre_change if we are rebuilding the - whole lot. For incremental change let etable do its thing. - (build_tree): Likewise for building the tree view. If making - incremental updates, do them as we build it. - (vfolder_subject): - (vfolder_sender): - (vfolder_recipient): - (filter_subject): - (filter_sender): - (filter_recipient): - (filter_mlist): - (on_right_click): Moved to folder-browser.c, where they belong. - (message_list_init): Dont connect to right_click anymore. - (message_list_toggle_threads): Moved to folder-browser.c, renamed. - (on_double_click): Moved to folder-browser.c - (on_click): Set the flags directly, rather than in anothre thread, - which is just not necessary. - (message_list_class_init): Added a new signal 'message_selected', - to indicate when a message was selected. - (on_cursor_change_idle): Emit a signal, rather than directly - triggering the display update. - (select_row): Removed, no longer used. - (idle_select_row): And this too. - (select_msg): Removed as well. - (message_list_select): Emit a signal, rather - thandisplaying/clearing the mail-display directly. - (mark_msg_seen): Moved to folder-browser.c - (message_list_new): Removed folderbrowser argument. - -2000-11-02 Jeffrey Stedfast - - * message-list.c (on_right_click): Sync with message - menu. Addresses bugzilla bug #778. - -2000-11-02 Christopher James Lahey - - * message-list.c: Turn on draw grid for the main ETable (this may - not be working in ETable itself.) - -2000-11-01 Jeffrey Stedfast - - * mail-threads.c (mail_op_set_message): fmt argument should be - const. - -2000-11-01 Dan Winship - - Make "Get Mail" even more functional on IMAP (scans all folders), - and do a first cut at folder tree highlighting (for IMAP/news - only). - - * mail-ops.c (do_fetch_mail): For imap (sigh, we *still* shouldn't - be hardcoding that), rescan the store's folder tree, rescan each - changed folder for new messages, and update the shell folder tree. - (do_scan_subfolders): Update for component-factory.c changes, and - set folder display names and highlights appropriately when - building the storage. - - * component-factory.c (add_storage): Make this static (was - mail_add_new_storage). Use camel_service_get_name for the name - rather than url->host. (Among other things, this lets you use a - single machine as both an IMAP server and a news server.) - (mail_lookup_storage): Hash storages based on their CamelStore - rather than the URL. - (factory_destroy): Disconnect each of the CamelStores in the - storages_hash. - - * subscribe-dialog.c (cleanup_subscribe_folder): - * mail-vfolder.c (vfolder_refresh): Pass "highlighted" flag to - evolution_storage_new_folder - -2000-11-01 Jeffrey Stedfast - - * mail-ops.c (mail_op_report_status): Don't call the default - logging function. - (do_fetch_mail): Set the logfile and don't pass the logfile to - filter_driver_set_status_func - it's purpose has been altered. - (do_filter_ondemand): Same. - -2000-11-02 Not Zed - - ** Merged in camel-incremental-branch. - - * mail-format.c (mail_get_message_body): Jeff! Sigh. - We should definetly not be strduping the - content, it has already been copied and duplicated. Look at - get_data_wrapper_text. - -2000-11-01 Chris Toshok - - * subscribe-dialog.h: add fields search_entry and search_top. - - * subscribe-dialog.c: add mail-ops.c style async operations for - getting the store (to remove deadlock in the case where a auth - dialog is dismissed at startup and then the subscribe dialog is - brought up), and subscribing/unsubscribing to folders. One case - remains, that is getting the list of all folders. - (subscribe_search): flesh out this function - (build_tree): use the search_top field so we can search for - groups/folders. - (subscribe_dialog_destroy): free search_top. - (subscribe_dialog_construct): init search_top. - -2000-10-30 Iain Holmes - - * mail-summary.c (generate_folder_summaries): Fix spelling :) - Set folder->uri to NULL for the Inbox. - -2000-10-26 Iain Holmes - - * mail-summary.c (generate_html_summary): Add view:// uris to - switch the display to that folder. - -2000-11-01 Jeffrey Stedfast - - * folder-browser-factory.c: Hmmm, someone can't spell Filder, - er...I mean Filter ;-) - -2000-11-01 Jeffrey Stedfast - - * mail-autofilter.c (rule_from_message): If the name is NULL or - empty, then set the title to "Mail from

". Closes - bugzilla bug #777. Also when filtering on Subject, set the file - name to "Subject is " rather than just "" - I - think this is a bit more user-friendly. - (strip_re): Use unsigned char when passing to is() - functions from ctype.h. - (rule_add_subject): Use the "is" rule instead of "contains". - -2000-11-01 Jesse Pavel - - * mail-display.c: added property bag support for Bonobo - controls, support which helps only the iTip control, currently. - -2000-11-01 Dan Winship - - * mail-display.c (pixbuf_gen_idle): Lots of fixes and - simplifications. Should get rid of the "missing icon" problem. - There is still a problem with some images failing to get - thumbnails, even though they display correctly. - (pixbuf_for_mime_type): New function to try really hard to get the - right icon for a MIME type, including looking in mc and nautilus's - pixmap directories. - (on_object_requested): Always use pixbuf_gen_idle, even for - non-image types, to prevent code duplication. - -2000-10-31 Jeffrey Stedfast - - * mail-format.c (mail_get_message_body): Shouldn't we be - strdup'ing the content? This seems to fix the memory corruption - problems. - (mail_generate_reply): Make sure that the last char in the - generated reply text is '\0' (when body text doesn't end with a - \n, a random char will appear otherwise). - -2000-10-31 Dan Winship - - * mail-config-gui.c (do_test_service): Update for - camel_service_disconnect change. - -2000-10-31 Jeffrey Stedfast - - * mail-autofilter.c (filter_gui_add_for_mailing_list): Match "is" - rather than "contains" now that we have the "is"-rule. - -2000-10-30 Dan Winship - - * mail-config-gui.c (config_do_query_authtypes): Redo this so that - it works for all pages, not just the first page. (Now that this is - finally working again, I expect Anna to finish her redesign in the - next 15 minutes.) - (service_page_item_new): Fix up the sizing of the Auth line to - look more like everything else. - -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" - command.) - - * mail-ops.c (do_fetch_mail): Sync the folder before refreshing so - we don't lose flag settings. - -2000-10-27 Jeffrey Stedfast - - * mail-callbacks.c (composer_send_cb): Check to make sure that the - recipient list is neither NULL nor a 0-length list of addresses - and pop up a dialog letting the user know why we are not allowing - him/her to send the message. - -2000-10-26 Dan Winship - - * mail-display.c (write_data_to_file): Don't destroy a dialog - after run_and_close'ing it. - -2000-10-26 Jeffrey Stedfast - - * mail-callbacks.c (composer_send_cb): Check for the TO recipient - list being NULL and don't send. - -2000-10-25 Jeffrey Stedfast - - * mail-ops.c (do_send_mail): Don't forget to unref the - FilterDriver. - - * mail-callbacks.c (apply_filters): New callback for applying - on-demand filters. (removed the old on-demand filters callback). - - * mail-ops.c (do_filter_ondemand): Rewrote to apply "incoming" - filters to all selected messages. - (mail_do_filter_ondemand): No longer takes a FilterContext - argument or a destination folder argument (why did we ever need - this last one??) but now takes a uids argument. - - * folder-browser-factory.c: Add a MessageApplyFilters menu item. - -2000-10-25 Iain Holmes - - * mail-summary.[ch]: Updated for the new ExecutiveSummary code. - - * Makefile.am: Added the summary files and the evolution-services CFLAGS - and LIB stuff. - - * component-factory.c: Re-enabled the summary stuff. - -2000-10-25 Dan Winship - - * main.c (main): Pass send/postpone signal handler functions to - evolution_composer_factory_init. - -2000-10-25 Jeffrey Stedfast - - * subscribe-dialog.c (subscribe_select_all): Implemented. - (subscribe_invert_selection): (was unselect_all) Implemented. - -2000-10-25 Dan Winship - - * message-list.c: Add a "flagged" column, based on the Camel - "flagged" flag, for assigning an arbitrary "hey, I care about - this" flag to a message. - (ml_tree_set_value_at): Remove - (ml_tree_is_cell_editable): No, it's not. - (on_click): Handle the read/unread and flagged fields via the - click handler. Among other things, this makes it not select - a message when you change its read status. - -2000-10-24 Dan Winship - - * subscribe-dialog.c (folder_info_subscribed, - subscribe_folder_info, unsubscribe_folder_info): Don't prepend "/" - to the folder's full_name. Deal with hierarchy in the - EvolutionStorage tree better. - (storage_tree_path): Helper function to build a storage path from - a CamelFolderInfo. - -2000-10-23 Dan Winship - - * *: Add some missing _()s and N_()s. - -2000-10-23 Dan Winship - - * Makefile.am (INCLUDES): Update EVOLUTION_LOCALEDIR. - -2000-10-23 Jeffrey Stedfast - - * mail-ops.c (do_send_mail): Apply outgoing filters to the - message. - -2000-10-23 Christopher James Lahey - - * message-list.c: Fixed a possible error in row numberings. This - needs to be changed quite a bit anyway, but this should make - things slightly nicer in some cases. - -2000-10-23 Christopher James Lahey - - * folder-browser.c: Made the top of the folder browser a little - prettier. - - * mail-display.c, mail-vfolder.c: Made more dialogs resizable. - -2000-10-23 Jeffrey Stedfast - - * mail-autofilter.c (filter_gui_add_from_message): Don't forget to - set the rule source! (eg "incoming", "demand", or "outgoing") - -2000-10-22 Ettore Perazzoli - - * message-list.c (message_list_init): Always display the vertical - scrollbar. - - * mail-display.c (mail_display_new): Always display the vertical - scrollbar. - -2000-10-20 Jeffrey Stedfast - - * mail-config.h: #include - -2000-10-20 Michael Meeks - - * mail.h: s/BonoboUIHandler/BonoboUIComponent/ - - * mail-callbacks.c (run_filter_ondemand): ditto. - - * session.c (forget_passwords): ditto. - -2000-10-20 Dan Winship - - * evolution-mail.oafinfo: Declare composer factory. - - * main.c (main): Initialize it - -2000-10-19 Chris Toshok - - * message-list.c (nuke_uids): e-tree-model is now opaque. use the - accessor to get the root node. - -2000-10-19 Jeffrey Stedfast - - * mail-callbacks.c: #include "mail-vfolder.h" - (vfolder_edit_vfolders): Don't call the dummy vfolder_edit - function. - - * folder-browser-factory.c: s/VFolderEdit/SetVFolder - -2000-10-19 Dan Winship - - * mail-ops.c: (do_fetch_mail): For an imap store, just refresh the - INBOX. - - * folder-browser-factory.c (control_deactivate): Don't sync - non-existent folders. - * message-list.c (nuke_uids): Don't traverse non-existent trees. - -2000-10-19 Ettore Perazzoli - - * Makefile.am (glade_messages): New. - (EXTRA_DIST): Add `$(glade_messages)'. - -2000-10-19 Dan Winship - - * mail-ops.c: Clean up some old #if 0 code. - -2000-10-19 Jeffrey Stedfast - - * mail-format.c (mail_generate_reply): Get the MailConfigIdentity - *before* we create a new composer object so that we can set the - signature file. - -2000-10-18 Michael Meeks - - * folder-browser-factory.c (register_ondemand): kill. - (create_ondemand_hooks): die. - (control_activate): remove hook. - - * test-mail.c (create_container): kill old UI handler. - -2000-10-18 Christopher James Lahey - - * message-list.c: Fixed some column widths. - -2000-11-02 Not Zed - - * message-list.c (get_message_info): Call get_message_uid to get - the uid, save some duplicated code. - (folder_changed): Handle the case of a NULL changes input. - - * message-thread.c (thread_messages): Removed pointless - variable/assignment 'container'. - (thread_messages): Try and cope with duplicate message id's. - -2000-11-01 Not Zed - - * mail-callbacks.c (main_select_first_unread): Changed to use 0 as - the first row to select a message. - - * mail-ops.h (mail_do_regenerate_messagelist): Removed from - header. This function is no longer public since it is really an - internal message-list function. - - * folder-browser.c (search_full_clicked): Call the set_search() - function, rather than messagelist_rebuild, which is going private. - (search_set): Same here. - (folder_browser_clear_search): And here. - (etable_key): Call message_list_select() instead of - message_list_home and message_list_end. Removing some odd code - duplication. - - * message-thread.c (do_thread_messages): Moved the mail lock to - here, rather than locking for each message lookup (which is - useless anyway). This is still not correct either, as the tree - references folder data ... but a bit better than it was. - (thread_messages): Removed the mail tool lock stuff, lock in - higher functions. - - * message-list.h: Added a threaded indicator to the message list - itself. - (threaded_view): removed a mystery variable. - - * message-list.c (do_regenerate_messagelist): Made the code a - little more readable. - (build_tree): Fixed argument to be a thread_messages struct, not a - container. - (cleanup_regenerate_messagelist): Free changeinfo. - (mail_do_regenerate_messagelist): If we are adding changes to a - flat view, we dont need to goto the other thread at all, so - process immediately. - (message_list_toggle_threads): Clear the tree if we're changing - the view mode. - (message_list_toggle_threads): And reset the rowmap, since it is no - longer valid. - (build_tree): If we are building into an already empty tree, just - build into that (probably irrelevant optimisation). - (build_subtree): Build hte subtree in the same order as we got it, - not inverted order. - (message_list_set_threaded): New function to select the threaded - view/flat view. - (mail_do_regenerate_messagelist): Removed references to - mail_config, get it from the ml->threaded var instead. - (message_list_destroy): No longer free the key data for the - uid_rowmap. - (new_id_from_uid): Convert a uid string into an id string. - (new_id_from_subject): Likewise for subject strings. - 'id' strings replace the 'uid:' and 'subject:' stuff with - accessors and macros and use less memory and is more readable. - (id_is_uid): macro to check if an id string is a uid. - (id_uid): Returns the uid part of a uid id string. - (id_subject): Returns the uid part of a subject id string. - (build_subtree): Use the new id functions, and dont duplicate the - uid in the uid rowmap, but just reference it from the tree node. - (node_equal): Use new id functions. - (add_node_diff): And here too. - (remove_node_diff): And here. Also remove the uid from the - rowmap, and dont free it anymore. - (get_message_info): And here. - (get_message_uid): And here. - (subtree_unread): And here. - (ml_tree_value_at): " - (ml_tree_set_value_at): Noted a memory leak. do_flag_messages() - doesn't free the contents of the uid array, just the uid array - (well that i can tell, teh code has more problems anyway). - (ml_tree_set_value_at): And fix the id accessors. - (save_node_state): " - (build_flat): Use id macros/functions. Dont alloc memory for hash - key. - (build_flat_diff): Use id macros. - (build_flat_diff): Remove the hash table entry before freeing its - key data (in the node). - (free_key): Removed. Keys are no longer alloc'd. - (clear_tree): When we clear the tree, also clear the uid_rowmap, - as it is no longer valid (or contains allocated keys!). - (free_tree_ids): Renamed from nuke_uids. - (free_ids_cb): Renamed from nuke_uids_cb. - (free_tree_ids): Changed arg to be a ETreeModel directly. - (ml_tree_value_at): Map id to subject using the right macro. - (free_tree_ids): Check we have any nodes to traverse first. - (build_flat): Insert to row -1 to append the nodes (faster). - (remove_node_diff): Only remove the uid rowmap entry if it is - referencing this node (i.e. the key string is the same key string, - not just a matching key string). - (add_node_diff): Remove the uid rowmap entry before inserting a - new one to force the key to be replaced. This is required as the - tree may temporarily contain duplicate messages during the - rebuilding phase. - (message_list_set_search): New function, set the search string. - Only redo the search if it has changed, etc. - (mail_do_regenerate_messagelist): Made static. There is no need - for external code to call this. - (message_list_set_folder): NOP if the new folder is the same. - (message_list_set_folder): Clear the tree before rebuilding it. - (message_list_select): Ok, this wins the award for 'most bizarre - interface'. Changed the start row to mean the end of the list if - we supply -1, rather than the start of the list. Also fixed the - endpoints (it would never select message 0 if searching - backwards). - (idle_select_row): Changed start row to 0 from -1. - (message_list_end): Removed. - (message_list_home): Removed. - (go_to_message): Removed. message_list_select can do this. - (message_list_select): Check that direction is one of the valid - ones, otherwise we could be thrown for loops. - -2000-10-31 Not Zed - - * message-list.c (node_equal): Compares an etree node with a - message-thread node to see if they point to the same object. - (add_node_diff): Adds a new thread node to the etree. - (remove_node_diff): Removed an etree node, freeing any additional - data. - (build_subtree_diff): Takes an existing etree definition, and a - new thread definition and makes the etree match, using as few - operations as possible. - (do_regenerate_messagelist): No longer free/clear the uid/rowmap - here. - (regenerate_messagelist_input_t): Added a tree field - are we - building a tree view? - (regnerate_messagelist_data_t): Added a tree field, if we built a - tree result. Added a changes parameter, for building diff's after - search/etc. - (mail_do_regenerate_messagelist): Setup the tree indicator. - (build_flat_diff): Apply a changeset to a message list. - (build_flat): Added a changes argument, if present, use - build_flat_diff() to build the list. - (do_regenerate_messagelist): If we are generating a threaded view, - build the threaded list here, rather in another separate - invocation. - (cleanup_regenerate_messagelist): Call build_tree directly on the - threaded list. - (message_list_init): Init the uid_rowmap hash table here instead - of somewhere odd. - (message_list_destroy): Assume uid_rowmap exists. - (do_regenerate_messagelist): Remove the code here that is messing - with the message list data (search/uid_rowmap). We're in a - different thread boys ... - -2000-10-26 Not Zed - - * message-list.c (cleanup_regenerate_messagelist): Fixed some - logic to make more sense (gboolean)!pointer replaced with - (pointer != NULL). - (build_tree): Put the tree pre/post change stuff in here, where it - should be. - (build_flat): Same here. - (cleanup_regenerate_messagelist): Remove model_changed stuff here. - (setup_regenerate_messagelist): Remove pre_change stuff here. - -2000-10-20 Not Zed - - * message-list.c (main_folder_changed): Perform incremental update - of the display for flat view. - (ml_tree_value_at): Spit out a mroe meaningful warning when we - can't find the uid in our tree, in the folder. - - * message-thread.c (thread_messages): Made public. - (thread_messages_free): Made public. - (thread_messages): Now we also return a struct _thread_messages, - which is passed to other functions. - (container_free): Renamed from thread_messages_free. - (thread_messages_free): Take a thread_messages argument. - (thread_messages_add): New function to add a list of uid's to the - thread list. - (thread_messages_remove): Likewise, for removing them. - (cleanup_thread_messages): Change for struct changes. - (do_thread_messages): Likewise. - -2000-10-19 Not Zed - - * mail-tools.c (mail_tool_do_movemail): removed unused var - - * folder-browser.c (search_full_clicked): Fix for api changes, - such as it can be called an api, its mroe an utter mess infact. - (search_set): Same. - (search_set): And here. - (folder_browser_clear_search): And here. - - * message-list.c (folder_changed): Copy and forward the changeinfo - list to the mian thread. - (main_folder_changed): Free the changeinfo. Todo: something smart - with this information. - (struct regenerate_messagelist_input_s): Added a changes field. - (mail_do_regenerate_messagelist): Added a change list argument. - (message_list_set_folder): Fix for mail_do_regenreate_messagelist - api. - (message_list_toggle_threads): Same. - -2000-10-18 Iain Holmes - - * mail-config-gui.c (mail_config): Make all the CLists have passive - titles. - (identity_dialog): Make the default button the "OK" button, and set - the dialog to close on pressing return on the entryboxes. - -2000-10-17 Iain Holmes - - * mail-config-gui.c (service_page_item_new): Disable the optionmenu - because it is empty. - (service_page_item_auth_fill): Enable the optionmenu as there's stuff - in it now. - - * mail-callbacks.c (reply_to_sender): Call check_send_configuration - when we have the FolderBrowser because if it is done in mail_reply - (with passing NULL) it will only be able to continue if the mailer - has already been configured. - (reply_to_all): Same. - -2000-10-18 Not Zed - - * folder-browser.c (folder_browser_gui_init): No, we REALLY dont - want to perform an immediate search as the keys are pressed. - - * mail-display.c (on_object_requested): Kill a minor warning with - a cast. - - * mail-config.c: Include mising ctype.h to kill a warning. - - * message-thread.c (main): Fixed the test case for api changes. - - * message-list.c (message_list_drag_data_get): Set some flags to - get_folder(). I dont even think this will work because - mail_tool_get_folder doesn't handle file url's. - - * mail-vfolder.c (vfolder_uri_to_folder): Pass appropriate flags. - - * mail-ops.c (do_setup_folder): Pass appropriate flags. Hmm, - whats the difference between setup and create. *shrug* - (do_create_folder): Pass appropriate flags to get_folder. Needs a - way to specify the index flag. - - * mail-tools.c (mail_tool_get_folder_from_urlname): Changed create - to flags argument. - (mail_tool_get_local_inbox_url): Add an index argument. - (mail_tool_get_local_inbox): honour index flag. - (mail_tool_get_inbox): Changed for api change. - (mail_tool_uri_to_folder): Fixed calls to store_get_folder(); - - * mail-local.c (load_metainfo): Added an indexed field to the metainfo. - (save_metainfo): And save it too. - (do_reconfigure_folder): Honour index flag when creating the new - folder. Do not open the old folder with an index at all. - (mail_local_map_uri): Add an index argument - tells if the mbox is - indexed. - (mail_tool_local_uri_to_folder): Create & pass flags properly. - (#include gnome.h): Dont include all of gnome, just what we use, - and explicity include xml-memory, so we get xmlFree(). - -2000-10-16 Jeffrey Stedfast - - * folder-browser.c (search_full_clicked): Un #if 0'd out - (search_full): Same. - (folder_browser_gui_init): Connect search_full and search_activate. - (search_set): Uncomment search_full() - - * Makefile.am: Re-add `mail-search-dialogue.h' and - `mail-search-dialogue.c'. - -2000-10-16 Jeffrey Stedfast - - * mail-format.c (mail_generate_reply): Decode recipient names so - that they display nicely in the To and Cc fields. - (write_field_to_stream): Now takes another argument - 'value_is_encoded' so that we know if we should decode that string - before proceding onward. Since the message subject is already - decoded before it's passed in, we don't want to decode it again - (wasted cpu time and/or any 8bit chars will be assumed to be - latin1 encoded and thus the decoded value will be corrupt). - -2000-10-16 Chris Toshok - - * mail-config-gui.c (service_page_get_url): only set the url->user - field if the user string is non-NULL and not empty. - -2000-10-16 Not Zed - - * message-list.c (message_list_setup_etable): Uh, fixed jeff's - wrong fix for setting the speficiation (the function changed to - set_state(), as can be seen in the e_table-scrolled_load_state() - call only 2 lines above). - -2000-10-13 Not Zed - - * message-list.c (message_list_setup_etable): oops, chose the - wrong thing to cut out after a merge conflict. - -2000-10-15 Chris Toshok - - * message-list.c (subtree_unread): ETreePath != GNode now, use - accessors. - (ml_tree_value_at): same. - (save_node_state): same. - (save_tree_state): same. - (nuke_uids_cb): convert to e_tree_model_node_traverse required - type. - (nuke_uids): g_node_traverse -> e_tree_model_node_traverse. - -2000-10-14 Ettore Perazzoli - - * evolution-mail.oafinfo: Add "evolution:shell-component-icon" - attribute. - -2000-10-13 Jeffrey Stedfast - - * message-list.c (message_list_setup_etable): Don't free the - service name. - -2000-10-12 Jeffrey Stedfast - - * mail-ops.c (do_fetch_mail): sync & expunge the source folder - after filtering. - -2000-10-12 Jeffrey Stedfast - - * message-list.c (message_list_setup_etable): Create the 'spec' - and 'extras' arguments and call e_table_scrolled_new() rather than - set_specification as that function no longer (?) exists. - - Also started to add drag & drop functionality to something like - Nautilus (but #if 0'd it out until I had time to finish it and - till after 0.6). - -2000-10-12 Not Zed - - * message-list.c (message_list_setup_etable): Duh, fix the test - for the folder name, strstr != strcmp is it. - -2000-10-10 Not Zed - - * message-list.c (folder_to_cachename): Removed, changed callers - to use mail_config_folder_to_cachename instead. - - * mail-config.c (mail_config_folder_to_cachename): New utility - function to get a cache name for a folder. - - * mail-tools.c (mail_tool_do_movemail): Changed to return the path - to the mbox, rather than opening a folder of it. - - * mail-ops.c (mail_incorporate_messages): Dont bother making the - pseudo messageinfo, filder_driver_filter_message will do it for - us. - (report_status): Callback to report status of filtering operation. - (do_fetch_mail): Changed significantly - for the api changes to - the filtering system. Also now incorporates a mailbox file - directly, without having to import it into a camel folder first. - (mail_incorporate_messages): Removed entirely, no longer needed. - - * mail-vfolder.c (vfolder_refresh): Fix for context api changes. - (vfolder_uri_to_folder): Likewise. - - * folder-browser-factory.c (create_ondemand_hooks): Changed for - api changes. Also only adds demand filters to the menu (fixed a - small logic bug). - -2000-10-11 Chris Toshok - - * subscribe-dialog.c (folder_etree_value_at): special case for - folders with NULL urls (which aren't selected/subscribeable). - (unsubscribe_folder_info): can't (un)subscribe from folders with - non-NULL urls. - (subscribe_folder_info): same. - -2000-10-12 Christopher James Lahey - - * message-list.c: Replace To with From except in Drafts, Outbox, - or Sent boxes. Make Subject column pay attention to text - attributes like bold and strikethrough. - -2000-10-12 Iain Holmes - - * component-factory.c: Disable the executive summary. - -2000-10-11 Chris Toshok - - * subscribe-dialog.c (FOLDER_ETABLE_SPEC): set expansion to 0.0, - minimum-width to 16, and resizable to false for the subscribed - column. - (folder_info_subscribed): new function so we can do the correct - path munging. - (subscribe_folder_info): only add the folder to the storage if - there wasn't an exception subscribing it. - (unsubscribe_folder_info): same, but unsubscribing. - (folder_etree_value_at): use folder_info_subscribed. - (folder_toggle_cb): same. - (unsubscribe_folder_foreach): same. - (subscribe_folder_foreach): same. - (subscribe_dialog_gui_init): set the bold column on the text cell, - and add the subscribed pixbuf. - -2000-10-11 Anna Marie Dirks - * mail-threads.c: Changed the password-getting dialog so that the - text entry has focus. - -2000-10-11 Chris Toshok - - * subscribe-dialog.c (STORE_ETABLE_SPEC): change cell type to - "string" since we're not including it in the extras. - -2000-10-11 Christopher James Lahey - - * message-list.c, message-list.h, subscribe-dialog.c: Changed - these to use the proper form for the column element. - -2000-10-11 Christopher James Lahey - - * message-list.c, message-list.h, subscribe-dialog.c: Updated - these to the new ETable style of specifications. - -2000-10-11 Chris Toshok - - * subscribe-dialog.c (subscribe_dialog_gui_init): convert to the - new gal e-table stuff. - (html_size_req): - (html_new): - (put_html): #if 0 out the html functions since description stuff - isn't used and we don't want the warnings. - -2000-10-11 Chris Toshok - - * subscribe-dialog.c (subscribe_dialog_gui_init): remove the html - description stuff for now. - -2000-10-10 Chris Toshok - - * subscribe-dialog.c (folder_toggle_cb): umm.. duh :) only - subscribe if it's not subscribed, and vice versa. - (subscribe_folder_foreach): make sure to call - e_tree_model_node_changed. - (unsubscribe_folder_foreach): make sure to call - e_tree_model_node_changed. - -2000-10-10 Chris Toshok - - * mail-ops.c (setup_scan_subfolders): add a ref to input->storage - here so that the ref/unref pattern more closely matches other - mail-ops. also, this keeps the storage from being freed when we - hit the unref in cleanup_scan_subfolders, which is important - because we maintain a reference to it in the storage_hash in - component-factory.c - - * subscribe-dialog.h: add storage field. - - * subscribe-dialog.c (subscribe_folder_info): new function, - subscribe to a folder given it's CamelFolderInfo, and add it to - the shell - we're generating a path from the name of the folder - which is bad. - (unsubscribe_folder_info): same (except we unsubscribe and remove - from the shell). - (storage_selected_cb): unref the currently selected storage. - (subscribe_dialog_destroy): unref the currently selected storage. - (subscribe_dialog_construct): sc->storage = NULL. - - * component-factory.c (mail_lookup_storage): new function, to look - up a EvolutionStorage corresponding to a CamelService. we ref the - EvolutionStorage before passing it back. - (mail_add_new_storage): insert the storage into storages_hash if - result is EVOLUTION_STORAGE_OK. - - * mail.h: add prototype for mail_lookup_storage. - -2000-10-10 Larry Ewing - - * mail-format.c (mail_generate_reply): make sure we dup the return - value of get_reply_to or get_from when building the recipient list. - -2000-10-10 Iain Holmes - - * mail-summary.c (generate_html_summary): Removed the
  • from the - HTML. - -2000-10-10 Cody Russell - - * mail-threads.c: Added #include - -2000-10-09 Iain Holmes - - * mail-summary.c: Removed the extra arguments to rule_context_load. - -2000-10-09 Chris Toshok - - * subscribe-dialog.c, subscribe-dialog.h: use our own etable to - display the stores, and get them from the mail-config api. put - #if 0'ed code in place to add/remove the folders from the shell - when they're subscribed/unsusbcribed. also, react to double - clicks in the folder etable by toggling subscription status. - -2000-10-08 Iain Holmes - - * mail-summary.c (create_summary_view): Updated to use new icon code. - -2000-10-08 Iain Holmes - - * mail-summary.c (generate_html_summary): Generic function to - recreate the HTML of the summary. Checks all the folder summaries. - (generate_folder_summarys): Create a summary of all the vfolders - and the Inbox. - (create_summary_view): Generate the folder summarys before the - HTML. - -2000-10-09 Ettore Perazzoli - - * folder-browser.c: Don't #include "mail-search-dialogue.h" as - it's missing from the repository. - (search_full_clicked): Temporarily `#if 0'ed out. - (search_full): Likewise. - (folder_browser_gui_init): Don't connect `search_full'. - (create_option_menu): Don't connect `search_menu_deactivate'. - (folder_browser_gui_init): Don't connect `search_activate'. - (search_set): Don't do `search_full()'. - (folder_browser_gui_init): Likewise. - - * Makefile.am (evolution_mail_SOURCES): Remove - `mail-search-dialogue.h' and `mail-search-dialogue.c' as NotZed - forgot to put them into CVS. - -2000-10-06 Not Zed - - * mail-search-dialogue.c: New widget, full search dialogue for - mail. - - * folder-browser.c (search_set): If we click on custom search, run - the full search dialogue. - (folder_browser_gui_init): Add a button to perform a full search. - (search_full): Bring up the mail search dialogue asynchronously. - (search_full_clicked): Handle search options. - (folder_browser_destroy): Free the saved rule if there is one - there. - (search_options[]): Added a custom option option - brings up the - full search dialogue. - (search_set): Disable the search entry if we are doing a full - search. - - * mail-vfolder.c (vfolder_create_storage): Yay, finally - depeterised this stuff. - (vfolder_uri_to_folder): Removed an irrelevant comment. - - * mail-callbacks.c (filter_edit): And here. - - * mail-ops.c (do_fetch_mail): And here too. - - * mail-autofilter.c (filter_gui_add_from_message): Fixed call to - context_load. - (filter_gui_add_for_mailing_list): And here too. - - * folder-browser-factory.c (create_ondemand_hooks): Remove that - ondemand callback snot. - -2000-10-05 Not Zed - - * message-list.c (message_list_init_etable): Build the etable once - we know what folder we are going to use. - (save_header_state): Save the header spec to a cache file. - (message_list_destroy): Save the header spec. - (message_list_setup_etable): Setup the etable spec for this - folder, from a saved version if one exists, or to suit the folder - type (sent/received). - (message_list_set_folder): Setup the etable here once we have a folder. - -2000-10-09 Michael Meeks - - * message-list.c (message_list_toggle_threads): re-write. - - * folder-browser-factory.c (control_activate): update paths, need - CVS HEAD bonobo, use a listener not a verb. - -2000-10-08 Miguel de Icaza - - * mail-ops.c (mail_incorporate_messages): Tag string for translation - (do_flag_messages): ditto. - - * mail-threads.c (pipe_write): Repeates writes on EINTRS. - (pipe_read): Repeats reads on EINTRS. - (mail_operation_queue): Use pipe_write - (mail_op_set_percentage): ditto. - (mail_op_hide_progressbar): ditto. - (mail_op_show_progressbar): ditto. - (mail_op_set_message): ditto. - (mail_op_get_password): ditto. - (mail_op_error): ditto. - (mail_op_forward_event): ditto. - (mail_operations_terminate): ditto. - (dispatch): use pipe_read. - (dispatch): use pipe_write - (dispatch): ditto. - - * mail-ops.c (mail_incorporate_messages): Only show message being - incorporated every 2 seconds, to avoid a bunch of CORBA round trips. - (do_transfer_messages): ditto. - (do_forward_messages): ditto. - -2000-10-07 Miguel de Icaza - - * mail-ops.c (do_fetch_mail): Move the functionality to - incorporate messages into mail_incorporate_messages. - (mail_load_evolution_rule_context): New function. Move the - functionality for loading the context rules to its own function. - -2000-10-06 Iain Holmes - - * mail-summary.c: Fix the locking up of the mail by only calling - camel functions from the camel thread, and ORBit functions from - the GTK thread. Watch for the message-changed signal again. - - * component-factory.c (summary_fn, component_factory_init): - Re-enabled it, cos I think it works again. - - * mail-display.h: Remove the pb_cache. - - * Makefile.am: Readd the mail-summary.[ch] files and add the - evolution-services library to the link. - -2000-10-06 Chris Toshok - - * mail-ops.c (do_scan_subfolders): set the @subscribed_only - parameter to TRUE, since the subscribe UI is the only interface - that should show unsubscribed groups. - -2000-10-06 Ettore Perazzoli - - * mail-ops.c (do_scan_subfolders): Add missing @subscribed_only - parameter in the call to `camel_store_get_folder_info()'. [FALSE, - I hope that's right.] - -2000-10-05 Jeffrey Stedfast - - * mail-format.c (write_field_to_stream): Decode the header before - writing it to the header box. - - * mail-callbacks.c (send_receieve_mail): fetch mail before - sending, this is a temp fix for POP-before-SMTP authentication. - -2000-10-05 Michael Meeks - - * component-factory.c (summary_fn, component_factory_init): - Disable summary stuff, it appears to be badly broken. - - * Makefile.am (evolution_mail_SOURCES): add mail-summary.[ch] - - * subscribe-dialog.c (update_pixmaps): upd. - (set_pixmap): upd. - (subscribe_dialog_gui_init): upd. - remove redundant and annoying forward definitions. - - * folder-browser-factory.c (control_deactivate): upd. - (control_activate_cb): upd. - (control_activate): upd. - (set_pixmap): upd. - (update_pixmaps): upd. - (register_ondemand): upd. - (create_ondemand_hooks): upd. - -2000-10-04 Jeffrey Stedfast - - * message-list.c (address_compare): Use CamelInternetAddress - instead of my quick hack (aka InternetAddress). - -2000-10-05 Iain Holmes - - * mail-summary.c: Don't watch for the message-changed signal. - -2000-10-05 Iain Holmes - - * component-factory.c (component_factory_init): Setup the summary - factory as well. - (summary_fn): New function to create the ExecutiveSummaryComponent. - - * mail-summary.c: Create the view, and update it when something - changes. - -2000-10-04 Iain Holmes - - * mail-display.c (on_object_requested): Removed the pixbuf cache - as it would return the pixbufs in the reverse order every so often - and generally get all confused. - -2000-10-04 Dan Winship - - * folder-browser-factory.c (control_deactivate): Add back the - "sync folder on leave" hack that got lost in the UIHandler merge. - -2000-10-04 Jeffrey Stedfast - - * folder-browser-factory.c: Instead of UnSelectAll, we want - InvertSelection. - - * mail-callbacks.c (select_all): Finished this function. - (invert_selection): Finished. (was unselect_all - but that's not - what we really wanted as it'd be pointless. invert_selection is a - much more useful callback :-) - -2000-10-04 Chris Toshok - - * mail-tools.c (mail_tool_get_root_of_store): remove news specific - check. - (mail_tool_uri_to_folder): news: -> nntp: - -2000-10-04 Jeffrey Stedfast - - * mail-ops.c (do_filter_ondemand): Don't expunge the source - mailbox on completion. - -2000-10-04 Dan Winship - - * mail-ops.c (do_scan_subfolders): Don't try to add_folders if - get_folder_info returned NULL. - -2000-10-04 Not Zed - - * message-list.c (message_list_init_header): Fix the attachment - icon width. - (content_is_attachment): Perform some simple tests to see if the - message contains an attachment. - (build_subtree): Kill a pointless warning. - -2000-10-04 Miguel de Icaza - - * mail-callbacks.c (delete_msg): Added a comment to a piece of - code that I was trying to "fix" just to find that the strange - behaviour here that was about to be fixed, was actually a fix to - the problem I was trying to fix. - - So put the original comments from Dan, and will hope that someone - with more knowledge about this can figure why the delete key wont - delete messages and select the next unread message. - -2000-10-02 Chris Toshok - - * subscribe-dialog.c (subscribe_dialog_destroy): destroy our - tree_model and remove the root node. also, release_unref our - control and view, and unref the listener. - - * mail-tools.c (mail_tool_uri_to_folder): news url's contain host - names too, now. - -2000-10-02 Chris Toshok - - * subscribe-dialog.c, subscribe-dialog.h: add a - storage-set-view-listener, and add a little printf saying what - storage was selected. - -2000-10-02 Chris Toshok - - * subscribe-dialog.c (subscribe_dialog_gui_init): get - Evolution::StorageSetView interface on our storage set view - control, and set "show_folders" to FALSE. - -2000-10-02 Chris Toshok - - * Makefile.am (INCLUDES): add -I$(top_srcdir)/widgets/misc - - * subscribe-dialog.c (subscribe_dialog_gui_init): change the - window title to Manage Subscriptions, bold subscribed folders, and - add a title bar ala the evolution shell (but without the close - button). - -2000-10-02 Chris Toshok - - * subscribe-dialog.h: add fields for the storage set - Bonobo_Control and Evolution_StorageSetView interfaces. - - * subscribe-dialog.c (subscribe_dialog_gui_init): create the uih - as early as possible, and add the storage set view to the left - side of the hpaned. - -2000-09-22 Michael Meeks - - * folder-browser-factory.c (set_pixmap): upd. - (control_activate): upd. - -2000-10-02 Dan Winship - - * mail-config-gui.c: Remove "Port" entry from source dialog. We'll - use "host:port" like Netscape and other programs do. - (service_page_get_url): If host ends in ":###", use that as port. - (service_page_set_url): If URL contains a port, append it to the - hostname, separated by a colon. - -2000-10-02 Chris Toshok - - * Makefile.am (evolution_mail_SOURCES): subscribe-control.[ch] -> - subscribe_dialog.[ch] - - * mail-callbacks.c (manage_subscriptions): subscribe_control -> - subscribe_dialog. Also, pass the shell to subscribe_dialog_new. - - * mail-types.h: SubscribeControl -> SubscribeDialog. - - * subscribe-dialog.c, subscribe-dialog.h: rename from - subscribe-control.[ch]. - - * subscribe-dialog.c (subscribe_dialog_construct): pass - Evolution_Shell in. - (subscribe_dialog_new): takes Evolution_Shell argument now. - -2000-10-02 Chris Toshok - - * message-list.c (message_list_init_renderers): remove the 2 tree - pixbufs, so adjust the offsets to the score pixbufs. also, pass - NULL for the open/closed pixbufs to the tree cell renderer. - -2000-10-02 Dan Winship - - * mail-ops.c (mail_do_scan_subfolders, etc): Update for - CamelFolderInfo changes. - - * message-list.c (message_list_destroy): Don't save_tree_state if - there's no folder associated with the MessageList. - - * folder-browser.c (folder_browser_set_uri): Only call - mail_do_load_folder if the URI is not "". - -2000-10-02 Iain Holmes - - * mail-display.[ch]: Add a cache for the pixbufs, hashed on CID, - so that we only have to make a thumbnail once. - -2000-10-01 Iain Holmes - - * mail-display.c: Generate the thumbnails on an idle function so - that the user interface isn't locked. Checks in case the widget it - will use to display the image isn't destroyed. - -2000-10-01 Iain Holmes - - * mail-display.c (on_object_requested): If the attachment is an - image display a thumbnail of it, instead of the generic image - icon. - -2000-09-29 Miguel de Icaza - - * folder-browser-factory.c: Add print preview verb here. - - * mail-callbacks.c (do_mail_print): Handle printing here, the - complete engine. - (mail_print_preview_msg): new. does print previewing. - (mail_print_msg): does printing of the message. - -2000-09-29 Chris Toshok - - * subscribe-control-factory.c, subscribe-control-factory.h: nuked. - - * subscribe-control.c, subscribe-control.h: lots of changes. we - now pop up a dialog, and will have a storage set view on our left - side, like the shell does. - - * mail.h: add prototype for manage_subscriptions. - - * mail-callbacks.c (manage_subscriptions): new function, pops up - the subscribe dialog. - - * folder-browser-factory.c: add the verb for managing - subscriptions. - - * Makefile.am (evolution_mail_SOURCES): add subscribe-control.[ch] - again. - -2000-09-28 Chris Toshok - - * subscribe-control.h (subscribe_search): added prototype. - - * subscribe-control.c (subscribe_search): new function. - - * subscribe-control-factory.c (make_folder_search_widget): new - function, to add search widget to toolbar. - (control_activate): create the search widget and add it to the - toolbar. - -2000-09-28 Jeffrey Stedfast - - * mail-ops.c (do_send_queue): Messages should be appended to Sent - as Seen. - (do_send_mail): Same. - -2000-09-28 Ettore Perazzoli - - * Makefile.am: Don't compile `subscribe-control' for now. It - needs to be converted to the new UI handler code in Bonobo; it - doesn't compile right now. - -2000-09-27 Chris Toshok - - * subscribe-control.c (subscribe_refresh_list): new function. - - * subscribe-control.h (subscribe_refresh_list): new prototype. - - * subscribe-control-factory.c (update_pixmaps): add RefreshList - pixmap. also, add it to the verbs list. - -2000-09-27 Chris Toshok - - * mail-types.h: add SubscribeControl typedef. - - * Makefile.am (evolution_mail_SOURCES): add the subscribe stuff. - - * subscribe-control-factory.h * subscribe-control-factory.c * - subscribe-control.c: * subscribe-control.h: Mostly mocked up - subscribe ui. - -2000-09-27 Jeffrey Stedfast - Note: We need a configuration option to specify whether to log - filtering actions or not. - - * mail-ops.c (do_filter_ondemand): Updated to pass a log file - pointer to filter_driver_run. - (do_fetch_mail): Same. - (mail_do_fetch_mail): Fixed a compiler warning. - -2000-09-27 Jeffrey Stedfast - - * mail-callbacks.c (composer_postpone_cb): Fix it so that "send - later" will still mark a message as being replied, forwarded, - whatever. Closes bug #568 on bugzilla. - -2000-09-27 Jeffrey Stedfast - - * mail-ops.c (do_filter_ondemand): If the message has been - deleted, don't try filtering it - skip to the next message. Fixes - bugzilla bug #639. - -2000-09-25 Jeffrey Stedfast - - * folder-browser-factory.c: Shuffling (un)select all menu items to - the Edit menu. - -2000-09-25 Jeffrey Stedfast - - * folder-browser-factory.c: Added new menu items - - * mail-callbacks.c (mark_as_seen): New callback to mark all - selected messages as Seen. - (mark_as_unseen): New callback to mark all selected messages as - Unseen. - (select_all): New callback to select all messages (not yet - finished) - (unselect_all): New callback to unselect all messages (not yet - finished) - -2000-09-25 Not Zed - - * message-list.c (folder_to_cachename): Function to convert a - folder name/path to a filename for per-folder data. - (save_tree_state): - (load_tree_state): - (free_tree_state): For loading/saving the state of the expansion - of nodes in the tree. - (message_list_destroy): Save the tree state when done. - (save_node_state): Changed logic, we save when the node should be - closed on startup. i.e. any new nodes with children automatically - default to being open. - (subtree_unread): Check for unread messages in a subtree. So - false messages (for tree roots) are properly displayed. - -2000-09-25 Jeffrey Stedfast - - * message-list.c (address_compare): Updated to use Nat's - ENameWestern parser. - - * Makefile.am: link against e-util/ename/libename.la - -2000-09-25 Dan Winship - - * mail-ops.c: CamelException is not for compile-time errors. - Replace lots of argument checks in setup_ functions with - g_return_if_fails in the public functions. Also remove some - prototypes that weren't needed because they were for static - functions that are defined before they're used. - -2000-09-23 Michael Meeks - - * folder-browser-factory.c (set_pixmap): upd. - (control_activate): upd. - -2000-09-23 Ettore Perazzoli - - * message-list.c (internet_address_new_from_string): Skip spaces - at the beginning of the string first before doing anything else. - The code that follows doesn't like the first character of the - string to be a space. - -2000-09-22 Jeffrey Stedfast - - * message-list.c (address_compare): New comparison function for - email addresses. - (subject_compare): New comparison function for message subjects. - (message_list_init_header): Updated to use the new compare funcs. - -2000-09-21 Jeffrey Stedfast - - * mail-format.c (mail_generate_reply): Fixed some memory - leakage. Call free_recipients() so we don't leak memory. - -2000-09-19 Jeffrey Stedfast - - * mail-ops.c (do_scan_subfolders): Use the folder's full_name so - recursive directory structures display correctly ;-) - -2000-09-19 Dan Winship - - * mail-ops.c (do_scan_subfolders): Update for CamelFolder changes - (subfolder_names -> subfolder_info). - -2000-09-19 Dan Winship - - * mail-callbacks.c (create_msg_composer, compose_msg, send_to_url, - mail_reply, forward_msg): * mail-format.c (mail_generate_reply): * - mail-ops.c (cleanup_edit_messages): - - * mail-view.c (view_forward_msg): Deal with NULL composer. - -2000-09-18 Dan Winship - - * main.c (main): Call gnome_vfs_init() since the composer now does - file operations (to get the MIME type of attachments). - -2000-09-18 Jeffrey Stedfast - - * message-list.c: Removed COL_ONLINE_STATUS because we don't want - that. Renamed COL_PRIORITY to COL_SCORE and set it up to sort-of - work, I'm not really sure which renderer I should use. - -2000-09-18 Christopher James Lahey - - * Makefile.am: Added $(EXTRA_GNOME_CFLAGS) and - $(EXTRA_GNOME_LIBS). Removed unneeded libraries. - - * component-factory.c, folder-browser-factory.c, folder-browser.c, - mail-callbacks.c, mail-config-gui.c, mail-display.c, - mail-display.h, main.c, message-list.c, message-list.h: Fixed the - #include lines to deal properly with gal. - -2000-09-16 Michael Meeks - - * Makefile.am (INCLUDES): add datadir - - * folder-browser-factory.c (control_activate): use it. - -2000-09-15 Dan Winship - - * mail-callbacks.c (transfer_msg): Revert **Temp fix** from below - since the relevant shell bug has been fixed now. - - * mail-ops.c (do_fetch_mail): Fix the sense of the "keep on - server" check so we're not doing this backwards. Don't - get_message_flags, because POP doesn't support it and it's - pointless anyway since we're setting deleted, not toggling it. - call camel_folder_sync with expunge=TRUE so that the deletions are - actually recorded. - -2000-09-15 Dan Winship - - This bug was so much fun to fix the first time that I decided to - fix it again. - - 2000-07-11 Dan Winship - - * mail-ops.c (real_send_mail): Set the post_send_data flag - rather than toggling it. (Maybe we'll need more control - over it later, but for now, the only flag we set is - "replied", and we want that set, not toggled.) - -2000-09-14 Jeffrey Stedfast - - * mail-callbacks.c (transfer_msg): **Temp fix** Send "" as the - default folder to select as anything else seems to cause a - segfault in shell's user_get_folder(). - (check_configured): A spoon full of 'line wrapping' makes the - medicine go down, the medicine go dowwwwn... - -2000-09-14 Iain Holmes - - * mail-callbacks.c (check_configured): Ask if you want to - configure the mail client if it isn't configured already. - (check_send_configuration): Remove the error box if mail isn't - configured. - (send_queued_mail): Same. - -2000-09-14 Dan Winship - - * mail-ops.c (setup_append_mail): camel_folder_append is perfectly - happy to take a NULL info. - -2000-09-14 Michael Meeks - - * folder-browser-factory.c: move fn to bonobo. - (set_pixmap): update. - (control_deactivate): add bonobo_ui_handler_unset_container - -2000-09-14 Christopher James Lahey - - * mail-config-gui.h: Changed the include here because it caused - make distcheck to fail for me. I changed it from to - "shell/Evolution.h". This seems to have fixed things. - -2000-09-14 Jeffrey Stedfast - - * mail-ops.c (do_fetch_mail): Only use the cache if the user plans - to keep_on_server. - -2000-09-14 Michael Meeks - - * folder-browser-factory.c (control_deactivate): kill - warning. (control_activate): set threaded toggle state, - add freeze / thaw. - (set_pixmap, fill_toolbar, update_pixmaps): update. - -2000-09-13 Christopher James Lahey - - * folder-browser-factory.c: Fixed a warning (Missing include - file.) - -2000-09-12 Ettore Perazzoli - - ($(EVOLUTION_MAIL_CORBA_GENERATED)): Add space after `-I'. - -2000-09-12 Ettore Perazzoli - - * Makefile.am: Remove `ui.xml' stuff. - -2000-09-12 Dan Winship - - * mail-local-storage.c (mail_local_storage_startup): set - folder_tree before adding the listener, since that will eventually - invoke callbacks that will look at it. - - * folder-browser-factory.c (control_deactivate): sync the folder - on deactivate. - -2000-09-12 Ettore Perazzoli - - * message-list.c (on_right_click): Also display the name of the - mailing list in the "Filter on Mailing List" item for additional - Coolness factor. - - * mail-autofilter.c (filter_gui_add_for_mailing_list): Create the - rule with `filter_filter_new()' so that it also has an action - part. - - * mail-mlist-magic.c (get_header): Use the right header name to - retrieve the header. - -2000-09-12 Ettore Perazzoli - - * message-list.c (on_right_click): Grey out the mailing list - filter item if `mail_mlist_magic_detect_list()' returns NULL on - this message [i.e., if we cannot figure out a mailing list for - this message]. - (filter_mlist): Good boys don't use F words. - - * mail-mlist-magic.c (check_sender): Work safely if - `header_name_return' or `header_value_return' are NULL. - (check_x_been_there): Likewise. - (check_delivered_to): Likewise. - (check_x_mailing_list): Likewise. - (check_x_loop): Likewise. - (get_header): Use the right header name to retrieve the header. - - * message-list.c (on_right_click): Mark strings for translation. - -2000-09-12 Ettore Perazzoli - - * folder-browser-factory.c: Use the latest, shiny, amazing TigerT - art for the toolbar. - - * component-factory.c: #include "mail-local-storage.h". - (owner_set_cb): Removed unused variable. - - * message-list.c (filter_sender): Made static. - (filter_recipient): Likewise. - (filter_subject): Likewise. - (vfolder_recipient): Likewise. - (vfolder_sender): Likewise. - (vfolder_subject): Likewise. - - * mail.h (vfolder_subject): Removed prototype [WTF was this doing - here?!?!]. - (vfolder_sender): Likewise. - (vfolder_recipient): Likewise. - (filter_subject): Likewise. - (filter_sender): Likewise. - (filter_recipient): Likewise. - - * message-list.c: Added a new "Filter on mailing list" menu item. - (filter_mlist): Callback for this menu item. Use - `filter_gui_add_for_mailing_list' to pop up the filter dialog with - the appropriate rule. - - * mail-autofilter.c (filter_gui_add_for_mailing_list): New. - - * message-thread.c (dump_tree): Removed unused variable. - - * mail-mlist-magic.c: New. - * mail-mlist-magic.h: New. - - * mail-autofilter.c (rule_match_recipients): Mark strings for - translation. - (rule_from_message): Likewise. - (filter_gui_add_from_message): Likewise. - -2000-09-12 Jeffrey Stedfast - - * mail-ops.c (do_fetch_mail): Was trying to unhook an event from - the wrong folder - oops. - -2000-09-12 Not Zed - - * message-thread.c: Reverted to version 1.15. - (remove_node): Ok, if a node has a parent, remove it from the - parent list, otherwise remove it from the (supplied) root list. - (group_root_set): When we merge children, free the lost node. - (thread_messages_free): Remove the return, run as is. - (prune_empty): Plugged another small leak. - -2000-09-11 Jeffrey Stedfast - - * mail-callbacks.c (run_filter_ondemand): Updated to use the new - mail_do_filter_ondemand. - - * mail-ops.c (do_fetch_mail): Update to use the new - filter_driver_run args. - (do_filter_ondemand): Updated to use the new filter_driver_run - args. - (mail_do_filter_ondemand): Take a FilterContext as a argument - instead of a driver as we need to destroy the filter inside the - do_filter_ondemand function and things'd get messy. - -2000-09-11 Jeffrey Stedfast - - * mail-ops.c (do_fetch_mail): Don't have the filter driver - self_destruct. - -2000-09-11 Jeffrey Stedfast - - * mail-ops.c (do_fetch_mail): If we're fetching from an mbox - formatted file then we need to do some special-casing. - -2000-09-11 Ettore Perazzoli - - * component-factory.c (owner_set_cb): Call - `mail_local_storage_startup()' to set up handling of the local - storage. - - * mail-local-storage.c: New. - * mail-local-storage.h: New. - -2000-09-11 Christopher James Lahey - - * mail-display.c: Fixed some warnings. - -2000-09-11 Dan Winship - - * mail-display.c, mail-format.c: Another big rewrite of this - stuff. Now all (well, most) attachments get a small icon with a - description and a (non-obvious) right-click pop-up menu with - options to save, open in an external program, or show/hide inline. - - TODO: antialias the icon, add more options to the pop-up for - certain MIME types, add an icon to the headers, fix PGP to work - like everything else, fix message/external-body to work again, - add some icon caching action, etc, etc. - -2000-09-09 Jeffrey Stedfast - - * mail-ops.c (do_fetch_mail): Use the CamelUIDCache so that we - only retrieve *new* messages and also send notes to the status bar - telling it which message we're downloading so that Ettore can - sleep at night ;-) - -2000-09-09 Jeffrey Stedfast - - * mail-ops.c (do_fetch_mail): Updated to not send hook/unhook data - to filter_driver_run as it no longer takes those args. - (do_filter_ondemand): Same. Also wrap filtering in freeze/thaw to - prevent signals from being queued up - -2000-09-09 Jeffrey Stedfast - - * mail-ops.c (do_fetch_mail): Freeze the default folder before - filtering and thaw it afterward to prevent a ton of - "folder_changed" signals from being queued. - -2000-09-08 Christopher James Lahey - - * folder-browser.c, mail-config-gui.c, mail-ops.c: Fixed some - warnings. - - * message-list.c: Added base ETableModel functions. - -2000-09-08 Jeffrey Stedfast - - * mail-ops.c (do_fetch_mail): Updated to pass a CamelMessageInfo - to filter_driver_run - (do_filter_ondemand): Same. - -2000-09-07 Jeffrey Stedfast - - * mail-ops.c (do_filter_ondemand): Updated to check the boolean - return code from filter_driver_run to find out whether or not the - message was filtered so that it can decide whether or not to - delete the message from the source folder or not. - -2000-09-07 Jesse Pavel - - * mail-format.c (mail_generate_reply) Changed the behavior of - Reply-to-All so that the sender's address does not appear in - the cc: list. - -2000-09-07 Jeffrey Stedfast - - * mail-ops.c (do_fetch_mail): Updated to pass an exception to - filter_driver_run and also check the exception before deleting the - message from the source folder. - (do_filter_ondemand): Updated to pass an exception to - filter_driver_run - -2000-09-07 Dan Winship - - * session.c (session_init): Pass a storage dir to - camel_session_new now. - - * main.c (main): Can't call session_init here now, because it - requires evolution_dir to be set. - - * component-factory.c (owner_set_cb): call session_init here. - - * mail-ops.c (do_fetch_mail): Fix previous fix. (Free the uids, - just do it correctly.) - -2000-09-07 Jeffrey Stedfast - - * mail-ops.c (do_fetch_mail): Don't free uids, let the camel - folder do that when it gets finalized - -2000-09-06 Jeffrey Stedfast - - * mail-ops.c (mail_do_filter_ondemand): New async function to - filter messages on demand. - (do_fetch_mail): Updated to filter 1 message at a time using the - new filter-driver code - - * mail-callbacks.c (composer_postpone_cb): Send NULL as the - message info. - (run_filter_ondemand): Use mail_do_filter_ondemand instead of - filter_driver_run - - * mail-tools.c: Removed mail_tool_filter_contents_into and - mail_tool_fetch_mail_into_searchable as they have now been - deprecated. - -2000-09-06 Dan Winship - - * message-list.c (clear_tree): set the data to NULL for the tree - root, so nuke_uids won't try to free anything. - -2000-09-06 Ettore Perazzoli - - * folder-browser.c (folder_browser_new): @shell made const. - `CORBA_Object_duplicate()' it before storing it. - (folder_browser_destroy): Free the shell object with - `CORBA_Object_release()', not `CORBA_free()'. - - * folder-browser-factory.c (folder_browser_factory_new_control): - @shell made const. - -2000-09-05 Dan Winship - - * mail-display.c (make_safe_filename): - * mail-format.c (handle_mystery): - * mail-identify.c (mail_identify_mime_part): - camel_mime_part_get_filename now deals with both - Content-Disposition and Content-Type. - -2000-09-05 Peter Williams - - * mail-ops.c (cleanup_load_folder): Check for NULL folder. - (mail_do_setup_folder): Copy the 'name' parameter so that - we can free it. - - * message-list.c (nuke_uids): Depth '-1' means "unlimited", not 0. - -2000-09-05 Dan Winship - - * component-factory.c (owner_set_cb): Re-rename "Sent". - - * folder-browser.c (fb_resize_cb): Remove the "+ 90" here since it - seems to break things for me, and it's not commented anyway and - there's no excuse for adding 90 to a number with no explanation. - -2000-09-05 Peter Williams - - * folder-browser.c (folder_browser_destroy): Don't free the shell; - it's not ours. - -2000-09-05 Dan Winship - - * mail-tools.c (mail_tool_move_folder_contents): only call - camel_folder_get_message_info if the folder has - summary_capability. Don't hack up a fake CamelMessageInfo: - append_message will take NULL. - - * mail-ops.c: Replace mail_do_setup_draftbox, - mail_do_setup_outbox, and mail_do_setup_sentbox with - mail_do_setup_folder. - (do_send_mail, do_send_queue): s/sentbox_folder/sent_folder/ - - * component-factory.c (owner_set_cb): Use mail_do_setup_folder, - rename sentbox_folder to sent_folder, and call - mail_operation_wait_for_finish after the setup_folder calls in - case anything needs to use the _folder variables. - -2000-09-04 Jeffrey Stedfast - - * mail-format.c (mail_generate_reply): Applied Jesse's patch that - will append a signature to the replied message text - - * folder-browser-factory.c: Changed "Send & Receieve" back to "Get - Mail" temporarily so that the toolbar buttons don't all get - stretched to some weird proportion - -2000-09-03 JP Rosevear - - * mail-config.c (mail_config_add_news): Copy the passed in item - before adding - (mail_config_add_source): ditto - (mail_config_add_identity): ditto - - * mail-config-gui.c (mail_config): We don't actually need a notebook - pointer. - (identities_edit_clicked): Don't explicitly destroy, we are using - gtk_clist_set_data_full now - (sources_edit_clicked): ditto - (news_edit_clicked): ditto - (mail_config): Use gtk_clist_set_row_data_full to kill leaks - -2000-09-03 Jeffrey Stedfast - - * folder-browser-factory.c: Change the "Get Mail" toolbar button - to become "Send & Receieve" - - * mail-callbacks.c (send_queued_mail): New callback function for - sending queued mail - (send_receieve_mail): New callback for Send & Receieve that - basically just calls send_queued_mail and then fetch_mail - - * mail-ops.c (cleanup_send_mail): Mod to be able to handle a NULL - composer window - (setup_send_mail): Modified to handle a NULL composer widget - (mail_do_send_queue): New convenience async function to send all - messages in a folder (aka all messages in a queue) - -2000-09-02 Jeffrey Stedfast - - * mail-tools.c (mail_tool_move_folder_contents): Since POP3 - doesn't implement get_message_info, we need to check for info to - be NULL. In this case, we need to make our own info structure to - pass to append_message and then remember to free it - afterward. Should we even bother with get_message_info? And if so, - should we then implement get_message_info for POP3? - -2000-09-02 Ettore Perazzoli - - * folder-browser.c (etable_key): Make the `Home' key to move to - the beginning of the list and `End' to the end of it, using - `message_list_home()' and `message_list_end()'. - - * message-list.c (message_list_home): New. - (message_list_end): New. - - * folder-browser.c (folder_browser_new): Don't ref the shell here. - (folder_browser_destroy): Don't unref the shell. Instead, - `CORBA_free()' the object reference. - - * folder-browser-factory.c (control_activate): Bind "Open in New - Window" to `Ctrl-O'. - -2000-09-02 Lauris Kaplinski - - * mail-config-gui.c: Use e_utf8 wrappers - - * main.c (main): Do e_unicode_init, so we are not confusing - libunicode - -2000-09-01 Christopher James Lahey - - * folder-browser.c: Removed a warning. - -2000-09-01 Jeffrey Stedfast - - * mail-callbacks.c (compose_msg): Attach a callback to the - postpone signal - (send_to_url): Same - (mail_reply): Same - (forward_msg): Same - (composer_postpone_cb): Callback function for the postpone signal - - * mail-ops.c (mail_do_setup_outbox): New convenience function to - load the Outbox folder - (mail_do_setup_sentbox): Same, but for Sentbox. - (do_send_mail): Now saves messages in Sentbox if sent successfully - (mail_do_append_mail): New convenience async function for - appending messages to a folder - - * component-factory.c: Added outbox_folder and sent_folder - (owner_set_cb): Call our new convenience functions to load Outbox - and Sentbox - -2000-09-01 Ettore Perazzoli - - * mail-ops.c (cleanup_scan_subfolders): Update for the extra arg - needed by `evolution_storage_new_folder()'. - * mail-vfolder.c (vfolder_refresh): Likewise. - -2000-08-31 Peter Williams - - * folder-browser.c (folder_browser_new): Don't ref the shell: - causes a race upon exit. - (folder_browser_destroy): Don't unref it. - - * mail-config-gui.c (service_page_item_new): Add a checkbutton - "use default port" to make life simple. - (service_page_get_url): Honor use_default_port. - (service_page_set_url): Set use_default_port based on the input - URL. - (toggle_port): New function, sets the sensitivity of the - port entry based on "use default port" - - (config_do_query_authtypes): Make this asynchronous, as it - may involve connecting to a server. - (service_page_detect): Call the async auth querier. - (service_page_item_new): Put the authentication stuff in if - the url_flags have URL_ALLOW_AUTH. Call the async auth querier - to get the info. - -2000-08-30 Ettore Perazzoli - - * mail-view.c (mail_view_create): Make the HTML widget grab the - focus. - -2000-08-30 Peter Williams - - * mail-config-gui.c (do_test_service): Explicitly connect to - the service again. - - * component-factory.c (mail_load_storages): Now that - camel_service_get_provider exists, use it to make this function - much simpler. - -2000-08-29 Peter Williams - - * folder-browser.c (folder_browser_new): Ref the Evolution_Shell. - Is this correct, or is it a circular reference? - -2000-08-29 Dan Winship - - * mail-ops.c (mail_do_send_mail): Update this and related - functions to no longer take a From address. (The composer deals - with it itself now.) - (do_send_mail): Add the Evolution version back to the X-Mailer - header (this change got lost in the thread migration). - - * mail-callbacks.c (composer_send_cb): Don't re-fetch the From - address. It's set by the composer now. Don't free the - post_send_data from here. - (mail_reply): Attach to the composer's destroy signal to free the - psd. (The current code would free it more than once if an error - occurred while trying to send the first time.) - -2000-08-28 Peter Williams - - * mail-config-gui.c (mail_config_apply_clicked): Add new news sources, - not only stores. - -2000-08-28 Jeffrey Stedfast - - * mail-callbacks.c (composer_send_cb): Free the from address when - we're done with it. Also, e_msg_composer_hdrs_get_from returns - alloc'd memory so don't strdup it. - -2000-08-28 Peter Williams - - * mail-ops.c (do_transfer_messages): Add status messages. - (do_flag_messages): Same. - (do_scan_subfolders): Same. - (do_forward_messages): Same. - (do_view_messages): Same. - -2000-08-28 Ettore Perazzoli - - * mail-view.c (mail_view_create): Use `gnome_app_set_toolbar()' - the easy way instead of doing things manually with `GnomeDock' and - `gnome_app_add_toolbar()'. - (MINIMUM_WIDTH): New #define. - (MINIMUM_HEIGHT): New #define. - (view_size_allocate_cb): New, callback for the "size_allocate" - signal of the mail view. It saves the last allocation in a static - `last_allocation' variable. - (mail_view_create): Connect it. - (set_default_size): New function. Set the default width/height to - the last allocation width/height; if the width/height is less than - the `MINIUM_WIDTH' or `MINIMUM_HEIGHT', use that value instead. - - * mail-tools.c (mail_tool_move_folder_contents): Show `i + 1', not - `i', so that we correctlly start counting from one instead of zero. - -2000-08-28 Peter Williams - - * *.c: s,mail_dialog_run,gnome_dialog_run,g. - - * main.c (main): Since only the main thread is dealing with GTK+, - free the GDK threads mutex and never worry about locking again. - -2000-08-28 Jeffrey Stedfast - - * mail-crypto.c (mail_crypto_openpgp_encrypt): Fix to prevent - possible buffer overflows and a logic fix. - -2000-08-27 Jeffrey Stedfast - - * mail-crypto.c (mail_crypto_openpgp_clearsign): New crypto - function to clearsign plaintext - -2000-08-27 Ariel Rios - - * folder-browser-factory.c (control_activate): Added bonobo menu - handler for mark_all_deleted function. - - * mail.h: (mark_all_deleted): Added prototype. - - * mail-callbacks.c (mark_all_deleted): Added callback for marking - all displayed messages in a folder as deleted. - -2000-08-26 Ettore Perazzoli - - * mail-view.c (mail_view_create): Use - `gtk_window_set_default_size' on the toplevel instead of - `gtk_widget_set_usize()', and make the default size smaller. - -2000-08-25 Christopher James Lahey - - * mail-crypto.c: Fixed an uninitialized variable. - -2000-08-26 JP Rosevear - - * evolution-mail.gnorba: Kill - - * Makefile.am: Remove gnorba related stuff - -2000-08-25 Peter Williams - - * mail-config-gui.c (service_page_item_new): If the service wants - a host, also let the user specify a port. - (MailDialogServicePageItem): Add members for the port GtkEntry and - the default port. - (service_page_get_url): Translate the port in the entry back into - the CamelURL. - (service_page_set_url): Read in the port from the URL or use - the default. - -2000-08-25 Jeffrey Stedfast - - * mail-crypto.c (mail_crypto_openpgp_encrypt): Implemented PGP 2.x - encryption. We only need to get the passphrase if we plan to sign - the text, otherwise we don't need to worry about getting the - passphrase. - -2000-08-24 Lauris Kaplinski - - * folder-browser.c: Use e_utf8 wrappers - - * mail-config-gui.c: Use e_utf8 wrappers - -2000-08-24 Peter Williams - - * folder-browser-factory.c (control_activate): Add all the - functions from message-list.c's popup menu to the main - menu as well - - * message-list.c (vfolder_subject): These functions become - public. - - * mail-callbacks.c (mark_all_seen): Don't call camel_folder_get_uids - here. IMAP, for example, will try to communicate with the IMAP - server during that call. - - * mail-ops.c (cleanup_fetch_mail): Tell the user - which URL has no new mail, as they may be checking - more than one source. - (mail_do_flag_all_messages): New function. Flags all of - the messages in a folder. Something of a hack. This merely - extends the flag_messages operation; it doesn't implement - a new one. - (do_flag_messages et al): Fetch the uids if we need to; - use camel_folder_free_uids if necessary, etc. - - * mail-tools.c (mail_tool_move_folder_contents): Add - messages to tell the user what's going on. - -2000-08-24 Christopher James Lahey - - * folder-browser-factory.c: Fixed some warnings in the uihandler - code. - -2000-08-24 Peter Williams - - * component-factory.c (mail_load_storages): New function. - Loads a list of URI's as mail storages, and inserts them - into the shell's folder tree if appropriate (really, only - puts them into the folder tree.) - (mail_add_new_storage): Insert a storage into the folder - tree. Not always appropriate (eg, /var/spool/mail/user is - a storage that shouldn't be in the folder tree.) - (create_view): Generate the Evolution_Shell and pass it - to folder_browser_factor_new_control so that its member - 'shell' can be set. - (owner_set_cb): Instead of create_news_storage and - creating the imap storages, load the news storages and - mail storages via mail_load_storages(). - - * folder-browser-factory.c (control_activate): Change to - use providers_config again instead of mail_config. Pass - the folderbrowser so that the config code knows where - to insert the new storages if any are created. Pass - forget_passwords the folderbriwser, too, for good luck. - (folder_browser_factory_new_control): Take a new parameter, - the Evolution_Shell that we belong to. The field in - FolderBrowser has been there but was never getting set by - anything, and we need this to be able to insert new storages - into the shell's folder list. - - * folder-browser.c (folder_browser_new): Accept the - new Evolution_Shell parameter. Set it. (Should we - ref it or something?) - - * mail-config-gui.c (struct MailDruidDialog): Store an - Evolution_Shell. With this we can insert the stores into - the shell's folder list. - (struct MailDialog): Same. - (service_page_item_changed): Close a leak. - (identity_dialog): Unswitch the Add/Edit identity titles. - (news_dialog): Analogous to above. - (mail_druid_finish): Add the new mail source to the shell - view. - (mail_config_druid): Take a new Evolution_Shell parameter - for later use. - (mail_config_apply_clicked): Add all the mail sources to - the shell view. - (mail_config): Take a new Evolution_Shell parameter. - - * mail-callbacks.c (check_configured): Accept a FolderBrowser - so that we know where to put the new storages if any are - created. Almost all the callbacks are passed a FB * anyway - so this isn't a big deal. - (check_send_configuration): Make sure that we're configured - enough to be able to send mail. composer_send_cb() used to - do this, but it would need a FolderBrowser *, and there are - too many entry points to composer_send_cb to make this - feasible. - (fetch_mail): Pass the extra parm to check_configured(). - (free_psd): Move so that composer_send_cb can call this - directly. - (composer_send_cb): Don't check for proper configuration - here -- it is the caller's responsiblity to call - check_send_configuration(). Call free_psd() directly. - (compose_msg): Call check_send_configuration(). - (send_to_url): Same. This is called from mail-display.c, - though, and cannot reasonably be passed a FB. So: we can't - start up the config dialog directly; the user must do it - manually. Oh well. - (mail_reply): Same as above. - (forward_msg): Same as compose_msg(). - (edit_msg): Same as above. - (providers_config): Reenable so that we can pass mail_config - its FolderBrowser. - - * mail-display.c (write_data_to_file): Use the much more - straightforward run_and_close to retrieve the user's answer, - instead of the reply callback stuff. - - * mail-threads.c (mail_dialog_run): New wrapper for - gnome_dialog_run that will take care of the GDK lock correctly. - Far far more complicated than it should be. - (mail_dialog_run_and_close): Analogous to above. - (read_msg): Set inside_read_msg and unset it for the benefit - of the two above functions. Don't bracket ourselves in - GDK_THREADS_ENTER/_LEAVE anymore. - (mail_operation_queue): Use mail_dialog_run_and_close. - (show_error): As above. - (get_password): As above. - - * mail-display.c (write_data_to_file): This has the only - exception to the rule that "use mail_dialog_run(_and_close) - instead of the gnome equivalent always." Not quite sure why - it doesn't work here (the file selection window?). - - * mail-config-gui.c (identity_dialog): Change to - mail_dialog_run_and_close. - (source_dialog): Same as above. - (news_dialog): Same as above. - (cleanup_test_service): Same as above. - (mail_config): Change to mail_dialog_run(). - - * session.c (mail_request_dialog): Change to - mail_dialog_run_and_close. - - * mail-tools.c (mail_tool_uri_to_folder_noex): As above. - - * mail-ops.c (cleanup_fetch_mail): As above. - - * mail-local.c (local_reconfigure_folder): As above. - - * mail-callbacks.c (check_send_configuration): As above. - (ask_confirm_for_empty_subject): As above. - (edit_msg): As above. - (filter_edit): As above. - -2000-08-23 Dan Winship - - * folder-browser-factory.c (control_activate): Reformat a bit, - make "Folder" appear before "Message", fill in the Message menu - more. - -2000-08-23 Peter Williams - - * mail-ops.c (describe_fetch_mail): Don't use the camel calls - to describe the operation. - -2000-08-22 Peter Williams - - * mail-tools.c (mail_tool_get_folder_from_urlname): Don't connect - to the service explicitly. - (mail_tool_send_via_transport): Don't connect to the transport - explicitly. - (mail_tool_get_root_of_store): Same. - - * mail-config-gui.c (do_test_service): Just try camel_session_get_service, - which will now connect for us. - - * message-thread.h: Add a note about *next being the first member - of struct _container... if it isn't, everything goes Very Wrong. - - * message-thread.c (free_container): Extra debug print. - (remove_node): Handle the case of empty containers holding the child - that we're interested in. - (thread_messages_free): Extra debug print. - -2000-08-20 Jeremy Wise - * folder-browser.c: (fb_resize_cb) Added function to monitor resize - of the e_paned in the main view. - -2000-08-18 Peter Williams - - * mail-tools.c (mail_tool_filter_contents_into): Fix a race. filter_driver_run is an - async operation so it won't even be started by the time we sync the folders and check - for the movemailbox to be emtpy. Thus the empty check for the movemail would fail - 99% of the time. - - * mail-callbacks.c (run_filter_ondemand): Pass he new argument to the ever-mushrooming - filter_driver_run. - -2000-08-17 Peter Williams - - * folder-browser-factory.c (control_activate): Fix menu item names. - (register_ondemand): Put the ondemand hooks into the new folder menu. - -2000-08-17 Ettore Perazzoli - - * mail-vfolder.c (vfolder_gui_add_rule): Use stock OK/Cancel - buttons and add i18n support. - - * folder-browser-factory.c (control_activate): Changed menu item - label from "Mark all messages seen" to "Mark All Messages as - Read". Changed capitalization of some other menu items. - (control_activate): Put the message- and folder- related menu - items in new "Message" and "Folder" subtrees which are created in - the `' item created by the shell. - (control_deactivate): Updated accordingly. - (control_activate): Put the filter and vfolder editors, the mail - configuration and the "forget password" command into the - "settings" menu. - (control_deactivate): Updated accordingly. - - * mail-config-gui.c (transport_page_new): Add translation mark. - (service_page_new): Show the menu items before appending them. - (service_page_item_new): Use `GTK_FILL' for the "Detect supported - types..." button. - - * local-config.glade: Change the apply button into an ok button. - -2000-08-17 Peter Williams - - Implement filtering on demand. - - * folder-browser-factory.c (register_ondemand): New function. Callback - to put the filter-on-demand filters into the bonobo UIH; - (create_ondemand_hooks): New function. Read in our on-demand filters - and hook them into the UI. - (remove_ondemand_hooks): New function. Remove the hooks when done with - them. - (control_activate): Call create_ondemand_hooks() - (control_deactivate): Call remove_ondemand_hooks(); - - * mail-callbacks.c (run_filter_ondemand): New function. Callback - for running a filter on demand. - (filter_edit): Pass NULLs as the new arguments to rule_context_load. - - * mail.h: Prototype run_filter_ondemand(); - - * folder-browser.c (oc_destroy): New function. Iterator to destroy - an fb_ondemand_closure. - (folder_browser_destroy): Free the data associated with the ondemand - menu items. - (my_folder_browser_init): Clear the filter_ variables. - - * folder-browser.h: Two new members of FolderBrowser: filter_menu_paths, - a list of fb_ondemand_closures so that the menu items can be freed and - removed; and filter_context, a permanently loaded FilterContext for - running the ondemand filters. Prototype the new fb_ondemand_closure - structure. - - * mail-autofilter.c (filter_gui_add_from_message): Pass NULLs as the - new parameters to rule_context_load (we don't need to hook up ondemand - menu items...) - - * mail-tools.c (mail_tool_filter_get_folder_func): Rename from - get_folder_func() and make public so mail-callbacks.c:run_filter_ondemand() - can use it too. - (mail_tool_filter_contents_into): Use the new name of get_folder_func. - Pass NULLs as the extra arguments to rule_context_load. Pass the - extra source type to filter_driver_run (only use INCOMING). - - * mail-tools.h: Publicly prototype mail_tool_filter_get_folder_func() - - * mail-vfolder.c (vfolder_create_storage): Pass NULLs as the extra - arguments to rule_context_load. - - * message-list.c (message_list_init): Free our strdup'd uids when - the table model gets destroyed. - (nuke_uids): New function. Walk the tree nodes to free the uids. - (nuke_uids_cb): New callback for nuke_uids(); - - -2000-08-16 Richard Hult - - * mail-ops.c (cleanup_display_message): Use a configurable timeout. - - * mail-config.c (mail_config_set_mark_as_seen_timeout): New function - for the settable mark-as-seen timeout. - (mail_config_mark_as_seen_timeout): Likewise. - (mail_config_write): Write the timeout setting. - (config_read): Read timeout setting. - - * mail-config-gui.c (mail_config): Add option for the settable - mark-as-seen timeout. - (mail_config_apply_clicked): Likewise. - (timeout_changed): New function for the timeout setting. - -2000-08-16 Peter Williams - - * message-thread.c (walk_containers): More (default disabled) - mem debugging here. Fix the big leaks. - - * mail-format.c (get_url_for_icon): Copy the url_path so that - it can't get freed under us. - - * mail-threads.c (mail_operation_queue): Fix a leak. - - * mail-ops.c (mail_do_display_message): Fix another leak. - - * message-list.c (message_list_destroy): Remove the seen_id timeout - if necessary. - - * mail-local.c (mail_tool_local_uri_to_folder): Fix a leak. - - * session.c (auth_callback): Fix a leak. Almost seems as if - I've been using Purify... - - -2000-08-15 Peter Williams - - * message-thread.c (alloc_container): Add support for debugging - container allocations -- currently disabled. Make sure that - the g_strfreev works. - - * message-list.c (main_message_changed): Address bug #496 -- - possible race when forwading a message_changed event. - - * mail-threads.c (dispatch): Close the dispatch thread's half of - pipes when about to exit. - (mail_operations_terminate): Close the main thread's half of the - pipes when about to exit. - (all): Add i18n support. - - * mail-tools.c (all): Add i18n support. - - * mail-ops.c (transfer_messages): Generalize move_messages into - transfer_messages so that we can copy too. - (all): Add i18n supprt where appropriate. - - * mail-ops.h: Prototype the new mail_do_transfer_messages. - - * folder-browser-factory.c: Add a UI hook for copy_msg. - - * mail-callbacks.c (transfer_msg): Generalize move so that it supports - copy as well, and add a callback 'copy_msg'. - - * message-list.c (on_right_click): Add a right-click hook for Copy Message. - - * session.c (mail_request_dialog): Don't deadlock when in main thread. - -2000-08-14 Peter Williams - - * mail-threads.c (show_error): Fix the error dialogs. - (read_msg): Re-enable them. - - * mail-ops.c (do_scan_subfolders): Silence a compile warning. - -2000-08-13 Jeffrey Stedfast - - * mail-crypto.c (mail_crypto_openpgp_encrypt): Added support for - encrypting via PGP 5.0 - -2000-08-13 Ettore Perazzoli - - * mail-ops.c (cleanup_create_folder): Release the listener object - with `CORBA_Object_release()', not `CORBA_free()'. - -2000-08-13 Ettore Perazzoli - - * main.c (main): Set the signal handlers for `SIGSEGV' and - `SIGBUS' to the default ones. - -2000-08-13 Jeffrey Stedfast - - * mail-config.c (mail_config_write): Set config->configured to - TRUE - -2000-08-13 Ettore Perazzoli - - * mail-config-gui.c (mail_config_druid): Don't - `GDK_THREADS_ENTER()'/`GDK_THREADS_LEAVE()'. - -2000-08-13 Ettore Perazzoli - - * mail-threads.c (update_active_views): Just iterate through all - the controls, not just the active ones. - - * folder-browser-factory.c: Don't keep track of active controls. - Rather, keep track of all of them. - (folder_browser_factory_get_active_control_list): Removed. - (folder_browser_factory_get_control_list): New. - -2000-08-13 Dan Winship - - * Makefile.am (evolution_mail_SOURCES): add mail-local.h - -2000-08-13 Ettore Perazzoli - - * mail-threads.c (read_msg): For now, don't do anything about - errors. - -2000-08-13 Dan Winship - - * mail-format.c (add_url): Fix some freed-memory references - - * mail-threads.c (get_password): Don't free the prompt. It - doesn't belong to you. - -2000-08-13 Ettore Perazzoli - - * mail-ops.c (mail_do_create_folder): Duplicate the listener - object. - (cleanup_create_folder): Free the listener. - -2000-08-13 Jeffrey Stedfast - - * mail-threads.c (get_password): Don't wrap the gnome_dialog_run - in GDK_THREADS_ENTER/LEAVE - -2000-08-13 Ettore Perazzoli - - * folder-browser-factory.c (control_destroy_cb): Remove the - control from the active control list, if it's there. - - * mail.h (folder_browser_factory_new_control): Removed prototype. - (folder_browser_factory_init): Removed prototype. - - * folder-browser-factory.h: New. - - * folder-browser-factory.c: New static variable `active_controls', - list of the currently active controls. - (control_activate): Add the control to it. - (control_deactivate): Remove the control from it. - (folder_browser_factory_get_active_control_list): New. - - * mail-threads.c (mail_operations_get_status): New function. - - * folder-browser.c (folder_browser_gui_init): Add i18n support for - the labels. - - [The following is actually from a patch by Peter Williams - .] - - * Removed types `PERCENTAGE', `HIDE_PBAR', `SHOW_PBAR'. New - struct `block_info_s'. Removed all the code to create and destroy - the progress window. - -2000-08-13 Jeffrey Stedfast - - * component-factory.c (create_news_storage): Updated to reflect - changes to mail_do_scan_subfolders - (create_imap_storage): Same. - - * mail-ops.c (mail_do_scan_subfolders): No longer takes an - add_INBOX argument - -2000-08-13 Dan Winship - - * mail-ops.c (do_scan_subfolders): Lose a reference to the store - on purpose. To be fixed later. - -2000-08-12 Dan Winship - - * component-factory.c (create_imap_storage): Take the source as a - command-line argument rather than fetching it from mail-config. - (owner_set_cb): Call create_imap_storage on each configured IMAP - store. - - * mail-format.c (decode_pgp): Redo this so that the lock icon - remains active after a failed decryption so you can click on it - and try again. - (try_inline_pgp, handle_multipart_encrypted): Put a border around - the decrypted data. - - * message-list.c (cleanup_regenerate_messagelist): Don't clear the - tree here. If two "folder_changed"s arrive in close succession, - then one possible ordering of events is - cleanup_regenerate_messagelist, cleanup_regenerate_messagelist, - cleanup_thread_messages, cleanup_thread_messages. Which would - result in the message list being filled in twice without being - cleared in between. So don't clear it until the rebuilding - function itself is called. - (clear_tree): New function to empty out the ETreeModel in the - message list. - (build_tree): Change to simpler interface. Call clear_tree. - (build_subtree): Does most of the work of the old build_tree - (build_flat): Remove unused arg. Call clear_tree. - - * message-thread.c (cleanup_thread_messages): Update for - build_tree interface change. - - * mail-ops.c (do_send_mail): Don't leak the transport. - - * mail-tools.c (mail_tool_get_folder_from_urlname): Don't ref the - store returned from camel_session_get_store. It's already reffed. - (mail_tool_get_root_of_store): Ditto. - (mail_tool_send_via_transport): Remove some commented-out code and - fix it to not leave the transport connected if sending fails. - - * mail-callbacks.c (delete_msg): Toggling a flag is an - "instantaneous" operation, so if we're only doing one, just do it - and return, rather than queueing it for the other thread. This - makes the "Delete" key work correctly (move to the next message) - again. - - * mail-identify.c: Remove workaround for gnome-vfs 0.2 bug. - - * mail-format.c (lookup_handler): Remove workaround for function - introduced between gnome-vfs 0.2 and 0.3, since we depend on 0.3 - now. - -2000-08-12 Michael Meeks - - * main.c (main): kill using_oaf assertion. - -2000-08-11 Peter Williams - - * Makefile.am: Make it so that test-mail links - -2000-08-11 JP Rosevear - - * folder-browser-factory.c (control_activate): Move menu items - that affect a single message together, ditto with ones that - affect multiple messages, put a separator in. - -2000-08-11 Christopher James Lahey - - * mail-format.c, mail-tools.h, message-list.c: Fixed a warning. - -2000-08-11 Dan Winship - - * mail-display.c, mail-format.c: Redo this again. Get rid of - struct mail_format_data and move most of that info into - MailDisplay itself, and pass the MailDisplay around. Add a GData** - to MailDisplay, and put the urls hash table into that. Also add - the ability to redisplay the currently-displayed message (with the - same GData**), and add a "show_pgp" datum to it that controls - whether or not to decrypt PGP messages, and redo the PGP stuff - (again) to take that into account. Now you don't get the annoying - PGP password dialog box without any warning. - -2000-08-11 Peter Williams - - * mail-config-gui.c (service_acceptable): Make verify-service - an asynchronous operation. - - * Makefile.am (noinst_PROGRAMS): Don't build test-thread - while mail-threads.c is in flux. - - * mail-threads.c (mail_operation_queue): Make the error - and query dialogs modal. - - * mail-local.c (update_progress): Don't use the - temporarily-disabled mail_op_set_percentage(). - -2000-08-11 Chris Toshok - - * mail-config.c (mail_config_get_default_news): use config->news - instead of config->sources. - -2000-08-11 Dan Winship - - * mail-format.c (destroy_part): Update this for CamelObject - (try_inline_pgp): Deal with decrypting here rather than trying to - pawn the data off to handle_multipart_encrypted, since it most - likely won't be correct (won't have the proper MIME headers inside - the encrypted part). - (handle_multipart_encrypted): Add code from Nathan Thompson-Amato - to re-MIME-parse the decrypted data after decrypting. - - * mail-crypto.c (mail_crypto_openpgp_{de,en}crypt): Get the - password here rather than having it passed in. Remove some dead - code. - - * session.c (mail_request_dialog): Allow this to work in either a - sync or an async context. - -2000-08-11 Peter Williams - - * mail-tools.c (mail_tool_fetch_mail_into_searchable): Don't - do the imap check here... it's a silly place. - - * mail-ops.c (do_fetch_mail): Do the imap check here. - -2000-08-11 JP Rosevear - - * mail-config-gui.c (service_page_new): Work around - gtk option menu bug. - (service_page_item_auth_fill): ditto - -2000-08-11 Peter Williams - - * mail-threads.c (read_msg): Fix the new FORWARD_EVENT handler - (didn't free msg, didn't write newline in the debug) - - * mail-local.c (local_reconfigure_folder): Make the dialog - modal. - - * mail-callbacks.c (select_first_unread): Fix some warnings. - - * mail-threads.c (mail_op_forward_event): New function that - writes a FORWARD_EVENT signal to the compipe, to allow Camel - events to be handled in the main thread. - (read_msg): Handle a FORWARD_EVENT. - - * mail-callbacks.c (select_first_unread): Forward the - event into the main thread to prevent the GTK calls in the - dispatcher thread. - (main_select_first_unread): New name of old select_first_unread. - - * message-list.c (folder_changed): Same as above. - (main_folder_changed): Same as above. - (message_changed): Same as above. - (main_message_changed): Same as above. - - * mail-format.c (free_byte_array): Note about using - mail_op_forward_event. (cmm_destroyed): Same. - -2000-08-11 Dan Winship - - * message-list.c (message_list_select): If the caller passes "-1" - for the model row, translate that to view row 0. - - * message-list.c (idle_select_row): - * mail-callbacks.c (select_first_unread): Use new - message_list_select kludge^H^H^H^H^H^Hfeature - -2000-08-11 JP Rosevear - - * mail-config-gui.c (source_dialog): Allow the window - to be growable - - * mail-config.c: use void in empty declarations - -2000-08-11 Peter Williams - - * mail-config.c (mail_config_get_news): Change () to (void) - if a function takes no arguments. - - * mail-config.h: Prototype mail_config_get_{sources,news}x - -2000-08-11 JP Rosevear - - * mail-config-gui.c (identity_dialog): iddialog, not sdialog - (news_edit_clicked): Kill leftover c-p crud - -2000-08-11 JP Rosevear - - * mail-config-gui.c (news_edit_clicked): Check nrow, not srow. - -2000-08-11 JP Rosevear - - * mail-config-gui.c (service_acceptable): Use camel_object_unref - instead of gtk_object_unref - (mail_druid_finish): Use new config accessors - (mail_config_druid): No need to call config functions - (news_add_clicked): Increments maxnrow, not maxsrow - (mail_config_apply_clicked): Use new config accessors - (mail_config): ditto - - * component-factory.c (create_imap_storage): Use new - config accessors - (create_news_storage): ditto - - * mail-config.glade: Set news clist name correctly - - * mail-config.c (config_read): Rename from mail_config_read and - made private - no one should need to do a read manually. - (mail_config_set_send_html): New accessor - (mail_config_add_identity): ditto - (mail_config_get_sources): ditto - (mail_config_add_source): ditto - (mail_config_get_default_news): ditto - (mail_config_get_news): ditto - (mail_config_add_news): ditto - - * mail-config.h: Prototype new accessors. Config struct is now - in mail-config.c and hidden from the world. - -2000-08-11 Dan Winship - - * mail-ops.c (describe_fetch_mail): Use camel_service_get_name - rather than showing the URL to the user. - -2000-08-11 Peter Williams - - * mail-ops.c (do_refile_messages): Freeze the folders while moving. - (do_flag_messages): Same. - - * mail-threads.c (get_password_clicked): Fix the case when the - user /doesn't/ use escape to cancel the dialog :-/ - (show_error_clicked): Same. - -2000-08-11 Dan Winship - - * mail-tools.c (mail_tool_get_folder_name): Add a function to - return a useful name for a folder (not just "mbox" or "mh" for - any local folder.) - - * mail-ops.c: Use mail_tool_get_folder_name rather than - folder->full_name when printing folder names. - -2000-08-11 Not Zed - - * mail-tools.c (mail_tool_get_local_inbox_url): Properly handle - different local file formats. The folder isn't always mbox. - (mail_tool_do_movemail): Movemail always uses an mbox format - however. - (mail_tool_get_local_movemail_url): What is the mbox url, it is - always the same type, mbox. - (mail_tool_fetch_mail_into_searchable): Same here. - - * mail-local.c (mail_local_map_uri): Map a local uri to the real uri. - -2000-08-10 Christopher James Lahey - - * folder-browser-factory.c, message-list.c, message-thread.c, - session.c: Fixed some warnings. - -2000-08-10 Dan Winship - - * session.c (session_init): Don't call e_setup_base_dir. It was - wrong and it doesn't exist any more. - - * component-factory.c (owner_set_cb): Update for changed - prototype, and record the evolution_homedir. Move call to - mail_config_init here from session.c so it happens after - evolution_dir is initialized. - - * mail.h: define "extern char *evolution_dir;" (formerly in - e-util/e-setup.h) - - * component-factory.c, mail-callbacks.c, mail-config-gui.c, - mail-config.c, mail-display.c, mail-format.c, mail-ops.c, - mail-tools.c, session.c: Remove "e-util/e-setup.h" include. - -2000-08-10 Peter Williams - - * test-thread.c (queue_ops): Use mail_operations_terminate() to - close the other thread nicely. - - * mail-threads.c (get_password_deleted): Handle the "close" event - as a cancel. - (show_error): Same. - -2000-08-10 Dan Winship - - * mail-tools.c (mail_tool_get_folder_from_urlname): Add a - "gboolean create" argument to pass to camel_store_get_folder. - - * mail-ops.c (do_create_folder, do_setup_draftbox): - * mail-local.c (mail_tool_local_uri_to_folder): - * mail-vfolder.c (vfolder_uri_to_folder): Add create flag to - mail_tool_get_folder_from_urlname calls. - -2000-08-10 Jeffrey Stedfast - - * mail-callbacks.c (composer_send_cb): Fix compile warning by - casting the object to a CamelObject - -2000-08-10 Peter Williams - - * mail-tools.c (mail_tool_filter_contents_into): Delete the source - folder if told to and if it's empty - (mail_tool_get_local_movemail_path): New function. - -2000-08-10 Dan Winship - - * mail-callbacks.c (reply_to_all): Fix a bug in the async changes. - (This was identical to reply_to_sender.) - -2000-08-10 Not Zed - - * mail-local.c (do_local_reconfigure_folder): Update for - append_message api change. - - * message-list.c (message_list_regenerate): Change for search api - change. - (ml_tree_value_at): Add a colour column, based on the colour - assigned in the summary. - (message_list_init_renderers): Init colour column. - -2000-08-09 Peter Williams - - * mail-display.c (part_for_url): Remove a gtk_object_get_data - -2000-08-09 Cody Russell - - * folder-browser-factory.c, mail-view.c: Make the toolbars - honor the user's gnomecc settings for detachable toolbars. - -2000-08-09 Jeffrey Stedfast - - * mail-ops.c (composer_send_cb): Get the from address set in the - composer, if that fails ONLY THEN get the default from mail config - - * mail-config.c (mail_config_get_identities): New convenience - function for getting a list of the configured identities - -2000-08-09 Dan Winship - - * mail-display.c (on_object_requested): Support controls as well - as embeddables. - -2000-08-09 Jeffrey Stedfast - - * mail-view.c (mail_view_create): Changed to only take a - FolderBrowser argument - - * mail-ops.c (real_view_msg): Create a new FolderBrowser for each - message being opened in a new window. Also set the - message_list->cursor_uid and mail_display->current_message to the - appropriate values. - (real_view_msg): Updated to reflect changes in the mail_view_create - - * message-list.c (on_right_click): Nicify a little, add in a menu - separator between VFolder and Filter stuff. - - * mail-ops.c (real_view_msg): Set the UID of the message that is - being displayed - -2000-08-09 Ettore Perazzoli - - * folder-browser-factory.c (control_activate): Use - `GNOME_STOCK_MENU_*' things instead of `GNOME_STOCK_PIXMAP_*' - things, that are too big and look bad. - -2000-08-09 Peter Williams - - * mail-view.c (mail_view_create): Save the top window so that on_close - can find it [with set_data]. - (on_close): Recover the top window. - - * mail-threads.c (read_msg): Destroy the window instead of hiding it. - -2000-08-09 Not Zed - - * mail-autofilter.c (filter_gui_add_from_message): Helper function - to add with confirm. - (rule_match_recipients): Dont set real name if its empty for the - filter name. - (rule_match_subject): was cutting ] off mailing list names. - - * message-list.c (on_right_click): Added menu to install - vfolders/filters from message. - -2000-08-09 Not Zed - - * mail-autofilter.c: New file to hold auto filter/vfolder stuff. - -2000-08-09 Christopher James Lahey - - * mail-display.c, mail-format.c, mail-ops.c: Fixed some warnings. - - * message-list.c: Fix the call to e_popup_menu_run to match the - new signature. - -2000-08-09 Ettore Perazzoli - - * folder-browser-factory.c (control_activate): Create a "print - message" menu item. - -2000-08-09 Jeffrey Stedfast - - * message-list.c (message_list_init): Attached a double_click - signal handler - (on_double_click): Our lovely new double_click callback. Will - display the current selected message in a new window - -2000-08-08 Jeremy Wise - * mail-config.[ch], folder-browser.c: Added configuration work to - save the size of the vpaned widget. It will be functional when the - e_paned widget emits a "resized" signal - -2000-08-08 Jeffrey Stedfast - - * mail-config.h: Added void as an argument to functions not - needing any parameters to avoid compile warnings. - -2000-08-08 Jeremy Wise - * mail-config.[ch], main.c, folder-browser-factory.c: State of the - threaded list toggle is now saved via gnome_config - -2000-08-08 Dan Winship - - * mail-config-gui.c (service_page_item_new): Attach a signal - handler to call the "changed" function when the user clicks the - "keep on server" checkbox. - -2000-08-08 Jeffrey Stedfast - - * mail-ops.c (view_msg): New convenience function with params of a - normal Gtk callback function. We also now create a new - FolderBrowser object so that the message-view window isn't tied to - the display in the main window - (view_message): Now calls view_msg (this function is a bonobo - callback and can't be used with gtk widgets) - (edit_msg): Same idea as view_msg() - (edit_message): Again, same as view_message() - - * message-list.c (on_right_click): Callback for creating an - e-popup-menu - (message_list_init): Added a right_click event to trigger a pop-up - menu to be displayed - -2000-08-08 Dan Winship - - * mail-config-gui.c: Add "Don't delete messages from server" - button to remote SOURCEs that aren't STORAGEs (ie, POP). - (provider_list): Only list SOURCEs. (ie, not mh) - - * mail-config.c: Save/load "keep_on_server" flag. - - * mail-ops.c (fetch_remote_mail): New function, split out of - real_fetch_mail. Deals with copying mail from a remote server into - a temporary mbox, possibly using a CamelUIDCache to leave the - messages on the server. - - * mail-crypto.c, mail-format.c, message-thread.c: Fix some - compiler warnings. - - * mail-format.c (mail_generate_reply): Fix up format of addresses. - (write_headers): Use CamelAddress functions to simplify this. - -2000-08-08 Jeffrey Stedfast - - * mail-view.c: Lets get rid of the last separator in the toolbar - until we add n/p - -2000-08-08 Ettore Perazzoli - - * mail-threads.c (queue_window_delete_event_cb): Callback for - "delete_event", just doing nothing. - (create_queue_window): Connect it to the "delete_event" signal of - the progress dialog. - -2000-08-08 Peter Williams - - * mail-threads.c (remove_next_pending): Sanity check for - job queue, which seems to have some issues. - (read_msg): Make sure that the next operation isn't started - before the last one is cleaned up. - - * mail-callbacks.c (fetch_mail): Fix erroneous free. - - * mail-config-gui.c (mail_config_druid): Wrap the gtk_main call. - - * mail-ops.c (do_flag_messages): Allow specification of whether - to set the flags unconditionally or toggle their current state. - - * message-list.c (ml_tree_set_value_at): Toggle the seen status; - don't set it unconditionally. - - * mail-callbacks.c (delete_msg): Toggle the deletion status; - don't set it unconditionally. - - * mail-tools.c (mail_tool_do_movemail): Fix for undeclared tmpfd. - - * mail-local.c (local_reconfigure_folder): Big rewrite; make into - an asynchronous operation. Use some mail tools to make life easy. - -2000-08-08 Dan Winship - - * main.c (main): Move mail_config_init after session_init, since - it depends on evolution_dir being set. - -2000-08-08 JP Rosevear - - * mail-ops.c (check_configured): Use config accessors - (fetch_mail): ditto - (composer_send_cb): ditto - (create_msg_composer): ditto - - * mail-config-gui.h: Update API - - * mail-config.h: Update API - - * mail-config.c: Add accessor functions - (mail_config_is_configured): accessor function - (mail_config_get_default_identity): ditto - (mail_config_get_default_source): ditto - (mail_config_get_transport): ditto - (mail_config_send_html): ditto - (identity_copy): Make public - (identity_destroy): ditto - (identity_destroy_each): ditto - (service_copy): ditto - (service_destroy): ditto - (service_destroy_each): ditto - (mail_config_init): Rename from init_config and make public - (mail_config_clear): Rename from clear_config and make public - (mail_config_read): Rename from read_config and make public - (mail_config_write): Reanme from write_config and make public - - * main.c (main): Call mail_config_init. - - * mail.h: Include mail-config-gui.h - - * mail-config-gui.c: Move config gui stuff here. - (source_dialog): Kill memory leak from debug leftovers. - Make sure returned source is NULL by default - -2000-08-07 Not Zed - - * mail-local.c (local_reconfigure_folder): Redone to show a - dialogue first, and show progress of whats happening as its done. - - * Makefile.am (glade_DATA): Added local-config.glade, for mailbox - reconfig dialogue. - -2000-08-04 Not Zed - - * folder-browser.c (mail_uri_to_folder): Use local_uri_to_folder() - for local uri's (file://). - - * mail-local.c (local_uri_to_folder): Handle looking up folder - storage type before opening the store/folder. - (local_reconfigure_folder): Function to reconfigure the format of - a local mailbox into another storage format. - - * Makefile.am (evolution_mail_SOURCES): Added mail-local.c and - missing mail-vfolder.h. - -2000-08-07 Jeffrey Stedfast - - * Makefile.am: Added mail-view.c - - * folder-browser-factory.c (control_activate): Adda menu item for - viewing the message - - * mail-view.c: New file containing methods for viewing messages in - separate windows - - * mail-ops.c (view_message): New callback for viewing messages in - a new window. - -2000-08-07 Jeffrey Stedfast - - * component-factory.c (real_create_generic_storage): New function - to replace real_create_imap_storage and real_create_news_storage - (create_imap_storage): Updated. - (create_news_storage): Updated. - -2000-08-07 Peter Williams - - * mail-ops.c (cleanup_edit_messages): New operation: edit_messages - For continuing draft messages. - (attach_messages): Fix accidental 0 datasize. - (do_setup_draftbox): New operation: setup_draftbox. Soooo hacky. - - * mail-callbacks.c: Move fejj's edit message to the async home. - - * component-factory.c (owner_set_cb): Use mail_do_setup_draftbox. - - -2000-08-07 Jeffrey Stedfast - - * mail-display.c: - * component-factory.c: s/strncasecmp/g_strncasecmp - - * mail-format.c (write_headers): Get rid of kludge around subject - beginning with spaces. - (mail_generate_reply): Get rid of kludge around subject beginning - with spaces and also use g_strncasecmp instead of strncasecmp for - portability - - * mail-ops.c (forward_msg): Get rid of kludges around subject - beginning with spaces. - -2000-08-07 Dan Winship - - * message-list.c (message_list_select): Clarify that the input row - is a model row, and swap it to a view row when finding the - next/previous row. - (idle_select_row): Select view row 0, not model row 0. - - * mail-ops.c (select_first_unread): Start from view row 0, not - model row 0. - -2000-08-07 Jeffrey Stedfast - - * mail-format.c (mail_get_message_body): Renamed from reply_body() - so other functions can use it - (mail_generate_reply): Updated to reflect function name changes - - * mail-ops.c (real_edit_msg): Attach a callback to the send signal - -2000-08-07 Jeffrey Stedfast - - * folder-browser-factory.c (control_activate): New menu item under - Actions to allow editing of messages. - - * mail-ops.c (edit_message): New function for editing messages. - - * component-factory.c (owner_set_cb): Create a global reference to - the Drafts mbox folder for the Composer to use - -2000-08-06 JP Rosevear - - * mail-config.c (ndialog_page_undone): Desensitize ok button - (sdialog_page_undone): ditto - (iddialog_page_undone): ditto - (news_page_new): Typo - news, not mail - (transport_page_new): Typo - transport, not source - (identity_dialog): Set undone callback - (source_dialog): ditto - (news_dialog): ditto - (mail_druid_identity_undone): Desensitize next button and - mark done flag as false - (mail_druid_source_undone): ditto - (mail_druid_transport_undone): ditto - (mail_druid_identity_done): Mark done flag as true - (mail_druid_source_done): ditto - (mail_druid_transport_done): ditto - (mail_druid_prepare): Use done flag to set next button - sensitivity, fixes #467 - -2000-08-06 Jeffrey Stedfast - - * mail-crypto.c (mail_crypto_openpgp_encrypt): Added support for - encrypting with GnuPG. Support for PGP5 and PGP2 are still in - progress. - -2000-08-05 Dan Winship - - * folder-browser-factory.c (control_activate): Remove bonobo 0.15 - vs 0.15-and-a-half ifdef, since we require post-0.16 now. - -2000-08-04 Dan Winship - - * mail-threads.c (mail_operation_wait_for_finish): Don't use - "while (gtk_events_pending ()) gtk_main_iteration ();" inside - another tight loop, because it makes the thread spin rather than - blocking and waiting like it should. - -2000-08-04 Peter Williams - - * message-thread.c (do_thread_messages): Uninitialized variable - fix. - - * mail-threads.c (read_msg): Small leak fix. - - * component-factory.c (owner_unset_cb): Use mail_operations_ - terminate() instead of wait_for_finish(). - - * mail-threads.c (mail_operation_queue): Centralize the clur - handling functions; fix a race condition where the dispatcher - would overwrite the closure before the main thread could - free the old one. - (mail_operations_terminate): New function, wait for ops to - finished and kill the other thread. - (dispatch): changes to die when terminate is called (abort - on NULL spec). - - * mail-ops.c (cleanup_display_message): Fix improper handling - of displaying a NULL message (which means clear the message - display). - -2000-08-04 Ettore Perazzoli - - * message-list.c (message_list_regenerate): Free the GPtrArray - correctly instead of using `g_strfreev()'. - -2000-08-04 Michael Meeks - - * folder-browser-factory.c (control_activate): release the ui_handler - after set_container. - -2000-08-03 Michael Meeks - - * mail-config.c (identity_page_new): only whack the sig in if the - file exists. - - * component-factory.c (factory_fn): count running instances, - attach destroy signal (factory_destroy): add. - - * main.c (main): pass orb around. - -2000-08-03 Jeffrey Stedfast - - * mail-ops.c (composer_send_cb): Yay, no more compiler warnings - - * mail-config.c: set config = NULL - (provider_list) Eek! Initialize news to NULL! Also, use - g_slist_prepend() for "performance" gains ;-) - (init_config): Set the config member data to NULL just to be on - the safe side - (clear_config): Don't bother freeing slist data if the slist is - NULL - -2000-08-03 Peter Williams - - * mail-ops.c (op_forward_messages): Use the new dynamic - operation naming. - - * message-thread.c (describe_thread_messages): Ditto. - - * message-list.c (describe_regenerate_messagelist): Ditto. - - * mail-threads.c (get_password_clicked): Dynamic generation - of descriptive text for mail operations. "Opening a folder" -> - "Opening INBOX". Supported only so far, will be implemented - quickly. - g_strdup() the old_message when changing the queue_window_label's - text. - - * main.c (main): One more gconf reference to take out... - - * mail-ops.c (composer_send_cb): Check for an identity before - sending. - -2000-08-03 JP Rosevear - - * mail-config.glade: Increase window size slightly, rename - "Transport" to "Mail Transport" - - * mail-config.c (init_config): Remove gconf references - (clear_config): ditto - (read_config): ditto - (write_config): ditto - (mail_config): Null provider lists before filling them - (mail_config_druid): ditto - (identity_page_new): Increase spacing of vbox - (service_page_new): ditto - - * Makefile.am: Remove gconf references. - -2000-08-02 Dan Winship - - * mail-config.c (service_page_item_new): Make the "test settings" - button FILL rather than SHRINK so it doesn't end up oddly-placed. - - * mail-config-druid.glade: Make the icon background dark blue - like the surrounding area. - -2000-08-02 Peter Williams - - * component-factory.c (owner_unset_cb): Wait for async operations - to finish before exiting. - -2000-08-02 Christopher James Lahey - - * mail-ops.c, message-list.c: Emit "model_pre_change" where - appropriate. - -2000-08-02 Peter Williams - - * mail-config.h: #ifdef _MAIL_CONFIG_H protect the header. - -2000-08-01 Peter Williams - - * mail-threads.c: Implement Solaris threads. Attempt - to join to the thread upon exit -- hopefully prevents - all those nasty zombie processes from popping up :-( - -2000-08-01 Dan Winship - - * mail-crypto.c: New code to spawn off GPG/PGP to do stuff. - Currently only deals with decryption. From Nathan Thompson-Amato - , with bunches of changes from me. - - * session.c (mail_request_dialog): Expose the password dialog to - the rest of the app (for use by the GPG/PGP code). - - * mail-format.c (handle_text_plain): Handle special inline data - types. (Currently uuencoding, BinHex, and PGP encryption.) This is - not the best way to deal with it, but it works for now. - (try_inline_pgp): Convert an inline PGP-encrypted message into a - multipart/encrypted part. - (try_inline_binhex): Convert an inline BinHex attachment into an - application/mac-binhex40 part (which we currently don't deal - with...) - (try_uudecoding): Convert a uuencoded attachment to an - application/octet-stream part. - (handle_multipart_encrypted): Deal with RFC2015 MIME-encoded PGP - encrypted messages. (From ndt.) - - * mail-display.c (mail_text_write, mail_error_write): New utility - functions. - - * Makefile.am (evolution_mail_SOURCES): add mail-crypto.c - -2000-07-31 Christopher James Lahey - - * component-factory.c, folder-browser.c: Fixed some warnings. - - * message-list.c: Made the icon column non sortable. - -2000-07-31 Dan Winship - - * mail-config.c (service_page_set_url): Fix a NULL-pointer strcmp - noticed by peterw. - -2000-07-31 Not Zed - - * mail-vfolder.h: Header for vfolder functions. - - * folder-browser.c (mail_uri_to_folder): Use new scheme to open - vfolders. - (search_save): New button/function to save a search as a vfolder. - - * mail-vfolder.c (vfolder_edit): Made asynchronous. - (vfolder_uri_to_folder): New function for loading vfolders and - setting up their source folders. - (vfolder_refresh): Change shell vfolder uri's to indirect - references rather than the real vfolder uri. - (vfolder_gui_add_rule): Add a rule with user confirmation. - (vfolder_create_part): Get a new part by name, for creating rules - in code. - - * message-thread.c (thread_messages): Check for uid lookup - failure, which indicates an error in the folder or calling code. - -2000-07-29 Not Zed - - * component-factory.c (create_view): Remove hack to pass the - storage around. - - * folder-browser-factory.c (control_activate): Changed to call - renamed vfolder editor. - - * mail-ops.c (vfolder_edit_vfolders): renamed from vfolder_edit, - call new edit function. - (vfolder_editor_clicked): Removed. - (filter_druid_clicked): - (filter_edit): Updated for api change. - (real_fetch_mail): Fixed up for api change and fucked up indent. - (filter_get_folder): callback for filter driver. - - * mail-vfolder.c: New file to manage virtual folders. - -2000-07-29 JP Rosevear - - * mail-format.c (mail_generate_reply): Use new mail config stuff - - * component-factory.c (create_imap_storage): Use new mail config - stuff - (create_news_storage): ditto - - * evolution-mail.schemas: Gconf schema for evolution mail - - * mail-config-druid.glade: Gladification of config druid - - * mail-config.h: New header with config structs. - - * mail-config.c: Rewrite of GUI configuration tools to use - new config structs. Stores multiple identities and sources now. - Still only uses the first one found. - (mail_config_fetch): Returns MailConfig struct to caller - for configuration queries. - (mail_config): Renamed function to show mail config dialog. - (mail_config_druid): Renamed function to show mail config druid. - - * mail-ops.c (create_msg_composer): Use - e_msg_composer_new_with_sig_file and new config stuff - (check_configured): Use new config stuff - (fetch_mail): ditto - (composer_send_cb): ditto - -2000-07-28 Cody Russell - * mail-ops.c, mail.h: Added mark_all_seen(), to mark every - message in the list with CAMEL_MESSAGE_SEEN. - - * folder-browser-factory.c: Added "Actions/Mark all seen". - -2000-07-27 Jeffrey Stedfast - - * mail-config.c: Lets fix Dan's kludge the Right Way (tm) - (set_service_url): Only strip off the leading "/" from the - url->path if url->host is NULL - (get_service_url): Only prepend a leading "/" to the path if the - host is NULL - -2000-07-27 Dan Winship - - * mail-config.c (get_service_url): toss in a kludge to deal with - the IMAP vs mbox path problem for now. - -2000-07-26 Christopher James Lahey - - * message-list.c, message-list.h: Removed counting of selected - messages. - -2000-07-26 Dan Winship - - * mail-ops.c (real_fetch_mail): Don't create the tmp_mbox before - calling movemail, because the external movemail requires it to not - exist. Contrariwise, delete it in the cleanup code if it's empty. - Update for camel_movemail interface change. Do the "No new - messages" dialog in the mbox case as well as the remote mail - issue. - -2000-07-26 Jeffrey Stedfast - - * mail-ops.c: s/struct refile_data/struct move_data - (real_move_msg): Renamed from real_refile_msg() - (move_msg): Renamed from refile_msg() - - * folder-browser-factory.c: Changed Refile to Move. - -2000-07-26 Dan Winship - - * mail-format.c (lookup_handler): Update for OAF and for external - apps as well as components. - (handle_via_external): Handler to set up for data that can be - displayed by an external application. - - * mail-display.c (on_link_clicked, etc): Refactor the save_data() - code and add launch_external() as a handler for - x-evolution-external URLs. - (embeddable_destroy_cb): Remove this, since it seems like it's all - wrong. - (on_object_requested): Update for OAF, and fix some bugs. - -2000-07-25 Jeffrey Stedfast - - * mail-config.c (get_service_url): Always prepend a leading "/" to - the url->path. - (set_service_url): Added more error checking and also strip the - leading '/' from the url->path - (create_identity_page): Set the signature file to the one specified in - the identity record, else set the default path to ~/.sugnature - -2000-07-25 Michael Meeks - - * mail-config.c (create_identity_page): set default signature to - ~/.signature - -2000-07-25 Peter Williams - - * mail-ops.c (reply): Check for the case of fb->mail_display-> - current_message = NULL, which shouldn't happen, but has happened - to me. - -2000-07-25 Dan Winship - - * message-thread.c (group_root_set): Don't group together messages - with the same non-Re: subject and no References/In-Reply-To. More - often than not, they're unrelated. (eg, "[No subject]".) - (thread_messages): Handle messages with no Message-Id. "This - shouldn't happen", but it does sometimes, and it's not much code - to make it just work. - -2000-07-25 Ettore Perazzoli - - * mail-config.c (create_service_page): Call - `gtk_option_menu_set_menu()' as the last thing, as `GtkOptionMenu' - is fscking broken. Also, `gtk_widget_show()' the individual menu - items. - -2000-07-24 Dan Winship - - * message-list.c (mark_msg_seen, ml_tree_set_value_at, - message_list_regenerate): Update for CamelFolder API changes. - (Certain functions no longer take a CamelException.) - - * mail-ops.c (real_fetch_mail, real_send_mail, real_delete_msg): - ditto - - * component-factory.c (real_create_imap_storage, - real_create_news_storage): ditto - -2000-07-24 Dan Winship - - * component-factory.c, folder-browser-factory.c, test-mail.c: - Remove GOAD support. - - * main.c: Remove GOAD support. - (main): More "guess the build mistake" fun, this time for the - failure to initialize Bonobo case. - -2000-07-24 Peter Williams - - * mail-tools.c (mail_tool_set_uid_flags): Change - function to faithfully pass parameters to - camel_folder_set_message_flags; this function is - somewhat useless now. Other files synced with - API change. - - * mail-ops.c (op_display_message): Change "display - a message" into "retrieve a messsage" in the - description of mail_op_display_message. - - * mail-threads.c (display_timeout): New function. - Only display the progress dialog if the operation - takes more than a second to perform. - (hide_queue_window): New function. Hide the queue - window as an idle function... I'm thinking maybe - the problem with hiding it was due to us not - being in a GTK event sequence? Perhaps it's only - the timeout, which was not being cancelled, which - is now. - - * message-list.c (get_message_uid): New function, - copy of get_message_info, except gets only the - UID, as that's all that most functions want, and - we avoid a Camel call. - -2000-07-23 Ettore Perazzoli - - * mail-ops.c (create_message_composer): New. - (compose_msg): Use it. - (send_to_url): Likewise. - (forward_msg): Likewise. - - * folder-browser-factory.c (control_activate): Use `_()' instead - of `N_()'. - -2000-07-21 Peter Williams - - * message-thread.c (setup_thread_messages): New - operation: thread_messages, simple wrapper around - thread_messages () and thread_messages_free(); - - * message-list.c (cleanup_regenerate_messagelist): - Use new thread_messages operation instead of just - calling ... thread_messages :-) - - * folder-browser.c (folder_browser_destroy): Use new - sync_folder operation instead of calling camel_folder_sync - directly. - - * component-factory.c (create_folder): Changed to use - new create_folder operation. - - * mail-ops.c (mail_do_create_folder): New operation: create - folder. New operation: sync folder. - - * mail-format.c (cmm_destroyed): Remove the url hashtable from - the larger hashtable when it gets destroyed. - - * mail-callbacks.c (fetch_mail): Pass a hook function and data - down the chain to pick up the folder_changed and change the view. - - * mail-ops.c: Rename from mail-ops-new.c now that it's a little more - solid. - (fetch_mail): Add new options to hook and unhook an event while the - filter driver runs. A hack, but all of the operations are to some - extent. - (cleanup_fetch_mail): Unref the destination folder if not NULL. - * mail-tools.c (mail_tool_filter_contents_into): Intermediate the - event hook/unhook hack here. - -2000-07-20 Peter Williams - - * mail-ops-new.c (setup_send_mail): Fix silly forgetting-to-ref - problem on some sends (when not replying). Note the early exit - path with a big comment. - - * message-list.c (message_list_set_folder): Don't call - folder_changed, call mail_do_regenerate_messagelist, as - the GDK_THREADS_ENTER in the former can deadlock us! - - * folder-browser.c (folder_browser_set_uri): Ah, screw it. - Make 'load folder' asynchronous and pretend that it always - succeeds. - - * mail-ops-new.c (mail_do_load_folder): New operation, loads - a folder into a FolderBrowser. - - * mail-threads.c (read_msg): Check if the exception is - a user cancel; don't complain if it is. - (mail_operation_queue): Same. - (dispatch_func): Same. - -2000-07-20 Peter Williams - - * mail-ops-new.c (cleanup_send_mail): Fix evil mistaken - unref. - - * test-thread.c: Fit the new mail_operation_spec prototype. - - * mail-callbacks.c (composer_send_cb): Hide the composer upon - start of send operation. - - * folder-browser.c: #include "mail-ops-new.h" - - * mail-threads.h: Change text fields of mail_operation_spec to - provide two forms of the name. - - * mail-threads.c: Use appropriate new string fields. - (dispatch_func): Hide the progressbar by default. - - * message-list.c (op_regenerate_messagelist): Fix the datasize from - 0 -> sizeof (regenerate_messagelist_data_t). Add the new gerund and - infinitive strings. - (do_regenerate_messagelist): Include some code that fell between the - cracks. - - * mail-ops-new.c (op_scan_subfolders): Same datasize fix for - scan_subfolders. - (op_forward_message): Same. - (all): Add new gerund and inifinitive strings for mail_operation_spec. - (cleanup_send_mail): Destroy the composer on success; re-show it on - error. I'm so clever! - -2000-07-20 Ettore Perazzoli - - * component-factory.c (factory_fn): Updated for the new - `evolution_shell_component_new()' arg. - -2000-07-19 Jeffrey Stedfast - - * message-thread.c (thread_messages): What if message info is NULL? - -2000-07-17 Peter Williams - - * component-factory.c (real_create_{imap,news}_storage): Instead of - directly calling evolution_storage_new_folder, queue up a list of - folders to register so that we don't do our CORBA in The Other Thread. - (create_{imap,news}_storage): Changes ancillary to the above. - (add_new_mailbox): New function to queue up a folder - (cleanup_create_info): New function to dequeue the folders and free mem. - - * test-thread.c: s,ENABLE_BROKEN_THREADS,USE_BROKEN_THREADS -- oops - - * mail-format.c: (mail_lookup_url_table): New function to get the url - table associated with a CamelMimeMessage because we can no longer - gtk_object_get_data on it. - - * mail-display.c: replace 'gtk_object_get_data( message, "urls" )' - with 'mail_lookup_url_table( message )' - -2000-07-16 Jeffrey Stedfast - - * folder-browser.c, component-factory.c: Initial code to support - IMAP folders that don't use "/" as a directory separator. - -2000-07-15 Ettore Perazzoli - - * mail-ops.c (set_x_mailer_header): New helper function to set the - `X-Mailer:' header to to `Evolution [Developer - Preview]". - (real_send_mail): Call it. - -2000-07-14 Peter Williams - - * message-list.c (message_list_set_folder): Ported to CamelObject: - GTK_OBJECT->CAMEL_OBJECT; gtk_signal_connect->camel_object_hook_event; - GDK_THREADS_ENTER/LEAVE around "changed" event hooks. - - * folder-browser.c (folder_browser_destroy): likewise. - (mail_uri_to_folder): likewise. - (folder_browser_load_folder): likewise. - -2000-07-14 Ettore Perazzoli - - * Makefile.am (evolution_mail_LDADD): Add `GCONF_LIBS'. - -2000-07-14 Dan Winship - - * mail-format.c (write_headers): put a

    at the end of the - header table. (I think there used to be whitespace after it, but - then some gtkhtml change got rid of it...) - (handle_text_plain): Don't do this

    . Instead, CONVERT_NL and
    -	CONVERT_SPACES and wrap it in . Now if the sender didn't
    -	include any newlines, it will be wrapped to the width of the
    -	window instead of extending off into infinity.
    -
    -2000-07-13  Dan Winship  
    -
    -	* message-list.c (message_list_destroy): Only unref the folder if
    -	it's been set.
    -
    -	* folder-browser.c (folder_browser_destroy): Only sync the folder
    -	if it's been set.
    -
    -2000-07-13  Jonathan Blandford  
    -
    -	* mail-config.c (create_transport):
    -	s/CAMEL_SERVICE_NEED_HOST/CAMEL_SERVICE_URL_NEED_HOST.
    -
    -2000-07-13  Dan Winship  
    -
    -	* mail-config.c (add_row): Add a "gboolean required" argument, and
    -	set its value on the entry.
    -	(create_source, create_transport): Create rows for URL elements if
    -	the URL ALLOWs them. Mark them required if it NEEDs them.
    -	(service_note_doneness): Only require the required fields to be
    -	filled in.
    -
    -	Now the IMAP config page allows the user to enter a path, but
    -	doesn't require it.
    -	
    -2000-07-13  Jeffrey Stedfast  
    -
    -	* mail-ops.c (real_fetch_mail): Back to the old way to avoid
    -	g_warnings, yay. Also fix append to send a flags argument (0)
    -
    -2000-07-12  Chris Toshok  
    -
    -	* mail-config.c (providers_config_new): fix some cut & paste bung.
    -
    -2000-07-12  Chris Toshok  
    -	
    -	* mail-format.c (setup_function_table): add "message/news" to the
    -	mime_function_table using the same handler as message/rfc822.
    -
    -2000-07-12  Chris Toshok  
    -
    -	* mail-config.glade*: add news server tab to dialog.
    -
    -	* mail-config.c (on_NewsServerConfigDialogButton_clicked): new function.
    -	(on_clistNewsServers_select_row): new function.
    -	(on_cmdNewsServersAdd_clicked): new function.
    -	(on_cmdNewsServersEdit_clicked): new function.
    -	(on_cmdNewsServersDelete_clicked): new function.
    -	(providers_config_new): mirror the source tab's code to fill in
    -	the news server tab.
    -	(write_config): save out the news server.
    -	(create_news_server_config_dialog): new function.
    -	(create_news_server_page): new function.
    -
    -2000-07-12  Peter Williams  
    -
    -	* mail-display.c (save_data): Change from evolution_dir to
    -	g_get_home_dir() for default location of save file.
    -
    -2000-07-11  Dan Winship  
    -
    -	* Update for CamelFolder API changes
    -
    -2000-07-11  Jeffrey Stedfast  
    -
    -	* mail-ops.c (real_fetch_mail): Changed to use 
    -	camel_folder_move_message_to () rather than get_message () and then
    -	append_message (). This also makes it so we don't have to worry about
    -	fetching message flags to pass to the new append_message () method.
    -
    -	* folder-browser.c (folder_browser_load_folder): Disable
    -	Search capability menu/entry if folder doesn't support it.
    -
    -	* message-list.c (message_list_regenerate): Don't perform
    -	a search if the folder doesn't support it.
    -
    -2000-07-11  Dan Winship  
    -
    -	* mail-ops.c (real_send_mail): Set the post_send_data flag rather
    -	than toggling it. (Maybe we'll need more control over it later,
    -	but for now, the only flag we set is "replied", and we want
    -	that set, not toggled.)
    -
    -2000-07-10  Dan Winship  
    -
    -	* folder-browser-factory.c (control_activate): Work with both
    -	current and 0.15 bonobo
    -
    -	* kill more debugging messages
    -
    -	* mail-ops.c (real_fetch_mail): Don't multiply free dest_url.
    -
    -	* message-list.c (message_list_select): Update
    -	message_list_select_next to do either next or previous.
    -
    -	* folder-browser.c (etable_key): Make 'n' and 'p' do next and
    -	previous unread message.
    -
    -	* mail-ops.c (select_first_unread): Update.
    -	(real_fetch_mail): clean up a bit.
    -
    -2000-07-10  Ettore Perazzoli  
    -
    -	* mail-ops.c (forward_msg): Initialize `fwd_subj' to NULL if
    -	`from' is NULL.
    -
    -2000-07-10  Jeffrey Stedfast  
    -
    -	* mail-ops.c (real_fetch_mail): Fixed broken POP fetching
    -
    -2000-07-10  Ettore Perazzoli  
    -
    -	* component-factory.c: Removed variable `browsers'.
    -	(create_view): Don't update it.
    -	(owner_unset_cb): Don't sync the folders here anymore, because at
    -	this point the folder browser is dead already so we cannot get a
    -	valid list of folders from it anymore.
    -
    -	* folder-browser.c (folder_browser_destroy): Sync the associated
    -	mailbox first.
    -
    -2000-07-10  Christopher James Lahey  
    -
    -	* message-list.c, message-list.h: Switched from ETable to
    -	ETableScrolled.
    -
    -2000-07-10  Jeffrey Stedfast  
    -
    -	* mail-ops.c (real_fetch_mail): Fixed movemail so that it too would
    -	deliver to Inbox.
    -
    -2000-07-09  Dan Winship  
    -
    -	* message-list.c (get_message_info): Don't g_warn if the user
    -	selects a fake tree parent.
    -	(message_list_select_next): Ignore fake rows
    -	(build_tree): Store the "root_subject" for fake rows
    -	(ml_tree_value_at): Display the correct subject for fake rows.
    -	(on_cursor_change_cmd): Update for the other changes and set
    -	cursor_uid to NULL when the cursor is on a fake row.
    -
    -	* mail-ops.c (reply): Don't try to reply when no (real) message is
    -	selected.
    -	(forward_msg): Ditto.
    -
    -2000-07-09  Christopher James Lahey  
    -
    -	* message-list.c: Remove setting of dnd_code since that's handled
    -	internally to ETable.
    -
    -2000-07-08  Dan Winship  
    -
    -	* folder-browser.c (etable_key): Fix up the pageup/pagedown
    -	increment a bit.
    -
    -	* folder-browser-factory.c (control_activate): Add a "Threaded
    -	Message List" item to the "View" menu.
    -
    -	* message-list.c (message_list_toggle_threads): Handler for that.
    -	(build_flat): New function to build a "flat" message list using
    -	the tree model.
    -	(message_list_regenerate): Build tree or flat message list
    -	depending on the global setting.
    -
    -	* message-thread.c (get_root_subject): fix a "Re:" parsing bug
    -
    -2000-07-08  Jeffrey Stedfast  
    -
    -	* mail-ops.c (real_fetch_mail): Always dump incoming messages to
    -	Inbox (assuming not filtered to another location).
    -
    -2000-07-08  Ettore Perazzoli  
    -
    -	* folder-browser-factory.c (control_activate): Move the
    -	"Expunge" item to the "Action" menu.
    -	(control_deactivate): Accordingly.
    -
    -2000-07-08  Dan Winship  
    -
    -	* mail-ops.c (forward_msg): Deal with having multiple selected
    -	messages.
    -
    -	* mail-format.c (mail_generate_forward): Removed. (Integrated into
    -	forward_msg)
    -
    -2000-07-08  Jeffrey Stedfast  
    -
    -	* message-list.c (build_tree): Small fix to stop uid data from
    -	being set on a message-list tree node when it didn't correspond
    -	to an actual message.
    -
    -2000-07-08  Dan Winship  
    -
    -	* message-list.c (get_message_info): Fix Jeff's FIXME: This does
    -	get called with out-of-range data sometimes, so we do need the
    -	check. Use e_table_model_row_count to get the actual right answer.
    -
    -2000-07-07  Jeffrey Stedfast  
    -
    -	* message-list.c (get_message_info): This wasn't quite right, it
    -	will now work but still isn't perfect. See FIXME comment.
    -
    -2000-07-07  Dan Winship  
    -
    -	* message-thread.c (remove_node): Add another argument "clast"
    -	pointing to the container before the current one in the list,
    -	which it can update if that turns out to be the one that it
    -	removed.
    -	(group_root_set): Update for remove_node change, and remove both
    -	nodes in the "subjects are common" case. Fixes a bug that would
    -	cause the message list to be truncated if this rule was invoked.
    -
    -	(sort_node): sort the tree by the original order of the messages
    -	in the folder rather than by date.
    -
    -2000-07-07  Dan Winship  
    -
    -	* message-list.c: Lots of changes. Store uids as node data on the
    -	tree nodes and use those rather than rows where possible. (The
    -	concept of "row" is just getting too complicated.) Get rid of the
    -	summary_table, because given a uid we can call
    -	camel_folder_get_message_info, which makes more sense than keeping
    -	a separate uid->row hash table ourselves.
    -
    -	(get_message_info): update
    -	(get_message_row): removed
    -	(ml_col_cound, ml_row_count, ml_value_at, ml_set_value_at,
    -	ml_cell_is_editable, ml_duplicate_value, ml_free_value,
    -	ml_initialize_value, ml_value_is_empty, ml_value_to_string):
    -	Removed. We always use the tree model now.
    -	(message_list_init): Remove the non-tree code.
    -	(build_tree): store uids in the tree rather than row numbers,
    -	and build the message_list->uid_rowmap to map from uids to rows
    -	when needed.
    -	(message_list_regenerate): Renamed from _set_search, since it's
    -	used to redraw in non-search cases too.
    -	(message_changed): Use the uid_rowmap to get a model row number.
    -
    -	* message-thread.c (thread_messages): Change the interface on this
    -	to work with the new MessageList.
    -
    -	* folder-browser.c (search_set, folder_browser_clear_search): 
    -	s/message_list_set_search/message_list_regenerate/
    -
    -2000-07-07  Christopher James Lahey  
    -
    -	* message-list.c (get_message_info): Handle a row number of -1
    -	properly.
    -
    -2000-07-06  Dan Winship  
    -
    -	* message-list.c (get_message_info): Map tree model row numbers to
    -	summary row numbers.
    -	(ml_tree_value_at, ml_tree_set_value_at,
    -	ml_tree_is_cell_editable): So don't do that here.
    -
    -2000-07-06  JP Rosevear  
    -
    -	* mail-config.glade*: Glade files for the configuration dialog.
    -	
    -	* mail-config.c (providers_config_new): Build the dialog with
    -	glade.
    -
    -2000-07-06  Dan Winship  
    -
    -	* folder-browser-factory.c, folder-browser.c, mail-ops.c,
    -	message-list.c: fix warnings.
    -
    -	* main.c (main): gtkhtmllib_init is no more. Call gconf_init
    -	directly instead.
    -
    -	* message-list.c (message_list_select_next): New function to
    -	select the first message on or after the given row that meets
    -	certain flag criteria.
    -
    -	* mail-ops.c (real_fetch_mail): call message_list_select_next to
    -	select first unread message in current folder if it changes.
    -	(real_delete_msg): Remove the code to move the etable cursor. It
    -	only makes sense really if you deleted the message with the
    -	keyboard, so do it from etable_key.
    -
    -	* folder-browser.c (etable_key): call message_list_select_next to
    -	select next non-deleted message after Delete.
    -
    -	* mail-identify.c: Add a workaround for a small gnome-vfs 0.2 bug
    -	so we don't need to require CVS gnome-vfs.
    -
    -2000-07-06  Not Zed  
    -
    -	* message-thread.c (sort_thread): sort messages based on date for
    -	the initial sort order.
    -	(thread_messages_free): Implement.
    -
    -	* message-list.c (message_list_init_header): Setup the subject
    -	renderer to a tree in tree mode.
    -	(on_cursor_change_cmd): For a tree model, map the view row to the
    -	data row.
    -	(build_tree): Builds the tree data structure of all messages.
    -	(message_list_set_search): For a tree model, build the tree here.
    -	(ml_tree_icon_at): Icon callback, returns nothing.
    -	(ml_tree_value_at):
    -	(ml_tree_set_value_at): 
    -	(ml_tree_is_cell_editable): Maps tree node to data row, and calls
    -	the equivalent table callback
    -	(message_list_init_renderers): Setup the tree renderer if needed.
    -	(message_list_init): set the root node invisible afterall.
    -	(message_list_set_search): Clear the old tree before putting in a
    -	new one.
    -
    -	* message-list.h: Add a tree renderer to render list, and
    -	tree_view indicator.
    -
    -	* message-thread.[ch]: Code for message threading. 
    -
    -2000-07-05  Dan Winship  
    -
    -	* mail-identify.c (mail_identify_mime_part): Oops. My gnome-vfs
    -	was out-of-date. Update for changed function name.
    -
    -2000-07-05  Dan Winship  
    -
    -	* mail-identify.c (mail_identify_mime_part): Use the gnomevfs
    -	sniff buffer interface to try to identify the MIME type when
    -	everything else fails.
    -
    -	* mail-display.c (on_object_requested):
    -	* mail-format.c (lookup_handler, handle_undisplayable,
    -	handle_audio): s/gnome_mime/gnome_vfs_mime/
    -
    -	* Makefile.am: Add gnomevfs stuff
    -
    -2000-07-03  Ettore Perazzoli  
    -
    -	* component-factory.c (create_folder): Get rid of a compiler
    -	warning by making sure `folder' is always initialized to some
    -	value for any code path.
    -
    -2000-07-03  Dan Winship  
    -
    -	* message-list.c (select_msg): call mail_display_set_message with
    -	NULL if the message we tried to select doesn't exist (probably
    -	meaning we tried to selecte the first message and the folder is
    -	empty.)
    -
    -	* mail-display.c (mail_display_set_message): deal with NULL as an
    -	input (meaning "undisplay previous message and display nothing").
    -
    -2000-07-02  Dan Winship  
    -
    -	* mail-ops.c (real_fetch_mail): Remove hack to redisplay the
    -	inbox, since folder_changed signals will now be emitted
    -	appropriately.
    -
    -	* component-factory.c (create_vfolder_storage): Fix
    -	filter_driver_new invocation.
    -
    -	* Makefile.am (bin_PROGRAMS): test-mail and test-thread should be
    -	noinst.
    -
    -	* mail-ops.c (real_fetch_mail): 
    -	(vfolder_editor_clicked): 
    -	* component-factory.c (create_vfolder_storage):
    -	Pass mail_uri_to_folder and rules to filter_driver_new.
    -
    -2000-07-02  Ettore Perazzoli  
    -
    -	* folder-browser.c (mail_uri_to_folder): Fix double freeing of the
    -	local exception `ex'.
    -
    -2000-07-01  Ettore Perazzoli  
    -
    -	* mail-ops.c (refile_msg): Only allow type "mail" in the folder
    -	selection dialog.
    -
    -2000-07-01  Dan Winship  
    -
    -	* pixmaps.h, pixmaps/*.xpm: Removed. These aren't being used any
    -	more. (The real pixmaps are in ../art.)
    -
    -2000-07-01  Jeffrey Stedfast  
    -
    -	* message-list.c (get_message_info):
    -	(select_msg): Updated to reflect camel-folder changes.
    -
    -	* mail-ops.c (real_fetch_mail): Modified to reflect camel-folder
    -	changes.
    -
    -2000-06-30  Dan Winship  
    -
    -	* mail-ops.c (print_msg): Use gnome-print to do a print preview.
    -
    -	* folder-browser-factory.c: Hook up "Print" button.
    -
    -	* message-list.c (message_list_foreach): New function, a wrapper
    -	around e_table_selected_row_foreach, which calls the callback
    -	function with UIDs rather than row numbers.
    -
    -	* folder-browser-factory.c: Remove never-used "Find" button from
    -	the toolbar and replace it with "Refile". (We need a better icon
    -	for this...). Hook up "Refile" to "refile_msg".
    -
    -	* mail-ops.c (refile_msg): Call the shell's user_select_folder
    -	routine, and then use message_list_foreach and real_refile_msg to
    -	do the work.
    -	(delete_msg): Update to use message_list_foreach.
    -
    -	* folder-browser.c (mail_uri_to_folder): new function, extracted
    -	from folder_browser_load_folder, to turn a URI into a folder.
    -	(folder_browser_load_folder): Use it.
    -
    -2000-06-30  Peter Williams  
    -
    -	* component-factory.c (create_news_storage, create_imap_storage):
    -	Fixed to use new EvolutionShellClient proxy thingamajiggie.
    -
    -2000-06-30  Dan Winship  
    -
    -	* message-list.c (on_row_selection): use the ETable row_selection
    -	signal to track how many rows are selected. Eventually we will use
    -	this info to disable toolbar buttons when you have too few/too
    -	many messages selected, but the current toolbar widget doesn't
    -	allow that.
    -
    -	* message-list.h, message-list.c, mail-ops.c: Change selected_row
    -	and selected_uid fields of MessageList to cursor_row and
    -	cursor_uid to be more correct according to the new ETable
    -	interfaces.
    -
    -2000-06-30  Ettore Perazzoli  
    -
    -	* component-factory.c: Eeek.  Fix typo: add missing star in the
    -	declaration of `global_shell_client'.
    -
    -2000-06-29  Ettore Perazzoli  
    -
    -	* component-factory.c: Replace `global_shell_interface' with
    -	`global_shell_client'.
    -
    -2000-06-29  Jeffrey Stedfast  
    -
    -	* mail-ops.c (delete_msg): Clean up compile warnings
    -	(real_fetch_mail): Fetching from IMAP should do nothing
    -
    -2000-06-29  Christopher James Lahey  
    -
    -	* mail-ops.c: Handle multiple deletes (change by Peter Williams.)
    -
    -2000-06-29  Jeffrey Stedfast  
    -
    -	* folder-browser-factory.c: Changed "Send" to "Compose" to
    -	avoid user confusion. Compose is a little more intuitive.
    -	Also changed the pixmap to MAIL_NEW instead of MAIL_SND
    -
    -	* mail-ops.c (compose_msg): Renamed to avoid confusion
    -
    -2000-06-29  Dan Winship  
    -
    -	* component-factory.c (create_imap_storage, create_news_storage):
    -	remove some code incorrectly copied and pasted from
    -	create_vfolder_storage which caused vfolder creation to stop
    -	working.
    -
    -2000-06-29  Christopher James Lahey  
    -
    -	* message-list.c, mail-ops.c: Changed the name of
    -	e_table_select_row to e_table_set_cursor_row.
    -
    -2000-06-29  Peter Williams  
    -
    -	* message-list.c (message_list_init): Set the dnd_code of the
    -	ETableHeader to something so that Solaris sprintf doesn't die
    -	on a NULL string.
    -
    -	* mail-config.c (providers_config_new): Check for a null "transport"
    -	string (not all OS' handle NULL strings well *cough* Solaris)
    -
    -2000-06-28  Dan Winship  
    -
    -	* mail-format.c (mail_generate_forward): add default subjects
    -
    -	* component-factory.c (create_folder): Refuse to create folders
    -	not of type "mail", and correctly create an empty "mbox" folder
    -	for new folders in /local.
    -
    -	* main.c (init_corba): Call od_assert_using_oaf() or
    -	od_assert_using_goad() as appropriate to make sure people didn't
    -	somehow trick the build system.
    -
    -2000-06-28  Jeffrey Stedfast  
    -
    -	* message-list.c: Added prototype for filter_date to make
    -	it build cleanly
    -
    -2000-06-27  Christopher James Lahey  
    -
    -	* message-list.c: Made dates display grouping information
    -	properly.
    -
    -2000-06-27  Peter Williams  
    -
    -	* message-list.c (mark_msg_seen): Need to return a value
    -	on error.
    -
    -	* main.c (main): Don't start threads or enter threads if
    -	there's no threading! Sigh.
    -
    -	* test-thread.c: Don't compile if no threads.
    -
    -	* session.c: Work without broken threads.
    -
    -	* message-list.c (filter_date): Solve the ctime_r problem the
    -	correct way, with the magic of autoconf.
    -
    -2000-06-27  Christopher James Lahey  
    -
    -	* message-list.c: Work around mismatched ctime_r functions.  This
    -	will be fixed.
    -
    -2000-06-27  Peter Williams  
    -
    -	* mail-threads.c: Don't compile this if we don't have
    -	threads enabled. This should maybe be on the Makefile.am
    -	level.
    -
    -2000-06-27  Michael Zucchi  
    -
    -	* component-factory.c (owner_set_cb): Put in a gross hack to
    -	export the shell reference elsewhere.
    -
    -2000-06-26  Christopher James Lahey  
    -
    -	* message-list.c: Added a value_to_string handler.
    -
    -2000-06-26  Peter Williams  
    -
    -	* component-factory.c, mail-ops.c: #ifdef the threads stuff so
    -	that if USE_BROKEN_THREADS is not defined we just call the functions
    -	in the main thread.
    -
    -	* mail-threads.h: Don't declare funcs if USE_BROKEN_THREADS not
    -	defined.
    -
    -	* mail-threads.c: Put the query and message boxes on top so that
    -	you can see them.
    -
    -2000-06-26  Jeffrey Stedfast  
    -
    -	* mail-config.c (error_dialog): va_start() returns void, don't
    -	assign it's retval to a variable.
    -
    -2000-06-26  Ettore Perazzoli  
    -
    -	* main.c (main): Call `GDK_THREADS_ENTER()' and
    -	`GDK_THREADS_LEAVE()' around the main loop as in the examples from
    -	the GTK+ FAQ.
    -
    -	* mail-threads.c (DEBUG): New macro for debugging.
    -	(read_msg): Use it.
    -
    -2000-06-25  Peter Williams  
    -
    -	* Makefile.am: Clean up the various _LIBS and _CFLAGS
    -	to work with simpler THREADS_LIBS and THREADS_CFLAGS scheme.
    -
    -2000-06-23  Jeffrey Stedfast  
    -
    -	* folder-browser.c (folder_browser_load_folder): Improved the
    -	code to separate the imap namespace from the folder name.
    -
    -2000-06-23  Peter Williams  
    -
    -	* component-factory.c: Include e-util/e-setup.h for the
    -	prototype of evolution_dir; prototype create_news_storage.
    -	(real_create_imap_storage, real_create_news_storage): New
    -	functions moving the camel stuff into the async callback.
    -	(create_imap_storage, create_news_storage): Chopped in
    -	half to move camel stuff as above.
    -
    -	* mail-ops.c: Include "mail-threads.h" for threading protos.
    -	(real_fetch_mail, real_send_mail, real_expunge_folder): 
    -	New functions moving the camel stuff into the async callback.
    -	(async_mail_exception_dialog): A version of mail_exception_dialog
    -	to be called from the async handlers (just calls mail_op_error())
    -	(fetch_mail, expunge_folder, composer_send_cb): Cut in half to
    -	move camel stuff as above.
    -	(cleanup_send_mail): Clean up after the async real_send_mail
    -	with the gtk_object_destroys et al.
    -
    -	* mail-threads.c: Instead of hiding the progress bar, make it
    -	zip back and forth constantly.
    -	(progress_timeout): New func. Timeout called to make the pbar
    -	shimmy.
    -	(timeout_toggle): New func. Turn on and off the shimmy effect.
    -	(check_cond): New func. Make sure that the GCond for modal
    -	operation is initialized before mail_op_{error,get_password}.
    -	(show_error_clicked, read_msg, get_password_clicked): Move
    -	over to timeout_toggle.
    -	(mail_op_error,mail_op_get_password): Add check_cond() call.
    -
    -	* main.c: (main) Call g_thread_init.
    -
    -	* session.c: Change auth_callback stuff over to assume that it's
    -	being called async. Note: no real good way to tell if this is
    -	the case or not.
    -	(request_callback): ifdef'ed out
    -	(evolution_auth_callback): Use mail_op_get_password.
    -	
    -2000-06-22  Jeffrey Stedfast  
    -
    -	* folder-browser.c (folder_browser_load_folder): Now should
    -	correctly get the selected folder from the given URL.
    -
    -2000-06-22  Chris Toshok  
    -
    -	* folder-browser.c (folder_browser_load_folder): add handling for
    -	loading "news:" folders.
    -
    -	* component-factory.c (create_news_storage): add a root for news
    -	source.
    -	(owner_set_cb): call create_news_storage.
    -
    -2000-06-22  Jeffrey Stedfast  
    -
    -	* folder-browser.c (folder_browser_load_folder): Updated to
    -	prepend url-> path if it exists for that imap store.
    -
    -	* component-factory.c (create_imap_storage): Modified to not
    -	prepend a hard-coded namespace.
    -
    -2000-06-22  Chris Toshok  
    -
    -	* mail-ops.c (fetch_mail_cleanup): new function, passed as arg to
    -	mail_operation_try.
    -	(fetch_mail): add cleanup func arg.
    -
    -2000-06-22  Christopher James Lahey  
    -
    -	* message-list.c: Changed ml_value_at to return "" instead of NULL
    -	in some cases.
    -
    -2000-06-22  Peter Williams  
    -	* Makefile.am: Add GNOME_EXTRA_LIBS so that we get libgthread
    -	in our LIBS for evolution-mail.
    -	
    -	* mail-threads.c: Make the dialog boxes for error and
    -	question non-modal. They're modal relative to the dispatch
    -	thread, but before they would also eg lock up the toolbar
    -	buttons (while the menus, managed by another process, were
    -	active -- a weird effect).
    -	
    -2000-06-22  Peter Williams  
    -
    -	* mail-threads.[ch]: Extra argument to mail_operation_try:
    -	'cleanup', a function to be called in the main thread after
    -	the dispatcher thread exits. gtk_object_destroy's et al may
    -	attempt to unmap windows so we can't do them in the dispatcher
    -	thread :-(
    -
    -	* test-thread.c: Updated with demo of new argument working.
    -
    -2000-06-22  Peter Williams  
    -
    -	* test-thread.c (op_5): New tests for the get_password
    -	hook.
    -
    -	* mail-threads.[ch]: New hook, mail_op_get_password, for
    -	getting a user response from an async operation. The operation
    -	blocks while waiting for the response. A big whole mutex 
    -	condition threading blocking dealie to make sure that it 
    -	works.
    -
    -	Also the error hook creates a dialog again, which also needs
    -	to block its caller while we wait for the user to press ok.
    -
    -2000-06-22  Peter Williams  
    -
    -	* mail-threads.c (various functions): Prettify the UI
    -	so that the progress bar doesn't become all huge 'n stuff.
    -	(mail_operation_try): Now save the operation's description,
    -	so that we can display it later as the default message.
    -	(read_msg): When the operation starts set the label to its
    -	UI-friendly name.
    -	(dispatch_func): Free the saved prettyname.
    -
    -2000-06-21  Christopher James Lahey  
    -
    -	* message-list.c: Removed an erroneous comment.
    -
    -2000-06-21  Dan Winship  
    -
    -	* mail-config.c (create_transport_page): Make this not crash if
    -	you don't have a transport configured.
    -	
    -	* message-list.c: Update received date to work like sent date.
    -
    -2000-06-21  Peter Williams  
    -
    -	* mail-thread.{c,h}: New files -- a simple API for executing
    -	the major mail ops (fetch_mail etc) asynchronously, allowing
    -	the operations to send messages and update a progress bar.
    -
    -	* test-thread.{c,h}: Tests the mail-thread API.
    -
    -	* Makefile.am: add mail-thread.[ch] to evolution_mail_SOURCES
    -	and declare the test_thread noinst_PROGRAM.
    -
    -2000-06-21  Peter Williams  
    -
    -	* mail-format.c (mail_generate_reply): Include "e-setup.h" to
    -	get the prototype for evolution_dir.
    -
    -2000-06-20  Jeffrey Stedfast  
    -
    -	* component-factory.c (create_imap_storage): Oops. Should
    -	have checked for a NULL sources.
    -
    -2000-06-20  Dan Winship  
    -
    -	* message-list.c (mark_msg_seen): Quick hack to prevent a NULL
    -	pointer dereference. Things need to be cleaned up a bit more here
    -	though.
    -
    -	* mail-sources.c: Oops. This should have been removed a long time
    -	ago.
    -
    -2000-06-20  Jeffrey Stedfast  
    -
    -	* folder-browser.c (folder_browser_load_folder): Working on getting 
    -	this to work :)
    -
    -	* component-factory.c (create_imap_storage): Should now correctly
    -	construct the folder path allowing the selection of a folder.
    -
    -2000-06-20  Ettore Perazzoli  
    -
    -	* mail-format.c (mail_generate_reply): Declare `evolution_dir'.
    -	Ugly, ugly, ugly, but I am not sure where it should go instead.
    -
    -2000-06-19  Ettore Perazzoli  
    -
    -	* mail-ops.c (ask_confirm_for_empty_subject): New function to ask
    -	confirmation for an empty subject line.
    -	(composer_send_cb): Use it if the subject is empty and only send
    -	the message if the user confirms.
    -
    -2000-06-20  Jeffrey Stedfast  
    -
    -	* component-factory.c (create_imap_storage): Now creates the IMAP
    -	storage (listing subfolders and such)
    -
    -2000-06-19  Dan Winship  
    -
    -	* mail-format.c (find_preferred_alternative): add an option to
    -	prefer text/plain.
    -	(reply_body): add an option to prefer text/plain
    -	(mail_generate_reply): Check the mail sending preferences, and
    -	generate a text/plain reply if the user prefers to send plain text
    -	(and we have a text/plain part to generate a reply from).
    -
    -2000-06-19  Jeffrey Stedfast  
    -
    -	* mail-config.c (providers_config_new): Should now correctly display
    -	the Transport page (made it set the optionmenu correctly, before it
    -	would only set SMTP).
    -	(create_transport_page): Updated to set the page info to sendmail/smtp
    -	based on the url.
    -	(create_service_page): Had to add some code to set data on some objects
    -	so I could grab the objects I needed to modify in the above function.
    -
    -2000-06-18  Jeffrey Stedfast  
    -
    -	* folder-browser.c (folder_browser_load_folder): started to add
    -	code to load an IMAP folder.
    -	
    -	* component-factory.c: Started to add a create_imap_storage 
    -	method so that we can eventually have our IMAP store displayed 
    -	in the tree view.
    -	(create_vfolder_storage): Renamed from
    -	create_test_storage().
    -	(owner_set_cb): Updated.
    -
    -2000-06-17  Dan Winship  
    -
    -	* message-list.c (message_list_set_folder): Prevent double-freeing
    -	action on summary_table and uid_rowmap.
    -
    -2000-06-16  Dan Winship  
    -
    -	* message-list.c (ml_set_value_at): Implement clicking on the
    -	envelope icon to set read/unread. Based on a patch by clahey.
    -	(select_msg): keep the timeout id for the "seen" flagging in the
    -	message_list structure, so ml_set_value_at can clear it so it
    -	doesn't re-mark a message seen after you click it unseen.
    -
    -2000-06-16  Dan Winship  
    -
    -	* message-list.c (get_message_row): new function to do a uid to
    -	row mapping.
    -	(mark_msg_seen, select_msg, message_changed,
    -	message_list_set_folder): Update for Camel flag changes.
    -	(on_cursor_change_cmd): Rename "row_to_select" to "selected_row",
    -	and keep a "selected_uid" as well.
    -
    -	* mail-ops.c (composer_send_cb): Update for Camel flag changes,
    -	and fix some memory-handling bugs. (Free the post_send_data when
    -	the composer is destroyed, not when the user clicks "send", which
    -	could happen never, or more than once.)
    -	(delete_msg): Update for Camel flag changes, and fix the "holding
    -	down the delete key skips some messages" bug.
    -
    -2000-06-15  Dan Winship  
    -
    -	* mail-ops.c (fetch_mail): 
    -	* component-factory.c (owner_unset_cb): 
    -	* message-list.c (message_list_set_folder): Update for CamelFolder
    -	changes.
    -
    -	* folder-browser.c (folder_browser_clear_search): New function to
    -	revert back to non-searching mode.
    -
    -	* mail-ops.c (fetch_mail): Use folder_browser_clear_search.
    -
    -	* mail-display.c (on_url_requested): if the document requests an
    -	unknown URL, it's not an error; just ignore the URL.
    -
    -	* mail-ops.c (fetch_mail): If there's no new mail, tell the user.
    -
    -2000-06-14  Radek Doulik  
    -
    -	* main.c (main): call gtkhtmllib_init here
    -
    -2000-06-13  Jeffrey Stedfast  
    -
    -	* mail-config.c (on_SourceConfigDialogButton_clicked): Make sure source
    -	is always pointing to something, so a blank is not written to the config file
    -	on close.
    -
    -2000-06-13  Ettore Perazzoli  
    -
    -	* Makefile.am (SHELL_OBJS): Removed.
    -	(evolution_mail_LDADD): Use `libeshell.a'.  Also use
    -	`top_builddir' consistently.
    -
    -2000-06-12  Jeffrey Stedfast  
    -
    -	* mail-config.c: Got rid of sources_max_row and identities_max_row
    -	as they are not really needed (just use clist->rows)
    -	(on_cmdSourcesEdit_clicked): Modified to make 'source'
    -	point to the data being edited.
    -	(on_cmdSourcesAdd_clicked): Adds a new clist item and selects it so the
    -	editor knows where to stick the data when it's done.
    -
    -2000-06-12  Federico Mena Quintero  
    -
    -	* message-list.c: Removed the ETableModel thaw handler.
    -
    -2000-06-12  Dan Winship  
    -
    -	* folder-browser.c (folder_browser_set_uri): Return the result of
    -	folder_browser_load_folder.
    -	(get_prop, set_prop, folder_browser_properties_init): Remove. No
    -	longer needed.
    -
    -	* folder-browser-factory.c (folder_browser_factory_new_control):
    -	Add a "uri" argument, return NULL if setting it fails.
    -	(folder_browser_factory_new_control): Remove property bag stuff.
    -	(folder_browser_factory_init, folder_browser_factory): Remove
    -	this, since we're using the component factory now.
    -
    -	* component-factory.c (create_view): Update for
    -	folder_browser_factory_new_control change and return NOTFOUND as
    -	appropriate.
    -
    -	* main.c (main): Don't call folder_browser_factory_init.
    -
    -	* mail-format.c (mail_generate_reply): Fix the subject generation
    -	so we don't get "Re:  Re:". This is working around something that
    -	may later be declared a misfeature in Camel.
    -
    -2000-06-10  Ettore Perazzoli  
    -
    -	* component-factory.c (create_folder): New stub implementation for
    -	the folder creation function in the EvolutionShellComponent we
    -	expose [it simply returns success all the time].
    -	(factory_fn): Pass this function to `evolution_shell_component_new'.
    -
    -2000-06-09  Dan Winship  
    -
    -	* folder-browser.c (folder_browser_new): Add a serial number to
    -	FolderBrowser.
    -
    -	* folder-browser-factory.c (control_activate, control_deactivate):
    -	Include fb serial number in the name of the Bonobo toolbar to
    -	prevent problems with disappearing toolbars. This is a kludge and
    -	should go away.
    -
    -
    -	* mail-ops.c (expunge_folder): display error from
    -	camel_folder_expunge if there is one.
    -
    -	* message-list.c (select_row): install an idle function to
    -	select the row rather than doing it directly. Ugh. What a
    -	kludge, but at least it works now.
    -
    -	* session.c (evolution_auth_callback): Update for
    -	CamelAuthCallback changes. (Uncache passwords when asked to.)
    -
    -	* mail-ops.c (fetch_mail): close and expunge the source folder
    -	after copying it to a local folder.
    -
    -2000-06-09  Ettore Perazzoli  
    -
    -	* component-factory.c (create_view): Updated to match the changes
    -	to the definition of `EvolutionShellComponentCreateFn'.  If @type
    -	is not "mail", return an "unsupported type" error.
    -	(factory_fn): Pass NULL for the `remove_folder' and
    -	`create_folder' functions.
    -
    -2000-06-09  Dan Winship  
    -
    -	* mail-format.c: Redo things a bit so that whitespace-only
    -	text parts aren't displayed. (In particular, so that
    -	whitespace-only subparts of multipart/mixed aren't displayed as
    -	separate (empty) parts.)
    -
    -2000-06-06  Dan Winship  
    -
    -	* mail-ops.c (fetch_mail): 
    -	* folder-browser.c (folder_browser_load_folder): Update for folder
    -	creation/existence changes.
    -
    -	* message-list.c (message_list_set_folder): Remove the code to
    -	create the folder if it doesn't exist, since we don't want to do
    -	that.
    -
    -2000-06-05  Dan Winship  
    -
    -	* mail-ops.c (composer_send_cb): Leave the composer window around
    -	if the message doesn't get sent.
    -
    -2000-06-05  Matt Loper  
    -
    -	* folder-browser.c (etable_key): Allow "GDK_KP_Delete", a keypad
    -	delete key, to delete a message.
    -
    -2000-06-05  Dan Winship  
    -
    -	* session.c (evolution_auth_callback): Remember passwords between
    -	calls.
    -	(forget_passwords): Callback for "Forget Passwords" menu item.
    -
    -	* folder-browser-factory.c (control_activate): 
    -	(control_deactivate): Add "Forget Passwords" menu item.
    -
    -	* mail.h, mail-ops.c: fix some function prototypes
    -
    -	* folder-browser.c (etable_key): Add "Delete" = delete message.
    -
    -	* mail-format.c (mail_generate_forward): Update for new composer
    -	attachment interface.
    -
    -2000-06-02  Jeffrey Stedfast  
    -
    -	* mail-config.c (providers_config_new): Added a new notebook
    -	page that allowed for mail format (text/plain or 
    -	multipart/alternative)
    -
    -2000-06-02  Dan Winship  
    -
    -	* message-list.c (filter_date): If the date in the summary is 0,
    -	output "?".
    -
    -	* component-factory.c (create_view): keep a GList of folder
    -	browsers created
    -	(owner_unset_cb): Go through the list and close each folder before
    -	exiting so they sync their summary state, etc to disk.
    -
    -	* mail-ops.c (fetch_mail): Use camel_service_connect, not
    -	connect_with_url, since we already passed the URL into
    -	camel_session_get_store.
    -
    -2000-06-02  Christopher James Lahey  
    -
    -	* message-list.c: Use camel_folder_free_summary instead of
    -	g_ptr_array_free.  Unref the folder when we're done with it.
    -
    -2000-06-02  Christopher James Lahey  
    -
    -	* session.c: Revert removal of e_setup_base_dir.
    -
    -2000-06-02  Dan Winship  
    -
    -	* folder-browser.c (my_folder_browser_init): Connect to ETable's
    -	key_press signal.
    -	(etable_key): scroll mail on space/backspace.
    -
    -2000-06-02  Christopher James Lahey  
    -
    -	* message-list.c: Made sent column as wide as from column.
    -
    -2000-06-02  Jeffrey Stedfast  
    -
    -	* mail-config.c (on_cmdSourcesAdd_clicked): Changed identity_row
    -	to source_row as this is a Sources clist we are dealing with and
    -	not an identity clist
    -	(on_cmdSourcesEdit_clicked): same
    -	(on_cmdSourcesDelete_clicked): again, same
    -	(on_cmdSourcesEdit_clicked): Source editor now fills in data from
    -	the clist
    -
    -2000-06-01  Dan Winship  
    -
    -	* message-list.c: Add a date column.	
    -	(COL_SENT_WIDTH_MIN): Make this wider.
    -	(ml_value_at): return the sent date (as a time_t) for COL_SENT.
    -	(Fix COL_TO too while I'm here.) 
    -	(ml_duplicate_value, ml_free_value, ml_initialize_value,
    -	ml_value_is_empty): COL_SENT is numeric now.
    -	(message_list_init_renderers): Create a date renderer (using
    -	text_filter to translate the time_t into a string).
    -	(message_list_init_header): Use render_date for COL_SENT.
    -
    -2000-06-01  Christopher James Lahey  
    -
    -	* session.c: Don't call e_setup_base_dir.
    -
    -2000-06-01  Dan Winship  
    -
    -	* mail-format.c (mail_generate_forward): Fix forwarding to work
    -	for people other than me. :) [Although apparently it doesn't
    -	really.]
    -
    -	* mail-ops.c (delete_msg): Add a quick hack to move the selection
    -	down a row when you delete a message.
    -
    -	* mail-format.c (handle_message_rfc822): use 
    rather - than
    to frame the embedded - message. If
     text in the subtable won't fit in the 95% width,
    -	GtkHTML will write past the border of the table (and
    -	
    causes creeping updates so it's not - usable for now). - -2000-06-01 Christopher James Lahey - - * message-list.c (message_list_init): Turn off the grid in our - ETable. - -2000-06-01 Dan Winship - - * mail-format.c (write_headers): Oops. This needs to take a - message argument because we might be writing headers for an - embedded message/rfc822 subpart rather than the root document. - -2000-06-01 Jeffrey Stedfast - - * mail-config.c: Config dialogs are completed. - (service_acceptable): Fixed a segfault caused by duplicate - camel_exception_free() - (providers_config_new): Identity and Source clists are now filled in - when the dialog is created as well as the Transport page - - * folder-browser-factory.c: Renamed Tool/ menu items - Vfolder was changed to Virtual Folder and - Configure Camel Providers was changed to Mail Configuration - -2000-06-01 Ettore Perazzoli - - * Makefile.am (evolution_mail_LDADD): Link with - `libemiscwidgets.a'. - - * mail-display.c (mail_display_new): Use an EScrollFrame instead - of a GtkScrolledWindow. - (mail_display_set_message): Likewise. - - * mail-display.h: Replace the GtkScrolledWindow with an - EScrollFrame. - -2000-06-01 Dan Winship - - * component-factory.c (owner_unset_cb): Quit when the shell exits. - This is a kludge, but a pretty necessary one until the refcounting - bugs that keep the component from exiting properly are fixed. - -2000-05-31 Jeffrey Stedfast - - * mail-config.c: Partially implemented the source - configuration, seems to segfault due to a destroyed - gnome dialog being destroyed again in the method - on_SourceConfigDialogButton_clicked() - -2000-05-31 Dan Winship - - * mail-format.c (free_url, handle_text_enriched, - get_url_for_icon): Fix up memory management of x-evolution-data - URLs so the URLs and/or their data don't get freed while there are - still references to them. - - * message-list.c (message_list_init_header): redo the (unused) - online status column to no longer refer to pixmaps that no longer - exist. - -2000-06-01 Ettore Perazzoli - - * folder-browser-factory.c (control_activate): Put the toolbar - into a frame to make it look like standard GNOME toolbars. Also, - set `GNOME_DOCK_ITEM_BEH_NEVER_VERTICAL' so that it does not do - evil things when its moved to the left or the right of the window. - -2000-05-31 Jeffrey Stedfast - - * mail-config.c: Configuration dialog now allows - adding/editing/deleting of Identities (which leaves - adding/editing/deleting of sources left to implement). - The data is also saved when the dialog is exited via - the OK button. - -2000-05-31 Dan Winship - - * mail-format.c (mail_format_mime_message): Initialize the "urls" - hash table stored on the message and store cid and other URLs - there rather than as object data on the message. - (get_cid): rewrite this a bunch - (handle_text_enriched): move the code from write_iframe_string() - into here, since it's the only place that actually needs it. - (handle_text_html): simplify this a lot. We can use a cid: URL - here rather than x-evolution-data. - (get_url_for_icon): New routine to return URLs for icons, and - cache the results, so we don't have to keep re-reading the icon - files (and so we can't be spoofed into reading non-icon files). - (handle_mystery, handle_audio): use get_url_for_icon. - - * mail-display.c (save_data): move the CamelMimePart filename - extracting code from get_cid to here. - (on_link_clicked, on_object_requested): Update for cid: changes. - (on_url_requested): Kill off the kludgy, exploitable x-gnome-icon - URL schema, update cid and x-evolution-data to match - mail-format.c. - - It should now be easier to implement RFC 2557 (Content-Location, - etc), but that RFC still pretty much sucks. - -2000-05-30 Dan Winship - - * mail-format.c: Redo this back to the old way: a single GtkHTML - with various things inline in it. (Gets rid of flicker, simplifies - some scrolling, selecting, and printing issues.) - (handle_text_enriched, handle_text_html): Use ", xed); - add_url (xed, ba, md); - camel_object_hook_event (CAMEL_OBJECT (md->current_message), - "finalize", free_byte_array, ba); - - return TRUE; -} - -static gboolean -handle_text_html (CamelMimePart *part, const char *mime_type, - MailDisplay *md) -{ - mail_html_write (md->html, md->stream, "\n\n"); - mail_html_write (md->html, md->stream, - "", get_cid (part, md)); - return TRUE; -} - -static gboolean -handle_image (CamelMimePart *part, const char *mime_type, MailDisplay *md) -{ - mail_html_write (md->html, md->stream, "", - get_cid (part, md)); - return TRUE; -} - -static gboolean -handle_multipart_mixed (CamelMimePart *part, const char *mime_type, - MailDisplay *md) -{ - CamelDataWrapper *wrapper = - camel_medium_get_content_object (CAMEL_MEDIUM (part)); - CamelMultipart *mp; - int i, nparts; - gboolean output = FALSE; - - g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); - mp = CAMEL_MULTIPART (wrapper); - - nparts = camel_multipart_get_number (mp); - for (i = 0; i < nparts; i++) { - if (i != 0 && output) - mail_html_write (md->html, md->stream, "
    \n"); - - part = camel_multipart_get_part (mp, i); - - output = call_handler_function (part, md); - } - - return TRUE; -} - -static gboolean -handle_multipart_encrypted (CamelMimePart *part, const char *mime_type, - MailDisplay *md) -{ - CamelDataWrapper *wrapper; - CamelMimePart *mime_part; - CamelException ex; - - wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part)); - - g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); - - /* Currently we only handle RFC2015-style PGP encryption. */ - if (!mail_crypto_is_rfc2015_encrypted (part)) - return handle_multipart_mixed (part, mime_type, md); - - camel_exception_init (&ex); - mime_part = pgp_mime_part_decrypt (part, &ex); - if (camel_exception_is_set (&ex)) { - /* I guess we just treat this as a multipart/mixed */ - return handle_multipart_mixed (part, mime_type, md); - } else { - gboolean retcode; - - retcode = call_handler_function (mime_part, md); - camel_object_unref (CAMEL_OBJECT (mime_part)); - - return retcode; - } -} - -static gboolean -handle_multipart_signed (CamelMimePart *part, const char *mime_type, - MailDisplay *md) -{ - CamelDataWrapper *wrapper; - CamelMultipart *mp; - CamelException *ex; - gboolean output = FALSE; - PgpValidity *valid; - int nparts, i; - - wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part)); - - g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); - - /* Currently we only handle RFC2015-style PGP signatures. */ - if (!mail_crypto_is_rfc2015_signed (part)) - return handle_multipart_mixed (part, mime_type, md); - - ex = camel_exception_new (); - valid = pgp_mime_part_verify (part, ex); - - /* now display all the subparts *except* the signature */ - mp = CAMEL_MULTIPART (wrapper); - - nparts = camel_multipart_get_number (mp); - for (i = 0; i < nparts - 1; i++) { - if (i != 0 && output) - mail_html_write (md->html, md->stream, "
    \n"); - - part = camel_multipart_get_part (mp, i); - - output = call_handler_function (part, md); - } - - /* Now display the "seal-of-authenticity" or something... */ - if (valid && openpgp_validity_get_valid (valid)) { - mail_html_write (md->html, md->stream, - "
    \n
    " - "" - "
    %s

    ", - get_url_for_icon ("wax-seal2.png", md), - _("This message is digitally signed and " - "has been found to be authentic.")); - } else { - mail_html_write (md->html, md->stream, - "
    \n" - "" - "
    %s

    ", - get_url_for_icon ("wax-seal-broken.png", md), - _("This message is digitally signed but can " - "not be proven to be authentic.")); - } - - if (valid && openpgp_validity_get_description (valid)) { - mail_error_write (md->html, md->stream, - openpgp_validity_get_description (valid)); - mail_html_write (md->html, md->stream, "

    "); - } - - mail_html_write (md->html, md->stream, "
    "); - - camel_exception_free (ex); - openpgp_validity_free (valid); - - return TRUE; -} - -/* As seen in RFC 2387! */ -static gboolean -handle_multipart_related (CamelMimePart *part, const char *mime_type, - MailDisplay *md) -{ - CamelDataWrapper *wrapper = - camel_medium_get_content_object (CAMEL_MEDIUM (part)); - CamelMultipart *mp; - CamelMimePart *body_part, *display_part = NULL; - CamelContentType *content_type; - const char *start; - int i, nparts; - - g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); - - mp = CAMEL_MULTIPART (wrapper); - nparts = camel_multipart_get_number (mp); - - content_type = camel_mime_part_get_content_type (part); - start = header_content_type_param (content_type, "start"); - if (start) { - int len; - - /* The "start" parameter includes <>s, which Content-Id - * does not. - */ - len = strlen (start) - 2; - - for (i = 0; i < nparts; i++) { - const char *cid; - - body_part = camel_multipart_get_part (mp, i); - cid = camel_mime_part_get_content_id (body_part); - - if (!strncmp (cid, start + 1, len) && - strlen (cid) == len) { - display_part = body_part; - break; - } - } - - if (!display_part) { - /* Oops. Hrmph. */ - return handle_multipart_mixed (part, mime_type, md); - } - } else { - /* No start parameter, so it defaults to the first part. */ - display_part = camel_multipart_get_part (mp, 0); - } - - /* Record the Content-IDs of any non-displayed parts. */ - for (i = 0; i < nparts; i++) { - body_part = camel_multipart_get_part (mp, i); - if (body_part == display_part) - continue; - - get_cid (body_part, md); - } - - /* Now, display the displayed part. */ - return call_handler_function (display_part, md); -} - -/* RFC 2046 says "display the last part that you are able to display". */ -static CamelMimePart * -find_preferred_alternative (CamelMultipart *multipart, gboolean want_plain) -{ - int i, nparts; - CamelMimePart *preferred_part = NULL; - MailMimeHandler *handler; - - nparts = camel_multipart_get_number (multipart); - for (i = 0; i < nparts; i++) { - CamelMimePart *part = camel_multipart_get_part (multipart, i); - CamelContentType *type = camel_mime_part_get_content_type (part); - char *mime_type = header_content_type_simple (type); - - g_strdown (mime_type); - if (want_plain && !strcmp (mime_type, "text/plain")) - return part; - handler = mail_lookup_handler (mime_type); - if (handler && (!preferred_part || !handler->generic)) - preferred_part = part; - g_free (mime_type); - } - - return preferred_part; -} - -static gboolean -handle_multipart_alternative (CamelMimePart *part, const char *mime_type, - MailDisplay *md) -{ - CamelDataWrapper *wrapper = - camel_medium_get_content_object (CAMEL_MEDIUM (part)); - CamelMultipart *multipart; - CamelMimePart *mime_part; - - g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); - - multipart = CAMEL_MULTIPART (wrapper); - - mime_part = find_preferred_alternative (multipart, FALSE); - if (mime_part) - return call_handler_function (mime_part, md); - else - return handle_multipart_mixed (part, mime_type, md); -} - -/* RFC 1740 */ -static gboolean -handle_multipart_appledouble (CamelMimePart *part, const char *mime_type, - MailDisplay *md) -{ - CamelDataWrapper *wrapper = - camel_medium_get_content_object (CAMEL_MEDIUM (part)); - CamelMultipart *multipart; - - g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); - - multipart = CAMEL_MULTIPART (wrapper); - - /* The first part is application/applefile and is not useful - * to us. The second part _may_ be displayable data. Most - * likely it's application/octet-stream though. - */ - part = camel_multipart_get_part (multipart, 1); - return call_handler_function (part, md); -} - -static gboolean -handle_message_rfc822 (CamelMimePart *part, const char *mime_type, - MailDisplay *md) -{ - CamelDataWrapper *wrapper = - camel_medium_get_content_object (CAMEL_MEDIUM (part)); - - g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (wrapper), FALSE); - - mail_html_write (md->html, md->stream, "
    "); - mail_format_mime_message (CAMEL_MIME_MESSAGE (wrapper), md); - mail_html_write (md->html, md->stream, "
    "); - - return TRUE; -} - -static gboolean -handle_message_external_body (CamelMimePart *part, const char *mime_type, - MailDisplay *md) -{ - CamelContentType *type; - const char *access_type; - char *url = NULL, *desc = NULL; - - type = camel_mime_part_get_content_type (part); - access_type = header_content_type_param (type, "access-type"); - if (!access_type) - goto fallback; - - if (!g_strcasecmp (access_type, "ftp") || - !g_strcasecmp (access_type, "anon-ftp")) { - const char *name, *site, *dir, *mode, *ftype; - char *path; - - name = header_content_type_param (type, "name"); - site = header_content_type_param (type, "site"); - if (name == NULL || site == NULL) - goto fallback; - dir = header_content_type_param (type, "directory"); - mode = header_content_type_param (type, "mode"); - - /* Generate the path. */ - if (dir) { - const char *p = dir + strlen (dir); - - path = g_strdup_printf ("%s%s%s%s", - *dir == '/' ? "" : "/", - dir, - *p == '/' ? "" : "/", - name); - } else { - path = g_strdup_printf ("%s%s", - *name == '/' ? "" : "/", - name); - } - - if (mode && *mode == 'A') - ftype = ";type=A"; - else if (mode && *mode == 'I') - ftype = ";type=I"; - else - ftype = ""; - - url = g_strdup_printf ("ftp://%s%s%s", site, path, ftype); - g_free (path); - desc = g_strdup_printf (_("Pointer to FTP site (%s)"), url); - } else if (!g_strcasecmp (access_type, "local-file")) { - const char *name, *site; - - name = header_content_type_param (type, "name"); - if (name == NULL) - goto fallback; - site = header_content_type_param (type, "site"); - - url = g_strdup_printf ("file://%s%s", *name == '/' ? "" : "/", - name); - if (site) { - desc = g_strdup_printf (_("Pointer to local file (%s) " - "valid at site \"%s\""), - name, site); - } else { - desc = g_strdup_printf (_("Pointer to local file (%s)"), - name); - } - } else if (!g_strcasecmp (access_type, "URL")) { - const char *urlparam; - char *s, *d; - - /* RFC 2017 */ - - urlparam = header_content_type_param (type, "url"); - if (urlparam == NULL) - goto fallback; - - /* For obscure MIMEy reasons, the URL may be split into - * multiple words, and needs to be rejoined. (The URL - * must have any real whitespace %-encoded, so we just - * get rid of all of it. - */ - url = g_strdup (urlparam); - s = d = url; - - while (*s) { - if (!isspace ((unsigned char)*s)) - *d++ = *s; - s++; - } - *d = *s; - - desc = g_strdup_printf ("Pointer to remote data (%s)", url); - } - - fallback: - if (!desc) { - if (access_type) { - desc = g_strdup_printf (_("Pointer to unknown " - "external data " - "(\"%s\" type)"), - access_type); - } else - desc = g_strdup (_("Malformed external-body part.")); - } - -#if 0 /* FIXME */ - handle_mystery (part, md, url, "gnome-globe.png", desc, - url ? "open it in a browser" : NULL); -#endif - - g_free (desc); - g_free (url); - return TRUE; -} - -static gboolean -handle_via_bonobo (CamelMimePart *part, const char *mime_type, - MailDisplay *md) -{ - mail_html_write (md->html, md->stream, - "", - get_cid (part, md), mime_type); - return TRUE; -} - -char * -mail_get_message_body (CamelDataWrapper *data, gboolean want_plain, gboolean *is_html) -{ - CamelMultipart *mp; - CamelMimePart *subpart; - int i, nparts; - char *subtext, *old; - const char *boundary; - char *text = NULL; - CamelContentType *mime_type; - - /* We only include text, message, and multipart bodies. */ - mime_type = camel_data_wrapper_get_mime_type_field (data); - - /* FIXME: This is wrong. We don't want to include large - * images. But if we don't do it this way, we don't get - * the headers... - */ - if (header_content_type_is (mime_type, "message", "*")) { - *is_html = FALSE; - return get_data_wrapper_text (data); - } - - if (header_content_type_is (mime_type, "text", "*")) { - *is_html = header_content_type_is (mime_type, "text", "html"); - return get_data_wrapper_text (data); - } - - /* If it's not message and it's not text, and it's not - * multipart, we don't want to deal with it. - */ - if (!header_content_type_is (mime_type, "multipart", "*")) - return NULL; - - mp = CAMEL_MULTIPART (data); - - if (header_content_type_is (mime_type, "multipart", "alternative")) { - /* Pick our favorite alternative and reply to it. */ - - subpart = find_preferred_alternative (mp, want_plain); - if (!subpart) - return NULL; - - data = camel_medium_get_content_object ( - CAMEL_MEDIUM (subpart)); - return mail_get_message_body (data, want_plain, is_html); - } - - nparts = camel_multipart_get_number (mp); - - /* Otherwise, concatenate all the parts that we can. If we find - * an HTML part in there though, return just that: We don't want - * to deal with merging HTML and non-HTML parts. - */ - boundary = camel_multipart_get_boundary (mp); - for (i = 0; i < nparts; i++) { - subpart = camel_multipart_get_part (mp, i); - - if (!mail_part_is_inline (subpart)) - continue; - - data = camel_medium_get_content_object ( - CAMEL_MEDIUM (subpart)); - subtext = mail_get_message_body (data, want_plain, is_html); - if (!subtext) - continue; - if (*is_html) { - g_free (text); - return subtext; - } - - if (text) { - old = text; - text = g_strdup_printf ("%s\n--%s\n%s", old, - boundary, subtext); - g_free (subtext); - g_free (old); - } else - text = subtext; - } - - return text; -} diff --git a/mail/mail-identify.c b/mail/mail-identify.c deleted file mode 100644 index e8b5f96a48..0000000000 --- a/mail/mail-identify.c +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Dan Winship - * - * Copyright 2000, Helix Code, Inc. (http://www.helixcode.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -#include - -#include -#include - -#include -#include -#include -#include "mail.h" - -/** - * mail_identify_mime_part: - * @part: a CamelMimePart - * @md: the MailDisplay @part is being shown in - * - * Try to identify the MIME type of the data in @part (which presumably - * doesn't have a useful Content-Type). - **/ -char * -mail_identify_mime_part (CamelMimePart *part, MailDisplay *md) -{ - const char *filename, *type; - GnomeVFSMimeSniffBuffer *sniffer; - CamelStream *memstream; - CamelDataWrapper *data; - GByteArray *ba; - - /* Try identifying based on name in Content-Type or - * filename in Content-Disposition. - */ - filename = camel_mime_part_get_filename (part); - if (filename) { - type = gnome_vfs_mime_type_from_name_or_default (filename, - NULL); - if (type) - return g_strdup (type); - } - - - /* Try file magic. */ - data = camel_medium_get_content_object (CAMEL_MEDIUM (part)); - /* FIXME: In a perfect world, we would not load the content just - * to identify the MIME type. - */ - if (mail_content_loaded (data, md)) { - ba = g_byte_array_new (); - memstream = camel_stream_mem_new_with_byte_array (ba); - camel_data_wrapper_write_to_stream (data, memstream); - if (ba->len) { - sniffer = gnome_vfs_mime_sniff_buffer_new_from_memory ( - ba->data, ba->len); - type = gnome_vfs_get_mime_type_for_buffer (sniffer); - gnome_vfs_mime_sniff_buffer_free (sniffer); - } else - type = NULL; - camel_object_unref (CAMEL_OBJECT (memstream)); - - if (type) - return g_strdup (type); - } - - /* Another possibility to try is the x-mac-type / x-mac-creator - * parameter to Content-Type used by some Mac email clients. That - * would require a Mac type to mime type conversion table. - */ - - - /* We give up. */ - return NULL; -} diff --git a/mail/mail-importer.c b/mail/mail-importer.c deleted file mode 100644 index 03f2bd374b..0000000000 --- a/mail/mail-importer.c +++ /dev/null @@ -1,153 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* mail-importer.c - * - * Authors: Iain Holmes - * - * Copyright (C) 2001 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include "mail-importer.h" -#include "mail-local.h" -#include "mail.h" - -#include -#include -#include -#include -#include - -#include "evolution-outlook-importer.h" -#include "evolution-mbox-importer.h" - -static gboolean factory_initialised = FALSE; - -extern char *evolution_dir; - -static GNOME_Evolution_LocalStorage local_storage = NULL; - -void -mail_importer_create_folder (const char *parent_path, - const char *name, - const char *type, - const char *description) -{ - BonoboListener *listener; - Bonobo_Listener corba_listener; - CORBA_Environment ev; - char *path, *physical; - - path = g_concat_dir_and_file (parent_path, name); - physical = g_strdup_printf ("file://%s/local/%s", evolution_dir, - parent_path); - - listener = bonobo_listener_new (NULL, NULL); - corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (listener)); - - CORBA_exception_init (&ev); - GNOME_Evolution_Storage_asyncCreateFolder (local_storage, - path, "mail", name, - physical, - corba_listener, &ev); - CORBA_exception_free (&ev); - g_free (path); - g_free (physical); -} - -/** - * mail_importer_add_line: - * importer: A MailImporter structure. - * str: Next line of the mbox. - * finished: TRUE if @str is the last line of the message. - * - * Adds lines to the message until it is finished, and then adds - * the complete message to the folder. - */ -void -mail_importer_add_line (MailImporter *importer, - const char *str, - gboolean finished) -{ - CamelMimeMessage *msg; - CamelMessageInfo *info; - CamelException *ex; - - if (importer->mstream == NULL) { - importer->mstream = CAMEL_STREAM_MEM (camel_stream_mem_new ()); - } - - camel_stream_write (CAMEL_STREAM (importer->mstream), str, - strlen (str)); - - if (finished == FALSE) - return; - - camel_stream_reset (CAMEL_STREAM (importer->mstream)); - info = g_new0 (CamelMessageInfo, 1); - info->flags = CAMEL_MESSAGE_SEEN; - - msg = camel_mime_message_new (); - camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg), - CAMEL_STREAM (importer->mstream)); - - camel_object_unref (CAMEL_OBJECT (importer->mstream)); - importer->mstream = NULL; - - ex = camel_exception_new (); - camel_folder_append_message (importer->folder, msg, info, ex); - camel_object_unref (CAMEL_OBJECT (msg)); - - camel_exception_free (ex); - g_free (info); -} - -/** - * mail_importer_init: - * - * Initialises all the importers - */ -void -mail_importer_init (EvolutionShellClient *client) -{ - BonoboGenericFactory *factory; - - if (factory_initialised == TRUE) - return; - - /* FIXME: Need plugins */ - factory = bonobo_generic_factory_new (OUTLOOK_FACTORY_IID, - outlook_factory_fn, - NULL); - if (factory == NULL) { - g_error ("Unable to create outlook factory."); - } - - factory = bonobo_generic_factory_new (MBOX_FACTORY_IID, - mbox_factory_fn, NULL); - if (factory == NULL) { - g_error ("Unable to create mbox factory."); - } - - factory_initialised = TRUE; - local_storage = evolution_shell_client_get_local_storage (client); -} - diff --git a/mail/mail-importer.h b/mail/mail-importer.h deleted file mode 100644 index e50288c6c0..0000000000 --- a/mail/mail-importer.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* mail-importer.h - * - * Authors: Iain Holmes - * - * Copyright (C) 2001 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __MAIL_IMPORTER_H__ -#define __MAIL_IMPORTER_H__ - -#include -#include -#include -#include - -typedef struct _MailImporter MailImporter; -struct _MailImporter { - CamelFolder *folder; - CamelStreamMem *mstream; - - gboolean frozen; /* Is folder frozen? */ -}; - -void mail_importer_init (EvolutionShellClient *client); -void mail_importer_add_line (MailImporter *importer, - const char *str, - gboolean finished); -void mail_importer_create_folder (const char *parent_path, - const char *name, - const char *type, - const char *description); -#endif diff --git a/mail/mail-local.c b/mail/mail-local.c deleted file mode 100644 index 4d2a7e0615..0000000000 --- a/mail/mail-local.c +++ /dev/null @@ -1,1006 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* mail-local.c: Local mailbox support. */ - -/* - * Authors: - * Michael Zucchi - * Peter Williams - * Ettore Perazzoli - * Dan Winship - * - * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - TODO: - - If we are going to have all this LocalStore stuff, then the LocalStore - should have a reconfigure_folder method on it, as, in reality, it is - the maintainer of this information. - -*/ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include - -#include "Evolution.h" -#include "evolution-storage.h" -#include "evolution-shell-component.h" -#include "evolution-storage-listener.h" - -#include "camel/camel.h" -#include "camel/camel-vee-folder.h" - -#include "filter/vfolder-context.h" -#include "filter/vfolder-rule.h" -#include "filter/vfolder-editor.h" - -#include "mail.h" -#include "mail-local.h" -#include "mail-tools.h" -#include "folder-browser.h" -#include "mail-mt.h" - -#define d(x) - - -/* Local folder metainfo */ - -struct _local_meta { - char *path; /* path of metainfo file */ - - char *format; /* format of mailbox */ - char *name; /* name of mbox itself */ - int indexed; /* do we index the body? */ -}; - -static struct _local_meta * -load_metainfo(const char *path) -{ - xmlDocPtr doc; - xmlNodePtr node; - struct _local_meta *meta; - - meta = g_malloc0(sizeof(*meta)); - meta->path = g_strdup(path); - - d(printf("Loading folder metainfo from : %s\n", meta->path)); - - doc = xmlParseFile(meta->path); - if (doc == NULL) { - goto dodefault; - } - node = doc->root; - if (strcmp(node->name, "folderinfo")) { - goto dodefault; - } - node = node->childs; - while (node) { - if (!strcmp(node->name, "folder")) { - char *index, *txt; - - txt = xmlGetProp(node, "type"); - meta->format = g_strdup (txt ? txt : "mbox"); - xmlFree (txt); - - txt = xmlGetProp(node, "name"); - meta->name = g_strdup (txt ? txt : "mbox"); - xmlFree (txt); - - index = xmlGetProp(node, "index"); - if (index) { - meta->indexed = atoi(index); - xmlFree(index); - } else - meta->indexed = TRUE; - - } - node = node->next; - } - xmlFreeDoc(doc); - return meta; - - dodefault: - meta->format = g_strdup("mbox"); /* defaults */ - meta->name = g_strdup("mbox"); - meta->indexed = TRUE; - if (doc) - xmlFreeDoc(doc); - return meta; -} - -static void -free_metainfo(struct _local_meta *meta) -{ - g_free(meta->path); - g_free(meta->format); - g_free(meta->name); - g_free(meta); -} - -static int -save_metainfo(struct _local_meta *meta) -{ - xmlDocPtr doc; - xmlNodePtr root, node; - int ret; - - d(printf("Saving folder metainfo to : %s\n", meta->path)); - - doc = xmlNewDoc("1.0"); - root = xmlNewDocNode(doc, NULL, "folderinfo", NULL); - xmlDocSetRootElement(doc, root); - - node = xmlNewChild(root, NULL, "folder", NULL); - xmlSetProp(node, "type", meta->format); - xmlSetProp(node, "name", meta->name); - xmlSetProp(node, "index", meta->indexed?"1":"0"); - - ret = xmlSaveFile(meta->path, doc); - xmlFreeDoc(doc); - return ret; -} - - -/* MailLocalStore implementation */ -#define MAIL_LOCAL_STORE_TYPE (mail_local_store_get_type ()) -#define MAIL_LOCAL_STORE(obj) (CAMEL_CHECK_CAST((obj), MAIL_LOCAL_STORE_TYPE, MailLocalStore)) -#define MAIL_LOCAL_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), MAIL_LOCAL_STORE_TYPE, MailLocalStoreClass)) -#define MAIL_IS_LOCAL_STORE(o) (CAMEL_CHECK_TYPE((o), MAIL_LOCAL_STORE_TYPE)) - -typedef struct { - CamelStore parent_object; - - GNOME_Evolution_LocalStorage corba_local_storage; - EvolutionStorageListener *local_storage_listener; - - char *local_path; - int local_pathlen; - GHashTable *folders, /* points to MailLocalFolder */ - *unread; -} MailLocalStore; - -typedef struct { - CamelStoreClass parent_class; -} MailLocalStoreClass; - -typedef struct { - CamelFolder *folder; - MailLocalStore *local_store; - char *path, *name, *uri; - int last_unread; -} MailLocalFolder; - -static MailLocalStore *local_store; - -CamelType mail_local_store_get_type (void); - -static void local_folder_changed_proxy (CamelObject *folder, gpointer event_data, gpointer user_data); - -static char *get_name (CamelService *service, gboolean brief); - -static CamelFolder *get_folder (CamelStore *store, const char *folder_name, - guint32 flags, CamelException *ex); -static CamelFolderInfo *get_folder_info (CamelStore *store, const char *top, - gboolean fast, gboolean recursive, - gboolean subscribed_only, CamelException *ex); -static void delete_folder (CamelStore *store, const char *folder_name, - CamelException *ex); -static void rename_folder (CamelStore *store, const char *old_name, - const char *new_name, CamelException *ex); - -static CamelStoreClass *local_parent_class; - -static void -mail_local_store_class_init (MailLocalStoreClass *mail_local_store_class) -{ - CamelStoreClass *camel_store_class = - CAMEL_STORE_CLASS (mail_local_store_class); - CamelServiceClass *camel_service_class = - CAMEL_SERVICE_CLASS (mail_local_store_class); - - /* virtual method overload */ - camel_service_class->get_name = get_name; - - /* Don't cache folders */ - camel_store_class->hash_folder_name = NULL; - camel_store_class->compare_folder_name = NULL; - - camel_store_class->get_folder = get_folder; - camel_store_class->get_folder_info = get_folder_info; - camel_store_class->free_folder_info = camel_store_free_folder_info_full; - camel_store_class->delete_folder = delete_folder; - camel_store_class->rename_folder = rename_folder; - - local_parent_class = (CamelStoreClass *)camel_type_get_global_classfuncs(camel_store_get_type ()); -} - -static void -mail_local_store_init (gpointer object, gpointer klass) -{ - MailLocalStore *local_store = MAIL_LOCAL_STORE (object); - - local_store->corba_local_storage = CORBA_OBJECT_NIL; -} - -static void -free_local_folder(MailLocalFolder *lf) -{ - if (lf->folder) { - camel_object_unhook_event((CamelObject *)lf->folder, - "folder_changed", local_folder_changed_proxy, - lf); - camel_object_unhook_event((CamelObject *)lf->folder, - "message_changed", local_folder_changed_proxy, - lf); - camel_object_unref((CamelObject *)lf->folder); - } - g_free(lf->path); - g_free(lf->name); - g_free(lf->uri); - camel_object_unref((CamelObject *)lf->local_store); -} - -static void -free_folder (gpointer key, gpointer data, gpointer user_data) -{ - MailLocalFolder *lf = data; - - g_free(key); - free_local_folder(lf); -} - -static void -mail_local_store_finalize (gpointer object) -{ - MailLocalStore *local_store = MAIL_LOCAL_STORE (object); - CORBA_Environment ev; - - CORBA_exception_init (&ev); - if (!CORBA_Object_is_nil (local_store->corba_local_storage, &ev)) { - Bonobo_Unknown_unref (local_store->corba_local_storage, &ev); - CORBA_Object_release (local_store->corba_local_storage, &ev); - } - CORBA_exception_free (&ev); - - if (local_store->local_storage_listener) - gtk_object_unref (GTK_OBJECT (local_store->local_storage_listener)); - - g_hash_table_foreach (local_store->folders, free_folder, NULL); - g_hash_table_destroy (local_store->folders); - - g_free (local_store->local_path); -} - -CamelType -mail_local_store_get_type (void) -{ - static CamelType mail_local_store_type = CAMEL_INVALID_TYPE; - - if (mail_local_store_type == CAMEL_INVALID_TYPE) { - mail_local_store_type = camel_type_register ( - CAMEL_STORE_TYPE, "MailLocalStore", - sizeof (MailLocalStore), - sizeof (MailLocalStoreClass), - (CamelObjectClassInitFunc) mail_local_store_class_init, - NULL, - (CamelObjectInitFunc) mail_local_store_init, - (CamelObjectFinalizeFunc) mail_local_store_finalize); - } - - return mail_local_store_type; -} - -static CamelFolder * -get_folder (CamelStore *store, const char *folder_name, - guint32 flags, CamelException *ex) -{ - MailLocalStore *local_store = (MailLocalStore *)store; - CamelFolder *folder; - MailLocalFolder *local_folder; - - local_folder = g_hash_table_lookup (local_store->folders, folder_name); - if (local_folder) { - folder = local_folder->folder; - camel_object_ref (CAMEL_OBJECT (folder)); - } else { - folder = NULL; - camel_exception_setv (ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, - "No such folder %s", folder_name); - } - return folder; -} - -static void -populate_folders (gpointer key, gpointer data, gpointer user_data) -{ - GPtrArray *folders = user_data; - MailLocalFolder *folder; - CamelFolderInfo *fi; - - folder = data; - - fi = g_new0 (CamelFolderInfo, 1); - fi->full_name = g_strdup (folder->path); - fi->name = g_strdup (folder->name); - fi->url = g_strdup (folder->uri); - fi->unread_message_count = -1; - - g_ptr_array_add (folders, fi); -} - -static CamelFolderInfo * -get_folder_info (CamelStore *store, const char *top, - gboolean fast, gboolean recursive, - gboolean subscribed_only, CamelException *ex) -{ - MailLocalStore *local_store = MAIL_LOCAL_STORE (store); - CamelFolderInfo *fi = NULL; - GPtrArray *folders; - - folders = g_ptr_array_new (); - g_hash_table_foreach (local_store->folders, populate_folders, folders); - - fi = camel_folder_info_build (folders, top, '/', TRUE); - g_ptr_array_free (folders, TRUE); - - return fi; -} - -static void -delete_folder (CamelStore *store, const char *folder_name, CamelException *ex) -{ - /* No-op. The shell local storage deals with this. */ -} - -static void -rename_folder (CamelStore *store, const char *old, const char *new, - CamelException *ex) -{ - /* Probable no-op... */ -} - -static char * -get_name (CamelService *service, gboolean brief) -{ - return g_strdup ("Local mail folders"); -} - - -/* Callbacks for the EvolutionStorageListner signals. */ - -static void -local_storage_destroyed_cb (EvolutionStorageListener *storage_listener, - void *data) -{ - /* FIXME: Dunno how to handle this yet. */ - g_warning ("%s -- The LocalStorage has gone?!", __FILE__); -} - - -static void -local_folder_changed (CamelObject *object, gpointer event_data, - gpointer user_data) -{ - MailLocalFolder *local_folder = user_data; - int unread = GPOINTER_TO_INT (event_data); - char *display; - - if (unread != local_folder->last_unread) { - CORBA_Environment ev; - - CORBA_exception_init (&ev); - if (unread > 0) { - display = g_strdup_printf ("%s (%d)", local_folder->name, unread); - GNOME_Evolution_LocalStorage_updateFolder ( - local_folder->local_store->corba_local_storage, - local_folder->path, display, TRUE, &ev); - g_free (display); - } else { - GNOME_Evolution_LocalStorage_updateFolder ( - local_folder->local_store->corba_local_storage, - local_folder->path, local_folder->name, - FALSE, &ev); - } - CORBA_exception_free (&ev); - - local_folder->last_unread = unread; - } -} - -static void -local_folder_changed_proxy (CamelObject *folder, gpointer event_data, gpointer user_data) -{ - int unread; - - unread = camel_folder_get_unread_message_count (CAMEL_FOLDER (folder)); - mail_proxy_event (local_folder_changed, folder, - GINT_TO_POINTER (unread), user_data); -} - -/* ********************************************************************** */ -/* Register folder */ - -struct _register_msg { - struct _mail_msg msg; - - MailLocalFolder *local_folder; -}; - -static char *register_folder_desc(struct _mail_msg *mm, int done) -{ - struct _register_msg *m = (struct _register_msg *)mm; - - printf("returning description for %s\n", m->local_folder->uri); - - return g_strdup_printf(_("Opening '%s'"), m->local_folder->uri); -} - -static void -register_folder_register(struct _mail_msg *mm) -{ - struct _register_msg *m = (struct _register_msg *)mm; - MailLocalFolder *local_folder = m->local_folder; - char *name, *path = local_folder->uri + 7; - struct _local_meta *meta; - CamelStore *store; - guint32 flags; - - name = g_strdup_printf ("%s/local-metadata.xml", path); - meta = load_metainfo (name); - g_free (name); - - camel_operation_register(mm->cancel); - - name = g_strdup_printf ("%s:%s", meta->format, path); - store = camel_session_get_store (session, name, &mm->ex); - g_free (name); - if (!store) { - free_metainfo (meta); - camel_operation_unregister(mm->cancel); - return; - } - - flags = CAMEL_STORE_FOLDER_CREATE; - if (meta->indexed) - flags |= CAMEL_STORE_FOLDER_BODY_INDEX; - local_folder->folder = camel_store_get_folder (store, meta->name, flags, &mm->ex); - if (local_folder->folder) { - camel_object_hook_event (CAMEL_OBJECT (local_folder->folder), - "folder_changed", local_folder_changed_proxy, - local_folder); - camel_object_hook_event (CAMEL_OBJECT (local_folder->folder), - "message_changed", local_folder_changed_proxy, - local_folder); - local_folder->last_unread = camel_folder_get_unread_message_count(local_folder->folder); - } - - camel_object_unref (CAMEL_OBJECT (store)); - free_metainfo (meta); - - camel_operation_unregister(mm->cancel); -} - -static void -register_folder_registered(struct _mail_msg *mm) -{ - struct _register_msg *m = (struct _register_msg *)mm; - MailLocalFolder *local_folder = m->local_folder; - int unread; - - if (local_folder->folder) { - CamelStore *store = CAMEL_STORE (local_folder->local_store); - - g_hash_table_insert (local_folder->local_store->folders, local_folder->uri + 8, - local_folder); - - /* Add the folder to the vTrash folder */ - if (store->vtrash) - camel_vee_folder_add_folder (CAMEL_VEE_FOLDER (store->vtrash), - local_folder->folder); - - unread = local_folder->last_unread; - local_folder->last_unread = 0; - local_folder_changed (CAMEL_OBJECT (local_folder->folder), GINT_TO_POINTER (unread), - local_folder); - m->local_folder = NULL; - } -} - -static void -register_folder_free(struct _mail_msg *mm) -{ - struct _register_msg *m = (struct _register_msg *)mm; - - if (m->local_folder) - free_local_folder(m->local_folder); -} - -static struct _mail_msg_op register_folder_op = { - register_folder_desc, - register_folder_register, - register_folder_registered, - register_folder_free, -}; - -static void -local_storage_new_folder_cb (EvolutionStorageListener *storage_listener, - const char *path, - const GNOME_Evolution_Folder *folder, - void *data) -{ - MailLocalStore *local_store = data; - MailLocalFolder *local_folder; - struct _register_msg *m; - int id; - - if (strcmp (folder->type, "mail") != 0 || - strncmp (folder->physical_uri, "file://", 7) != 0 || - strncmp (folder->physical_uri + 7, local_store->local_path, - local_store->local_pathlen) != 0) - return; - - local_folder = g_new0 (MailLocalFolder, 1); - local_folder->name = g_strdup (strrchr (path, '/') + 1); - local_folder->path = g_strdup (path); - local_folder->uri = g_strdup (folder->physical_uri); - local_folder->local_store = local_store; - camel_object_ref((CamelObject *)local_store); - - m = mail_msg_new(®ister_folder_op, NULL, sizeof(*m)); - - m->local_folder = local_folder; - - /* run synchronous, the shell expects it (I think) */ - id = m->msg.seq; - e_thread_put(mail_thread_queued, (EMsg *)m); - mail_msg_wait(id); -} - -static void -local_storage_removed_folder_cb (EvolutionStorageListener *storage_listener, - const char *path, - void *data) -{ - MailLocalStore *local_store = data; - MailLocalFolder *local_folder; - - if (strncmp (path, "file://", 7) != 0 || - strncmp (path + 7, local_store->local_path, - local_store->local_pathlen) != 0) - return; - - local_folder = g_hash_table_lookup (local_store->folders, path + 8); - if (local_folder) { - g_hash_table_remove (local_store->folders, path); - free_local_folder(local_folder); - } -} - -static CamelProvider local_provider = { - "file", "Local mail", NULL, "mail", - CAMEL_PROVIDER_IS_STORAGE, CAMEL_URL_NEED_PATH, - { 0, 0 }, NULL -}; - -/* There's only one "file:" store. */ -static guint -non_hash (gconstpointer key) -{ - return 0; -} - -static gint -non_equal (gconstpointer a, gconstpointer b) -{ - return TRUE; -} - -void -mail_local_storage_startup (EvolutionShellClient *shellclient, - const char *evolution_path) -{ - GNOME_Evolution_StorageListener corba_local_storage_listener; - CORBA_Environment ev; - - /* Register with Camel to handle file: URLs */ - local_provider.object_types[CAMEL_PROVIDER_STORE] = - mail_local_store_get_type(); - - local_provider.service_cache = g_hash_table_new (non_hash, non_equal); - camel_session_register_provider (session, &local_provider); - - - /* Now build the storage. */ - local_store = (MailLocalStore *)camel_session_get_service ( - session, "file:/", CAMEL_PROVIDER_STORE, NULL); - if (!local_store) { - g_warning ("No local store!"); - return; - } - local_store->corba_local_storage = - evolution_shell_client_get_local_storage (shellclient); - if (local_store->corba_local_storage == CORBA_OBJECT_NIL) { - g_warning ("No local storage!"); - camel_object_unref (CAMEL_OBJECT (local_store)); - return; - } - - local_store->local_storage_listener = - evolution_storage_listener_new (); - corba_local_storage_listener = - evolution_storage_listener_corba_objref ( - local_store->local_storage_listener); - - gtk_signal_connect (GTK_OBJECT (local_store->local_storage_listener), - "destroyed", - GTK_SIGNAL_FUNC (local_storage_destroyed_cb), - local_store); - gtk_signal_connect (GTK_OBJECT (local_store->local_storage_listener), - "new_folder", - GTK_SIGNAL_FUNC (local_storage_new_folder_cb), - local_store); - gtk_signal_connect (GTK_OBJECT (local_store->local_storage_listener), - "removed_folder", - GTK_SIGNAL_FUNC (local_storage_removed_folder_cb), - local_store); - - local_store->local_path = g_strdup_printf ("%s/local", - evolution_path); - local_store->local_pathlen = strlen (local_store->local_path); - - local_store->folders = g_hash_table_new (g_str_hash, g_str_equal); - - CORBA_exception_init (&ev); - GNOME_Evolution_Storage_addListener (local_store->corba_local_storage, - corba_local_storage_listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Cannot add a listener to the Local Storage."); - camel_object_unref (CAMEL_OBJECT (local_store)); - CORBA_exception_free (&ev); - return; - } - CORBA_exception_free (&ev); -} - - -/* Local folder reconfiguration stuff */ - -/* - open new - copy old->new - close old - rename old oldsave - rename new old - open oldsave - delete oldsave - - close old - rename oldtmp - open new - open oldtmp - copy oldtmp new - close oldtmp - close oldnew - -*/ - -static void -update_progress(char *fmt, float percent) -{ - if (fmt) - mail_status(fmt); - /*mail_op_set_percentage (percent);*/ -} - -/* ******************** */ - -/* we should have our own progress bar for this */ - -struct _reconfigure_msg { - struct _mail_msg msg; - - FolderBrowser *fb; - gchar *newtype; - GtkWidget *frame; - GtkWidget *apply; - GtkWidget *cancel; - GtkOptionMenu *optionlist; -}; - -#if 0 -static gchar * -describe_reconfigure_folder (gpointer in_data, gboolean gerund) -{ - reconfigure_folder_input_t *input = (reconfigure_folder_input_t *) in_data; - - if (gerund) - return g_strdup_printf (_("Changing folder \"%s\" to \"%s\" format"), - input->fb->uri, - input->newtype); - else - return g_strdup_printf (_("Change folder \"%s\" to \"%s\" format"), - input->fb->uri, - input->newtype); -} -#endif - -static void -reconfigure_folder_reconfigure(struct _mail_msg *mm) -{ - struct _reconfigure_msg *m = (struct _reconfigure_msg *)mm; - MailLocalFolder *local_folder = NULL; - CamelStore *fromstore = NULL, *tostore = NULL; - char *fromurl = NULL, *tourl = NULL; - CamelFolder *fromfolder = NULL, *tofolder = NULL; - GPtrArray *uids; - int i; - char *metapath; - char *tmpname; - CamelURL *url = NULL; - struct _local_meta *meta = NULL; - guint32 flags; - - d(printf("reconfiguring folder: %s to type %s\n", m->fb->uri, m->newtype)); - - mail_status_start(_("Reconfiguring folder")); - - /* NOTE: This var is cleared by the folder_browser via the set_uri method */ - m->fb->reconfigure = TRUE; - - /* get the actual location of the mailbox */ - url = camel_url_new(m->fb->uri, &mm->ex); - if (camel_exception_is_set(&mm->ex)) { - g_warning("%s is not a workable url!", m->fb->uri); - goto cleanup; - } - - tmpname = strchr (m->fb->uri, '/'); - if (tmpname) { - while (*tmpname == '/') - tmpname++; - local_folder = g_hash_table_lookup (local_store->folders, tmpname); - } else - local_folder = NULL; - if (!local_folder) { - g_warning("%s is not a registered local folder!", m->fb->uri); - goto cleanup; - } - - metapath = g_strdup_printf("%s/local-metadata.xml", url->path); - meta = load_metainfo(metapath); - g_free(metapath); - - /* first, 'close' the old folder */ - update_progress(_("Closing current folder"), 0.0); - camel_folder_sync(local_folder->folder, FALSE, &mm->ex); - camel_object_unhook_event(CAMEL_OBJECT (local_folder->folder), - "folder_changed", local_folder_changed_proxy, - local_folder); - camel_object_unhook_event(CAMEL_OBJECT (local_folder->folder), - "message_changed", local_folder_changed_proxy, - local_folder); - /* Once for the FolderBrowser, once for the local store */ - camel_object_unref(CAMEL_OBJECT(local_folder->folder)); - camel_object_unref(CAMEL_OBJECT(local_folder->folder)); - local_folder->folder = m->fb->folder = NULL; - - camel_url_set_protocol (url, meta->format); - fromurl = camel_url_to_string (url, FALSE); - camel_url_set_protocol (url, m->newtype); - tourl = camel_url_to_string (url, FALSE); - - d(printf("opening stores %s and %s\n", fromurl, tourl)); - - fromstore = camel_session_get_store(session, fromurl, &mm->ex); - - if (camel_exception_is_set(&mm->ex)) - goto cleanup; - - tostore = camel_session_get_store(session, tourl, &mm->ex); - if (camel_exception_is_set(&mm->ex)) - goto cleanup; - - /* rename the old mbox and open it again, without indexing */ - tmpname = g_strdup_printf("%s_reconfig", meta->name); - d(printf("renaming %s to %s, and opening it\n", meta->name, tmpname)); - update_progress(_("Renaming old folder and opening"), 0.0); - - camel_store_rename_folder(fromstore, meta->name, tmpname, &mm->ex); - if (camel_exception_is_set(&mm->ex)) { - goto cleanup; - } - - /* we dont need to set the create flag ... or need an index if it has one */ - fromfolder = camel_store_get_folder(fromstore, tmpname, 0, &mm->ex); - if (fromfolder == NULL || camel_exception_is_set(&mm->ex)) { - /* try and recover ... */ - camel_exception_clear (&mm->ex); - camel_store_rename_folder(fromstore, tmpname, meta->name, &mm->ex); - goto cleanup; - } - - /* create a new mbox */ - d(printf("Creating the destination mbox\n")); - update_progress(_("Creating new folder"), 0.0); - - flags = CAMEL_STORE_FOLDER_CREATE; - if (meta->indexed) - flags |= CAMEL_STORE_FOLDER_BODY_INDEX; - tofolder = camel_store_get_folder(tostore, meta->name, flags, &mm->ex); - if (tofolder == NULL || camel_exception_is_set(&mm->ex)) { - d(printf("cannot open destination folder\n")); - /* try and recover ... */ - camel_exception_clear (&mm->ex); - camel_store_rename_folder(fromstore, tmpname, meta->name, &mm->ex); - goto cleanup; - } - - update_progress(_("Copying messages"), 0.0); - uids = camel_folder_get_uids(fromfolder); - for (i=0;ilen;i++) { - mail_statusf("Copying message %d of %d", i, uids->len); - camel_folder_move_message_to(fromfolder, uids->pdata[i], tofolder, &mm->ex); - if (camel_exception_is_set(&mm->ex)) { - camel_folder_free_uids(fromfolder, uids); - goto cleanup; - } - } - camel_folder_free_uids(fromfolder, uids); - camel_folder_expunge(fromfolder, &mm->ex); - - d(printf("delete old mbox ...\n")); - camel_store_delete_folder(fromstore, tmpname, &mm->ex); - - /* switch format */ - g_free(meta->format); - meta->format = g_strdup(m->newtype); - if (save_metainfo(meta) == -1) { - camel_exception_setv (&mm->ex, CAMEL_EXCEPTION_SYSTEM, - _("Cannot save folder metainfo; " - "you'll probably find you can't\n" - "open this folder anymore: %s"), - tourl); - } - - cleanup: - if (local_folder && !local_folder->folder) { - struct _register_msg *rm = mail_msg_new(®ister_folder_op, NULL, sizeof(*m)); - - /* fake the internal part of this operation, nasty hackish thing */ - rm->local_folder = local_folder; - register_folder_register((struct _mail_msg *)rm); - rm->local_folder = NULL; - mail_msg_free((struct _mail_msg *)rm); - } - if (tofolder) - camel_object_unref (CAMEL_OBJECT (tofolder)); - if (fromfolder) - camel_object_unref (CAMEL_OBJECT (fromfolder)); - if (fromstore) - camel_object_unref (CAMEL_OBJECT (fromstore)); - if (tostore) - camel_object_unref (CAMEL_OBJECT (tostore)); - if (meta) - free_metainfo(meta); - g_free(fromurl); - g_free(tourl); - if (url) - camel_url_free (url); -} - -static void -reconfigure_folder_reconfigured(struct _mail_msg *mm) -{ - struct _reconfigure_msg *m = (struct _reconfigure_msg *)mm; - char *uri; - - if (camel_exception_is_set(&mm->ex)) { - gnome_error_dialog (_("If you can no longer open this mailbox, then\n" - "you may need to repair it manually.")); - } - - /* force a reload of the newly formatted folder */ - d(printf("opening new source\n")); - uri = g_strdup(m->fb->uri); - folder_browser_set_uri(m->fb, uri); - g_free(uri); -} - -static void -reconfigure_folder_free(struct _mail_msg *mm) -{ - struct _reconfigure_msg *m = (struct _reconfigure_msg *)mm; - - gtk_object_unref (GTK_OBJECT (m->fb)); - g_free (m->newtype); -} - -static struct _mail_msg_op reconfigure_folder_op = { - NULL, - reconfigure_folder_reconfigure, - reconfigure_folder_reconfigured, - reconfigure_folder_free, -}; - -static void -reconfigure_clicked(GnomeDialog *d, int button, struct _reconfigure_msg *m) -{ - if (button == 0) { - GtkMenu *menu; - int type; - char *types[] = { "mbox", "maildir", "mh" }; - - menu = (GtkMenu *)gtk_option_menu_get_menu(m->optionlist); - type = g_list_index(GTK_MENU_SHELL(menu)->children, gtk_menu_get_active(menu)); - if (type < 0 || type > 2) - type = 0; - - gtk_widget_set_sensitive(m->frame, FALSE); - gtk_widget_set_sensitive(m->apply, FALSE); - gtk_widget_set_sensitive(m->cancel, FALSE); - - m->newtype = g_strdup (types[type]); - e_thread_put(mail_thread_queued, (EMsg *)m); - } else - mail_msg_free((struct _mail_msg *)m); - - if (button != -1) - gnome_dialog_close(d); -} - -void -mail_local_reconfigure_folder(FolderBrowser *fb) -{ - CamelStore *store; - GladeXML *gui; - GnomeDialog *gd; - struct _reconfigure_msg *m; - - if (fb->folder == NULL) { - g_warning("Trying to reconfigure nonexistant folder"); - return; - } - - m = mail_msg_new(&reconfigure_folder_op, NULL, sizeof(*m)); - store = camel_folder_get_parent_store(fb->folder); - - gui = glade_xml_new(EVOLUTION_GLADEDIR "/local-config.glade", "dialog_format"); - gd = (GnomeDialog *)glade_xml_get_widget (gui, "dialog_format"); - - m->frame = glade_xml_get_widget (gui, "frame_format"); - m->apply = glade_xml_get_widget (gui, "apply_format"); - m->cancel = glade_xml_get_widget (gui, "cancel_format"); - m->optionlist = (GtkOptionMenu *)glade_xml_get_widget (gui, "option_format"); - m->newtype = NULL; - m->fb = fb; - gtk_object_ref((GtkObject *)fb); - - gtk_label_set_text((GtkLabel *)glade_xml_get_widget (gui, "label_format"), - ((CamelService *)store)->url->protocol); - - gtk_signal_connect((GtkObject *)gd, "clicked", reconfigure_clicked, m); - gtk_object_unref((GtkObject *)gui); - - gnome_dialog_run_and_close (GNOME_DIALOG (gd)); -} diff --git a/mail/mail-local.h b/mail/mail-local.h deleted file mode 100644 index 254fcbe4f6..0000000000 --- a/mail/mail-local.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* mail-local.h: Local mailbox support. */ - -/* - * Authors: - * Michael Zucchi - * Dan Winship - * - * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#ifndef _MAIL_LOCAL_H -#define _MAIL_LOCAL_H - -#include "evolution-shell-client.h" -#include "folder-browser.h" - -void mail_local_storage_startup (EvolutionShellClient *shellclient, - const char *evolution_path); - -void mail_local_reconfigure_folder (FolderBrowser *fb); - -#endif diff --git a/mail/mail-mlist-magic.c b/mail/mail-mlist-magic.c deleted file mode 100644 index 8fb588d701..0000000000 --- a/mail/mail-mlist-magic.c +++ /dev/null @@ -1,271 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* mail-mlist-magic.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -#include "camel.h" - -#include "mail-mlist-magic.h" - -/* FIXME: This really should just use regexps... */ - - -/* Utility functions. */ - -static char * -extract_until_at_sign (const char *s) -{ - const char *at_sign; - - at_sign = strchr (s, '@'); - if (at_sign == NULL) - return g_strdup (s); - - if (at_sign == s) - return NULL; - - return g_strndup (s, at_sign - s); -} - -static const char * -get_header (CamelMimeMessage *message, - const char *header_name) -{ - const char *value; - - value = camel_medium_get_header (CAMEL_MEDIUM (message), header_name); - if (value == NULL) - return NULL; - - /* FIXME: Correct? */ - while (isspace ((int) *value)) - value++; - - return value; -} - - -/* The checks. */ - -/* Sender: (owner-([^@]+)|([^@+]-owner)@ */ -static char * -check_sender (CamelMimeMessage *message, - const char **header_name_return, - char **header_value_return) -{ - const char *value; - char *owner, *list_name; - - value = get_header (message, "Sender"); - if (value == NULL) - return NULL; - - owner = strstr (value, "owner"); - if (!owner) - return NULL; - - if (owner == value && value[5] == '-' && value[6] && value[6] != '@') - list_name = extract_until_at_sign (value + 6); - else if (owner > value + 1 && *(owner - 1) == '-' && owner[5] == '@') - list_name = g_strndup (value, owner - 1 - value); - else - return NULL; - - if (header_name_return != NULL) - *header_name_return = "Sender"; - if (header_value_return != NULL) - *header_value_return = g_strdup (value); - return list_name; -} - -/* X-BeenThere: ([^@]+) */ -static char * -check_x_been_there (CamelMimeMessage *message, - const char **header_name_return, - char **header_value_return) -{ - const char *value; - - value = get_header (message, "X-BeenThere"); - if (value == NULL || *value == '@') - return NULL; - - if (header_name_return != NULL) - *header_name_return = "X-BeenThere"; - if (header_value_return != NULL) - *header_value_return = g_strdup (value); - - return extract_until_at_sign (value); -} - -/* Delivered-To: mailing list ([^@]+) */ -static char * -check_delivered_to (CamelMimeMessage *message, - const char **header_name_return, - char **header_value_return) -{ - const char *value; - - value = get_header (message, "Delivered-To"); - if (value == NULL) - return NULL; - - /* FIXME uh? */ - if (strncmp (value, "mailing list ", 13) != 0) - return NULL; - - if (value[13] == '\0' || value[13] == '@') - return NULL; - - if (header_name_return != NULL) - *header_name_return = "Delivered-To"; - if (header_value_return != NULL) - *header_value_return = g_strdup (value); - return extract_until_at_sign (value + 13); -} - -/* X-Mailing-List: <([^@]+) */ -static char * -check_x_mailing_list (CamelMimeMessage *message, - const char **header_name_return, - char **header_value_return) -{ - const char *value; - int value_length; - - value = get_header (message, "X-Mailing-List"); - if (value == NULL) - return NULL; - - if (value[0] != '<' || value[1] == '\0' || value[1] == '@') - return NULL; - - value_length = strlen (value); - if (value[value_length - 1] != '>') - return NULL; - - if (header_name_return != NULL) - *header_name_return = "X-Mailing-List"; - if (header_value_return != NULL) - *header_value_return = g_strdup (value); - return extract_until_at_sign (value + 1); -} - -/* X-Loop: ([^@]+) */ -static char * -check_x_loop (CamelMimeMessage *message, - const char **header_name_return, - char **header_value_return) -{ - const char *value; - - value = get_header (message, "X-Loop"); - if (value == NULL) - return NULL; - - if (*value == '\0' || *value == '@') - return NULL; - - if (header_name_return != NULL) - *header_name_return = "X-Loop"; - if (header_value_return != NULL) - *header_value_return = g_strdup (value); - - return extract_until_at_sign (value); -} - -/* List-Post: -#include - -#include "e-util/e-msgport.h" -#include "camel/camel-operation.h" -#include -#include - -#include "mail-mt.h" - -#include -#include -#include -#include -#include - -#include "folder-browser-factory.h" - -#include -#include - -/*#define MALLOC_CHECK*/ -#define d(x) - -static void set_view_data(const char *current_message, int busy); -static void set_stop(int sensitive); -static void mail_enable_stop(void); -static void mail_disable_stop(void); -static void mail_operation_status(struct _CamelOperation *op, const char *what, int pc, void *data); - -#define MAIL_MT_LOCK(x) pthread_mutex_lock(&x) -#define MAIL_MT_UNLOCK(x) pthread_mutex_unlock(&x) - -/* background operation status stuff */ -struct _mail_msg_priv { - GtkProgressBar *bar; - GtkLabel *label; - - /* for pending requests, before timeout_id is activated (then bar will be ! NULL) */ - char *what; - int pc; - int timeout_id; -}; - -static GtkWindow *progress_dialogue; -static int progress_row; - -/* mail_msg stuff */ -static unsigned int mail_msg_seq; /* sequence number of each message */ -static GHashTable *mail_msg_active; /* table of active messages, must hold mail_msg_lock to access */ -static pthread_mutex_t mail_msg_lock = PTHREAD_MUTEX_INITIALIZER; -static pthread_cond_t mail_msg_cond = PTHREAD_COND_INITIALIZER; - -pthread_t mail_gui_thread; - -void *mail_msg_new(mail_msg_op_t *ops, EMsgPort *reply_port, size_t size) -{ - struct _mail_msg *msg; - - MAIL_MT_LOCK(mail_msg_lock); - - msg = g_malloc0(size); - msg->ops = ops; - msg->seq = mail_msg_seq++; - msg->msg.reply_port = reply_port; - msg->cancel = camel_operation_new(mail_operation_status, (void *)msg->seq); - camel_exception_init(&msg->ex); - msg->priv = g_malloc0(sizeof(*msg->priv)); - - g_hash_table_insert(mail_msg_active, (void *)msg->seq, msg); - - d(printf("New message %p\n", msg)); - - MAIL_MT_UNLOCK(mail_msg_lock); - - return msg; -} - -/* either destroy the progress (in event_data), or the whole dialogue (in data) */ -static void destroy_widgets(CamelObject *o, void *event_data, void *data) -{ - if (data) - gtk_widget_destroy((GtkWidget *)data); - if (event_data) - gtk_widget_destroy((GtkWidget *)event_data); -} - -#ifdef MALLOC_CHECK -#include - -static void -checkmem(void *p) -{ - if (p) { - int status = mprobe(p); - - switch (status) { - case MCHECK_HEAD: - printf("Memory underrun at %p\n", p); - abort(); - case MCHECK_TAIL: - printf("Memory overrun at %p\n", p); - abort(); - case MCHECK_FREE: - printf("Double free %p\n", p); - abort(); - } - } -} -#endif - -void mail_msg_free(void *msg) -{ - struct _mail_msg *m = msg; - -#ifdef MALLOC_CHECK - checkmem(m); - checkmem(m->cancel); - checkmem(m->priv); -#endif - d(printf("Free message %p\n", msg)); - - if (m->ops->destroy_msg) - m->ops->destroy_msg(m); - - MAIL_MT_LOCK(mail_msg_lock); - - g_hash_table_remove(mail_msg_active, (void *)m->seq); - pthread_cond_broadcast(&mail_msg_cond); - - /* this closes the bar, and/or the whole progress dialogue, once we're out of things to do */ - if (g_hash_table_size(mail_msg_active) == 0) { - if (progress_dialogue != NULL) { - void *data = progress_dialogue; - progress_dialogue = NULL; - progress_row = 0; - mail_proxy_event(destroy_widgets, NULL, data, NULL); - } - } else if (m->priv->bar) { - mail_proxy_event(destroy_widgets, NULL, m->priv->bar, m->priv->label); - } - - if (m->priv->timeout_id > 0) - gtk_timeout_remove(m->priv->timeout_id); - - MAIL_MT_UNLOCK(mail_msg_lock); - - camel_operation_unref(m->cancel); - camel_exception_clear(&m->ex); - g_free(m->priv->what); - g_free(m->priv); - g_free(m); -} - -void mail_msg_check_error(void *msg) -{ - struct _mail_msg *m = msg; - char *what = NULL; - char *text; - GnomeDialog *gd; - -#ifdef MALLOC_CHECK - checkmem(m); - checkmem(m->cancel); - checkmem(m->priv); -#endif - - if (!camel_exception_is_set(&m->ex) - || m->ex.id == CAMEL_EXCEPTION_USER_CANCEL) - return; - - if (m->ops->describe_msg) - what = m->ops->describe_msg(m, FALSE); - - if (what) - text = g_strdup_printf(_("Error while '%s':\n%s"), what, camel_exception_get_description(&m->ex)); - else - text = g_strdup_printf(_("Error while performing operation:\n%s"), camel_exception_get_description(&m->ex)); - - gd = (GnomeDialog *)gnome_error_dialog(text); - gnome_dialog_run_and_close(gd); - g_free(text); -} - -void mail_msg_cancel(unsigned int msgid) -{ - struct _mail_msg *m; - - MAIL_MT_LOCK(mail_msg_lock); - m = g_hash_table_lookup(mail_msg_active, (void *)msgid); - - if (m) - camel_operation_cancel(m->cancel); - - MAIL_MT_UNLOCK(mail_msg_lock); -} - - -/* waits for a message to be finished processing (freed) - the messageid is from struct _mail_msg->seq */ -void mail_msg_wait(unsigned int msgid) -{ - struct _mail_msg *m; - int ismain = pthread_self() == mail_gui_thread; - - if (ismain) { - MAIL_MT_LOCK(mail_msg_lock); - m = g_hash_table_lookup(mail_msg_active, (void *)msgid); - while (m) { - MAIL_MT_UNLOCK(mail_msg_lock); - gtk_main_iteration(); - MAIL_MT_LOCK(mail_msg_lock); - m = g_hash_table_lookup(mail_msg_active, (void *)msgid); - } - MAIL_MT_UNLOCK(mail_msg_lock); - } else { - MAIL_MT_LOCK(mail_msg_lock); - m = g_hash_table_lookup(mail_msg_active, (void *)msgid); - while (m) { - pthread_cond_wait(&mail_msg_cond, &mail_msg_lock); - m = g_hash_table_lookup(mail_msg_active, (void *)msgid); - } - MAIL_MT_UNLOCK(mail_msg_lock); - } -} - -EMsgPort *mail_gui_port; -static GIOChannel *mail_gui_channel; -EMsgPort *mail_gui_reply_port; -static GIOChannel *mail_gui_reply_channel; - -/* a couple of global threads available */ -EThread *mail_thread_queued; /* for operations that can (or should) be queued */ -EThread *mail_thread_new; /* for operations that should run in a new thread each time */ - -static gboolean -mail_msgport_replied(GIOChannel *source, GIOCondition cond, void *d) -{ - EMsgPort *port = (EMsgPort *)d; - mail_msg_t *m; - - while (( m = (mail_msg_t *)e_msgport_get(port))) { - -#ifdef MALLOC_CHECK - checkmem(m); - checkmem(m->cancel); - checkmem(m->priv); -#endif - - if (m->ops->reply_msg) - m->ops->reply_msg(m); - mail_msg_check_error(m); - if (m->ops->describe_msg) - mail_status_end(); - mail_msg_free(m); - } - - return TRUE; -} - -static gboolean -mail_msgport_received(GIOChannel *source, GIOCondition cond, void *d) -{ - EMsgPort *port = (EMsgPort *)d; - mail_msg_t *m; - - while (( m = (mail_msg_t *)e_msgport_get(port))) { -#ifdef MALLOC_CHECK - checkmem(m); - checkmem(m->cancel); - checkmem(m->priv); -#endif - if (m->ops->describe_msg) { - char *text = m->ops->describe_msg(m, FALSE); - mail_status_start(text); - g_free(text); - } - if (m->ops->receive_msg) - m->ops->receive_msg(m); - if (m->msg.reply_port) - e_msgport_reply((EMsg *)m); - else { - if (m->ops->reply_msg) - m->ops->reply_msg(m); - if (m->ops->describe_msg) - mail_status_end(); - mail_msg_free(m); - } - } - - return TRUE; -} - -static void -mail_msg_destroy(EThread *e, EMsg *msg, void *data) -{ - mail_msg_t *m = (mail_msg_t *)msg; - -#ifdef MALLOC_CHECK - checkmem(m); - checkmem(m->cancel); - checkmem(m->priv); -#endif - - if (m->ops->describe_msg) - mail_status_end(); - mail_msg_free(m); -} - -static void -mail_msg_received(EThread *e, EMsg *msg, void *data) -{ - mail_msg_t *m = (mail_msg_t *)msg; - -#ifdef MALLOC_CHECK - checkmem(m); - checkmem(m->cancel); - checkmem(m->priv); -#endif - - if (m->ops->describe_msg) { - char *text = m->ops->describe_msg(m, FALSE); - d(printf("message received at thread\n")); - mail_status_start(text); - g_free(text); - } - - if (m->ops->receive_msg) { - mail_enable_stop(); - m->ops->receive_msg(m); - mail_disable_stop(); - } -} - -static void mail_msg_cleanup(void) -{ - e_thread_destroy(mail_thread_queued); - e_thread_destroy(mail_thread_new); - - e_msgport_destroy(mail_gui_port); - e_msgport_destroy(mail_gui_reply_port); - - /* FIXME: channels too, etc */ -} - -void mail_msg_init(void) -{ - mail_gui_reply_port = e_msgport_new(); - mail_gui_reply_channel = g_io_channel_unix_new(e_msgport_fd(mail_gui_reply_port)); - g_io_add_watch(mail_gui_reply_channel, G_IO_IN, mail_msgport_replied, mail_gui_reply_port); - - mail_gui_port = e_msgport_new(); - mail_gui_channel = g_io_channel_unix_new(e_msgport_fd(mail_gui_port)); - g_io_add_watch(mail_gui_channel, G_IO_IN, mail_msgport_received, mail_gui_port); - - mail_thread_queued = e_thread_new(E_THREAD_QUEUE); - e_thread_set_msg_destroy(mail_thread_queued, mail_msg_destroy, 0); - e_thread_set_msg_received(mail_thread_queued, mail_msg_received, 0); - e_thread_set_reply_port(mail_thread_queued, mail_gui_reply_port); - - mail_thread_new = e_thread_new(E_THREAD_NEW); - e_thread_set_msg_destroy(mail_thread_new, mail_msg_destroy, 0); - e_thread_set_msg_received(mail_thread_new, mail_msg_received, 0); - e_thread_set_reply_port(mail_thread_new, mail_gui_reply_port); - - mail_msg_active = g_hash_table_new(NULL, NULL); - mail_gui_thread = pthread_self(); - - atexit(mail_msg_cleanup); -} - -/* ********************************************************************** */ - -struct _set_msg { - struct _mail_msg msg; - char *text; -}; - -/* locks */ -static pthread_mutex_t status_lock = PTHREAD_MUTEX_INITIALIZER; -#define STATUS_BUSY_PENDING (2) - -/* blah blah */ - -#define STATUS_DELAY (5) - -static int status_depth; -static int status_showing; -static int status_shown; -static char *status_message_next; -static int status_message_clear; -static int status_timeout_id; -/*static int status_busy;*/ - -struct _status_msg { - struct _mail_msg msg; - char *text; - int busy; -}; - -static gboolean -status_timeout(void *data) -{ - char *msg; - int busy = 0; - - d(printf("got status timeout\n")); - - MAIL_MT_LOCK(status_lock); - if (status_message_next) { - d(printf("setting message to '%s' busy %d\n", status_message_next, status_busy)); - msg = status_message_next; - status_message_next = NULL; - busy = status_depth > 0; - status_message_clear = 0; - MAIL_MT_UNLOCK(status_lock); - - /* copy msg so we can set it outside the lock */ - /* unset first is a hack to avoid the stack stuff that doesn't and can't work anyway */ - if (status_shown) - set_view_data(NULL, FALSE); - status_shown = TRUE; - set_view_data(msg, busy); - g_free(msg); - return TRUE; - } - - /* the delay-clear stuff doesn't work yet. Dont care ... */ - - status_showing = FALSE; - status_message_clear++; - if (status_message_clear >= STATUS_DELAY && status_depth==0) { - d(printf("clearing message, busy = %d\n", status_depth)); - } else { - d(printf("delaying clear\n")); - MAIL_MT_UNLOCK(status_lock); - return TRUE; - } - - status_timeout_id = 0; - - MAIL_MT_UNLOCK(status_lock); - - if (status_shown) - set_view_data(NULL, FALSE); - status_shown = FALSE; - - return FALSE; -} - -static void do_set_status(struct _mail_msg *mm) -{ - struct _status_msg *m = (struct _status_msg *)mm; - - MAIL_MT_LOCK(status_lock); - - if (status_timeout_id != 0) - gtk_timeout_remove(status_timeout_id); - - status_timeout_id = gtk_timeout_add(500, status_timeout, 0); - status_message_clear = 0; - - MAIL_MT_UNLOCK(status_lock); - - /* the 'clear' stuff doesn't really work yet, but oh well, - this stuff here needs a little changing for it to work */ - if (status_shown) - set_view_data(NULL, status_depth != 0); - status_shown = 0; - - if (m->text) { - status_shown = 1; - set_view_data(m->text, status_depth != 0); - } -} - -static void do_del_status(struct _mail_msg *mm) -{ - struct _status_msg *m = (struct _status_msg *)mm; - - g_free(m->text); -} - -struct _mail_msg_op set_status_op = { - NULL, - do_set_status, - NULL, - do_del_status, -}; - -/* start a new operation */ -void mail_status_start(const char *msg) -{ - struct _status_msg *m = NULL; - - MAIL_MT_LOCK(status_lock); - status_depth++; - MAIL_MT_UNLOCK(status_lock); - - if (msg == NULL || msg[0] == 0) - msg = _("Working"); - - m = mail_msg_new(&set_status_op, NULL, sizeof(*m)); - m->text = g_strdup(msg); - m->busy = TRUE; - - e_msgport_put(mail_gui_port, &m->msg.msg); -} - -/* end it */ -void mail_status_end(void) -{ - struct _status_msg *m = NULL; - - m = mail_msg_new(&set_status_op, NULL, sizeof(*m)); - m->text = NULL; - - MAIL_MT_LOCK(status_lock); - status_depth--; - m->busy = status_depth = 0; - MAIL_MT_UNLOCK(status_lock); - - e_msgport_put(mail_gui_port, &m->msg.msg); -} - -/* message during it */ -void mail_status(const char *msg) -{ - if (msg == NULL || msg[0] == 0) - msg = _("Working"); - - MAIL_MT_LOCK(status_lock); - - g_free(status_message_next); - status_message_next = g_strdup(msg); - - MAIL_MT_UNLOCK(status_lock); -} - -void mail_statusf(const char *fmt, ...) -{ - va_list ap; - char *text; - - va_start(ap, fmt); - text = g_strdup_vprintf(fmt, ap); - va_end(ap); - mail_status(text); - g_free(text); -} - -/* ********************************************************************** */ - -struct _pass_msg { - struct _mail_msg msg; - char *prompt; - int secret; - char *result; -}; - -/* libgnomeui's idea of an api/gui is very weird ... hence this dumb hack */ -static void focus_on_entry(GtkWidget *widget, void *user_data) -{ - if (GTK_IS_ENTRY(widget)) - gtk_widget_grab_focus(widget); -} - -static void pass_got(char *string, void *data) -{ - struct _pass_msg *m = data; - - if (string) - m->result = g_strdup (string); -} - -static void -do_get_pass(struct _mail_msg *mm) -{ - struct _pass_msg *m = (struct _pass_msg *)mm; - GtkWidget *dialogue; - - /* this api is just awful ... hence the hacks */ - dialogue = gnome_request_dialog(m->secret, m->prompt, NULL, - 0, pass_got, m, NULL); - e_container_foreach_leaf((GtkContainer *)dialogue, focus_on_entry, NULL); - - /* hrm, we can't run this async since the gui_port from which we're called - will reply to our message for us */ - gnome_dialog_run_and_close((GnomeDialog *)dialogue); - - /*gtk_widget_show(dialogue);*/ -} - -static void -do_free_pass(struct _mail_msg *mm) -{ - /*struct _pass_msg *m = (struct _pass_msg *)mm;*/ - - /* the string is passed out so we dont need to free it */ -} - -struct _mail_msg_op get_pass_op = { - NULL, - do_get_pass, - NULL, - do_free_pass, -}; - -/* returns the password, or NULL if cancelled */ -char * -mail_get_password(char *prompt, gboolean secret) -{ - char *ret; - struct _pass_msg *m, *r; - EMsgPort *pass_reply; - - pass_reply = e_msgport_new(); - - m = mail_msg_new(&get_pass_op, pass_reply, sizeof(*m)); - - m->prompt = prompt; - m->secret = secret; - - if (pthread_self() == mail_gui_thread) { - do_get_pass((struct _mail_msg *)m); - r = m; - } else { - static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; - - /* we want this single-threaded, this is the easiest way to do it without blocking ? */ - pthread_mutex_lock(&lock); - e_msgport_put(mail_gui_port, (EMsg *)m); - e_msgport_wait(pass_reply); - r = (struct _pass_msg *)e_msgport_get(pass_reply); - pthread_mutex_unlock(&lock); - } - - g_assert(r == m); - - ret = m->result; - - mail_msg_free(m); - e_msgport_destroy(pass_reply); - - return ret; -} - -/* ******************** */ - -struct _proxy_msg { - struct _mail_msg msg; - CamelObjectEventHookFunc func; - CamelObject *o; - void *event_data; - void *data; -}; - -static void -do_proxy_event(struct _mail_msg *mm) -{ - struct _proxy_msg *m = (struct _proxy_msg *)mm; - - m->func(m->o, m->event_data, m->data); -} - -struct _mail_msg_op proxy_event_op = { - NULL, - do_proxy_event, - NULL, - NULL, -}; - -int mail_proxy_event(CamelObjectEventHookFunc func, CamelObject *o, void *event_data, void *data) -{ - struct _proxy_msg *m; - int id; - int ismain = pthread_self() == mail_gui_thread; - - if (ismain) { - func(o, event_data, data); - /* id of -1 is 'always finished' */ - return -1; - } else { - /* we dont have a reply port for this, we dont care when/if it gets executed, just queue it */ - m = mail_msg_new(&proxy_event_op, NULL, sizeof(*m)); - m->func = func; - m->o = o; - m->event_data = event_data; - m->data = data; - - id = m->msg.seq; - e_msgport_put(mail_gui_port, (EMsg *)m); - return id; - } -} - -/* ********************************************************************** */ -/* locked via status_lock */ -static int busy_state; - -static void do_set_busy(struct _mail_msg *mm) -{ - set_stop(busy_state > 0); -} - -struct _mail_msg_op set_busy_op = { - NULL, - do_set_busy, - NULL, - NULL, -}; - -static void mail_enable_stop(void) -{ - struct _mail_msg *m; - - MAIL_MT_LOCK(status_lock); - busy_state++; - if (busy_state == 1) { - m = mail_msg_new(&set_busy_op, NULL, sizeof(*m)); - e_msgport_put(mail_gui_port, (EMsg *)m); - } - MAIL_MT_UNLOCK(status_lock); -} - -static void mail_disable_stop(void) -{ - struct _mail_msg *m; - - MAIL_MT_LOCK(status_lock); - busy_state--; - if (busy_state == 0) { - m = mail_msg_new(&set_busy_op, NULL, sizeof(*m)); - e_msgport_put(mail_gui_port, (EMsg *)m); - } - MAIL_MT_UNLOCK(status_lock); -} - -/* ******************************************************************************** */ - -struct _op_status_msg { - struct _mail_msg msg; - - struct _CamelOperation *op; - char *what; - int pc; - void *data; -}; - -GtkTable *progress_table; - -static int op_status_timeout(void *d) -{ - int id = (int)d; - struct _mail_msg *msg; - struct _mail_msg_priv *data; - - MAIL_MT_LOCK(mail_msg_lock); - - msg = g_hash_table_lookup(mail_msg_active, (void *)id); - if (msg == NULL) { - MAIL_MT_UNLOCK(mail_msg_lock); - return FALSE; - } - - data = msg->priv; - - if (progress_dialogue == NULL) { - progress_dialogue = (GtkWindow *)gtk_window_new(GTK_WINDOW_DIALOG); - gtk_window_set_title(progress_dialogue, _("Evolution progress")); - gtk_window_set_policy(progress_dialogue, 0, 0, 1); - gtk_window_set_position(progress_dialogue, GTK_WIN_POS_CENTER); - progress_table = (GtkTable *)gtk_table_new(1, 2, FALSE); - gtk_container_add((GtkContainer *)progress_dialogue, (GtkWidget *)progress_table); - } - - data->bar = (GtkProgressBar *)gtk_progress_bar_new(); - gtk_progress_set_show_text((GtkProgress *)data->bar, TRUE); - - gtk_progress_set_percentage((GtkProgress *)data->bar, (gfloat)(data->pc/100.0)); - gtk_progress_set_format_string((GtkProgress *)data->bar, data->what); - - if (msg->ops->describe_msg) { - char *desc = msg->ops->describe_msg(msg, FALSE); - data->label = (GtkLabel *)gtk_label_new(desc); - g_free(desc); - } else { - data->label = (GtkLabel *)gtk_label_new(_("Working")); - } - - gtk_table_attach(progress_table, (GtkWidget *)data->label, 0, 1, progress_row, progress_row+1, GTK_EXPAND|GTK_FILL, 0, 3, 1); - gtk_table_attach(progress_table, (GtkWidget *)data->bar, 1, 2, progress_row, progress_row+1, GTK_EXPAND|GTK_FILL, 0, 3, 1); - progress_row++; - - gtk_widget_show_all((GtkWidget *)progress_table); - gtk_widget_show((GtkWidget *)progress_dialogue); - - data->timeout_id = -1; - - MAIL_MT_UNLOCK(mail_msg_lock); - - return FALSE; -} - -static void do_op_status(struct _mail_msg *mm) -{ - struct _op_status_msg *m = (struct _op_status_msg *)mm; - struct _mail_msg *msg; - struct _mail_msg_priv *data; - char *out, *p, *o, c; - - g_assert(mail_gui_thread == pthread_self()); - - MAIL_MT_LOCK(mail_msg_lock); - - msg = g_hash_table_lookup(mail_msg_active, m->data); - if (msg == NULL) { - MAIL_MT_UNLOCK(mail_msg_lock); - return; - } - - data = msg->priv; - - out = alloca(strlen(m->what)*2+1); - o = out; - p = m->what; - while ((c = *p++)) { - if (c=='%') - *o++ = '%'; - *o++ = c; - } - *o = 0; - - if (data->timeout_id == 0) { - data->what = g_strdup(out); - data->pc = m->pc; - data->timeout_id = gtk_timeout_add(2000, op_status_timeout, m->data); - MAIL_MT_UNLOCK(mail_msg_lock); - return; - } - - if (data->bar == NULL) { - g_free(data->what); - data->what = g_strdup(out); - data->pc = m->pc; - MAIL_MT_UNLOCK(mail_msg_lock); - return; - } - - gtk_progress_set_percentage((GtkProgress *)data->bar, (gfloat)(m->pc/100.0)); - gtk_progress_set_format_string((GtkProgress *)data->bar, out); - - MAIL_MT_UNLOCK(mail_msg_lock); -} - -static void do_op_status_free(struct _mail_msg *mm) -{ - struct _op_status_msg *m = (struct _op_status_msg *)mm; - - g_free(m->what); -} - -struct _mail_msg_op op_status_op = { - NULL, - do_op_status, - NULL, - do_op_status_free, -}; - -static void -mail_operation_status(struct _CamelOperation *op, const char *what, int pc, void *data) -{ - struct _op_status_msg *m; - - d(printf("got operation statys: %s %d%%\n", what, pc)); - - m = mail_msg_new(&op_status_op, NULL, sizeof(*m)); - m->op = op; - m->what = g_strdup(what); - switch (pc) { - case CAMEL_OPERATION_START: - pc = 0; - break; - case CAMEL_OPERATION_END: - pc = 100; - break; - } - m->pc = pc; - m->data = data; - e_msgport_put(mail_gui_port, (EMsg *)m); -} - -/* ******************** */ - -/* FIXME FIXME FIXME This is a totally evil hack. */ - -static GNOME_Evolution_ShellView -retrieve_shell_view_interface_from_control (BonoboControl *control) -{ - Bonobo_ControlFrame control_frame; - GNOME_Evolution_ShellView shell_view_interface; - CORBA_Environment ev; - - control_frame = bonobo_control_get_control_frame (control); - - if (control_frame == NULL) - return CORBA_OBJECT_NIL; - - CORBA_exception_init (&ev); - shell_view_interface = Bonobo_Unknown_queryInterface (control_frame, - "IDL:GNOME/Evolution/ShellView:1.0", - &ev); - CORBA_exception_free (&ev); - - if (shell_view_interface != CORBA_OBJECT_NIL) - gtk_object_set_data (GTK_OBJECT (control), - "mail_threads_shell_view_interface", - shell_view_interface); - else - g_warning ("Control frame doesn't have Evolution/ShellView."); - - return shell_view_interface; -} - -static void -set_view_data(const char *current_message, int busy) -{ - EList *controls; - EIterator *it; - - controls = folder_browser_factory_get_control_list (); - for (it = e_list_get_iterator (controls); e_iterator_is_valid (it); e_iterator_next (it)) { - BonoboControl *control; - GNOME_Evolution_ShellView shell_view_interface; - CORBA_Environment ev; - - control = BONOBO_CONTROL (e_iterator_get (it)); - - shell_view_interface = gtk_object_get_data (GTK_OBJECT (control), "mail_threads_shell_view_interface"); - - if (shell_view_interface == CORBA_OBJECT_NIL) - shell_view_interface = retrieve_shell_view_interface_from_control (control); - - CORBA_exception_init (&ev); - - if (shell_view_interface != CORBA_OBJECT_NIL) { - if ((current_message == NULL || current_message[0] == 0) && ! busy) { - d(printf("clearing msg\n")); - GNOME_Evolution_ShellView_unsetMessage (shell_view_interface, &ev); - } else { - d(printf("setting msg %s\n", current_message ? current_message : "(null)")); - GNOME_Evolution_ShellView_setMessage (shell_view_interface, - current_message?current_message:"", - busy, - &ev); - } - } - - CORBA_exception_free (&ev); - - /* yeah we only set the first one. Why? Because it seems to leave - random ones lying around otherwise. Shrug. */ - break; - } - gtk_object_unref(GTK_OBJECT(it)); -} - -static void -set_stop(int sensitive) -{ - EList *controls; - EIterator *it; - static int last = FALSE; - - if (last == sensitive) - return; - - controls = folder_browser_factory_get_control_list (); - for (it = e_list_get_iterator (controls); e_iterator_is_valid (it); e_iterator_next (it)) { - BonoboControl *control; - BonoboUIComponent *uic; - - control = BONOBO_CONTROL (e_iterator_get (it)); - uic = bonobo_control_get_ui_component (control); - if (uic == CORBA_OBJECT_NIL || bonobo_ui_component_get_container(uic) == CORBA_OBJECT_NIL) - continue; - - bonobo_ui_component_set_prop(uic, "/commands/MailStop", "sensitive", sensitive?"1":"0", NULL); - } - gtk_object_unref(GTK_OBJECT(it)); - last = sensitive; -} diff --git a/mail/mail-mt.h b/mail/mail-mt.h deleted file mode 100644 index cc9f1be756..0000000000 --- a/mail/mail-mt.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Authors: Michael Zucchi - * - * Copyright 2000, Helix Code, Inc. (http://www.helixcode.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -#ifndef _MAIL_MT -#define _MAIL_MT - -#include -#include "camel/camel-exception.h" -#include "e-util/e-msgport.h" -#include "camel/camel-object.h" -#include "camel/camel-operation.h" - -typedef struct _mail_msg { - EMsg msg; /* parent type */ - struct _mail_msg_op *ops; /* operation functions */ - unsigned int seq; /* seq number for synchronisation */ - CamelOperation *cancel; /* a cancellation/status handle */ - CamelException ex; /* an initialised camel exception, upto the caller to use this */ - struct _mail_msg_priv *priv; /* private for internal use */ -} mail_msg_t; - -/* callback functions for thread message */ -typedef struct _mail_msg_op { - char *(*describe_msg)(struct _mail_msg *msg, int complete); - - void (*receive_msg)(struct _mail_msg *msg); /* message received */ - void (*reply_msg)(struct _mail_msg *msg); /* message replied */ - void (*destroy_msg)(struct _mail_msg *msg); /* finalise message */ -} mail_msg_op_t; - -/* setup ports */ -void mail_msg_init(void); - -/* allocate a new message */ -void *mail_msg_new(mail_msg_op_t *ops, EMsgPort *reply_port, size_t size); -void mail_msg_free(void *msg); -void mail_msg_check_error(void *msg); -void mail_msg_cancel(unsigned int msgid); -void mail_msg_wait(unsigned int msgid); - -/* set the status-bar message */ -/* start/end a new op */ -void mail_status_start(const char *msg); -void mail_status_end(void); -/* set a status during an op */ -void mail_statusf(const char *fmt, ...); -void mail_status(const char *msg); - -/* request a string/password */ -char *mail_get_password(char *prompt, gboolean secret); - -/* forward a camel event (or other call) to the gui thread */ -int mail_proxy_event(CamelObjectEventHookFunc func, CamelObject *o, void *event_data, void *data); - -/* a message port that receives messages in the gui thread, used for sending port */ -extern EMsgPort *mail_gui_port; -/* a message port that receives messages in the gui thread, used for the reply port */ -extern EMsgPort *mail_gui_reply_port; - -/* some globally available threads */ -extern EThread *mail_thread_queued; /* for operations that can (or should) be queued */ -extern EThread *mail_thread_new; /* for operations that should run in a new thread each time */ - -/* The main thread. */ -extern pthread_t mail_gui_thread; - - -#endif /* ! _MAIL_MT */ diff --git a/mail/mail-ops.c b/mail/mail-ops.c deleted file mode 100644 index 1d2516272a..0000000000 --- a/mail/mail-ops.c +++ /dev/null @@ -1,1833 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* mail-ops.c: callbacks for the mail toolbar/menus */ - -/* - * Authors: Dan Winship - * Jeffrey Stedfast - * Peter Williams - * Michael Zucchi - * - * Copyright 2000,2001 Ximian, Inc. (http://www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#include -#include -#include -#include -#include -#include -#include "mail.h" -#include "mail-tools.h" -#include "mail-ops.h" -#include "mail-vfolder.h" -#include "composer/e-msg-composer.h" -#include "folder-browser.h" -#include "e-util/e-html-utils.h" - -#include "filter/filter-filter.h" - -#include "mail-mt.h" - -#define d(x) x - -FilterContext * -mail_load_filter_context(void) -{ - char *userrules; - char *systemrules; - FilterContext *fc; - - userrules = g_strdup_printf ("%s/filters.xml", evolution_dir); - systemrules = g_strdup_printf ("%s/evolution/filtertypes.xml", EVOLUTION_DATADIR); - fc = filter_context_new (); - rule_context_load ((RuleContext *)fc, systemrules, userrules); - g_free (userrules); - g_free (systemrules); - - return fc; -} - -static void -setup_filter_driver(CamelFilterDriver *driver, FilterContext *fc, const char *source) -{ - GString *fsearch, *faction; - FilterFilter *rule = NULL; - - if (TRUE /* perform_logging */) { - char *filename = g_strdup_printf("%s/evolution-filter-log", evolution_dir); - /* FIXME: This is a nasty little thing to stop leaking file handles. - Needs to be setup elsewhere. */ - static FILE *logfile = NULL; - - if (logfile == NULL) - logfile = fopen(filename, "a+"); - g_free(filename); - if (logfile) - camel_filter_driver_set_logfile(driver, logfile); - } - - fsearch = g_string_new (""); - faction = g_string_new (""); - - while ((rule = (FilterFilter *)rule_context_next_rule((RuleContext *)fc, (FilterRule *)rule, source))) { - g_string_truncate (fsearch, 0); - g_string_truncate (faction, 0); - - filter_rule_build_code ((FilterRule *)rule, fsearch); - filter_filter_build_action (rule, faction); - - camel_filter_driver_add_rule(driver, ((FilterRule *)rule)->name, fsearch->str, faction->str); - } - - g_string_free (fsearch, TRUE); - g_string_free (faction, TRUE); -} - -static CamelFolder * -filter_get_folder(CamelFilterDriver *d, const char *uri, void *data, CamelException *ex) -{ - CamelFolder *folder; - - folder = mail_tool_uri_to_folder(uri, ex); - - return folder; -} - -/* used for both just filtering a folder + uid's, and for filtering a whole folder */ -/* used both for fetching mail, and for filtering mail */ -struct _filter_mail_msg { - struct _mail_msg msg; - - CamelFolder *source_folder; /* where they come from */ - GPtrArray *source_uids; /* uids to copy, or NULL == copy all */ - CamelOperation *cancel; - CamelFilterDriver *driver; - int delete; /* delete messages after filtering them? */ - CamelFolder *destination; /* default destination for any messages, NULL for none */ -}; - -/* since fetching also filters, we subclass the data here */ -struct _fetch_mail_msg { - struct _filter_mail_msg fmsg; - - CamelOperation *cancel; /* we have our own cancellation struct, the other should be empty */ - int keep; /* keep on server? */ - - char *source_uri; - - void (*done)(char *source, void *data); - void *data; -}; - -/* filter a folder, or a subset thereof, uses source_folder/source_uids */ -/* this is shared with fetch_mail */ -static void -filter_folder_filter(struct _mail_msg *mm) -{ - struct _filter_mail_msg *m = (struct _filter_mail_msg *)mm; - CamelFolder *folder; - GPtrArray *uids, *folder_uids = NULL; - - if (m->cancel) - camel_operation_register(m->cancel); - - folder = m->source_folder; - - if (folder == NULL || camel_folder_get_message_count (folder) == 0) { - if (m->cancel) - camel_operation_unregister(m->cancel); - return; - } - - if (m->destination) { - camel_folder_freeze(m->destination); - camel_filter_driver_set_default_folder(m->driver, m->destination); - } - - camel_folder_freeze(folder); - - if (m->source_uids) - uids = m->source_uids; - else - folder_uids = uids = camel_folder_get_uids (folder); - - camel_filter_driver_filter_folder(m->driver, folder, uids, m->delete, &mm->ex); - - if (folder_uids) - camel_folder_free_uids(folder, folder_uids); - - /* sync and expunge */ - camel_folder_sync (folder, TRUE, &mm->ex); - camel_folder_thaw(folder); - - if (m->destination) - camel_folder_thaw(m->destination); - - if (m->cancel) - camel_operation_unregister(m->cancel); -} - -static void -filter_folder_filtered(struct _mail_msg *mm) -{ -} - -static void -filter_folder_free(struct _mail_msg *mm) -{ - struct _filter_mail_msg *m = (struct _filter_mail_msg *)mm; - int i; - - if (m->source_folder) - camel_object_unref((CamelObject *)m->source_folder); - if (m->source_uids) { - for (i=0;isource_uids->len;i++) - g_free(m->source_uids->pdata[i]); - g_ptr_array_free(m->source_uids, TRUE); - } - if (m->cancel) - camel_operation_unref(m->cancel); - if (m->destination) - camel_object_unref((CamelObject *)m->destination); - if (m->driver) - camel_object_unref((CamelObject *)m->driver); -} - -static struct _mail_msg_op filter_folder_op = { - NULL, /* we do our own progress reporting? */ - filter_folder_filter, - filter_folder_filtered, - filter_folder_free, -}; - -void -mail_filter_folder(CamelFolder *source_folder, GPtrArray *uids, - FilterContext *fc, const char *type, - CamelOperation *cancel) -{ - struct _filter_mail_msg *m; - - m = mail_msg_new(&filter_folder_op, NULL, sizeof(*m)); - m->source_folder = source_folder; - camel_object_ref((CamelObject *)source_folder); - m->source_uids = uids; - m->delete = FALSE; - if (cancel) { - m->cancel = cancel; - camel_operation_ref(cancel); - } - - m->driver = camel_filter_driver_new(filter_get_folder, NULL); - setup_filter_driver(m->driver, fc, type); - - e_thread_put(mail_thread_new, (EMsg *)m); -} - -/* convenience function for it */ -void mail_filter_on_demand(CamelFolder *folder, GPtrArray *uids) -{ - FilterContext *fc; - - fc = mail_load_filter_context(); - mail_filter_folder(folder, uids, fc, FILTER_SOURCE_INCOMING, NULL); - gtk_object_unref((GtkObject *)fc); -} - -/* ********************************************************************** */ - -static void -fetch_mail_fetch(struct _mail_msg *mm) -{ - struct _fetch_mail_msg *m = (struct _fetch_mail_msg *)mm; - struct _filter_mail_msg *fm = (struct _filter_mail_msg *)mm; - int i; - - if (m->cancel) - camel_operation_register(m->cancel); - - if ( (fm->destination = mail_tool_get_local_inbox(&mm->ex)) == NULL) { - if (m->cancel) - camel_operation_unregister(m->cancel); - return; - } - - /* FIXME: this should support keep_on_server too, which would then perform a spool - access thingy, right? problem is matching raw messages to uid's etc. */ - if (!strncmp (m->source_uri, "mbox:", 5)) { - char *path = mail_tool_do_movemail (m->source_uri, &mm->ex); - - if (path && !camel_exception_is_set (&mm->ex)) { - camel_folder_freeze(fm->destination); - camel_filter_driver_set_default_folder(fm->driver, fm->destination); - camel_filter_driver_filter_mbox(fm->driver, path, &mm->ex); - camel_folder_thaw(fm->destination); - - if (!camel_exception_is_set (&mm->ex)) - unlink (path); - } - g_free (path); - } else { - CamelFolder *folder = fm->source_folder = mail_tool_get_inbox(m->source_uri, &mm->ex); - - if (folder) { - /* this handles 'keep on server' stuff, if we have any new uid's to copy - across, we need to copy them to a new array 'cause of the way fetch_mail_free works */ - CamelUIDCache *cache = NULL; - char *cachename; - - cachename = mail_config_folder_to_cachename (folder, "cache-"); - cache = camel_uid_cache_new (cachename); - g_free (cachename); - - if (cache) { - GPtrArray *folder_uids, *cache_uids, *uids; - - folder_uids = camel_folder_get_uids (folder); - cache_uids = camel_uid_cache_get_new_uids (cache, folder_uids); - if (cache_uids) { - /* need to copy this, sigh */ - fm->source_uids = uids = g_ptr_array_new (); - g_ptr_array_set_size (uids, cache_uids->len); - for (i = 0; i < cache_uids->len; i++) - uids->pdata[i] = g_strdup (cache_uids->pdata[i]); - camel_uid_cache_free_uids (cache_uids); - - filter_folder_filter (mm); - - /* if we are not to delete the messages, save the UID cache */ - if (!fm->delete && !camel_exception_is_set (&mm->ex)) - camel_uid_cache_save (cache); - - camel_uid_cache_destroy (cache); - } - camel_folder_free_uids (folder, folder_uids); - } else { - filter_folder_filter (mm); - } - } - } - - if (m->cancel) - camel_operation_unregister(m->cancel); - - /* we unref this here as it may have more work to do (syncing - folders and whatnot) before we are really done */ - /* should this be cancellable too? (i.e. above unregister above) */ - camel_object_unref((CamelObject *)m->fmsg.driver); - m->fmsg.driver = NULL; -} - -static void -fetch_mail_fetched(struct _mail_msg *mm) -{ - struct _fetch_mail_msg *m = (struct _fetch_mail_msg *)mm; - - if (m->done) - m->done(m->source_uri, m->data); -} - -static void -fetch_mail_free(struct _mail_msg *mm) -{ - struct _fetch_mail_msg *m = (struct _fetch_mail_msg *)mm; - - g_free(m->source_uri); - if (m->cancel) - camel_operation_unref(m->cancel); - - filter_folder_free(mm); -} - -static struct _mail_msg_op fetch_mail_op = { - NULL, /* we do our own progress reporting */ - fetch_mail_fetch, - fetch_mail_fetched, - fetch_mail_free, -}; - -/* ouch, a 'do everything' interface ... */ -void mail_fetch_mail(const char *source, int keep, - FilterContext *fc, const char *type, - CamelOperation *cancel, - CamelFilterGetFolderFunc get_folder, void *get_data, - CamelFilterStatusFunc *status, void *status_data, - void (*done)(char *source, void *data), void *data) -{ - struct _fetch_mail_msg *m; - struct _filter_mail_msg *fm; - - m = mail_msg_new(&fetch_mail_op, NULL, sizeof(*m)); - fm = (struct _filter_mail_msg *)m; - m->source_uri = g_strdup(source); - fm->delete = !keep; - if (cancel) { - m->cancel = cancel; - camel_operation_ref(cancel); - } - m->done = done; - m->data = data; - - fm->driver = camel_filter_driver_new(get_folder, get_data); - setup_filter_driver(fm->driver, fc, type); - if (status) - camel_filter_driver_set_status_func(fm->driver, status, status_data); - - e_thread_put(mail_thread_new, (EMsg *)m); -} - - -/* updating of imap folders etc */ -struct _update_info { - EvolutionStorage *storage; - - void (*done)(CamelStore *, void *data); - void *data; -}; - -static void do_update_subfolders_rec(CamelStore *store, CamelFolderInfo *info, EvolutionStorage *storage, const char *prefix) -{ - char *path, *name; - - path = g_strdup_printf("%s/%s", prefix, info->name); - if (info->unread_message_count > 0) - name = g_strdup_printf("%s (%d)", info->name, info->unread_message_count); - else - name = g_strdup(info->name); - - evolution_storage_update_folder(storage, path, name, info->unread_message_count > 0); - g_free(name); - if (info->child) - do_update_subfolders_rec(store, info->child, storage, path); - if (info->sibling) - do_update_subfolders_rec(store, info->sibling, storage, prefix); - g_free(path); -} - -static void do_update_subfolders(CamelStore *store, CamelFolderInfo *info, void *data) -{ - struct _update_info *uinfo = data; - - if (uinfo) { - do_update_subfolders_rec(store, info, uinfo->storage, ""); - } - - if (uinfo->done) - uinfo->done(store, uinfo->data); - - gtk_object_unref((GtkObject *)uinfo->storage); - g_free(uinfo); -} - -/* this interface is a little icky */ -int mail_update_subfolders(CamelStore *store, EvolutionStorage *storage, - void (*done)(CamelStore *, void *data), void *data) -{ - struct _update_info *info; - - /* FIXME: This wont actually work entirely right, as a failure may lose this data */ - /* however, this isn't a big problem ... */ - info = g_malloc0(sizeof(*info)); - info->storage = storage; - gtk_object_ref((GtkObject *)storage); - info->done = done; - info->data = data; - - return mail_get_folderinfo(store, do_update_subfolders, info); -} - -/* ********************************************************************** */ -/* sending stuff */ -/* ** SEND MAIL *********************************************************** */ - -/* send 1 message to a specific transport */ -static void -mail_send_message(CamelMimeMessage *message, const char *destination, CamelFilterDriver *driver, CamelException *ex) -{ - extern CamelFolder *sent_folder; /* FIXME */ - CamelMessageInfo *info; - CamelTransport *xport; - const char *version; - - if (SUB_VERSION[0] == '\0') - version = "Evolution/" VERSION " (Preview Release)"; - else - version = "Evolution/" VERSION SUB_VERSION " (Preview Release)"; - camel_medium_add_header(CAMEL_MEDIUM (message), "X-Mailer", version); - camel_mime_message_set_date(message, CAMEL_MESSAGE_DATE_CURRENT, 0); - - xport = camel_session_get_transport(session, destination, ex); - if (camel_exception_is_set(ex)) - return; - - camel_transport_send(xport, (CamelMedium *)message, ex); - camel_object_unref((CamelObject *)xport); - if (camel_exception_is_set(ex)) - return; - - /* post-process */ - info = camel_message_info_new(); - info->flags = CAMEL_MESSAGE_SEEN; - - if (driver) - camel_filter_driver_filter_message (driver, message, info, - NULL, NULL, "", ex); - - if (sent_folder) - camel_folder_append_message(sent_folder, message, info, ex); - - camel_message_info_free(info); -} - -/* ********************************************************************** */ - -struct _send_mail_msg { - struct _mail_msg msg; - - CamelFilterDriver *driver; - char *destination; - CamelMimeMessage *message; - - void (*done)(char *uri, CamelMimeMessage *message, gboolean sent, void *data); - void *data; -}; - -static char *send_mail_desc(struct _mail_msg *mm, int done) -{ - struct _send_mail_msg *m = (struct _send_mail_msg *)mm; - const char *subject; - - subject = camel_mime_message_get_subject(m->message); - if (subject && subject[0]) - return g_strdup_printf (_("Sending \"%s\""), subject); - else - return g_strdup(_("Sending message")); -} - -static void send_mail_send(struct _mail_msg *mm) -{ - struct _send_mail_msg *m = (struct _send_mail_msg *)mm; - - camel_operation_register(mm->cancel); - mail_send_message(m->message, m->destination, m->driver, &mm->ex); - camel_operation_unregister(mm->cancel); -} - -static void send_mail_sent(struct _mail_msg *mm) -{ - struct _send_mail_msg *m = (struct _send_mail_msg *)mm; - - if (m->done) - m->done(m->destination, m->message, !camel_exception_is_set(&mm->ex), m->data); -} - -static void send_mail_free(struct _mail_msg *mm) -{ - struct _send_mail_msg *m = (struct _send_mail_msg *)mm; - - camel_object_unref((CamelObject *)m->message); - g_free(m->destination); -} - -static struct _mail_msg_op send_mail_op = { - send_mail_desc, - send_mail_send, - send_mail_sent, - send_mail_free, -}; - -int -mail_send_mail(const char *uri, CamelMimeMessage *message, void (*done) (char *uri, CamelMimeMessage *message, gboolean sent, void *data), void *data) -{ - struct _send_mail_msg *m; - int id; - FilterContext *fc; - - m = mail_msg_new(&send_mail_op, NULL, sizeof(*m)); - m->destination = g_strdup(uri); - m->message = message; - camel_object_ref((CamelObject *)message); - m->data = data; - m->done = done; - - id = m->msg.seq; - - m->driver = camel_filter_driver_new(filter_get_folder, NULL); - fc = mail_load_filter_context(); - setup_filter_driver(m->driver, fc, FILTER_SOURCE_OUTGOING); - gtk_object_unref((GtkObject *)fc); - - e_thread_put(mail_thread_new, (EMsg *)m); - return id; -} - -/* ** SEND MAIL QUEUE ***************************************************** */ - -struct _send_queue_msg { - struct _mail_msg msg; - - CamelFolder *queue; - char *destination; - - CamelFilterDriver *driver; - CamelOperation *cancel; - - /* we use camelfilterstatusfunc, even though its not the filter doing it */ - CamelFilterStatusFunc *status; - void *status_data; - - void (*done)(char *destination, void *data); - void *data; -}; - -static void -report_status(struct _send_queue_msg *m, enum camel_filter_status_t status, int pc, const char *desc, ...) -{ - va_list ap; - char *str; - - if (m->status) { - va_start(ap, desc); - str = g_strdup_vprintf(desc, ap); - m->status(m->driver, status, pc, str, m->status_data); - g_free(str); - } -} - -static void -send_queue_send(struct _mail_msg *mm) -{ - struct _send_queue_msg *m = (struct _send_queue_msg *)mm; - GPtrArray *uids; - int i; - extern CamelFolder *sent_folder; /* FIXME */ - - printf("sending queue\n"); - - uids = camel_folder_get_uids(m->queue); - if (uids == NULL || uids->len == 0) - return; - - if (m->cancel) - camel_operation_register(m->cancel); - - for (i=0; ilen; i++) { - CamelMimeMessage *message; - char *destination; - int pc = (100 * i)/uids->len; - - report_status(m, CAMEL_FILTER_STATUS_START, pc, "Sending message %d of %d", i+1, uids->len); - - message = camel_folder_get_message(m->queue, uids->pdata[i], &mm->ex); - if (camel_exception_is_set(&mm->ex)) - break; - - /* Get the preferred transport URI */ - destination = (char *)camel_medium_get_header(CAMEL_MEDIUM(message), "X-Evolution-Transport"); - if (destination) { - destination = g_strdup(destination); - camel_medium_remove_header(CAMEL_MEDIUM(message), "X-Evolution-Transport"); - mail_send_message(message, g_strstrip(destination), m->driver, &mm->ex); - g_free(destination); - } else - mail_send_message(message, m->destination, m->driver, &mm->ex); - - if (camel_exception_is_set(&mm->ex)) - break; - - camel_folder_set_message_flags(m->queue, uids->pdata[i], CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_DELETED); - } - - if (camel_exception_is_set(&mm->ex)) - report_status(m, CAMEL_FILTER_STATUS_END, 100, "Failed on message %d of %d", i+1, uids->len); - else - report_status(m, CAMEL_FILTER_STATUS_END, 100, "Complete."); - - camel_folder_free_uids(m->queue, uids); - - if (!camel_exception_is_set(&mm->ex)) - camel_folder_expunge(m->queue, &mm->ex); - - if (sent_folder) - camel_folder_sync(sent_folder, FALSE, &mm->ex); - - if (m->cancel) - camel_operation_unregister(m->cancel); -} - -static void -send_queue_sent(struct _mail_msg *mm) -{ - struct _send_queue_msg *m = (struct _send_queue_msg *)mm; - - if (m->done) - m->done(m->destination, m->data); -} - -static void -send_queue_free(struct _mail_msg *mm) -{ - struct _send_queue_msg *m = (struct _send_queue_msg *)mm; - - camel_object_unref((CamelObject *)m->queue); - g_free(m->destination); - if (m->cancel) - camel_operation_unref(m->cancel); -} - -static struct _mail_msg_op send_queue_op = { - NULL, /* do our own reporting, as with fetch mail */ - send_queue_send, - send_queue_sent, - send_queue_free, -}; - -/* same interface as fetch_mail, just 'cause i'm lazy today (and we need to run it from the same spot?) */ -void -mail_send_queue(CamelFolder *queue, const char *destination, - FilterContext *fc, const char *type, - CamelOperation *cancel, - CamelFilterGetFolderFunc get_folder, void *get_data, - CamelFilterStatusFunc *status, void *status_data, - void (*done)(char *destination, void *data), void *data) -{ - struct _send_queue_msg *m; - - m = mail_msg_new(&send_queue_op, NULL, sizeof(*m)); - m->queue = queue; - camel_object_ref((CamelObject *)queue); - m->destination = g_strdup(destination); - if (cancel) { - m->cancel = cancel; - camel_operation_ref(cancel); - } - m->status = status; - m->status_data = status_data; - m->done = done; - m->data = data; - - m->driver = camel_filter_driver_new(get_folder, get_data); - setup_filter_driver(m->driver, fc, type); - - e_thread_put(mail_thread_new, (EMsg *)m); -} - -/* ** APPEND MESSAGE TO FOLDER ******************************************** */ - -struct _append_msg { - struct _mail_msg msg; - - CamelFolder *folder; - CamelMimeMessage *message; - CamelMessageInfo *info; - - void (*done)(CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, int ok, void *data); - void *data; -}; - -static char *append_mail_desc(struct _mail_msg *mm, int done) -{ - return g_strdup(_("Saving message to folder")); -} - -static void append_mail_append(struct _mail_msg *mm) -{ - struct _append_msg *m = (struct _append_msg *)mm; - - camel_mime_message_set_date(m->message, CAMEL_MESSAGE_DATE_CURRENT, 0); - camel_folder_append_message(m->folder, m->message, m->info, &mm->ex); -} - -static void append_mail_appended(struct _mail_msg *mm) -{ - struct _append_msg *m = (struct _append_msg *)mm; - - if (m->done) - m->done(m->folder, m->message, m->info, !camel_exception_is_set(&mm->ex), m->data); -} - -static void append_mail_free(struct _mail_msg *mm) -{ - struct _append_msg *m = (struct _append_msg *)mm; - - camel_object_unref((CamelObject *)m->message); - camel_object_unref((CamelObject *)m->folder); -} - -static struct _mail_msg_op append_mail_op = { - append_mail_desc, - append_mail_append, - append_mail_appended, - append_mail_free -}; - -void -mail_append_mail (CamelFolder *folder, - CamelMimeMessage *message, - CamelMessageInfo *info, - void (*done)(CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, int ok, void *data), void *data) -{ - struct _append_msg *m; - - g_return_if_fail (CAMEL_IS_FOLDER (folder)); - g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message)); - - m = mail_msg_new(&append_mail_op, NULL, sizeof(*m)); - m->folder = folder; - camel_object_ref((CamelObject *)folder); - m->message = message; - camel_object_ref((CamelObject *)message); - m->info = info; - - m->done = done; - m->data = data; - - e_thread_put(mail_thread_new, (EMsg *)m); -} - -/* ** TRANSFER MESSAGES **************************************************** */ - -struct _transfer_msg { - struct _mail_msg msg; - - CamelFolder *source; - GPtrArray *uids; - gboolean delete; - char *dest_uri; -}; - -static char *transfer_messages_desc(struct _mail_msg *mm, int done) -{ - struct _transfer_msg *m = (struct _transfer_msg *)mm; - - return g_strdup_printf(m->delete?_("Moving messages to %s"):_("Copying messages to %s"), - m->dest_uri); - -} - -static void transfer_messages_transfer(struct _mail_msg *mm) -{ - struct _transfer_msg *m = (struct _transfer_msg *)mm; - CamelFolder *dest; - int i; - char *desc; - void (*func) (CamelFolder *, const char *, - CamelFolder *, - CamelException *); - - if (m->delete) { - func = camel_folder_move_message_to; - desc = _("Moving"); - } else { - func = camel_folder_copy_message_to; - desc = _("Copying"); - } - - dest = mail_tool_uri_to_folder (m->dest_uri, &mm->ex); - if (camel_exception_is_set (&mm->ex)) - return; - - camel_folder_freeze (m->source); - camel_folder_freeze (dest); - - for (i = 0; i < m->uids->len; i++) { - mail_statusf(_("%s message %d of %d (uid \"%s\")"), desc, - i + 1, m->uids->len, (char *)m->uids->pdata[i]); - - (func) (m->source, m->uids->pdata[i], dest, &mm->ex); - if (camel_exception_is_set (&mm->ex)) - break; - } - - camel_folder_thaw(m->source); - camel_folder_thaw(dest); - camel_object_unref((CamelObject *)dest); -} - -static void transfer_messages_free(struct _mail_msg *mm) -{ - struct _transfer_msg *m = (struct _transfer_msg *)mm; - int i; - - camel_object_unref((CamelObject *)m->source); - g_free(m->dest_uri); - for (i=0;iuids->len;i++) - g_free(m->uids->pdata[i]); - g_ptr_array_free(m->uids, TRUE); - -} - -static struct _mail_msg_op transfer_messages_op = { - transfer_messages_desc, - transfer_messages_transfer, - NULL, - transfer_messages_free, -}; - -void -mail_do_transfer_messages (CamelFolder *source, GPtrArray *uids, - gboolean delete_from_source, - gchar *dest_uri) -{ - struct _transfer_msg *m; - - g_return_if_fail (CAMEL_IS_FOLDER (source)); - g_return_if_fail (uids != NULL); - g_return_if_fail (dest_uri != NULL); - - m = mail_msg_new(&transfer_messages_op, NULL, sizeof(*m)); - m->source = source; - camel_object_ref((CamelObject *)source); - m->uids = uids; - m->delete = delete_from_source; - m->dest_uri = g_strdup (dest_uri); - - e_thread_put(mail_thread_queued, (EMsg *)m); -} - -/* ** SCAN SUBFOLDERS ***************************************************** */ - -struct _get_folderinfo_msg { - struct _mail_msg msg; - - CamelStore *store; - CamelFolderInfo *info; - void (*done)(CamelStore *store, CamelFolderInfo *info, void *data); - void *data; -}; - -static char *get_folderinfo_desc(struct _mail_msg *mm, int done) -{ - struct _get_folderinfo_msg *m = (struct _get_folderinfo_msg *)mm; - char *ret, *name; - - name = camel_service_get_name((CamelService *)m->store, TRUE); - ret = g_strdup_printf(_("Scanning folders in \"%s\""), name); - g_free(name); - return ret; -} - -static void -add_vtrash_info (CamelFolderInfo *info) -{ - CamelFolderInfo *fi, *vtrash; - CamelURL *url; - char *uri; - - if (!info) - return; - - for (fi = info; fi->sibling; fi = fi->sibling) { - if (!strcmp (fi->name, "vTrash")) - return; - } - - /* create our vTrash URL */ - url = camel_url_new (info->url, NULL); - g_free (url->path); - url->path = g_strdup ("vTrash"); - uri = camel_url_to_string (url, FALSE); - camel_url_free (url); - - vtrash = g_new0 (CamelFolderInfo, 1); - vtrash->full_name = g_strdup ("vTrash"); - vtrash->name = g_strdup ("vTrash"); - vtrash->url = g_strdup_printf ("vtrash:%s", uri); - vtrash->unread_message_count = -1; - g_free (uri); - - vtrash->parent = fi; - - fi->sibling = vtrash; -} - -static void get_folderinfo_get(struct _mail_msg *mm) -{ - struct _get_folderinfo_msg *m = (struct _get_folderinfo_msg *)mm; - - camel_operation_register(mm->cancel); - m->info = camel_store_get_folder_info(m->store, NULL, FALSE, TRUE, TRUE, &mm->ex); - add_vtrash_info (m->info); - camel_operation_unregister(mm->cancel); -} - -static void get_folderinfo_got(struct _mail_msg *mm) -{ - struct _get_folderinfo_msg *m = (struct _get_folderinfo_msg *)mm; - - if (m->done) - m->done(m->store, m->info, m->data); -} - -static void get_folderinfo_free(struct _mail_msg *mm) -{ - struct _get_folderinfo_msg *m = (struct _get_folderinfo_msg *)mm; - - if (m->info) - camel_store_free_folder_info(m->store, m->info); - camel_object_unref((CamelObject *)m->store); -} - -static struct _mail_msg_op get_folderinfo_op = { - get_folderinfo_desc, - get_folderinfo_get, - get_folderinfo_got, - get_folderinfo_free, -}; - -int mail_get_folderinfo(CamelStore *store, void (*done)(CamelStore *store, CamelFolderInfo *info, void *data), void *data) -{ - struct _get_folderinfo_msg *m; - int id; - - m = mail_msg_new(&get_folderinfo_op, NULL, sizeof(*m)); - m->store = store; - camel_object_ref((CamelObject *)store); - m->done = done; - m->data = data; - id = m->msg.seq; - - e_thread_put(mail_thread_new, (EMsg *)m); - - return id; -} - -/* ********************************************************************** */ - -static void -do_scan_subfolders (CamelStore *store, CamelFolderInfo *info, void *data) -{ - EvolutionStorage *storage = data; - - if (info) { - gtk_object_set_data((GtkObject *)storage, "connected", (void *)1); - mail_storage_create_folder (storage, store, info); - } -} - -/* synchronous function to scan the & and add folders in a store */ -void mail_scan_subfolders(CamelStore *store, EvolutionStorage *storage) -{ - int id; - - id = mail_get_folderinfo(store, do_scan_subfolders, storage); - /*mail_msg_wait(id);*/ -} - -/* ** ATTACH MESSAGES ****************************************************** */ - -struct _build_data { - void (*done)(CamelFolder *folder, GPtrArray *uids, CamelMimePart *part, char *subject, void *data); - void *data; -}; - -static void do_build_attachment(CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, void *data) -{ - struct _build_data *d = data; - CamelMultipart *multipart; - CamelMimePart *part; - char *subject; - int i; - - if (messages->len == 0) { - d->done(folder, messages, NULL, NULL, d->data); - g_free(d); - return; - } - - if (messages->len == 1) { - part = mail_tool_make_message_attachment(messages->pdata[0]); - } else { - multipart = camel_multipart_new(); - camel_data_wrapper_set_mime_type(CAMEL_DATA_WRAPPER (multipart), "multipart/digest"); - camel_multipart_set_boundary(multipart, NULL); - - for (i=0;ilen;i++) { - part = mail_tool_make_message_attachment(messages->pdata[i]); - camel_multipart_add_part(multipart, part); - camel_object_unref((CamelObject *)part); - } - part = camel_mime_part_new(); - camel_medium_set_content_object(CAMEL_MEDIUM (part), CAMEL_DATA_WRAPPER(multipart)); - camel_object_unref((CamelObject *)multipart); - - camel_mime_part_set_description(part, _("Forwarded messages")); - } - - subject = mail_tool_generate_forward_subject(messages->pdata[0]); - d->done(folder, messages, part, subject, d->data); - g_free(subject); - camel_object_unref((CamelObject *)part); - - g_free(d); -} - -void -mail_build_attachment(CamelFolder *folder, GPtrArray *uids, - void (*done)(CamelFolder *folder, GPtrArray *messages, CamelMimePart *part, char *subject, void *data), void *data) -{ - struct _build_data *d; - - d = g_malloc(sizeof(*d)); - d->done = done; - d->data = data; - mail_get_messages(folder, uids, do_build_attachment, d); -} - -/* ** LOAD FOLDER ********************************************************* */ - -/* there hsould be some way to merge this and create folder, since both can - presumably create a folder ... */ - -struct _get_folder_msg { - struct _mail_msg msg; - - char *uri; - CamelFolder *folder; - void (*done) (char *uri, CamelFolder *folder, void *data); - void *data; -}; - -static char *get_folder_desc(struct _mail_msg *mm, int done) -{ - struct _get_folder_msg *m = (struct _get_folder_msg *)mm; - - return g_strdup_printf(_("Opening folder %s"), m->uri); -} - -static void get_folder_get(struct _mail_msg *mm) -{ - struct _get_folder_msg *m = (struct _get_folder_msg *)mm; - - camel_operation_register(mm->cancel); - m->folder = mail_tool_uri_to_folder(m->uri, &mm->ex); - camel_operation_unregister(mm->cancel); -} - -static void get_folder_got(struct _mail_msg *mm) -{ - struct _get_folder_msg *m = (struct _get_folder_msg *)mm; - - if (m->done) - m->done (m->uri, m->folder, m->data); -} - -static void get_folder_free(struct _mail_msg *mm) -{ - struct _get_folder_msg *m = (struct _get_folder_msg *)mm; - - g_free(m->uri); - if (m->folder) - camel_object_unref((CamelObject *)m->folder); -} - -static struct _mail_msg_op get_folder_op = { - get_folder_desc, - get_folder_get, - get_folder_got, - get_folder_free, -}; - -int -mail_get_folder(const char *uri, void (*done) (char *uri, CamelFolder *folder, void *data), void *data) -{ - struct _get_folder_msg *m; - int id; - - m = mail_msg_new(&get_folder_op, NULL, sizeof(*m)); - m->uri = g_strdup(uri); - m->data = data; - m->done = done; - - id = m->msg.seq; - e_thread_put(mail_thread_new, (EMsg *)m); - return id; -} - -/* ** GET STORE ******************************************************* */ - -struct _get_store_msg { - struct _mail_msg msg; - - char *uri; - CamelStore *store; - void (*done) (char *uri, CamelStore *store, void *data); - void *data; -}; - -static char *get_store_desc(struct _mail_msg *mm, int done) -{ - struct _get_store_msg *m = (struct _get_store_msg *)mm; - - return g_strdup_printf(_("Opening store %s"), m->uri); -} - -static void get_store_get(struct _mail_msg *mm) -{ - struct _get_store_msg *m = (struct _get_store_msg *)mm; - - camel_operation_register(mm->cancel); - m->store = camel_session_get_store(session, m->uri, &mm->ex); - camel_operation_unregister(mm->cancel); -} - -static void get_store_got(struct _mail_msg *mm) -{ - struct _get_store_msg *m = (struct _get_store_msg *)mm; - - if (m->done) - m->done(m->uri, m->store, m->data); -} - -static void get_store_free(struct _mail_msg *mm) -{ - struct _get_store_msg *m = (struct _get_store_msg *)mm; - - g_free(m->uri); - if (m->store) - camel_object_unref((CamelObject *)m->store); -} - -static struct _mail_msg_op get_store_op = { - get_store_desc, - get_store_get, - get_store_got, - get_store_free, -}; - -int -mail_get_store(const char *uri, void (*done) (char *uri, CamelStore *store, void *data), void *data) -{ - struct _get_store_msg *m; - int id; - - m = mail_msg_new(&get_store_op, NULL, sizeof(*m)); - m->uri = g_strdup(uri); - m->data = data; - m->done = done; - - id = m->msg.seq; - e_thread_put(mail_thread_new, (EMsg *)m); - return id; -} - -/* ** CREATE FOLDER ******************************************************* */ - -/* trying to find a way to remove this entirely and just use get_folder() - to do the same thing. But i dont think it can be done, because one works on - shell uri's (get folder), and the other only works for mail uri's ? */ - -struct _create_folder_msg { - struct _mail_msg msg; - - char *uri; - CamelFolder *folder; - void (*done) (char *uri, CamelFolder *folder, void *data); - void *data; -}; - -static char *create_folder_desc(struct _mail_msg *mm, int done) -{ - struct _create_folder_msg *m = (struct _create_folder_msg *)mm; - - return g_strdup_printf(_("Opening folder %s"), m->uri); -} - -static void create_folder_get(struct _mail_msg *mm) -{ - struct _create_folder_msg *m = (struct _create_folder_msg *)mm; - - /* FIXME: supply a way to make indexes optional */ - camel_operation_register(mm->cancel); - m->folder = mail_tool_get_folder_from_urlname(m->uri, "mbox", - CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_FOLDER_BODY_INDEX, - &mm->ex); - camel_operation_unregister(mm->cancel); -} - -static void create_folder_got(struct _mail_msg *mm) -{ - struct _create_folder_msg *m = (struct _create_folder_msg *)mm; - - if (m->done) - m->done(m->uri, m->folder, m->data); -} - -static void create_folder_free(struct _mail_msg *mm) -{ - struct _create_folder_msg *m = (struct _create_folder_msg *)mm; - - g_free(m->uri); - if (m->folder) - camel_object_unref((CamelObject *)m->folder); -} - -static struct _mail_msg_op create_folder_op = { - create_folder_desc, - create_folder_get, - create_folder_got, - create_folder_free, -}; - -void -mail_create_folder(const char *uri, void (*done) (char *uri, CamelFolder *folder, void *data), void *data) -{ - struct _create_folder_msg *m; - - m = mail_msg_new(&create_folder_op, NULL, sizeof(*m)); - m->uri = g_strdup(uri); - m->data = data; - m->done = done; - - e_thread_put(mail_thread_new, (EMsg *)m); -} - -/* ** SYNC FOLDER ********************************************************* */ - -struct _sync_folder_msg { - struct _mail_msg msg; - - CamelFolder *folder; - void (*done) (CamelFolder *folder, void *data); - void *data; -}; - -static char *sync_folder_desc(struct _mail_msg *mm, int done) -{ - return g_strdup(_("Synchronising folder")); -} - -static void sync_folder_sync(struct _mail_msg *mm) -{ - struct _sync_folder_msg *m = (struct _sync_folder_msg *)mm; - - camel_operation_register(mm->cancel); - camel_folder_sync(m->folder, FALSE, &mm->ex); - camel_operation_unregister(mm->cancel); -} - -static void sync_folder_synced(struct _mail_msg *mm) -{ - struct _sync_folder_msg *m = (struct _sync_folder_msg *)mm; - - if (m->done) - m->done(m->folder, m->data); -} - -static void sync_folder_free(struct _mail_msg *mm) -{ - struct _sync_folder_msg *m = (struct _sync_folder_msg *)mm; - - camel_object_unref((CamelObject *)m->folder); -} - -static struct _mail_msg_op sync_folder_op = { - sync_folder_desc, - sync_folder_sync, - sync_folder_synced, - sync_folder_free, -}; - -void -mail_sync_folder(CamelFolder *folder, void (*done) (CamelFolder *folder, void *data), void *data) -{ - struct _sync_folder_msg *m; - - m = mail_msg_new(&sync_folder_op, NULL, sizeof(*m)); - m->folder = folder; - camel_object_ref((CamelObject *)folder); - m->data = data; - m->done = done; - - e_thread_put(mail_thread_new, (EMsg *)m); -} - -/* ******************************************************************************** */ - -static char *expunge_folder_desc(struct _mail_msg *mm, int done) -{ - return g_strdup(_("Expunging folder")); -} - -static void expunge_folder_expunge(struct _mail_msg *mm) -{ - struct _sync_folder_msg *m = (struct _sync_folder_msg *)mm; - - camel_folder_expunge(m->folder, &mm->ex); -} - -/* we just use the sync stuff where we can, since it would be the same */ -static struct _mail_msg_op expunge_folder_op = { - expunge_folder_desc, - expunge_folder_expunge, - sync_folder_synced, - sync_folder_free, -}; - -void -mail_expunge_folder(CamelFolder *folder, void (*done) (CamelFolder *folder, void *data), void *data) -{ - struct _sync_folder_msg *m; - - m = mail_msg_new(&expunge_folder_op, NULL, sizeof(*m)); - m->folder = folder; - camel_object_ref((CamelObject *)folder); - m->data = data; - m->done = done; - - e_thread_put(mail_thread_new, (EMsg *)m); -} - -/* ** GET MESSAGE(s) ***************************************************** */ - -struct _get_message_msg { - struct _mail_msg msg; - - CamelFolder *folder; - char *uid; - void (*done) (CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *data); - void *data; - CamelMimeMessage *message; - CamelOperation *cancel; -}; - -static char *get_message_desc(struct _mail_msg *mm, int done) -{ - struct _get_message_msg *m = (struct _get_message_msg *)mm; - - return g_strdup_printf(_("Retrieving message %s"), m->uid); -} - -static void get_message_get(struct _mail_msg *mm) -{ - struct _get_message_msg *m = (struct _get_message_msg *)mm; - - camel_operation_register(m->cancel); - m->message = camel_folder_get_message(m->folder, m->uid, &mm->ex); - camel_operation_unregister(m->cancel); -} - -static void get_message_got(struct _mail_msg *mm) -{ - struct _get_message_msg *m = (struct _get_message_msg *)mm; - - if (m->done) - m->done(m->folder, m->uid, m->message, m->data); -} - -static void get_message_free(struct _mail_msg *mm) -{ - struct _get_message_msg *m = (struct _get_message_msg *)mm; - - g_free(m->uid); - camel_object_unref((CamelObject *)m->folder); - camel_operation_unref(m->cancel); -} - -static struct _mail_msg_op get_message_op = { - get_message_desc, - get_message_get, - get_message_got, - get_message_free, -}; - -void -mail_get_message(CamelFolder *folder, const char *uid, void (*done) (CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *data), void *data, EThread *thread) -{ - struct _get_message_msg *m; - - m = mail_msg_new(&get_message_op, NULL, sizeof(*m)); - m->folder = folder; - camel_object_ref((CamelObject *)folder); - m->uid = g_strdup(uid); - m->data = data; - m->done = done; - m->cancel = camel_operation_new(NULL, NULL); - - e_thread_put(thread, (EMsg *)m); -} - -/* ********************************************************************** */ - -struct _get_messages_msg { - struct _mail_msg msg; - - CamelFolder *folder; - GPtrArray *uids; - GPtrArray *messages; - - void (*done) (CamelFolder *folder, GPtrArray *uids, GPtrArray *msgs, void *data); - void *data; -}; - -static char * get_messages_desc(struct _mail_msg *mm, int done) -{ - return g_strdup_printf(_("Retrieving messages")); -} - -static void get_messages_get(struct _mail_msg *mm) -{ - struct _get_messages_msg *m = (struct _get_messages_msg *)mm; - int i; - CamelMimeMessage *message; - - for (i=0; iuids->len; i++) { - mail_statusf(_("Retrieving message number %d of %d (uid \"%s\")"), - i+1, m->uids->len, (char *) m->uids->pdata[i]); - - message = camel_folder_get_message(m->folder, m->uids->pdata[i], &mm->ex); - if (message == NULL) - break; - - g_ptr_array_add(m->messages, message); - } -} - -static void get_messages_got(struct _mail_msg *mm) -{ - struct _get_messages_msg *m = (struct _get_messages_msg *)mm; - - if (m->done) - m->done(m->folder, m->uids, m->messages, m->data); -} - -static void get_messages_free(struct _mail_msg *mm) -{ - struct _get_messages_msg *m = (struct _get_messages_msg *)mm; - int i; - - for (i=0;iuids->len;i++) - g_free(m->uids->pdata[i]); - g_ptr_array_free(m->uids, TRUE); - for (i=0;imessages->len;i++) { - if (m->messages->pdata[i]) - camel_object_unref((CamelObject *)m->messages->pdata[i]); - } - g_ptr_array_free(m->messages, TRUE); - camel_object_unref((CamelObject *)m->folder); -} - -static struct _mail_msg_op get_messages_op = { - get_messages_desc, - get_messages_get, - get_messages_got, - get_messages_free, -}; - -void -mail_get_messages(CamelFolder *folder, GPtrArray *uids, - void (*done) (CamelFolder *folder, GPtrArray *uids, GPtrArray *msgs, void *data), - void *data) -{ - struct _get_messages_msg *m; - - m = mail_msg_new(&get_messages_op, NULL, sizeof(*m)); - m->folder = folder; - camel_object_ref((CamelObject *)folder); - m->uids = uids; - m->messages = g_ptr_array_new(); - m->data = data; - m->done = done; - - e_thread_put(mail_thread_new, (EMsg *)m); -} - -/* ** SAVE MESSAGES ******************************************************* */ - -struct _save_messages_msg { - struct _mail_msg msg; - - CamelFolder *folder; - GPtrArray *uids; - char *path; - void (*done)(CamelFolder *folder, GPtrArray *uids, char *path, void *data); - void *data; -}; - -static char *save_messages_desc(struct _mail_msg *mm, int done) -{ - return g_strdup(_("Saving messages")); -} - -/* tries to build a From line, based on message headers */ -/* this is a copy directly from camel-mbox-summary.c */ - -static char *tz_months[] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" -}; - -static char *tz_days[] = { - "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" -}; - -static char * -build_from(struct _header_raw *header) -{ - GString *out = g_string_new("From "); - char *ret; - const char *tmp; - time_t thetime; - int offset; - struct tm tm; - - tmp = header_raw_find(&header, "Sender", NULL); - if (tmp == NULL) - tmp = header_raw_find(&header, "From", NULL); - if (tmp != NULL) { - struct _header_address *addr = header_address_decode(tmp); - - tmp = NULL; - if (addr) { - if (addr->type == HEADER_ADDRESS_NAME) { - g_string_append(out, addr->v.addr); - tmp = ""; - } - header_address_unref(addr); - } - } - if (tmp == NULL) - g_string_append(out, "unknown@nodomain.now.au"); - - /* try use the received header to get the date */ - tmp = header_raw_find(&header, "Received", NULL); - if (tmp) { - tmp = strrchr(tmp, ';'); - if (tmp) - tmp++; - } - - /* if there isn't one, try the Date field */ - if (tmp == NULL) - tmp = header_raw_find(&header, "Date", NULL); - - thetime = header_decode_date(tmp, &offset); - thetime += ((offset / 100) * (60 * 60)) + (offset % 100) * 60; - gmtime_r(&thetime, &tm); - g_string_sprintfa(out, " %s %s %d %02d:%02d:%02d %4d\n", - tz_days[tm.tm_wday], - tz_months[tm.tm_mon], tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_year + 1900); - - ret = out->str; - g_string_free(out, FALSE); - return ret; -} - -static void save_messages_save(struct _mail_msg *mm) -{ - struct _save_messages_msg *m = (struct _save_messages_msg *)mm; - CamelStreamFilter *filtered_stream; - CamelMimeFilterFrom *from_filter; - CamelStream *stream; - int fd, i; - char *from; - - fd = open(m->path, O_WRONLY | O_CREAT | O_TRUNC, 0666); - if (fd == -1) { - camel_exception_setv(&mm->ex, CAMEL_EXCEPTION_SYSTEM, - _("Unable to create output file: %s\n %s"), m->path, strerror(errno)); - return; - } - - stream = camel_stream_fs_new_with_fd(fd); - from_filter = camel_mime_filter_from_new(); - filtered_stream = camel_stream_filter_new_with_stream(stream); - camel_stream_filter_add(filtered_stream, (CamelMimeFilter *)from_filter); - camel_object_unref((CamelObject *)from_filter); - - for (i=0; iuids->len; i++) { - CamelMimeMessage *message; - - mail_statusf(_("Saving message %d of %d (uid \"%s\")"), - i+1, m->uids->len, (char *)m->uids->pdata[i]); - - message = camel_folder_get_message(m->folder, m->uids->pdata[i], &mm->ex); - if (!message) - break; - - /* we need to flush after each stream write since we are writing to the same fd */ - from = build_from(((CamelMimePart *)message)->headers); - if (camel_stream_write_string(stream, from) == -1 - || camel_stream_flush(stream) == -1 - || camel_data_wrapper_write_to_stream((CamelDataWrapper *)message, (CamelStream *)filtered_stream) == -1 - || camel_stream_flush((CamelStream *)filtered_stream) == -1) { - camel_exception_setv(&mm->ex, CAMEL_EXCEPTION_SYSTEM, - _("Error saving messages to: %s:\n %s"), m->path, strerror(errno)); - g_free(from); - camel_object_unref((CamelObject *)message); - break; - } - g_free(from); - camel_object_unref((CamelObject *)message); - } - - camel_object_unref((CamelObject *)filtered_stream); - camel_object_unref((CamelObject *)stream); -} - -static void save_messages_saved(struct _mail_msg *mm) -{ - struct _save_messages_msg *m = (struct _save_messages_msg *)mm; - - if (m->done) - m->done(m->folder, m->uids, m->path, m->data); -} - -static void save_messages_free(struct _mail_msg *mm) -{ - struct _save_messages_msg *m = (struct _save_messages_msg *)mm; - int i; - - for (i=0;iuids->len;i++) - g_free(m->uids->pdata[i]); - g_ptr_array_free(m->uids, TRUE); - camel_object_unref((CamelObject *)m->folder); - g_free(m->path); -} - -static struct _mail_msg_op save_messages_op = { - save_messages_desc, - save_messages_save, - save_messages_saved, - save_messages_free, -}; - -int -mail_save_messages(CamelFolder *folder, GPtrArray *uids, const char *path, - void (*done) (CamelFolder *folder, GPtrArray *uids, char *path, void *data), void *data) -{ - struct _save_messages_msg *m; - int id; - - m = mail_msg_new(&save_messages_op, NULL, sizeof(*m)); - m->folder = folder; - camel_object_ref((CamelObject *)folder); - m->uids = uids; - m->path = g_strdup(path); - m->data = data; - m->done = done; - - id = m->msg.seq; - e_thread_put(mail_thread_new, (EMsg *)m); - - return id; -} - -/* ** SAVE PART ******************************************************* */ - -struct _save_part_msg { - struct _mail_msg msg; - - CamelMimePart *part; - char *path; - void (*done)(CamelMimePart *part, char *path, int saved, void *data); - void *data; -}; - -static char *save_part_desc(struct _mail_msg *mm, int done) -{ - return g_strdup(_("Saving attachment")); -} - -static void save_part_save(struct _mail_msg *mm) -{ - struct _save_part_msg *m = (struct _save_part_msg *)mm; - CamelMimeFilterCharset *charsetfilter; - CamelContentType *content_type; - CamelStreamFilter *filtered_stream; - CamelStream *stream_fs; - CamelDataWrapper *data; - const char *charset; - - stream_fs = camel_stream_fs_new_with_name(m->path, O_WRONLY|O_CREAT, 0600); - if (stream_fs == NULL) { - camel_exception_setv(&mm->ex, 1, _("Cannot create output file: %s:\n %s"), m->path, strerror(errno)); - return; - } - - /* we only convert text/ parts, and we only convert if we have to - null charset param == us-ascii == utf8 always, and utf8 == utf8 obviously */ - /* this will also let "us-ascii that isn't really" parts pass out in - proper format, without us trying to treat it as what it isn't, which is - the same algorithm camel uses */ - - data = camel_medium_get_content_object((CamelMedium *)m->part); - content_type = camel_mime_part_get_content_type(m->part); - if (header_content_type_is(content_type, "text", "*") - && (charset = header_content_type_param(content_type, "charset")) - && strcasecmp(charset, "utf-8") != 0) { - charsetfilter = camel_mime_filter_charset_new_convert("utf-8", charset); - filtered_stream = camel_stream_filter_new_with_stream(stream_fs); - camel_stream_filter_add(filtered_stream, CAMEL_MIME_FILTER(charsetfilter)); - camel_object_unref(CAMEL_OBJECT(charsetfilter)); - } else { - /* no we can't use a CAMEL_BLAH() cast here, since its not true, HOWEVER - we only treat it as a normal stream from here on, so it is OK */ - filtered_stream = (CamelStreamFilter *)stream_fs; - camel_object_ref(CAMEL_OBJECT(stream_fs)); - } - - if (camel_data_wrapper_write_to_stream(data, CAMEL_STREAM(filtered_stream)) == -1 - || camel_stream_flush (CAMEL_STREAM(filtered_stream)) == -1) - camel_exception_setv(&mm->ex, 1, _("Could not write data: %s"), strerror(errno)); - - camel_object_unref (CAMEL_OBJECT (filtered_stream)); - camel_object_unref (CAMEL_OBJECT (stream_fs)); -} - -static void save_part_saved(struct _mail_msg *mm) -{ - struct _save_part_msg *m = (struct _save_part_msg *)mm; - - if (m->done) - m->done(m->part, m->path, !camel_exception_is_set(&mm->ex), m->data); -} - -static void save_part_free(struct _mail_msg *mm) -{ - struct _save_part_msg *m = (struct _save_part_msg *)mm; - - camel_object_unref((CamelObject *)m->part); - g_free(m->path); -} - -static struct _mail_msg_op save_part_op = { - save_part_desc, - save_part_save, - save_part_saved, - save_part_free, -}; - -int -mail_save_part(CamelMimePart *part, const char *path, - void (*done)(CamelMimePart *part, char *path, int saved, void *data), void *data) -{ - struct _save_part_msg *m; - int id; - - m = mail_msg_new(&save_part_op, NULL, sizeof(*m)); - m->part = part; - camel_object_ref((CamelObject *)part); - m->path = g_strdup(path); - m->data = data; - m->done = done; - - id = m->msg.seq; - e_thread_put(mail_thread_queued, (EMsg *)m); - - return id; -} diff --git a/mail/mail-ops.h b/mail/mail-ops.h deleted file mode 100644 index 74a197cb56..0000000000 --- a/mail/mail-ops.h +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Authors: - * Peter Williams - * Michael Zucchi - * - * Copyright 2000, 2001 Ximian, Inc. (http://www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#include "camel/camel-folder.h" -#include "camel/camel-filter-driver.h" -#include "camel/camel-mime-message.h" -#include "camel/camel-operation.h" - -#include "filter/filter-context.h" - -#include "evolution-storage.h" /*EvolutionStorage */ -#include "e-util/e-msgport.h" - -/* utility functions */ -FilterContext *mail_load_filter_context(void); - -void mail_append_mail (CamelFolder *folder, CamelMimeMessage *message, CamelMessageInfo *info, - void (*done)(CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, int ok, void *data), void *data); - -void mail_do_transfer_messages (CamelFolder *source, GPtrArray *uids, - gboolean delete_from_source, - gchar *dest_uri); - -/* get a single message, asynchronously */ -void mail_get_message(CamelFolder *folder, const char *uid, - void (*done) (CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *data), void *data, - EThread *thread); - -/* get several messages */ -void mail_get_messages(CamelFolder *folder, GPtrArray *uids, - void (*done) (CamelFolder *folder, GPtrArray *uids, GPtrArray *msgs, void *data), void *data); - -/* same for a folder */ -int mail_get_folder(const char *uri, - void (*done) (char *uri, CamelFolder *folder, void *data), void *data); - -/* and for a store */ -int mail_get_store(const char *uri, - void (*done) (char *uri, CamelStore *store, void *data), void *data); - -/* build an attachment */ -void mail_build_attachment(CamelFolder *folder, GPtrArray *uids, - void (*done)(CamelFolder *folder, GPtrArray *messages, CamelMimePart *part, char *subject, void *data), void *data); - -void mail_sync_folder(CamelFolder *folder, - void (*done) (CamelFolder *folder, void *data), void *data); -void mail_expunge_folder(CamelFolder *folder, - void (*done) (CamelFolder *folder, void *data), void *data); - -/* get folder info asynchronously */ -int mail_get_folderinfo(CamelStore *store, - void (*done)(CamelStore *store, CamelFolderInfo *info, void *data), void *data); - -/* create a new mail folder */ -void mail_create_folder(const char *uri, - void (*done) (char *uri, CamelFolder *folder, void *data), void *data); - -/* save messages */ -int mail_save_messages(CamelFolder *folder, GPtrArray *uids, const char *path, - void (*done) (CamelFolder *folder, GPtrArray *uids, char *path, void *data), void *data); -int mail_save_part(CamelMimePart *part, const char *path, - void (*done)(CamelMimePart *part, char *path, int saved, void *data), void *data); - -int mail_send_mail(const char *uri, CamelMimeMessage *message, - void (*done) (char *uri, CamelMimeMessage *message, gboolean sent, void *data), void *data); - -/* scan subfolders and add them to the storage, synchronous */ -/* FIXME: Move this to component-factory.c */ -void mail_scan_subfolders(CamelStore *store, EvolutionStorage *storage); -/* not sure about this one though */ -int mail_update_subfolders(CamelStore *store, EvolutionStorage *storage, - void (*done)(CamelStore *, void *data), void *data); - -/* yeah so this is messy, but it does a lot, maybe i can consolidate all user_data's to be the one */ -void mail_send_queue(CamelFolder *queue, const char *destination, - FilterContext *fc, const char *type, - CamelOperation *cancel, - CamelFilterGetFolderFunc get_folder, void *get_data, - CamelFilterStatusFunc *status, void *status_data, - void (*done)(char *destination, void *data), void *data); - -void mail_fetch_mail(const char *source, int keep, - FilterContext *fc, const char *type, - CamelOperation *cancel, - CamelFilterGetFolderFunc get_folder, void *get_data, - CamelFilterStatusFunc *status, void *status_data, - void (*done)(char *source, void *data), void *data); - -void mail_filter_folder(CamelFolder *source_folder, GPtrArray *uids, - FilterContext *fc, const char *type, - CamelOperation *cancel); - -/* convenience function for above */ -void mail_filter_on_demand(CamelFolder *folder, GPtrArray *uids); diff --git a/mail/mail-search-dialogue.c b/mail/mail-search-dialogue.c deleted file mode 100644 index c89148f4ba..0000000000 --- a/mail/mail-search-dialogue.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2000, 2001 Ximian, Inc. - * - * Authors: Not Zed - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License - * as published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include - -#include "mail-search-dialogue.h" - -static void mail_search_dialogue_class_init (MailSearchDialogueClass *class); -static void mail_search_dialogue_init (MailSearchDialogue *gspaper); -static void mail_search_dialogue_finalise (GtkObject *obj); - -static GnomeDialogClass *parent_class; - -guint -mail_search_dialogue_get_type (void) -{ - static guint type = 0; - - if (!type) { - GtkTypeInfo type_info = { - "MailSearchDialogue", - sizeof(MailSearchDialogue), - sizeof(MailSearchDialogueClass), - (GtkClassInitFunc)mail_search_dialogue_class_init, - (GtkObjectInitFunc)mail_search_dialogue_init, - (GtkArgSetFunc)NULL, - (GtkArgGetFunc)NULL - }; - - type = gtk_type_unique (gnome_dialog_get_type (), &type_info); - } - - return type; -} - -static void -mail_search_dialogue_class_init (MailSearchDialogueClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *)class; - parent_class = gtk_type_class (gnome_dialog_get_type ()); - - object_class->finalize = mail_search_dialogue_finalise; - /* override methods */ - -} - -static void -mail_search_dialogue_construct (MailSearchDialogue *o, FilterRule *rule) -{ - FilterPart *part; - GnomeDialog *dialogue = GNOME_DIALOG (o); - - gtk_window_set_policy (GTK_WINDOW (dialogue), FALSE, TRUE, FALSE); - gtk_window_set_default_size (GTK_WINDOW (dialogue), 500, 400); - - o->context = rule_context_new (); - rule_context_add_part_set (o->context, "partset", filter_part_get_type (), - rule_context_add_part, rule_context_next_part); - rule_context_load (o->context, EVOLUTION_DATADIR "/evolution/vfoldertypes.xml", ""); - if (rule) { - o->rule = rule; - o->guts = filter_rule_get_widget (o->rule, o->context); - } else { - o->rule = filter_rule_new (); - part = rule_context_next_part (o->context, NULL); - if (part == NULL) { - g_warning ("Problem loading search: no parts to load"); - o->guts = gtk_entry_new (); - } else { - filter_rule_add_part (o->rule, filter_part_clone (part)); - o->guts = filter_rule_get_widget (o->rule, o->context); - } - } - - gtk_widget_show (o->guts); - gtk_box_pack_start (GTK_BOX (dialogue->vbox), o->guts, TRUE, TRUE, 0); -} - -static void -mail_search_dialogue_init (MailSearchDialogue *o) -{ - GnomeDialog *dialogue = GNOME_DIALOG (o); - - gnome_dialog_append_buttons (dialogue, - GNOME_STOCK_BUTTON_OK, - _("_Search"), - GNOME_STOCK_BUTTON_CANCEL, - NULL); - gnome_dialog_set_default (dialogue, 0); -} - - -static void -mail_search_dialogue_finalise (GtkObject *obj) -{ - MailSearchDialogue *o = (MailSearchDialogue *)obj; - - if (o->context) - gtk_object_unref (GTK_OBJECT (o->context)); - if (o->rule) - gtk_object_unref (GTK_OBJECT (o->rule)); - - ((GtkObjectClass *)(parent_class))->finalize(obj); -} - -/** - * mail_search_dialogue_new: - * - * Create a new MailSearchDialogue object. - * - * Return value: A new #MailSearchDialogue object. - **/ -MailSearchDialogue * -mail_search_dialogue_new () -{ - MailSearchDialogue *o = (MailSearchDialogue *)gtk_type_new (mail_search_dialogue_get_type ()); - mail_search_dialogue_construct (o, NULL); - return o; -} - -MailSearchDialogue * -mail_search_dialogue_new_with_rule (FilterRule *rule) -{ - MailSearchDialogue *o = (MailSearchDialogue *)gtk_type_new (mail_search_dialogue_get_type ()); - if (rule) - gtk_object_ref (GTK_OBJECT (rule)); - mail_search_dialogue_construct (o, rule); - return o; -} - -/** - * mail_search_dialogue_get_query: - * @msd: - * - * Get the query string represting the current search criterea. - * - * Return value: - **/ -char * -mail_search_dialogue_get_query (MailSearchDialogue *msd) -{ - GString *out = g_string_new (""); - char *ret; - - filter_rule_build_code (msd->rule, out); - ret = out->str; - g_string_free (out, FALSE); - return ret; -} diff --git a/mail/mail-search-dialogue.h b/mail/mail-search-dialogue.h deleted file mode 100644 index f952bebaf6..0000000000 --- a/mail/mail-search-dialogue.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2000 Helix Code Inc. - * - * Authors: Not Zed - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License - * as published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef _MAIL_SEARCH_DIALOGUE_H -#define _MAIL_SEARCH_DIALOGUE_H - -#include -#include - -#include "filter/rule-context.h" -#include "filter/filter-rule.h" - -#define MAIL_SEARCH_DIALOGUE(obj) GTK_CHECK_CAST (obj, mail_search_dialogue_get_type (), MailSearchDialogue) -#define MAIL_SEARCH_DIALOGUE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, mail_search_dialogue_get_type (), MailSearchDialogueClass) -#define IS_MAIL_SEARCH_DIALOGUE(obj) GTK_CHECK_TYPE (obj, mail_search_dialogue_get_type ()) - -typedef struct _MailSearchDialogue MailSearchDialogue; -typedef struct _MailSearchDialogueClass MailSearchDialogueClass; - -struct _MailSearchDialogue { - GnomeDialog parent; - - RuleContext *context; - FilterRule *rule; - GtkWidget *guts; -}; - -struct _MailSearchDialogueClass { - GnomeDialogClass parent_class; - - /* virtual methods */ - - /* signals */ -}; - -guint mail_search_dialogue_get_type (void); -MailSearchDialogue *mail_search_dialogue_new (void); -MailSearchDialogue *mail_search_dialogue_new_with_rule(FilterRule *rule); - -/* methods */ -char *mail_search_dialogue_get_query(MailSearchDialogue *msd); - -#endif /* ! _MAIL_SEARCH_DIALOGUE_H */ - diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c deleted file mode 100644 index b9f51b65ac..0000000000 --- a/mail/mail-send-recv.c +++ /dev/null @@ -1,785 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Michael Zucchi - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -#include "config.h" -#include "mail-send-recv.h" - -#include -#include - -#include "filter/filter-context.h" -#include "filter/filter-filter.h" -#include "camel/camel-filter-driver.h" -#include "camel/camel-folder.h" -#include "camel/camel-operation.h" - -#include "evolution-storage.h" - -#include "mail.h" -#include "mail-mt.h" -#include "mail-config.h" -#include "mail-session.h" -#include "mail-tools.h" -#include "mail-ops.h" - -/* for the dialogue stuff */ -#include -#include -#include -#include -#include - -#define d(x) - -/* ms between status updates to the gui */ -#define STATUS_TIMEOUT (250) - -/* send/receive email */ - -/* ********************************************************************** */ -/* This stuff below is independent of the stuff above */ - -/* this stuff is used to keep track of which folders filters have accessed, and - what not. the thaw/refreeze thing doesn't really seem to work though */ -struct _folder_info { - char *uri; - CamelFolder *folder; - time_t update; - int count; /* how many times updated, to slow it down as we go, if we have lots */ -}; - -struct _send_data { - GList *infos; - - GnomeDialog *gd; - int cancelled; - - CamelFolder *inbox; /* since we're never asked to update this one, do it ourselves */ - time_t inbox_update; - - GMutex *lock; - GHashTable *folders; - - GHashTable *active; /* send_info's by uri */ -}; - -typedef enum { - SEND_RECEIVE, /* receiver */ - SEND_SEND, /* sender */ - SEND_UPDATE, /* imap-like 'just update folder info' */ -} send_info_t ; - -typedef enum { - SEND_ACTIVE, - SEND_CANCELLED, - SEND_COMPLETE -} send_state_t; - -struct _send_info { - send_info_t type; /* 0 = fetch, 1 = send */ - CamelOperation *cancel; - char *uri; - int keep; - send_state_t state; - GtkProgressBar *bar; - GtkButton *stop; - - int timeout_id; - char *what; - int pc; - - /*time_t update;*/ - struct _send_data *data; -}; - -static struct _send_data *send_data = NULL; - -static struct _send_data *setup_send_data(void) -{ - struct _send_data *data; - - if (send_data == NULL) { - send_data = data = g_malloc0(sizeof(*data)); - data->lock = g_mutex_new(); - data->folders = g_hash_table_new(g_str_hash, g_str_equal); - data->inbox = mail_tool_get_local_inbox(NULL); - data->active = g_hash_table_new(g_str_hash, g_str_equal); - } - return send_data; -} - -static void -receive_cancel(GtkButton *button, struct _send_info *info) -{ - if (info->state == SEND_ACTIVE) { - camel_operation_cancel(info->cancel); - if (info->bar) - gtk_progress_set_format_string((GtkProgress *)info->bar, _("Cancelling ...")); - info->state = SEND_CANCELLED; - } - if (info->stop) - gtk_widget_set_sensitive((GtkWidget *)info->stop, FALSE); -} - -static void -free_folder_info(void *key, struct _folder_info *info, void *data) -{ - /*camel_folder_thaw (info->folder); */ - camel_object_unref((CamelObject *)info->folder); - g_free(info->uri); -} - -static void free_send_info(void *key, struct _send_info *info, void *data) -{ - d(printf("Freeing send info %p\n", info)); - g_free(info->uri); - camel_operation_unref(info->cancel); - if (info->timeout_id != 0) - gtk_timeout_remove(info->timeout_id); - g_free(info); -} - -static void -free_send_data(void) -{ - struct _send_data *data = send_data; - - g_assert(g_hash_table_size(data->active) == 0); - - g_list_free(data->infos); - g_hash_table_foreach(data->active, (GHFunc)free_send_info, NULL); - g_hash_table_destroy(data->active); - g_hash_table_foreach(data->folders, (GHFunc)free_folder_info, NULL); - g_hash_table_destroy(data->folders); - g_mutex_free(data->lock); - if (data->inbox) { - /*camel_folder_thaw (data->inbox); */ - camel_object_unref((CamelObject *)data->inbox); - } - g_free(data); - send_data = NULL; -} - - -static void cancel_send_info(void *key, struct _send_info *info, void *data) -{ - receive_cancel(info->stop, info); -} - -static void hide_send_info(void *key, struct _send_info *info, void *data) -{ - info->stop = NULL; - info->bar = NULL; -} - -static void -dialogue_clicked(GnomeDialog *gd, int button, struct _send_data *data) -{ - switch(button) { - case 0: - d(printf("cancelled whole thing\n")); - if (!data->cancelled) { - data->cancelled = TRUE; - g_hash_table_foreach(data->active, (GHFunc)cancel_send_info, NULL); - } - gnome_dialog_set_sensitive(gd, 0, FALSE); - break; - case -1: /* dialogue vanished, so make out its just hidden */ - d(printf("hiding dialogue\n")); - g_hash_table_foreach(data->active, (GHFunc)hide_send_info, NULL); - break; - } -} - -static void operation_status(CamelOperation *op, const char *what, int pc, void *data); -static int operation_status_timeout(void *data); - -static struct _send_data *build_dialogue(GSList *sources, CamelFolder *outbox, const char *destination) -{ - GnomeDialog *gd; - GtkFrame *frame; - GtkTable *table; - int row; - GList *list = NULL; - struct _send_data *data; - GtkLabel *label; - GtkProgressBar *bar; - GtkButton *stop; - struct _send_info *info; - - data = setup_send_data(); - - gd = (GnomeDialog *)gnome_dialog_new(_("Send & Receive mail"), GNOME_STOCK_BUTTON_CANCEL, NULL); - gnome_window_icon_set_from_file((GtkWindow *)gd, EVOLUTION_DATADIR "images/evolution/evolution-inbox.png"); - - frame= (GtkFrame *)gtk_frame_new(_("Receiving")); - gtk_box_pack_start((GtkBox *)gd->vbox, (GtkWidget *)frame, TRUE, TRUE, 0); - table = (GtkTable *)gtk_table_new(g_slist_length(sources), 3, FALSE); - gtk_container_add((GtkContainer *)frame, (GtkWidget *)table); - gtk_widget_show((GtkWidget *)frame); - - row = 0; - while (sources) { - MailConfigService *source = sources->data; - - if (!source->url - || !source->enabled) { - sources = sources->next; - continue; - } - - /* see if we have an outstanding download active */ - info = g_hash_table_lookup(data->active, source->url); - if (info == NULL) { - info = g_malloc0(sizeof(*info)); - /* imap is handled differently */ - if (!strncmp(source->url, "imap:", 5)) - info->type = SEND_UPDATE; - else - info->type = SEND_RECEIVE; - d(printf("adding source %s\n", source->url)); - - info->uri = g_strdup(source->url); - info->keep = source->keep_on_server; - info->cancel = camel_operation_new(operation_status, info); - info->state = SEND_ACTIVE; - info->timeout_id = gtk_timeout_add(STATUS_TIMEOUT, operation_status_timeout, info); - - g_hash_table_insert(data->active, info->uri, info); - list = g_list_prepend(list, info); - } else if (info->bar != NULL) { - /* incase we get the same source pop up again */ - sources = sources->next; - continue; - } else if (info->timeout_id == 0) - info->timeout_id = gtk_timeout_add(STATUS_TIMEOUT, operation_status_timeout, info); - - label = (GtkLabel *)gtk_label_new(source->url); - bar = (GtkProgressBar *)gtk_progress_bar_new(); - stop = (GtkButton *)gnome_stock_button(GNOME_STOCK_BUTTON_CANCEL); - - gtk_progress_set_show_text((GtkProgress *)bar, TRUE); - - if (info->type == SEND_UPDATE) { - gtk_progress_set_format_string((GtkProgress *)bar, _("Updating ...")); - } else { - gtk_progress_set_format_string((GtkProgress *)bar, _("Waiting ...")); - } - - gtk_table_attach(table, (GtkWidget *)label, 0, 1, row, row+1, GTK_EXPAND|GTK_FILL, 0, 3, 1); - gtk_table_attach(table, (GtkWidget *)bar, 1, 2, row, row+1, GTK_EXPAND|GTK_FILL, 0, 3, 1); - gtk_table_attach(table, (GtkWidget *)stop, 2, 3, row, row+1, GTK_EXPAND|GTK_FILL, 0, 3, 1); - - info->bar = bar; - info->stop = stop; - info->data = data; - - gtk_signal_connect((GtkObject *)stop, "clicked", receive_cancel, info); - sources = sources->next; - row++; - } - - gtk_widget_show_all((GtkWidget *)table); - - if (outbox) { - frame= (GtkFrame *)gtk_frame_new(_("Sending")); - gtk_box_pack_start((GtkBox *)gd->vbox, (GtkWidget *)frame, TRUE, TRUE, 0); - table = (GtkTable *)gtk_table_new(1, 3, FALSE); - gtk_container_add((GtkContainer *)frame, (GtkWidget *)table); - gtk_widget_show((GtkWidget *)frame); - - info = g_hash_table_lookup(data->active, destination); - if (info == NULL) { - info = g_malloc0(sizeof(*info)); - info->type = SEND_SEND; - d(printf("adding dest %s\n", destination)); - - info->uri = g_strdup(destination); - info->keep = FALSE; - info->cancel = camel_operation_new(operation_status, info); - info->state = SEND_ACTIVE; - info->timeout_id = gtk_timeout_add(STATUS_TIMEOUT, operation_status_timeout, info); - - g_hash_table_insert(data->active, info->uri, info); - list = g_list_prepend(list, info); - } else if (info->timeout_id == 0) - info->timeout_id = gtk_timeout_add(STATUS_TIMEOUT, operation_status_timeout, info); - - label = (GtkLabel *)gtk_label_new(destination); - bar = (GtkProgressBar *)gtk_progress_bar_new(); - stop = (GtkButton *)gnome_stock_button(GNOME_STOCK_BUTTON_CANCEL); - - gtk_progress_set_format_string((GtkProgress *)bar, _("Waiting ...")); - gtk_progress_set_show_text((GtkProgress *)bar, TRUE); - - gtk_table_attach(table, (GtkWidget *)label, 0, 1, row, row+1, GTK_EXPAND|GTK_FILL, 0, 3, 1); - gtk_table_attach(table, (GtkWidget *)bar, 1, 2, row, row+1, GTK_EXPAND|GTK_FILL, 0, 3, 1); - gtk_table_attach(table, (GtkWidget *)stop, 2, 3, row, row+1, GTK_EXPAND|GTK_FILL, 0, 3, 1); - - info->bar = bar; - info->stop = stop; - info->data = data; - - gtk_signal_connect((GtkObject *)stop, "clicked", receive_cancel, info); - gtk_widget_show_all((GtkWidget *)table); - } - - gtk_widget_show((GtkWidget *)gd); - - gtk_signal_connect((GtkObject *)gd, "clicked", dialogue_clicked, data); - - data->infos = list; - data->gd = gd; - - return data; -} - -static void -update_folders(char *uri, struct _folder_info *info, void *data) -{ - time_t now = *((time_t *)data); - - d(printf("checking update for folder: %s\n", info->uri)); - - /* let it flow through to the folders every 10 seconds */ - /* we back off slowly as we progress */ - if (now > info->update+10+info->count*5) { - d(printf("upating a folder: %s\n", info->uri)); - /*camel_folder_thaw(info->folder); - camel_folder_freeze(info->folder);*/ - info->update = now; - info->count++; - } -} - -static void set_send_status(struct _send_info *info, const char *desc, int pc) -{ - const char *p; - char *out, *o, c; - - out = alloca(strlen(desc)*2+1); - o = out; - p = desc; - while ((c = *p++)) { - if (c=='%') - *o++ = '%'; - *o++ = c; - } - *o = 0; - - /* FIXME: LOCK */ - g_free(info->what); - info->what = g_strdup(out); - info->pc = pc; -} - -static void -receive_status (CamelFilterDriver *driver, enum camel_filter_status_t status, int pc, const char *desc, void *data) -{ - struct _send_info *info = data; - time_t now; - - /* let it flow through to the folder, every now and then too? */ - g_hash_table_foreach(info->data->folders, (GHFunc)update_folders, &now); - - if (info->data->inbox && now > info->data->inbox_update+20) { - d(printf("updating inbox too\n")); - /* this doesn't seem to work right :( */ - /*camel_folder_thaw(info->data->inbox); - camel_folder_freeze(info->data->inbox);*/ - info->data->inbox_update = now; - } - - /* we just pile them onto the port, assuming it can handle it. - We could also have a receiver port and see if they've been processed - yet, so if this is necessary its not too hard to add */ - /* the mail_gui_port receiver will free everything for us */ - switch (status) { - case CAMEL_FILTER_STATUS_START: - case CAMEL_FILTER_STATUS_END: - set_send_status(info, desc, pc); - break; - default: - break; - } -} - -static int operation_status_timeout(void *data) -{ - struct _send_info *info = data; - - if (info->bar) { - gtk_progress_set_percentage((GtkProgress *)info->bar, (gfloat)(info->pc/100.0)); - gtk_progress_set_format_string((GtkProgress *)info->bar, info->what); - - return TRUE; - } - - return FALSE; -} - -/* for camel operation status */ -static void operation_status(CamelOperation *op, const char *what, int pc, void *data) -{ - struct _send_info *info = data; - - /*printf("Operation '%s', percent %d\n");*/ - switch (pc) { - case CAMEL_OPERATION_START: - pc = 0; - break; - case CAMEL_OPERATION_END: - pc = 100; - break; - } - - set_send_status(info, what, pc); -} - -/* when receive/send is complete */ -static void -receive_done (char *uri, void *data) -{ - struct _send_info *info = data; - - if (info->bar) { - gtk_progress_set_percentage((GtkProgress *)info->bar, (gfloat)1.0); - - switch(info->state) { - case SEND_CANCELLED: - gtk_progress_set_format_string((GtkProgress *)info->bar, _("Cancelled.")); - break; - default: - info->state = SEND_COMPLETE; - gtk_progress_set_format_string((GtkProgress *)info->bar, _("Complete.")); - } - } - - if (info->stop) - gtk_widget_set_sensitive((GtkWidget *)info->stop, FALSE); - - /* remove/free this active download */ - d(printf("%s: freeing info %p\n", __FUNCTION__, info)); - g_hash_table_remove(info->data->active, info->uri); - info->data->infos = g_list_remove(info->data->infos, info); - g_free(info->uri); - camel_operation_unref(info->cancel); - if (info->timeout_id) - gtk_timeout_remove(info->timeout_id); - - if (g_hash_table_size(info->data->active) == 0) { - if (info->data->gd) - gtk_object_unref((GtkObject *)info->data->gd); - free_send_data(); - } - - g_free(info); -} - -/* same for updating */ -static void -receive_update_done(CamelStore *store, void *data) -{ - receive_done("", data); -} - -/* although we dont do anythign smart here yet, there is no need for this interface to - be available to anyone else. - This can also be used to hook into which folders are being updated, and occasionally - let them refresh */ -static CamelFolder * -receive_get_folder(CamelFilterDriver *d, const char *uri, void *data, CamelException *ex) -{ - struct _send_info *info = data; - CamelFolder *folder; - struct _folder_info *oldinfo; - char *oldkey; - - g_mutex_lock(info->data->lock); - folder = g_hash_table_lookup(info->data->folders, uri); - g_mutex_unlock(info->data->lock); - if (folder) { - camel_object_ref((CamelObject *)folder); - return folder; - } - folder = mail_tool_uri_to_folder(uri, ex); - if (!folder) - return NULL; - - /* we recheck that the folder hasn't snuck in while we were loading it ... */ - /* and we assume the newer one is the same, but unref the old one anyway */ - g_mutex_lock(info->data->lock); - - if (g_hash_table_lookup_extended(info->data->folders, uri, (void **)&oldkey, (void **)&oldinfo)) { - camel_object_unref((CamelObject *)oldinfo->folder); - oldinfo->folder = folder; - } else { - /*camel_folder_freeze (folder); */ - oldinfo = g_malloc0(sizeof(*oldinfo)); - oldinfo->folder = folder; - oldinfo->uri = g_strdup(uri); - g_hash_table_insert(info->data->folders, oldinfo->uri, oldinfo); - } - - camel_object_ref (CAMEL_OBJECT (folder)); - - g_mutex_unlock(info->data->lock); - - return folder; -} - -static void -receive_update_got_store(char *uri, CamelStore *store, void *data) -{ - struct _send_info *info = data; - - if (store) { - EvolutionStorage *storage = mail_lookup_storage(store); - if (storage) { - mail_update_subfolders(store, storage, receive_update_done, info); - gtk_object_unref((GtkObject *)storage); - } else { - receive_done("", info); - } - } else { - receive_done("", info); - } -} - -void mail_send_receive(void) -{ - GSList *sources; - GList *scan; - FilterContext *fc; - static GtkWidget *gd = NULL; - struct _send_data *data; - extern CamelFolder *outbox_folder; - const MailConfigAccount *account; - - if (gd != NULL) { - g_assert(GTK_WIDGET_REALIZED(gd)); - gdk_window_show(gd->window); - gdk_window_raise(gd->window); - return; - } - - sources = mail_config_get_sources(); - if (!sources) - return; - account = mail_config_get_default_account(); - if (!account || !account->transport) - return; - - fc = mail_load_filter_context(); - - /* what to do about pop before smtp ? - Well, probably hook into receive_done or receive_status on - the right pop account, and when it is, then kick off the - smtp one. */ - data = build_dialogue(sources, outbox_folder, account->transport->url); - scan = data->infos; - gd = GTK_WIDGET(data->gd); - gtk_signal_connect((GtkObject *)gd, "destroy", gtk_widget_destroyed, &gd); - while (scan) { - struct _send_info *info = scan->data; - - switch(info->type) { - case SEND_RECEIVE: - mail_fetch_mail(info->uri, info->keep, - fc, FILTER_SOURCE_INCOMING, - info->cancel, - receive_get_folder, info, - receive_status, info, - receive_done, info); - break; - case SEND_SEND: - /* todo, store the folder in info? */ - mail_send_queue(outbox_folder, info->uri, - fc, FILTER_SOURCE_OUTGOING, - info->cancel, - receive_get_folder, info, - receive_status, info, - receive_done, info); - break; - case SEND_UPDATE: - /* FIXME: error reporting? */ - mail_get_store(info->uri, receive_update_got_store, info); - break; - } - scan = scan->next; - } - - gtk_object_unref((GtkObject *)fc); -} - -struct _auto_data { - char *uri; - int keep; /* keep on server flag */ - int period; /* in seconds */ - int timeout_id; -}; - -static GHashTable *auto_active; - -static gboolean -auto_timeout(void *data) -{ - struct _auto_data *info = data; - - mail_receive_uri(info->uri, info->keep); - - return TRUE; -} - -static void auto_setup_set(void *key, struct _auto_data *info, GHashTable *set) -{ - g_hash_table_insert(set, info->uri, info); -} - -static void auto_clean_set(void *key, struct _auto_data *info, GHashTable *set) -{ - d(printf("removing auto-check for %s %p\n", info->uri, info)); - g_hash_table_remove(set, info->uri); - gtk_timeout_remove(info->timeout_id); - g_free(info->uri); - g_free(info); -} - -/* call to setup initial, and after changes are made to the config */ -/* FIXME: Need a cleanup funciton for when object is deactivated */ -void -mail_autoreceive_setup(void) -{ - GSList *sources; - GHashTable *set_hash; - - sources = mail_config_get_sources(); - if (!sources) - return; - - if (auto_active == NULL) - auto_active = g_hash_table_new(g_str_hash, g_str_equal); - - set_hash = g_hash_table_new(g_str_hash, g_str_equal); - g_hash_table_foreach(auto_active, (GHFunc)auto_setup_set, set_hash); - - while (sources) { - MailConfigService *source = sources->data; - if (source->url && source->auto_check && source->enabled) { - struct _auto_data *info; - - d(printf("setting up auto-receive mail for : %s\n", source->url)); - - g_hash_table_remove(set_hash, source->url); - info = g_hash_table_lookup(auto_active, source->url); - if (info) { - info->keep = source->keep_on_server; - if (info->period != source->auto_check_time*60) { - info->period = source->auto_check_time*60; - gtk_timeout_remove(info->timeout_id); - info->timeout_id = gtk_timeout_add(info->period*1000, auto_timeout, info); - } - } else { - info = g_malloc0(sizeof(*info)); - info->uri = g_strdup(source->url); - info->keep = source->keep_on_server; - info->period = source->auto_check_time*60; - info->timeout_id = gtk_timeout_add(info->period*1000, auto_timeout, info); - g_hash_table_insert(auto_active, info->uri, info); - /* If we do this at startup, it can cause the logon dialogue to be hidden, - so lets not */ - /*mail_receive_uri(source->url, source->keep_on_server);*/ - } - } - - sources = sources->next; - } - - g_hash_table_foreach(set_hash, (GHFunc)auto_clean_set, auto_active); - g_hash_table_destroy(set_hash); -} - -/* we setup the download info's in a hashtable, if we later need to build the gui, we insert - them in to add them. */ -void mail_receive_uri(const char *uri, int keep) -{ - FilterContext *fc; - struct _send_info *info; - struct _send_data *data; - extern CamelFolder *outbox_folder; - - data = setup_send_data(); - info = g_hash_table_lookup(data->active, uri); - if (info != NULL) { - d(printf("download of %s still in progress\n", uri)); - return; - } - - d(printf("starting non-interactive download of '%s'\n", uri)); - - info = g_malloc0(sizeof(*info)); - /* imap is handled differently */ - if (!strncmp(uri, "imap:", 5)) - info->type = SEND_UPDATE; - else - info->type = SEND_RECEIVE; - - info->bar = NULL; - info->uri = g_strdup(uri); - info->keep = keep; - info->cancel = camel_operation_new(operation_status, info); - info->stop = NULL; - info->data = data; - info->state = SEND_ACTIVE; - info->timeout_id = 0; - - d(printf("Adding new info %p\n", info)); - - g_hash_table_insert(data->active, info->uri, info); - - fc = mail_load_filter_context(); - switch(info->type) { - case SEND_RECEIVE: - mail_fetch_mail(info->uri, info->keep, - fc, FILTER_SOURCE_INCOMING, - info->cancel, - receive_get_folder, info, - receive_status, info, - receive_done, info); - break; - case SEND_SEND: - /* todo, store the folder in info? */ - mail_send_queue(outbox_folder, info->uri, - fc, FILTER_SOURCE_OUTGOING, - info->cancel, - receive_get_folder, info, - receive_status, info, - receive_done, info); - break; - case SEND_UPDATE: - /* FIXME: error reporting? */ - mail_get_store(info->uri, receive_update_got_store, info); - break; - } - gtk_object_unref((GtkObject *)fc); -} - diff --git a/mail/mail-send-recv.h b/mail/mail-send-recv.h deleted file mode 100644 index ef3a502b4c..0000000000 --- a/mail/mail-send-recv.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Michael Zucchi - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -#ifndef MAIL_SEND_RECV_H -#define MAIL_SEND_RECV_H - -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus }*/ - -/* send/receive all uri's */ -void mail_send_receive(void); -/* receive a single uri */ -void mail_receive_uri(const char *uri, int keep); -/* setup auto receive stuff */ -void mail_autoreceive_setup(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ! MAIL_SEND_RECV_H */ diff --git a/mail/mail-session.h b/mail/mail-session.h deleted file mode 100644 index bde6c8d186..0000000000 --- a/mail/mail-session.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast - * - * Copyright 2000 Helix Code, Inc. (www.helixcode.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -#ifndef MAIL_SESSION_H -#define MAIL_SESSION_H - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -void mail_session_init (void); -void mail_session_enable_interaction (gboolean enable); -char *mail_session_request_dialog (const char *prompt, gboolean secret, - const char *key, gboolean async); -void mail_session_forget_passwords (BonoboUIComponent *uih, void *user_data, - const char *path); -void mail_session_remember_password (const char *url); - -void mail_session_forget_password (const char *key); - -void mail_session_set_password (const char *url, const char *password); - -extern CamelSession *session; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ! MAIL_SESSION_H */ diff --git a/mail/mail-summary.c b/mail/mail-summary.c deleted file mode 100644 index fb7b88ce8b..0000000000 --- a/mail/mail-summary.c +++ /dev/null @@ -1,525 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* mail-summary.c - * - * Authors: Iain Holmes - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -#include "camel.h" -#include -#include "mail.h" -#include "mail-tools.h" -#include "mail-ops.h" -#include "mail-vfolder.h" -#include "mail-summary.h" - -#include "Evolution.h" -#include "evolution-storage.h" -#include "evolution-storage-listener.h" - -#include "filter/vfolder-context.h" - -#include -#include - -typedef struct { - CamelFolder *folder; - - char *name; - char *uri; - int total, unread; -} FolderSummary; - -typedef struct { - BonoboObject *component; - BonoboObject *view; - EvolutionStorageListener *listener; - - GHashTable *folder_to_summary; - FolderSummary **folders; - int numfolders; - - char *title; - char *icon; - - guint idle; - gboolean in_summary; -} MailSummary; - -#define SUMMARY_IN() g_print ("IN: %s: %d\n", __FUNCTION__, __LINE__); -#define SUMMARY_OUT() g_print ("OUT: %s: %d\n", __FUNCTION__, __LINE__); - -static int queue_len = 0; - -extern char *evolution_dir; -extern EvolutionStorage *vfolder_storage; - -#define MAIN_READER main_compipe[0] -#define MAIN_WRITER main_compipe[1] -#define DISPATCH_READER dispatch_compipe[0] -#define DISPATCH_WRITER dispatch_compipe[1] - -static int main_compipe[2] = {-1, -1}; -static int dispatch_compipe[2] = {-1, -1}; - -GIOChannel *summary_chan_reader = NULL; - -static gboolean do_changed (MailSummary *summary); - -enum { - PROPERTY_TITLE, - PROPERTY_ICON -}; - -/* Read a message from the pipe */ -static gboolean -read_msg (GIOChannel *source, - GIOCondition condition, - gpointer user_data) -{ - MailSummary *summary; - int size; - - summary = g_new0 (MailSummary, 1); - g_io_channel_read (source, (gchar *) summary, - sizeof (MailSummary) / sizeof (gchar), &size); - - if (size != sizeof (MailSummary)) { - g_warning (_("Incomplete message written on pipe!")); - return TRUE; - } - - do_changed (summary); - g_free (summary); - - return TRUE; -} - -/* check_compipes: */ -static void -check_compipes (void) -{ - if (MAIN_READER < 0) { - if (pipe (main_compipe) < 0) { - g_warning ("Call to pipe failed"); - return; - } - - summary_chan_reader = g_io_channel_unix_new (MAIN_READER); - g_io_add_watch (summary_chan_reader, G_IO_IN, read_msg, NULL); - } - - if (DISPATCH_READER < 0) { - if (pipe (dispatch_compipe) < 0) { - g_warning ("Call to pipe failed"); - return; - } - } -} - -static void -folder_free (FolderSummary *folder) -{ - g_free (folder->name); - g_free (folder->uri); -} - -static void -summary_free (MailSummary *summary) -{ - int i; - - for (i = 0; i < summary->numfolders; i++){ - folder_free (summary->folders[i]); - } - - g_free (summary->folders); - g_free (summary->title); - g_free (summary->icon); - - g_hash_table_destroy (summary->folder_to_summary); -} - -static void -view_destroy_cb (GtkObject *object, - MailSummary *summary) -{ - summary_free (summary); - g_free (summary); -} - -static char * -generate_html_summary (MailSummary *summary) -{ - char *ret_html = NULL, *tmp; - FolderSummary *fs; - int i; - - summary->in_summary = TRUE; - /* Inbox first */ - fs = summary->folders[0]; - - g_print ("%p: %p\n", fs, fs->name); - g_print ("unread: %d\n", fs->unread); - g_print ("total: %d\n", fs->total); - - tmp = g_strdup_printf ("", - fs->name, fs->unread, fs->total); - - ret_html = g_strdup (tmp); - for (i = 1; i < summary->numfolders; i++) { - char *tmp2; - - fs = summary->folders[i]; - tmp2 = g_strdup_printf ("" - "", - fs->uri, fs->name, fs->unread, fs->total); - - tmp = ret_html; - ret_html = g_strconcat (ret_html, tmp2, NULL); - g_free (tmp); - g_free (tmp2); - } - - tmp = ret_html; - ret_html = g_strconcat (ret_html, "
    %s:" - "%d/%d
    %s:%d/%d
    ", NULL); - g_free (tmp); - - summary->in_summary = FALSE; - return ret_html; -} - -static gboolean -do_changed (MailSummary *summary) -{ - char *ret_html; - - ret_html = generate_html_summary (summary); - executive_summary_html_view_set_html(EXECUTIVE_SUMMARY_HTML_VIEW(summary->view), (const char *) ret_html); - g_free (ret_html); - - summary->idle = 0; - return TRUE; -} - -/* These two callbacks are called from the Camel thread, - which can't make any CORBA calls, or else ORBit locks up, - and likewise the thread that can call ORBit, cannot call - camel. - - So, when the callbacks are triggered, they generate a MailSummary - structure and write this onto a pipe. The ORBit calling thread - detects when something is written to the pipe and creates its own - MailSummary structure, and calls the appropriate CORBA calls. - - Same theory as mail-threads.c, but a lot less complicated - as there is only one way communication, and only one type of message -*/ -static void -folder_changed_cb (CamelObject *folder, - gpointer event_data, - gpointer user_data) -{ - MailSummary *summary; - FolderSummary *fs; - - summary = (MailSummary *) user_data; - fs = g_hash_table_lookup (summary->folder_to_summary, folder); - if (fs == NULL) { - g_warning ("%s: Unknown folder", __FUNCTION__); - return; - } - - fs->total = camel_folder_get_message_count (fs->folder); - fs->unread = camel_folder_get_unread_message_count (fs->folder); - - write (MAIN_WRITER, summary, sizeof (MailSummary)); - queue_len++; - - return; -} - -static void -message_changed_cb (CamelObject *folder, - gpointer event_data, - gpointer user_data) -{ - MailSummary *summary; - FolderSummary *fs; - - summary = (MailSummary *)user_data; - fs = g_hash_table_lookup (summary->folder_to_summary, folder); - if (fs == NULL) { - g_warning ("%s: Unknown folder.", __FUNCTION__); - return; - } - - fs->unread = camel_folder_get_unread_message_count (fs->folder); - fs->total = camel_folder_get_message_count (fs->folder); - - write (MAIN_WRITER, summary, sizeof (MailSummary)); - queue_len++; - - return; -} - -static void -generate_folder_summaries (MailSummary *summary) -{ - int numfolders = 1; /* Always at least the Inbox */ - char *user, *system; - FilterRule *rule; - VfolderContext *context; - FolderSummary *fs; - CamelException *ex; - int i; - - user = g_strdup_printf ("%s/vfolders.xml", evolution_dir); - system = g_strdup_printf ("%s/evolution/vfoldertypes.xml", EVOLUTION_DATADIR); - - context = vfolder_context_new (); - rule_context_load ((RuleContext *)context, system, user); - g_free (user); - g_free (system); - - rule = NULL; - while ((rule = rule_context_next_rule ((RuleContext *)context, rule, NULL))){ - g_print ("rule->name: %s\n", rule->name); - numfolders++; - } - - if (summary->folders != NULL) { - int i; - - for (i = 0; i < summary->numfolders; i++){ - folder_free (summary->folders[i]); - } - - g_free (summary->folders); - } - - summary->folders = g_new (FolderSummary *, numfolders); - - /* Inbox */ - fs = summary->folders[0] = g_new (FolderSummary, 1); - fs->name = g_strdup ("Inbox"); - g_print ("%p: %s(%p)\n", fs, fs->name, fs->name); - fs->uri = NULL; - ex = camel_exception_new (); - fs->folder = mail_tool_get_local_inbox (ex); - - fs->total = camel_folder_get_message_count (fs->folder); - fs->unread = camel_folder_get_unread_message_count (fs->folder); - camel_exception_free (ex); - camel_object_hook_event (CAMEL_OBJECT (fs->folder), "folder_changed", - (CamelObjectEventHookFunc) folder_changed_cb, - summary); - camel_object_hook_event (CAMEL_OBJECT (fs->folder), "message_changed", - (CamelObjectEventHookFunc) message_changed_cb, - summary); - g_hash_table_insert (summary->folder_to_summary, fs->folder, fs); - - - summary->numfolders = 1; - - for (i = 1, rule = NULL; i < numfolders; i++) { - char *uri; - - ex = camel_exception_new (); - fs = summary->folders[i] = g_new (FolderSummary, 1); - rule = rule_context_next_rule ((RuleContext *)context, rule, NULL); - fs->name = g_strdup (rule->name); - - uri = g_strconcat ("vfolder:", rule->name, NULL); - fs->folder = vfolder_uri_to_folder (uri, ex); - fs->uri = g_strconcat ("evolution:/VFolders/", rule->name, NULL); - g_free (uri); - - fs->total = camel_folder_get_message_count (fs->folder); - fs->unread = camel_folder_get_unread_message_count (fs->folder); - - /* Connect to each folder */ - camel_object_hook_event (CAMEL_OBJECT (fs->folder), - "folder_changed", - (CamelObjectEventHookFunc) folder_changed_cb, - summary); - camel_object_hook_event (CAMEL_OBJECT (fs->folder), - "message_changed", - (CamelObjectEventHookFunc) message_changed_cb, - summary); - g_hash_table_insert (summary->folder_to_summary, fs->folder, fs); - summary->numfolders++; - - camel_exception_free (ex); - } - - gtk_object_destroy (GTK_OBJECT (context)); -} - -static void -get_property (BonoboPropertyBag *bag, - BonoboArg *arg, - guint arg_id, - CORBA_Environment *ev, - gpointer user_data) -{ - MailSummary *summary = (MailSummary *) user_data; - - switch (arg_id) { - case PROPERTY_TITLE: - BONOBO_ARG_SET_STRING (arg, summary->title); - break; - - case PROPERTY_ICON: - BONOBO_ARG_SET_STRING (arg, summary->icon); - break; - - default: - break; - } -} - -/* This code may play with the threads wrongly... - if the mail component locks when you use the summary - remove this define */ -#define DETECT_NEW_VFOLDERS -#ifdef DETECT_NEW_VFOLDERS - -/* Check that we can generate a new summary - and keep coming back until we can. */ -static gboolean -idle_check (gpointer data) -{ - MailSummary *summary = (MailSummary *) data; - - if (summary->in_summary == TRUE) - return TRUE; - - generate_folder_summaries (summary); - write (MAIN_WRITER, summary, sizeof (MailSummary)); - queue_len++; - summary->idle = 0; - - return FALSE; -} - -static void -new_folder_cb (EvolutionStorageListener *listener, - const char *path, - const GNOME_Evolution_Folder *folder, - MailSummary *summary) -{ - g_print ("New folder: %s\n", path); - - if (summary->idle == 0) - summary->idle = g_idle_add ((GSourceFunc) idle_check, summary); -} - -static void -removed_folder_cb (EvolutionStorageListener *listener, - const char *path, - MailSummary *summary) -{ - g_print ("Removed folder: %s\n", path); - - if (summary->idle == 0) - summary->idle = g_idle_add ((GSourceFunc) idle_check, summary); -} -#endif - -BonoboObject * -create_summary_view (ExecutiveSummaryComponentFactory *_factory, - void *closure) -{ - GNOME_Evolution_Storage corba_local_objref; - GNOME_Evolution_StorageListener corba_object; - CORBA_Environment ev; - BonoboObject *component, *view; - BonoboPropertyBag *bag; - BonoboEventSource *event_source; - MailSummary *summary; - - summary = g_new (MailSummary, 1); - summary->folders = 0; - summary->in_summary = FALSE; - summary->folder_to_summary = g_hash_table_new (NULL, NULL); - summary->title = g_strdup ("Mail Summary"); - summary->icon = g_strdup ("envelope.png"); - summary->idle = 0; - - check_compipes (); - - component = executive_summary_component_new (); - summary->component = component; - - event_source = bonobo_event_source_new (); - - view = executive_summary_html_view_new_full (event_source); - bonobo_object_add_interface (component, view); - summary->view = view; - gtk_signal_connect (GTK_OBJECT (view), "destroy", - GTK_SIGNAL_FUNC (view_destroy_cb), summary); - - bag = bonobo_property_bag_new_full (get_property, NULL, - event_source, summary); - bonobo_property_bag_add (bag, - "window_title", PROPERTY_TITLE, - BONOBO_ARG_STRING, NULL, - "The title of this component's window", - BONOBO_PROPERTY_READABLE); - bonobo_property_bag_add (bag, - "window_icon", PROPERTY_ICON, - BONOBO_ARG_STRING, NULL, - "The icon for this component's window", - BONOBO_PROPERTY_READABLE); - bonobo_object_add_interface (component, BONOBO_OBJECT(bag)); - -#ifdef DETECT_NEW_VFOLDERS - summary->listener = evolution_storage_listener_new (); - gtk_signal_connect (GTK_OBJECT (summary->listener), "new_folder", - GTK_SIGNAL_FUNC (new_folder_cb), summary); - gtk_signal_connect (GTK_OBJECT (summary->listener), "removed_folder", - GTK_SIGNAL_FUNC (removed_folder_cb), summary); - - corba_object = evolution_storage_listener_corba_objref (summary->listener); - - CORBA_exception_init (&ev); - corba_local_objref = bonobo_object_corba_objref (BONOBO_OBJECT (vfolder_storage)); - - GNOME_Evolution_Storage_addListener (corba_local_objref, - corba_object, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Cannot add a listener to the vfolder storage."); - } - CORBA_exception_free (&ev); -#endif - - if (summary->idle == 0) - summary->idle = g_idle_add ((GSourceFunc) idle_check, summary); - - return component; -} diff --git a/mail/mail-summary.h b/mail/mail-summary.h deleted file mode 100644 index 8c706a1787..0000000000 --- a/mail/mail-summary.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* mail-summary.h - * - * Authors: Iain Holmes - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __MAIL_SUMMARY_H__ -#define __MAIL_SUMMARY_H__ - -#include - -BonoboObject *create_summary_view (ExecutiveSummaryComponentFactory *factory, - void *closure); - -#endif diff --git a/mail/mail-tools.c b/mail/mail-tools.c deleted file mode 100644 index 73d024f8ff..0000000000 --- a/mail/mail-tools.c +++ /dev/null @@ -1,386 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* mail-ops.c: callbacks for the mail toolbar/menus */ - -/* - * Authors: - * Dan Winship - * Peter Williams - * Jeffrey Stedfast - * - * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#include -#include -#include -#include "camel/camel.h" -#include "camel/camel-vee-folder.h" -#include "mail-vfolder.h" -#include "filter/vfolder-rule.h" -#include "filter/vfolder-context.h" -#include "filter/filter-option.h" -#include "filter/filter-input.h" -#include "mail.h" /*session*/ -#include "mail-tools.h" -#include "mail-local.h" -#include "e-util/e-html-utils.h" - -/* **************************************** */ - -G_LOCK_DEFINE_STATIC (camel); -G_LOCK_DEFINE_STATIC (camel_locklevel); -static GPrivate *camel_locklevel = NULL; - -#define LOCK_VAL (GPOINTER_TO_INT (g_private_get (camel_locklevel))) -#define LOCK_SET(val) g_private_set (camel_locklevel, (GINT_TO_POINTER (val))) - - -CamelFolder * -mail_tool_get_folder_from_urlname (const gchar *url, const gchar *name, - guint32 flags, CamelException *ex) -{ - CamelStore *store; - CamelFolder *folder; - - store = camel_session_get_store (session, url, ex); - if (!store) - return NULL; - - folder = camel_store_get_folder (store, name, flags, ex); - camel_object_unref (CAMEL_OBJECT (store)); - - return folder; -} - -const gchar * -mail_tool_get_folder_name (CamelFolder *folder) -{ - const char *name = camel_folder_get_full_name (folder); - char *path; - - /* This is a kludge. */ - - if (strcmp (name, "//mbox") && strcmp (name, "//mh")) - return name; - - /* For mbox/mh, return the parent store's final path component. */ - path = CAMEL_SERVICE (folder->parent_store)->url->path; - if (strchr (path, '/')) - return strrchr (path, '/') + 1; - else - return path; -} - -gchar * -mail_tool_get_local_movemail_path (void) -{ - return g_strdup_printf ("%s/local/Inbox/movemail", evolution_dir); -} - -CamelFolder * -mail_tool_get_local_inbox (CamelException *ex) -{ - gchar *url; - CamelFolder *folder; - - url = g_strdup_printf("file://%s/local/Inbox", evolution_dir); - folder = mail_tool_uri_to_folder (url, ex); - g_free (url); - return folder; -} - -CamelFolder * -mail_tool_get_inbox (const gchar *url, CamelException *ex) -{ - CamelStore *store; - CamelFolder *folder; - - store = camel_session_get_store (session, url, ex); - if (!store) - return NULL; - - folder = camel_store_get_inbox (store, ex); - camel_object_unref (CAMEL_OBJECT (store)); - - return folder; -} - -/* why is this function so stupidly complex when allthe work is done elsehwere? */ -char * -mail_tool_do_movemail (const gchar *source_url, CamelException *ex) -{ - gchar *dest_path; - const gchar *source; - struct stat sb; -#ifndef MOVEMAIL_PATH - int tmpfd; -#endif - g_return_val_if_fail (strncmp (source_url, "mbox:", 5) == 0, NULL); - - /* Set up our destination. */ - - dest_path = mail_tool_get_local_movemail_path(); - - /* Create a new movemail mailbox file of 0 size */ - -#ifndef MOVEMAIL_PATH - tmpfd = open (dest_path, O_RDWR | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR); - - if (tmpfd == -1) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Couldn't create temporary " - "mbox `%s': %s"), dest_path, g_strerror (errno)); - g_free (dest_path); - return NULL; - } - - close (tmpfd); -#endif - - /* Skip over "mbox:" plus host part (if any) of url. */ - - source = source_url + 5; - if (!strncmp (source, "//", 2)) - source = strchr (source + 2, '/'); - - - /* Movemail from source (source_url) to dest_path */ - camel_movemail (source, dest_path, ex); - - if (stat (dest_path, &sb) < 0 || sb.st_size == 0) { - g_free (dest_path); - return NULL; - } - - if (camel_exception_is_set (ex)) { - g_free (dest_path); - return NULL; - } - - return dest_path; -} - -void -mail_tool_set_uid_flags (CamelFolder *folder, const char *uid, guint32 mask, guint32 set) -{ - camel_folder_set_message_flags (folder, uid, mask, set); -} - -char * -mail_tool_generate_forward_subject (CamelMimeMessage *msg) -{ - const char *subject; - char *fwd_subj, *fromstr; - const CamelInternetAddress *from; - - from = camel_mime_message_get_from(msg); - subject = camel_mime_message_get_subject(msg); - - if (from) { - fromstr = camel_address_format((CamelAddress *)from); - if (subject && *subject) { - fwd_subj = g_strdup_printf ("[%s] %s", fromstr, subject); - } else { - fwd_subj = g_strdup_printf (_("[%s] (forwarded message)"), - fromstr); - } - g_free(fromstr); - } else { - if (subject && *subject) { - if (strncmp (subject, "Fwd: ", 5) == 0) - subject += 4; - fwd_subj = g_strdup_printf ("Fwd: %s", subject); - } else - fwd_subj = g_strdup (_("Fwd: (no subject)")); - } - - return fwd_subj; -} - -CamelMimePart * -mail_tool_make_message_attachment (CamelMimeMessage *message) -{ - CamelMimePart *part; - const char *subject; - gchar *desc; - - /*camel_object_ref (CAMEL_OBJECT (message));*/ - - subject = camel_mime_message_get_subject (message); - if (subject) - desc = g_strdup_printf (_("Forwarded message - %s"), subject); - else - desc = g_strdup (_("Forwarded message (no subject)")); - - part = camel_mime_part_new (); - camel_mime_part_set_disposition (part, "inline"); - camel_mime_part_set_description (part, desc); - camel_medium_set_content_object (CAMEL_MEDIUM (part), - CAMEL_DATA_WRAPPER (message)); - camel_mime_part_set_content_type (part, "message/rfc822"); - g_free(desc); - /*camel_object_unref (CAMEL_OBJECT (message));*/ - return part; -} - -CamelFolder * -mail_tool_uri_to_folder (const char *uri, CamelException *ex) -{ - CamelURL *url; - CamelStore *store = NULL; - CamelFolder *folder = NULL; - int offset = 0; - - g_return_val_if_fail (uri != NULL, NULL); - - if (!strncmp (uri, "vtrash:", 7)) - offset = 7; - - url = camel_url_new (uri + offset, ex); - if (!url) - return NULL; - - if (!strcmp (url->protocol, "vfolder")) { - folder = vfolder_uri_to_folder (uri, ex); - } else { - store = camel_session_get_store (session, uri + offset, ex); - if (store) { - char *name; - - if (url->path && *url->path) - name = url->path + 1; - else - name = ""; - - if (offset) - folder = camel_store_get_trash (store, ex); - else - folder = camel_store_get_folder (store, name, - CAMEL_STORE_FOLDER_CREATE, ex); - } - } - - if (camel_exception_is_set (ex)) { - if (folder) { - camel_object_unref (CAMEL_OBJECT (folder)); - folder = NULL; - } - } - if (store) - camel_object_unref (CAMEL_OBJECT (store)); - camel_url_free (url); - - return folder; -} - -/** - * mail_tool_quote_message: - * @message: mime message to quote - * @fmt: credits format - example: "On %s, %s wrote:\n" - * @Varargs: arguments - * - * Returns an allocated buffer containing the quoted message. - */ -gchar * -mail_tool_quote_message (CamelMimeMessage *message, const char *fmt, ...) -{ - CamelDataWrapper *contents; - gboolean want_plain, is_html; - gchar *text; - - want_plain = !mail_config_get_send_html (); - contents = camel_medium_get_content_object (CAMEL_MEDIUM (message)); - text = mail_get_message_body (contents, want_plain, &is_html); - - /* Set the quoted reply text. */ - if (text) { - gchar *ret_text, *credits = NULL; - - /* create credits */ - if (fmt) { - va_list ap; - - va_start (ap, fmt); - credits = g_strdup_vprintf (fmt, ap); - va_end (ap); - } - - if (is_html) { - if (credits) { - ret_text = g_strdup_printf ("
    \n%s\n%s\n" - "
    \n", - credits, text); - } else { - ret_text = g_strdup_printf ("
    \n%s\n" - "
    \n", - text); - } - } else { - gchar *s, *d, *quoted_text; - gint lines, len, offset = 0; - - /* Count the number of lines in the body. If - * the text ends with a \n, this will be one - * too high, but that's ok. Allocate enough - * space for the text and the "> "s. - */ - for (s = text, lines = 0; s; s = strchr (s + 1, '\n')) - lines++; - - offset = credits ? strlen (credits) : 0; - - /* offset is the size of the credits, strlen (text) - * covers the body, lines * 2 does the "> "s, and - * the last +2 covers the final "\0", plus an extra - * "\n" in case text doesn't end with one. - */ - quoted_text = g_malloc (offset + strlen (text) + - lines * 2 + 2); - - if (credits) - memcpy (quoted_text, credits, offset); - - s = text; - d = quoted_text + offset; - - /* Copy text to quoted_text line by line, - * prepending "> ". - */ - while (1) { - len = strcspn (s, "\n"); - if (len == 0 && !*s) - break; - sprintf (d, "> %.*s\n", len, s); - s += len; - if (!*s++) - break; - d += len + 3; - } - *d = '\0'; - - /* Now convert that to HTML. */ - ret_text = e_text_to_html (quoted_text, E_TEXT_TO_HTML_PRE); - g_free (quoted_text); - } - - g_free (text); - return ret_text; - } - - return NULL; -} diff --git a/mail/mail-tools.h b/mail/mail-tools.h deleted file mode 100644 index 7f6aa647f3..0000000000 --- a/mail/mail-tools.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Peter Williams - * - * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#ifndef MAIL_TOOLS_H -#define MAIL_TOOLS_H - -#include -#include /*eek*/ - -/* Get a CamelFolder from a root url and a foldername (uses the global session)*/ -CamelFolder * -mail_tool_get_folder_from_urlname (const gchar *url, const gchar *name, - guint32 flags, CamelException *ex); - -/* Get a useful name for a given CamelFolder (ie, not "mbox") */ -const gchar *mail_tool_get_folder_name (CamelFolder *folder); - -/* Get the url for the local inbox, index returns if the mailbox is indexed */ -gchar *mail_tool_get_local_inbox_url (int *index); - -/* Get the filename for our movemail folder or storage */ -gchar *mail_tool_get_local_movemail_path (void); -gchar *mail_tool_get_local_movemail_url (void); - -/* Get the CamelFolder for the local inbox */ -CamelFolder *mail_tool_get_local_inbox (CamelException *ex); - -/* Get the "inbox" for a url (uses global session) */ -CamelFolder *mail_tool_get_inbox (const gchar *url, CamelException *ex); - -/* Does a camel_movemail into the local movemail folder - * and returns the path to the new movemail folder that was created. which shoudl be freed later */ -char * -mail_tool_do_movemail (const gchar *source_url, CamelException *ex); - -/* Transfers all the messages from source into dest; - * source is emptied and synced. */ -void -mail_tool_move_folder_contents (CamelFolder *source, CamelFolder *dest, gboolean use_cache, CamelException *ex); - -/* Generates the subject for a message forwarding @msg */ -gchar * -mail_tool_generate_forward_subject (CamelMimeMessage *msg); - -/* Make a message into an attachment */ -CamelMimePart * -mail_tool_make_message_attachment (CamelMimeMessage *message); - -/* Parse the ui into a real CamelFolder any way we know how. */ -CamelFolder * -mail_tool_uri_to_folder (const char *uri, CamelException *ex); - -GHashTable * -mail_lookup_url_table (CamelMimeMessage *mime_message); - -gchar *mail_tool_quote_message (CamelMimeMessage *message, const char *fmt, ...); - -#endif diff --git a/mail/mail-types.h b/mail/mail-types.h deleted file mode 100644 index 74e650fd4f..0000000000 --- a/mail/mail-types.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#ifndef MAIL_TYPES_H -#define MAIL_TYPES_H 1 - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus }*/ - - -typedef struct _FolderBrowser FolderBrowser; -typedef struct _SubscribeDialog SubscribeDialog; -typedef struct _MessageList MessageList; -typedef struct _MailDisplay MailDisplay; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* MAIL_TYPES_H */ diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c deleted file mode 100644 index 706f259b85..0000000000 --- a/mail/mail-vfolder.c +++ /dev/null @@ -1,377 +0,0 @@ -/* - Copyright 2000, 2001 Helix Code Inc. - - Author: Michael Zucchi - - code for managing vfolders - - NOTE: dont run this through fucking indent. -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include - -#include "Evolution.h" -#include "evolution-storage.h" - -#include "evolution-shell-component.h" -#include "folder-browser.h" -#include "mail-vfolder.h" -#include "mail-tools.h" -#include "mail-autofilter.h" -#include "mail.h" - -#include "camel/camel.h" - -#include "filter/vfolder-context.h" -#include "filter/vfolder-editor.h" - -#define d(x) x - -struct _vfolder_info { - char *name; - char *query; -}; - -/* list of vfolders available */ -static GList *available_vfolders = NULL; -static VfolderContext *context; - -/* Ditto below */ -EvolutionStorage *vfolder_storage; - -/* GROSS HACK: for passing to other parts of the program */ -EvolutionShellClient *global_shell_client = NULL; - -/* more globals ... */ -extern char *evolution_dir; -extern CamelSession *session; - -static struct _vfolder_info * -vfolder_find(const char *name) -{ - GList *l = available_vfolders; - struct _vfolder_info *info; - - while (l) { - info = l->data; - if (!strcmp(info->name, name)) - return info; - l = g_list_next(l); - } - return NULL; -} - -/* go through the list of what we have, what we want, and make - them match, deleting/reconfiguring as required */ -static void -vfolder_refresh(void) -{ - GList *l; - GList *head = NULL; /* processed list */ - struct _vfolder_info *info; - FilterRule *rule; - GString *expr = g_string_new(""); - char *uri, *path; - - rule = NULL; - while ( (rule = rule_context_next_rule((RuleContext *)context, rule, NULL)) ) { - info = vfolder_find(rule->name); - g_string_truncate(expr, 0); - filter_rule_build_code(rule, expr); - if (info) { - available_vfolders = g_list_remove(available_vfolders, info); - - /* check if the rule has changed ... otherwise, leave it */ - if (strcmp(expr->str, info->query)) { - d(printf("Must reconfigure vfolder with new rule?\n")); - g_free(info->query); - info->query = g_strdup(expr->str); - - uri = g_strdup_printf("vfolder:%s", info->name); - path = g_strdup_printf("/%s", info->name); - evolution_storage_removed_folder(vfolder_storage, path); - evolution_storage_new_folder(vfolder_storage, path, g_basename(path), - "mail", uri, info->name, FALSE); - g_free(uri); - g_free(path); - } - } else { - info = g_malloc(sizeof(*info)); - info->name = g_strdup(rule->name); - info->query = g_strdup(expr->str); - d(printf("Adding new vfolder: %s %s\n", rule->name, expr->str)); - - uri = g_strdup_printf("vfolder:%s", info->name); - path = g_strdup_printf("/%s", info->name); - evolution_storage_new_folder(vfolder_storage, path, g_basename(path), - "mail", uri, info->name, FALSE); - g_free(uri); - g_free(path); - } - head = g_list_append(head, info); - } - /* everything in available_vfolders are to be removed ... */ - l = available_vfolders; - while (l) { - info = l->data; - d(printf("removing vfolders %s %s\n", info->name, info->query)); - path = g_strdup_printf("/%s", info->name); - evolution_storage_removed_folder(vfolder_storage, path); - g_free(path); - g_free(info->name); - g_free(info->query); - l = g_list_next(l); - } - - /* setup the virtual unmatched folder */ - info = vfolder_find("UNMATCHED"); - if (info == NULL) { - char *uri, *path; - - info = g_malloc(sizeof(*info)); - info->name = g_strdup("UNMATCHED"); - info->query = g_strdup("UNMATCHED"); - d(printf("Adding new vfolder: %s %s\n", info->name, info->query)); - - uri = g_strdup_printf("vfolder:%s", info->name); - path = g_strdup_printf("/%s", info->name); - evolution_storage_new_folder(vfolder_storage, path, g_basename(path), - "mail", uri, info->name, FALSE); - g_free(uri); - g_free(path); - } - head = g_list_append(head, info); - - g_list_free(available_vfolders); - available_vfolders = head; - g_string_free(expr, TRUE); -} - -void -vfolder_create_storage(EvolutionShellComponent *shell_component) -{ - EvolutionShellClient *shell_client; - GNOME_Evolution_Shell corba_shell; - EvolutionStorage *storage; - char *user, *system; - - shell_client = evolution_shell_component_get_owner (shell_component); - if (shell_client == NULL) { - g_warning ("We have no shell!?"); - return; - } - global_shell_client = shell_client; - - corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)); - - storage = evolution_storage_new (_("VFolders"), NULL, NULL); - if (evolution_storage_register_on_shell (storage, corba_shell) != EVOLUTION_STORAGE_OK) { - g_warning ("Cannot register storage"); - return; - } - - vfolder_storage = storage; - - user = g_strdup_printf ("%s/vfolders.xml", evolution_dir); - system = g_strdup_printf("%s/evolution/vfoldertypes.xml", EVOLUTION_DATADIR); - - context = vfolder_context_new(); - printf("loading rules %s %s\n", system, user); - if (rule_context_load((RuleContext *)context, system, user) != 0) { - g_warning("cannot load vfolders: %s\n", ((RuleContext *)context)->error); - } - g_free(user); - g_free(system); - vfolder_refresh(); -} - -/* maps the shell's uri to the real vfolder uri and open the folder */ -CamelFolder * -vfolder_uri_to_folder(const char *uri, CamelException *ex) -{ - void camel_vee_folder_add_folder(CamelFolder *, CamelFolder *); - - struct _vfolder_info *info; - char *storeuri, *foldername; - VfolderRule *rule; - CamelFolder *folder = NULL, *sourcefolder; - const char *sourceuri; - int sources; - - if (strncmp (uri, "vfolder:", 8)) - return NULL; - - info = vfolder_find(uri+8); - if (info == NULL) { - g_warning("Shell trying to open unknown vFolder: %s", uri); - return NULL; - } - - d(printf("Opening vfolder: %s\n", uri)); - - rule = (VfolderRule *)rule_context_find_rule((RuleContext *)context, info->name, NULL); - - storeuri = g_strdup_printf("vfolder:%s/vfolder/%s", evolution_dir, info->name); - foldername = g_strdup_printf("%s?%s", info->name, info->query); - - /* we dont have indexing on vfolders */ - folder = mail_tool_get_folder_from_urlname (storeuri, foldername, CAMEL_STORE_FOLDER_CREATE, ex); - - bonobo_object_ref (BONOBO_OBJECT (vfolder_storage)); - mail_hash_storage ((CamelService *)folder->parent_store, vfolder_storage); - - if (strcmp(uri+8, "UNMATCHED") != 0) { - sourceuri = NULL; - sources = 0; - while ( (sourceuri = vfolder_rule_next_source(rule, sourceuri)) ) { - d(printf("adding vfolder source: %s\n", sourceuri)); - sourcefolder = mail_tool_uri_to_folder (sourceuri, ex); - printf("source folder = %p\n", sourcefolder); - if (sourcefolder) { - sources++; - camel_vee_folder_add_folder(folder, sourcefolder); - } else { - /* we'll just silently ignore now-missing sources */ - camel_exception_clear(ex); - } - } - /* if we didn't have any sources, just use Inbox as the default */ - if (sources == 0) { - char *defaulturi; - - defaulturi = g_strdup_printf("file://%s/local/Inbox", evolution_dir); - d(printf("No sources configured/found, using default: %s\n", defaulturi)); - sourcefolder = mail_tool_uri_to_folder (defaulturi, ex); - g_free(defaulturi); - if (sourcefolder) { - camel_vee_folder_add_folder(folder, sourcefolder); - } - } - } - - g_free(foldername); - g_free(storeuri); - - return folder; -} - -static void -vfolder_editor_clicked(GtkWidget *w, int button, void *data) -{ - if (button == 0) { - char *user; - - user = g_strdup_printf("%s/vfolders.xml", evolution_dir); - rule_context_save((RuleContext *)context, user); - g_free(user); - vfolder_refresh(); - } - if (button != -1) { - gnome_dialog_close((GnomeDialog *)w); - } -} - -void -vfolder_edit(void) -{ - GtkWidget *w; - - w = vfolder_editor_construct(context); - gtk_signal_connect((GtkObject *)w, "clicked", vfolder_editor_clicked, NULL); - gtk_widget_show(w); -} - -static void -new_rule_clicked(GtkWidget *w, int button, void *data) -{ - if (button == 0) { - char *user; - FilterRule *rule = gtk_object_get_data((GtkObject *)w, "rule"); - - gtk_object_ref((GtkObject *)rule); - rule_context_add_rule((RuleContext *)context, rule); - user = g_strdup_printf("%s/vfolders.xml", evolution_dir); - rule_context_save((RuleContext *)context, user); - g_free(user); - vfolder_refresh(); - } - if (button != -1) { - gnome_dialog_close((GnomeDialog *)w); - } -} - -FilterPart * -vfolder_create_part(const char *name) -{ - return rule_context_create_part((RuleContext *)context, name); -} - -/* clones a filter/search rule into a matching vfolder rule (assuming the same system definitions) */ -FilterRule * -vfolder_clone_rule(FilterRule *in) -{ - FilterRule *rule = vfolder_rule_new(); - xmlNodePtr xml; - - xml = filter_rule_xml_encode(in); - filter_rule_xml_decode(rule, xml, (RuleContext *)context); - xmlFreeNodeList(xml); - - return rule; -} - -/* adds a rule with a gui */ -void -vfolder_gui_add_rule(VfolderRule *rule) -{ - GtkWidget *w; - GnomeDialog *gd; - - w = filter_rule_get_widget((FilterRule *)rule, (RuleContext *)context); - - gd = (GnomeDialog *)gnome_dialog_new(_("New VFolder"), - GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_CANCEL, - NULL); - gnome_dialog_set_default (gd, 0); - - gtk_window_set_policy(GTK_WINDOW(gd), FALSE, TRUE, FALSE); - gtk_window_set_default_size (GTK_WINDOW (gd), 500, 500); - gtk_box_pack_start((GtkBox *)gd->vbox, w, TRUE, TRUE, 0); - gtk_widget_show((GtkWidget *)gd); - gtk_object_set_data_full((GtkObject *)gd, "rule", rule, (GtkDestroyNotify)gtk_object_unref); - gtk_signal_connect((GtkObject *)gd, "clicked", new_rule_clicked, NULL); - gtk_widget_show((GtkWidget *)gd); -} - -void -vfolder_gui_add_from_message(CamelMimeMessage *msg, int flags, const char *source) -{ - VfolderRule *rule; - - g_return_if_fail (msg != NULL); - - rule = (VfolderRule*)vfolder_rule_from_message(context, msg, flags, source); - vfolder_gui_add_rule(rule); -} - -void -vfolder_gui_add_from_mlist(CamelMimeMessage *msg, const char *mlist, const char *source) -{ - VfolderRule *rule; - - g_return_if_fail (msg != NULL); - - rule = (VfolderRule*)vfolder_rule_from_mlist(context, mlist, source); - vfolder_gui_add_rule(rule); -} - -EvolutionStorage * -mail_vfolder_get_vfolder_storage (void) -{ - gtk_object_ref (GTK_OBJECT (vfolder_storage)); - return vfolder_storage; -} diff --git a/mail/mail-vfolder.h b/mail/mail-vfolder.h deleted file mode 100644 index b8b409b1e7..0000000000 --- a/mail/mail-vfolder.h +++ /dev/null @@ -1,28 +0,0 @@ - -#ifndef _MAIL_VFOLDER_H -#define _MAIL_VFOLDER_H - -#include - -#include "Evolution.h" -#include "evolution-storage.h" -#include "evolution-shell-component.h" - -#include "camel/camel-folder.h" -#include "camel/camel-mime-message.h" -#include "filter/vfolder-rule.h" -#include "filter/filter-part.h" - -void vfolder_create_storage(EvolutionShellComponent *shell_component); - -CamelFolder *vfolder_uri_to_folder(const char *uri, CamelException *ex); -void vfolder_edit(void); -FilterPart *vfolder_create_part(const char *name); -FilterRule *vfolder_clone_rule(FilterRule *in); -void vfolder_gui_add_rule(VfolderRule *rule); -void vfolder_gui_add_from_message(CamelMimeMessage *msg, int flags, const char *source); -void vfolder_gui_add_from_mlist(CamelMimeMessage *msg, const char *mlist, const char *source); - -EvolutionStorage *mail_vfolder_get_vfolder_storage (void); - -#endif diff --git a/mail/mail-view.c b/mail/mail-view.c deleted file mode 100644 index 320ad9510d..0000000000 --- a/mail/mail-view.c +++ /dev/null @@ -1,250 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast - * - * Copyright 2000 Helix Code, Inc. (www.helixcode.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -#include -#include "mail.h" -#include "mail-ops.h" -#include "camel/camel.h" -#include "mail-display.h" -#include "mail-callbacks.h" - -typedef struct mail_view_data_s { - CamelFolder *source; - gchar *uid; - CamelMimeMessage *msg; - MailDisplay *md; -} mail_view_data; - -#define MINIMUM_WIDTH 600 -#define MINIMUM_HEIGHT 400 - -/* Size of the window last time it was changed. */ -static GtkAllocation last_allocation = { 0, 0 }; - -static void -mail_view_data_free (gpointer mvd) -{ - mail_view_data *data = (mail_view_data *) mvd; - - if (data->uid) - g_free (data->uid); - if (data->msg) - camel_object_unref (CAMEL_OBJECT (data->msg)); - if (data->source) - camel_object_unref (CAMEL_OBJECT (data->source)); - - g_free (data); -} - -static mail_view_data * -mail_view_data_new (CamelFolder *source, const gchar *uid, CamelMimeMessage *msg) -{ - mail_view_data *data; - - data = g_new (mail_view_data, 1); - data->source = source; - camel_object_ref (CAMEL_OBJECT (data->source)); - data->msg = msg; - camel_object_ref (CAMEL_OBJECT (data->msg)); - data->uid = g_strdup (uid); - - return data; -} - -static void -on_close (GtkWidget *menuitem, gpointer user_data) -{ - GtkWidget *view_window; - - view_window = gtk_object_get_data (GTK_OBJECT (menuitem), "view-window"); - g_return_if_fail (view_window); - gtk_widget_destroy (GTK_WIDGET (view_window)); -} - -static void -view_reply_to_sender (GtkWidget *widget, gpointer user_data) -{ - mail_view_data *data = (mail_view_data *) user_data; - - mail_reply (data->source, data->msg, data->uid, FALSE); -} - -static void -view_reply_to_all (GtkWidget *widget, gpointer user_data) -{ - mail_view_data *data = (mail_view_data *) user_data; - - mail_reply (data->source, data->msg, data->uid, TRUE); -} - -static void -view_forward_msg (GtkWidget *widget, gpointer user_data) -{ - mail_view_data *data = (mail_view_data *) user_data; - GPtrArray *uids; - - uids = g_ptr_array_new(); - g_ptr_array_add(uids, g_strdup (data->uid)); - forward_messages(data->source, uids, FALSE); -} - -static void -view_print_msg (GtkWidget *widget, gpointer user_data) -{ - mail_view_data *data = (mail_view_data *) user_data; - - mail_print_msg (data->md); -} - -static void -view_delete_msg (GtkWidget *button, gpointer user_data) -{ - mail_view_data *data = (mail_view_data *) user_data; - - camel_folder_set_message_flags(data->source, data->uid, CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN); -} - -static void -view_size_allocate_cb (GtkWidget *widget, - GtkAllocation *allocation) -{ - last_allocation = *allocation; -} - -static GnomeUIInfo mail_view_toolbar [] = { - - /*GNOMEUIINFO_ITEM_STOCK (N_("Save"), N_("Save this message"), - save_msg, GNOME_STOCK_PIXMAP_SAVE),*/ - - GNOMEUIINFO_ITEM_STOCK (N_("Reply"), N_("Reply to the sender of this message"), - view_reply_to_sender, GNOME_STOCK_PIXMAP_MAIL_RPL), - - GNOMEUIINFO_ITEM_STOCK (N_("Reply to All"), N_("Reply to all recipients of this message"), - view_reply_to_all, GNOME_STOCK_PIXMAP_MAIL_RPL), - - GNOMEUIINFO_ITEM_STOCK (N_("Forward"), N_("Forward this message"), view_forward_msg, GNOME_STOCK_PIXMAP_MAIL_FWD), - - GNOMEUIINFO_SEPARATOR, - - GNOMEUIINFO_ITEM_STOCK (N_("Print"), N_("Print the selected message"), view_print_msg, GNOME_STOCK_PIXMAP_PRINT), - - GNOMEUIINFO_ITEM_STOCK (N_("Delete"), N_("Delete this message"), view_delete_msg, GNOME_STOCK_PIXMAP_TRASH), - - /*GNOMEUIINFO_SEPARATOR,*/ - - /*GNOMEUIINFO_ITEM_STOCK (N_("Next"), N_("Next message"), mail_view_next_msg, GNOME_STOCK_PIXMAP_NEXT), - - GNOMEUIINFO_ITEM_STOCK (N_("Previous"), N_("Previous message"), mail_view_prev_msg, GNOME_STOCK_PIXMAP_PREVIOUS),*/ - - GNOMEUIINFO_END -}; - -static GnomeUIInfo file_menu[] = { - /*GNOMEUIINFO_MENU_SAVE_ITEM (save, NULL),*/ - /*GNOMEUIINFO_MENU_SAVE_AS_ITEM (save_as, NULL),*/ - /*GNOMEUIINFO_SEPARATOR,*/ - GNOMEUIINFO_MENU_CLOSE_ITEM (on_close, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo view_menu[] = -{ - GNOMEUIINFO_END -}; - -static GnomeUIInfo mail_view_menubar[] = -{ - GNOMEUIINFO_MENU_FILE_TREE (file_menu), - GNOMEUIINFO_MENU_VIEW_TREE (view_menu), - GNOMEUIINFO_END -}; - -static void -set_default_size (GtkWidget *widget) -{ - int width, height; - - width = MAX (MINIMUM_WIDTH, last_allocation.width); - height = MAX (MINIMUM_HEIGHT, last_allocation.height); - - gtk_window_set_default_size (GTK_WINDOW (widget), width, height); -} - -GtkWidget * -mail_view_create (CamelFolder *source, const char *uid, CamelMimeMessage *msg) -{ - GtkWidget *window; - GtkWidget *toolbar; - GtkWidget *mail_display; - char *subject; - mail_view_data *data; - - data = mail_view_data_new (source, uid, msg); - - subject = (char *) camel_mime_message_get_subject (msg); - if (!subject) - subject = ""; - - window = gnome_app_new ("Evolution", subject); - - toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH); - - gnome_app_fill_toolbar_with_data (GTK_TOOLBAR (toolbar), - mail_view_toolbar, - NULL, data); - - gnome_app_set_toolbar (GNOME_APP (window), GTK_TOOLBAR (toolbar)); - gnome_app_create_menus (GNOME_APP (window), mail_view_menubar); - - gtk_object_set_data_full (GTK_OBJECT (window), "mvd", data, - mail_view_data_free); - - gtk_widget_ref (mail_view_menubar[0].widget); - gtk_object_set_data_full (GTK_OBJECT (window), "file", - mail_view_menubar[0].widget, - (GtkDestroyNotify) gtk_widget_unref); - - gtk_widget_ref (file_menu[0].widget); - gtk_object_set_data (GTK_OBJECT (file_menu[0].widget), "view-window", window); - gtk_object_set_data_full (GTK_OBJECT (window), "close", - file_menu[0].widget, - (GtkDestroyNotify) gtk_widget_unref); - - gtk_widget_ref (mail_view_menubar[1].widget); - gtk_object_set_data_full (GTK_OBJECT (window), "view", - mail_view_menubar[1].widget, - (GtkDestroyNotify) gtk_widget_unref); - - mail_display = mail_display_new (); - mail_display_set_message (MAIL_DISPLAY (mail_display), CAMEL_MEDIUM (msg)); - data->md = MAIL_DISPLAY (mail_display); - gnome_app_set_contents (GNOME_APP (window), mail_display); - gtk_widget_grab_focus (GTK_WIDGET (MAIL_DISPLAY (mail_display)->html)); - - gtk_signal_connect (GTK_OBJECT (window), "size_allocate", - GTK_SIGNAL_FUNC (view_size_allocate_cb), NULL); - - set_default_size (window); - - return window; -} - diff --git a/mail/mail-vtrash.c b/mail/mail-vtrash.c deleted file mode 100644 index 565f60dd98..0000000000 --- a/mail/mail-vtrash.c +++ /dev/null @@ -1,173 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "Evolution.h" -#include "evolution-storage.h" -#include "evolution-shell-component.h" - -#include "mail.h" -#include "mail-vfolder.h" -#include "mail-vtrash.h" -#include "mail-tools.h" -#include "mail-mt.h" - -#include "camel/camel.h" - -#define d(x) - -extern char *evolution_dir; -extern CamelSession *session; - - -/** - * mail_vtrash_add: add a "vTrash" folder on the EvolutionStorage - * @store: the CamelStore that the vTrash exists on - * @store_uri: the URL of the store - * @name: the name to give the vTrash folder - * - * Creates the vTrash folder for the provided store in the folder view - * (EvolutionStorage) and creates the URL for that vTrash folder. - **/ -void -mail_vtrash_add (CamelStore *store, const char *store_uri, const char *name) -{ - EvolutionStorage *storage; - char *uri, *path; - - g_return_if_fail (CAMEL_IS_STORE (store)); - - uri = g_strdup_printf ("vtrash:%s", store_uri); - - if (!strcmp (store_uri, "file:/")) { - storage = mail_vfolder_get_vfolder_storage (); - } else { - storage = mail_lookup_storage (store); - } - - if (!storage) { - g_free (uri); - return; - } - - path = g_strdup_printf ("/%s", name); - evolution_storage_new_folder (storage, path, g_basename (path), - "mail", uri, name, FALSE); - gtk_object_unref (GTK_OBJECT (storage)); - - g_free (path); -} - -struct _get_trash_msg { - struct _mail_msg msg; - - CamelStore *store; - char *store_uri; - char *name; -}; - -static char * -get_trash_desc (struct _mail_msg *mm, int done) -{ - struct _get_trash_msg *m = (struct _get_trash_msg *)mm; - - return g_strdup_printf (_("Opening Trash folder for %s"), m->store_uri); -} - -static void -get_trash_get (struct _mail_msg *mm) -{ - struct _get_trash_msg *m = (struct _get_trash_msg *)mm; - - camel_operation_register (mm->cancel); - camel_operation_start (mm->cancel, _("Getting matches")); - - /* we don't want to connect */ - m->store = (CamelStore *) camel_session_get_service (session, m->store_uri, - CAMEL_PROVIDER_STORE, &mm->ex); - if (m->store == NULL) { - g_warning ("Couldn't get service %s: %s\n", m->store_uri, - camel_exception_get_description (&mm->ex)); - camel_exception_clear (&mm->ex); - } - - camel_operation_end (mm->cancel); - camel_operation_unregister (mm->cancel); -} - -static void -get_trash_got (struct _mail_msg *mm) -{ - struct _get_trash_msg *m = (struct _get_trash_msg *)mm; - - if (m->store) - mail_vtrash_add (m->store, m->store_uri, m->name); -} - -static void -get_trash_free (struct _mail_msg *mm) -{ - struct _get_trash_msg *m = (struct _get_trash_msg *)mm; - - if (m->store) - camel_object_unref (CAMEL_OBJECT (m->store)); - - g_free (m->store_uri); - g_free (m->name); -} - -static struct _mail_msg_op get_trash_op = { - get_trash_desc, - get_trash_get, - get_trash_got, - get_trash_free, -}; - - -/** - * mail_vtrash_create: Create a vTrash folder - * @store_uri: URL of the CamelStore - * @name: name to give the vTrash folder - * - * Async function to lookup the CamelStore corresponding to @store_uri - * and then calls mail_vtrash_add() to create the vTrash folder/URL on - * the EvolutionStorage. - **/ -int -mail_vtrash_create (const char *store_uri, const char *name) -{ - struct _get_trash_msg *m; - int id; - - m = mail_msg_new (&get_trash_op, NULL, sizeof (*m)); - m->store_uri = g_strdup (store_uri); - m->name = g_strdup (name); - - id = m->msg.seq; - e_thread_put (mail_thread_new, (EMsg *)m); - - return id; -} diff --git a/mail/mail-vtrash.h b/mail/mail-vtrash.h deleted file mode 100644 index 1aac0c1e9f..0000000000 --- a/mail/mail-vtrash.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -#ifndef MAIL_VTRASH_H -#define MAIL_VTRASH_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -void mail_vtrash_add (CamelStore *store, const char *store_uri, const char *name); - -int mail_vtrash_create (const char *store_uri, const char *name); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* MAIL_VTRASH_H */ diff --git a/mail/mail.h b/mail/mail.h deleted file mode 100644 index ed90d4024e..0000000000 --- a/mail/mail.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright 2000, Helix Code, Inc. (http://www.helixcode.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - */ - -/* This file is a F*CKING MESS. Shame to us! */ - -#include -#include -#include "camel/camel.h" -#include "composer/e-msg-composer.h" -#include "mail-accounts.h" -#include "mail-account-editor.h" -#include "mail-callbacks.h" -#include "mail-config.h" -#include "mail-config-druid.h" -/*#include "folder-browser.h"*/ -#include "mail-session.h" -#include "mail-types.h" -#include "shell/evolution-storage.h" - -extern char *evolution_dir; - -/* mail-format */ -void mail_format_mime_message (CamelMimeMessage *mime_message, - MailDisplay *md); -void mail_format_raw_message (CamelMimeMessage *mime_message, - MailDisplay *md); -gboolean mail_content_loaded (CamelDataWrapper *wrapper, MailDisplay *display); - -typedef gboolean (*MailMimeHandlerFn) (CamelMimePart *part, - const char *mime_type, - MailDisplay *md); -typedef struct { - gboolean generic; - OAF_ServerInfo *component; - GnomeVFSMimeApplication *application; - MailMimeHandlerFn builtin; -} MailMimeHandler; -MailMimeHandler *mail_lookup_handler (const char *mime_type); - -gboolean mail_part_is_inline (CamelMimePart *part); - -char *mail_get_message_body (CamelDataWrapper *data, gboolean want_plain, - gboolean *is_html); - -/* mail-identify */ -char *mail_identify_mime_part (CamelMimePart *part, MailDisplay *md); - -/* mail view */ -GtkWidget *mail_view_create (CamelFolder *source, const char *uid, CamelMimeMessage *msg); - -/* component factory for lack of a better place */ -/*takes a GSList of MailConfigServices */ -void mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources, gboolean is_account_data); - -void mail_hash_storage (CamelService *store, EvolutionStorage *storage); -EvolutionStorage *mail_lookup_storage (CamelStore *store); diff --git a/mail/main.c b/mail/main.c deleted file mode 100644 index 5900ee5625..0000000000 --- a/mail/main.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * main.c: The core of the mail component - * - * Author: - * Miguel de Icaza (miguel@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ - -#include - -#include - -#include -#include -#include -#include -#include -#include - -#ifdef GTKHTML_HAVE_GCONF -#include -#endif - -#include -#include -#include - -#include "component-factory.h" -#include "composer/evolution-composer.h" -#include "mail.h" -#include "mail-mt.h" -#include "mail-vtrash.h" - -/*#define DO_MCHECK*/ - -#ifdef DO_MCHECK -static int blowup(int status) -{ - switch(status) { - case 1: - printf("Double free failure\n"); - break; - case 2: - printf("Memory clobbered before block\n"); - break; - case 3: - printf("Memory clobbered after block\n"); - break; - } - abort(); - return status; -} -#endif - -/* The GNOME SEGV handler will lose if it's not run from the main Gtk - * thread. So if we crash in another thread, redirect the signal. - */ -static void (*gnome_segv_handler) (int); - -static void -segv_redirect (int sig) -{ - if (pthread_self () == mail_gui_thread) - gnome_segv_handler (sig); - else { - pthread_kill (mail_gui_thread, sig); - pthread_exit (NULL); - } -} - -int -main (int argc, char *argv []) -{ - CORBA_ORB orb; - struct sigaction sa, osa; - -#ifdef DO_MCHECK - /* used to make elfence work */ -#if 0 - free (malloc (10)); -#else - /*mtrace();*/ - mcheck(blowup); -#endif -#endif - bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR); - textdomain (PACKAGE); - - g_thread_init( NULL ); - - gnome_init_with_popt_table ("evolution-mail-component", VERSION, - argc, argv, oaf_popt_options, 0, NULL); - - sa.sa_flags = 0; - sigemptyset (&sa.sa_mask); - sa.sa_handler = segv_redirect; - sigaction (SIGSEGV, &sa, &osa); - sigaction (SIGBUS, &sa, NULL); - sigaction (SIGFPE, &sa, NULL); - gnome_segv_handler = osa.sa_handler; - - orb = oaf_init (argc, argv); - - if (bonobo_init (orb, CORBA_OBJECT_NIL, - CORBA_OBJECT_NIL) == FALSE) { - g_error ("Mail component could not initialize Bonobo.\n" - "If there was a warning message about the " - "RootPOA, it probably means\nyou compiled " - "Bonobo against GOAD instead of OAF."); - } - -#ifdef GTKHTML_HAVE_GCONF - gconf_init (argc, argv, NULL); -#endif - - glade_gnome_init (); - - gnome_vfs_init (); - - e_cursors_init (); - - mail_msg_init(); - - component_factory_init (); - evolution_composer_factory_init (composer_send_cb, - composer_postpone_cb); - - if (gdk_threads_mutex) { - g_mutex_free (gdk_threads_mutex); - gdk_threads_mutex = NULL; - } - - GDK_THREADS_ENTER (); - bonobo_main (); - GDK_THREADS_LEAVE (); - - mail_config_write_on_exit (); - - return 0; -} diff --git a/mail/message-list.c b/mail/message-list.c deleted file mode 100644 index c1e180a8bf..0000000000 --- a/mail/message-list.c +++ /dev/null @@ -1,2705 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * message-list.c: Displays the messages. - * Implements CORBA's Evolution::MessageList - * - * Author: - * Miguel de Icaza (miguel@helixcode.com) - * Bertrand Guiheneuf (bg@aful.org) - * And just about everyone else in evolution ... - * - * (C) 2000 Helix Code, Inc. - */ - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "mail-config.h" -#include "message-list.h" -#include "mail-mt.h" -#include "mail-tools.h" -#include "mail-ops.h" -#include "Mail.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "art/mail-new.xpm" -#include "art/mail-read.xpm" -#include "art/mail-replied.xpm" -#include "art/attachment.xpm" -#include "art/priority-high.xpm" -#include "art/empty.xpm" -#include "art/score-lowest.xpm" -#include "art/score-lower.xpm" -#include "art/score-low.xpm" -#include "art/score-normal.xpm" -#include "art/score-high.xpm" -#include "art/score-higher.xpm" -#include "art/score-highest.xpm" - -/*#define TIMEIT */ - -#ifdef TIMEIT -#include -#include -#endif - -#define d(x) -#define t(x) - -/* - * Default sizes for the ETable display - * - */ -#define N_CHARS(x) (CHAR_WIDTH * (x)) - -#define COL_ICON_WIDTH (16) -#define COL_ATTACH_WIDTH (16) -#define COL_CHECK_BOX_WIDTH (16) -#define COL_FROM_EXPANSION (24.0) -#define COL_FROM_WIDTH_MIN (32) -#define COL_SUBJECT_EXPANSION (30.0) -#define COL_SUBJECT_WIDTH_MIN (32) -#define COL_SENT_EXPANSION (24.0) -#define COL_SENT_WIDTH_MIN (32) -#define COL_RECEIVED_EXPANSION (20.0) -#define COL_RECEIVED_WIDTH_MIN (32) -#define COL_TO_EXPANSION (24.0) -#define COL_TO_WIDTH_MIN (32) -#define COL_SIZE_EXPANSION (6.0) -#define COL_SIZE_WIDTH_MIN (32) - -#define PARENT_TYPE (e_table_scrolled_get_type ()) - -#ifdef SMART_ADDRESS_COMPARE -struct _EMailAddress { - ENameWestern *wname; - gchar *address; -}; - -typedef struct _EMailAddress EMailAddress; -#endif /* SMART_ADDRESS_COMPARE */ - -static ETableScrolledClass *message_list_parent_class; - -static void on_cursor_activated_cmd (ETableScrolled *table, int row, gpointer user_data); -static gint on_click (ETableScrolled *table, gint row, gint col, GdkEvent *event, MessageList *list); -static char *filter_date (time_t date); -static char *filter_size (int size); - -static void save_tree_state(MessageList *ml); - -static void folder_changed (CamelObject *o, gpointer event_data, gpointer user_data); -static void message_changed (CamelObject *o, gpointer event_data, gpointer user_data); - -static void hide_save_state(MessageList *ml); -static void hide_load_state(MessageList *ml); - -/* note: @changes is owned/freed by the caller */ -/*static void mail_do_regenerate_messagelist (MessageList *list, const char *search, const char *hideexpr, CamelFolderChangeInfo *changes);*/ -static void mail_regen_list(MessageList *ml, const char *search, const char *hideexpr, CamelFolderChangeInfo *changes); - -/* macros for working with id's (stored in the tree nodes) */ -#define id_is_uid(id) (id[0] == 'u')/* is this a uid id? */ -#define id_is_subject(id) (id[0] == 's') /* is this a subject id? */ -#define id_uid(id) (&id[1]) /* get the uid part of the id */ -#define id_subject(id) (&id[1]) /* get the subject part of the id */ - -enum { - MESSAGE_SELECTED, - LAST_SIGNAL -}; - -static guint message_list_signals [LAST_SIGNAL] = {0, }; - -static struct { - char **image_base; - GdkPixbuf *pixbuf; -} states_pixmaps [] = { - { mail_new_xpm, NULL }, - { mail_read_xpm, NULL }, - { mail_replied_xpm, NULL }, -/* FIXME: Replace these with pixmaps for multiple_read and multiple_unread */ - { mail_new_xpm, NULL }, - { mail_read_xpm, NULL }, - { empty_xpm, NULL }, - { attachment_xpm, NULL }, - { priority_high_xpm, NULL }, - { score_lowest_xpm, NULL }, - { score_lower_xpm, NULL }, - { score_low_xpm, NULL }, - { score_normal_xpm, NULL }, - { score_high_xpm, NULL }, - { score_higher_xpm, NULL }, - { score_highest_xpm, NULL }, - { NULL, NULL } -}; - -enum DndTargetTyhpe { - DND_TARGET_LIST_TYPE_URI, -}; -#define URI_LIST_TYPE "text/uri-list" -static GtkTargetEntry drag_types[] = { - { URI_LIST_TYPE, 0, DND_TARGET_LIST_TYPE_URI }, -}; -static const int num_drag_types = sizeof (drag_types) / sizeof (drag_types[0]); - -#ifdef SMART_ADDRESS_SORT -static EMailAddress * -e_mail_address_new (const char *address) -{ - CamelInternetAddress *cia; - EMailAddress *new; - const char *name = NULL, *addr = NULL; - - cia = camel_internet_address_new (); - if (camel_address_unformat (CAMEL_ADDRESS (cia), address) == -1) { - camel_object_unref (CAMEL_OBJECT (cia)); - return NULL; - } - camel_internet_address_get (cia, 0, &name, &addr); - - new = g_new (EMailAddress, 1); - new->address = g_strdup (addr); - if (name && *name) { - new->wname = e_name_western_parse (name); - } else { - new->wname = NULL; - } - - camel_object_unref (CAMEL_OBJECT (cia)); - - return new; -} - -static void -e_mail_address_free (EMailAddress *addr) -{ - g_return_if_fail (addr != NULL); - - g_free (addr->address); - if (addr->wname) - e_name_western_free (addr->wname); - g_free (addr); -} - -static gint -e_mail_address_compare (gconstpointer address1, gconstpointer address2) -{ - const EMailAddress *addr1 = address1; - const EMailAddress *addr2 = address2; - gint retval; - - g_return_val_if_fail (addr1 != NULL, 1); - g_return_val_if_fail (addr2 != NULL, -1); - - if (!addr1->wname || !addr2->wname) { - /* have to compare addresses, one or both don't have names */ - g_return_val_if_fail (addr1->address != NULL, 1); - g_return_val_if_fail (addr2->address != NULL, -1); - - retval = g_strcasecmp (addr1->address, addr2->address); - } else { - if (!addr1->wname->last && !addr2->wname->last) { - /* neither has a last name - default to address? */ - /* FIXME: what do we compare next? */ - g_return_val_if_fail (addr1->address != NULL, 1); - g_return_val_if_fail (addr2->address != NULL, -1); - - retval = g_strcasecmp (addr1->address, addr2->address); - } else { - /* compare last names */ - if (!addr1->wname->last) - retval = -1; - else if (!addr2->wname->last) - retval = 1; - else { - retval = g_strcasecmp (addr1->wname->last, addr2->wname->last); - if (!retval) { - /* last names are identical - compare first names */ - if (!addr1->wname->first) - retval = -1; - else if (!addr2->wname->first) - retval = 1; - else { - retval = g_strcasecmp (addr1->wname->first, addr2->wname->first); - if (!retval) { - /* first names are identical - compare addresses */ - g_return_val_if_fail (addr1->address != NULL, 1); - g_return_val_if_fail (addr2->address != NULL, -1); - - retval = g_strcasecmp (addr1->address, addr2->address); - } - } - } - } - } - } - - return retval; -} -#endif /* SMART_ADDRESS_COMPARE */ - -static gint -address_compare (gconstpointer address1, gconstpointer address2) -{ -#ifdef SMART_ADDRESS_COMPARE - EMailAddress *addr1, *addr2; -#endif /* SMART_ADDRESS_COMPARE */ - gint retval; - - g_return_val_if_fail (address1 != NULL, 1); - g_return_val_if_fail (address2 != NULL, -1); - -#ifdef SMART_ADDRESS_COMPARE - addr1 = e_mail_address_new (address1); - addr2 = e_mail_address_new (address2); - retval = e_mail_address_compare (addr1, addr2); - e_mail_address_free (addr1); - e_mail_address_free (addr2); -#else - retval = g_strcasecmp ((const char *) address1, (const char *) address2); -#endif /* SMART_ADDRESS_COMPARE */ - - return retval; -} - -static gint -subject_compare (gconstpointer subject1, gconstpointer subject2) -{ - char *sub1; - char *sub2; - - g_return_val_if_fail (subject1 != NULL, 1); - g_return_val_if_fail (subject2 != NULL, -1); - - /* trim off any "Re:"'s at the beginning of subject1 */ - sub1 = (char *) subject1; - while (!g_strncasecmp (sub1, "Re:", 3)) { - sub1 += 3; - /* jump over any spaces */ - for ( ; *sub1 && isspace (*sub1); sub1++); - } - - /* trim off any "Re:"'s at the beginning of subject2 */ - sub2 = (char *) subject2; - while (!g_strncasecmp (sub2, "Re:", 3)) { - sub2 += 3; - /* jump over any spaces */ - for ( ; *sub2 && isspace (*sub2); sub2++); - } - - /* jump over any spaces */ - for ( ; *sub1 && isspace (*sub1); sub1++); - for ( ; *sub2 && isspace (*sub2); sub2++); - - return g_strcasecmp (sub1, sub2); -} - -static gchar * -filter_size (gint size) -{ - gfloat fsize; - - if (size < 1024) { - return g_strdup_printf ("%d", size); - } else { - fsize = ((gfloat) size) / 1024.0; - if (fsize < 1024.0) { - return g_strdup_printf ("%.2f K", fsize); - } else { - fsize /= 1024.0; - return g_strdup_printf ("%.2f M", fsize); - } - } -} - -/* Gets the uid of the message displayed at a given view row */ -static const char * -get_message_uid (MessageList *message_list, int row) -{ - ETreeModel *model = (ETreeModel *)message_list->table_model; - ETreePath *node; - const char *uid; - - if (row >= e_table_model_row_count (message_list->table_model)) - return NULL; - - node = e_tree_model_node_at_row (model, row); - g_return_val_if_fail (node != NULL, NULL); - uid = e_tree_model_node_get_data (model, node); - - if (!id_is_uid(uid)) - return NULL; - - return id_uid(uid); -} - -/* Gets the CamelMessageInfo for the message displayed at the given - * view row. - */ -static CamelMessageInfo * -get_message_info (MessageList *message_list, int row) -{ - const char *uid; - - uid = get_message_uid(message_list, row); - if (uid) - return camel_folder_get_message_info(message_list->folder, uid); - - return NULL; -} - -/** - * message_list_select: - * @message_list: a MessageList - * @base_row: the (model) row to start from - * @direction: the direction to search in - * @flags: a set of flag values - * @mask: a mask for comparing against @flags - * - * This moves the message list selection to a suitable row. @base_row - * lists the first (model) row to try, but as a special case, model - * row -1 is mapped to the last row. @flags and @mask combine to specify - * what constitutes a suitable row. @direction is - * %MESSAGE_LIST_SELECT_NEXT if it should find the next matching - * message, or %MESSAGE_LIST_SELECT_PREVIOUS if it should find the - * previous. If no suitable row is found, the selection will be - * unchanged but the message display will be cleared. - **/ -void -message_list_select (MessageList *message_list, int base_row, - MessageListSelectDirection direction, - guint32 flags, guint32 mask) -{ - CamelMessageInfo *info; - int vrow, mrow, last; - ETable *et = message_list->table; - - switch (direction) { - case MESSAGE_LIST_SELECT_PREVIOUS: - last = -1; - break; - case MESSAGE_LIST_SELECT_NEXT: - last = e_table_model_row_count (message_list->table_model); - break; - default: - g_warning("Invalid argument to message_list_select"); - return; - } - - if (base_row == -1) - base_row = e_table_model_row_count(message_list->table_model) - 1; - - /* model_to_view_row etc simply dont work for sorted views. Sigh. */ - vrow = e_table_model_to_view_row (et, base_row); - - /* This means that we'll move at least one message in 'direction'. */ - if (vrow != last) - vrow += direction; - - /* We don't know whether to use < or > due to "direction" */ - while (vrow != last) { - mrow = e_table_view_to_model_row (et, vrow); - info = get_message_info (message_list, mrow); - if (info && (info->flags & mask) == flags) { - e_table_set_cursor_row (et, mrow); - gtk_signal_emit(GTK_OBJECT (message_list), message_list_signals [MESSAGE_SELECTED], camel_message_info_uid(info)); - camel_folder_free_message_info(message_list->folder, info); - return; - } - camel_folder_free_message_info(message_list->folder, info); - vrow += direction; - } - - gtk_signal_emit(GTK_OBJECT (message_list), message_list_signals [MESSAGE_SELECTED], NULL); -} - -static void -add_uid (MessageList *ml, const char *uid, gpointer data) -{ - g_ptr_array_add ((GPtrArray *) data, g_strdup (uid)); -} - -static void -message_list_drag_data_get (ETable *table, - int row, - int col, - GdkDragContext *context, - GtkSelectionData *selection_data, - guint info, - guint time, - gpointer user_data) -{ - MessageList *mlist = (MessageList *) user_data; - CamelMessageInfo *minfo; - GPtrArray *uids = NULL; - char *tmpl, *tmpdir, *filename, *subject; - - switch (info) { - case DND_TARGET_LIST_TYPE_URI: - /* drag & drop into nautilus */ - tmpl = g_strdup ("/tmp/evolution.XXXXXX"); -#ifdef HAVE_MKDTEMP - tmpdir = mkdtemp (tmpl); -#else - tmpdir = mktemp (tmpl); - if (tmpdir) { - if (mkdir (tmpdir, S_IRWXU) == -1) - tmpdir = NULL; - } -#endif - if (!tmpdir) { - g_free (tmpl); - return; - } - - minfo = get_message_info (mlist, row); - if (minfo == NULL) { - g_warning("Row %d is invalid", row); - g_free(tmpl); - return; - } - subject = g_strdup (camel_message_info_subject (minfo)); - camel_folder_free_message_info(mlist->folder, minfo); - e_filename_make_safe (subject); - filename = g_strdup_printf ("%s/%s.eml", tmpdir, subject); - g_free (subject); - - uids = g_ptr_array_new (); - message_list_foreach (mlist, add_uid, uids); - - mail_msg_wait(mail_save_messages(mlist->folder, uids, filename, NULL, NULL)); - - gtk_selection_data_set (selection_data, selection_data->target, 8, - (guchar *) filename, strlen (filename)); - - g_free (tmpl); - g_free (filename); - break; - default: - break; - } -} - -/* - * SimpleTableModel::col_count - */ -static int -ml_col_count (ETableModel *etm, void *data) -{ - return COL_LAST; -} - -static void * -ml_duplicate_value (ETableModel *etm, int col, const void *value, void *data) -{ - switch (col){ - case COL_MESSAGE_STATUS: - case COL_FLAGGED: - case COL_SCORE: - case COL_ATTACHMENT: - case COL_DELETED: - case COL_UNREAD: - case COL_SENT: - case COL_RECEIVED: - case COL_SIZE: - return (void *) value; - - case COL_FROM: - case COL_SUBJECT: - case COL_TO: - return g_strdup (value); - default: - g_assert_not_reached (); - } - return NULL; -} - -static void -ml_free_value (ETableModel *etm, int col, void *value, void *data) -{ - switch (col){ - case COL_MESSAGE_STATUS: - case COL_FLAGGED: - case COL_SCORE: - case COL_ATTACHMENT: - case COL_DELETED: - case COL_UNREAD: - case COL_SENT: - case COL_RECEIVED: - case COL_SIZE: - break; - - case COL_FROM: - case COL_SUBJECT: - case COL_TO: - g_free (value); - break; - default: - g_assert_not_reached (); - } -} - -static void * -ml_initialize_value (ETableModel *etm, int col, void *data) -{ - switch (col){ - case COL_MESSAGE_STATUS: - case COL_FLAGGED: - case COL_SCORE: - case COL_ATTACHMENT: - case COL_DELETED: - case COL_UNREAD: - case COL_SENT: - case COL_RECEIVED: - case COL_SIZE: - return NULL; - - case COL_FROM: - case COL_SUBJECT: - case COL_TO: - return g_strdup(""); - default: - g_assert_not_reached (); - } - - return NULL; -} - -static gboolean -ml_value_is_empty (ETableModel *etm, int col, const void *value, void *data) -{ - switch (col){ - case COL_MESSAGE_STATUS: - case COL_FLAGGED: - case COL_SCORE: - case COL_ATTACHMENT: - case COL_DELETED: - case COL_UNREAD: - case COL_SENT: - case COL_RECEIVED: - case COL_SIZE: - return value == NULL; - - case COL_FROM: - case COL_SUBJECT: - case COL_TO: - return !(value && *(char *)value); - default: - g_assert_not_reached (); - return FALSE; - } -} - -static char * -ml_value_to_string (ETableModel *etm, int col, const void *value, void *data) -{ - switch (col){ - case COL_MESSAGE_STATUS: - switch ((int) value) { - case 0: - return g_strdup (_("Unseen")); - break; - case 1: - return g_strdup (_("Seen")); - break; - case 2: - return g_strdup (_("Answered")); - break; - case 3: - return g_strdup (_("Multiple Unseen Messages")); - break; - case 4: - return g_strdup (_("Multiple Messages")); - break; - default: - return g_strdup (""); - break; - } - break; - - case COL_SCORE: - switch ((int) value) { - case -3: - return g_strdup ("Lowest"); - break; - case -2: - return g_strdup ("Lower"); - break; - case -1: - return g_strdup ("Low"); - break; - case 1: - return g_strdup ("High"); - break; - case 2: - return g_strdup ("Higher"); - break; - case 3: - return g_strdup ("Highest"); - break; - default: - return g_strdup ("Normal"); - break; - } - break; - - case COL_ATTACHMENT: - case COL_FLAGGED: - case COL_DELETED: - case COL_UNREAD: - return g_strdup_printf("%d", (int) value); - - case COL_SENT: - case COL_RECEIVED: - return filter_date (GPOINTER_TO_INT(value)); - - case COL_SIZE: - return filter_size (GPOINTER_TO_INT(value)); - - case COL_FROM: - case COL_SUBJECT: - case COL_TO: - return g_strdup (value); - default: - g_assert_not_reached (); - return NULL; - } -} - -static GdkPixbuf * -ml_tree_icon_at (ETreeModel *etm, ETreePath *path, void *model_data) -{ - /* we dont really need an icon ... */ - return NULL; -} - -/* return true if there are any unread messages in the subtree */ -static int -subtree_unread(MessageList *ml, ETreePath *node) -{ - CamelMessageInfo *info; - char *uid; - - while (node) { - ETreePath *child; - uid = e_tree_model_node_get_data((ETreeModel *)ml->table_model, node); - if (uid == NULL) { - g_warning("I got a NULL uid at node %p", node); - } else if (id_is_uid(uid) - && (info = camel_folder_get_message_info(ml->folder, id_uid(uid)))) { - if (!(info->flags & CAMEL_MESSAGE_SEEN)) { - camel_folder_free_message_info(ml->folder, info); - return TRUE; - } - camel_folder_free_message_info(ml->folder, info); - } - if ((child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->table_model), node))) - if (subtree_unread(ml, child)) - return TRUE; - node = e_tree_model_node_get_next (E_TREE_MODEL (ml->table_model), node); - } - return FALSE; -} - -static int -subtree_size(MessageList *ml, ETreePath *node) -{ - CamelMessageInfo *info; - char *uid; - int size = 0; - - while (node) { - ETreePath *child; - uid = e_tree_model_node_get_data((ETreeModel *)ml->table_model, node); - if (uid == NULL) { - g_warning("I got a NULL uid at node %p", node); - } else if (id_is_uid(uid) - && (info = camel_folder_get_message_info(ml->folder, id_uid(uid)))) { - size += info->size; - camel_folder_free_message_info(ml->folder, info); - } - if ((child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->table_model), node))) - size += subtree_size(ml, child); - - node = e_tree_model_node_get_next (E_TREE_MODEL (ml->table_model), node); - } - return size; -} - -static time_t -subtree_earliest(MessageList *ml, ETreePath *node, int sent) -{ - CamelMessageInfo *info; - char *uid; - time_t earliest = 0, date; - - while (node) { - ETreePath *child; - uid = e_tree_model_node_get_data((ETreeModel *)ml->table_model, node); - if (uid == NULL) { - g_warning("I got a NULL uid at node %p", node); - } else if (id_is_uid(uid) - && (info = camel_folder_get_message_info(ml->folder, id_uid(uid)))) { - if (sent) - date = info->date_sent; - else - date = info->date_received; - if (earliest == 0 || date < earliest) - earliest = date; - camel_folder_free_message_info(ml->folder, info); - } - if ((child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->table_model), node))) { - date = subtree_earliest(ml, child, sent); - if (earliest == 0 || (date != 0 && date < earliest)) - earliest = date; - } - - node = e_tree_model_node_get_next (E_TREE_MODEL (ml->table_model), node); - } - - return earliest; -} - -static void * -ml_tree_value_at (ETreeModel *etm, ETreePath *path, int col, void *model_data) -{ - MessageList *message_list = model_data; - char *uid; - static char *saved; - CamelMessageInfo *msg_info; - void *value; - - /* simlated(tm) static dynamic memory (sigh) */ - if (saved) { - g_free(saved); - saved = 0; - } - - /* retrieve the message information array */ - uid = e_tree_model_node_get_data (etm, path); - if (uid == NULL) { - uid="s ERROR ERROR - UNKNOWN ROW IN TREE"; - goto fake; - } - if (!id_is_uid(uid)) { - g_warning("Invalid node encountered: %s", uid); - goto fake; - } - uid = id_uid(uid); - - msg_info = camel_folder_get_message_info (message_list->folder, uid); - if (msg_info == NULL) { - g_warning("Invalid node encountered: %s", uid); - goto fake; - } - - switch (col){ - case COL_MESSAGE_STATUS: { - ETreePath *child; - - /* if a tree is collapsed, then scan its insides for details */ - child = e_tree_model_node_get_first_child(etm, path); - if (child && !e_tree_model_node_is_expanded(etm, path)) { - if (subtree_unread(message_list, child)) - return (void *)3; - else - return (void *)4; - } - - if (msg_info->flags & CAMEL_MESSAGE_ANSWERED) - value = GINT_TO_POINTER (2); - else if (msg_info->flags & CAMEL_MESSAGE_SEEN) - value = GINT_TO_POINTER (1); - else - value = GINT_TO_POINTER (0); - break; - } - - case COL_FLAGGED: - value = GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_FLAGGED) != 0); - break; - - case COL_SCORE: - { - const char *tag; - int score = 0; - - tag = camel_tag_get ((CamelTag **) &msg_info->user_tags, "score"); - if (tag) - score = atoi (tag); - - value = GINT_TO_POINTER (score); - break; - } - - case COL_ATTACHMENT: - value = GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_ATTACHMENTS) != 0); - break; - - case COL_FROM: - saved = g_strdup (camel_message_info_from(msg_info)); - value = saved; - break; - - case COL_SUBJECT: - saved = g_strdup (camel_message_info_subject(msg_info)); - value = saved; - break; - - case COL_SENT: - value = GINT_TO_POINTER (msg_info->date_sent); - break; - - case COL_RECEIVED: - value = GINT_TO_POINTER (msg_info->date_received); - break; - - case COL_TO: - saved = g_strdup (camel_message_info_to(msg_info)); - value = saved; - break; - - case COL_SIZE: - value = GINT_TO_POINTER (msg_info->size); - break; - - case COL_DELETED: - value = GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_DELETED) != 0); - break; - - case COL_UNREAD: { - ETreePath *child; - - child = e_tree_model_node_get_first_child(etm, path); - if (child && !e_tree_model_node_is_expanded(etm, path) - && (msg_info->flags & CAMEL_MESSAGE_SEEN)) { - return (void *)subtree_unread(message_list, child); - } - - value = GINT_TO_POINTER (!(msg_info->flags & CAMEL_MESSAGE_SEEN)); - break; - } - case COL_COLOUR: - { - const char *colour; - - colour = camel_tag_get ((CamelTag **) &msg_info->user_tags, - "colour"); - if (colour) { - saved = g_strdup (colour); - value = saved; - } else if (msg_info->flags & CAMEL_MESSAGE_FLAGGED) - /* FIXME: extract from the xpm somehow. */ - value = "#A7453E"; - else - value = NULL; - break; - } - } - - camel_folder_free_message_info(message_list->folder, msg_info); - return value; - - g_assert_not_reached (); - - fake: - /* This is a fake tree parent */ - switch (col){ - case COL_UNREAD: - /* this value should probably be cached, as it could take a bit - of processing to evaluate all the time */ - return (void *)subtree_unread(message_list, e_tree_model_node_get_first_child(etm, path)); - - case COL_MESSAGE_STATUS: - /* The same applies as for COL_UNREAD just above */ - if (subtree_unread(message_list, e_tree_model_node_get_first_child(etm,path))) - return (void *)3; - else - return (void *)4; - - case COL_FLAGGED: - case COL_SCORE: - case COL_ATTACHMENT: - case COL_DELETED: - case COL_COLOUR: - return (void *) 0; - - case COL_SENT: - return (void *)subtree_earliest(message_list, e_tree_model_node_get_first_child(etm, path), TRUE); - - case COL_RECEIVED: - return (void *)subtree_earliest(message_list, e_tree_model_node_get_first_child(etm, path), FALSE); - - case COL_SUBJECT: - saved = g_strdup_printf(_("[ %s ]"), id_subject(uid)); - return saved; - - case COL_FROM: { - ETreePath *child; - - /* the first child should always exist/etc */ - if ( (child = e_tree_model_node_get_first_child(etm, path)) - && (uid = e_tree_model_node_get_data (etm, child)) - && id_is_uid(uid) - && (msg_info = camel_folder_get_message_info (message_list->folder, id_uid(uid))) ) { - /* well, we could scan more children, build up a (more accurate) list, but this should do ok */ - saved = g_strdup_printf(_("%s, et al."), camel_message_info_from(msg_info)); - camel_folder_free_message_info(message_list->folder, msg_info); - } else { - return _(""); - } - return saved; - } - case COL_TO: { - ETreePath *child; - - /* the first child should always exist/etc */ - if ( (child = e_tree_model_node_get_first_child(etm, path)) - && (uid = e_tree_model_node_get_data (etm, child)) - && id_is_uid(uid) - && (msg_info = camel_folder_get_message_info (message_list->folder, id_uid(uid))) ) { - /* well, we could scan more children, build up a (more accurate) list, but this should do ok */ - saved = g_strdup_printf(_("%s, et al."), camel_message_info_to(msg_info)); - camel_folder_free_message_info(message_list->folder, msg_info); - } else { - return _(""); - } - return saved; - } - case COL_SIZE: - return GINT_TO_POINTER (subtree_size(message_list, e_tree_model_node_get_first_child(etm, path))); - } - g_assert_not_reached (); - - return NULL; -} - -static void -ml_tree_set_value_at (ETreeModel *etm, ETreePath *path, int col, - const void *val, void *model_data) -{ - g_assert_not_reached (); -} - -static gboolean -ml_tree_is_cell_editable (ETreeModel *etm, ETreePath *path, int col, void *model_data) -{ - return FALSE; -} - -static void -message_list_init_images (void) -{ - int i; - - /* - * Only load once, and share - */ - if (states_pixmaps [0].pixbuf) - return; - - for (i = 0; states_pixmaps [i].image_base; i++){ - states_pixmaps [i].pixbuf = gdk_pixbuf_new_from_xpm_data ( - (const char **) states_pixmaps [i].image_base); - } -} - -static char * -filter_date (time_t date) -{ - time_t nowdate = time(NULL); - time_t yesdate; - struct tm then, now, yesterday; - char buf[26]; - gboolean done = FALSE; - - if (date == 0) - return g_strdup (_("?")); - - localtime_r (&date, &then); - localtime_r (&nowdate, &now); - if (then.tm_mday == now.tm_mday && - then.tm_mon == now.tm_mon && - then.tm_year == now.tm_year) { - strftime (buf, 26, _("Today %l:%M %p"), &then); - done = TRUE; - } - if (!done) { - yesdate = nowdate - 60 * 60 * 24; - localtime_r (&yesdate, &yesterday); - if (then.tm_mday == yesterday.tm_mday && - then.tm_mon == yesterday.tm_mon && - then.tm_year == yesterday.tm_year) { - strftime (buf, 26, _("Yesterday %l:%M %p"), &then); - done = TRUE; - } - } - if (!done) { - int i; - for (i = 2; i < 7; i++) { - yesdate = nowdate - 60 * 60 * 24 * i; - localtime_r (&yesdate, &yesterday); - if (then.tm_mday == yesterday.tm_mday && - then.tm_mon == yesterday.tm_mon && - then.tm_year == yesterday.tm_year) { - strftime (buf, 26, _("%a %l:%M %p"), &then); - done = TRUE; - break; - } - } - } - if (!done) { - if (then.tm_year == now.tm_year) { - strftime (buf, 26, _("%b %d %l:%M %p"), &then); - } else { - strftime (buf, 26, _("%b %d %Y"), &then); - } - } -#if 0 -#ifdef CTIME_R_THREE_ARGS - ctime_r (&date, buf, 26); -#else - ctime_r (&date, buf); -#endif -#endif - - return g_strdup (buf); -} - -static ETableExtras * -message_list_create_extras (void) -{ - int i; - GdkPixbuf *images [7]; - ETableExtras *extras; - ECell *cell; - - extras = e_table_extras_new(); - e_table_extras_add_pixbuf(extras, "status", states_pixmaps [0].pixbuf); - e_table_extras_add_pixbuf(extras, "score", states_pixmaps [13].pixbuf); - e_table_extras_add_pixbuf(extras, "attachment", states_pixmaps [6].pixbuf); - e_table_extras_add_pixbuf(extras, "flagged", states_pixmaps [7].pixbuf); - - e_table_extras_add_compare(extras, "address_compare", address_compare); - e_table_extras_add_compare(extras, "subject_compare", subject_compare); - - for (i = 0; i < 5; i++) - images [i] = states_pixmaps [i].pixbuf; - - e_table_extras_add_cell(extras, "render_message_status", e_cell_toggle_new (0, 5, images)); - - for (i = 0; i < 2; i++) - images [i] = states_pixmaps [i + 5].pixbuf; - - e_table_extras_add_cell(extras, "render_attachment", e_cell_toggle_new (0, 2, images)); - - images [1] = states_pixmaps [7].pixbuf; - e_table_extras_add_cell(extras, "render_flagged", e_cell_toggle_new (0, 2, images)); - - for (i = 0; i < 7; i++) - images[i] = states_pixmaps [i + 7].pixbuf; - - e_table_extras_add_cell(extras, "render_score", e_cell_toggle_new (0, 7, images)); - - /* date cell */ - cell = e_cell_date_new (NULL, GTK_JUSTIFY_LEFT); - gtk_object_set (GTK_OBJECT (cell), - "strikeout_column", COL_DELETED, - "bold_column", COL_UNREAD, - "color_column", COL_COLOUR, - NULL); - e_table_extras_add_cell(extras, "render_date", cell); - - /* text cell */ - cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); - gtk_object_set (GTK_OBJECT (cell), - "strikeout_column", COL_DELETED, - "bold_column", COL_UNREAD, - "color_column", COL_COLOUR, - NULL); - e_table_extras_add_cell(extras, "render_text", cell); - - e_table_extras_add_cell(extras, "render_tree", - e_cell_tree_new (NULL, NULL, /* let the tree renderer default the pixmaps */ - TRUE, cell)); - - /* size cell */ - cell = e_cell_size_new (NULL, GTK_JUSTIFY_RIGHT); - gtk_object_set (GTK_OBJECT (cell), - "strikeout_column", COL_DELETED, - "bold_column", COL_UNREAD, - "color_column", COL_COLOUR, - NULL); - e_table_extras_add_cell(extras, "render_size", cell); - - return extras; -} - -static void -save_header_state(MessageList *ml) -{ - char *filename; - - if (ml->folder == NULL || ml->table == NULL) - return; - - filename = mail_config_folder_to_cachename(ml->folder, "et-header-"); - e_table_save_state(ml->table, filename); - g_free(filename); -} - -#ifdef JUST_FOR_TRANSLATORS -static char *list [] = { - N_("Status"), N_("Flagged"), N_("Score"), N_("Attachment"), - N_("From"), N_("Subject"), N_("Date"), N_("Received"), - N_("To"), N_("Size") -}; -#endif - -char * -message_list_get_layout (MessageList *message_list) -{ - /* Default: Status, Attachments, Priority, From, Subject, Date */ - return g_strdup ("" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - " " - " " - " " - ""); -} - -static void -message_list_setup_etable(MessageList *message_list) -{ - /* build the spec based on the folder, and possibly from a saved file */ - /* otherwise, leave default */ - if (message_list->folder) { - char *path; - char *name; - struct stat st; - - name = camel_service_get_name (CAMEL_SERVICE (message_list->folder->parent_store), TRUE); - printf ("folder name is '%s'\n", name); - path = mail_config_folder_to_cachename (message_list->folder, "et-header-"); - - if (path && stat (path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) { - /* build based on saved file */ - e_table_load_state (message_list->table, path); - } else if (strstr (name, "/Drafts") || strstr (name, "/Outbox") || strstr (name, "/Sent")) { - /* these folders have special defaults */ - char *state = "" - " " - " " - " "; - - e_table_set_state (message_list->table, state); - } - - g_free (path); - g_free (name); - } -} - -/* - * GtkObject::init - */ -static void -message_list_init (GtkObject *object) -{ - MessageList *message_list = MESSAGE_LIST (object); - - e_scroll_frame_set_policy (E_SCROLL_FRAME (message_list), - GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); - - message_list->uid_rowmap = g_hash_table_new (g_str_hash, g_str_equal); - message_list->uid_pool = e_mempool_new(1024, 512, E_MEMPOOL_ALIGN_BYTE); - message_list->hidden = NULL; - message_list->hidden_pool = NULL; - message_list->hide_before = ML_HIDE_NONE_START; - message_list->hide_after = ML_HIDE_NONE_END; - - message_list->hide_lock = g_mutex_new(); -} - -static void -message_list_destroy (GtkObject *object) -{ - MessageList *message_list = MESSAGE_LIST (object); - - if (message_list->folder) { - save_tree_state(message_list); - save_header_state(message_list); - hide_save_state(message_list); - } - - gtk_object_unref (GTK_OBJECT (message_list->table_model)); - - g_hash_table_destroy (message_list->uid_rowmap); - e_mempool_destroy(message_list->uid_pool); - - if (message_list->idle_id != 0) - g_source_remove(message_list->idle_id); - - if (message_list->seen_id) - gtk_timeout_remove (message_list->seen_id); - - if (message_list->folder) { - camel_object_unhook_event((CamelObject *)message_list->folder, "folder_changed", - folder_changed, message_list); - camel_object_unhook_event((CamelObject *)message_list->folder, "message_changed", - message_changed, message_list); - camel_object_unref (CAMEL_OBJECT (message_list->folder)); - } - - if (message_list->hidden) { - g_hash_table_destroy(message_list->hidden); - e_mempool_destroy(message_list->hidden_pool); - message_list->hidden = NULL; - message_list->hidden_pool = NULL; - } - - g_free(message_list->cursor_uid); - - g_mutex_free(message_list->hide_lock); - - GTK_OBJECT_CLASS (message_list_parent_class)->destroy (object); -} - -/* - * GtkObjectClass::init - */ -static void -message_list_class_init (GtkObjectClass *object_class) -{ - message_list_parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = message_list_destroy; - - message_list_signals[MESSAGE_SELECTED] = - gtk_signal_new ("message_selected", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (MessageListClass, message_selected), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, GTK_TYPE_STRING); - - gtk_object_class_add_signals(object_class, message_list_signals, LAST_SIGNAL); - - message_list_init_images (); -} - -static void -message_list_construct (MessageList *message_list) -{ - ETableExtras *extras; - char *spec; - - message_list->table_model = (ETableModel *) - e_tree_simple_new (ml_col_count, - ml_duplicate_value, - ml_free_value, - ml_initialize_value, - ml_value_is_empty, - ml_value_to_string, - ml_tree_icon_at, ml_tree_value_at, - ml_tree_set_value_at, - ml_tree_is_cell_editable, - message_list); - gtk_object_ref (GTK_OBJECT (message_list->table_model)); - gtk_object_sink (GTK_OBJECT (message_list->table_model)); - - e_tree_model_root_node_set_visible ((ETreeModel *)message_list->table_model, FALSE); - - /* - * The etable - */ - spec = message_list_get_layout (message_list); - extras = message_list_create_extras (); - e_table_scrolled_construct (E_TABLE_SCROLLED (message_list), - message_list->table_model, - extras, spec, NULL); - message_list->table = - e_table_scrolled_get_table (E_TABLE_SCROLLED (message_list)); - g_free (spec); - gtk_object_sink (GTK_OBJECT (extras)); - - gtk_signal_connect (GTK_OBJECT (message_list->table), "cursor_activated", - GTK_SIGNAL_FUNC (on_cursor_activated_cmd), - message_list); - - gtk_signal_connect (GTK_OBJECT (message_list->table), "click", - GTK_SIGNAL_FUNC (on_click), message_list); - - /* drag & drop */ - e_table_drag_source_set (message_list->table, GDK_BUTTON1_MASK, - drag_types, num_drag_types, GDK_ACTION_MOVE); - - gtk_signal_connect (GTK_OBJECT (message_list->table), "drag_data_get", - GTK_SIGNAL_FUNC (message_list_drag_data_get), - message_list); -} - -GtkWidget * -message_list_new (void) -{ - MessageList *message_list; - - message_list = MESSAGE_LIST (gtk_widget_new (message_list_get_type (), - "hadjustment", NULL, - "vadjustment", NULL, - NULL)); - message_list_construct (message_list); - - return GTK_WIDGET (message_list); -} - -static void -clear_tree (MessageList *ml) -{ - ETreeModel *etm = E_TREE_MODEL (ml->table_model); - -#ifdef TIMEIT - struct timeval start, end; - unsigned long diff; - - printf("Clearing tree\n"); - gettimeofday(&start, NULL); -#endif - - /* we also reset the uid_rowmap since it is no longer useful/valid anyway */ - g_hash_table_destroy (ml->uid_rowmap); - ml->uid_rowmap = g_hash_table_new(g_str_hash, g_str_equal); - e_mempool_flush(ml->uid_pool, TRUE); - - if (ml->tree_root) { - /* we should be frozen already */ - e_tree_model_node_remove (etm, ml->tree_root); - } - - ml->tree_root = e_tree_model_node_insert (etm, NULL, 0, NULL); - e_tree_model_node_set_expanded (etm, ml->tree_root, TRUE); - -#ifdef TIMEIT - gettimeofday(&end, NULL); - diff = end.tv_sec * 1000 + end.tv_usec/1000; - diff -= start.tv_sec * 1000 + start.tv_usec/1000; - printf("Clearing tree took %ld.%03ld seconds\n", diff / 1000, diff % 1000); -#endif - -} - -/* we save the node id to the file if the node should be closed when - we start up. We only save nodeid's for messages with children */ -static void -save_node_state(MessageList *ml, FILE *out, ETreePath *node) -{ - char *data; - CamelMessageInfo *info; - - while (node) { - ETreePath *child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->table_model), node); - if (child - && !e_tree_model_node_is_expanded((ETreeModel *)ml->table_model, node)) { - data = e_tree_model_node_get_data((ETreeModel *)ml->table_model, node); - if (data) { - if (id_is_uid(data)) { - info = camel_folder_get_message_info(ml->folder, id_uid(data)); - if (info) { - fprintf(out, "%08x%08x\n", info->message_id.id.part.hi, info->message_id.id.part.lo); - camel_folder_free_message_info(ml->folder, info); - } - } else { - fprintf(out, "%s\n", data); - } - } - } - if (child) { - save_node_state(ml, out, child); - } - node = e_tree_model_node_get_next (E_TREE_MODEL (ml->table_model), node); - } -} - -static GHashTable * -load_tree_state(MessageList *ml) -{ - char *filename, linebuf[10240]; - GHashTable *result; - FILE *in; - int len; - - result = g_hash_table_new(g_str_hash, g_str_equal); - filename = mail_config_folder_to_cachename(ml->folder, "treestate-"); - in = fopen(filename, "r"); - if (in) { - while (fgets(linebuf, sizeof(linebuf), in) != NULL) { - len = strlen(linebuf); - if (len) { - linebuf[len-1] = 0; - g_hash_table_insert(result, g_strdup(linebuf), (void *)1); - } - } - fclose(in); - } - g_free(filename); - return result; -} - -/* save tree info */ -static void -save_tree_state(MessageList *ml) -{ - char *filename; - ETreePath *node; - ETreePath *child; - FILE *out; - int rem; - - filename = mail_config_folder_to_cachename(ml->folder, "treestate-"); - out = fopen(filename, "w"); - if (out) { - node = e_tree_model_get_root((ETreeModel *)ml->table_model); - child = e_tree_model_node_get_first_child ((ETreeModel *)ml->table_model, node); - if (node && child) { - save_node_state(ml, out, child); - } - rem = ftell(out) == 0; - fclose(out); - /* remove the file if it was empty, should probably check first, but this is easier */ - if (rem) - unlink(filename); - } - g_free(filename); -} - -static void -free_node_state(void *key, void *value, void *data) -{ - g_free(key); -} - -static void -free_tree_state(GHashTable *expanded_nodes) -{ - g_hash_table_foreach(expanded_nodes, free_node_state, 0); - g_hash_table_destroy(expanded_nodes); -} - -/* only call if we have a tree model */ -/* builds the tree structure */ -static void build_subtree (MessageList *ml, ETreePath *parent, CamelFolderThreadNode *c, int *row, GHashTable *); - -static void build_subtree_diff (MessageList *ml, ETreePath *parent, ETreePath *path, CamelFolderThreadNode *c, int *row, GHashTable *expanded_nodes); - -static void -build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *changes) -{ - int row = 0; - GHashTable *expanded_nodes; - ETreeModel *etm = (ETreeModel *)ml->table_model; - ETreePath *top; - char *uid = NULL; - -#ifdef TIMEIT - struct timeval start, end; - unsigned long diff; - - printf("Building tree\n"); - gettimeofday(&start, NULL); -#endif - expanded_nodes = load_tree_state(ml); - -#ifdef TIMEIT - gettimeofday(&end, NULL); - diff = end.tv_sec * 1000 + end.tv_usec/1000; - diff -= start.tv_sec * 1000 + start.tv_usec/1000; - printf("Loading tree state took %ld.%03ld seconds\n", diff / 1000, diff % 1000); -#endif - - if (ml->tree_root == NULL) { - ml->tree_root = e_tree_model_node_insert(etm, NULL, 0, NULL); - e_tree_model_node_set_expanded(etm, ml->tree_root, TRUE); - } - -#define BROKEN_ETREE /* avoid some broken code in etree(?) by not using the incremental update */ - - top = e_tree_model_node_get_first_child(etm, ml->tree_root); -#ifndef BROKEN_ETREE - if (top == NULL || changes == NULL) { -#endif - if (ml->cursor_uid) { - uid = g_strdup(ml->cursor_uid); - printf("current uid = %s\n", uid); - } - - e_tree_model_freeze(etm); - clear_tree (ml); - - build_subtree(ml, ml->tree_root, thread->tree, &row, expanded_nodes); - - e_tree_model_thaw(etm); - - if (uid) { - int row; - char *dummy; - - if (g_hash_table_lookup_extended(ml->uid_rowmap, uid, (void **)&dummy, (void **)&row)) { - printf("selecting uid %s row %d\n", uid, row); - e_table_set_cursor_row(ml->table, row); - } else { - printf("cannot find uid %s\n", uid); - g_free(ml->cursor_uid); - ml->cursor_uid = NULL; - gtk_signal_emit((GtkObject *)ml, message_list_signals[MESSAGE_SELECTED], NULL); - } - g_free(uid); - } - -#ifndef BROKEN_ETREE - } else { - static int tree_equal(ETreeModel *etm, ETreePath *ap, CamelFolderThreadNode *bp); - - build_subtree_diff(ml, ml->tree_root, top, thread->tree, &row, expanded_nodes); - top = e_tree_model_node_get_first_child(etm, ml->tree_root); - tree_equal(ml->table_model, top, thread->tree); - } -#endif - free_tree_state(expanded_nodes); - -#ifdef TIMEIT - gettimeofday(&end, NULL); - diff = end.tv_sec * 1000 + end.tv_usec/1000; - diff -= start.tv_sec * 1000 + start.tv_usec/1000; - printf("Building tree took %ld.%03ld seconds\n", diff / 1000, diff % 1000); -#endif - -} - -static char * -new_id_from_uid(MessageList *ml, const char *uid) -{ - char *res; - int len; - - len = strlen(uid)+2; - res = e_mempool_alloc(ml->uid_pool, len); - res[0] = 'u'; - strcpy(res+1, uid); - return res; -} - -static char * -new_id_from_subject(MessageList *ml, const char *subject) -{ - char *res; - int len; - - len = strlen(subject)+2; - res = e_mempool_alloc(ml->uid_pool, len); - res[0] = 's'; - strcpy(res+1, subject); - return res; -} - -/* this is about 20% faster than build_subtree_diff, - entirely because e_tree_model_node_insert(xx, -1 xx) - is faster than inserting to the right row :( */ -/* Otherwise, this code would probably go as it does the same thing essentially */ -static void -build_subtree (MessageList *ml, ETreePath *parent, CamelFolderThreadNode *c, int *row, GHashTable *expanded_nodes) -{ - ETreeModel *tree = E_TREE_MODEL (ml->table_model); - ETreePath *node; - char *id; - int expanded = FALSE; - - while (c) { - if (c->message) { - id = new_id_from_uid(ml, camel_message_info_uid(c->message)); - g_hash_table_insert(ml->uid_rowmap, id_uid(id), GINT_TO_POINTER ((*row)++)); - if (c->child) { - if (c->message) { - char key[17]; - sprintf(key, "%08x%08x", c->message->message_id.id.part.hi, c->message->message_id.id.part.lo); - expanded = !g_hash_table_lookup(expanded_nodes, key) != 0; - } else - expanded = TRUE; - } - } else { - id = new_id_from_subject(ml, c->root_subject); - if (c->child) { - expanded = !g_hash_table_lookup(expanded_nodes, id) != 0; - } - } - node = e_tree_model_node_insert(tree, parent, -1, id); - if (c->child) { - /* by default, open all trees */ - if (expanded) - e_tree_model_node_set_expanded(tree, node, expanded); - build_subtree(ml, node, c->child, row, expanded_nodes); - } - c = c->next; - } -} - -/* compares a thread tree node with the etable tree node to see if they point to - the same object */ -static int -node_equal(ETreeModel *etm, ETreePath *ap, CamelFolderThreadNode *bp) -{ - char *uid; - - uid = e_tree_model_node_get_data(etm, ap); - - if (id_is_uid(uid)) { - if (bp->message && strcmp(id_uid(uid), camel_message_info_uid(bp->message))==0) - return 1; - } else if (id_is_subject(uid)) { - if (bp->message == NULL && strcmp(id_subject(uid), bp->root_subject) == 0) - return 1; - } - return 0; -} - -#ifndef BROKEN_ETREE -/* debug function - compare the two trees to see if they are the same */ -static int -tree_equal(ETreeModel *etm, ETreePath *ap, CamelFolderThreadNode *bp) -{ - char *uid; - - while (ap && bp) { - if (!node_equal(etm, ap, bp)) { - g_warning("Nodes in tree differ"); - uid = e_tree_model_node_get_data(etm, ap); - if (id_is_uid(uid)) - printf("table uid = %s\n", id_uid(uid)); - else - printf("table subject = %s\n", id_subject(uid)); - if (bp->message) - printf("camel uid = %s\n", camel_message_info_uid(bp->message)); - else - printf("camel subject = %s\n", bp->root_subject); - return FALSE; - } else { - if (!tree_equal(etm, e_tree_model_node_get_first_child(etm, ap), bp->child)) - return FALSE; - } - bp = bp->next; - ap = e_tree_model_node_get_next(etm, ap); - } - - if (ap || bp) { - g_warning("Tree differs, out of nodes in one branch"); - if (ap) { - uid = e_tree_model_node_get_data(etm, ap); - if (uid) { - if (id_is_uid(uid)) - printf("table uid = %s\n", id_uid(uid)); - else - printf("table subject = %s\n", id_subject(uid)); - } else - printf("uid is empty?\n"); - } - if (bp) { - if (bp->message) - printf("camel uid = %s\n", camel_message_info_uid(bp->message)); - else - printf("camel subject = %s\n", bp->root_subject); - return FALSE; - } - return FALSE; - } - return TRUE; -} -#endif - -/* adds a single node, retains save state, and handles adding children if required */ -static void -add_node_diff(MessageList *ml, ETreePath *parent, ETreePath *path, CamelFolderThreadNode *c, int *row, int myrow, GHashTable *expanded_nodes) -{ - ETreeModel *etm = E_TREE_MODEL (ml->table_model); - ETreePath *node; - char *id; - int expanded = FALSE; - - if (c->message) { - id = new_id_from_uid(ml, camel_message_info_uid(c->message)); - /* need to remove the id first, as GHashTable' wont replace the key pointer for us */ - g_hash_table_remove(ml->uid_rowmap, id_uid(id)); - g_hash_table_insert(ml->uid_rowmap, id_uid(id), GINT_TO_POINTER (*row)); - if (c->child) { - if (c->message) { - char key[17]; - sprintf(key, "%08x%08x", c->message->message_id.id.part.hi, c->message->message_id.id.part.lo); - expanded = !g_hash_table_lookup(expanded_nodes, key) != 0; - } else - expanded = TRUE; - } - } else { - id = new_id_from_subject(ml, c->root_subject); - if (c->child) { - expanded = !g_hash_table_lookup(expanded_nodes, id) != 0; - } - } - - t(printf("Adding node: %s row %d\n", id, myrow)); - - node = e_tree_model_node_insert(etm, parent, myrow, id); - (*row)++; - if (c->child) { - e_tree_model_node_set_expanded(etm, node, expanded); - t(printf("Building subtree ...\n")); - build_subtree_diff(ml, node, NULL, c->child, row, expanded_nodes); - } -} - -/* removes node, children recursively and all associated data */ -static void -remove_node_diff(MessageList *ml, ETreePath *node, int depth) -{ - ETreeModel *etm = E_TREE_MODEL (ml->table_model); - ETreePath *cp, *cn; - char *uid, *olduid; - int oldrow; - - t(printf("Removing node: %s\n", (char *)e_tree_model_node_get_data(etm, node))); - - /* we depth-first remove all node data's ... */ - cp = e_tree_model_node_get_first_child(etm, node); - while (cp) { - cn = e_tree_model_node_get_next(etm, cp); - remove_node_diff(ml, cp, depth+1); - cp = cn; - } - - /* and the rowid entry - if and only if it is referencing this node */ - uid = e_tree_model_node_get_data(etm, node); - if (id_is_uid(uid) - && g_hash_table_lookup_extended(ml->uid_rowmap, id_uid(uid), (void *)&olduid, (void *)&oldrow) - && olduid == id_uid(uid)) { - t(printf("removing rowid map entry: %s\n", id_uid(uid))); - g_hash_table_remove(ml->uid_rowmap, id_uid(uid)); - } - e_tree_model_node_set_data(etm, node, NULL); - - /* and only at the toplevel, remove the node (etree should optimise this remove somewhat) */ - if (depth == 0) - e_tree_model_node_remove(etm, node); -} - -/* applies a new tree structure to an existing tree, but only by changing things - that have changed */ -static void -build_subtree_diff(MessageList *ml, ETreePath *parent, ETreePath *path, CamelFolderThreadNode *c, int *row, GHashTable *expanded_nodes) -{ - ETreeModel *etm = E_TREE_MODEL (ml->table_model); - ETreePath *ap, *ai, *at, *tmp; - CamelFolderThreadNode *bp, *bi, *bt; - int i, j, myrow = 0; - - ap = path; - bp = c; - - while (ap || bp) { - t(printf("Processing row: %d (subtree row %d)\n", *row, myrow)); - if (ap == NULL) { - t(printf("out of old nodes\n")); - /* ran out of old nodes - remaining nodes are added */ - add_node_diff(ml, parent, ap, bp, row, myrow, expanded_nodes); - myrow++; - bp = bp->next; - } else if (bp == NULL) { - t(printf("out of new nodes\n")); - /* ran out of new nodes - remaining nodes are removed */ - tmp = e_tree_model_node_get_next(etm, ap); - remove_node_diff(ml, ap, 0); - ap = tmp; - } else if (node_equal(etm, ap, bp)) { - /*t(printf("nodes match, verify\n"));*/ - /* matching nodes, verify details/children */ - if (bp->message) { - char *olduid; - int oldrow; - - /* if this is a message row, check/update the row id map */ - if (g_hash_table_lookup_extended(ml->uid_rowmap, camel_message_info_uid(bp->message), (void *)&olduid, (void *)&oldrow)) { - if (oldrow != (*row)) { - g_hash_table_insert(ml->uid_rowmap, olduid, (void *)(*row)); - } - } else { - g_warning("Cannot find uid %s in table?", camel_message_info_uid(bp->message)); - /*g_assert_not_reached();*/ - } - } - *row = (*row)+1; - myrow++; - tmp = e_tree_model_node_get_first_child(etm, ap); - /* make child lists match (if either has one) */ - if (bp->child || tmp) { - build_subtree_diff(ml, ap, tmp, bp->child, row, expanded_nodes); - } - ap = e_tree_model_node_get_next(etm, ap); - bp = bp->next; - } else { - t(printf("searching for matches\n")); - /* we have to scan each side for a match */ - bi = bp->next; - ai = e_tree_model_node_get_next(etm, ap); - for (i=1;bi!=NULL;i++,bi=bi->next) { - if (node_equal(etm, ap, bi)) - break; - } - for (j=1;ai!=NULL;j++,ai=e_tree_model_node_get_next(etm, ai)) { - if (node_equal(etm, ai, bp)) - break; - } - if (inext; - } - bp = bi; - } else { - t(printf("adding new node 1\n")); - /* no match in new nodes, add one, try next */ - add_node_diff(ml, parent, NULL, bp, row, myrow, expanded_nodes); - myrow++; - bp = bp->next; - } - } else { - /* bigger run of old nodes - must be nodes to remove */ - if (ai) { - at = ap; - while (at != ai) { - t(printf("removing old node 0\n")); - tmp = e_tree_model_node_get_next(etm, at); - remove_node_diff(ml, at, 0); - at = tmp; - } - ap = ai; - } else { - t(printf("adding new node 2\n")); - /* didn't find match in old nodes, must be new node? */ - add_node_diff(ml, parent, NULL, bp, row, myrow, expanded_nodes); - myrow++; - bp = bp->next; -#if 0 - tmp = e_tree_model_node_get_next(etm, ap); - remove_node_diff(etm, ap, 0); - ap = tmp; -#endif - } - } - } - } -} - -#ifndef BROKEN_ETREE -static void build_flat_diff(MessageList *ml, CamelFolderChangeInfo *changes); -#endif - -static void -build_flat (MessageList *ml, GPtrArray *uids, CamelFolderChangeInfo *changes) -{ - ETreeModel *tree = E_TREE_MODEL (ml->table_model); - ETreePath *node; - char *saveuid = NULL; - int i; - -#ifdef TIMEIT - struct timeval start, end; - unsigned long diff; - - printf("Building flat\n"); - gettimeofday(&start, NULL); -#endif - -#ifndef BROKEN_ETREE - if (changes) { - build_flat_diff(ml, changes); - } else { -#endif - if (ml->cursor_uid) - saveuid = g_strdup(ml->cursor_uid); - - e_tree_model_freeze(tree); - clear_tree (ml); - for (i = 0; i < uids->len; i++) { - char *uid = new_id_from_uid(ml, uids->pdata[i]); - node = e_tree_model_node_insert (tree, ml->tree_root, -1, uid); - g_hash_table_insert (ml->uid_rowmap, id_uid(uid), GINT_TO_POINTER (i)); - } - e_tree_model_thaw(tree); - - if (saveuid) { - int row; - char *dummy; - - if (g_hash_table_lookup_extended(ml->uid_rowmap, saveuid, (void **)&dummy, (void **)&row)) { - printf("re-selecting %s rwo %d\n", saveuid, row); - e_table_set_cursor_row(ml->table, row); - } else { - printf("can't find uid %s anymore\n", saveuid); - g_free(ml->cursor_uid); - ml->cursor_uid = NULL; - gtk_signal_emit((GtkObject *)ml, message_list_signals[MESSAGE_SELECTED], NULL); - } - - g_free(saveuid); - } -#ifndef BROKEN_ETREE - } -#endif - -#ifdef TIMEIT - gettimeofday(&end, NULL); - diff = end.tv_sec * 1000 + end.tv_usec/1000; - diff -= start.tv_sec * 1000 + start.tv_usec/1000; - printf("Building flat took %ld.%03ld seconds\n", diff / 1000, diff % 1000); -#endif - -} - -#ifndef BROKEN_ETREE - -/* used to sort the rows to match list order */ -struct _uidsort { - int row; - char *uid; -}; - -static int -sort_uid_cmp(const void *ap, const void *bp) -{ - const struct _uidsort *a = (struct _uidsort *)ap; - const struct _uidsort *b = (struct _uidsort *)bp; - - if (a->row < b->row) - return -1; - else if (a->row > b->row) - return 1; - return 0; -} - -static void -sort_uid_to_rows(MessageList *ml, GPtrArray *uids) -{ - struct _uidsort *uidlist; - int i; - - uidlist = g_malloc(sizeof(struct _uidsort) * uids->len); - for (i=0;ilen;i++) { - uidlist[i].row = (int)g_hash_table_lookup(ml->uid_rowmap, uids->pdata[i]); - uidlist[i].uid = uids->pdata[i]; - } - qsort(uidlist, uids->len, sizeof(struct _uidsort), sort_uid_cmp); - for (i=0;ilen;i++) { - uids->pdata[i] = uidlist[i].uid; - } - g_free(uidlist); -} - -static void -build_flat_diff(MessageList *ml, CamelFolderChangeInfo *changes) -{ - int row, i; - ETreePath *node; - char *uid; - int oldrow; - char *olduid; - -#ifdef TIMEIT - struct timeval start, end; - unsigned long diff; - - gettimeofday(&start, NULL); -#endif - - printf("updating changes to display\n"); - - /* remove individual nodes? */ - if (changes->uid_removed->len > 0) { - /* first, we need to sort the row id's to match the summary order */ - sort_uid_to_rows(ml, changes->uid_removed); - - /* we remove from the end, so that the rowmap remains valid as we go */ - d(printf("Removing messages from view:\n")); - for (i=changes->uid_removed->len-1;i>=0;i--) { - d(printf(" %s\n", (char *)changes->uid_removed->pdata[i])); - if (g_hash_table_lookup_extended(ml->uid_rowmap, changes->uid_removed->pdata[i], (void *)&olduid, (void *)&row)) { - node = e_tree_model_node_at_row((ETreeModel *)ml->table_model, row); - uid = e_tree_model_node_get_data((ETreeModel *)ml->table_model, node); - if (uid && id_is_uid(uid) && !strcmp(id_uid(uid), changes->uid_removed->pdata[i])) { - g_hash_table_remove(ml->uid_rowmap, olduid); - e_tree_model_node_remove((ETreeModel *)ml->table_model, node); - d(printf(" - removed\n")); - } else { - d(printf(" - is this the right uid, it doesn't match my map?\n")); - } - } - } - } - - /* add new nodes? - just append to the end */ - if (changes->uid_added->len > 0) { - node = e_tree_model_node_get_last_child((ETreeModel *)ml->table_model, ml->tree_root); - row = e_tree_model_row_of_node((ETreeModel *)ml->table_model, node) + 1; - d(printf("Adding messages to view:\n")); - for (i=0;iuid_added->len;i++) { - d(printf(" %s\n", (char *)changes->uid_added->pdata[i])); - uid = new_id_from_uid(ml, changes->uid_added->pdata[i]); - node = e_tree_model_node_insert((ETreeModel *)ml->table_model, ml->tree_root, row, uid); - g_hash_table_insert(ml->uid_rowmap, id_uid(uid), GINT_TO_POINTER (row)); - row++; - } - } - - /* now, check the rowmap, some rows might've changed (with removes) */ - if (changes->uid_removed->len) { - d(printf("checking uid mappings\n")); - row = 0; - node = e_tree_model_node_get_first_child ((ETreeModel *)ml->table_model, ml->tree_root); - while (node) { - uid = e_tree_model_node_get_data((ETreeModel *)ml->table_model, node); - if (id_is_uid(uid)) { - if (g_hash_table_lookup_extended(ml->uid_rowmap, id_uid(uid), (void *)&olduid, (void *)&oldrow)) { - if (oldrow != row) { - d(printf("row %d moved to new row %d\n", oldrow, row)); - g_hash_table_insert(ml->uid_rowmap, olduid, (void *)row); - } - } else { /* missing? shouldn't happen */ - g_warning("Uid vanished from rowmap?: %s\n", uid); - } - } - row++; - node = e_tree_model_node_get_next((ETreeModel *)ml->table_model, node); - } - } - -#ifdef TIMEIT - gettimeofday(&end, NULL); - diff = end.tv_sec * 1000 + end.tv_usec/1000; - diff -= start.tv_sec * 1000 + start.tv_usec/1000; - printf("Inserting changes took %ld.%03ld seconds\n", diff / 1000, diff % 1000); -#endif - -} -#endif /* ! BROKEN_ETREE */ - -static void -main_folder_changed (CamelObject *o, gpointer event_data, gpointer user_data) -{ - MessageList *ml = MESSAGE_LIST (user_data); - CamelFolderChangeInfo *changes = (CamelFolderChangeInfo *)event_data; - - printf("folder changed event, changes = %p\n", changes); - if (changes) { - printf("changed = %d added = %d removed = %d\n", - changes->uid_changed->len, changes->uid_added->len, changes->uid_removed->len); - if (changes->uid_added->len == 0 && changes->uid_removed->len == 0) { - int i; - - for (i=0;iuid_changed->len;i++) { - int row = GPOINTER_TO_INT (g_hash_table_lookup (ml->uid_rowmap, changes->uid_changed->pdata[i])); - if (row != -1) - e_table_model_row_changed(ml->table_model, row); - } - - camel_folder_change_info_free(changes); - return; - } - } - - - mail_regen_list(ml, ml->search, NULL, changes); -} - -static void -folder_changed (CamelObject *o, gpointer event_data, gpointer user_data) -{ - /* similarly to message_changed, copy the change list and propagate it to - the main thread and free it */ - CamelFolderChangeInfo *changes; - - if (event_data) { - changes = camel_folder_change_info_new(); - camel_folder_change_info_cat(changes, (CamelFolderChangeInfo *)event_data); - } else { - changes = NULL; - } - mail_proxy_event (main_folder_changed, o, changes, user_data); -} - -static void -main_message_changed (CamelObject *o, gpointer uid, gpointer user_data) -{ - MessageList *message_list = MESSAGE_LIST (user_data); - int row; - - row = GPOINTER_TO_INT (g_hash_table_lookup (message_list->uid_rowmap, - uid)); - if (row != -1) - e_table_model_row_changed (message_list->table_model, row); - - g_free (uid); -} - -static void -message_changed (CamelObject *o, gpointer event_data, gpointer user_data) -{ - /* Here we copy the data because our thread may free the copy that we would reference. - * The other thread would be passed a uid parameter that pointed to freed data. - * We copy it and free it in the handler. - */ - mail_proxy_event (main_message_changed, o, g_strdup ((gchar *)event_data), user_data); -} - -void -message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder) -{ - CamelException ex; - - g_return_if_fail (message_list != NULL); - g_return_if_fail (camel_folder != NULL); - g_return_if_fail (IS_MESSAGE_LIST (message_list)); - g_return_if_fail (CAMEL_IS_FOLDER (camel_folder)); - g_return_if_fail (camel_folder_has_summary_capability (camel_folder)); - - if (message_list->folder == camel_folder) - return; - - camel_exception_init (&ex); - - if (message_list->folder) { - hide_save_state(message_list); - camel_object_unhook_event((CamelObject *)message_list->folder, "folder_changed", - folder_changed, message_list); - camel_object_unhook_event((CamelObject *)message_list->folder, "message_changed", - message_changed, message_list); - camel_object_unref (CAMEL_OBJECT (message_list->folder)); - } - - message_list->folder = camel_folder; - - /* build the etable suitable for this folder */ - message_list_setup_etable(message_list); - - camel_object_hook_event(CAMEL_OBJECT (camel_folder), "folder_changed", - folder_changed, message_list); - camel_object_hook_event(CAMEL_OBJECT (camel_folder), "message_changed", - message_changed, message_list); - - camel_object_ref (CAMEL_OBJECT (camel_folder)); - - hide_load_state(message_list); - - clear_tree(message_list); - mail_regen_list(message_list, message_list->search, NULL, NULL); -} - -E_MAKE_TYPE (message_list, "MessageList", MessageList, message_list_class_init, message_list_init, PARENT_TYPE); - -static gboolean -on_cursor_activated_idle (gpointer data) -{ - MessageList *message_list = data; - - printf("emitting cursor changed signal, for uid %s\n", message_list->cursor_uid); - gtk_signal_emit(GTK_OBJECT (message_list), message_list_signals [MESSAGE_SELECTED], message_list->cursor_uid); - - message_list->idle_id = 0; - return FALSE; -} - -static void -on_cursor_activated_cmd (ETableScrolled *table, int row, gpointer user_data) -{ - MessageList *message_list; - - message_list = MESSAGE_LIST (user_data); - - message_list->cursor_row = row; - g_free(message_list->cursor_uid); - message_list->cursor_uid = g_strdup(get_message_uid(message_list, row)); - - if (!message_list->idle_id) { - message_list->idle_id = - g_idle_add_full (G_PRIORITY_LOW, on_cursor_activated_idle, - message_list, NULL); - } -} - -static gint -on_click (ETableScrolled *table, gint row, gint col, GdkEvent *event, MessageList *list) -{ - int flag; - CamelMessageInfo *info; - - if (col == COL_MESSAGE_STATUS) - flag = CAMEL_MESSAGE_SEEN; - else if (col == COL_FLAGGED) - flag = CAMEL_MESSAGE_FLAGGED; - else - return FALSE; - - info = get_message_info(list, row); - if (info == NULL) { - return FALSE; - } - - camel_folder_set_message_flags(list->folder, camel_message_info_uid(info), flag, ~info->flags); - camel_folder_free_message_info(list->folder, info); - - if (flag == CAMEL_MESSAGE_SEEN && list->seen_id) { - gtk_timeout_remove (list->seen_id); - list->seen_id = 0; - } - - return TRUE; -} - -struct message_list_foreach_data { - MessageList *message_list; - MessageListForeachFunc callback; - gpointer user_data; -}; - -static void -mlfe_callback (int row, gpointer user_data) -{ - struct message_list_foreach_data *mlfe_data = user_data; - const char *uid; - - uid = get_message_uid (mlfe_data->message_list, row); - if (uid) { - mlfe_data->callback (mlfe_data->message_list, - uid, - mlfe_data->user_data); - } -} - -void -message_list_foreach (MessageList *message_list, - MessageListForeachFunc callback, - gpointer user_data) -{ - struct message_list_foreach_data mlfe_data; - - mlfe_data.message_list = message_list; - mlfe_data.callback = callback; - mlfe_data.user_data = user_data; - e_table_selected_row_foreach (message_list->table, - mlfe_callback, &mlfe_data); -} - -/* set whether we are in threaded view or flat view */ -void -message_list_set_threaded(MessageList *ml, gboolean threaded) -{ - if (ml->threaded ^ threaded) { - ml->threaded = threaded; - - mail_regen_list(ml, ml->search, NULL, NULL); - } -} - -void -message_list_set_search(MessageList *ml, const char *search) -{ - if (search == NULL || search[0] == '\0') - if (ml->search == NULL || ml->search[0]=='\0') - return; - - if (search != NULL && ml->search !=NULL && strcmp(search, ml->search)==0) - return; - - mail_regen_list(ml, search, NULL, NULL); -} - -/* returns the number of messages displayable *after* expression hiding has taken place */ -unsigned int message_list_length(MessageList *ml) -{ - return ml->hide_unhidden; -} - -/* add a new expression to hide, or set the range. - @expr: A new search expression - all matching messages will be hidden. May be %NULL. - @lower: Use ML_HIDE_NONE_START to specify no messages hidden from the start of the list. - @upper: Use ML_HIDE_NONE_END to specify no message hidden from the end of the list. - - For either @upper or @lower, use ML_HIDE_SAME, to keep the previously set hide range. - If either range is negative, then the range is taken from the end of the available list - of messages, once other hiding has been performed. Use message_list_length() to find out - how many messages are available for hiding. - - Example: hide_add(ml, NULL, -100, ML_HIDE_NONE_END) -> hide all but the last (most recent) - 100 messages. -*/ -void message_list_hide_add(MessageList *ml, const char *expr, unsigned int lower, unsigned int upper) -{ - MESSAGE_LIST_LOCK(ml, hide_lock); - - if (lower != ML_HIDE_SAME) - ml->hide_before = lower; - if (upper != ML_HIDE_SAME) - ml->hide_after = upper; - - MESSAGE_LIST_UNLOCK(ml, hide_lock); - - mail_regen_list(ml, ml->search, expr, NULL); -} - -/* hide specific uid's */ -void message_list_hide_uids(MessageList *ml, GPtrArray *uids) -{ - int i; - char *uid; - - /* first see if we need to do any work, if so, then do it all at once */ - for (i=0;ilen;i++) { - if (g_hash_table_lookup(ml->uid_rowmap, uids->pdata[i])) { - MESSAGE_LIST_LOCK(ml, hide_lock); - if (ml->hidden == NULL) { - ml->hidden = g_hash_table_new(g_str_hash, g_str_equal); - ml->hidden_pool = e_mempool_new(512, 256, E_MEMPOOL_ALIGN_BYTE); - } - - uid = e_mempool_strdup(ml->hidden_pool, uids->pdata[i]); - g_hash_table_insert(ml->hidden, uid, uid); - for (;ilen;i++) { - if (g_hash_table_lookup(ml->uid_rowmap, uids->pdata[i])) { - uid = e_mempool_strdup(ml->hidden_pool, uids->pdata[i]); - g_hash_table_insert(ml->hidden, uid, uid); - } - } - MESSAGE_LIST_UNLOCK(ml, hide_lock); - mail_regen_list(ml, ml->search, NULL, NULL); - break; - } - } -} - -/* no longer hide any messages */ -void message_list_hide_clear(MessageList *ml) -{ - MESSAGE_LIST_LOCK(ml, hide_lock); - if (ml->hidden) { - g_hash_table_destroy(ml->hidden); - e_mempool_destroy(ml->hidden_pool); - ml->hidden = NULL; - ml->hidden_pool = NULL; - } - ml->hide_before = ML_HIDE_NONE_START; - ml->hide_after = ML_HIDE_NONE_END; - MESSAGE_LIST_UNLOCK(ml, hide_lock); - - mail_regen_list(ml, ml->search, NULL, NULL); -} - -#define HIDE_STATE_VERSION (1) - -/* version 1 file is: - uintf 1 - uintf hide_before - uintf hide_after - string* uids -*/ - -static void hide_load_state(MessageList *ml) -{ - char *filename; - FILE *in; - guint32 version, lower, upper; - - filename = mail_config_folder_to_cachename(ml->folder, "hidestate-"); - in = fopen(filename, "r"); - if (in) { - camel_folder_summary_decode_fixed_int32(in, &version); - if (version == HIDE_STATE_VERSION) { - MESSAGE_LIST_LOCK(ml, hide_lock); - if (ml->hidden == NULL) { - ml->hidden = g_hash_table_new(g_str_hash, g_str_equal); - ml->hidden_pool = e_mempool_new(512, 256, E_MEMPOOL_ALIGN_BYTE); - } - camel_folder_summary_decode_fixed_int32(in, &lower); - ml->hide_before = lower; - camel_folder_summary_decode_fixed_int32(in, &upper); - ml->hide_after = upper; - while (!feof(in)) { - char *olduid, *uid; - - if (camel_folder_summary_decode_string(in, &olduid) != -1) { - uid = e_mempool_strdup(ml->hidden_pool, olduid); - g_free (olduid); - g_hash_table_insert(ml->hidden, uid, uid); - } - } - MESSAGE_LIST_UNLOCK(ml, hide_lock); - } - fclose(in); - } - g_free(filename); -} - -static void hide_save_1(char *uid, char *keydata, FILE *out) -{ - camel_folder_summary_encode_string(out, uid); -} - -/* save the hide state. Note that messages are hidden by uid, if the uid's change, then - this will become invalid, but is easy to reset in the ui */ -static void hide_save_state(MessageList *ml) -{ - char *filename; - FILE *out; - - MESSAGE_LIST_LOCK(ml, hide_lock); - - filename = mail_config_folder_to_cachename(ml->folder, "hidestate-"); - if (ml->hidden == NULL && ml->hide_before == ML_HIDE_NONE_START && ml->hide_after == ML_HIDE_NONE_END) { - unlink(filename); - } else if ( (out = fopen(filename, "w")) ) { - camel_folder_summary_encode_fixed_int32(out, HIDE_STATE_VERSION); - camel_folder_summary_encode_fixed_int32(out, ml->hide_before); - camel_folder_summary_encode_fixed_int32(out, ml->hide_after); - if (ml->hidden) - g_hash_table_foreach(ml->hidden, (GHFunc)hide_save_1, out); - fclose(out); - } - - MESSAGE_LIST_UNLOCK(ml, hide_lock); -} - -/* ** REGENERATE MESSAGELIST ********************************************** */ -struct _regen_list_msg { - struct _mail_msg msg; - - MessageList *ml; - char *search; - char *hideexpr; - CamelFolderChangeInfo *changes; - gboolean dotree; /* we are building a tree */ - - GPtrArray *uids, /* list of uid's to use, if realuids is NULL, this is the actual uid's from search, else a simple ptrarray */ - *realuids; /* actual uid's from search/get_uid's, or NULL */ - CamelFolderThread *tree; -}; - -static void regen_list_regen(struct _mail_msg *mm) -{ - struct _regen_list_msg *m = (struct _regen_list_msg *)mm; - int i; - GPtrArray *uids, *uidnew; - - if (m->search) { - m->uids = camel_folder_search_by_expression(m->ml->folder, m->search, &mm->ex); - } else { - m->uids = camel_folder_get_uids(m->ml->folder); - } - - if (camel_exception_is_set(&mm->ex)) - return; - - /* see if we have a new expression to hide on */ - if (m->hideexpr) { - uidnew = camel_folder_search_by_expression(m->ml->folder, m->hideexpr, &mm->ex); - /* well, lets not abort just because this faileld ... */ - camel_exception_clear(&mm->ex); - - if (uidnew) { - MESSAGE_LIST_LOCK(m->ml, hide_lock); - - if (m->ml->hidden == NULL) { - m->ml->hidden = g_hash_table_new(g_str_hash, g_str_equal); - m->ml->hidden_pool = e_mempool_new(512, 256, E_MEMPOOL_ALIGN_BYTE); - } - - for (i=0;ilen;i++) { - if (g_hash_table_lookup(m->ml->hidden, uidnew->pdata[i]) == 0) { - char *uid = e_mempool_strdup(m->ml->hidden_pool, uidnew->pdata[i]); - g_hash_table_insert(m->ml->hidden, uid, uid); - } - } - - MESSAGE_LIST_UNLOCK(m->ml, hide_lock); - - camel_folder_search_free(m->ml->folder, uidnew); - } - } - - MESSAGE_LIST_LOCK(m->ml, hide_lock); - - m->ml->hide_unhidden = m->uids->len; - - /* what semantics do we want from hide_before, hide_after? - probably <0 means measure from the end of the list */ - - /* perform uid hiding */ - if (m->ml->hidden || m->ml->hide_before != ML_HIDE_NONE_START || m->ml->hide_after != ML_HIDE_NONE_END) { - int start, end; - uidnew = g_ptr_array_new(); - uids = m->uids; - - /* first, hide matches */ - if (m->ml->hidden) { - for (i=0;ilen;i++) { - if (g_hash_table_lookup(m->ml->hidden, uids->pdata[i]) == 0) - g_ptr_array_add(uidnew, uids->pdata[i]); - } - } - - /* then calculate the subrange visible and chop it out */ - m->ml->hide_unhidden = uidnew->len; - - if (m->ml->hide_before != ML_HIDE_NONE_START || m->ml->hide_after != ML_HIDE_NONE_END) { - GPtrArray *uid2 = g_ptr_array_new(); - - start = m->ml->hide_before; - if (start < 0) - start += m->ml->hide_unhidden; - end = m->ml->hide_after; - if (end < 0) - end += m->ml->hide_unhidden; - - start = MAX(start, 0); - end = MIN(end, uidnew->len); - for (i=start;ipdata[i]); - } - - g_ptr_array_free(uidnew, TRUE); - uidnew = uid2; - } - m->realuids = uids; - m->uids = uidnew; - } else { - m->realuids = NULL; - } - - MESSAGE_LIST_UNLOCK(m->ml, hide_lock); - - if (m->dotree && m->uids) - m->tree = camel_folder_thread_messages_new(m->ml->folder, m->uids); - else - m->tree = NULL; -} - -static void regen_list_regened(struct _mail_msg *mm) -{ - struct _regen_list_msg *m = (struct _regen_list_msg *)mm; - - if (m->uids == NULL) - return; - - if (m->dotree) - build_tree(m->ml, m->tree, m->changes); - else - build_flat(m->ml, m->uids, m->changes); -} - -static void regen_list_free(struct _mail_msg *mm) -{ - struct _regen_list_msg *m = (struct _regen_list_msg *)mm; - GPtrArray *uids; - - /* work out if we have aux uid's to free, otherwise free the real ones */ - uids = m->realuids; - if (uids) { - if (m->uids) - g_ptr_array_free(m->uids, TRUE); - } else - uids = m->uids; - - if (uids) { - if (m->search) - camel_folder_search_free(m->ml->folder, uids); - else - camel_folder_free_uids(m->ml->folder, uids); - } - - /* update what we have as our search string */ - if (m->ml->search && m->ml->search != m->search) - g_free(m->ml->search); - m->ml->search = m->search; - - if (m->tree) - camel_folder_thread_messages_destroy(m->tree); - - g_free(m->hideexpr); - - if (m->changes) - camel_folder_change_info_free(m->changes); - - gtk_object_unref((GtkObject *)m->ml); -} - -static struct _mail_msg_op regen_list_op = { - NULL, - regen_list_regen, - regen_list_regened, - regen_list_free, -}; - -static void -mail_regen_list(MessageList *ml, const char *search, const char *hideexpr, CamelFolderChangeInfo *changes) -{ - struct _regen_list_msg *m; - - if (ml->folder == NULL) - return; - -#ifndef BROKEN_ETREE - /* this can sometimes crash,so ... */ - - /* see if we need to goto the child thread at all anyway */ - /* currently the only case is the flat view with updates and no search */ - if (hideexpr == NULL && search == NULL && changes != NULL && !ml->threaded) { - build_flat_diff(ml, changes); - camel_folder_change_info_free(changes); - return; - } -#endif - - m = mail_msg_new(®en_list_op, NULL, sizeof(*m)); - m->ml = ml; - m->search = g_strdup(search); - m->hideexpr = g_strdup(hideexpr); - m->changes = changes; - m->dotree = ml->threaded; - gtk_object_ref((GtkObject *)ml); - - e_thread_put(mail_thread_new, (EMsg *)m); -} diff --git a/mail/message-list.h b/mail/message-list.h deleted file mode 100644 index dbbb3421be..0000000000 --- a/mail/message-list.h +++ /dev/null @@ -1,132 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _MESSAGE_LIST_H_ -#define _MESSAGE_LIST_H_ - -/*#include */ -#include - -#include "mail-types.h" -#include -#include -#include - -#define MESSAGE_LIST_TYPE (message_list_get_type ()) -#define MESSAGE_LIST(o) (GTK_CHECK_CAST ((o), MESSAGE_LIST_TYPE, MessageList)) -#define MESSAGE_LIST_CLASS(k) (GTK_CHECK_CLASS_CAST((k), MESSAGE_LIST_TYPE, MessageListClass)) -#define IS_MESSAGE_LIST(o) (GTK_CHECK_TYPE ((o), MESSAGE_LIST_TYPE)) -#define IS_MESSAGE_LIST_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MESSAGE_LIST_TYPE)) - -enum { - COL_MESSAGE_STATUS, - COL_FLAGGED, - COL_SCORE, - COL_ATTACHMENT, - COL_FROM, - COL_SUBJECT, - COL_SENT, - COL_RECEIVED, - COL_TO, - COL_SIZE, - - COL_LAST, - - /* Invisible columns */ - COL_DELETED, - COL_UNREAD, - COL_COLOUR, -}; - -#define MESSAGE_LIST_COLUMN_IS_ACTIVE(col) (col == COL_MESSAGE_STATUS || \ - col == COL_FLAGGED) - -#define ML_HIDE_NONE_START (0) -#define ML_HIDE_NONE_END (2147483647) -/* dont change */ -#define ML_HIDE_SAME (2147483646) - -struct _MessageList { - ETableScrolled parent; - - /* The table */ - ETableModel *table_model; - ETable *table; - ETreePath *tree_root; - - /* The folder */ - CamelFolder *folder; - - /* UID to model row hash table. Keys owned by the mempool. */ - GHashTable *uid_rowmap; - struct _EMemPool *uid_pool; - - /* UID's to hide. Keys in the mempool */ - /* IMPORTANT: You MUST have obtained the hide lock, to operate on this data */ - GHashTable *hidden; - struct _EMemPool *hidden_pool; - int hide_unhidden, /* total length, before hiding */ - hide_before, hide_after; /* hide ranges of messages */ - - /* Current search string, or %NULL */ - char *search; - - /* Are we displaying threaded view? */ - gboolean threaded; - - /* Where the ETable cursor is. */ - int cursor_row; - char *cursor_uid; - - /* Row-selection and seen-marking timers */ - guint idle_id, seen_id; - - /* locks */ - GMutex *hide_lock; /* for any 'hide' info above */ -}; - -typedef struct { - ETableScrolledClass parent_class; - - /* signals - select a message */ - void (*message_selected) (MessageList *ml, const char *uid); -} MessageListClass; - -typedef void (*MessageListForeachFunc) (MessageList *message_list, - const char *uid, - gpointer user_data); - -typedef enum { - MESSAGE_LIST_SELECT_NEXT = 1, - MESSAGE_LIST_SELECT_PREVIOUS = -1 -} MessageListSelectDirection; - -GtkType message_list_get_type (void); -GtkWidget *message_list_new (void); -void message_list_set_folder (MessageList *message_list, - CamelFolder *camel_folder); - -void message_list_foreach (MessageList *message_list, - MessageListForeachFunc callback, - gpointer user_data); - -void message_list_select (MessageList *message_list, - int base_row, - MessageListSelectDirection direction, - guint32 flags, guint32 mask); - -/* info */ -unsigned int message_list_length(MessageList *ml); - -/* hide specific messages */ -void message_list_hide_add(MessageList *ml, const char *expr, unsigned int lower, unsigned int upper); -void message_list_hide_uids(MessageList *ml, GPtrArray *uids); -void message_list_hide_clear(MessageList *ml); - -void message_list_set_threaded(MessageList *ml, gboolean threaded); -void message_list_set_search(MessageList *ml, const char *search); - -char *message_list_get_layout (MessageList *message_list); - -#define MESSAGE_LIST_LOCK(m, l) g_mutex_lock(((MessageList *)m)->l) -#define MESSAGE_LIST_UNLOCK(m, l) g_mutex_unlock(((MessageList *)m)->l) - -#endif /* _MESSAGE_LIST_H_ */ diff --git a/mail/netscape-importer.c b/mail/netscape-importer.c deleted file mode 100644 index a505c9300f..0000000000 --- a/mail/netscape-importer.c +++ /dev/null @@ -1,277 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* netscape-importer.c - * - * - * Authors: - * Iain Holmes - * - * Copyright 2001 Ximian, Inc. (http://www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "mail-importer.h" -static char *nsmail_dir = NULL; - -/*#define SUPER_IMPORTER_DEBUG*/ -#ifdef SUPER_IMPORTER_DEBUG -#define d(x) x -#else -#define d(x) -#endif - -#if 0 -typedef struct { - MailImporter importer; - - int num; - CamelMimeParser *mp; -} NetscapeImporter; - -static void -netscape_clean_up (void) -{ - g_free (nsmail_dir); - nsmail_dir = NULL; -} - -static gboolean -netscape_can_import (void) -{ - char *nsprefs; - FILE *prefs_handle; - - nsprefs = gnome_util_prepend_user_home (".netscape/preferences.js"); - prefs_handle = fopen (nsprefs, "r"); - g_free (nsprefs); - - if (prefs_handle == NULL) { - d(g_warning ("No .netscape/preferences.js")); - return FALSE; - } - - /* Find the user mail dir */ - while (1) { - char line[4096]; - - fgets (line, 4096, prefs_handle); - if (line == NULL) { - d(g_warning ("No mail.directory entry")); - fclose (prefs_handle); - return FALSE; - } - - if (strstr (line, "mail.directory") != NULL) { - char *sep, *start, *end; - /* Found the line */ - - sep = strchr (line, ','); - if (sep == NULL) { - d(g_warning ("Bad line %s", line)); - fclose (prefs_handle); - return FALSE; - } - - start = strchr (sep, '\"') + 1; - if (start == NULL) { - d(g_warning ("Bad line %s", line)); - fclose (prefs_handle); - return FALSE; - } - - end = strrchr (sep, '\"'); - if (end == NULL) { - d(g_warning ("Bad line %s", line)); - fclose (prefs_handle); - return FALSE; - } - - nsmail_dir = g_strndup (start, end - start); - d(g_warning ("Got nsmail_dir: %s", nsmail_dir)); - fclose (prefs_handle); - return TRUE; - } - } -} - -static void -netscape_import_file (const char *parent, - const char *dirname, - const char *filename) -{ - char *summary, *summarypath; - - /* Check that the file is a netscape mbox. - It should have an associated .summary file */ - summary = g_strdup_printf (".%s.summary", filename); - summarypath = g_concat_dir_and_file (dirname, summary); - if (!g_file_exists (summarypath)) { - d(g_warning ("%s does not exist.\nIgnoring %s", summary, - filename)); - g_free (summary); - g_free (summarypath); - return; - } - - g_free (summary); - g_free (summarypath); - - /* Do import */ - mail_importer_create_folder (parent, filename, "mail", NULL); - g_print ("Importing %s as %s\n", parent, filename); -} - -static void -scan_dir (NetscapeImporter *importer, - char *parent, - const char *dirname) -{ - DIR *nsmail; - struct stat buf; - struct dirent *current; - - nsmail = opendir (dirname); - if (nsmail == NULL) { - d(g_warning ("Could not open %s\nopendir returned: %s", - dirname, g_strerror (errno))); - return; - } - - current = readdir (nsmail); - while (current) { - char *fullname; - - /* Ignore things which start with . - which should be ., .., and the summaries. */ - if (current->d_name[0] =='.') { - current = readdir (nsmail); - continue; - } - - fullname = g_concat_dir_and_file (dirname, current->d_name); - if (stat (fullname, &buf) == -1) { - d(g_warning ("Could not stat %s\nstat returned:%s", - fullname, g_strerror (errno))); - current = readdir (nsmail); - g_free (fullname); - continue; - } - - if (S_ISREG (buf.st_mode)) { - d(g_print ("File: %s\n", fullname)); - netscape_import_file (importer, parent, dirname, - current->d_name); - } else if (S_ISDIR (buf.st_mode)) { - char *ext; - d(g_print ("Directory: %s\n", fullname)); - - ext = strrchr (current->d_name, '.'); - if (ext && strcmp (ext + 1, "sbd") == 0) { - /* Strip the .sbd */ - if (parent == NULL) { - parent = g_strndup (current->d_name, - ext - current->d_name); - } else { - char *part; - char *tmp; - - part = g_strndup (current->d_name, - ext - current->d_name); - tmp = parent; - parent = g_concat_dir_and_file (parent, - part); - g_free (tmp); - g_free (part); - } - - scan_dir (importer, parent, fullname); - } - } - - g_free (fullname); - current = readdir (nsmail); - } -} - -static void -netscape_create_structure (void) -{ - DIR *nsmail; - struct dirent *current; - NetscapeImporter *importer; - - g_return_if_fail (nsmail_dir != NULL); - - importer = g_new0 (NetscapeImporter, 1); - - g_print ("Creating structure\n" - "------------------\n"); - scan_dir (importer, g_strdup ("/"), nsmail_dir); - g_print ("------------------\n"); -} - - -#ifdef STANDALONE -int -main (int argc, - char **argv) -#else -int -netscape_importer(void) -#endif -{ - gboolean found; - - g_print ("ISI - Iain's Super Importer\n"); - g_print ("Checking for Netscape mail:\t"); - found = netscape_can_import (); - g_print ("%s", found ? "Found" : "Not found"); - - if (found) - g_print (" (%s)\n", nsmail_dir); - else - g_print ("\n"); - - netscape_create_structure (); -} - -BonoboObject * -mbox_factory_fn (BonoboGenericFactory *_factory, - void *closure) -{ - EvolutionImporter *importer; - NetscapeImporter *netscape; - - netscape = g_new0 (NetscapeImporter, 1); - importer = evolution_importer_new (support_format_fn, - load_file_fn, - process_item_fn, NULL, netscape); -} -#endif diff --git a/mail/openpgp-utils.c b/mail/openpgp-utils.c deleted file mode 100644 index d5ab123e09..0000000000 --- a/mail/openpgp-utils.c +++ /dev/null @@ -1,1274 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Nathan Thompson-Amato - * Dan Winship - * Jeffrey Stedfast - * - * Copyright (C) Helix Code, Inc. (www.helixcode.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include /* for _() macro */ -#include "openpgp-utils.h" -#include "mail-session.h" -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define d(x) - -struct _PgpValidity { - gboolean valid; - gchar *description; -}; - -static const gchar *pgp_path = NULL; -static PgpType pgp_type = PGP_TYPE_NONE; - - -static const gchar * -pgp_get_type_as_string (PgpType type) -{ - switch (pgp_type) { - case PGP_TYPE_GPG: - return "GnuPG"; - case PGP_TYPE_PGP5: - return "PGP5"; - case PGP_TYPE_PGP2: - return "PGP2.x"; - default: - g_assert_not_reached (); - return NULL; - } -} - -static gchar * -pgp_get_passphrase (const gchar *userid) -{ - gchar *passphrase, *prompt; - const char *type; - - type = pgp_get_type_as_string (pgp_type); - - if (userid) - prompt = g_strdup_printf (_("Please enter your %s passphrase for %s"), - type, userid); - else - prompt = g_strdup_printf (_("Please enter your %s passphrase"), - type); - - /* Use the userid as a key if possible, else be generic and use the type */ - passphrase = mail_session_request_dialog (prompt, TRUE, userid ? userid : type, FALSE); - g_free (prompt); - - return passphrase; -} - -static void -pgp_forget_passphrase (const char *key) -{ - if (!key) - key = pgp_get_type_as_string (pgp_type); - - mail_session_forget_password (key); -} - - -/** - * openpgp_init: - * @path: path to pgp - * @type: pgp program type - * - * Initializes pgp variables - **/ -void -openpgp_init (const gchar *path, PgpType type) -{ - pgp_path = path; - pgp_type = type; -} - - -/** - * openpgp_detect: - * @text: input text - * - * Returns TRUE if it is found that the text contains a PGP encrypted - * block otherwise returns FALSE. - **/ -gboolean -openpgp_detect (const gchar *text) -{ - if (strstr (text, "-----BEGIN PGP MESSAGE-----")) - return TRUE; - return FALSE; -} - - -/** - * openpgp_sign_detect: - * @text: input text - * - * Returns TRUE if it is found that the text contains a PGP signed - * block otherwise returns FALSE. - **/ -gboolean -openpgp_sign_detect (const gchar *text) -{ - if (strstr (text, "-----BEGIN PGP SIGNED MESSAGE-----")) - return TRUE; - return FALSE; -} - -static int -cleanup_child (pid_t child) -{ - int status; - pid_t wait_result; - sigset_t mask, omask; - - /* PGP5 closes fds before exiting, meaning this might be called - * too early. So wait a bit for the result. - */ - sigemptyset (&mask); - sigaddset (&mask, SIGALRM); - sigprocmask (SIG_BLOCK, &mask, &omask); - alarm (1); - wait_result = waitpid (child, &status, 0); - alarm (0); - sigprocmask (SIG_SETMASK, &omask, NULL); - - if (wait_result == -1 && errno == EINTR) { - /* The child is hanging: send a friendly reminder. */ - kill (child, SIGTERM); - sleep (1); - wait_result = waitpid (child, &status, WNOHANG); - if (wait_result == 0) { - /* Still hanging; use brute force. */ - kill (child, SIGKILL); - sleep (1); - wait_result = waitpid (child, &status, WNOHANG); - } - } - - if (wait_result != -1 && WIFEXITED (status)) - return WEXITSTATUS (status); - else - return -1; -} - -static void -cleanup_before_exec (int fd) -{ - int maxfd, i; - - maxfd = sysconf (_SC_OPEN_MAX); - if (maxfd < 0) - return; - - /* Loop over all fds. */ - for (i = 0; i < maxfd; i++) { - if ((STDIN_FILENO != i) && - (STDOUT_FILENO != i) && - (STDERR_FILENO != i) && - (fd != i)) - close (i); - } -} - -static int -crypto_exec_with_passwd (const char *path, char *argv[], const char *input, int inlen, - int passwd_fds[], const char *passphrase, - char **output, int *outlen, char **diagnostics) -{ - fd_set fdset, write_fdset; - int ip_fds[2], op_fds[2], diag_fds[2]; - int select_result, read_len, write_len; - size_t tmp_len; - pid_t child; - char *buf, *diag_buf; - const char *passwd_next, *input_next; - size_t size, alloc_size, diag_size, diag_alloc_size; - gboolean eof_seen, diag_eof_seen, passwd_eof_seen, input_eof_seen; - size_t passwd_remaining, passwd_incr, input_remaining, input_incr; - struct timeval timeout; - - - if ((pipe (ip_fds) < 0 ) || - (pipe (op_fds) < 0 ) || - (pipe (diag_fds) < 0 )) { - *diagnostics = g_strdup_printf ("Couldn't create pipe to %s: " - "%s", pgp_path, - g_strerror (errno)); - return 0; - } - - if (!(child = fork ())) { - /* In child */ - - if ((dup2 (ip_fds[0], STDIN_FILENO) < 0 ) || - (dup2 (op_fds[1], STDOUT_FILENO) < 0 ) || - (dup2 (diag_fds[1], STDERR_FILENO) < 0 )) { - _exit (255); - } - - /* Dissociate from evolution-mail's controlling - * terminal so that pgp/gpg won't be able to read from - * it: PGP 2 will fall back to asking for the password - * on /dev/tty if the passed-in password is incorrect. - * This will make that fail rather than hanging. - */ - setsid (); - - /* Close excess fds */ - cleanup_before_exec (passwd_fds[0]); - - execvp (path, argv); - fprintf (stderr, "Could not execute %s: %s\n", argv[0], - g_strerror (errno)); - _exit (255); - } else if (child < 0) { - *diagnostics = g_strdup_printf ("Cannot fork %s: %s", - argv[0], g_strerror (errno)); - return 0; - } - - /* Parent */ - close (ip_fds[0]); - close (op_fds[1]); - close (diag_fds[1]); - close (passwd_fds[0]); - - timeout.tv_sec = 10; /* timeout in seconds */ - timeout.tv_usec = 0; - - size = diag_size = 0; - alloc_size = 4096; - diag_alloc_size = 1024; - eof_seen = diag_eof_seen = FALSE; - - buf = g_malloc (alloc_size); - diag_buf = g_malloc (diag_alloc_size); - - passwd_next = passphrase; - passwd_remaining = passphrase ? strlen (passphrase) : 0; - passwd_incr = fpathconf (passwd_fds[1], _PC_PIPE_BUF); - /* Use a reasonable default value on error. */ - if (passwd_incr <= 0) - passwd_incr = 1024; - passwd_eof_seen = FALSE; - - input_next = input; - input_remaining = inlen; - input_incr = fpathconf (ip_fds[1], _PC_PIPE_BUF); - if (input_incr <= 0) - input_incr = 1024; - input_eof_seen = FALSE; - - while (!(eof_seen && diag_eof_seen)) { - FD_ZERO (&fdset); - if (!eof_seen) - FD_SET (op_fds[0], &fdset); - if (!diag_eof_seen) - FD_SET (diag_fds[0], &fdset); - - FD_ZERO (&write_fdset); - if (!passwd_eof_seen) - FD_SET (passwd_fds[1], &write_fdset); - if (!input_eof_seen) - FD_SET (ip_fds[1], &write_fdset); - - select_result = select (FD_SETSIZE, &fdset, &write_fdset, - NULL, &timeout); - if (select_result < 0) { - if (errno == EINTR) - continue; - break; - } - if (select_result == 0) { - /* timeout */ - break; - } - - if (FD_ISSET (op_fds[0], &fdset)) { - /* More output is available. */ - - if (size + 4096 > alloc_size) { - alloc_size += 4096; - buf = g_realloc (buf , alloc_size); - } - read_len = read (op_fds[0], &buf[size], - alloc_size - size - 1); - if (read_len < 0) { - if (errno == EINTR) - continue; - break; - } - if (read_len == 0) - eof_seen = TRUE; - size += read_len; - } - - if (FD_ISSET(diag_fds[0], &fdset) ) { - /* More stderr is available. */ - - if (diag_size + 1024 > diag_alloc_size) { - diag_alloc_size += 1024; - diag_buf = g_realloc (diag_buf, - diag_alloc_size); - } - - read_len = read (diag_fds[0], &diag_buf[diag_size], - diag_alloc_size - diag_size - 1); - if (read_len < 0) { - if (errno == EINTR) - continue; - break; - } - if (read_len == 0) - diag_eof_seen = TRUE; - diag_size += read_len; - } - - if (FD_ISSET(passwd_fds[1], &write_fdset)) { - /* Ready for more password input. */ - - tmp_len = passwd_incr; - if (tmp_len > passwd_remaining) - tmp_len = passwd_remaining; - write_len = write (passwd_fds[1], passwd_next, - tmp_len); - if (write_len < 0) { - if (errno == EINTR) - continue; - break; - } - passwd_next += write_len; - passwd_remaining -= write_len; - if (passwd_remaining == 0) { - close (passwd_fds[1]); - passwd_eof_seen = TRUE; - } - } - - if (FD_ISSET(ip_fds[1], &write_fdset)) { - /* Ready for more ciphertext input. */ - - tmp_len = input_incr; - if (tmp_len > input_remaining) - tmp_len = input_remaining; - write_len = write (ip_fds[1], input_next, tmp_len); - if (write_len < 0) { - if (errno == EINTR) - continue; - break; - } - input_next += write_len; - input_remaining -= write_len; - if (input_remaining == 0 ) { - close (ip_fds[1]); - input_eof_seen = TRUE; - } - } - } - - buf[size] = 0; - diag_buf[diag_size] = 0; - close (op_fds[0]); - close (diag_fds[0]); - - *output = buf; - if (outlen) - *outlen = size; - *diagnostics = diag_buf; - - return cleanup_child (child); -} - -/*----------------------------------------------------------------------* - * Public crypto functions - *----------------------------------------------------------------------*/ - -/** - * openpgp_decrypt: - * @ciphertext: ciphertext to decrypt - * @cipherlen: ciphertext length - * @outlen: output length of the decrypted data (to be set by #openpgp_decrypt) - * @ex: exception - * - * Returns an allocated buffer containing the decrypted ciphertext. If - * the cleartext is plain text then you may treat it like a normal - * string as it will be NUL terminated, however #outlen is also set in - * the case that the cleartext is a binary stream. - **/ -gchar * -openpgp_decrypt (const gchar *ciphertext, gint cipherlen, gint *outlen, CamelException *ex) -{ - char *argv[15]; - char *plaintext = NULL; - char *diagnostics = NULL; - char *passphrase; - int passwd_fds[2]; - char passwd_fd[32]; - int retval, i; - - if (pgp_type == PGP_TYPE_NONE) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("No GPG/PGP program available.")); - return NULL; - } - - passphrase = pgp_get_passphrase (NULL); - if (!passphrase) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("No password provided.")); - return NULL; - } - - if (pipe (passwd_fds) < 0) { - g_free (passphrase); - pgp_forget_passphrase (NULL); - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Couldn't create pipe to GPG/PGP: %s"), - g_strerror (errno)); - return NULL; - } - - i = 0; - switch (pgp_type) { - case PGP_TYPE_GPG: - argv[i++] = "gpg"; - argv[i++] = "--verbose"; - argv[i++] = "--yes"; - argv[i++] = "--batch"; - - argv[i++] = "--output"; - argv[i++] = "-"; /* output to stdout */ - - argv[i++] = "--decrypt"; - - argv[i++] = "--passphrase-fd"; - sprintf (passwd_fd, "%d", passwd_fds[0]); - argv[i++] = passwd_fd; - break; - case PGP_TYPE_PGP5: - argv[i++] = "pgpv"; - argv[i++] = "-f"; - argv[i++] = "+batchmode=1"; - - sprintf (passwd_fd, "PGPPASSFD=%d", passwd_fds[0]); - putenv (passwd_fd); - break; - case PGP_TYPE_PGP2: - argv[i++] = "pgp"; - argv[i++] = "-f"; - - sprintf (passwd_fd, "PGPPASSFD=%d", passwd_fds[0]); - putenv (passwd_fd); - break; - default: - break; - } - - argv[i++] = NULL; - - retval = crypto_exec_with_passwd (pgp_path, argv, - ciphertext, cipherlen, - passwd_fds, passphrase, - &plaintext, outlen, - &diagnostics); - g_free (passphrase); - - if (retval != 0 || !*plaintext) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - "%s", diagnostics); - g_free (plaintext); - g_free (diagnostics); - pgp_forget_passphrase (NULL); - return NULL; - } - - g_free (diagnostics); - - return plaintext; -} - - -/** - * openpgp_encrypt: - * @in: data to encrypt - * @inlen: input length of input data - * @recipients: An array of recipient ids - * @sign: TRUE if you want to sign as well as encrypt - * @userid: userid to use when signing (assuming #sign is TRUE) - * @ex: exception - * - * Returns an allocated string containing the ciphertext. - **/ -gchar * -openpgp_encrypt (const gchar *in, gint inlen, const GPtrArray *recipients, - gboolean sign, const gchar *userid, CamelException *ex) -{ - GPtrArray *recipient_list = NULL; - GPtrArray *argv = NULL; - int retval, r; - char *ciphertext = NULL; - char *diagnostics = NULL; - int passwd_fds[2]; - char passwd_fd[32]; - char *passphrase = NULL; - - if (pgp_type == PGP_TYPE_NONE) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("No GPG/PGP program available.")); - return NULL; - } - - if (sign) { - /* we only need a passphrase if we intend on signing */ - passphrase = pgp_get_passphrase (NULL); - if (!passphrase) { - camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, - _("No password provided.")); - return NULL; - } - } - - if (pipe (passwd_fds) < 0) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Couldn't create pipe to GPG/PGP: %s"), - g_strerror (errno)); - - if (sign) { - g_free (passphrase); - pgp_forget_passphrase (NULL); - } - - return NULL; - } - - /* check to make sure we have recipients */ - if (recipients->len == 0) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("No recipients specified")); - - if (sign) { - g_free (passphrase); - pgp_forget_passphrase (NULL); - } - - return NULL; - } - - argv = g_ptr_array_new (); - recipient_list = g_ptr_array_new (); - - switch (pgp_type) { - case PGP_TYPE_GPG: - for (r = 0; r < recipients->len; r++) { - char *buf, *recipient; - - recipient = recipients->pdata[r]; - buf = g_strdup_printf ("-r %s", recipient); - g_ptr_array_add (recipient_list, buf); - g_free (recipient); - } - - g_ptr_array_add (argv, "gpg"); - - g_ptr_array_add (argv, "--verbose"); - g_ptr_array_add (argv, "--yes"); - g_ptr_array_add (argv, "--batch"); - - g_ptr_array_add (argv, "--armor"); - - for (r = 0; r < recipient_list->len; r++) - g_ptr_array_add (argv, recipient_list->pdata[r]); - - g_ptr_array_add (argv, "--output"); - g_ptr_array_add (argv, "-"); /* output to stdout */ - - g_ptr_array_add (argv, "--encrypt"); - - if (sign) { - g_ptr_array_add (argv, "--sign"); - - g_ptr_array_add (argv, "-u"); - g_ptr_array_add (argv, (gchar *) userid); - - g_ptr_array_add (argv, "--passphrase-fd"); - sprintf (passwd_fd, "%d", passwd_fds[0]); - g_ptr_array_add (argv, passwd_fd); - } - break; - case PGP_TYPE_PGP5: - for (r = 0; r < recipients->len; r++) { - char *buf, *recipient; - - recipient = recipients->pdata[r]; - buf = g_strdup_printf ("-r %s", recipient); - g_ptr_array_add (recipient_list, buf); - g_free (recipient); - } - - g_ptr_array_add (argv, "pgpe"); - - for (r = 0; r < recipient_list->len; r++) - g_ptr_array_add (argv, recipient_list->pdata[r]); - - g_ptr_array_add (argv, "-f"); - g_ptr_array_add (argv, "-z"); - g_ptr_array_add (argv, "-a"); - g_ptr_array_add (argv, "-o"); - g_ptr_array_add (argv, "-"); /* output to stdout */ - - if (sign) { - g_ptr_array_add (argv, "-s"); - - g_ptr_array_add (argv, "-u"); - g_ptr_array_add (argv, (gchar *) userid); - - sprintf (passwd_fd, "PGPPASSFD=%d", passwd_fds[0]); - putenv (passwd_fd); - } - break; - case PGP_TYPE_PGP2: - for (r = 0; r < recipients->len; r++) { - char *buf, *recipient; - - recipient = recipients->pdata[r]; - buf = g_strdup (recipient); - g_ptr_array_add (recipient_list, buf); - g_free (recipient); - } - - g_ptr_array_add (argv, "pgp"); - g_ptr_array_add (argv, "-f"); - g_ptr_array_add (argv, "-e"); - g_ptr_array_add (argv, "-a"); - g_ptr_array_add (argv, "-o"); - g_ptr_array_add (argv, "-"); - - for (r = 0; r < recipient_list->len; r++) - g_ptr_array_add (argv, recipient_list->pdata[r]); - - if (sign) { - g_ptr_array_add (argv, "-s"); - - g_ptr_array_add (argv, "-u"); - g_ptr_array_add (argv, (gchar *) userid); - - sprintf (passwd_fd, "PGPPASSFD=%d", passwd_fds[0]); - putenv (passwd_fd); - } - break; - default: - break; - } - - g_ptr_array_add (argv, NULL); - - retval = crypto_exec_with_passwd (pgp_path, (char **) argv->pdata, - in, inlen, passwd_fds, - passphrase, &ciphertext, NULL, - &diagnostics); - - g_free (passphrase); - g_ptr_array_free (argv, TRUE); - - if (retval != 0 || !*ciphertext) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - "%s", diagnostics); - g_free (ciphertext); - ciphertext = NULL; - if (sign) - pgp_forget_passphrase (NULL); - } - - if (recipient_list) { - for (r = 0; r < recipient_list->len; r++) - g_free (recipient_list->pdata[r]); - g_ptr_array_free (recipient_list, TRUE); - } - - g_free (diagnostics); - - return ciphertext; -} - - -/** - * openpgp_clearsign: - * @plaintext: plain readable text to clearsign - * @userid: userid to sign with - * @hash: Preferred hash function (md5 or sha1) - * @ex: exception - * - * Returns an allocated string containing the clearsigned plaintext - * using the preferred hash. - **/ -gchar * -openpgp_clearsign (const gchar *plaintext, const gchar *userid, - PgpHashType hash, CamelException *ex) -{ - char *argv[15]; - char *ciphertext = NULL; - char *diagnostics = NULL; - char *passphrase = NULL; - char *hash_str = NULL; - int passwd_fds[2]; - char passwd_fd[32]; - int retval, i; - - if (pgp_type == PGP_TYPE_NONE) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("No GPG/PGP program available.")); - return NULL; - } - - passphrase = pgp_get_passphrase (userid); - if (!passphrase) { - camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, - _("No password provided.")); - return NULL; - } - - if (pipe (passwd_fds) < 0) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Couldn't create pipe to GPG/PGP: %s"), - g_strerror (errno)); - - g_free (passphrase); - pgp_forget_passphrase (userid); - - return NULL; - } - - switch (hash) { - case PGP_HASH_TYPE_MD5: - hash_str = "MD5"; - break; - case PGP_HASH_TYPE_SHA1: - hash_str = "SHA1"; - break; - default: - break; - } - - i = 0; - switch (pgp_type) { - case PGP_TYPE_GPG: - argv[i++] = "gpg"; - - argv[i++] = "--clearsign"; - - if (hash_str) { - argv[i++] = "--digest-algo"; - argv[i++] = hash_str; - } - - if (userid) { - argv[i++] = "-u"; - argv[i++] = (char *) userid; - } - - argv[i++] = "--verbose"; - argv[i++] = "--yes"; - argv[i++] = "--batch"; - - argv[i++] = "--armor"; - - argv[i++] = "--output"; - argv[i++] = "-"; /* output to stdout */ - - argv[i++] = "--passphrase-fd"; - sprintf (passwd_fd, "%d", passwd_fds[0]); - argv[i++] = passwd_fd; - break; - case PGP_TYPE_PGP5: - /* FIXME: modify to respect hash */ - argv[i++] = "pgps"; - - if (userid) { - argv[i++] = "-u"; - argv[i++] = (char *) userid; - } - - argv[i++] = "-f"; - argv[i++] = "-z"; - argv[i++] = "-a"; - argv[i++] = "-o"; - argv[i++] = "-"; /* output to stdout */ - - sprintf (passwd_fd, "PGPPASSFD=%d", passwd_fds[0]); - putenv (passwd_fd); - break; - case PGP_TYPE_PGP2: - /* FIXME: modify to respect hash */ - argv[i++] = "pgp"; - - if (userid) { - argv[i++] = "-u"; - argv[i++] = (char *) userid; - } - - argv[i++] = "-f"; - argv[i++] = "-a"; - argv[i++] = "-o"; - argv[i++] = "-"; - - argv[i++] = "-st"; - sprintf (passwd_fd, "PGPPASSFD=%d", passwd_fds[0]); - putenv (passwd_fd); - break; - default: - break; - } - - argv[i++] = NULL; - - retval = crypto_exec_with_passwd (pgp_path, argv, - plaintext, strlen (plaintext), - passwd_fds, passphrase, - &ciphertext, NULL, - &diagnostics); - - g_free (passphrase); - - if (retval != 0 || !*ciphertext) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - "%s", diagnostics); - g_free (ciphertext); - ciphertext = NULL; - pgp_forget_passphrase (userid); - } - - g_free (diagnostics); - - return ciphertext; -} - - -/** - * openpgp_sign: - * @in: input data to sign - * @inlen: length of input data - * @userid: userid to sign with - * @hash: preferred hash type (md5 or sha1) - * @ex: exception - * - * Returns an allocated string containing the detached signature using - * the preferred hash. - **/ -gchar * -openpgp_sign (const gchar *in, gint inlen, const gchar *userid, - PgpHashType hash, CamelException *ex) -{ - char *argv[20]; - char *ciphertext = NULL; - char *diagnostics = NULL; - char *passphrase = NULL; - char *hash_str = NULL; - int passwd_fds[2]; - char passwd_fd[32]; - int retval, i; - - if (pgp_type == PGP_TYPE_NONE) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("No GPG/PGP program available.")); - return NULL; - } - - passphrase = pgp_get_passphrase (userid); - if (!passphrase) { - camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, - _("No password provided.")); - return NULL; - } - - if (pipe (passwd_fds) < 0) { - g_free (passphrase); - pgp_forget_passphrase (userid); - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Couldn't create pipe to GPG/PGP: %s"), - g_strerror (errno)); - return NULL; - } - - switch (hash) { - case PGP_HASH_TYPE_MD5: - hash_str = "MD5"; - break; - case PGP_HASH_TYPE_SHA1: - hash_str = "SHA1"; - break; - default: - break; - } - - i = 0; - switch (pgp_type) { - case PGP_TYPE_GPG: - argv[i++] = "gpg"; - - argv[i++] = "--sign"; - argv[i++] = "-b"; - if (hash_str) { - argv[i++] = "--digest-algo"; - argv[i++] = hash_str; - } - - if (userid) { - argv[i++] = "-u"; - argv[i++] = (char *) userid; - } - - argv[i++] = "--verbose"; - argv[i++] = "--yes"; - argv[i++] = "--batch"; - - argv[i++] = "--armor"; - - argv[i++] = "--output"; - argv[i++] = "-"; /* output to stdout */ - - argv[i++] = "--passphrase-fd"; - sprintf (passwd_fd, "%d", passwd_fds[0]); - argv[i++] = passwd_fd; - break; - case PGP_TYPE_PGP5: - /* FIXME: respect hash */ - argv[i++] = "pgps"; - - if (userid) { - argv[i++] = "-u"; - argv[i++] = (char *) userid; - } - - argv[i++] = "-b"; - argv[i++] = "-f"; - argv[i++] = "-z"; - argv[i++] = "-a"; - argv[i++] = "-o"; - argv[i++] = "-"; /* output to stdout */ - - sprintf (passwd_fd, "PGPPASSFD=%d", passwd_fds[0]); - putenv (passwd_fd); - break; - case PGP_TYPE_PGP2: - /* FIXME: respect hash */ - argv[i++] = "pgp"; - - if (userid) { - argv[i++] = "-u"; - argv[i++] = (char *) userid; - } - - argv[i++] = "-f"; - argv[i++] = "-a"; - argv[i++] = "-o"; - argv[i++] = "-"; - - argv[i++] = "-sb"; /* create a detached signature */ - sprintf (passwd_fd, "PGPPASSFD=%d", passwd_fds[0]); - putenv (passwd_fd); - break; - default: - break; - } - - argv[i++] = NULL; - - retval = crypto_exec_with_passwd (pgp_path, argv, - in, inlen, - passwd_fds, passphrase, - &ciphertext, NULL, - &diagnostics); - - g_free (passphrase); - - if (retval != 0 || !*ciphertext) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - "%s", diagnostics); - g_free (ciphertext); - ciphertext = NULL; - pgp_forget_passphrase (userid); - } - - g_free (diagnostics); - - return ciphertext; -} - -static char * -swrite (const char *data, int len) -{ - char *template; - int fd; - - template = g_strdup ("/tmp/evolution-pgp.XXXXXX"); - fd = mkstemp (template); - if (fd == -1) { - g_free (template); - return NULL; - } - - write (fd, data, len); - close (fd); - - return template; -} - -PgpValidity * -openpgp_verify (const gchar *in, gint inlen, const gchar *sigin, gint siglen, CamelException *ex) -{ - char *argv[20]; - char *cleartext = NULL; - char *diagnostics = NULL; - int passwd_fds[2]; - char *sigfile = NULL; - int retval, i, clearlen; - PgpValidity *valid = NULL; - - - if (pgp_type == PGP_TYPE_NONE) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("No GPG/PGP program available.")); - return NULL; - } - - if (pipe (passwd_fds) < 0) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Couldn't create pipe to GPG/PGP: %s"), - g_strerror (errno)); - return NULL; - } - - if (sigin != NULL && siglen) { - /* We are going to verify a detached signature so save - the signature to a temp file. */ - sigfile = swrite (sigin, siglen); - if (!sigfile) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Couldn't create temp file: %s"), - g_strerror (errno)); - return NULL; - } - } - - i = 0; - switch (pgp_type) { - case PGP_TYPE_GPG: - argv[i++] = "gpg"; - - argv[i++] = "--verify"; - - argv[i++] = "--no-tty"; - /*argv[i++] = "--verbose";*/ - /*argv[i++] = "--yes";*/ - /*argv[i++] = "--batch";*/ - - if (sigin != NULL && siglen) - argv[i++] = sigfile; - - argv[i++] = "-"; - break; - case PGP_TYPE_PGP5: - argv[i++] = "pgpv"; - - argv[i++] = "-z"; - - if (sigin != NULL && siglen) - argv[i++] = sigfile; - - argv[i++] = "-f"; - - break; - case PGP_TYPE_PGP2: - argv[i++] = "pgp"; - - if (sigin != NULL && siglen) - argv[i++] = sigfile; - - argv[i++] = "-f"; - - break; - default: - break; - } - - argv[i++] = NULL; - - clearlen = 0; - retval = crypto_exec_with_passwd (pgp_path, argv, - in, inlen, - passwd_fds, NULL, - &cleartext, &clearlen, - &diagnostics); - - /* cleanup */ - if (sigfile) { - unlink (sigfile); - g_free (sigfile); - } - - valid = openpgp_validity_new (); - - if (retval != 0) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - "%s", diagnostics); - - openpgp_validity_set_valid (valid, FALSE); - } else { - openpgp_validity_set_valid (valid, TRUE); - } - - if (diagnostics) { - char *charset; - const char *buf; - char *desc, *outbuf; - iconv_t cd; - size_t len, outlen; - - charset = getenv ("CHARSET"); - if (!charset) - charset = "US-ASCII"; - - cd = iconv_open ("UTF-8", charset); - - len = strlen (diagnostics); - outlen = 2 * len; - - outbuf = desc = g_malloc0 (outlen + 1); - buf = diagnostics; - if (cd == (iconv_t) -1 || iconv (cd, &buf, &len, &outbuf, &outlen) == -1) { - g_free (desc); - desc = g_strdup (diagnostics); - } - - if (cd != (iconv_t) -1) - iconv_close (cd); - - openpgp_validity_set_description (valid, desc); - g_free (desc); - } - - g_free (diagnostics); - g_free (cleartext); - - return valid; -} - - -/* PGP Validity */ - -PgpValidity * -openpgp_validity_new (void) -{ - PgpValidity *validity; - - validity = g_new (PgpValidity, 1); - validity->valid = FALSE; - validity->description = NULL; - - return validity; -} - -void -openpgp_validity_init (PgpValidity *validity) -{ - g_assert (validity != NULL); - - validity->valid = FALSE; - validity->description = NULL; -} - -gboolean -openpgp_validity_get_valid (PgpValidity *validity) -{ - if (validity == NULL) - return FALSE; - - return validity->valid; -} - -void -openpgp_validity_set_valid (PgpValidity *validity, gboolean valid) -{ - g_assert (validity != NULL); - - validity->valid = valid; -} - -gchar * -openpgp_validity_get_description (PgpValidity *validity) -{ - if (validity == NULL) - return NULL; - - return validity->description; -} - -void -openpgp_validity_set_description (PgpValidity *validity, const gchar *description) -{ - g_assert (validity != NULL); - - g_free (validity->description); - validity->description = g_strdup (description); -} - -void -openpgp_validity_clear (PgpValidity *validity) -{ - g_assert (validity != NULL); - - validity->valid = FALSE; - g_free (validity->description); - validity->description = NULL; -} - -void -openpgp_validity_free (PgpValidity *validity) -{ - if (validity == NULL) - return; - - g_free (validity->description); - g_free (validity); -} diff --git a/mail/openpgp-utils.h b/mail/openpgp-utils.h deleted file mode 100644 index 66dee836b0..0000000000 --- a/mail/openpgp-utils.h +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast - * - * Copyright 2000 Helix Code, Inc. (www.helixcode.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - - -#ifndef __OPENPGP_UTILS_H__ -#define __OPENPGP_UTILS_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -typedef enum { - PGP_TYPE_NONE, - PGP_TYPE_PGP2, - PGP_TYPE_PGP5, - PGP_TYPE_GPG -} PgpType; - -typedef enum { - PGP_HASH_TYPE_NONE, - PGP_HASH_TYPE_MD5, - PGP_HASH_TYPE_SHA1 -} PgpHashType; - -typedef struct _PgpValidity PgpValidity; - -void openpgp_init (const gchar *path, PgpType type); - -gboolean openpgp_detect (const gchar *text); - -gboolean openpgp_sign_detect (const gchar *text); - -gchar *openpgp_decrypt (const gchar *ciphertext, gint cipherlen, gint *outlen, CamelException *ex); - -gchar *openpgp_encrypt (const gchar *in, gint inlen, const GPtrArray *recipients, - gboolean sign, const gchar *userid, CamelException *ex); - -gchar *openpgp_clearsign (const gchar *plaintext, const gchar *userid, - PgpHashType hash, CamelException *ex); - -gchar *openpgp_sign (const gchar *in, gint inlen, const gchar *userid, - PgpHashType hash, CamelException *ex); - -PgpValidity *openpgp_verify (const gchar *in, gint inlen, const gchar *sigin, - gint siglen, CamelException *ex); - -PgpValidity *openpgp_validity_new (void); - -void openpgp_validity_init (PgpValidity *validity); - -gboolean openpgp_validity_get_valid (PgpValidity *validity); - -void openpgp_validity_set_valid (PgpValidity *validity, gboolean valid); - -gchar *openpgp_validity_get_description (PgpValidity *validity); - -void openpgp_validity_set_description (PgpValidity *validity, const gchar *description); - -void openpgp_validity_clear (PgpValidity *validity); - -void openpgp_validity_free (PgpValidity *validity); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __OPENPGP_UTILS_H__ */ diff --git a/mail/session.c b/mail/session.c deleted file mode 100644 index d8aeaa30ba..0000000000 --- a/mail/session.c +++ /dev/null @@ -1,311 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* mail-session.c: handles the session information and resource manipulation */ -/* - * Authors: Miguel de Icaza - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -#include -#include -#include "mail.h" -#include "mail-session.h" -#include "mail-mt.h" - -CamelSession *session; - -static GHashTable *passwords; -static gboolean interaction_enabled; - -static void -request_callback (gchar *string, gpointer data) -{ - char **ans = data; - - if (string) - *ans = g_strdup(string); - else - *ans = NULL; -} - -char * -mail_session_request_dialog (const char *prompt, gboolean secret, const char *key, - gboolean async) -{ - GtkWidget *dialog; - char *ans; - - if (!passwords) - passwords = g_hash_table_new (g_str_hash, g_str_equal); - - ans = g_hash_table_lookup (passwords, key); - if (ans) - return g_strdup (ans); - - if (!interaction_enabled) - return NULL; - - if (!async) { - dialog = gnome_request_dialog (secret, prompt, NULL, 0, - request_callback, &ans, NULL); - if (!dialog) - return NULL; - if (gnome_dialog_run_and_close (GNOME_DIALOG (dialog)) == -1 || - ans == NULL) - return NULL; - } else { - if ((ans = mail_get_password ((char *) prompt, secret)) == NULL) - return NULL; - } - - g_hash_table_insert (passwords, g_strdup (key), g_strdup (ans)); - return ans; -} - -static char * -auth_callback (CamelAuthCallbackMode mode, char *data, gboolean secret, - CamelService *service, char *item, CamelException *ex) -{ - char *key, *ans, *url; - - url = camel_url_to_string (service->url, FALSE); - key = g_strdup_printf ("%s:%s", url, item); - g_free (url); - - if (mode == CAMEL_AUTHENTICATOR_TELL) { - if (!data) { - g_hash_table_remove (passwords, key); - g_free (key); - } else { - gpointer old_key, old_data; - - if (g_hash_table_lookup_extended (passwords, key, - &old_key, - &old_data)) { - g_hash_table_insert (passwords, old_key, data); - g_free (old_data); - g_free (key); - } else - g_hash_table_insert (passwords, key, data); - } - - return NULL; - } - - ans = mail_session_request_dialog (data, secret, key, TRUE); - g_free (key); - - if (!ans) { - camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, - "User canceled operation."); - } - - return ans; -} - -static char * -decode_base64 (char *base64) -{ - char *plain, *pad = "=="; - int len, out, state, save; - - len = strlen (base64); - plain = g_malloc0 (len); - state = save = 0; - out = base64_decode_step (base64, len, plain, &state, &save); - if (len % 4) { - base64_decode_step (pad, 4 - len % 4, plain + out, - &state, &save); - } - - return plain; -} - -static void -maybe_remember_password (gpointer key, gpointer password, gpointer url) -{ - char *path, *key64, *pass64; - int len, state, save; - - len = strlen (url); - if (strncmp (key, url, len) != 0) - return; - - len = strlen (key); - key64 = g_malloc0 ((len + 2) * 4 / 3 + 1); - state = save = 0; - base64_encode_close (key, len, FALSE, key64, &state, &save); - path = g_strdup_printf ("/Evolution/Passwords/%s", key64); - g_free (key64); - - len = strlen (password); - pass64 = g_malloc0 ((len + 2) * 4 / 3 + 1); - state = save = 0; - base64_encode_close (password, len, FALSE, pass64, &state, &save); - - gnome_config_private_set_string (path, pass64); - g_free (path); - g_free (pass64); -} - -void -mail_session_remember_password (const char *url) -{ - g_hash_table_foreach (passwords, maybe_remember_password, (void *) url); -} - -void -mail_session_forget_password (const char *key) -{ - gpointer okey, value; - - if (g_hash_table_lookup_extended (passwords, key, &okey, &value)) { - g_hash_table_remove (passwords, key); - g_free (okey); - g_free (value); - } -} - -/* ******************** */ - -struct _timeout_data { - CamelTimeoutCallback cb; - gpointer camel_data; - gboolean result; -}; - -struct _timeout_msg { - struct _mail_msg msg; - - CamelTimeoutCallback cb; - gpointer camel_data; -}; - -static void timeout_timeout(struct _mail_msg *mm) -{ - struct _timeout_msg *m = (struct _timeout_msg *)mm; - - /* we ignore the callback result, do we care?? no. */ - m->cb(m->camel_data); -} - -static struct _mail_msg_op timeout_op = { - NULL, - timeout_timeout, - NULL, - NULL, -}; - -static gboolean -camel_timeout (gpointer data) -{ - struct _timeout_data *td = data; - struct _timeout_msg *m; - - m = mail_msg_new(&timeout_op, NULL, sizeof(*m)); - - m->cb = td->cb; - m->camel_data = td->camel_data; - - e_thread_put(mail_thread_queued, (EMsg *)m); - - return TRUE; -} - -static guint -register_callback (guint32 interval, CamelTimeoutCallback cb, gpointer camel_data) -{ - struct _timeout_data *td; - - /* We do this because otherwise the timeout can get called - * more often than the dispatch thread can get rid of it, - * leading to timeout calls piling up, and we don't have a - * good way to watch the return values. It's not cool. - */ - g_return_val_if_fail (interval > 1000, 0); - - td = g_malloc(sizeof(*td)); - td->result = TRUE; - td->cb = cb; - td->camel_data = camel_data; - - return gtk_timeout_add_full(interval, camel_timeout, NULL, td, g_free); -} - -static gboolean -remove_callback (guint handle) -{ - gtk_timeout_remove (handle); - return TRUE; -} - -/* ******************** */ - -void -mail_session_init (void) -{ - char *camel_dir, *key, *value; - void *iter; - - camel_init (); - camel_dir = g_strdup_printf ("%s/mail", evolution_dir); - session = camel_session_new (camel_dir, auth_callback, - register_callback, remove_callback); - g_free (camel_dir); - - passwords = g_hash_table_new (g_str_hash, g_str_equal); - iter = gnome_config_private_init_iterator ("/Evolution/Passwords"); - if (iter) { - while (gnome_config_iterator_next (iter, &key, &value)) { - g_hash_table_insert (passwords, decode_base64 (key), - decode_base64 (value)); - g_free (key); - g_free (value); - } - } -} - -void -mail_session_enable_interaction (gboolean enable) -{ - interaction_enabled = enable; -} - -static gboolean -free_entry (gpointer key, gpointer value, gpointer user_data) -{ - g_free (key); - memset (value, 0, strlen (value)); - g_free (value); - return TRUE; -} - -void -mail_session_forget_passwords (BonoboUIComponent *uih, void *user_data, - const char *path) -{ - g_hash_table_foreach_remove (passwords, free_entry, NULL); - gnome_config_private_clean_section ("/Evolution/Passwords"); - gnome_config_sync (); -} - -void -mail_session_set_password (const char *url, const char *password) -{ - g_hash_table_insert (passwords, g_strdup (url), g_strdup (password)); -} diff --git a/mail/subscribe-dialog.c b/mail/subscribe-dialog.c deleted file mode 100644 index 4a6b773fb8..0000000000 --- a/mail/subscribe-dialog.c +++ /dev/null @@ -1,1102 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* subscribe-dialog.c: Subscribe dialog */ -/* - * Authors: Chris Toshok - * - * Copyright 2000 Helix Code, Inc. (www.helixcode.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -#include - -#include "subscribe-dialog.h" -#include "e-util/e-html-utils.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "mail.h" -#include "mail-tools.h" -#include "mail-mt.h" -#include "camel/camel-exception.h" -#include "camel/camel-store.h" -#include "camel/camel-session.h" - -#include "art/empty.xpm" -#include "art/mark.xpm" - - -#define DEFAULT_STORE_TABLE_WIDTH 200 -#define DEFAULT_WIDTH 500 -#define DEFAULT_HEIGHT 300 - -#define PARENT_TYPE (gtk_object_get_type ()) - -#ifdef JUST_FOR_TRANSLATORS -static char *list [] = { - N_("Folder"), - N_("Store"), -}; -#endif - -#define FOLDER_ETABLE_SPEC " \ - \ - \ - \ - \ - \ - \ - \ -" - -#define STORE_ETABLE_SPEC " \ - \ - \ - \ - \ - \ -" - -enum { - FOLDER_COL_SUBSCRIBED, - FOLDER_COL_NAME, - FOLDER_COL_LAST -}; - -enum { - STORE_COL_NAME, - STORE_COL_LAST -}; - -static GtkObjectClass *subscribe_dialog_parent_class; - -static void build_tree (SubscribeDialog *sc, CamelStore *store); - -static void -set_pixmap (BonoboUIComponent *component, - const char *xml_path, - const char *icon) -{ - char *path; - GdkPixbuf *pixbuf; - - path = g_concat_dir_and_file (EVOLUTION_DATADIR "/images/evolution/buttons", icon); - - pixbuf = gdk_pixbuf_new_from_file (path); - g_return_if_fail (pixbuf != NULL); - - bonobo_ui_util_set_pixbuf (component, xml_path, pixbuf); - - gdk_pixbuf_unref (pixbuf); - - g_free (path); -} - -static void -update_pixmaps (BonoboUIComponent *component) -{ - set_pixmap (component, "/Toolbar/SubscribeFolder", "fetch-mail.png"); /* XXX */ - set_pixmap (component, "/Toolbar/UnsubscribeFolder", "compose-message.png"); /* XXX */ - set_pixmap (component, "/Toolbar/RefreshList", "forward.png"); /* XXX */ -} - -static GtkWidget* -make_folder_search_widget (GtkSignalFunc start_search_func, - gpointer user_data_for_search) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (user_data_for_search); - GtkWidget *search_hbox = gtk_hbox_new (FALSE, 0); - - sc->search_entry = gtk_entry_new (); - - if (start_search_func) { - gtk_signal_connect (GTK_OBJECT (sc->search_entry), "activate", - start_search_func, - user_data_for_search); - } - - /* add the search entry to the our search_vbox */ - gtk_box_pack_start (GTK_BOX (search_hbox), - gtk_label_new(_("Display folders starting with:")), - FALSE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (search_hbox), sc->search_entry, - FALSE, TRUE, 3); - - return search_hbox; -} - - -/* Our async operations */ - -typedef void (*SubscribeGetStoreCallback)(SubscribeDialog *sc, CamelStore *store, gpointer cb_data); -typedef void (*SubscribeFolderCallback)(SubscribeDialog *sc, gboolean success, gpointer cb_data); - -/* ** GET STORE ******************************************************* */ - -struct _get_store_msg { - struct _mail_msg msg; - - SubscribeDialog *sc; - char *url; - SubscribeGetStoreCallback cb; - gpointer cb_data; - CamelStore *store; -}; - -static char *get_store_desc(struct _mail_msg *mm, int done) -{ - struct _get_store_msg *m = (struct _get_store_msg *)mm; - - return g_strdup_printf(_("Getting store for \"%s\""), m->url); -} - -static void get_store_get(struct _mail_msg *mm) -{ - struct _get_store_msg *m = (struct _get_store_msg *)mm; - - m->store = camel_session_get_store (session, m->url, &mm->ex); -} - -static void get_store_got(struct _mail_msg *mm) -{ - struct _get_store_msg *m = (struct _get_store_msg *)mm; - - m->cb(m->sc, m->store, m->cb_data); -} - -static void get_store_free(struct _mail_msg *mm) -{ - struct _get_store_msg *m = (struct _get_store_msg *)mm; - - if (m->store) - camel_object_unref((CamelObject *)m->store); - g_free(m->url); -} - -static struct _mail_msg_op get_store_op = { - get_store_desc, - get_store_get, - get_store_got, - get_store_free, -}; - -static void -subscribe_do_get_store (SubscribeDialog *sc, const char *url, SubscribeGetStoreCallback cb, gpointer cb_data) -{ - struct _get_store_msg *m; - int id; - - g_return_if_fail (url != NULL); - - m = mail_msg_new(&get_store_op, NULL, sizeof(*m)); - m->sc = sc; - m->url = g_strdup(url); - m->cb = cb; - m->cb_data = cb_data; - - id = m->msg.seq; - e_thread_put(mail_thread_queued, (EMsg *)m); - mail_msg_wait(id); -} - -/* ** SUBSCRIBE FOLDER ******************************************************* */ -/* Given a CamelFolderInfo, construct the corresponding - * EvolutionStorage path to it. - */ -static char * -storage_tree_path (CamelFolderInfo *info) -{ - int len; - CamelFolderInfo *i; - char *path, *p; - - for (len = 0, i = info; i; i = i->parent) - len += strlen (i->name) + 1; - - /* We do this backwards because that's the way the pointers point. */ - path = g_malloc (len + 1); - p = path + len; - *p = '\0'; - for (i = info; i; i = i->parent) { - len = strlen (i->name); - p -= len; - memcpy (p, i->name, len); - *--p = '/'; - } - - return path; -} - -/* ********************************************************************** */ -/* Subscribe folder */ - -struct _subscribe_msg { - struct _mail_msg msg; - - SubscribeDialog *sc; - CamelStore *store; - gboolean subscribe; - SubscribeFolderCallback cb; - gpointer cb_data; - - char *path; - char *name; - char *full_name; - char *url; -}; - -static char *subscribe_folder_desc(struct _mail_msg *mm, int done) -{ - struct _subscribe_msg *m = (struct _subscribe_msg *)mm; - - if (m->subscribe) - return g_strdup_printf(_("Subscribing to folder \"%s\""), m->name); - else - return g_strdup_printf(_("Unsubscribing to folder \"%s\""), m->name); -} - -static void subscribe_folder_subscribe(struct _mail_msg *mm) -{ - struct _subscribe_msg *m = (struct _subscribe_msg *)mm; - - if (m->subscribe) - camel_store_subscribe_folder(m->store, m->full_name, &mm->ex); - else - camel_store_unsubscribe_folder(m->store, m->full_name, &mm->ex); -} - -static void -recursive_add_folder (EvolutionStorage *storage, const char *path, const char *name, const char *url) -{ - char *parent, *pname, *p; - - p = strrchr (path, '/'); - if (p && p != path) { - parent = g_strndup (path, p - path); - if (!evolution_storage_folder_exists (storage, parent)) { - p = strrchr (parent, '/'); - if (p) - pname = g_strdup (p + 1); - else - pname = g_strdup (""); - recursive_add_folder (storage, parent, pname, ""); - g_free (pname); - } - g_free (parent); - } - - evolution_storage_new_folder (storage, path, name, "mail", url, name, FALSE); -} - -static void subscribe_folder_subscribed(struct _mail_msg *mm) -{ - struct _subscribe_msg *m = (struct _subscribe_msg *)mm; - - if (!camel_exception_is_set (&mm->ex)) { - if (m->subscribe) - recursive_add_folder(m->sc->storage, m->path, m->name, m->url); - else - evolution_storage_removed_folder(m->sc->storage, m->path); - } - - if (m->cb) - m->cb(m->sc, !camel_exception_is_set(&mm->ex), m->cb_data); -} - -static void subscribe_folder_free(struct _mail_msg *mm) -{ - struct _subscribe_msg *m = (struct _subscribe_msg *)mm; - - g_free(m->path); - g_free(m->name); - g_free(m->full_name); - g_free(m->url); - - camel_object_unref((CamelObject *)m->store); - /* in wrong thread to do this? - gtk_object_unref (GTK_OBJECT (input->sc));*/ -} - -static struct _mail_msg_op subscribe_folder_op = { - subscribe_folder_desc, - subscribe_folder_subscribe, - subscribe_folder_subscribed, - subscribe_folder_free, -}; - -static void -subscribe_do_subscribe_folder (SubscribeDialog *sc, CamelStore *store, CamelFolderInfo *info, - gboolean subscribe, SubscribeFolderCallback cb, gpointer cb_data) -{ - struct _subscribe_msg *m; - - g_return_if_fail (CAMEL_IS_STORE (store)); - g_return_if_fail (info); - - m = mail_msg_new(&subscribe_folder_op, NULL, sizeof(*m)); - m->sc = sc; - m->store = store; - camel_object_ref((CamelObject *)store); - m->subscribe = subscribe; - m->cb = cb; - m->cb_data = cb_data; - - m->path = storage_tree_path (info); - m->name = g_strdup (info->name); - m->full_name = g_strdup (info->full_name); - m->url = g_strdup (info->url); - - /* - gtk_object_ref (GTK_OBJECT (sc));*/ - - e_thread_put(mail_thread_new, (EMsg *)m); -} - - - -static gboolean -folder_info_subscribed (SubscribeDialog *sc, CamelFolderInfo *info) -{ - return camel_store_folder_subscribed (sc->store, info->full_name); -} - -static void -node_changed_cb (SubscribeDialog *sc, gboolean changed, gpointer data) -{ - ETreePath *node = data; - - if (changed) - e_tree_model_node_changed (sc->folder_model, node); -} - -static void -subscribe_folder_info (SubscribeDialog *sc, CamelFolderInfo *info, ETreePath *node) -{ - /* folders without urls cannot be subscribed to */ - if (info->url == NULL) - return; - - subscribe_do_subscribe_folder (sc, sc->store, info, TRUE, node_changed_cb, node); -} - -static void -unsubscribe_folder_info (SubscribeDialog *sc, CamelFolderInfo *info, ETreePath *node) -{ - /* folders without urls cannot be subscribed to */ - if (info->url == NULL) - return; - - subscribe_do_subscribe_folder (sc, sc->store, info, FALSE, node_changed_cb, node); -} - -static void -subscribe_close (BonoboUIComponent *uic, - void *user_data, const char *path) -{ - SubscribeDialog *sc = (SubscribeDialog*)user_data; - - gtk_widget_destroy (sc->app); -} - -static void -subscribe_select_all (BonoboUIComponent *uic, - void *user_data, const char *path) -{ - SubscribeDialog *sc = (SubscribeDialog*)user_data; - ETableScrolled *scrolled = E_TABLE_SCROLLED (sc->folder_etable); - - e_table_select_all (scrolled->table); -} - -static void -subscribe_invert_selection (BonoboUIComponent *uic, - void *user_data, const char *path) -{ - SubscribeDialog *sc = (SubscribeDialog*)user_data; - ETableScrolled *scrolled = E_TABLE_SCROLLED (sc->folder_etable); - - e_table_invert_selection (scrolled->table); -} - -static void -subscribe_folder_foreach (int model_row, gpointer closure) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (closure); - ETreePath *node = e_tree_model_node_at_row (sc->folder_model, model_row); - CamelFolderInfo *info = e_tree_model_node_get_data (sc->folder_model, node); - - if (!folder_info_subscribed (sc, info)) - subscribe_folder_info (sc, info, node); -} - -static void -subscribe_folders (BonoboUIComponent *componet, gpointer user_data, const char *cname) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (user_data); - - e_table_selected_row_foreach (E_TABLE_SCROLLED(sc->folder_etable)->table, - subscribe_folder_foreach, sc); -} - -static void -unsubscribe_folder_foreach (int model_row, gpointer closure) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (closure); - ETreePath *node = e_tree_model_node_at_row (sc->folder_model, model_row); - CamelFolderInfo *info = e_tree_model_node_get_data (sc->folder_model, node); - - if (folder_info_subscribed(sc, info)) - unsubscribe_folder_info (sc, info, node); -} - - -static void -unsubscribe_folders (BonoboUIComponent *component, gpointer user_data, const char *cname) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (user_data); - - e_table_selected_row_foreach (E_TABLE_SCROLLED(sc->folder_etable)->table, - unsubscribe_folder_foreach, sc); -} - -static void -subscribe_refresh_list (BonoboUIComponent *component, gpointer user_data, const char *cname) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (user_data); - - e_utf8_gtk_entry_set_text (GTK_ENTRY (sc->search_entry), ""); - if (sc->search_top) { - g_free (sc->search_top); - sc->search_top = NULL; - } - if (sc->store) - build_tree (sc, sc->store); -} - -static void -subscribe_search (GtkWidget *widget, gpointer user_data) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (user_data); - char* search_pattern = e_utf8_gtk_entry_get_text(GTK_ENTRY(widget)); - - if (sc->search_top) { - g_free (sc->search_top); - sc->search_top = NULL; - } - - if (search_pattern && *search_pattern) - sc->search_top = search_pattern; - - if (sc->store) - build_tree (sc, sc->store); -} - - -#if 0 -/* HTML Helpers */ -static void -html_size_req (GtkWidget *widget, GtkRequisition *requisition) -{ - if (GTK_LAYOUT (widget)->height > 90) - requisition->height = 90; - else - requisition->height = GTK_LAYOUT (widget)->height; -} - -/* Returns a GtkHTML which is already inside a GtkScrolledWindow. If - * @white is TRUE, the GtkScrolledWindow will be inside a GtkFrame. - */ -static GtkWidget * -html_new (gboolean white) -{ - GtkWidget *html, *scrolled, *frame; - GtkStyle *style; - - html = gtk_html_new (); - GTK_LAYOUT (html)->height = 0; - gtk_signal_connect (GTK_OBJECT (html), "size_request", - GTK_SIGNAL_FUNC (html_size_req), NULL); - gtk_html_set_editable (GTK_HTML (html), FALSE); - style = gtk_rc_get_style (html); - if (style) { - gtk_html_set_default_background_color (GTK_HTML (html), - white ? &style->white : - &style->bg[0]); - } - gtk_widget_set_sensitive (html, FALSE); - scrolled = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), - GTK_POLICY_NEVER, - GTK_POLICY_NEVER); - gtk_container_add (GTK_CONTAINER (scrolled), html); - - if (white) { - frame = gtk_frame_new (NULL); - gtk_frame_set_shadow_type (GTK_FRAME (frame), - GTK_SHADOW_ETCHED_IN); - gtk_container_add (GTK_CONTAINER (frame), scrolled); - gtk_widget_show_all (frame); - } else - gtk_widget_show_all (scrolled); - - return html; -} - -static void -put_html (GtkHTML *html, char *text) -{ - GtkHTMLStream *handle; - - text = e_text_to_html (text, (E_TEXT_TO_HTML_CONVERT_NL | - E_TEXT_TO_HTML_CONVERT_SPACES | - E_TEXT_TO_HTML_CONVERT_URLS)); - handle = gtk_html_begin (html); - gtk_html_write (html, handle, "", 12); - gtk_html_write (html, handle, text, strlen (text)); - gtk_html_write (html, handle, "", 14); - g_free (text); - gtk_html_end (html, handle, GTK_HTML_STREAM_OK); -} -#endif - - -/* etable stuff for the subscribe ui */ - -static int -folder_etable_col_count (ETableModel *etm, void *data) -{ - return FOLDER_COL_LAST; -} - -static void* -folder_etable_duplicate_value (ETableModel *etm, int col, const void *val, void *data) -{ - return g_strdup (val); -} - -static void -folder_etable_free_value (ETableModel *etm, int col, void *val, void *data) -{ - g_free (val); -} - -static void* -folder_etable_init_value (ETableModel *etm, int col, void *data) -{ - return g_strdup (""); -} - -static gboolean -folder_etable_value_is_empty (ETableModel *etm, int col, const void *val, void *data) -{ - return !(val && *(char *)val); -} - -static char* -folder_etable_value_to_string (ETableModel *etm, int col, const void *val, void *data) -{ - return g_strdup(val); -} - -static GdkPixbuf* -folder_etree_icon_at (ETreeModel *etree, ETreePath *path, void *model_data) -{ - return NULL; /* XXX no icons for now */ -} - -static void* -folder_etree_value_at (ETreeModel *etree, ETreePath *path, int col, void *model_data) -{ - SubscribeDialog *dialog = SUBSCRIBE_DIALOG (model_data); - CamelFolderInfo *info = e_tree_model_node_get_data (etree, path); - - if (col == FOLDER_COL_NAME) { - return info->name; - } - else /* FOLDER_COL_SUBSCRIBED */ { - /* folders without urls cannot be subscribed to */ - if (info->url == NULL) - return GINT_TO_POINTER(0); /* empty */ - else if (!folder_info_subscribed(dialog, info)) - return GINT_TO_POINTER(0); /* XXX unchecked */ - else - return GUINT_TO_POINTER (1); /* checked */ - } -} - -static void -folder_etree_set_value_at (ETreeModel *etree, ETreePath *path, int col, const void *val, void *model_data) -{ - /* nothing */ -} - -static gboolean -folder_etree_is_editable (ETreeModel *etree, ETreePath *path, int col, void *model_data) -{ - return FALSE; -} - - - -static int -store_etable_col_count (ETableModel *etm, void *data) -{ - return STORE_COL_LAST; -} - -static int -store_etable_row_count (ETableModel *etm, void *data) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (data); - - return g_list_length (sc->store_list); -} - -static void* -store_etable_value_at (ETableModel *etm, int col, int row, void *data) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (data); - CamelStore *store = (CamelStore*)g_list_nth_data (sc->store_list, row); - - return camel_service_get_name (CAMEL_SERVICE (store), TRUE); -} - -static void -store_etable_set_value_at (ETableModel *etm, int col, int row, const void *val, void *data) -{ - /* nada */ -} - -static gboolean -store_etable_is_editable (ETableModel *etm, int col, int row, void *data) -{ - return FALSE; -} - -static void* -store_etable_duplicate_value (ETableModel *etm, int col, const void *val, void *data) -{ - return g_strdup (val); -} - -static void -store_etable_free_value (ETableModel *etm, int col, void *val, void *data) -{ - g_free (val); -} - -static void* -store_etable_initialize_value (ETableModel *etm, int col, void *data) -{ - return g_strdup (""); -} - -static gboolean -store_etable_value_is_empty (ETableModel *etm, int col, const void *val, void *data) -{ - return !(val && *(char *)val); -} - -static char* -store_etable_value_to_string (ETableModel *etm, int col, const void *val, void *data) -{ - return g_strdup(val); -} - - - -static void -build_etree_from_folder_info (SubscribeDialog *sc, ETreePath *parent, CamelFolderInfo *info) -{ - CamelFolderInfo *i; - - if (info == NULL) - return; - - for (i = info; i; i = i->sibling) { - ETreePath *node = e_tree_model_node_insert (sc->folder_model, parent, -1, i); - build_etree_from_folder_info (sc, node, i->child); - } -} - -static void -build_tree (SubscribeDialog *sc, CamelStore *store) -{ - CamelException *ex = camel_exception_new(); - - /* free up the existing CamelFolderInfo* if there is any */ - if (sc->folder_info) - camel_store_free_folder_info (sc->store, sc->folder_info); - if (sc->storage) - gtk_object_unref (GTK_OBJECT (sc->storage)); - - sc->store = store; - sc->storage = mail_lookup_storage (sc->store); - sc->folder_info = camel_store_get_folder_info (sc->store, sc->search_top, TRUE, TRUE, FALSE, ex); - - if (camel_exception_is_set (ex)) { - printf ("camel_store_get_folder_info failed\n"); - camel_exception_free (ex); - return; - } - - e_tree_model_node_remove (sc->folder_model, sc->folder_root); - sc->folder_root = e_tree_model_node_insert (sc->folder_model, NULL, - 0, NULL); - - - build_etree_from_folder_info (sc, sc->folder_root, sc->folder_info); - - camel_exception_free (ex); -} - -static void -storage_selected_cb (ETable *table, int row, gpointer data) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (data); - CamelStore *store = (CamelStore*)g_list_nth_data (sc->store_list, row); - - build_tree (sc, store); -} - - - -static void -folder_toggle_cb (ETable *table, int row, int col, GdkEvent *event, gpointer data) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (data); - ETreePath *node = e_tree_model_node_at_row (sc->folder_model, row); - CamelFolderInfo *info = e_tree_model_node_get_data (sc->folder_model, node); - - if (folder_info_subscribed(sc, info)) - unsubscribe_folder_info (sc, info, node); - else - subscribe_folder_info (sc, info, node); - - e_tree_model_node_changed (sc->folder_model, node); -} - - - -#define EXAMPLE_DESCR "And the beast shall come forth surrounded by a roiling cloud of vengeance.\n" \ -" The house of the unbelievers shall be razed and they shall be scorched to the\n" \ -" earth. Their tags shall blink until the end of days. \n" \ -" from The Book of Mozilla, 12:10" - -static BonoboUIVerb verbs [] = { - /* File Menu */ - BONOBO_UI_VERB ("FileCloseWin", subscribe_close), - - /* Edit Menu */ - BONOBO_UI_VERB ("EditSelectAll", subscribe_select_all), - BONOBO_UI_VERB ("EditInvertSelection", subscribe_invert_selection), - - /* Folder Menu / Toolbar */ - BONOBO_UI_VERB ("SubscribeFolder", subscribe_folders), - BONOBO_UI_VERB ("UnsubscribeFolder", unsubscribe_folders), - - /* Toolbar Specific */ - BONOBO_UI_VERB ("RefreshList", subscribe_refresh_list), - - BONOBO_UI_VERB_END -}; - -static void -store_cb (SubscribeDialog *sc, CamelStore *store, gpointer data) -{ - if (!store) - return; - - if (camel_store_supports_subscriptions (store)) { - camel_object_ref((CamelObject *)store); - sc->store_list = g_list_prepend (sc->store_list, store); - e_table_model_row_inserted (sc->store_model, 0); - } -} - -static void -populate_store_foreach (MailConfigService *service, SubscribeDialog *sc) -{ - g_return_if_fail (service->url != NULL); - - subscribe_do_get_store (sc, service->url, store_cb, NULL); -} - -static void -populate_store_list (SubscribeDialog *sc) -{ - const GSList *news; - GSList *sources; - - sources = mail_config_get_sources (); - g_slist_foreach (sources, (GFunc)populate_store_foreach, sc); - g_slist_free (sources); - - news = mail_config_get_news (); - g_slist_foreach ((GSList *)news, (GFunc)populate_store_foreach, sc); - - e_table_model_changed (sc->store_model); -} - -static void -subscribe_dialog_gui_init (SubscribeDialog *sc) -{ - ETableExtras *extras; - ECell *cell; - GdkPixbuf *toggles[2]; - BonoboUIComponent *component; - BonoboUIContainer *container; - GtkWidget *folder_search_widget; - BonoboControl *search_control; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - /* Construct the app */ - sc->app = bonobo_window_new ("subscribe-dialog", "Manage Subscriptions"); - - /* Build the menu and toolbar */ - container = bonobo_ui_container_new (); - bonobo_ui_container_set_win (container, BONOBO_WINDOW (sc->app)); - - /* set up the bonobo stuff */ - component = bonobo_ui_component_new_default (); - bonobo_ui_component_set_container ( - component, bonobo_object_corba_objref (BONOBO_OBJECT (container))); - - bonobo_ui_component_add_verb_list_with_data ( - component, verbs, sc); - - bonobo_ui_component_freeze (component, NULL); - - bonobo_ui_util_set_ui (component, EVOLUTION_DATADIR, - "evolution-subscribe.xml", - "evolution-subscribe"); - - update_pixmaps (component); - - bonobo_ui_component_thaw (component, NULL); - - sc->table = gtk_table_new (1, 2, FALSE); - - sc->hpaned = e_hpaned_new (); - - folder_search_widget = make_folder_search_widget (subscribe_search, sc); - gtk_widget_show_all (folder_search_widget); - search_control = bonobo_control_new (folder_search_widget); - - bonobo_ui_component_object_set (component, "/Toolbar/FolderSearch", - bonobo_object_corba_objref (BONOBO_OBJECT (search_control)), - NULL); - - /* set our our contents */ -#if 0 - sc->description = html_new (TRUE); - put_html (GTK_HTML (sc->description), EXAMPLE_DESCR); - - gtk_table_attach (GTK_TABLE (sc->table), sc->description->parent->parent, - 0, 1, 0, 1, - GTK_FILL | GTK_EXPAND, - 0, - 0, 0); -#endif - - /* set up the store etable */ - sc->store_model = e_table_simple_new (store_etable_col_count, - store_etable_row_count, - store_etable_value_at, - store_etable_set_value_at, - store_etable_is_editable, - store_etable_duplicate_value, - store_etable_free_value, - store_etable_initialize_value, - store_etable_value_is_empty, - store_etable_value_to_string, - sc); - - extras = e_table_extras_new (); - - sc->store_etable = e_table_scrolled_new (E_TABLE_MODEL(sc->store_model), - extras, STORE_ETABLE_SPEC, NULL); - - gtk_object_sink (GTK_OBJECT (extras)); - - gtk_signal_connect (GTK_OBJECT (e_table_scrolled_get_table(E_TABLE_SCROLLED (sc->store_etable))), - "cursor_change", GTK_SIGNAL_FUNC (storage_selected_cb), - sc); - - /* set up the folder etable */ - sc->folder_model = e_tree_simple_new (folder_etable_col_count, - folder_etable_duplicate_value, - folder_etable_free_value, - folder_etable_init_value, - folder_etable_value_is_empty, - folder_etable_value_to_string, - folder_etree_icon_at, - folder_etree_value_at, - folder_etree_set_value_at, - folder_etree_is_editable, - sc); - - sc->folder_root = e_tree_model_node_insert (sc->folder_model, NULL, - 0, NULL); - - e_tree_model_root_node_set_visible (sc->folder_model, FALSE); - e_tree_model_set_expanded_default (sc->folder_model, TRUE); - - toggles[0] = gdk_pixbuf_new_from_xpm_data ((const char **)empty_xpm); - toggles[1] = gdk_pixbuf_new_from_xpm_data ((const char **)mark_xpm); - - extras = e_table_extras_new (); - - cell = e_cell_text_new(NULL, GTK_JUSTIFY_LEFT); - - e_table_extras_add_cell (extras, "cell_text", cell); - e_table_extras_add_cell (extras, "cell_toggle", e_cell_toggle_new (0, 2, toggles)); - e_table_extras_add_cell (extras, "cell_tree", e_cell_tree_new(NULL, NULL, TRUE, cell)); - - gtk_object_set (GTK_OBJECT (cell), - "bold_column", FOLDER_COL_SUBSCRIBED, - NULL); - - e_table_extras_add_pixbuf (extras, "subscribed-image", toggles[1]); - - sc->folder_etable = e_table_scrolled_new (E_TABLE_MODEL(sc->folder_model), - extras, FOLDER_ETABLE_SPEC, NULL); - - gtk_object_sink (GTK_OBJECT (extras)); - gdk_pixbuf_unref(toggles[0]); - gdk_pixbuf_unref(toggles[1]); - - gtk_signal_connect (GTK_OBJECT (e_table_scrolled_get_table(E_TABLE_SCROLLED (sc->folder_etable))), - "double_click", GTK_SIGNAL_FUNC (folder_toggle_cb), - sc); - gtk_table_attach ( - GTK_TABLE (sc->table), sc->folder_etable, - 0, 1, 1, 3, - GTK_FILL | GTK_EXPAND, - GTK_FILL | GTK_EXPAND, - 0, 0); - - e_paned_add1 (E_PANED (sc->hpaned), sc->store_etable); - e_paned_add2 (E_PANED (sc->hpaned), sc->table); - e_paned_set_position (E_PANED (sc->hpaned), DEFAULT_STORE_TABLE_WIDTH); - - bonobo_window_set_contents (BONOBO_WINDOW (sc->app), sc->hpaned); - -#if 0 - gtk_widget_show (sc->description); -#endif - - gtk_widget_show (sc->folder_etable); - gtk_widget_show (sc->table); - gtk_widget_show (sc->store_etable); - gtk_widget_show (sc->hpaned); - - /* FIXME: Session management and stuff? */ - gtk_window_set_default_size (GTK_WINDOW (sc->app), - DEFAULT_WIDTH, DEFAULT_HEIGHT); - - populate_store_list (sc); -} - -static void -subscribe_dialog_destroy (GtkObject *object) -{ - SubscribeDialog *sc; - - sc = SUBSCRIBE_DIALOG (object); - - /* free our folder information */ - e_tree_model_node_remove (sc->folder_model, sc->folder_root); - gtk_object_unref (GTK_OBJECT (sc->folder_model)); - if (sc->folder_info) - camel_store_free_folder_info (sc->store, sc->folder_info); - - /* free our store information */ - gtk_object_unref (GTK_OBJECT (sc->store_model)); - g_list_foreach (sc->store_list, (GFunc)gtk_object_unref, NULL); - - /* free our storage */ - if (sc->storage) - gtk_object_unref (GTK_OBJECT (sc->storage)); - - /* free our search */ - if (sc->search_top) - g_free (sc->search_top); - - subscribe_dialog_parent_class->destroy (object); -} - -static void -subscribe_dialog_class_init (GtkObjectClass *object_class) -{ - object_class->destroy = subscribe_dialog_destroy; - - subscribe_dialog_parent_class = gtk_type_class (PARENT_TYPE); -} - -static void -subscribe_dialog_init (GtkObject *object) -{ -} - -static void -subscribe_dialog_construct (GtkObject *object, GNOME_Evolution_Shell shell) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (object); - - /* - * Our instance data - */ - sc->shell = shell; - sc->store = NULL; - sc->storage = NULL; - sc->folder_info = NULL; - sc->store_list = NULL; - sc->search_top = NULL; - - subscribe_dialog_gui_init (sc); -} - -GtkWidget * -subscribe_dialog_new (GNOME_Evolution_Shell shell) -{ - SubscribeDialog *subscribe_dialog; - - subscribe_dialog = gtk_type_new (subscribe_dialog_get_type ()); - - subscribe_dialog_construct (GTK_OBJECT (subscribe_dialog), shell); - - return GTK_WIDGET (subscribe_dialog->app); -} - -E_MAKE_TYPE (subscribe_dialog, "SubscribeDialog", SubscribeDialog, subscribe_dialog_class_init, subscribe_dialog_init, PARENT_TYPE); - diff --git a/mail/subscribe-dialog.glade b/mail/subscribe-dialog.glade deleted file mode 100644 index 5169f450c3..0000000000 --- a/mail/subscribe-dialog.glade +++ /dev/null @@ -1,298 +0,0 @@ - - - - - Evolution - evolution - - src - pixmaps - C - True - True - subscribe-dialog.glade.h - - - - GnomeDialog - subscriptions - False - - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - True - False - True - False - False - False - - - GtkVBox - GnomeDialog:vbox - dialog-vbox1 - False - 8 - - 4 - True - True - - - - GtkHButtonBox - GnomeDialog:action_area - dialog-action_area1 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - button1 - True - True - GNOME_STOCK_BUTTON_OK - - - - GtkButton - button2 - True - True - GNOME_STOCK_BUTTON_APPLY - - - - GtkButton - button3 - True - True - True - True - GNOME_STOCK_BUTTON_CANCEL - - - - - GtkVBox - vbox1 - False - 0 - - 0 - True - True - - - - GtkTable - table - 3 - 2 - False - 0 - 3 - - 0 - True - True - - - - GtkLabel - lblDisplay - - GTK_JUSTIFY_LEFT - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - False - False - - - - - GtkEntry - txtSearch`` - True - True - True - 0 - - - 0 - 1 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - GtkNotebook - notebook - True - True - True - GTK_POS_BOTTOM - False - 2 - 2 - False - - 0 - 1 - 2 - 3 - 0 - 0 - False - True - False - False - True - True - - - - Custom - etableAll - create_folderlist - 0 - 0 - Thu, 09 Nov 2000 23:31:36 GMT - - - - GtkLabel - Notebook:tab - lblAll - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - Custom - etableSubscribed - create_folderlist - 1 - 0 - Thu, 09 Nov 2000 23:30:19 GMT - - - - GtkLabel - Notebook:tab - lblSubscribed - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - GtkButton - cmdQuery - True - - - 1 - 2 - 1 - 2 - 5 - 0 - False - False - False - False - True - False - - - - - GtkVButtonBox - vbuttonbox1 - GTK_BUTTONBOX_DEFAULT_STYLE - 0 - 85 - 27 - 7 - 0 - - 1 - 2 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - - - GtkButton - cmdSubscribe - True - True - - - - - GtkButton - cmdUnsubscribe - True - True - - - - - - - - - diff --git a/mail/subscribe-dialog.h b/mail/subscribe-dialog.h deleted file mode 100644 index 68cd8a4876..0000000000 --- a/mail/subscribe-dialog.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Chris Toshok - * - * Copyright 2000 Helix Code, Inc. (www.helixcode.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - - -#ifndef _SUBSCRIBE_DIALOG_H_ -#define _SUBSCRIBE_DIALOG_H_ - -#include "mail-types.h" -#include "camel/camel-store.h" -#include -#include -#include -#include -#include "shell/evolution-storage.h" - -#define SUBSCRIBE_DIALOG_TYPE (subscribe_dialog_get_type ()) -#define SUBSCRIBE_DIALOG(o) (GTK_CHECK_CAST ((o), SUBSCRIBE_DIALOG_TYPE, SubscribeDialog)) -#define SUBSCRIBE_DIALOG_CLASS(k) (GTK_CHECK_CLASS_CAST((k), SUBSCRIBE_DIALOG_TYPE, SubscribeDialogClass)) -#define IS_SUBSCRIBE_DIALOG(o) (GTK_CHECK_TYPE ((o), SUBSCRIBE_DIALOG_TYPE)) -#define IS_SUBSCRIBE_DIALOG_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), SUBSCRIBE_DIALOG_TYPE)) - -struct _SubscribeDialog { - GtkObject parent; - - GNOME_Evolution_Shell shell; - - GtkWidget *app; - - GtkWidget *hpaned; - GtkWidget *table; - GtkWidget *description; - - GtkWidget *store_etable; - ETableModel *store_model; - - GtkWidget *folder_etable; - ETreeModel *folder_model; - ETreePath *folder_root; - - CamelStore *store; - EvolutionStorage *storage; - CamelFolderInfo *folder_info; - - GList *store_list; - - GtkWidget *search_entry; - char *search_top; -}; - - -typedef struct { - GtkObjectClass parent_class; -} SubscribeDialogClass; - -GtkType subscribe_dialog_get_type (void); -GtkWidget *subscribe_dialog_new (GNOME_Evolution_Shell shell); - -#endif /* _SUBSCRIBE_DIALOG_H_ */ diff --git a/mail/test-mail.c b/mail/test-mail.c deleted file mode 100644 index 6e240199cd..0000000000 --- a/mail/test-mail.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Tests the mail summary display bonobo component - * - * Author: - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 2000 Helix Code, Inc. - */ - -#include - -#include -#include -#include - -static guint -create_container (void) -{ - GtkWidget *window, *control; - BonoboUIContainer *container; - - gdk_rgb_init (); - - gtk_widget_set_default_colormap (gdk_rgb_get_cmap ()); - gtk_widget_set_default_visual (gdk_rgb_get_visual ()); - - window = bonobo_window_new ("Test", "test"); - gtk_widget_set_usize (GTK_WIDGET (window), 640, 480); - gtk_widget_show (GTK_WIDGET (window)); - - container = bonobo_ui_container_new (); - bonobo_ui_container_set_win (container, BONOBO_WINDOW (window)); - - control = bonobo_widget_new_control ( - "OAFIID:GNOME_Evolution_Mail_Control", - bonobo_object_corba_objref (BONOBO_OBJECT (container))); - - if (control == NULL){ - printf ("Could not launch mail control\n"); - exit (1); - } - gtk_container_add (GTK_CONTAINER (window), control); - - gtk_widget_show (window); - gtk_widget_show (control); - - - return FALSE; -} - -int -main (int argc, char *argv []) -{ - gnome_init ("sample-control-container", "1.0", argc, argv); - oaf_init (argc, argv); - - if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) - g_error ("Could not initialize Bonobo\n"); - - gtk_idle_add ((GtkFunction) create_container, NULL); - - /* - * Main loop - */ - bonobo_main (); - - return 0; -} - - - - - diff --git a/mail/test-thread.c b/mail/test-thread.c deleted file mode 100644 index eddf9dd7c8..0000000000 --- a/mail/test-thread.c +++ /dev/null @@ -1,230 +0,0 @@ -/* Tests the multithreaded UI code */ - -#include "config.h" -#include -#include -#include -#include -#include -#include "mail-threads.h" - -static gchar *desc_1 (gpointer in, gboolean gerund); -static void op_1( gpointer in, gpointer op, CamelException *ex ); -static gchar *desc_2 (gpointer in, gboolean gerund); -static void op_2( gpointer in, gpointer op, CamelException *ex ); -static gchar *desc_3 (gpointer in, gboolean gerund); -static void op_3( gpointer in, gpointer op, CamelException *ex ); -static gchar *desc_4 (gpointer in, gboolean gerund); -static void op_4( gpointer in, gpointer op, CamelException *ex ); -static gchar *desc_5 (gpointer in, gboolean gerund); -static void op_5( gpointer in, gpointer op, CamelException *ex ); -static gchar *desc_6 (gpointer in, gboolean gerund); -static gchar *desc_7 (gpointer in, gboolean gerund); -static gchar *desc_8 (gpointer in, gboolean gerund); -static void done( gpointer in, gpointer op, CamelException *ex ); -static void exception( gpointer in, gpointer op, CamelException *ex ); -static gboolean queue_ops( void ); - -const mail_operation_spec spec1 = { desc_1, 0, NULL, op_1, done }; -const mail_operation_spec spec2 = { desc_2, 0, NULL, op_2, done }; -const mail_operation_spec spec3 = { desc_3, 0, NULL, op_3, done }; -const mail_operation_spec spec4 = { desc_4, 0, NULL, op_4, NULL }; -const mail_operation_spec spec5 = { desc_5, 0, NULL, op_5, done }; -const mail_operation_spec spec6 = { desc_6, 0, exception, op_4, NULL }; -const mail_operation_spec spec7 = { desc_7, 0, NULL, exception, NULL }; -const mail_operation_spec spec8 = { desc_8, 0, NULL, op_4, exception }; - -static gboolean queue_ops( void ) -{ - int i; - - g_message( "Top of queue_ops" ); - - mail_operation_queue( &spec1, "op1 finished", FALSE ); - mail_operation_queue( &spec2, "op2 finished", FALSE ); - mail_operation_queue( &spec3, "op3 finished", FALSE ); - - for( i = 0; i < 3; i++ ) { - mail_operation_queue( &spec4, GINT_TO_POINTER( i ), FALSE ); - } - - g_message( "Waiting for finish..." ); - mail_operation_wait_for_finish(); - - g_message( "Ops done -- queue some more!" ); - - mail_operation_queue( &spec1, "done a second time", FALSE ); - - g_message( "Waiting for finish again..." ); - mail_operation_wait_for_finish(); - - g_message( "Ops done -- more, more!" ); - - mail_operation_queue( &spec5, "passwords stolen", FALSE ); - - for( i = 0; i < 3; i++ ) { - mail_operation_queue( &spec4, GINT_TO_POINTER( i ), FALSE ); - } - - mail_operation_queue( &spec6, NULL, FALSE ); - mail_operation_queue( &spec7, NULL, FALSE ); - mail_operation_queue( &spec8, NULL, FALSE ); - - g_message( "Waiting for finish for the last time..." ); - mail_operations_terminate(); - g_message( "Ops done again. Exiting 0" ); - gtk_exit( 0 ); - return FALSE; -} - -static void exception( gpointer in, gpointer op, CamelException *ex ) -{ - camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, "I don't feel like it."); -} - -static void op_1( gpointer in, gpointer op, CamelException *ex ) -{ - gfloat pct; - - mail_op_show_progressbar(); - mail_op_set_message( "Watch the progress bar!" ); - - for( pct = 0.0; pct < 1.0; pct += 0.2 ) { - sleep( 1 ); - mail_op_set_percentage( pct ); - } -} - -static void op_2( gpointer in, gpointer op, CamelException *ex ) -{ - int i; - - mail_op_hide_progressbar(); - for( i = 5; i > 0; i-- ) { - mail_op_set_message( "%d", i ); - sleep( 1 ); - } - - mail_op_set_message( "BOOOM!" ); - sleep( 1 ); -} - -static void op_3( gpointer in, gpointer op, CamelException *ex ) -{ - gfloat pct; - - mail_op_show_progressbar(); - mail_op_set_message( "Frobulating the foosamatic" ); - - for( pct = 0.0; pct < 0.3; pct += 0.1 ) { - mail_op_set_percentage( pct ); - sleep( 1 ); - } - - mail_op_error( "Oh no! The foosamatic was booby-trapped!" ); - sleep( 1 ); -} - -static void op_4( gpointer in, gpointer op, CamelException *ex ) -{ - mail_op_hide_progressbar(); - mail_op_set_message( "Filler # %d", GPOINTER_TO_INT( in ) ); - sleep( 1 ); -} - -static void op_5( gpointer in, gpointer op, CamelException *ex ) -{ - gchar *pass; - gboolean ret; - - mail_op_show_progressbar(); - mail_op_set_percentage( 0.5 ); - - ret = mail_op_get_password( "What is your super-secret password?", TRUE, &pass ); - - if( ret == FALSE ) - mail_op_set_message( "Oh no, you cancelled! : %s", pass ); - else - mail_op_set_message( "\"%s\", you said?", pass ); - - sleep( 1 ); -} - -static void done( gpointer in, gpointer op, CamelException *ex ) -{ - g_message( "Operation done: %s", (gchar *) in ); -} - -static gchar *desc_1 (gpointer in, gboolean gerund) -{ - if (gerund) - return g_strdup ("Showing the Crawling Progress Bar of Doom"); - else - return g_strdup ("Progress Bar"); -} - -static gchar *desc_2 (gpointer in, gboolean gerund) -{ - if (gerund) - return g_strdup ("Exploring the Mysterious Message Setter"); - else - return g_strdup ("Explore"); -} - -static gchar *desc_3 (gpointer in, gboolean gerund) -{ - if (gerund) - return g_strdup ("Dare the Error Dialog of No Return"); - else - return g_strdup ("Dare"); -} - -static gchar *desc_4 (gpointer in, gboolean gerund) -{ - if (gerund) - return g_strdup_printf ("Filling Queue Space -- %d", GPOINTER_TO_INT (in)); - else - return g_strdup_printf ("Filler -- %d", GPOINTER_TO_INT (in)); -} - -static gchar *desc_5 (gpointer in, gboolean gerund) -{ - if (gerund) - return g_strdup ("Stealing your Password"); - else - return g_strdup ("The Dastardly Password Stealer"); -} - -static gchar *desc_6 (gpointer in, gboolean gerund) -{ - if (gerund) - return g_strdup ("Setting exception on setup"); - else - return g_strdup ("Exception on setup"); -} - -static gchar *desc_7 (gpointer in, gboolean gerund) -{ - if (gerund) - return g_strdup ("Setting exception in process"); - else - return g_strdup ("Exception coming soon"); -} - -static gchar *desc_8 (gpointer in, gboolean gerund) -{ - if (gerund) - return g_strdup ("Setting exception in cleanup"); - else - return g_strdup ("Exception in cleanup"); -} - - -int main( int argc, char **argv ) -{ - g_thread_init( NULL ); - gnome_init( "test-thread", "0.0", argc, argv ); - gtk_idle_add( (GtkFunction) queue_ops, NULL ); - gtk_main(); - return 0; -} -- cgit v1.2.3