diff options
author | nobody <nobody@localhost> | 2001-12-05 12:54:00 +0800 |
---|---|---|
committer | nobody <nobody@localhost> | 2001-12-05 12:54:00 +0800 |
commit | 01cbdc713fe66ddf9b2f82c1562c8edc526b81d4 (patch) | |
tree | 79560a393da3e5e67ae5f3bf03d952ba22cfe72d /mail | |
parent | 64262ad7f2c7f72a3dffc5aa39372dbb41bdd451 (diff) | |
download | gsoc2013-evolution-01cbdc713fe66ddf9b2f82c1562c8edc526b81d4.tar gsoc2013-evolution-01cbdc713fe66ddf9b2f82c1562c8edc526b81d4.tar.gz gsoc2013-evolution-01cbdc713fe66ddf9b2f82c1562c8edc526b81d4.tar.bz2 gsoc2013-evolution-01cbdc713fe66ddf9b2f82c1562c8edc526b81d4.tar.lz gsoc2013-evolution-01cbdc713fe66ddf9b2f82c1562c8edc526b81d4.tar.xz gsoc2013-evolution-01cbdc713fe66ddf9b2f82c1562c8edc526b81d4.tar.zst gsoc2013-evolution-01cbdc713fe66ddf9b2f82c1562c8edc526b81d4.zip |
This commit was manufactured by cvs2svn to create tagGPERFMETER_GNOME_1_4_1
'GPERFMETER_GNOME_1_4_1'.
svn path=/tags/GPERFMETER_GNOME_1_4_1/; revision=14882
Diffstat (limited to 'mail')
88 files changed, 0 insertions, 60591 deletions
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 e9a1659204..0000000000 --- a/mail/ChangeLog +++ /dev/null @@ -1,17613 +0,0 @@ -2001-12-04 Jon Trowbridge <trow@ximian.com> - - * folder-browser-ui.c (folder_browser_ui_set_selection_state): - Allow 'n' and 'p' to work when multiple messages are selected. - Fixes #12062. - -2001-11-28 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (save_msg_ok): If the path exists, make sure - it's a regular file (or we can't possibly save to it). Fix for - #14127. - -2001-11-28 Jeffrey Stedfast <fejj@ximian.com> - - * message-list.c (message_list_select): Cleaned up the code. - - * mail-callbacks.c (previous_unread_msg): Pass wraparound as TRUE. - -2001-11-24 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.c (pgpopen): Fix the boolean check to be && and not - ||. - -2001-11-27 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (format_mime_part): Reverted the non-NULL - mime-type patch from a little while back, didn't mean to commit - this. - -2001-11-25 Not Zed <NotZed@Ximian.com> - - * mail-config.c (config_read): Enable news accounts that exist - always, since no gui for it. - -2001-11-20 Jeffrey Stedfast <fejj@ximian.com> - - * message-list.c (message_list_select): 'n' shouldn't wrap if 'p' - doesn't. - - * mail-format.c (format_mime_part): Make sure the mime-type is - non-NULL before passing it off to mail_lookup_handler(). - -2001-11-20 Not Zed <NotZed@Ximian.com> - - * folder-browser-ui.c: Disable search if no message - loaded/viewed. Also for #14348. - - * folder-browser.c: Disable "Add sender to addressbook" if we dont - have a message loaded (it wont work). For #14348. - -2001-11-20 Jeffrey Stedfast <fejj@ximian.com> - - * mail-display.c (load_content_loaded): Make sure the mail-display - object is still "alive" before accessing any of it's data. - -2001-11-20 Not Zed <NotZed@Ximian.com> - - * folder-browser-ui.c: Disable search if no message - loaded/viewed. Also for #14348. - - * folder-browser.c: Disable "Add sender to addressbook" if we dont - have a message loaded (it wont work). For #14348. - -2001-11-20 Jeffrey Stedfast <fejj@ximian.com> - - * mail-display.c (load_content_loaded): Make sure the mail-display - object is still "alive" before accessing any of it's data. - -2001-11-14 Zbigniew Chyla <cyba@gnome.pl> - - * mail-autofilter.c (rule_match_recipients, rule_from_message, - rule_from_mlist): s/_/U_/ (filter_rule_set_name requires UTF-8 string) - -2001-11-14 Dan Winship <danw@ximian.com> - - * main.c (segv_redirect): Instead of doing pthread_exit() after - redirecting the SEGV, try to lock a mutex we know is already - locked. This will hopefully help debug a bunch of bugs where the - crashed thread seems to be missing from the bug-buddy report. - -2001-11-13 Jeffrey Stedfast <fejj@ximian.com> - - * mail-session.c (pass_got): Call e_passwords_remember_password() - for account passwords if the user set the "remember password" - checkbox. - -2001-11-12 Jeffrey Stedfast <fejj@ximian.com> - - * mail-vfolder.c (vfolder_load_storage): Add a NULL check for - rule->name. - (mail_vfolder_add_uri): Same here. - -2001-11-09 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (forward_message): If we already have the - message loaded in the mail-display, don't bother re-loading. This - happens to fix bug #14848. - -2001-11-08 Jeffrey Stedfast <fejj@ximian.com> - - * mail-tools.c (mail_tools_x_evolution_message_parse): Was - x_evolution_message_parse from folder-browser.c. A space char is - no longer used to separate the folder URI and the first uid, - instead this is now done with a nul-char so update to parse the - newer/better format. - - * component-factory.c (destination_folder_handle_drop): Update to - parse the new/better format. - - * folder-browser.c (x_evolution_message_parse): Moved to - mail-tools.c - (message_list_drag_data_get): Instead of placing a space char - after the folder URI, instead use a nul-char. - -2001-11-06 Jeffrey Stedfast <fejj@ximian.com> - - * mail-accounts.c (pgp_path_changed): Call - mail_config_pgp_type_detect_from_path() instead of doing our own - lame auto-detection that didn't even work ;-) - - * mail-config.c (auto_detect_pgp_variables): Execute the pgp - binary and look at it's version string if we have a version string - to compare to. - (mail_config_pgp_type_detect_from_path): New function that takes a - pgp path and attempts to figure out what pgp version it is. - -2001-11-07 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (try_inline_pgp): Add a "x-inline-pgp-hack=true" - paramter to the multipart's content-type. - -2001-11-05 Jeffrey Stedfast <fejj@ximian.com> - - * mail-account-editor.c (construct): Don't make the account editor - modal either. - - * mail-accounts.c (mail_add): Use the new global account druid - variable so that we can avoid having more than a single druid at a - time. If a druid already exists, bring it to the top. - (mail_edit): Same idea only for the account editor this time. - (mail_editor_destroyed): Set the global editor to NULL. - (mail_add_finished): Set the global druid to NULL. - (mail_delete): Don't allow any deletes if an account editor is - opened (we don't want to be able to delete the account we are - editing...) - (news_edit): Same thing for the news editor. - (news_editor_destroyed): Set the news editor to NULL. - (news_add): And again for the news add. - - * mail-account-gui.c (service_check_supported): Updated to pass a - GtkWindow argument to mail_config_check_service(). - - * mail-config.c (mail_config_check_service): Now takes a GtkWindow - argument so we can set our parent window. Also, don't make this - dialog modal either. - - * mail-config-druid.c (construct): Don't make this druid modal. - -2001-11-05 <NotZed@Ximian.com> - - * message-browser.c (set_bonobo_ui): Override the Move/Copy - handlers setup by the folder_browser_ui code, and use our own, - because we need to pass it a live window which we can't. - (transfer_msg): Our own version of mail-callbacks.c:transfer_msg, - so we can properly pass the parent to the user_select_folder. - (transfer_msg_done): Also copy this so we can pass it diff args. - All fix #13919. - - * mail-callbacks.c (transfer_msg): Set physical/uri to NULL before - calling, because althought he shell client api call is supposed to - null these out, it doesn't with its stupid assertion checks on - entry. Also free physical to plug a memleak. Bugs exposed by - #13919. - -2001-11-01 Jeffrey Stedfast <fejj@ximian.com> - - * mail-display.h (mail_html_write): Renamed from - mail_html_write_string. - - * mail-display.c (mail_text_write): Don't bother with varargs - since nothing used them, we were only passing strings anyway... - (mail_error_printf): Renamed from mail_error_write, this makes - more sense. - (mail_html_write): Removed. - - * mail-format.c: Updated to use gtk_html_stream_printf directly - and s/mail_html_write_string/mail_html_write. - (mail_lookup_handler): Don't use %.*s here either... - (handle_text_enriched): Same. - (write_one_text_plain_chunk): And finally here (also update for - new mail_text_write api). - (handle_multipart_signed): Update for new mail_text_write api. - (format_mime_part): Update for new mail_error_text/printf name - change. - (handle_multipart_encrypted): Same. - - * mail-tools.c (mail_tool_generate_forward_subject): Same as - mail_generate_reply. - - * mail-callbacks.c (mail_generate_reply): Don't use %.*s in any - *printf* functions. - -2001-11-02 Christopher James Lahey <clahey@ximian.com> - - * message-list.c (ml_tree_value_at): Use GINT_TO_POINTER here for - platforms where simply casting an int to void * won't work. - (build_flat_diff, main_folder_changed): Call - e_tree_model_pre_change here. - -2001-11-02 <NotZed@Ximian.com> - - * message-browser.c (message_browser_message_list_built): - Disconnect from the message_list_built function so we dont do it - every time the list is rebuilt. - - * mail-callbacks.c (composer_send_cb): Disable autosave when we're - sending mail. - (composer_sent_cb): Re-enable autosave. - - * folder-browser-ui.c (fbui_sensitize_timeout): Make sure we reset - any data we're using on the folderbrowser before doing anything - 'cause things could vanish while we're doing it, and also - ref/unref the folderbrowser so it doesn't vanish while w'ere - working. - - * folder-browser.c (folder_browser_set_ui_component): If we are - changing the ui comp, remove any pending timeouts. For #13719. - -2001-11-01 Larry Ewing <lewing@ximian.com> - - * folder-browser.c (folder_browser_copy): fix cut & paste from the - message body. - -2001-11-01 Dan Winship <danw@ximian.com> - - * mail-format.c (handle_multipart_signed): Write out the url - before callind add_url since add_url may free it. Fixes #13839. - Remove debug printf. - - * mail-display.c (on_object_requested): Remove debug printf. - -2001-10-31 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (list_add_addresses): Don't use a - case-sensitive comparison. - -2001-10-31 Dan Winship <danw@ximian.com> - - * mail-format.c (try_inline_pgp_sig): Make this work again. - -2001-10-30 Larry Ewing <lewing@ximian.com> - - * mail-account-gui.c (delete_event_cb): add delete_event_handler. - (menu_file_save_close_cb): add save and close command. - (launch_signature_editor): initial the editor as having changed - and attach the delete event handler. - -2001-10-30 <NotZed@Ximian.com> - - * message-browser.c (d): Turn it off. - - * mail-mt.c: Added exception strings to some of the op logging. - - * mail-format.c (elide_quotes): Remove, uh, what was this for, its - not used anywhere? Also loops the instant it had a ", good one - trow! :) - (write_address): Remove name_arg/email_arg, these aren't used - anywhere. - - * mail-mt.c (mail_msg_received): If we have a cancellation setup, - destroy it immediately, to save fd's. - (mail_msg_cancel): Check cancel != NULL. - (mail_msg_free): Same. - - * folder-info.c: Comment out the Folder: and you've got mail - prints. - - * mail-config-druid.c (wizard_next_cb): If we have a next - function, honour if it tells us its going to set the page, and - dont set it, otherwise, set it to the next page, unless we're at - the end of our pages, and let the wizard do it itself. - (wizard_back_cb): Same for going back. Rest of fix for #12127, - see e-shell-startup-wizard for the rest. - (next_func): If we're not on the last page, tell the druid we're - gonna handle the next button, so we can sync properly with it, - needed for above changes. - (back_func): Similarly for going back past page 0. - (wizard_listener_event): We want to set the page to the actual one - asked for not, pagenum-1. - - * mail-local.c (mls_rename_folder): Oops, dont use the url storage - path to offset the folder name we're renaming/opening, etc. - - * subscribe-dialog.c (fe_cancel_op_foreach): Argh!!! Dont free the - async op data here, the async op is still running and will access - it! Just try to cancel it and mark it as cancelled (id == -1) - (fe_done_subscribing): Only remove outselves from the hash table - if we're not cancelled. The handle should always be set here, - since this code runs in the gui thread. - - * message-list.c (on_cursor_activated_idle): If nothing - selected/cursor not activated, then select no message. - - * mail-folder-cache.c (update_1folder): Make the trash count - optional on EVOLUTION_COUNT_TRASH, becuase some lusers are just - too stupid to understand what its for. - - * component-factory.c (storage_xfer_folder): Return slightly - better error codes for copying folders, since its not implemented - yet. - - * mail-vfolder.c, mail-local.c, mail-folder-cache.c, - message-list.c component-factory.c, mail-ops.c, - subscribe-dialog.c, mail-session.c: d() out some debug printfs, - w() out some warnings. - - * folder-browser-ui.c (folder_browser_ui_add_message): Fix typo, - Resent->Resend. - -2001-10-29 Jeffrey Stedfast <fejj@ximian.com> - - * mail-ops.c (transfer_messages_transfer): Don't warn the user if - the source and destination folders are the same. - -2001-10-29 Dan Winship <danw@ximian.com> - - * mail-format.c (handle_multipart_signed): add some debug spew re - 13839. - - * mail-display.c (on_object_requested): here too - -2001-10-29 Christopher James Lahey <clahey@ximian.com> - - * e-searching-tokenizer.c (search_info_set_match_size_increase): - Fixed a warning by #if 0ing out this function. - - * folder-browser.c, folder-browser.h (on_selection_changed): - Update status bar in an idle call. Fixes Ximian bug #13929. - - * mail-folder-cache.c (folder_renamed, store_folder_renamed): - Fixed some warnings here. - -2001-10-29 Dan Winship <danw@ximian.com> - - * folder-browser.c (folder_browser_copy): Fix the focus check. - It's not fb->message_list that has focus, it's one of its - children. #13616. - -2001-10-29 <NotZed@Ximian.com> - - * mail-folder-cache.c (store_folder_renamed): Sort the folder - updates first, since we dont seem to get them in the right order, - or infact in any tree representation whatsoever when using IMAP - ...? get_folder_info bugs? - - Unrelated note to self, the subscribe dialogue may interfere with - the folder cache. - - * mail-vfolder.c (rule_changed): Copy the folder's full_name - before trying to use it to rename. - (vfolder_edit_rule): Set 'orig' to be a reference of the original - rule. - (edit_rule_clicked): Dont lookup orig by name, copy it over - instead. - - * folder-browser.c (got_folder): oops, emit signal before - unreffing object, incase we got killded during getting folder. - (got_folder): Reset get_id. - (folder_browser_new): Set get_id of the get_folder task. - (folder_browser_init): Init get_id. - (folder_browser_destroy): IF we have outstanding 'get folder' op, - cancel it. - -2001-10-28 Jeffrey Stedfast <fejj@ximian.com> - - * mail-account-gui.c (mail_account_gui_save): Call - mail_autoreceive_setup() instead of - mail_autoreceive_setup_account() since that code was completely - broken anyway. - - * mail-send-recv.c (mail_autoreceive_setup_account): Removed. - - * mail-callbacks.c (transfer_msg_done): Move the message-list - cursor to the next message. - (transfer_msg): If we are moving messages, then pass - transfer_msg_done() to mail_transfer_messages() so when it - finishes it can move the cursor to the next undeleted message. - - * mail-format.c (try_inline_pgp): Check that the special PGP lines - begin and end with \n so as to avoid matching against quoted PGP - lines. - -2001-10-28 <NotZed@Ximian.com> - - * mail-callbacks.c (mark_all_as_seen): fb = user_data, not fb = - fb!, fixes 13844. - - * mail-local.c (mlf_rename): add the folder name to the path when - passing down to the subordinate folder. - - * folder-browser-ui.c (fbui_sensitize_timeout): Remove uic, kill - dumb warning. - - * mail-autofilter.c (mail_filter_rename_uri): Implement function - for filters to keep track of uri's being renamed. - (mail_filter_delete_uri): Similarly for deleting uri's. Note that - these functions are just noops though. - -2001-10-28 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser.c: Deactivate the Print right-click menu option - if the message isn't loaded. Fixes bug #10346. - -2001-10-28 <NotZed@Ximian.com> - - * mail-vfolder.c (mail_vfolder_rename_uri): Implemented. - (mail_vfolder_rename_uri): We do want to check renamed uri's from - vstores. - (mail_vfolder_delete_uri): Same. - (store_folder_renamed): Fix the folder hash at the same time. - - * mail-folder-cache.c (real_flush_updates): Pass the rename event - to vfolder rename uri. - (real_flush_updates): Also rename and delete uri's from filters. - - * mail-local.c (mail_local_folder_reconfigure): Change the store - path to be same as parent + mbox to be full path. - (mls_delete_folder): Change store path to be parent path, and mbox - to be full path. - (mail_local_folder_reconfigure): Fix a leak of tmpname. - (mls_delete_folder): Unref the store when done. - (mls_rename_folder): Fix implementation, shell already created - destination folder, so we can't just rename :( - - * component-factory.c (xfer_folder): Only do a rename if we have - remove set, cleaned up logic a bit. - (idle_quit): Put the components still active check last last of - all. - (storage_create_folder): IF we have a fragment, use that as part - part for parent. - (xfer_folder): Manually call rename code, since the shell will do - a remove/add later on, AND there's no way we can determine the new - path from the crock of an api we have to work with. - -2001-10-27 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (mail_format_get_data_wrapper_text): Allow the - user to shoot him/herself in the foot when overriding message - charsets. Permanantly fixes bug #921. - -2001-10-26 Dan Winship <danw@ximian.com> - - * folder-browser.c (etree_key): Work around something that we - think is a GtkHTML bug, where sometimes the adjustments have - slightly bogus values and scrolling ends up working backwards. - (Ximian 4939) - - * mail-display.c (do_signature, do_attachment_header): Set the - icon to be 24x24 here so that (assuming it's not a thumbnail), no - resizes will have to be queued later. (There's still a bug with - the text to the left of the button being drawn twice for some - reason though.) - - * mail-callbacks.c (delete_msg): Fix a bug here that makes - deleting multiple messages cause a gratuitous message body fetch. - (Ximian 12355) - -2001-10-25 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (providers_config): Set the GdkWindow of the - FolderBrowser, not the GtkWindow... - -2001-10-26 <NotZed@Ximian.com> - - * mail-local.c (mlf_set_folder): Changed to open the source store - from '/', so we can do renames across directories. Of course, - this doesn't quite work with different filesystems, but we'll - assume this isn't a problem we're going to have. - (mail_local_folder_get_type): Setup parent_class. - (mlf_rename): Implement folder rename call, rename internal data. - - Is this a security issue? Well, not really, no more than anything - else. - - * mail-folder-cache.c (mail_note_store): Listen to rename event. - (store_folder_renamed): Function to handle it, empty. - (mail_note_store_remove): Unhook from rename event. - (mail_note_folder): Hook onto renamed event. - (unset_folder_info): Unhook from renamed event. - (folder_finalised): Lock around update. - (folder_deleted): Lock around update. - (real_flush_updates): If we have a path to remove remove it. - (rename_folders): Scan folderinfo's, if we can find ones renamed, - rename them, otherwise add them. - - * component-factory.c (owner_unset_cb): Use a timeout not an idle - handler. - (storage_xfer_folder): Implementation of xfer_folder signal - handler, so we can rename imap/vfolders/etc. - - * component-factory.c (owner_unset_cb): Use a timeout not an idle - handler. - - * mail-callbacks.c (providers_config): Only set the parent window. - - * mail-accounts.c (mail_edit): Set the parent on the account editor. - -2001-10-25 <NotZed@Ximian.com> - - * openpgp-utils.c (openpgp_verify): s/iconv/e_iconv/. - -2001-10-25 Jeffrey Stedfast <fejj@ximian.com> - - * mail-ops.c (send_mail_free): Don't forget to unref the filter - driver here. - -2001-10-25 <NotZed@Ximian.com> - - * folder-browser-ui.c (fbui_sensitize_timeout): So apparently the - uicomp can just 'vanish' while we're using it. Joy. Take care of - that case here, fixes #13482. - (fbui_sensitise_item): Check here too just for kicks. - - * mail-folder-cache.c (store_finalised): If we can't destroy our - async event, then queue another one to do it. - (store_finalised_finish): And handle it here, until we can, then - free it. - (mail_note_store): Queue an async event to get folderinfo, dont - use mail_get_folderinfo. - (update_folders_get): thread-async event to retrieve the - folderinfo, and build it, then queues gui-async event to update - the gui. - (add_unmatched_info): Taken from mail-ops, adds unmatched if - required. - (add_vtrash_info): From mail-ops, add trash if required. - (update_folders): Thread async event to update gui. - (mail_note_store): Ref the store and storage when created. - (update_1folder): Changed to assume we have info_lock, and store - updates in an updates list. - (setup_folder): Same. - (folder_changed): Changed to call update_1folder directly. - (real_folder_changed): Removed. - (mail_note_folder): Changed to call update_1folder directly. - (real_note_folder): Removed. - (store_folder_subscribed): Call setup_folder directly. - (real_folder_created): Removed. - (real_flush_update): Function that actually does the updates in - the gui thread. - (mail_note_store): Go back to using mail_get_folderinfo. - (update_folders): Fixed upf ro changed api's. - (unset_folder_info): Changed to queue pending updates. - (real_folder_deleted): Removed. - (store_folder_unsubscribed): Do the removal work directly. - (mail_note_store): Dont link to finalised event of store - we now - ref it. - (mail_note_store_remove): If we have any pending updates, clear - them out. Also cancel any pending folderinfo retrieve operations. - (update_folders): Remove our update from the storeinfo list, if it - still exists. - (update_1folder): Make 'sent folder shows all counts' optional via - an environmental variable EVOLUTION_COUNT_SENT for all those - bloody whinging lusers out there. - (mail_note_store_remove): Unref the storage when done. - - * mail-mt.c (mail_async_event_emit): If we're in main and have a - gui task, set it to run via an idle function. - (idle_async_event): Wrapper for calling do_async_event from idle - function, and freeing the message when done. - (idle_async_event): Call mail_msg_free not free on the finished - message. - - * component-factory.c (mail_remove_storage): Destroy the storage - async. - (store_disconnect): This does the work. - (free_storage): Un-note the store when we remove it, so the store - noting code can unref things properly. - (idle_quit): Return false when done, dont loop. - -2001-10-24 <NotZed@Ximian.com> - - * component-factory.c (owner_set_cb): Setup an async_event - handler. - (idle_quit): Try to destroy the async_event, or keep dropping out - if it can't (deadlock). - - * mail-mt.c (do_async_event): Set the threadid of the thread we're - running in so we know its running/which thread its in. - (mail_async_event_emit): Added new argument 'type' which is the - type of thread to execute against, gui or another one. Fixed all - callers. - (mail_async_event_destroy): Return -1 if this operation will fail - (deadlock possibility). If we're in the thread of the task - we're going to wait for, then return a failure (since we will - deadlock). - (mail_async_event_emit): Changed to use MailAsyncFunc type as the - function type, which just takes 3 void args, change args to suit. - - * mail-folder-cache.c (mail_note_store): Record the pending update - events in a pending list. We should really be able to use an - async event for this, but that doesn't return to the gui loop when - done :-/ - (update_folders): Remove from pending update when done. - -2001-10-25 Jeffrey Stedfast <fejj@ximian.com> - - * mail-send-recv.c (get_receive_type): Check for a NULL provider. - (build_dialogue): Check for invalid source urls. - (mail_receive_uri): Same. - -2001-10-24 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (mail_generate_reply): No longer need to pass a - settext argument. - (do_forward_non_attached): Same. - - * mail-format.c (mail_get_message_body): Fix to not always return - NULL for html parts, doh!. - -2001-10-24 <NotZed@Ximian.com> - - * folder-browser-ui.c (ui_add): - (fbui_sensitize_timeout): Same. - - * folder-browser-factory.c (control_activate): Comment out freeze/thaw. - (control_deactivate): - -2001-10-24 Jon Trowbridge <trow@ximian.com> - - * mail-search.c (mail_search_construct): Fixed some weird casting - crack that got in here somehow, removed superfluous box-packing - that was generating a gtk warning. - -2001-10-23 Jeffrey Stedfast <fejj@ximian.com> - - * component-factory.c (owner_unset_cb): Unref the global - search_context. - (owner_set_cb): create the global search_context. - - * folder-browser.c (folder_browser_gui_init): Pass along the - global search_context to the e_filter_bar_new call. - -2001-10-24 <NotZed@Ximian.com> - - * message-browser.c (message_browser_message_loaded): Call - ui_message_loaded when we are. - - * folder-browser-factory.c (control_activate): Freeze/thaw around - all updates. - (control_deactivate): Freeze/thaw around all updates. - - * folder-browser.c (folder_browser_init): Setup a hashtable to - keep track of *our* sensitise state, so we can optimise pushes to - bonobo. - (folder_browser_finalise): Free hash here. - (folder_browser_set_message_preview): Call a ui_message_loaded, - even though it isn't, so it updates sensitivities right. - (done_message_selected): Call ui_message_loaded when it really is, - rather than the very fucked up idea of reversing the loaded_uid - check. - - * folder-browser-ui.c (folder_browser_ui_set_selection_state): - Dont enable the message-enabled options if the message display is - hidden, e.g. print, view headers, etc. - (folder_browser_ui_rm_all): Forget sensitise state. - (fbui_sensitise_item): Sensitise items via a current-state table, - so we dont have to do bonobo calls every time. - (folder_browser_setup_property_menu): Call sensitise_item. - (folder_browser_ui_add_message): - (folder_browser_ui_add_global): Leave current set_prop "sensitive" - for the stop button, so it doesn't get lost by the stuff in - mail-mt.c - (fbui_real_sensitize_items): Removed. - (fbui_sensitize_timeout): Cleaned up, use sensitise_item to do - work. - (folder_browser_ui_message_loaded): Setup sensitive based on - preview_shown too. - (folder_browser_ui_set_selection_state): And here too. - -2001-10-23 Jeffrey Stedfast <fejj@ximian.com> - - * mail-account-gui.c (service_check_supported): Don't allow an - auth-type to be set when saving the service. - (mail_account_gui_new): Initialize the source and transport - provider_type's here so we don't forget to do it when it matters. - (mail_account_gui_setup): Don't bother setting the provider_type's - here, they are already set in mail_account_gui_new() now. - -2001-10-23 <NotZed@Ximian.com> - - * mail-display.c (mail_display_destroy): Remove the idle_id when - we're destroyed so the idle func doesn't run on an invalid object. - - * message-list.c (regen_list_regened): Dont do anything if we're - destroyed #13021. - - * mail-mt.c (mail_user_message): - (mail_get_password): Removed, all functionality moved to - mail-session. - - * mail-config.c (mail_config_write_on_exit): Check - threaded/preview hash is null before using it, its setup on demand - so itmight nto be initialised here. - - * mail-session.c (request_password): Remove password_current - stuff. - (alert_user): Redont, similar to get_pass. Do things as async as - possible, and dont even wait for a response if we're not asking - for the cancel button (this may or may not be right behaviour - - need to check). mail_user_message() code replaced from the stuff - in mail-mt.c - (MailSession): Added a lock field. - (init): Setup lock. - (finalise): fRee lock. - (register_timeout): Redone. We now allocate our own 'timeoutid's, - and <> to the real things asynchronously. Use async_event's so we - can make sure we have no outstanding ones after shutdown. - (mail_session_enable_interaction): If interaction has been - disabled, and we have either a message-box open, or a password - request open and/or any pending message boxes/passwords, blow 'em - away. - (main_register_timeout): If we have pending remove of this same - timeout, dont do anything. - (timeout_timeout): Properly honour the result, remove the timout - if it returns false. - (do_user_message): Setup the message_destroy_id when we setup the - destroy handler so it doesn't get called twice. - -2001-10-23 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (reply_to_sender): Make sure the fb and it's - message-list exist. - (reply_to_list): same. - (reply_to_all): And here... - (forward_message): Here too. - (forward_attached): Again here. - (transfer_msg): Here too. - (apply_filters): Same. - (select_all): Yet again here... - (select_thread): And here. - (invert_selection): Same. - (flag_messages): Here too. - (mark_as_unseen): and here... - (mark_all_as_seen): ... - (zoom_in): - (zoom_out): - (zoom_reset): - (search_msg): - (load_images): - (save_msg): - (next_msg): - (next_flagged_msg): - (next_unread_msg): - (previous_msg): - (previous_unread_msg): - (expunge_folder): - (configure_folder): - (empty_trash): - -2001-10-23 <NotZed@Ximian.com> - - * mail-mt.c: Added missing errno.h - (mail_msg_new): Fix the logic a bit, dont try to open the log file - unless logging is actually requested. - (mail_enable_stop, mail_disable_stop, do_set_busy, - mail_operation_statys): Dont bother propagating events if - global_shell_client isn't up yet. - -2001-10-23 Dan Winship <danw@ximian.com> - - * mail-mt.c (mail_msg_new): If the fopen() fails (eg, because - evolution-mail was started by oafd with PWD=/), don't try to use - the NULL file handle. - -2001-10-23 <NotZed@Ximian.com> - - * mail-session.c (get_password): Completely re-done. We now hae a - completely async dialogue when requested from antoehr thread, and - dont use gtk_main() if we can avoid it (which is normally the - case). This stuff is only partially finished, and will mena the - removal of the same from mail-mt.c, and the mail_user_message() - code will be moved here and changed to work in a similar way. - - * mail-callbacks.c (empty_trash): Dont try and connect to remote - stores just to get the trash. Also, always run empty trash async, - and make sure we unref the trash. - (empty_trash): Hmm, dont unref the trash, causes a problem on - exit, i suspect something else is doing funky unrefs on it. - - * mail-tools.c (mail_tool_get_trash): Pass a 'connect' arg, tell - it whether it should tryand connect or not to the parent service, - if it isn't already connected. - - * component-factory.c (owner_unset_cb): Dont try wait_all here, - could potentially deadlock. - (idle_quit): Keep returning TRUE if we have outstanding - processing. Note that this may busy-wait during exit processign - with busy tasks :( - (idle_quit): Keep calling ourselves till we no longer get called - (i.e. gtk_main really quits). - - * mail-mt.c (mail_msg_active): New function, returns TRUE if - events are still active/outstanding. - (do_op_status): @$@$#@@!#@!! didn't unlock the mail_msg_lock if - data->activity was NULL and we had no global_shell_client anymore! - Also shortcut processing if this is going to be the case. - (mail_msg_init): Setup a temporary other gui_port for redoing with - new semantics password, user message and progress reporting. - (mail_get_password): #ifdef'd out all this code temporarily, till - it gets fully moved to mail-session.c - -2001-10-22 <NotZed@Ximian.com> - - * component-factory.c (owner_set_cb): Dont call enable_interaction - here. - (interactive_cb): But here instead, let the shell tell us when its - ok to go interactive. - -2001-10-22 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (write_one_text_plain_chunk): Oops, revert my - change to this function. - - * mail-display.h (mail_html_write_string): New fun macro. - - * mail-format.c (write_one_text_plain_chunk): Use gtk_html_write - instead of mail_html_write so we avoid strdup'ing the text. - (handle_text_plain_flowed): Use the mail_html_write_string macro. - (handle_message_rfc822): Here too. - (mail_format_raw_message): We can do it here also... - (attachment_header): We can do it a little bit here... - (write_address): A microscopic bit here... - (write_hr): same. - -2001-10-22 Anna Marie Dirks <anna@ximian.com> - - * mail-config.glade: Added several new accelerators to the edit account - dialog, and fixed the focus targets on all existing accelerators. I - was hoping that since the widgets used in the account editor are also - used in the first-time start-up druid and them mail-config druid, - that this would fix all accelerator problems for those druids as well, - but there is something wrong with Bonobo which is preventing - the druids from responding to their accelerators. Sigh. Anyway, - most accelerators in the edit account dialog work correctly - now, though there are few (such as _Full Name) which fail to - do anything. I don't know why. - -2001-10-22 Jeffrey Stedfast <fejj@ximian.com> - - * mail-stream-gtkhtml.c (mail_stream_gtkhtml_new): New class that - wraps writing to a GtkHTML stream so that we don't have to write - to an intermediate GByteArray. - - * mail-display.c (on_url_requested): Use the new Camel->GtkHTML - stream - this means we don't have to chew up nearly as much - memory...yay! - (try_part_urls): Here too. - -2001-10-22 Ettore Perazzoli <ettore@ximian.com> - - * mail-mt.c (do_op_status): Don't free `clientid' as it's - uninitialized. - -2001-10-22 Christopher James Lahey <clahey@ximian.com> - - * message-list.etspec (Score): disable this column. Fixes Ximian - bug #12381. - -2001-10-22 Ettore Perazzoli <ettore@ximian.com> - - * mail-mt.c: #include "component-factory.h". - (do_op_status): Pass the component ID instead of the msg ID. - - * component-factory.h (COMPONENT_ID): #define here instead of - `component-factory.c'. - (SUMMARY_FACTORY_ID): Likewise. - -2001-10-22 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (format_mime_part): Don't wrap error text with - <blockquote>, this is done inside mail_error_write. - (handle_multipart_encrypted): If we get an exception trying to - decrypt the mime part, display an error rather than trying to - treat it as multipart/mixed. - - * mail-callbacks.c (empty_trash): Confirm expunge. - - * folder-browser.c (folder_browser_destroy): Move the folder sync - code along with a few other things from folder_browser_finalise() - into here instead. - (folder_browser_finalise): Moved some cleanup functions into - destroy. - -2001-10-22 Dan Winship <danw@ximian.com> - - PGP verification UI changes to make it not HTML spoofable. - - * mail-format.c (handle_application_pgp): Remove this unused - hack. - (mail_format_mime_message): Initialize a fourth hash table, used - to keep track of fake MIME parts. - (mail_part_set_default_displayed_inline): New routine to set the - default disposition of a part (doesn't change it if the user has - already overridden it). - (format_mime_part): Wrap a blockquote around the error text (moved - here from mail_error_write since it doesn't apply in other cases). - (write_hr): Write a <hr> with appropriate padding between MIME - parts. - (write_one_text_plain_chunk): Write some plain text with - appropriate margins. - (handle_text_plain): Use write_one_text_plain_chunk. Update for - inline specials handler API change. - (fake_mime_part_from_data): Use the "fake_parts" hash to avoid - recreating the same fake parts again if the message is - redisplayed. Lets you toggle the shown/hiddenness of uudecode - parts, and do the new pgp verification thing for inline pgp - signatures. - (try_inline_pgp): Don't do any actual PGP handling here: Just - rewrite as a multipart/encrypted. - (try_inline_pgp_sig): Likewise, just do a multipart/signed (with - the x-inline-pgp-hack parameter set). - (try_uudecoding, try_inline_binhex): Update for API changes. - (handle_multipart_signed): Exciting and new. Use <object> to - create a button which the user must click to do the - verification. Change the formatting of the gpg output text a bit. - - * mail-display.c (on_link_clicked): Remove x-evolution-decode-pgp - hack, which is no longer used. - (pixbuf_gen_idle): Add a hack for the PGP verification button. - (do_attachment_header, do_external_viewer): Split out of - on_object_requeested for clarity. - (do_signature): New routine to do the PGP verification button. - (on_object_requested): Now just dispatches to - do_attachment_header, do_external_viewer, or do_signature. - (mail_error_write): Don't do <blockquote> here. Fixed the problem - that was trying to fix elsewhere. - -2001-10-22 Dan Winship <danw@ximian.com> - - * mail-callbacks.c (transfer_msg): Fix these functions so they - don't crash evolution-mail. Too bad it still crashes in the - shell. - -2001-10-21 Jeffrey Stedfast <fejj@ximian.com> - - * mail-display.c (on_url_requested): Use - mail_format_get_data_wrapper_text for text parts so we get free - charset conversion. - - * mail-format.c (mail_format_get_data_wrapper_text): Renamed from - get_data_wrapper_text and now returns a GByteArray. - (handle_text_plain): Updated to use the new get_data_wrapper_text. - (handle_application_pgp): Same. Wow...also fixed a mem leak and - made a bit more efficient by doing so. - (handle_text_enriched): Here too. Also use string->len instead of - strlen (string->str). - (mail_format_raw_message): Same. - -2001-10-22 <NotZed@Ximian.com> - - * mail-callbacks.c (mark_all_as_seen): Instead of select_all() - then using the tree's selected nodes to iterate, just do it on the - folder which keeps the current selection. Fixes #3658. - -2001-10-21 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser.c: Call the new move/copy_msg_cb's - - * mail-callbacks.c (move_msg_cb): Renamed from move_msg. - (copy_msg_cb): Renamed from copy_msg. - (move_msg): The bonobo-ui-component callback. - (copy_msg): Same. - -2001-10-21 <NotZed@Ximian.com> - - * mail-vfolder.c (mail_vfolder_shutdown): Clear variables once - done, for debugging. - (mail_vfolder_add_uri, mail_vfolder_delete_uri): Dont do anything - if we're shutdown (context == NULL). - - * component-factory.c (idle_quit): Move mail_vfolder_shutdown - here, it should be one of the last things shutdown. - - * mail-format.c (handle_text_plain): Dont use (if (!p++), and then - check p!= later, since its now 1, oops. Fixes #13106, thought it - was a start of uuencoded stuff! - - * folder-browser.c (on_right_click): Escape _'s before adding them - to menu from mailing list name, also remove some dead code that - someone forgot to remove when refactoring. #11307. - (folder_browser_is_drafts): Use the store's uri_cmp function to - compare to the drafts uri's. - (folder_browser_is_sent): Same. Slight cleanup for #11351. - -2001-10-21 Dan Winship <danw@ximian.com> - - * mail-callbacks.c (mail_generate_reply): Update for - e_msg_composer_add_messages_attachments arg change. - (do_forward_non_attached): Likewise. - -2001-10-20 Jon Trowbridge <trow@ximian.com> - - * mail-display.c (mail_display_new): Don't leak our - ESearchingTokenizer. - -2001-10-20 Larry Ewing <lewing@ximian.com> - - * folder-browser-ui.c: hook up zoom functions. - - * mail-callbacks.h: add prototypes. - - * mail-callbacks.c (zoom_in): added. - (zoom_out): added. - (zoom_reset): added. - -2001-10-19 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (transfer_msg): Allow copy/move to/from vTrash - folders as well. - - * component-factory.c (destination_folder_handle_drop): Properly - handle local vTrash folders. - -2001-10-19 <NotZed@Ximian.com> - - * mail-account-gui.c (build_auth_menu): Dont translate camel strings. - (mail_account_gui_setup): " - -2001-10-19 Ettore Perazzoli <ettore@ximian.com> - - * component-factory.c (destination_folder_handle_motion): Get - @folder_type here too [to match the changes in the - EvolutionShellComponentDnd interface]. Also, remove a debugging - message. - (destination_folder_handle_drop): Likewise. - -2001-10-19 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (mail_generate_reply): Update to reflect API - changes to e_msg_composer_add_message_attachments(). - (do_forward_non_attached): Same. - (providers_config): Oops, pass a GdkWindow instead of a GtkWindow. - -2001-10-19 <NotZed@Ximian.com> - - * mail-folder-cache.c (store_finalised): Free folders_uri. - (real_folder_deleted): If folder is deleted, remove it from the - hashtables. - -2001-10-18 <NotZed@Ximian.com> - - * subscribe-dialog.c (get_short_folderinfo_get): Remove the - register/unregister, they're already done above us. - - * mail-vfolder.c (vfolder_adduri): Added remove flag - its not - adduri, its removeuri, its less typing than creating a removeuri. - (vfolder_adduri_do): Implement the remove flag. - (mail_vfolder_remove_uri): Changed to mail_vfolder_delte_uri, to - indicate its actually been deleted. - (mail_vfolder_add_uri): Added remove flag. - (rule_changed): When adding existing folders to a new rule, strdup - the list data. - (mail_vfolder_delete_uri): Dont do any work to remove the actual - folder from the vfolder (we'd have to look it up first), let the - vfolder remove it itself. Just update the rules. - - * mail-folder-cache.c (store_finalised): Unhook from all events - when done. - (mail_note_store_remove): Remove a store from being noted. - (free_folder_info): Also if we have a folder, unhook all events. - Also remove the uri from vfolders. - (mail_note_folder): Remove warning about adding folders to stores - that aren't added yet - we might actually be removing the store. - - * component-factory.c (mail_remove_storage): Call - mail_note_store_remove when we remove the storage. - -2001-10-18 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (providers_config): Don't make the mail - settings dialog modal. - -2001-10-17 Ettore Perazzoli <ettore@ximian.com> - - * mail-account-gui.c (folder_picker_clicked): Pass the toplevel to - `evolution_shell_client_user_select_folder()'. - * mail-callbacks.c (transfer_msg): Likewise. - -2001-10-18 <NotZed@Ximian.com> - - * mail-send-recv.c (build_dialogue): call setup_send_data *after* - we've setup the global dialogue thingy. - (mail_send_receive): Instead of using static local to check for - re-running of dialogue, use a global, setup by build_dialogue. - These fix #12335. - (mail_send_receive): Dont assert dialogue is realized, it might - still be being built, so only show if it is realized. - -2001-10-18 Dan Winship <danw@ximian.com> - - * mail-mt.c (mail_call_main): Use G_VA_COPY to make this compile - on ppc again. - (do_call): Here too. - -2001-10-17 <NotZed@Ximian.com> - - * mail-folder-cache.c (store_folder_subscribed): Clone the - folderinfo before passing to async event. - (real_folder_created): Free when done. - (store_folder_unsubscribed): - (real_folder_deleted): And same here. - - * mail-ops.c (mail_expunge_folder): Use the queued thread for - expunging folders. - -2001-10-17 Jeffrey Stedfast <fejj@ximian.com> - - * mail-ops.c (mail_send_message): No longer need to copy the - description now that camel-exceptions have been fixed. - - * subscribe-dialog.h (subscribe_dialog_show): Helper macro. - - * subscribe-dialog.c (subscribe_dialog_run_and_close): Removed. - - * mail-callbacks.c (check_send_configuration): Don't use - gnome_dialog_run_and_close() here, we can easily get away with - just using a gtk_widget_show(). - (providers_config): Don't use a gnome_dialog_run_and_close() here - either. No longer need to use e_gnome_dialog utils. - (manage_subscriptions): Don't run_and_close(). - -2001-10-17 <NotZed@Ximian.com> - - * mail-callbacks.c (empty_trash): Only empty trash on enabled - accounts, fixes #12821. - -2001-10-17 Dan Winship <danw@ximian.com> - - * mail-format.c (write_default_header): Make Reply-To bold too - since no one ever figures out why it's not currently. - -2001-10-17 Iain Holmes <iain@ximian.com> - - * importers/evolution-mbox-importer.c: Fix the typo. - -2001-10-16 Jeffrey Stedfast <fejj@ximian.com> - - * mail-ops.c (uid_cachename_hack): Lets put the UID cache in - ~/evolution/mail/pop3 as this makes more sense than ~/mail/config - does. Perform checking to see what flavor cache-path the user is - on and compensate. - - * message-list.c (on_cursor_activated_idle): Check that the - cursor_uid is non-NULL before emitting a "message_selected" - signal. Fixes bug #6015. - -2001-10-16 Jon Trowbridge <trow@ximian.com> - - * e-searching-tokenizer.c (e_searching_tokenizer_begin): Always - explicitly clear out the SearchInfo. - -2001-10-16 <NotZed@Ximian.com> - - * mail-folder-cache.c: Added an async_event handler to store_info. - (mail_note_store): Setup async event handler here. - (store_finalised): Flush out async events here. - (folder_changed): Use async event handler to emit event. - (mail_note_folder): Chagned, do most of the work in the calling - context, only do the corba stuff in main. - (store_folder_subscribed): Use async event, and do more work locally. - (store_folder_unsubscribed): Same. - (store_folder_deleted): Call store_folder_unsubscribed if we have - to do any work. - (store_folder_created): Call store_folder_subscribed if we have to - do any work. - (store_folder_unsubscribed): Ref store while busy. - (real_folder_deleted): And unref here. - (store_folder_subscribed): Reg store while busy. - (real_folder_created): Unref here. - (mail_note_folder): Ref folder while busy. - (real_note_folder): And unref here. - (mail_note_folder): Hook onto folder_deleted event. - (folder_deleted): Just mark this folder as no longer available. - - * mail-session.c (register_timeout): Use mail_call_main instead of - proxy_event. - (remove_timeout): Same here. - - * folder-browser.c (folder_changed): use the new mail_async_event - stuff. - (folder_changed_main): Remove old async event handling stuff. - (FOLDER_BROWSER_LOCK/UNLOCK): Removed. - (FolderBrowserPrivate): Removed too, sigh. - (folder_browser_set_message_preview): Return do nothing if we're - destroyed (message_list == NULL). - (folder_browser_search_query_changed): " - (folder_browser_toggle_preview): " - (folder_browser_toggle_threads): " - (folder_browser_toggle_hide_deleted): " - (folder_browser_set_message_display_style): " - (folder_browser_charset_changed): " All for #12613. - - * mail-mt.c (mail_async_event_new, mail_async_event_emit, - mail_async_event_destroy): New functions to handle async events. - (mail_proxy_event, mail_proxy_event_id): Removed old functions for - async events. - (do_call): Add suport for MAIL_CALL_p_pp. - (mail_msg_free): Use mail_async_event instead of proxy_event. - - * message-list.c (message_changed): Promote the message_changed to - a folder_changed and use main_folder_changed to process it. - (main_message_changed): Remove.d - (message_list_init): Setup async event handler. - (message_list_destroy): Remove async handler. - (folder_changed): Use async hanler to emit event in main loop. - (message_changed): Same. - - * mail-mt.c (mail_proxy_event_id): New function to return the id - of the currently executing proxied event. - - * folder-browser.h: Added private field. - - * folder-browser.c (folder_changed): Keep track of tasks - outstanding in the tasks list, locked access. - (FOLDER_BROWSER_LOCK, UNLOCK): Macros to lock the folder browser - for poking about in diff threads. - (folder_browser_finalise): Wait for any outstanding takss to - finish before cleaning ourself up. - (folder_browser_destroy): Move the seen_id handling to finalise, - also add a loading_id handling code. - (main_folder_changed): Remove our running task when done. - -2001-10-15 Larry Ewing <lewing@ximian.com> - - * mail-display.c (mail_error_write): don't write strings longer - than they actually are. - -2001-10-15 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser.c (folder_browser_destroy): Remove the mark_seen - timeout. - -2001-10-15 Larry Ewing <lewing@ximian.com> - - * mail-callbacks.c (mail_generate_reply): don't apply the body - text in replys since we will just replace it anyway. - -2001-10-15 Jeffrey Stedfast <fejj@ximian.com> - - * component-factory.c (owner_unset_cb): Call - mail_vfolder_shutdown. - - * mail-vfolder.c (mail_vfolder_shutdown): Unref all of our - VFolders. - - * mail-folder-cache.c (real_note_folder): Remember to unref the - folder before returning if we have already noted this folder. - -2001-10-15 <NotZed@Ximian.com> - - * mail-session.c (get_password): Proxy get-password call to main - thread. - (forget_password): same for forget_password. - (get_filter_driver): and same for get_filter_driver, since it uses - gtk objects. - - * mail-mt.c (mail_call_main): new generic interface for calling - stuff/proxying in the gui thread. - -2001-10-14 Jon Trowbridge <trow@ximian.com> - - * e-searching-tokenizer.c (e_searching_tokenizer_clone): Share - more state between the parent and its clones, so that our multiple - tokenizers don't get out of sync when we are rendering frames and - iframes. (Bug #11638) - -2001-10-13 Jon Trowbridge <trow@ximian.com> - - * e-searching-tokenizer.c (search_info_compare): Bad hacker! - Don't implicitly assume that utf8 characters are one byte in size! - (Bug #9520) - (e_searching_tokenizer_begin): As long as I'm touching those code: - don't increase the size of search matches. I'll fix the colors - later. (part of bug #11589) - -2001-10-13 Dan Winship <danw@ximian.com> - - * mail-callbacks.c (create_msg_composer): Don't emit a gtk warning - if the composer creation fails. - -2001-10-12 Dan Winship <danw@ximian.com> - - * message-list.c, message-list.h, message-list.etspec: Revert the - change to remove the Score column until Chris can fix ETable so - it's possible to remove a column without breaking everyone's - exisiting settings. - -2001-10-12 Iain Holmes <iain@ximian.com> - - * importers/evolution-mbox-importer.c (load_file_fn): Don't ever create - the folder here. Wait until the shell has created it. Otherwise we get - loads of race conditions where the mailer can create a subfolder before - the shell has registered the parent. - -2001-10-12 Chris Toshok <toshok@ximian.com> - - * main.c (main): call e_passwords_init and e_passwords_shutdown. - - * mail-session.h: add prototypes for - mail_session_{get,add}_password. - - * mail-session.c (init): empty this out - we use e_passwords - instead of a local hashtable. - (get_password): use e_passwords_get_password and - e_passwords_add_password. - (forget_password): use e_passwords_forget_password. - (mail_session_remember_password): use - e_passwords_remember_password. - (mail_session_forget_password): use e_passwords_forget_password. - (mail_session_get_password): new function, use - e_passwords_get_password. - (mail_session_add_password): same, use e_passwords_add_password. - (mail_session_forget_passwords): use e_passwords_forget_passwords. - - * mail-config.c (mail_config_write_on_exit): fix this up so it - works as desired with the e_passwords stuff. - -2001-10-12 Jeffrey Stedfast <fejj@ximian.com> - - * mail-display.c (mail_error_write): Convert URLS so we can get - clickable links. - - * message-list.c: Removed score stuff. - -2001-10-12 Jon Trowbridge <trow@ximian.com> - - * mail-display.c (html_button_press_event): Store our listener id. - (popup_info_free): Disconnect our listener when we free the popup. - (Bug #11040) - -2001-10-11 Jon Trowbridge <trow@ximian.com> - - * mail-callbacks.c (addrbook_sender): Listen for "destroy" events - from the control, so that we don't leave stray windows laying - around. (Bug #9101) - -2001-10-11 <NotZed@Ximian.com> - - * local-config.glade: Added a checkbox for body indexing. - - * mail-local.c (mail_local_reconfigure_folder): Get index_body - widget. - (mail_local_folder_reconfigure): Add an 'index_body' argument & - implement. Dont do anything if nothing changed. - - * openpgp-utils.c (openpgp_verify): Use e_iconv_open. - -2001-10-11 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (do_forward_non_attached): Attach the message - attachments. Fixes bug #5439. - -2001-10-11 Dan Winship <danw@ximian.com> - - * mail-folder-cache.c (update_1folder): No longer need to pass - folder display name to storage update_folder methods. - (setup_folder, free_folder_info): Meaning we no longer need to - keep track of it. - - * evolution-outlook-importer.[ch], evolution-mbox-importer.[ch]: - These copies are cruft. The real ones are in importers/. - -2001-10-11 Jeffrey Stedfast <fejj@ximian.com> - - * component-factory.c (free_storage): Make sure the - service/storage are non-NULL. - - * mail-callbacks.c (e_gnome_dialog_parent_destroyed): Call - gtk_main_quit. - (send_receive_mail): Don't use e_gnome stuff since this doesn't - need to be run using gnome_dialog_run_and_close(). - (composer_send_cb): Same. - (edit_msg): Here too. - (resend_msg): And here. - (search_msg): Same. - (filter_edit): Here too. - (filter_edit): Don't use e_gnome_dialog_set_parent() because we - don't do gnome_dialog_run_and_close on this dialog. - (e_gnome_error_dialog_parented): Removed. - (e_gnome_ok_dialog_parented): Removed. - -2001-10-10 Dan Winship <danw@ximian.com> - - * mail-config.c (new_source_created): Fix up the logic here. - -2001-10-10 Larry Ewing <lewing@ximian.com> - - * mail-callbacks.c (mail_generate_reply): use new function to copy - the attachments from the source message. This still isn't perfect - but it should avoid the problems with headers being transfered. - This makes images in replies work again. - - * mail-display.c (save_url): copy the data. We can't ref the byte - array and we can't free it so we have to copy it. - -2001-10-10 <NotZed@Ximian.com> - - * mail-ops.c (transfer_messages_transfer): IF the source and - destination folders are the same, do nothing. Oh, and return an - error, otherwise the shell goes and removes it anyway. Fixes a - rather serious bug with dnd of folders onto their current - location. - -2001-10-09 Larry Ewing <lewing@ximian.com> - - * mail-display.c (save_part): ref the part. - (save_destroy_cb): new function to unref the part when we have - closed the dialog. - (save_url): fake a mime part so that we can save data urls without - extra effort. This is less sucky than it seems since it handles - filenames and ref counting with minimal fuss. - -2001-10-09 <NotZed@Ximian.com> - - * component-factory.c (owner_unset_cb): Disconnect from all the - signals we were listening to, so we dont try and do shit twice on - exit (one on unset_cb, one on destroy). - (create_component): Setup the signal handlers using a table, so - they're easier to disconnect on finish. - - * mail-folder-cache.c (folder_changed): Ref folder so it hangs - around till we're done with it. - (real_folder_changed): Unref folder when we are done with it. - Should fix #11981. - -2001-10-09 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser.c (done_message_selected): Make sure the - mail-display is non-NULL. - -2001-10-09 <NotZed@Ximian.com> - - * mail-local.c (mlf_search_by_uids): Implement. - -2001-10-09 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser-ui.c (folder_browser_ui_add_message): Create a - chaqrset picker submenu in the View menu. - - * mail-format.c (mail_format_raw_message): Pass the mail-display - to get_data_wrapper_text. - (get_data_wrapper_text): Use the user's override charset if one is - provided, otherwise user the user's default charset. - (handle_text_plain): Pass along the mail-display to - get_data_wrapper_text. - (handle_application_pgp): Same. - (handle_text_enriched): Here too. - (mail_get_message_body): Pass NULL as the mail-display to - get_data_wrapper_text since we don't have access to a - mail-display. - - * mail-display.c (mail_display_set_charset): New function to set a - charset on the maildisplay. Once set, the message is redisplayed - using the new charset. - (mail_display_destroy): Free the charset. - - * folder-browser.c (folder_browser_charset_changed): New callback - for when a user overrides the message charset. - -2001-10-09 Dan Winship <danw@ximian.com> - - * mail-callbacks.c (e_gnome_dialog_set_parent): Use - gtk_signal_connect_while_alive here so - e_gnome_dialog_parent_destroyed doesn't get called on an - already-destroyed dialog. - - * mail-config-druid.c (*_prepare): Record which page we're - currently in. - (*_changed): Only update the druid buttons if we're the current - page. Fixes a problem that could make it impossible to get beyond - the first page of the setup wizard. - - * mail-callbacks.c (mail_generate_reply): Revert the change to use - e_msg_composer_new_with_message. That has unwanted side effects. - (This commit re-breaks replying to HTML messages with inline - images.) - -2001-10-08 Dan Winship <danw@ximian.com> - - * mail-local.c (mlf_set_folder, mlf_unset_folder): Update for - folder_flags. - - * folder-browser-ui.c (folder_browser_ui_add_list): Check - CAMEL_FOLDER_IS_TRASH flag rather than checking - CAMEL_IS_VTRASH_FOLDER. - - * folder-browser.c (folder_browser_toggle_hide_deleted): Likewise - - * message-list.c (message_list_set_folder): Likewise. - (message_list_set_hidedeleted): Remove redundant trash check. - -2001-10-08 Jon Trowbridge <trow@ximian.com> - - * mail-format.c (write_default_header): Write out the Bcc: header - when applicable. Fixes bug #5823. - -2001-10-08 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (attachment_header): Convert the htmlinfo into - utf8. Fixes bug #11966. - -2001-10-08 Dan Winship <danw@ximian.com> - - * component-factory.c (create_view): For mailstorage folders, - connect to the control's "activate" signal, and don't try to - connect to the store. - (storage_activate): Instead, do it here, so if the connection - fails, or the user cancels, or whatever else, he can try again - later. - -2001-10-07 Dan Winship <danw@ximian.com> - - * mail-tools.c (mail_tool_do_movemail): Remove #ifndef - MOVEMAIL_PATH code, since the setting of that variable has been - meaningless for a while now, and the rest of the code DTRT whether - that code executes or not. - -2001-10-05 Jeffrey Stedfast <fejj@ximian.com> - - * mail-mt.c (pass_got): Fix a merge-conflict leftover. - -2001-10-05 <NotZed@Ximian.com> - - * folder-browser.c: reformatted the menu tables so they're a bit - more bloody readable. - - * mail-folder-cache.c (mail_note_store): Hook into - subscribed/unsubscribed events. Only 'add/remove' folders from - the add/removed events if we aren't subscribed, otherwise use the - subscribed events. Rest of fix for #11831 - -2001-10-05 Jon Trowbridge <trow@ximian.com> - - * mail-config.glade: Add toggle button to config menu to turn the - "confirm sending unwanted HTML" dialog on/off. (Bug 10794) - - * mail-accounts.c (construct): Make said toggle button actually - work. - -2001-10-05 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (e_gnome_dialog_set_parent): New convenience - function that not only sets the gnome-dialog's parent window but - also makes sure that the gnome-dialog closes when it's parent - closes. - (e_gnome_warning_dialog_parented): New conmvenience wrapper around - the libgnomeui version that also does the same thing as - e_gnome_dialog_set_parent. - (e_gnome_error_dialog_parented): Same. - (e_gnome_ok_dialog_parented): And again... - (e_gnome_ok_cancel_dialog_parented): And once again. - -2001-10-05 Larry Ewing <lewing@ximian.com> - - * mail-callbacks.c (mail_generate_reply): use - e_msg_composer_new_with_message rather than e_msg_composer_new. - This way we bring in all the attachment of the message we are - replying to. - -2001-10-05 Christopher James Lahey <clahey@ximian.com> - - * message-list.c (message_list_setup_etree): Turn on - "uniform_row_height" argument. - -2001-10-04 <NotZed@Ximian.com> - - * folder-browser.c (update_status_bar): Show "nn sent" as total in - sent folder, rather than just 'total'. - - * mail-folder-cache.c (update_1folder): Also show total message - count for sent_folder. - - * folder-browser-ui.c (folder_browser_setup_property_menu): Do a - better job of setting up the name. Also de-sensitise when we - can't configure the folder. - -2001-10-04 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (providers_config): Set the parent window as - the fb. This fixes bug #11723. - (filter_edit): Do the same thing here too and also to the warning - dialog. - (edit_msg): Set the parent on the warning dialog. - (resend_msg): And here. - (search_msg): Here too. - (confirm_expunge): Set the parent window on the dialog here too. - (save_msg_ok): Same here. - - * mail-accounts.c (images_radio_toggled): Ignore the signal if the - radio button is not "on". This fixes bug #10532 because the on/off - signals don't always come in the off->on order. - - * mail-ops.c (mail_send_message): Reduced some redundancy. - -2001-10-04 Dan Winship <danw@ximian.com> - - * mail-format.c (write_address): Fix so that an email address with - no name is once again just "foo@bar.com", not "<foo@bar.com>". - -2001-10-04 Iain Holmes <iain@ximian.com> - - * importers/evolution-mbox-importer.c (load_file_fn): Only pass - CAMEL_STORE_FOLDER_CREATE when the shell will be creating the - folder. - -2001-10-04 <NotZed@Ximian.com> - - * mail-callbacks.c (configure_folder): If we're accessing a - vfolder uri, then popup the vfolder editor instead of trying the - mail local one. - - * mail-vfolder.c (vfolder_edit_rule): Edit a vfolder by name. - -2001-10-04 Jeffrey Stedfast <fejj@ximian.com> - - * mail-account-gui.c (mail_account_gui_save): Added some more NULL - checks. - -2001-10-04 <NotZed@Ximian.com> - - * component-factory.c (storage_remove_folder): Do the url - fragment/path -> folder name hack. Removing vfolders from shell - works now? - -2001-10-03 <NotZed@Ximian.com> - - * mail-send-recv.c (build_dialogue): Only build destination data - if we have destination != NULL. Fixes crash of bug #10835. - - * folder-browser.c (folder_browser_config_search): Set 'to' -> - 'recipient' data for search object. #6199. - - * mail-local.c (local_storage_new_folder_cb): Handle vtrash case, - emit 'folder_created' event for the folder-cache to work, etc. - -2001-10-03 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (mail_write_authenticity): Don't use the wax-seal - icons for the pgp stuff anymore, use Jimmac's new icons instead. - -2001-10-03 <NotZed@Ximian.com> - - * mail-folder-cache.c (folder_changed): Dont wait for event to - finish before returning. This could however mean we process it - after things have vanished below us? Fixes another case of ctrl-d - deadlock. - - * folder-browser.c (update_status_bar): If we have hide deleted - set, then dont count deleted messages in the 'total' messages - count. Fixes #6591. - - * mail-ops.c (add_vtrash_info): If we have a fragment, override - that, rather than the path. Fixes #5251. - (remove_folder_get): Freeze/thaw around deleting all messages in - folder. - -2001-10-03 Rodrigo Moya <rodrigo@ximian.com> - - * importers/Makefile.am: add $BONOBO_GNOME_CFLAGS to make it work - with latest Bonobo - -2001-10-02 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (transfer_msg): Pass an empty flags argument to - mail_transfer_messages - destination folder should already be - created by this point. - - * folder-browser.c (message_list_drag_data_received): Pass an - empty flags argument to mail_transfer_messages. - (selection_received): Same. - - * component-factory.c (xfer_folder): Pass the CREATE flag to - mail_transfer_messages() so that the dest folder gets created. - (destination_folder_handle_drop): Update for mail-ops API change. - - * mail-ops.c (mail_transfer_messages): Now takes a dest_flags - argument that it passes along to mail_tool_uri_to_folder when - opening the destination folder. - -2001-10-02 Jeffrey Stedfast <fejj@ximian.com> - - * mail-vfolder.c (vfolder_setup_do): Pass an empty flags argument - to mail_tool_uri_to_folder. - (vfolder_adduri_do): Same. - - * mail-session.c (get_folder): Pass an empty flags argument to - mail_tool_uri_to_folder. - - * mail-send-recv.c (receive_get_folder): Pass an empty flags - argument to mail_tool_uri_to_folder. - - * mail-ops.c (get_folder_get): Pass the flags to - mail_tool_uri_to_folder. - (mail_get_folder): Now takes a flags argument. - (remove_folder_get): Pass an empty flags argument to - mail_tool_uri_to_folder. - (mail_send_message): Pass an empty argument flag to - mail_tool_uri_to_folder. - (transfer_messages_transfer): Same. Destination folder should - already be created by this time. - - * folder-info.c (do_get_info): Pass an empty flags argument to - mail_tool_uri_to_folder. - - * importers/evolution-mbox-importer.c (folder_created_cb): Pass - the CREATE flag here too. - (load_file_fn): And here. - (load_file_fn): And here too. - - * importers/evolution-outlook-importer.c (load_file_fn): Pass the - CREATE flag to mail_tool_uri_to_folder. - - * folder-browser.c (folder_browser_new): Pass an empty flags - argument. - (x_evolution_message_parse): Pass an empty flags argument to - mail_tool_uri_to_folder. - - * component-factory.c (create_folder): Pass a CREATE flag to - mail_get_folder here too. - (owner_set_cb): And here. - (xfer_folder): Shouldn't need the CREATE flag here, so not passing - any flags. - (destination_folder_handle_drop): Same. - - * mail-local.c (mail_local_store_add_folder): Pass a CREATE flag - to mail_get_folder. - (reconfigure_folder_reconfigure): Pass an empty flags argument to - mail_tool_uri_to_folder. - - * mail-tools.c (mail_tool_uri_to_folder): Take a flags argument. - (mail_tool_get_local_inbox): Pass an empty flags argument to - mail_tool_uri_to_folder. - -2001-10-02 Ettore Perazzoli <ettore@ximian.com> - - * mail-account-gui.c (launch_signature_editor): Use - `bonobo_ui_component_new_default()', not - `bonobo_ui_component_new()'. - -2001-10-01 Jon Trowbridge <trow@ximian.com> - - * mail-display.c (on_url_requested): Make sure we aren't dealing - with a pathological message w/o a From: header. - (ebook_callback): Properly check that the address we queried - matches the address on the current message. (Bug #10038) - -2001-10-01 Iain Holmes <iain@ximian.com> - - * component-factory.c (component_factory_init): Check for errors. - - * mail.h: Change prototype for evolution_folder_info_factory_init. - - * folder-info.c (evolution_folder_info_factory_init): Return TRUE - or FALSE. - - * mail-config.c (evolution_mail_config_factory_init): Return TRUE or - FALSE. - - * mail-config.h: Change prototype for above. - -2001-10-01 Jeffrey Stedfast <fejj@ximian.com> - - * mail-vfolder.c (mail_vfolder_remove_uri): replace my_list_find() - == NULL with my_list_find() != NULL. - -2001-10-01 Dan Winship <danw@ximian.com> - - * component-factory.c (mail_load_storage_by_uri): create storages - for providers that are STORAGE and aren't EXTERNAL, rather than - "(STORAGE and REMOTE) or spool, maildir, or vfolder". - (mail_remove_storage_by_uri): Use the same rule here (which makes - it possible now to remove maildir and spool stores now, which - weren't properly special-cased before). Remove some CamelException - misuse. - - * mail-config.c (new_source_created): Fix up the broken INBOX- - shortcut-generating assumption a little by only assuming that if - you call camel_store_get_inbox(), that its full_name is the same - as its path. (This happens to always be true for inboxes now, and - will be always true by definition at some point in the future.) - Now maildir stores get working Inbox shortcuts. - - * mail-send-recv.c (get_receive_type): If PROVIDER_IS_STORAGE - then use SEND_UPDATE, if not, use SEND_RECEIVE. - - * mail-local.c (local_provider): The local provider is EXTERNAL. - (The shell creates it.) - (mail_local_reconfigure_folder): Allow reconfiguring between - IS_LOCAL providers. - - * mail-accounts.c (news_delete): Don't need to check the provider - flags here... we know nntp is a STORAGE. - -2001-10-01 Dan Winship <danw@ximian.com> - - * mail-local.c (mail_local_reconfigure_folder): Don't use - mail_tool_get_folder_name here since that function only existed to - be clever in a certain case that this is not. - (reconfigure_folder_free): Remove the dialog from the hash table - here so that it gets removed in the successfully-reconfigured case - too. Don't unref folder_out if it never got set. - (reconfigure_clicked): Remove the hash table code from here; it's - in reconfigure_folder_free now. - - * mail-tools.c (mail_tool_get_folder_name): No longer used by - anything. - (mail_tool_get_folder_from_urlname): Also not used anywhere. - -2001-10-01 Jeffrey Stedfast <fejj@ximian.com> - - * mail-tools.c (mail_tool_uri_to_folder): Don't pass the CREATE - flag, we shouldn't ever need this... - -2001-10-01 Larry Ewing <lewing@ximian.com> - - * mail-identify.c (mail_identify_mime_part): if gnome-vfs returns - application/octet-stream with the magic check, use the filename - check instead since it at least has a chance of being useful. - -2001-09-28 Dan Winship <danw@ximian.com> - - * folder-browser-ui.c (fbui_sensitize_timeout): wrap a - bonobo_ui_component_freeze/thaw around all of the set_props so - they all update at once. - -2001-09-28 Jeffrey Stedfast <fejj@ximian.com> - - * mail-accounts.c (construct): Don't create checkboxes for global - Threaded or Preview options as they are now removed. - -2001-09-28 <NotZed@Ximian.com> - - * component-factory.c (owner_set_cb): Setup vfolder storage before - all others. - - * mail-local.c (mail_local_store_remove_folder): Emit - folder_deleted event. - (remove_find_path): Fix, compare against path, not full_name. - - * mail-tools.c (mail_tool_uri_to_folder): Dont - vfolder_register_source anymore. - - * mail-vfolder.c (rule_changed): Changed to access - mail_fodler_cahce to find out if the folder exist yet before - trying to open them, also use the cache as a cache so we dont have - to open the folder if its already been opened. - (vfolder_register_source, register_source): Removed. - (source_finalise): Removed, - (check_source): Removed. All handled through diff mechanism. - (mail_vfolder_add_uri): New function, records uri's of available - folders, and adds them to any active vfolders if required. - (mail_vfolder_remove_uri): New function, removes a uri from - available folders, and checks any rules to see fi they need - updating. - (vfolder_adduri): New async function to add a uri to all vfolders - that need it. - (store_folder_deleted): oops! free user, not rule!! - - * mail-folder-cache.c: Add uri->folderinfo hashtable, and the - store from which they come into the store info struct. - Add uri to the folder_info. - (setup_folder): Store the uri in the folderinfo. - (setup_folder): And the uri in the folder_uri hashtable. - (mail_note_store): Store the store in the storeinfo, and setup the - folders_uri hashtable via the store's hash functions. - (setup_folder): Call mail_vfolder_add_uri to note this newly setup - folder uri. - (store_folder_deleted): Proxy call to main thread. - (real_folder_deleted): And tell the vfolder to remove this uri - from its folder list. - (setup_folder): Dont call vfolder_add_uri if noselect is set on - the uri. - -2001-09-27 <NotZed@Ximian.com> - - * mail-vfolder.c: Removed vfolder_info struct, vfolder_storage. - Neither used anymore. - -2001-09-28 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.c (mail_config_get_account_by_transport_url): Use - Camel to compare the urls rather than using e_url_equal which does - all sorts of funky shit that may not work in every case. - -2001-09-28 Jeffrey Stedfast <fejj@ximian.com> - - * mail-local.c (mail_local_provider_init): Setup the url_hash and - url_equal functions for the local provider. - - * mail-account-gui.c (mail_account_gui_save): Add code here to - check to make sure that the Drafts and Sent folders are pointing - to valid urls. This is kinda nasty and only really solves the case - where the user changes, say, his imap server or - something. Unfortunately we still have the problem where if - account A's sent/drafts folders point to account B's store and the - user changes the url for account B. - - * mail-config.c (mail_config_get_account_by_source_url): Use Camel - to compare the urls rather than using e_url_equal which does all - sorts of funky shit that may not work in every case. - -2001-09-28 Dan Winship <danw@ximian.com> - - * mail-mt.c (pass_got): Don't call - mail_config_service_set_save_passwd if we didn't find a service. - -2001-09-27 Ettore Perazzoli <ettore@ximian.com> - - * mail-config.c (add_shortcut_entry): Just add the shortcut to the - first group. - -2001-09-28 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser-ui.c (folder_browser_ui_add_list): Call - folder_browser_toggle_threads() here after setting the value. This - should fix bug #6415 and if it doesn't, then this whole deal is - just a lost cause. - - * mail-mt.h: Added mail_msg_cleanup() prototype. - -2001-09-28 Dan Winship <danw@ximian.com> - - * mail-format.c (get_data_wrapper_text): Deal with - camel_mime_filter_charset_new_convert returning NULL. (Every other - call to it does, and something's wrong with iconv on the Sun right - now so it keeps failing.) - -2001-09-27 Ettore Perazzoli <ettore@ximian.com> - - * mail-mt.c (do_user_message): Always make the Cancel button the - last one. - -2001-09-27 <NotZed@Ximian.com> - - * mail-folder-cache.c (real_note_folder): No such event finalized! - Its finalize. - (mail_note_store): " - - Fixed dan's comment a bit, info != NULL for folder_created, info== - NULL for changed. - -2001-09-26 <NotZed@Ximian.com> - - * mail-local.c (mlf_set_message_flags): Proxy the - set_message_flags call too. Doesn't fix the 'local folder counts - dont update' problem, but its more correct. - -2001-09-27 Jeffrey Stedfast <fejj@ximian.com> - - * mail-session.c (mail_session_remember_password): Perform a - NULL-check. Hopefully fixes bug #7874. - -2001-09-27 Dan Winship <danw@ximian.com> - - * mail-offline-handler.c (service_is_relevant): A service needs to - be disconnected if it's remote, not already offline, and either - connected OR connecting. - (storage_go_offline): Don't put non-relevant stores offline. (Eg, - don't force an IMAP store which you hadn't already connected to to - connect and sync.) - (storage_go_online): Likewise, don't "reconnect" stores that - weren't connected before. - - * mail-ops.c (set_offline_desc): Fix the message to say - "reconnecting" instead of "disconnecting" when appropriate. - (mail_store_set_offline): If offline is TRUE, call - camel_service_cancel_connect on the store. (We do this here - because we don't want the cancel_connect request to get queued up - behind a hanging connection attempt.) - -2001-09-26 Anna Marie Dirks <anna@ximian.com> - - * mail-config.glade: Added a "Description:" label and moved - the source_description and transport_description labels to - a more appropriate place. - -2001-09-26 Christopher James Lahey <clahey@ximian.com> - - * message-list.c (mlfe_callback): Check for the root node here. - Fixes Ximian bug #11029. - -2001-09-26 Jeffrey Stedfast <fejj@ximian.com> - - * mail-mt.c (do_get_pass): Change the wording of the password - dialog if we are getting a pgp passphrase so that users don't - misinterpret it to mean saving the passphrase forever. - -2001-09-26 Jon Trowbridge <trow@ximian.com> - - * mail-callbacks.c (composer_get_message): strdup our "This - message contains invalid recipients" string, since it gets freed - later. And then don't leak the message string. (Bug #10877) - - * mail-format.c (write_address): Use camel_address_format, - not camel_address_encode. - - * mail-display.c (html_button_press_event): Decode our URL before - extracting the address to pop up contact info. - - * mail-format.c (write_address): When writing out a mailto: link, - make sure we construct a valid URL w/ correct encoding. Make sure - our address is properly quoted, if necessary. - -2001-09-26 Dan Winship <danw@ximian.com> - - * mail-folder-cache.c: Add a big comment explaining unread message - counts so no one can mess them up again in the future. :-) - (update_1folder): If info->unread_message_count is -1, don't do - anything. - - * component-factory.c (component_factory_init): warn and exit if - oaf_active_server_register returns OAF_REG_ALREADY_ACTIVE. - -2001-09-26 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.c (config_read): Oops, translate the fake account - name to UTF-8. - -2001-09-26 Christopher James Lahey <clahey@ximian.com> - - * message-list.c (message_list_foreach): Use - e_tree_selected_path_foreach instead of - e_tree_selected_row_foreach here. - -2001-09-27 Michael Meeks <michael@ximian.com> - - * mail-config.c (mail_config_init): report the - exception on failure and abort quickly instead of hitting - a strange assert later. - -2001-09-25 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (decode_pgp): Update to not send the - remember-passphrase option to the context, it doesn't need it - anymore. - (try_inline_pgp_sig): Same. - - * mail-accounts.c (construct): The remember-passphrase option is - no longer there. This can now be set on the passphrase prompt - dialog. - (construct): Add confirm expunge options. - - * mail-config.c (config_read): We no longer read-in the - remember-passphrase state because we no longer need it. - (mail_config_write_on_exit): We no longer save it either. - (mail_config_get_remember_pgp_passphrase): Removed. - (mail_config_set_remember_pgp_passphrase): Removed. - - * mail-crypto.c (mail_crypto_pgp_mime_part_sign): No longer do we - need to send the remember passphrase state to the pgp context. - (mail_crypto_pgp_mime_part_verify): Same. - (mail_crypto_pgp_mime_part_encrypt): Here too. - (mail_crypto_pgp_mime_part_decrypt): And here. - -2001-09-25 Ettore Perazzoli <ettore@ximian.com> - - [Patch for Automake 1.5 compatibility pointed out by Richard - Boulton <richard@tartarus.org>, as per #9258.] - - * Makefile.am (CLEANFILES): Assign directly, not with `+='. - -2001-09-25 Jeffrey Stedfast <fejj@ximian.com> - - * mail-folder-cache.c (update_1folder): The folder-info needs to - take priority over the folder because of the way IMAP works (which - is that it doesn't actually update the folders until you SELECT - them and so when you do get_folder_info(), it doesn't actually - SELECT the folders, it just STATUS's them). - -2001-09-25 <NotZed@Ximian.com> - - * folder-browser.c (folder_browser_destroy): Deal with destroy vs - finalise semantics. Only destroy widgets here. - (folder_browser_finalise): object finalise function, actually - unref/free all other objects here. - (folder_browser_class_init): Init the finalise hook. - (got_folder): Check if message_list == NULL -> we've been - destroyed before the thread got a chance to finish loading the - folder. - (folder_browser_is_drafts): Dont use a g_return_if_fail to return - in what could be a valid state of the object. - (folder_browser_is_sent): Likewise. - (folder_browser_copy): Do nothing if message_list == NULL. - - * main.c (main): call mail_msg_cleanup() before leaving threads. - - * component-factory.c (owner_unset_cb): Wait for all outstanding - operations to finish before setting up to quit. - (idle_quit): Wait for all outstanding ops to finish before - cleanup. - (unref_standard_folders): NULL out the standard folder before - unreffing it. - - * mail-mt.c (mail_msg_wait_all): New function to wait for all - outstanding thread operations. - (mail_msg_cleanup): Destroy the io channels before we're - finished. Also wait for all outstanding threads first. Made - public. - (mail_msg_init): Dont call mail_msg_cleanup atexit automatically. - - -2001-09-25 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (get_data_wrapper_text): If the data wrapper - contains raw text, treat the contents as if they were in the - user's default charset and convert them to UTF-8. - - * component-factory.c (owner_set_cb): Throw up a warning dialog if - we suspect the config database is corrupt. - - * mail-config.c (config_read): If the account name is NULL, then - we have a corrupt config database most likely - so generate a fake - account name and set the corrupt but to TRUE. - (mail_config_is_corrupt): New function to find out if the config - is suspected of being corrupted. - -2001-09-25 Iain Holmes <iain@ximian.com> - - * mail-config.c (impl_GNOME_Evolution_MailConfig_addAccount): - Check if the transport is NULL. - -2001-09-25 Iain Holmes <iain@ximian.com> - - * mail-display.c (link_menu): Remove the Save Link as (FIXME) - item. - -2001-09-25 Jeffrey Stedfast <fejj@ximian.com> - - * mail-mt.c (pass_got): Only cache the password for the service if - it has an entry in the account database. Fixes bug #10875. - -2001-09-24 Christopher James Lahey <clahey@ximian.com> - - * message-list.c (filter_date): Use e_strftime_fix_am_pm instead - of strftime. - -2001-09-24 <NotZed@Ximian.com> - - * mail-local.c (mls_get_folder): Removed unused variables. - - * component-factory.c (storage_create_folder): Remove unused - variable. - - * mail-format.c (write_default_header): Used to write a header - that we know about/normally print. Use a static header table to - index these. - (write_header): removed. - (default_header_index): Return the index of the default header. - (write_headers): Changed the way it writes headers a bit. Use - write_default_header or write_text_header directly. Also try and - use the header charset as a fallback if the header can't be - decoded using the locale charset. - -2001-09-23 Jeffrey Stedfast <fejj@ximian.com> - - * mail-mt.c (pass_got): Always cache POP and IMAP passwords, even - if the user didn't tell us to. Fixes bug #10569. - -2001-09-21 <NotZed@Ximian.com> - - * mail-mt.c (mail_msg_check_error): If we have an operation that - failed before, dont show the dialogue for the the new error. Also - use gtk_widget_show rather than invoking another main loop. Fix - for lazy people who like to leave their mailers running and go - home. - -2001-09-21 Jeffrey Stedfast <fejj@ximian.com> - - * mail-ops.c (mail_send_message): Use the mail-tools convenience - functions to remove and restore the X-Evolution headers. - (mail_update_subfolders): Removed. - -2001-09-21 <NotZed@Ximian.com> - - * mail-callbacks.c (mail_storage_create_folder, folder_created, - create_folders): All made redundant by new mail-folder-cache - code. - (delete_folders, folder_deleted): Uh, code that isn't used - anywhere. Removed. - - * component-factory.c (storage_create_folder): Dont call - folder_created, let the folder_created event handle the update. - - * mail-local.c (mail_local_store_add_folder): Use url path as - full_name, not shell path. - (mail_local_folder_construct): Remove path argument, and use the - full_name instead. - (mls_get_folder): Dont lookup folderinfo in cache. Like duh the - shell hasn't told me its there yet, smaaaart. - - * mail-folder-cache.c (mail_note_store): Take a new argument - 'done' that can callback when complete. Fixed callers - appropriately. - - * mail-ops.c (mail_update_subfolders): Removed. Isn't used - anymore. - (mail_scan_subfolders): Remove, no longer used. - - * mail-send-recv.c (receive_update_got_store): Remove call to - mail_update_subfolders. - -2001-09-20 <NotZed@Ximian.com> - - * mail-vfolder.c (check_source): Dont let drafts/outbox/sent be - added via a generic 'all local folders' rule. - - * component-factory.c (got_folder): trigger a folder changed - event, so the folderinfocache stuff has a chance to see if this is - the outbox_folder or not. - - * mail-folder-cache.c (update_1folder): If we have -1 unread - count, pass that as 0 to the shell so it doesn't go bolding. - (setup_folder): Same. - -2001-09-20 Jeffrey Stedfast <fejj@ximian.com> - - * mail-account-gui.c (mail_account_gui_save): Only add the account - if it doesn't already exist in the config db. - - * mail-config.c (mail_config_find_account): New convenience - function. - - * mail-config-druid.c (wizard_finish_cb): Do not add the account - here as this is taken care of in mail_account_gui_save() since it - has to be able to set the default account. - - * mail-config.c (mail_config_set_default_account): Don't allow the - index to become invalid. - - * mail-account-gui.c (mail_account_gui_save): Add the account - before setting it as the default. - -2001-09-20 <NotZed@Ximian.com> - - * folder-browser.c (folder_browser_set_shell_view): Update the - status bar here, assuming we've just been activated. - - * mail-ops.c (add_vtrash_info): Scan whole list, rather than - missing the last one. Also dont assume its always the last, - otherwise we could lose following folders. - -2001-09-20 Jeffrey Stedfast <fejj@ximian.com> - - * mail-tools.c (mail_tool_uri_to_folder): Don't "note" the folder - if we failed to get it. - -2001-09-20 Iain Holmes <iain@ximian.com> - - * mail-account-gui.c (mail_account_gui_new): Set the sensitivity - of the edit buttons correctly. - -2001-09-20 <NotZed@Ximian.com> - - * mail-vfolder.c (vfolder_register_source): Lock around - hashtable/list manipulation. Also dont try scan vfolder_hash if - it hasn't been setup yet. - (source_finalise): Lock around list access. - (rule_changed): Lock around hash access. - (context_rule_added): Lock around hash access. - (context_rule_removed): " - (rule_changed): Lock around list access. - (all): d(x) out debug printfs - - * mail-local.c (storage_listener_startup): Fix for api change. - (local_storage_new_folder_cb): Dont skip over leading / in path. - (local_storage_removed_folder_cb): ditto. - - * mail-folder-cache.c (create_folders): No longer pass prefix - between recursive calls - we have the path in the folderinfo. - (setup_folder): No longer take path arg, we get it from - folderinfo. - (mail_note_folder): No longer take path arg, we use - folder->full_name to key the folder table. - (mail_note_store): Consolidate note_store interface, pass storage - or corba_storage to it. - (mail_note_local_store): Removed. - (update_1folder): If its a vtrash folder, or the outbox_folder, - and we have a folder, then make the 'count' the total message - count, not unread messages count. - -2001-09-20 Jeffrey Stedfast <fejj@ximian.com> - - * mail-local.c (mail_local_store_add_folder): Set the folder info - path. - -2001-09-20 <NotZed@Ximian.com> - - * mail-tools.c (mail_tool_uri_to_folder): Register vfolder sources - here. - - * folder-browser.c (got_folder): Dont register vfolder sources - here. - - * mail-ops.c (mail_get_folder): Add thread parameter. Fix callers. - (add_unmatched_info): Scan for unmatched name and re-title. - - * mail-vfolder.c (vfolder_setup): Use the 'slow' queue for setting - up vfolders. - - * mail-mt.c (mail_msg_init): Limit the maximum number of threads - on the 'new' thread to 10. - (mail_msg_init): Create a new queue 'slow' for doing slow - operations. - -2001-09-20 Iain Holmes <iain@ximian.com> - - * mail-display.c (mail_error_write): Add a <blockquote> to make - the error message look better. - -2001-09-20 <NotZed@Ximian.com> - - * mail-tools.c (mail_tool_uri_to_folder): Dont special case file: - url's anymore. - - * mail-local.c: Add real_path to MailLocalFolder. - (mail_local_folder_construct): Added path argument, setup - full_name == path, and real_path == full_name. - (mls_get_folder): First lookup folderinfo to confirm this folder - exists, then use that to properly construct the folder paths. - (mail_local_folder_reconfigure): Use real_path not full_name to - create the store uri. - (mlf_set_folder): Use real_path not folder_name to get real uri - path. - -2001-09-19 <NotZed@Ximian.com> - - * mail-folder-cache.c (setup_store): Use the wrong spelling of - finalised for the event hook. - (real_note_folder): Use the wrong spelling of finalised for the - event hook. - (free_folder_info): Free the full_name parameter. - (setup_folder): - (real_note_folder): Key the folderinfo table on full_name, not - path. - -2001-09-20 Jeffrey Stedfast <fejj@ximian.com> - - * mail-ops.c (save_messages_save): Convert all textual parts to - 8bit before saving. Fixes bug #10388. - - * mail-callbacks.c (ask_confirm_for_unwanted_html_mail): Oops, - don't free memory that we don't own. - -2001-09-20 Dan Winship <danw@ximian.com> - - * mail-config.c (evolution_mail_config_factory_init): No need to - have g_warnings here. If it's done properly, therapeutically, - there's no danger involved. - -2001-09-19 Jon Trowbridge <trow@ximian.com> - - * mail-callbacks.c (mail_generate_reply): Truncate extremely long - subjects. (inspired by bug #9158) - - * mail-tools.c (mail_tool_generate_forward_subject): Truncate - extremely long subjects. (bug #9158) - -2001-09-19 Jeffrey Stedfast <fejj@ximian.com> - - * mail-send-recv.c (receive_update_got_store): Here too. - - * component-factory.c (create_view): Call mail_note_store() - instead of mail_scan_subfolders() here so that these folders get - hooked up with the unread count code. - -2001-09-12 Iain Holmes <iain@ximian.com> - - * importers/evolution-mbox-importer.c (load_file_fn): Fix memory - leak. - -2001-09-19 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (ask_confirm_for_unwanted_html_mail): Convert - the names to the locale charset. - -2001-09-19 Dan Winship <danw@ximian.com> - - * mail-callbacks.c (create_folders): Pass the actual unread - message count, not just whether or not it's > 0. Fixes ximian - 9089. - -2001-09-19 <NotZed@Ximian.com> - - * component-factory.c: Added missing header. - - * mail-local.c (mail_local_store_add_folder): Async load the - folder we just added, so it can update the folder counts in the - display. We just discard the folder afterwards? - - * mail-ops.c (mail_get_folder): Use the queued thread to get - folders. - - * General cleanup of mail debug printfs. - - * mail-folder-cache.[ch]: Completely rewritten. Removed all calls - to the old code everywhere they were used. Nuff said. - - * folder-browser.h: Add shell_view to folder_browser & api to set - it. - - * folder-browser-factory.c (control_activate): Set the shell-view - on the folder_browser. - (control_deactivate): And clear it here. - - * folder-browser.c (folder_browser_destroy): Unhook from changed - events on the folder before giving it away. - (got_folder): Hook onto the folder-changed events. - (folder_changed): Event hook proxy for folder_changed events - (main_folder_changed): And the main code version. - (update_status_bar): And the one that actually does the work. - (on_selection_changed): Also call update_status_bar() to update - the selection count. - (folder_browser_set_shell_view): Implement function to set the - shell_view on the folder_browser. - (folder_browser_destroy): Release the shell_view here too. - - * mail-tools.c (mail_tool_uri_to_folder): Dont 'note' the new - folder if its from a file: url, this is handled by hte local store - (yeeruughck). - - * mail-local.c (mls_init): - (free_info): - (mls_finalise): Setup init/finalise funcs for the folderinfo hash. - (local_storage_removed_folder_cb): re-enable. - -2001-09-18 <NotZed@Ximian.com> - - * mail-local.c (MailLocalStore): Add a hash table to store - uri<>folderinfo data. - (mail_local_store_add_folder): Add a new folderinfo to our hash. - (mail_local_store_remove_folder): Remove a folder by uri. - (storage_listener_startup): Add this store to those monitored by - the folder tree. - -2001-09-18 Jeffrey Stedfast <fejj@ximian.com> - - * mail-mt.c (do_get_pass): Make the title translatable, and also - use the account name when possible. Sorta fixes bug #6277. - -2001-09-17 <NotZed@Ximian.com> - - * mail-send-recv.c (get_receive_type): Function to get the real - receive tpe for ag iven url. IMAP/SPOOL/MAILDIR types just update - their info, dont download. - (build_dialogue): - (mail_receive_uri): Use function above to get the right receive - type. - -2001-09-18 Jeffrey Stedfast <fejj@ximian.com> - - * mail-tools.c (mail_tool_remove_xevolution_headers): Oops, forgot - about X-Evolution-Format. - (mail_tool_restore_xevolution_headers): Same. - -2001-09-18 Dan Winship <danw@ximian.com> - - * folder-browser.c (folder_browser_set_uri): Merged into - folder_browser_new: nothing ever changes the URI of an existing - folder browser any more. - (folder_browser_new): Make this take a uri argument and do the - work folder_browser_set_uri used to do, except that we set fb->uri - right away, so that if the folder browser's control is activated - before got_folder() gets called, then folder_browser_ui_add_list() - will have access to the correct uri for purposes of setting - ViewThreaded, etc. Fixes #4913. - (got_folder): Don't set fb->uri here since it will already have - been set. Don't call message_list_set_threaded, since it should be - a noop now (and if it's not, it would make the message list not - match the menu item). - - * folder-browser-ui.c (folder_browser_ui_add_list): Remove some - code that was failing to work around the problems above. - - * message-browser.c (message_browser_new): Pass uri to - folder_browser_new, remove call to set_uri. - - * folder-browser-factory.c (folder_browser_factory_new_control): - Likewise. Also fix a s/destroy/unref/ in an error cleanup. - -2001-09-18 Jeffrey Stedfast <fejj@ximian.com> - - * mail-session.c (get_password): Pass a 'cache-me' argument to - mail_get_password. - - * mail-mt.c (pass_got): Make less confusing... - (mail_get_password): Now takes an argument 'cache' that allows our - caller to determine if the user wanted to cache his/her password - or not. - (pass_got): Set the cache option. - -2001-09-18 Dan Winship <danw@ximian.com> - - * mail-format.c (mail_format_raw_message): Call - mail_content_loaded here rather than blocking if the message data - isn't available. - -2001-09-17 <NotZed@Ximian.com> - - * mail-ops.c (mail_get_folderinfo): Get folderinfo 1 at a time - rather than all at once. - -2001-09-17 Jeffrey Stedfast <fejj@ximian.com> - - * component-factory.c (storage_remove_folder): Unsubscribe from - the folder before deleting it. Also, use the url's path instead of - the shell's path since IMAP doesn't necessarily have to use "/" as - the dir sep. - - * mail-ops.c (remove_folder_get): If the store supports - subscriptions, make sure to unsubscribe from the folder before - deleting it. - -2001-09-17 <NotZed@Ximian.com> - - * mail-local.c (storage_listener_startup): Setup global - corba_storage variable. - (mls_get_folder): Set 'update lstorage' on the newly opened - folder. - -2001-09-17 Jeffrey Stedfast <fejj@ximian.com> - - * mail-display.c (invisible_selection_get_callback): Do nothing if - the selection is NULL? Maybe this is the cause of bug #6817. - - * mail-config.c (mail_config_folder_to_cachename): Go back to - generating the cachename ourselves, but continue doing it the way - the dfault implementation of camel_folder_get_uri worked. - -2001-09-16 Christopher James Lahey <clahey@ximian.com> - - * message-list.c (ml_get_node_by_id): Made save_id const here. - -2001-09-16 Jeffrey Stedfast <fejj@ximian.com> - - * mail-display.c (pixbuf_gen_idle): Don;t destroy the pixbuf - loader, unref it instead. - - * mail-config.c (mail_config_folder_to_cachename): Use - camel_folder_get_uri(). - -2001-09-15 <NotZed@Ximian.com> - - * mail-vfolder.c: Major rewrite of most of the guts, handle - changes based on signals and events, etc. Use the main storage - handling code that imap uses, etc. - - * mail-tools.c (mail_tool_uri_to_folder): Dont special case - vfolder: anymore. - - * component-factory.c (owner_set_cb): use vfolder_load_storage(), - new function to setup vfolder storage, after interaction has been - enabled only. This might need some tweaking ... - (storage_remove_folder): Removed all the folder lookup stuff. - Just delete the folder based on the path passed in. There should - be no reason this wouldn't work, right? - -2001-09-14 <NotZed@Ximian.com> - - * mail-ops.c (get_folderinfo_get): Only add vtrash folder info, if - store supports vtrash. - - * component-factory.c (mail_load_storage_by_uri): Let 'vfolder' - stores show up too. - -2001-09-13 <NotZed@Ximian.com> - - * mail-vfolder.c (vfolder_uri_to_folder): Open a vfolder then set - its expression, since name?query open method is removed. - -2001-09-14 Jeffrey Stedfast <fejj@ximian.com> - - * subscribe-dialog.c (fe_root_value_at): Return the cached value - of camel_service_get_name so that we don't leak memory. - (fe_real_value_at): Don't strdup the node's name. - (folder_etree_construct): Set the service_name. - (fe_destroy): Free the service_name. - - * mail-ops.c (add_vtrash_info): Free the temporary path variable - here. - - * subscribe-dialog.c (store_data_new): Added a refcount variable - so set the refcount to 1. - (sd_got_store): Unref the store-data. - (store_data_async_get_store): Ref the store-data. - (store_data_ref): New function. - (store_data_unref): New function. - (subscribe_dialog_destroy): Instead of freeing the store-data - here, unref it instead. We may just have an async function - running. Set the callback function to NULL so that when the - (remaining) async functions finish, they become no-ops. - - * mail-send-recv.c (build_dialogue): Revert my bar_destroy code - and replace it with dialog_destroy instead. - - * mail-ops.c (mail_send_message): Append a message to any - exception we get appending to any folders after having sent the - message successfully saying that the message was sent successfully - so the user doesn't misinterpret the error. - -2001-09-13 Jon Trowbridge <trow@ximian.com> - - * mail-callbacks.c (composer_get_message): Fixed double-freeing of - EDestination vector when sending html mail to people who don't - necessarily want it. Fixes bug #9848. - -2001-09-13 Jeffrey Stedfast <fejj@ximian.com> - - * subscribe-dialog.c (get_short_folderinfo_desc): - (get_short_folderinfo_get): - (get_short_folderinfo_got): - (get_short_folderinfo_free): - (subscribe_get_short_folderinfo): Modified to take a FolderETree - instead of a CamelStore (since the CamelStore is inside the - FolderETree anyway) so that we could ref the ETree to prevent a - race condition. Should fix bug #9827. - - * mail-format.c (try_inline_pgp_sig): Make sure that the - charset_filter is non-NULL before using it since iconv may fail. - -2001-09-13 Larry Ewing <lewing@ximian.com> - - * mail-tools.c (mail_tool_quote_message): free the credits string. - -2001-09-12 <NotZed@Ximian.com> - - * mail-vfolder.c (vfolder_remove_cb): Fixed the remove callback - prototype, and return the result properly using the listener. - (vfolder_uri_to_folder): Always use the same store uri, so we dont - create a new store for each folder. - -2001-09-12 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.c (mail_config_write_on_exit): Save transport - passwords too. This fixes bug #3020. - -2001-09-11 Dan Winship <danw@ximian.com> - - * mail-folder-cache.c (mail_folder_cache_note_folderinfo): Don't - set the folderinfo's unread count to 0 when camel reports -1, - since that may overwrite a valid unread count from before. - (get_folder_info): Do it here instead when first creating a new - folderinfo structure. - Should fix bug #1756. - -2001-09-11 Larry Ewing <lewing@ximian.com> - - * mail-account-gui.c (menu_file_save_cb): call menu_file_save_error - when there is an exception while saving. - (menu_file_save_error): pop up a dialog telling the user the file - has not been saved. - -2001-09-10 <NotZed@Ximian.com> - - * mail-local.c (mail_local_reconfigure_folder): Dynamically create - the folder type list from camel. - (reconfigure_clicked): And change code to handle changes. - -2001-09-10 <NotZed@Ximian.com> - - * merged mail_local patch from peterw. Many changes. - -2001-09-10 Iain Holmes <iain@ximian.com> - - * mail-config.c (impl_GNOME_Evolution_MailConfig_addAccount): Add a - none account if the url is empty. - -2001-09-10 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (mail_generate_reply): Don't use - new_with_sig_file, that function no longer exists. - (forward_get_composer): Same here. - -2001-09-10 Zbigniew Chyla <cyba@gnome.pl> - - * mail-config.c - (add_shortcut_entry): Marked string for translation. - (new_source_created): Ditto. - - * mail-send-recv.c - (format_url): Marked strings for translation. - (build_dialogue): Ditto. - -2001-09-10 Jeffrey Stedfast <fejj@ximian.com> - - * mail-account-gui.c (mail_account_gui_new): Hide the S/MIME frame - if we don't support S/MIME. - - * mail-send-recv.c (build_dialogue): Attach to the destroy event - for each progressbar using bar_destroyed as the callback. - (bar_destroyed): New callback to unregister the timeout and set - the send-info's bar member to NULL so we don't try to update a - destroyed progressbar. - - * mail-callbacks.c (mail_generate_reply): Pass along the right - string, this fixes bug #9518. - - * mail-account-gui.c (save_service): Don't save the authmech if - the username doesn't exist. Fixes bug #9474. - - * mail-callbacks.c (do_edit_messages): Remove some mailer-set - headers. Fixes bug #9462. - -2001-09-10 Dan Winship <danw@ximian.com> - - * mail-callbacks.c (composer_get_message): Fix obvious dumb - mistake in previous commit that made it *always* complain you had - invalid recipients. - -2001-09-09 Jon Trowbridge <trow@ximian.com> - - * mail-callbacks.c (composer_get_message): Complain if we are - trying to send to invalid recipients. (Bug #8875) - -2001-09-09 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config-druid.c (evolution_mail_config_wizard_factory_fn): - We need to initialize all of the struct fields or else god knows - what will happen later when we try to use 'em. Also set a destroy - function for the MailConfigWizard so we don't leak it. - -2001-09-08 Jon Trowbridge <trow@ximian.com> - - * mail-callbacks.c (ask_confirm_for_unwanted_html_mail): Added. - Shows a (hopefully) informative dialog warning you that some - recipients might not want HTML mail (who are listed), and gives - the option to cancel sending. (FIXME: The wording of this dialog - could use some work.) - (composer_get_message): Check if we are sending HTML to someone - who might not want it, and raise the dialog if we are. Use our - new destination-vector based api when talking to the composer. - Touch our destinations here, boosting their use scores. This is - the right place for this to happen --- closer to the end of the - sending process, where incorrect/artificial use score inflation is - less likely to occur. - - * mail-config.c (config_read): Added - /Mail/Format/confirm_unwanted_html key. This flag determines - whether or not we want to see the warning dialog when we send HTML - mail to contacts who don't want it. Default is TRUE. - (mail_config_write_on_exit): Write out the confirm_unwanted_html - key. - (mail_config_get_confirm_unwanted_html): Added. - (mail_config_set_confirm_unwanted_html): Added. - -2001-09-08 Dan Winship <danw@ximian.com> - - * mail-display.c (mail_display_destroy): Unref the invisible, - don't just destroy it. - -2001-09-07 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (mail_write_authenticity): Give the full path of - the wax-seal icons. - (try_inline_pgp_sig): Convert the charset from UTF-8 to whatever - charset it should be. Now takes a CamelMimePart argument as well. - (try_uudecoding): Now takes a part argument as well. - (try_inline_pgp): Here too. - (try_binhex): And finally here. - (handle_text_plain): Pass along the mime part to the try_* - functions. - -2001-09-06 Chris Toshok <toshok@ximian.com> - - * component-factory.c (notify_listener): new function, to notify - the bonobo listener in remove_folder/create_folder. - (storage_create_folder): match EvolutionStorage create_folder - signal's signature. - (storage_remove_folder): match EvolutionStorage remove_folder - signal's signature. - -2001-09-06 Dan Winship <danw@ximian.com> - - Fix a bunch of replying/forwarding-related formatting bugs. - - 2749 - Message text not included in reply, but html attachment is - 4294 - "forward inline" should quote the same headers as the - normal mail display - 6100 - Reply to a forwarded email displays email headers - 7255 - Replying to HTML message - 7527 - replying to forwarded message w/ attachments does the wrong - thing - - * mail-format.c (mail_get_message_rfc822): New function to get - message headers and body together, for inline forwards, or replies - containing attached messages. - (mail_get_message_body): Redo this to always return HTML, but keep - the "want_plain" flag, to decide whether to return HTML that looks - like HTML or HTML that looks like plain text. Use - mail_get_message_rfc822 to handle attached message/rfc822 parts. - Don't include the text of vcard or icalendar attachments. Don't - fail to include text parts just because we found an HTML part. - (Since we're always returning HTML now, this doesn't cause - problems any more.) - - * mail-tools.c (mail_tool_quote_message): Simplify greatly. - mail_get_message_body always returns HTML now, and we let it take - care of prepending "> "s too. We then let GtkHTML deal with - converting the HTML to plain text if the user wants to reply in - plain text. - (mail_tool_forward_message): Simplify this a ton too: parts of it - are moved into mail_get_message_rfc822 and parts are now - unnecessary. - - * mail-callbacks.c (do_forward_non_attached): Call - mail_tool_forward_message here always, and let it do the "> " - quoting in the "quoted" case, so that we get the headers too when - forwarding quoted. Related to bug #4294. - -2001-09-05 Dan Winship <danw@ximian.com> - - * mail-display.c (launch_cb): the "command" of a - GnomeVFSMimeApplication can include arguments as well. Deal with - that. Fixes support for CodeWeavers' CrossOver Plugin. - -2001-09-05 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.c (mail_config_remove_account): Adjust the - default_account index correctly. - -2001-09-05 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.c (mail_config_get_accounts): Added a g_assert to - make sure that config wasn't NULL. This is meant to help debug bug - #4911 and friends. - - * component-factory.c (owner_set_cb): Do not mail_config_init() - here as we've already called this in main() in main.c. - -2001-09-05 Ettore Perazzoli <ettore@ximian.com> - - [Fix #958, ShellComponents should not be created by factories, for - the mailer case.] - - * GNOME_Evolution_Mail.oaf.in: Remove the - GNOME_Evolution_Mail_ShellComponentFactory. - - * component-factory.c: Changed to not use a factory. - (COMPONENT_FACTORY_ID): Removed. - (COMPONENT_ID): New. - (idle_quit): Don't unref the component_factory. - (create_component): Renamed from `component_fn'. Take no args. - (component_factory_init): Create the component with - `create_component' and register it on OAF. - -2001-09-06 Radek Doulik <rodo@ximian.com> - - * everywhere updated for new mail_content_loaded definition - (prototype) - -2001-09-05 Radek Doulik <rodo@ximian.com> - - * mail-display.c (mail_display_redisplay): increase - redisplay_counter - (try_part_urls): new helper function - (try_data_urls): ditto - (load_content_loaded): if it has stream handle available and if - it's still valid, it writes to this stream instead of - redisplaying, uses try_part_urls and try_data_urls - - * mail-display.h: added redisplay_counter to MailDisplay, I use - it in load_content_loaded to be sure that there wasn't any - redisplay and that remembered handle is still valid - - * mail-display.c (on_url_requested): don't end stream with error - if part is not loaded yet - (on_url_requested): don't end stream in cases when we are going to - load image using http - (stream_write_or_redisplay_when_loaded): new helper function, - which is extracted from mail_display_redisplay_when_loaded. it's - extended to handle gtkhtml stream writting - (mail_display_redisplay_when_loaded): use - stream_write_or_redisplay_when_loaded - (mail_display_stream_write_when_loaded): new function, uses - stream_write_or_redisplay_when_loaded - struct _load_content_msg: added handle, url and redisplay_counter - fields - - * mail-format.c (mail_content_loaded): added redisplay, url and - handle parameter for case when we are loading image content and - want it write to stream instead of redisplaying - -2001-09-05 Ettore Perazzoli <ettore@ximian.com> - - * message-browser.c (message_browser_new): s/Evolution/Ximian - Evolution/. - -2001-09-04 Ettore Perazzoli <ettore@ximian.com> - - [Fix #7542, "Crash Afer Closing".] - - * component-factory.c (owner_unset_cb): NULL the - global_shell_client as the first thing here. Otherwise we might - get into a slight race that causes the shell to crash. [Still, of - course the shell shouldn't crash, but I haven't been able to track - that down yet.] - -2001-09-04 Zbigniew Chyla <cyba@gnome.pl> - - Fixes #7251 - - * mail-ops.c (add_vtrash_info): Mark "Trash" with U_(), not _(). - -2001-09-04 Jeffrey Stedfast <fejj@ximian.com> - - * mail-ops.c (fetch_mail_fetch): Unref the source folder here - because it might be a POP folder. We do this because on store - finalize, we now try to disconnect cleanly which means that we may - block. - - * mail-send-recv.c (build_dialogue): Fix capitalization. Fixes bug - #7486. - -2001-09-04 Peter Williams <peterw@ximian.com> - - * mail-local.c (mlf_init): Remove accidentally left-in "choke on - this" preprocessor thingie. - (mail_local_folder_reconfigure): Instead of creating our own local - exception, just assert that ex != NULL. - (*): Staticize everything that can be and remove some obnoxious - prototypes. - -2001-08-31 Peter Williams <peterw@ximian.com> - - * mail-local.c (mail_local_reconfigure_folder): Use (NULL, NULL) - as the arguments to g_hash_table_new instead of g_direct_foo. - Instead of checking the URI, check MAIL_IS_LOCAL_FOLDER (fb->folder) - to check whether we can reconfigure the folder. Instead of - gnome_dialog_run_and_close, use gnome_dialog_run... - (reconfigure_clicked): And deal with removing the hash table - elements here. - (local_storage_new_folder_cb): Set the folder's name to the - displayName to i18nize correctly (after shell patch is applied). - -2001-08-30 Peter Williams <peterw@ximian.com> - - * mail-local.c: Rewrite as a more complete CamelStore. - - * component-factory.c (create_folder): We can now chuck out most - of this function and just call mail_get_folder. - (xfer_folder_done): If we succeeded in moving the messages, now - delete the source folder as we should be. - (xfer_folder): In order to do so, create a new xfer_folder_data - struct that records the value of 'remove_source' Fix a leak by - unreffing the source folder. - - * mail-ops.[ch]: We no longer need the mail_new_folder operation. - - * folder-browser.[ch]: Don't need the 'reconfigure' member - anymore, because the loaded folder's URL doesn't change. - (do_message_selected): Don't check it - (on_right_click): Same. - (folder_browser_set_uri): Same. - (got_folder): Same. - -2001-08-31 Zbigniew Chyla <cyba@gnome.pl> - - * mail-vfolder.c (vfolder_create_storage): Marked string for - translation (with U_). - -2001-08-28 Zbigniew Chyla <cyba@gnome.pl> - - * message-list.c (e_mail_address_compare): Use g_utf8_collate - instead of g_strcasecmp for comparing names. - (subject_compare): Replaced g_strcasecmp, isspace, var++ with - UTF-8 counterparts. - -2001-08-30 Iain Holmes <iain@ximian.com> - - * importer/evolution-mbox-importer.c (load_file_fn): Check if it's - a folder, if so, create a folder. - (process_item_fn): If it was a folder created, just finish up - importing - -2001-08-29 Iain Holmes <iain@ximian.com> - - * importers/evolution-mbox-importer.c: Turn off debugging, remove - spewage. - (process_item_fn): Notify the importer if the folder isn't opened - or created yet. - (load_file_fn): Allow the function to continue if the folder is - being created. - -2001-08-30 Peter Williams <peterw@ximian.com> - - Due to the introduction of mail_folder_cache_remove(), we can no - longer assume that mail_folder_info's always exist, so we need to - robustify a lot of this. - - * mail-folder-cache.c (folder_browser_destroyed): New - function. Called when the folder browser is destroyed -- analogous - to camel_folder_finalized. - (mail_folder_cache_note_fb): Hook it up here. - (struct _mail_folder_info): Add a member, mail_info_id, that - records the get_mail operation's id, so that we can cancel it if - we need to. - (get_folder_info): Initialize it here. - (get_mail_info_reply): Clear it here. - (mail_folder_cache_remove_folder): If necessary, cancel it here. - (mail_folder_cache_note_folder): Check it here before starting a - new operation, just in case. - (update_message_counts_main): Take a URI instead of a - mail_folder_info *, in case the MFI has gotten destroyed. - (update_message_counts): Take a quark of the URI instead of a - mail_folder_info *, for the same reason. We use a quark instead of - an allocated gchar * because figuring out when to free the string - gets tricky. Then go from quark -> URI string -> MFI. Return if - the folder is no longer valid, because this indicates that the MFI - was removed before this signal got called. Pass a string to - update_message_counts_main instead of an MFI. - (camel_folder_finalized): Don't bother unhooking the signals here. - Same change as above, but don't bother checking for a valid folder - because we're about to make it invalid anyway. - (message_list_built): Analogous to the above, except with the - FolderBrowser instead of the CamelFolder. - (selection_changed): As above. - (folder_browser_destroyed): As above. - (struct get_mail_info_msg): Instead of taking a mail_folder_info - *, take a URI, for reasons explained above. - (get_mail_info_receive): Go from URI -> MFI before doing anything. - (get_mail_info_reply): Same. - (get_mail_info_destroy): Free the URI. - (get_mail_info): Take a URI and return the message id so that it - can be cancelled if necessary. - (mail_folder_cache_remove_folder): Disconnect from signals and - events before removing. - (mail_folder_cache_note_folder): Use a GQuark instead of the - mail_folder_info * as the user_data. - (mail_folder_cache_note_fb): Same. - (mail_folder_cache_note_folderinfo): Little formatting change. - -2001-08-30 Jeffrey Stedfast <fejj@ximian.com> - - * message-browser.c (message_browser_message_loaded): Fixed a - memory leak. - (message_browser_new): Added a comment as to why , after - reparenting, we do not unref the mail_display. - (message_browser_destroy): Don't call gtk_widget_destroy() on the - message_list here. - -2001-08-30 Peter Williams <peterw@ximian.com> - - * mail-ops.c (remove_folder_get): Instead of removing the folder - from the folder cache here... - (remove_folder_got): ... do it here, in the main thread. - -2001-08-29 Jon Trowbridge <trow@ximian.com> - - * mail-callbacks.c (composer_get_message): When calling - e_msg_composer_get_message, pass in TRUE for the 'sending' arg. - (Part of the fix for bug #8332) - -2001-08-29 Peter Williams <peterw@ximian.com> - - * folder-browser-ui.c: Fix the pixmap for /commands/MessageUndelete. - - * component-factory.c (owner_set_cb): Toss in a call to - mail_config_init () cause it might contribute to solving - bug 4911, and it won't hurt. - -2001-08-28 Peter Williams <peterw@ximian.com> - - * component-factory.c (owner_unset_cb): Disable interaction once - the shell has quit. - (create_view): Instead of - folder_browser_factory_new_control ("", corba_shell) when looking - at a mailstorage folder, use create_noselect_control(). - -2001-08-27 Ettore Perazzoli <ettore@ximian.com> - - * mail-local.c: Match the studlyCapsification of - shell/Evolution*.idl. - - * mail-config-druid.h: Change type of `event_source' from - `Bonobo_EventSource *' to `Bonobo_EventSource'. - - * mail-accounts.c (mail_delete): Remove unused local variable - `label'. - - * folder-info.c (do_get_info): `#if 0' unused variables. - -2001-08-27 Jon Trowbridge <trow@ximian.com> - - * mail-callbacks.c (mail_generate_reply): Check if we are trying - to reply to a message with no From: field, and try to do something - graceful in that case. (Bug #7028) - - * mail-display.c (ebook_callback): Add paranoid checks for the - case of a message with a From: field. (Also maybe bug #7028) - -2001-08-27 Iain Holmes <iain@ximian.com> - - * mail-config-druid.c (druid_finish): Free the list and hash table. - (druid_cancel): Free the list and hash table. - -2001-08-27 Jeffrey Stedfast <fejj@ximian.com> - - * mail-account-gui.c (mail_account_gui_new): Set the source and - transport description labels. - (transport_type_changed): Set the transport description label. - (source_type_changed): Set the source description label. - - * mail-tools.c (mail_tool_make_message_attachment): Remove - X-Evolution* headers. - (mail_tool_remove_xevolution_headers): New function to convenience - removing the X-Evolution headers. - (mail_tool_restore_xevolution_headers): New convenience function - to restore the X-Evolution headers. - (mail_tool_destroy_xevolution): New function to cleanup the - structure. - (mail_tool_forward_message): Remove and restore the X-Evolution - headers here too. - -2001-08-26 Jeffrey Stedfast <fejj@ximian.com> - - * mail-send-recv.c (receive_update_got_store): If the store is not - connected, scan it's subfolders first. - - * mail-ops.c (report_status): Call va_end() so LinuxPPC doesn't - have a caniption. - -2001-08-24 Jeffrey Stedfast <fejj@ximian.com> - - * mail-display.c (launch_cb): Use the new e_mkdtemp function. - - * folder-browser.c (message_list_drag_data_get): Use the new - e_mkdtemp function. - -2001-08-24 Ettore Perazzoli <ettore@ximian.com> - - [Fix #8024, Empty strings marked for translation.] - - * component-factory.c: Don't mark empty strings for translation. - Rather, give descriptions and display names to types "mailstorage" - and "vtrash". - -2001-08-24 Peter Williams <peterw@ximian.com> - - * mail-ops.c (remove_folder_get): Save the folder's full_name, - unref it, and *then* unref the store, so that the folder has been - closed before it gets deleted. - -2001-08-24 Peter Williams <peterw@ximian.com> - - * mail-config.c (add_shortcut_entry): Instead of using the length - of the shortcuts list as the index for the shortcut, use -1, which - means "last". - - * mail-config-druid.c (druid_finish): Remove the account adding - stuff since that happens in wizard_finish now. - - * mail-config.c (add_new_storage): New function. Add a - MailConfigAccount to the shell as a storage. - (maybe_add_shortcut): Renamed to new_source_created. - (new_source_created): Call add_new_storage here. - - * component-factory.c (mail_remove_storage_by_uri): Don't warn if - the storage isn't remote... no point in making the caller do extra - work. - -2001-08-24 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.c (mail_config_set_thread_list): Don't let the uri - be an empty string (how the fuck is this even happening in the - first place??). - (mail_config_get_thread_list): Same. - (mail_config_set_show_preview): And here. - (mail_config_get_show_preview): And finally here. - -2001-08-23 Larry Ewing <lewing@ximian.com> - - * mail-search.c (mail_search_construct): attach to the destroy - handler to reset the tokenizer. - (dialog_destroy_cb): reset the tokenizer here so that destroying - the dialog with the window manager still clears the hilighted - items. - -2001-08-23 Peter Williams <peterw@ximian.com> - - * mail-account-gui.c (mail_account_gui_save): Eek, let the user create - new accounts if old_account == NULL. - -2001-08-23 Jeffrey Stedfast <fejj@ximian.com> - - * component-factory.c (destination_folder_handle_drop): Check to - make sure we actually have drag data. - - * folder-browser.c (message_list_drag_data_received): Check to - make sure we have valid data. - -2001-08-21 Christopher James Lahey <clahey@ximian.com> - - * Revert fix for Ximian bug #6995. - -2001-08-23 Peter Williams <peterw@ximian.com> - - * mail-folder-cache.c (maybe_update): Record the timeout_id so we - can cancel it if the mail_folder_info is later freed. Also obviates - the use of the _UPDATE_QUEUED flag. - (mail_folder_cache_remove_folder): Cancel the timeout if we need to. - Lock around the hash table operations. Free mfi itself. Add debugging - spew. - (get_folder_info): Initialiae the timeout_id to 0. - -2001-08-22 Jon Trowbridge <trow@ximian.com> - - * mail-callbacks.c (ask_confirm_for_only_bcc): Provide alternative - text for this dialog for the case when a message has only Bcc - recipients because of a hidden contact list's addresses being - moved from To/Cc to Bcc. - (composer_get_message): Try to detect when our message has only - Bcc recipients because of moving addresses around due to a hidden - contact list, and show the dialog with the revised wording in this - case. - -2001-08-22 Jeffrey Stedfast <fejj@ximian.com> - - * component-factory.c (create_view): Don't blindly make all vtrash - folder types have a uri of vtrash:file:/, instead only make it use - vtrash:file:/ if it's a file: uri, else use physical_uri. - -2001-08-22 jacob berkman <jacob@ximian.com> - - * mail-display.c: rework how the e-card-popup thing has its life - managed. we now hide the window on the Hide event and destroy it - on the Destroy event emitted from its event source - -2001-08-22 Peter Williams <peterw@ximian.com> - - * mail-send-recv.c (set_send_status): We don't need to escape this - for printf'ing. - -2001-08-22 Peter Williams <peterw@ximian.com> - - Prevent the user from creating two accounts with the same name. - - * mail-config.c (impl_GNOME_Evolution_MailConfig_addAccount): - Abort if the account has the same name as another account. - - * mail-account-gui.c (mail_account_gui_save): Don't let the user - save if the account has the same name as another account. - - * mail-config-druid.c (management_check): Disable the next button - if the account name is the same as a preexisting account. - (construct): The only part of 'pages' that was being used was the - name. 'wizard_pages' now has the callbacks, while 'pages' is just - an array of char *'s. - (wizard_finish_cb): Save the account first because that's the - right way, and try to honor mail_account_gui_save's return value. - - * mail-config.glade: Add a label noting that you're not allowed to - create two accounts with the same name. - -2001-08-22 Peter Williams <peterw@ximian.com> - - * folder-browser-ui.c (fbui_sensitize_timeout): Check for NULL uic - here as well. - (fbui_sensitize_items): Up the timeout interval to 110 ms. - -2001-08-21 Peter Williams <peterw@ximian.com> - - * mail-account-editor.c (apply_changes): Honor the return value of - mail_account_gui_save. - - * mail-ops.c (sync_folder_desc): Say which folder is getting - saved. - -2001-08-21 Dan Winship <danw@ximian.com> - - * mail-identify.c (mail_identify_mime_part): Don't trust gnome-vfs - when it says "text/plain" if gnome_vfs_mime_type_from_name says - something different. Fixes a problem with recognizing icalendar - attachments labeled "application/octet-stream". Also, don't bother - asking gnome-vfs about winmail.dat attachments, since it will - often claim that they're MPEGs due to some mis-magic. - -2001-08-21 Jeffrey Stedfast <fejj@ximian.com> - - * mail-session.c (mail_session_forget_password): zero-ize the - password before freeing. - (forget_password): Same. - -2001-08-21 Peter Williams <peterw@ximian.com> - - * message-list.c (message_list_set_folder): Don't sink the extras - since _set_folder can get called more than once (on reconfigure.) - (message_list_destroy): So just unref the extras here. - - * mail-send-recv.c (build_dialogue): Treat the spool provider like - IMAP: update instead of performing an explicit receive. - -2001-08-21 Peter Williams <peterw@ximian.com> - - * folder-browser-ui.c (fbui_sensitize_items): Rename to - fbui_real_sensitize_items. Now we queue a change and set up a - timeout, making sure weed out redundant changes, fixing flicker. - (fbui_sensitize_timeout): New function. The timeout. - (fbui_real_sensitize_items): Semi-new function. Rename of old - fbui_sensitize_items. - (folder_browser_ui_set_selection_state): Pass the FB instead of - only the UIC to sensitize_items. - (folder_browser_ui_message_loaded): Same. - - * folder-browser.c (folder_browser_destroy): Kill the new timeout - if it is registered. - - * folder-browser.h: Add some members to FolderBrowser for keeping - track of the queue of changes. - -2001-08-20 Iain Holmes <iain@ximian.com> - - * mail-config.druid: Fix the jumping around. - -2001-08-20 Peter Williams <peterw@ximian.com> - - * mail-ops.c (remove_folder_get): Fix double-unref of the store. - -2001-08-20 Jeffrey Stedfast <fejj@ximian.com> - - * component-factory.c (create_folder): Modify the url and set the - protocol to mbox rather than hacking it and prepending mbox: to - the uri. - - * mail-local.c (get_folder): Don't prepend the folder_name with - the store's path because the hash key is folder_name, not - /folder_name. - -2001-08-20 Iain Holmes <iain@ximian.com> - - * mail-config-druid.c: Change some of the text labels. - (create_label): Make a label instead of a GtkHTML widget. - -2001-08-18 Iain Holmes <iain@ximian.com> - - * mail-account-gui.c (mail_account_gui_setup): Stop hiding the source - and transport frames. - -2001-08-20 Ettore Perazzoli <ettore@ximian.com> - - * folder-browser-ui.c (folder_browser_setup_property_menu): - Updated as ChangeFolderProperties is now in the - ComponentPlaceholder. - -2001-08-20 Peter Williams <peterw@ximian.com> - - * mail-accounts.c (mail_able): Whoops, make sure that the account - has a source before removing it or what-have-you. - - * subscribe-dialog.c: Add a few comments. - -2001-08-20 Damon Chaplin <damon@ximian.com> - - * folder-browser-ui.c: use new small trash icon for Delete command. - -2001-08-20 Ettore Perazzoli <ettore@ximian.com> - - * mail-ops.c (sync_folder_desc): s/Synchronising/Synchronizing/. - -2001-08-20 Jeffrey Stedfast <fejj@ximian.com> - - * component-factory.c (storage_create_folder): - camel_folder_create_folder can now return a heirachial tree so - subscribe to down the tree. - -2001-08-20 Damon Chaplin <damon@ximian.com> - - * folder-browser-ui.c: use new Cut/Copy/Paste icons. - -2001-08-19 Ettore Perazzoli <ettore@ximian.com> - - * component-factory.c: Update the folder list to include a display - name and a description. - -2001-08-19 Jeffrey Stedfast <fejj@ximian.com> - - * mail-mt.c (do_op_status): Allow the activity to be NULL if there - isn't a global_shell_client so that we don't try and report status - updates when the shell is destroyed. - - * mail-config.c (add_shortcut_entry): Return if there isn't a - global_shell_client. - - * component-factory.c (owner_set_cb): set the global_shell_client - here and connect to the destroy signal. - - * mail-vfolder.c (vfolder_create_storage): Use an extern - global_shell_client. - -2001-08-19 Christopher James Lahey <clahey@ximian.com> - - * mail-callbacks.c (delete_msg): Made delete make the cursor go - backwards if the user is sorting by descending date. Fixes Ximian - bug #6995. (Reverted.) - -2001-08-19 Jeffrey Stedfast <fejj@ximian.com> - - Note: The following changes were based on Zbigniew Chyla's fixes. - - * mail-callbacks.c (mail_generate_reply): Convert the date string - to UTF-8. - (do_forward_non_attached): Same here. - -2001-08-05 Zbigniew Chyla <cyba@gnome.pl> - - * folder-info.c: Added missing #include <config.h>. (applied by Damon) - -2001-08-18 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.c (config_read): Change the default values for - "always-sign" to false. - - * mail-callbacks.c (open_msg): if the folder is Outbox, let the - user edit the message(s) too I guess. - -2001-08-18 Ettore Perazzoli <ettore@ximian.com> - - * folder-browser-ui.c: Hook the new `delete-message.png' up. - -2001-08-17 Damon Chaplin <damon@ximian.com> - - * mail-display.c (pixmap_press): stop signal emission so the GtkButton - class method doesn't mess up the popup menu. Hopefully fixes bug #1828. - -2001-08-17 Zbigniew Chyla <cyba@gnome.pl> - - * mail-search.c (mail_search_construct): Put _() instead of N_() - around of the "Search" string, gnome_dialog_constructv doesn't - translate button names. - -2001-08-17 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (mail_write_authenticity): We want wax-seal.png - instead, since I added the png files to cvs and renamed it to - wax-seal.png. - -2001-08-17 Iain Holmes <iain@ximian.com> - - * importers/evolution-mbox-importer.c (load_file_fn): Fix - warnings. - -2001-08-17 JP Rosevear <jpr@ximian.com> - - * component-factory.c (owner_set_cb): don't init the config here - - * main.c (main): init the config here - -2001-08-17 JP Rosevear <jpr@ximian.com> - - * mail-config-druid.c: remove dead structure - -2001-08-17 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.c (mail_config_write): Save the always-sign options - for pgp and smime. - (config_read): Read in the always-save options for pgp and smime. - -2001-08-17 Christopher James Lahey <clahey@ximian.com> - - * message-list.etspec: Made the default values for column - expansions here more reasonable. - -2001-08-16 Iain Holmes <iain@ximian.com> - - * GNOME_Evolution_Mail.oaf.in: Add the Wizard stuff. - - * component-factory.c (component_fn): Init the Wizard factory. - (mail_load_storages): Check service isn't NULL before it's been - dereferenced. - - * mail-account-gui.c (mail_account_gui_setup): Only show the top level - widget is it's not NULL. - Change the gtk_widget_set_usizes to gtk_widget_hides. - - * mail-config-druid.c: Rewrite to use the EvolutionWizard stuff. - - * mail-config-druid.h: Add stuff to the MailConfigDruid struct. - - * mail-config.c (mail_config_get_default_account): Init the config if - it's not been inited. - -2001-08-16 Jason Leach <jleach@ximian.com> - - * mail-tools.c (mail_tool_quote_message): Only starting cutting - the signature out when we match "-- \n", so "--\n" in the middle - of a mail won't omit the rest for a quoted reply. Bug #7454. - -2001-08-16 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (confirm_expunge): Respect the user's desire to - be prompted to confirm that he wants to expunge the blasted - folder. Also, don't set the usize - that's just an evil hack and - you may find it will cut off text once the label has been - translated. - (create_msg_composer): In order for the security options to be - checked when composing a new message, we must set the from account - explicitly even though the composer hdrs sets the default from - account and emits the signal because at that stage the composer - hasn't yet connected to the signals and thus the bonobo menu items - don't get set. - - * mail-config.c (mail_config_set_confirm_expunge): New. - (mail_config_get_confirm_expunge): New. - -2001-08-16 Peter Williams <peterw@ximian.com> - - * subscribe-dialog.c (fe_got_children): Sort the nodes here... - (fe_sort_folder): ... using this function. - - * folder-browser-ui.c (folder_browser_ui_message_loaded): Check - for uic == NULL. I'm not sure how this could happen, but... - -2001-08-16 Peter Williams <peterw@ximian.com> - - * folder-browser-ui.c (folder_browser_ui_set_selection_state): - Disable "Search Message" when more or less than exactly one - message is selected. - - * subscribe-dialog.c (fe_done_subscribing): Instead of hackfully - getting the path, use a CamelURL so that escaping is - handled. Silly me. -- See below -- - (fe_node_to_shell_path): Use node->name and node->full_name to - generate the the shell path of this item. Don't need to escape the - URL, and handle cases when dir_sep != '/' - (fe_done_subscribing): Use fe_node_to_shell_path instead of the - CamelURL. Third time's the charm... * folder-browser-ui.c - (folder_browser_ui_set_selection_state): Disable "Search Message" - when more or less than exactly one message is selected. - - * subscribe-dialog.c (fe_done_subscribing): Instead of hackfully - getting the path, use a CamelURL so that escaping is - handled. Silly me. -- See below -- - (fe_node_to_shell_path): Use node->name and node->full_name to - generate the the shell path of this item. Don't need to escape the - URL, and handle cases when dir_sep != '/' - (fe_done_subscribing): Use fe_node_to_shell_path instead of the - CamelURL. Third time's the charm... - -2001-08-15 Jeffrey Stedfast <fejj@ximian.com> - - * mail-display.c (save_part): Remember the filename is in utf8, so - use the e_utf8 functions to set the filename in the file selection - dialog. - -2001-08-15 Peter Williams <peterw@ximian.com> - - * message-list.c (on_cursor_activated_idle): Always remove the - idle and return FALSE, instead of returning TRUE if more than one - message is selected. - -2001-08-15 Jason Leach <jleach@ximian.com> - - * mail-tools.c (mail_tool_quote_message): Stop building the quote - after a sigdash, hence, omitting the signature from a - reply/forward. Bug #5529. - -2001-08-15 Anna Marie Dirks <anna@ximian.com> - - * mail-callbacks.c (expunge-folders): Re-added, at Ettore's - request, the confirm-expunge dialog. - -2001-08-15 Jason Leach <jleach@ximian.com> - - * message-list.c (message_list_init): Use ALWAYS for scroll frame - policy because ETable acts lame with AUTOMATIC. Bug #6925. - -2001-08-16 Not Zed <NotZed@Ximian.com> - - * mail-callbacks.c (expunge_folder): Don't confirm expunge. - -2001-08-15 Not Zed <NotZed@Ximian.com> - - * mail-local.c (register_folder_register): Remove operation - registration/etc. Handled by mail-mt.c - - * message-list.c (regen_list_regen): Remove camel operation - registration/etc. - -2001-08-14 Jeffrey Stedfast <fejj@ximian.com> - - * mail-accounts.c (load_accounts): Convert the UTF-8 account name - string into a gtk-string before using it in the GtkCList. - -2001-08-14 Peter Williams <peterw@ximian.com> - - * mail-callbacks.c (previous_unread_msg): Make previous unread - wrap around too. - - * mail-accounts.c (load_accounts): If the account is enabled, - set a checkmark pixmap instead of a strange plus sign. - (mail_accounts_dialog_init): Load the pixmap here. - (mail_accounts_dialog_finalise): Free it here. - - * mail-accounts.h: Prototype it here. - -2001-08-14 Dan Winship <danw@ximian.com> - - * folder-browser.c (message_list_drag_data_get): Fix the fix for - #6722. - - * mail-ops.c (save_messages_save): Likewise. - (save_part_save): Deal with the possibility that - camel_mime_filter_charset_new_convert will return NULL (bad - charset name). Fixes #6611. - -2001-08-13 Jon Trowbridge <trow@ximian.com> - - * mail-search.c (mail_search_construct): Disable the "search - forward/backward" option in the search dialog. Why? Well, it - doesn't work properly (bug #4869), and the reason it doesn't work - is because of some scary stuff deep inside of gtkhtml that I don't - understand at all. So since I'm paranoid, and since the GUI - freeze is tomorrow, and since it isn't really an important feature - at all, I'm #if 0-ing it out. If the gtkhtml stuff gets sorted - out, we can slip it back in for 1.1. - -2001-08-13 Peter Williams <peterw@ximian.com> - - * component-factory.c (user_create_new_item_cb): New function, - handle "user creatable items". - (component_fn): Tell the shell that we're capable of creating - mail messages. - -2001-08-13 Jason Leach <jleach@ximian.com> - - * mail-local.c (get_folder): Fix this so it can actually get - folders from the hash of folders on the local store (it was - looking up plain @folder_name, which is typically "mbox", instead - of the full URI, /home/jleach/evolution/local/Foo/mbox). - - * component-factory.c (do_remove_folder): Rename to - remove_folder_done, more fitting for it's purpose. - (do_xfer_folder): Similar name change. - (do_create_folder): Similar name change. - (remove_folder): Don't notifyResult for the component here, we - will notify with our result in remove_folder_done. - (xfer_folder): Ditto. - - * mail-vfolder.c (vfolder_refresh): Create new folders with unread - counts of "0" instead of #FALSE (which just happens to be #defined - as zero). - -2001-08-13 Peter Williams <peterw@ximian.com> - - * mail-send-recv.c (mail_autoreceive_setup): Break most of the - functionality into a separate function. - (autoreceive_setup_list): Rename of mail_autoreceive_setup that is - passed a list of accounts. - (mail_autoreceive_setup_account): New function. Set up a single - account using autoreceive_setup_account. - - * mail-send-receive.h: Prototype mail_autoreceive_setup_account. - - * mail-account-gui.c (mail_account_gui_save): Instead of setting - up all accounts, set up only this source with the new - mail_autoreceive_setup_account. - - * mail-config-druid.c (druid_finish): ... which means we can call - mail_config_add_account() after the MailConfigAccount has been - created by mail_account_gui_save() because we no longer need the - account to be in the list for mail_autoreceive_setup() - - * mail-config.c (mail_config_add_account): ... which means we can - possibly add a shortcut to the account's sources's Inbox here. - (maybe_add_shortcut): New function. If the store is a storage, add - a shortcut to its inbox. Hope that /INBOX exists. - (add_shortcut_entry): New function. Creates a shortcut if it doesn't - yet exist. - -2001-08-13 Peter Williams <peterw@ximian.com> - - * mail-account-gui.c (service_complete): Take account of the fact that - service->path may be NULL (if service is a transport.) - - * mail-config-druid.c (druid_finish): Bleah, bugfix in case the - account has no source. - -2001-08-13 Anna Marie Dirks <anna@ximian.com> - - * mail-config.glade: Changed all instances of "Wizard" and "Druid" - to "Assistant". - - * mail-config-druid.c: Ditto. - -2001-08-13 Anna Marie Dirks <anna@ximian.com> - - * mail-accounts.c: Changed the title of the Mail Settings - dialog from "Evolution Account Manager" to "Mail Settings" . - -2001-08-13 Jeffrey Stedfast <fejj@ximian.com> - - * message-list.c (get_message_uid): Do some g_assert() - action. Make sure that the node passed in is non-NULL and also - make sure that the CamelMessageInfo gotten from the ETree is - non-NULL. - (get_message_info): Same here. - - * mail-callbacks.c (expunge_folder): Confirm that the user really - wants to expunge. - (save_msg_ok): Set the parent window here. - -2001-08-13 Peter Williams <peterw@ximian.com> - - * mail-config.c (remove_account_shortcuts): Remove the shortcuts - corresponding to an account (they all point to - evolution:/accountname/..) - (mail_config_remove_account): When deleting the account, remove - its shortcuts. - -2001-08-10 Peter Williams <peterw@ximian.com> - - * mail-config-druid.c (druid_finish): Whoa, fatal typo. Sorry. - -2001-08-13 Jason Leach <jleach@ximian.com> - - * mail-local.c (init_trash): Tell folder cache the path for our - Trash is /Trash, because that's what Shell needs to hear for - updating folders. - -2001-08-11 Jason Leach <jleach@ximian.com> - - * mail-offline-handler.c (impl_goOnline): Set the session as - online so auto mail checking (and the composer) will be doing the - right things when you go online. Bug #6343 and #4601. - - * folder-browser.c: Make the right click "Resend..." into "Edit as - New Message...", bug #6838. - - * mail-accounts.h: Remove unecessary #include <camel.h> - - * mail.h: Removed a prototype for a non-existant - mail_view_create(). - -2001-08-10 Jeffrey Stedfast <fejj@ximian.com> - - * mail-account-gui.c (build_auth_menu): Fix bug #4523 for good. - (save_service): If service->authitem is NULL, then the user tried - to enable authentication but the provider doesn't actually support - it. - -2001-08-10 Jon Trowbridge <trow@ximian.com> - - * folder-browser.c: Set our ESearchBarItems subitems to NULL. - -2001-08-10 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (transfer_msg): Prepend the uri with evolution: - to fix bug #6916. - -2001-08-10 Jason Leach <jleach@ximian.com> - - * folder-browser.c: Make the context menu for the Sent folder have - "Resend..." instead of "Resend", to clarify that it will bring up - a dialog needing your input rather than just blindly sending the - message again. Also give it the 'e' accelerator. Bug #6838. - - * mail-callbacks.c (next_unread_msg): Since 'N' keypresses go - through here now, use wrap-around selecting. - (previous_unread_msg): Same for 'P' here. - - * message-list.c (on_cursor_activated_idle): Stop this idle timer - when we have multiple items selected, this keeps it from loading - and then marking the last item in your selection list as read. - Bug #4693. - -2001-08-10 Peter Williams <peterw@ximian.com> - - * mail-accounts.c (mail_delete): Don't remove the account from the - tree if it's not enabled. - -2001-08-10 Jason Leach <jleach@ximian.com> - - * mail-ops.c (remove_folder_get): Remove all the messages from a - folder that's being deleted before actually doing the - camel_store_delete_folder, so it won't leave behind an mbox file - that's going to prevent the actual directory from being deleted, - and strange effects like new folders with the same name being made - in it's place. Bug #5618. - - * mail-folder-cache.c (mail_folder_cache_remove_folder): New - function, a way to get something out of the folder cache, like - folders being deleted. Bug #6878. - -2001-08-10 Peter Williams <peterw@ximian.com> - - * mail-accounts.c (news_add_destroyed): Whoops, compile fix. - -2001-08-10 Jason Leach <jleach@ximian.com> - - * mail-callbacks.c (mark_as_unseen): If marking messages as - unread, remove the automatic mark-as-read timer. Bug #4153. - -2001-08-08 Peter Williams <peterw@ximian.com> - - * component-factory.c (mail_load_storages): Don't load the storage - if it isn't enabled. - (mail_remove_storage_by_uri): New function. Goes through the - gymnastics of getting a CamelStore from the URI and calling - mail_remove_storage. Copied from mail_delete(). - (mail_load_storage_by_uri): Break out the storage-loading part of - mail_load_storages into a single function. - (mail_load_storages): Just call mail_load_storage_by_uri several - times. - - * mail.h: Prototype our new _by_uri functions. - - * mail-accounts.c (news_add_destroyed): Instead of hacking around - mail_load_storages, call mail_load_storage_by_uri. - (mail_delete): Move this chunk of code into - mail_remove_storage_by_uri. - (mail_able): Add or remove the storage as necessary, with our - new _by_uri functions. - - * mail-config-druid.c (druid_finish): See news_add_destroyed above. - -2001-08-10 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.c (mail_config_get_show_preview): Free dbkey if we - don't use it. - - * folder-browser.c (on_right_click): Added a comment about leaking - memory here, but we seem to not even use the 2 strings we - strdup...is this code still under construction? - - * mail-ops.c (mail_send_message): Free the sent_folder_uri at the - bottom of the function (ironically enough we were freeing it if we - encountered an error but never free'd it on success :-) - (get_folderinfo_got): Fixed a memory leak...this one would have - gone away once we got rid of the debug g_warning though. - -2001-08-10 Not Zed <NotZed@Ximian.com> - - * mail-ops.c (mail_transfer_messages): Dont want it to keep on - running if it got bad arguments, want it to bloody well crash. - (mail_append_mail): Same here. - -2001-08-09 Jeffrey Stedfast <fejj@ximian.com> - - * message-list.c (mlfe_callback): Added a g_assert_not_reached() - - I'm hoping this will help us track down the "can't delete message - sometimes" (ie bug #6637 and friends) bugs that users have been - reporting. If herein lies the problem, then we can expect some - crashes and some good backtraces, hopefully. - -2001-08-09 Peter Williams <peterw@ximian.com> - - * folder-browser.c (on_key_press): The bonobo menu items now - handle 'n' and 'p'. - (on_key_press): 'q' as well. - - * message-list.c (message_list_select): Fix inline documentation. - -2001-08-09 Anna Marie Dirks <anna@ximian.com> - - Fixes bug #6918 - - * folder-browser.c: Changed the "Store search as vFolder" menu - item to "Create vFolder from Search". - -2001-08-09 Jeffrey Stedfast <fejj@ximian.com> - - Fixes bug #6722 - - * mail-ops.c (save_messages_save): Don't set the default perms - here, let the user's umask deal with permissions. - - * folder-browser.c (message_list_drag_data_get): Don't set any - default perms. - -2001-08-09 Jeffrey Stedfast <fejj@ximian.com> - - * mail-account-gui.c (mail_account_gui_save): Save the pgp and - smime always-sign options. - - * mail-config.c (account_copy): Copy the always-sign options over - too. - -2001-08-08 Not Zed <NotZed@Ximian.com> - - * mail-ops.c (send_mail_send): Dont double-register this - operation, mail-mt will do it for us. - (get_folderinfo_get): " - (get_folder_get): " - (get_store_get): " - (create_folder_get): " - (remove_folder_get): " - (sync_folder_sync): " - (get_message_get): " - - * message-list.c (message_list_setup_etree): Free the etstate - object after we're done using it. - -2001-08-08 Peter Williams <peterw@ximian.com> - - * subscribe-dialog.c (sc_selection_changed): New function. Set the - sensitivity of the subscribe buttons based on whether any folders - are selected. - (menu_item_selected): If getting the widget for the first time, - hook up sc_selection_changed. - -2001-08-08 Peter Williams <peterw@ximian.com> - - * mail-ops.c (mail_update_subfolders): Change this gtk_object_ref - on the storage to a bonobo_object_ref. - - * component-factory.c (mail_lookup_storage): And here. - - * mail-vfolder.c (mail_vfolder_get_vfolder_storage): And here. - -2001-08-07 Ettore Perazzoli <ettore@ximian.com> - - * message-browser.c (set_bonobo_ui): Remove the "Customize - Toolbar" thing. - -2001-08-07 Not Zed <NotZed@Ximian.com> - - * mail-config.c (mail_config_get_thread_list): Free the dbkey if - we found the config option. - - * mail-send-recv.c (build_dialogue): Free the pretty_url after - we've used it. - (free_send_info): Free the 'what' string. - (receive_done): Use free_send_info to make sure we free - everything. - - * mail-ops.c (send_queue_free): Unref the filter driver when done. - (send_queue_send): Unref the driver here too, force any long - taking operations to run in our thread. - -2001-08-07 Peter Williams <peterw@ximian.com> - - * Revert Jeff's changes to subscribe-dialog.[ch]. It's not a widget, - it's an object from which you can obtain a widget. - -2001-08-07 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (manage_subscriptions): Hide the app->window. - (do_mail_print): Set the parent of the gnome-dialog to be the - folder-browser so that when evolution is closed, the print dialog - gets destroyed. Should fix bug #4781. - - * subscribe-dialog.c (subscribe_dialog_new): This should return a - GtkWidget not a GtkObject. - - * mail-session.c (get_filter_driver): Update to use user's logging - preferences. - - * mail-accounts.c (filter_log_toggled): New. - (filter_log_path_changed): New. - (construct): Get and attach signals to the filter logging option - widgets. - - * mail-config.c (config_read): Read in filter logging options. - (mail_config_write_on_exit): Save filter logging options. - (mail_config_set_filter_log_path): Implemented. - (mail_config_get_filter_log_path): Implemented. - (mail_config_set_filter_log): Implemented. - (mail_config_get_filter_log): Implemented. - -2001-08-07 Peter Williams <peterw@ximian.com> - - * subscribe-dialog.c (folder_etree_construct): Move - fe_create_root_node farther down, so we can check for its children - without problems. - - * mail-callbacks.c (folder_created): Use bonobo_object_unref on - the storage since it's a bonobo object. - (mail_storage_create_folder): Same. - (folder_deleted): Same. - - * mail-send-recv.c (receive_update_got_store): Same. - - * mail-ops.c (do_update_subfolders): Same. - - * subscribe-dialog.c (fe_destroy): Unref the e_storage since - lookup_store gives us a ref. - -2001-08-07 Peter Williams <peterw@ximian.com> - - * subscribe-dialog.c (folder_etree_construct): Move - fe_create_root_node farther down, so we can check for its children - without problems. - (storage_tree_path): Removed, this was broken. - (subscribe_get_short_folderinfo): Use the queued thread instead of - the new thread. - (subscribe_do_subscribe_folder): Same. - (ftree_node_new_root): Don't create the path anymore; it was - broken and there's a better way to get it now. - (fe_got_children): Remove some debugging output. - (fe_check_for_children): Here too. - (fe_done_subscribing): Get the path from the URI instead of the - ftree_node. - (_SubscribeDialogPrivate): Add all of our useful widgets as - members. - (sc_refresh_pressed): Don't clear the search... that makes no - sense now. - (sc_search_activated): Don't set the filter radio button as active - now; we use sensitivity instead. - (sc_all_toggled): Make the search entry insensitive. - (sc_filter_toggled): Make the search entry sensitive. - (kill_default_view): New function. Gets rid of the default view - stuff and makes all the widgetry sensitive. - (menu_item_selected): Check if we moved off of the default view - and, if so, call kill_default_view(). - (subscribe_dialog_construct): Initialize our new private widget - members, and by default insensitize most of the buttons because - they make no sense in the default view. - -2001-08-06 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.glade: Added key accelerators to a bunch of the - config options and moved the Bcc and empty-subject checkboxes to - the composer tab where they belong. - - * mail-callbacks.c (providers_config): Raise the dialog if it - exists already. - (manage_subscriptions): Raise the dialog if it already exists. - (main_select_first_unread): Removed (we haven't needed this code - in ages). - (select_first_unread): Same. - (save_msg_ok): If the path is empty, just return. - - * mail-local.c (mail_local_reconfigure_folder): Raise the dialog - if it already exists. - -2001-08-06 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (expunge_folder): Set the message-display - message to NULL if we can't get an info too. - -2001-08-06 Jason Leach <jleach@ximian.com> - - * mail-callbacks.c (create_folders): Make vtrash folders on other - storages with a "vtrash" type, so they get the little trashcan - icon. - -2001-08-06 Peter Williams <peterw@ximian.com> - - * subscribe-dialog.[ch]: Reimplement to be asynchronous and pretty, - with progressive folder loading and all sorts of wonderful - improvements. - - * mail-callbacks.c (manage_subscriptions): Change to reflect API - update. - - * Makefile.am (etspec_DATA): Add subscribe-dialog.etspec. - (glade_DATA): And the glade file. - - * subscribe-dialog.etspec: New file, break out the specification - from inside the subscribe-dialog.c - - * subscribe-dialog.glade: Update this, actually use it now. - -2001-08-06 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (empty_trash): Yuck. Special case whether or - not we want to expunge all the trash folders syncronously or - asyncronously based on whether or not we are doing Empty-On-Exit - or emptying trash by user request respectively. - -2001-08-06 Jason Leach <jleach@ximian.com> - - * mail-folder-cache.c (make_folder_name): Removed this function, - it's not needed anymore. - (mail_folder_cache_note_folderinfo): Initialize mfi->unread to 0 - always, so the shell won't get sent a random int for vtrash or - potentially other folders. - - * message-list.c (message_list_select): Fix a minor glitch with - how it started a backwards wraparound at the 2nd to last message, - skipping the very last message. - -2001-08-06 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.glade: s/character set/character encoding - -2001-08-05 Ettore Perazzoli <ettore@ximian.com> - - * message-browser.c (message_browser_message_loaded): Make the - title of the window "subject - Message" instead of just "subject". - Also, display "(No subject)" if the subject is NULL. - - [Fix #6399, 8-bit characters are not displayed in window title.] - - * message-browser.c (message_browser_message_loaded): Convert the - subject from UTF-8 to GTK. - -2001-08-05 Ettore Perazzoli <ettore@ximian.com> - - [Revert the previous changes, there seems to be something wrong - with it.] - - * component-factory.c (component_factory_init): Back to using - `bonobo_generic_factory_new()'. - (component_fn): Updated accordingly. - -2001-08-04 Ettore Perazzoli <ettore@ximian.com> - - * component-factory.c (component_factory_init): Use - `e_bonobo_generic_factory_multi_display_new()' instead of just - `bonobo_generic_factory_new()'. - (component_fn): Added @component_id arg. - -2001-08-04 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (mail_part_is_inline): Add yet another - special-case hack for application/pgp. - -2001-08-04 Jason Leach <jleach@ximian.com> - - * message-list.c (message_list_select): Add a @wraparound - argument, so the 'n' and 'p' keypresses (or anything else that - wants to) can wrap around to find the next unread. - - * folder-browser.c (on_key_press): Tell it to wrap around here. - - * mail-callbacks.c (delete_msg): Don't wrap around here (or the - other callbacks in this file). - -2001-08-03 Jason Leach <jleach@ximian.com> - - * mail-folder-cache.c (update_idle): Updates for EvolutionStorage - API changes. - - * mail-importer.c (mail_importer_create_folder): Ditto. - - * mail-local.c: Same here. - -2001-08-03 Jeffrey Stedfast <fejj@ximian.com> - - * mail-account-gui.c (build_auth_menu): Try to restore the choice - the user had chosen before hitting the "Check Supported Types" - button. - - * mail-format.c (write_headers): Removed a no-longer-needed - g_warning. - -2001-08-03 Not Zed <NotZed@Ximian.com> - - * mail-session.c (get_password): return the source url for - popb4smtp auth request. - -2001-08-02 Jon Trowbridge <trow@ximian.com> - - * mail-ops.c (filter_folder_describe): Added. Provide - description for filter_folder_op. - (fetch_mail_describe): Added. Provide description for - fetch_mail_op. - - * message-list.c (regen_list_describe): Added. Provide - description for regen_list_op. - - * mail-config.c (check_service_describe): Added. Provide - description for check_service_op. - - * folder-info.c (do_describe_info): Added. Provide description - for get_info_op. - -2001-08-02 Larry Ewing <lewing@ximian.com> - - * mail-send-recv.c (format_url): handle null paths in the dialog - so that we avoid printing NULL strings - -2001-08-02 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (filter_edit): Raise the filter-editor window - if it's already created. - - * folder-browser.c (message_list_drag_data_received): I obviously - can't spell recieved, er, received...uh, yea. - -2001-08-02 Jason Leach <jleach@ximian.com> - - * mail-config.glade: Set history_id's for the sig and html sig - gnome file entry boxes so it can persist history, also add titles - to the dialogs that popup when you click the "Browse..." button. - Bug #5595. - -2001-08-02 Jeffrey Stedfast <fejj@ximian.com> - - * mail-vfolder.c (vfolder_create_storage): Connect to the - folder_remove signal on the storage. - (vfolder_remove): New function to remove a vfolder. - (vfolder_edit): Raise the window if it already exists. - -2001-08-02 Not Zed <NotZed@Ximian.com> - - * Makefile.am (INCLUDES): Add EVOLUTION_BUTTONSDIR to get to some - different icons. - - * mail-ops.c (mail_sync_folder): Queue the folder sync operation, - rather than running it in parallel. - - * mail-send-recv.c: applies anna's patch for prettier send-recv - dialogue. - (parse_url): Renamed to format_url, fixed callers. - (format_url): Use camel_url_free instead of g_free, also handle - case where we have no host (use path instead). - (build_dialogue): Cleaned up some whitespace. - (build_dialogue): Create the label directly with the right text, - dont set any text in the progress bar, and save the label into the - info struct for later updating. - (struct _send_info): Added 'status' the label with the status - string. - (operation_status_timeout): - (receive_done): - (receive_cancel): Set the status label, not the progress format - text. - (hide_send_info): NULL out status too. - (mail_receive_uri): Init status. - (free_folder_info): Initiate a folder sync here, so we can ... - (free_send_data): ... Remove the awful hack of iterating through - bonobo controls to sync all open folders. - (free_send_data): Initiate a sync of the inbox too. - (build_dialogue): Remove set_alignment on the icon, its not a - gtkmisc object. - -2001-08-01 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser.c (folder_browser_copy): Do the Right Thing (tm) - if the message list is not the widget in focus (which is to copy - the text selected in the html viewer instead). Fixes bug #5868. - -2001-08-01 Jason Leach <jleach@ximian.com> - - * folder-browser-ui.c: Use the new Save As and Message Search - icons from Jakub. - - * mail-callbacks.c (delete_msg): Don't move cursors around when - deleting last message and Hide Deleted Messages isn't enabled. - Bug #5928. - -2001-07-31 Anna Marie Dirks <anna@ximian.com> - - * mail-mt.c (do_get_pass): Changed the title of this dialog - to "Enter Password". - -2001-07-30 Jeffrey Stedfast <fejj@ximian.com> - - * mail-mt.c (do_get_pass): We are not guarenteed to have a - non-NULL service (ie. PGP) thus check for it. - (pass_got): And again here. - (mail_get_password): And of course here too. - - * mail-format.c (decode_pgp): When writing out a CamelException to - the HTML stream, be sure to translate it first. - (handle_message_external_body): Convert to UTF8 here too - I know - this function is basically a dead end right now but eventually we - will want to do something. I mostly did this because param values - are UTF8 encoded so we should avoid mixing and matching UTF with - non UTF8. - (format_mime_part): Avoid writing non-UTF8 to the HTML stream. - - * mail-tools.c (mail_tool_make_message_attachment): Convert - translated strings to UTF8 here too. - (mail_tool_forward_message): Here too. - -2001-07-23 Zbigniew Chyla <cyba@gnome.pl> - - * mail-format.c (attachment_header, write_address, decode_pgp, - mail_write_authenticity): - Convert translated strings to UTF8 before calling mail_html_write. - - I modified the patch slightly and cleaned up bits of code around - it as well. For example, we probably want to avoid having HTML - tags in the strings to be translated. -- fejj - -2001-07-30 Jeffrey Stedfast <fejj@ximian.com> - - * mail-account-gui.c (mail_account_gui_new): Restore old security - settings from the saved configuration. Fixes bug #5710. - -2001-07-30 Not Zed <NotZed@Ximian.com> - - * mail-session.c (do_register_timeout): Actually add the timeout, - this time in the gtk thread. - (do_remove_timeout): And same for remove. - (register_timeout): - (remove_timeout): Proxy the gtk calls to the main thread, and - wait for them to execute synchronously. - (register_timeout): Instead of return with fail for a too small - timeout, just increase the timeout. - -2001-07-27 Zbigniew Chyla <cyba@gnome.pl> - - * component-factory.c (populate_folder_context_menu): Added (unused) - table with strings intended to be translated (i18n tools can't extract - strings from XML data inside .c file). - -2001-07-27 Jeffrey Stedfast <fejj@ximian.com> - - * mail-mt.c (focus_on_entry): Don't need this anymore. - (do_get_pass): Since we already have the entry widget, no need to - do the nasty focus_on_entry hack. - -2001-07-26 Peter Williams <peterw@ximian.com> - - * mail-mt.c (do_get_pass): Figure out whether we're getting the - password for the source or the transport, and get the toggle - button accordingly. - (pass_got): Same. - - * mail-config.c (mail_config_get_account_by_transport_url): New - function. Cut + paste + search + replace of _by_source_url. - - * mail-config.h: Prototype here. - -2001-07-26 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser.c (message_list_drag_data_get): If we don't have - any messages selected, break out. This fixes bug #5612. - - * component-factory.c (xfer_folder): Fixed a strstr (url, - "noselect=yes") brokenness. - (destination_folder_handle_motion): Same. - (destination_folder_handle_drop): And again here. - - * mail-format.c (handle_application_pgp): Implemented. - (setup_mime_tables): Setup the application/pgp handler to use - handle_application_pgp instead of handle_text_plain. - (handle_text_plain): Remove special-case hacks for application/pgp - types. - - * mail-config.glade: beautification. - -2001-07-26 Peter Williams <peterw@ximian.com> - - * mail-mt.c (do_get_pass): Use magic to make the password - remembering checkbutton come after the entry, visually. - -2001-07-26 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (write_headers): Respect Gtk theme colors for the - fonts and calculate a new table gbcolor based on gtk theme - preferences. - - * mail-config.glade: Label the enabled field. - -2001-07-26 Peter Williams <peterw@ximian.com> - - * message-list.etspec: Make the date column smaller and the - subject column larger, relatively. - - * mail-folder-cache.c (make_folder_status): Don't display "0 - hidden". - - * folder-browser.c (on_key_press): Make 'q' a toggle, not one-way. - - * message-list.etspec: Rename "Date" column to "Sent". - -2001-07-25 Anna Marie Dirks <anna@ximian.com> - - * mail-config.glade: fixed a mis-spelling of "Fashion" in the mail - accounts window. (See bug 5433) - -2001-07-25 Jeffrey Stedfast <fejj@ximian.com> - - * mail-session.c (make_key): Don't make the key url:item if we - have the url, just make it url. This fixes bug #5339. - (mail_session_set_password): Removed. - -2001-07-25 Peter Williams <peterw@ximian.com> - - * folder-browser.c (etree_key): Make it so Enter always opens the - message in another window. - -2001-07-25 Peter Williams <peterw@ximian.com> - - * mail-mt.c (mail_get_password): Now take a CamelService parameter - (as passed by Camel). Allows us to have a "remember password" - checkbox that is set correctly and whose settings can be - propagated back to the proper MailConfigService. - (do_get_pass): Add a checkbutton allowing the user to change - whether the password is remembered or not. - (pass_got): Apply the setting of the "remember password" - checkbutton (if not cancelled.) - - * mail-mt.h: Update the prototype here. - - * mail-config.c (mail_config_service_set_save_passwd): New - function, pretty bland. - - * mail-config.h: Prototype our bland new function. (Get it? It's a - pun!) - - * mail-session.c (get_password): Pass the service as well. - -2001-07-25 Jeffrey Stedfast <fejj@ximian.com> - - * mail-account-gui.c (build_auth_menu): Now takes a - check_supported gboolean argument saying whether or not to disable - non-supported authtypes. - (source_type_changed): Update for build_auth_menu. - (transport_type_changed): Same. - (service_check_supported): Pass in TRUE for the disable - non-supported authtypes to build_auth_menu and also disable - check-supported button and the authtype menu if we get a NULL - supported auth list. - - * mail-callbacks.c (mail_generate_reply): Initialize `me' to NULL. - (forward_attached): If we are only forwarding a single message, - pass the message along as the callback data, else pass NULL. - (do_forward_attach): Updated for changes to - forward_get_composer(). - (do_forward_non_attached): Same. - (forward_get_composer): Try to guess which account to forward the - message from if the message passed in is non-NULL. - -2001-07-24 Peter Williams <peterw@ximian.com> - - * mail-config.c (mail_config_write): Um, write the HTML signature - settings in the right place. Whoops. - -2001-07-24 Jason Leach <jleach@ximian.com> - - * mail-callbacks.c (delete_msg): If we're deleting the last - message, select the previous, not next, which actually selects - nothing. Fixes #5323. - -2001-07-24 Jeffrey Stedfast <fejj@ximian.com> - - * mail-ops.c (save_part_save): Pass the O_TRUNC flag to open so - that we don't leave trailing garbage at the end of the file if the - new file content is shorter than the old file content. - - * component-factory.c (create_view): Fix for bug #5174. - -2001-07-24 Jason Leach <jleach@ximian.com> - - * mail-config.c (config_read): Match the prefix for the - "remember_passphrase" setting with where it's being saved to - (/Mail/Prompts), so the setting gets loaded correctly. Fixes - #5351. - -2001-07-24 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (handle_text_plain): check_specials if this is an - application/pgp type as well. - - * mail-ops.c (add_vtrash_info): When dumping the CamelURL to a - string, hide all the params. - -2001-07-24 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (guess_me): Do a case-insensitive comparison. - (mail_generate_reply): Only resort to the source account's - identity if we can't find out which identity to use based on the - recipients of the message first. - - * mail-config.c (mail_config_get_default_account): Make sure to - return the 0th account if we don't have a default. We don't want - to return NULL. - - * mail-callbacks.c (empty_trash): Use mail_tool_get_trash for the - remote store trash folders. - - * mail-tools.c (mail_tool_get_trash): New convenience function. - -2001-07-24 Jason Leach <jleach@ximian.com> - - * mail-config.c (config_read): get_boolean_with_default for the - "Mark as read" timeout, not get_long_with_default. Fixes #5176. - -2001-07-24 Peter Williams <peterw@ximian.com> - - * mail-folder-cache.c (make_folder_name): Don't display "(0 unsent)" if - the outbox is empty. - - * mail-local.c (init_trash): Set up the local trash in the folder - cache. - - * mail-folder-cache.c (update_idle): Make the error reporting a little - but more descriptive. - -2001-07-24 Peter Williams <peterw@ximian.com> - - * mail-config.glade: Add new label widgets with a message that SSL - isn't supported. - - * mail-account-gui.h: Add a new member to the Transport GUI struct - for the 'SSL is not supported' message. - - * mail-account-gui.c (source_type_changed): Change logic to display - a message stating that SSL isn't supported if SSL isn't supported. - (transport_type_changed): Same. - (mail_account_gui_new): Also load the labels for the the no-SSL - message. - - * mail-accounts.c (construct): Fix typo. - -2001-07-24 Not Zed <NotZed@Ximian.com> - - * component-factory.c (create_folder): Dont call notifyResult here - if we've just launched a thread to do the work, it calls it - itself. This apparently breaks the importers, but thats a - different issue. - -2001-07-23 Not Zed <NotZed@Ximian.com> - - * mail-mt.c (mail_msgport_replied): Go back to calling - mail_msg_free here. - (mail_msg_destroy): Remove the operation unregistration stuff. - (mail_msg_received): And put it here, so we unregister as soon as - the async part of the operation is complete. I thought about this - and we should be doing this anyway so we register/unregister - always in the same thread, although the camel_operation api - doesn't enforce it, this *is* what it expects. - - * message-list.c (regen_list_regen): re-add reporting to - rebuilding the message list. Basically fixes #4931 - -2001-07-23 Jeffrey Stedfast <fejj@ximian.com> - - * mail-search.c (toggled_fwd_cb): Oops. Uncomment this code since - Trow fixed GtkHTML to actually have this function now. - - * mail-config.glade: Fixed the "Read" to be Read in the glade file - per menesis' request. - - * mail-accounts.c (construct): Give the dialog a Close button - instead of an OK button. - (prompt_bcc_only_toggled): New. - (threaded_list_toggled): New. - (show_preview_toggled): New. - (construct): Add code for the bcc-only-prompt, threaded-list, and - show-preview checkboxes. - - * mail-ops.c (transfer_messages_transfer): If the source and - destination folders are the same, just mark the uids as undeleted - (in case they were marked as deleted before). - -2001-07-23 Jon Trowbridge <trow@ximian.com> - - * mail-search.c (begin_cb): Carefully check for NULL everywhere, - and do the right thing if the message we are currently looking at - gets expunged. (Bug #4870) - -2001-07-23 Jason Leach <jleach@ximian.com> - - [Bug #5225: No UI way to mark as unimportant] - - * folder-browser.c (on_right_click): Do the necessary stuff to - show or hide the correct "Mark Important" or "Mark as Unimportant" - menu items depending on the status of messages that are selected. - - * folder-browser-ui.c: Add the MarkAsUnimportant verb here. - - * mail-callbacks.c (mark_as_unimportant): Simple function that's - the callback for these new menu items. - -2001-07-22 Ettore Perazzoli <ettore@ximian.com> - - * component-factory.c (remove_folder): Updated to get a @type - argument. Return an error if the type isn't "mail". - (xfer_folder): Likewise. - -2001-07-21 Ettore Perazzoli <ettore@ximian.com> - - * component-factory.c: Make types "mailstorage" and "vtrash" - non-user-creatable. - -2001-07-20 Jason Leach <jleach@ximian.com> - - * mail-summary.c (generate_html_summary): Change this back to the - "evolution:/local/Inbox" URI. - -2001-07-20 Peter Williams <peterw@ximian.com> - - * component-factory.c (storage_remove_folder): Don't let the user - remove vtrash folders. - -2001-07-20 Peter Williams <peterw@ximian.com> - - * mail-mt.c (mail_msgport_replied): Fix DanW's fix. Pass the right - arguments to mail_msg_destroy. - - * component-factory.c (component_fn): Don't populate the context - menu; our only action didn't even work. - (populate_folder_context_menu): Removed. ChangeFolderProperties - needs a FolderBrowser which we don't have. It didn't even work - before. - - * mail-local.c (mail_local_reconfigure_folder): Bring the creation - of the hash table to the beginning to prevent warnings. Complain - if the mailbox is non-local. - -2001-07-20 Jeffrey Stedfast <fejj@ximian.com> - - * mail-ops.c (filter_folder_filter): Don't expunge the source - folder if we have a cache. - -2001-07-20 Dan Winship <danw@ximian.com> - - * mail-mt.c (mail_msgport_replied): Use mail_msg_destroy rather - than mail_msg_free, so the cancellation operation gets - unregistered and doesn't leak two file descriptors. - -2001-07-19 Jason Leach <jleach@ximian.com> - - * mail-summary.c (generate_html_summary): Update this - evolution:/local/ URI to evolution:/Local Folders/ to go along - with today's shell changes. - -2001-07-19 Jason Leach <jleach@ximian.com> - - * mail-display.c: Fix #4605: "Save Image as" should be "Save Image - as...". - -2001-07-19 Jason Leach <jleach@ximian.com> - - * mail-display.c (mail_display_new): Set the vertical scrolling - policy for the mail display to AUTOMATIC, only get a scrollbar if - the e-mail is longer than one frame. - - * folder-browser.c (my_folder_browser_init): We were setting the - policy twice (and to two different things). Removed this one. - - * message-list.c (message_list_init): Set the policy for the - message list scroll frame to be horizontal=NEVER, - vertical=AUTOMATIC (scrollbar only if you have >1 page of - messages). - -2001-07-19 Peter Williams <peterw@ximian.com> - - Track the NoSelect changes in Camel. - - * mail-callbacks.c (create_folders): We don't need to check if - the URL is NULL or not anymore. - - * component-factory.c (create_noselect_control): New - function. Create a dummy control for folders that can't contain - messages (ie \NoSelect) - (create_view): If the URI says the folder is noselect, make a - dummy control. FIXME: still should merge in the global UI - elements. - (xfer_folder): Don't allow the operation if the destination is - NoSelect. - (destination_folder_handle_motion): Ditto. - (destination_folder_handle_drop): Ditto. - -2001-07-19 Not Zed <NotZed@Ximian.com> - - * mail-local.c (reconfigure_folder_reconfigure): remvoed - register/start/end etc code. - - * mail-ops.c (get_messages_desc): Add the count here. - (get_messages_get): Remove the register/start code, its handled - above us. - (save_messages_desc): Added count. - (save_messages_save): Removed register/start/end code. - - * mail-mt.c (mail_msg_received, mail_msg_destroy): Changed to use - camel_operation rather than mail_status. - (mail_msgport_received, mail_msgport_replied): Turn of the - mail_status stuff, we dont need to report on stuff running in the - gui thread right? - (retrieve_shell_view_interface_from_control, set_view_data, - mail_statusf, mail_status, mail_status_end, mail_status_start, - status_timeout, do_del_status, set_status_op): removed now - redundant stuff. - (mail_msg_free): Removed reference to timeout_id. - -2001-07-18 Not Zed <NotZed@Ximian.com> - - * mail-local.c (reconfigure_folder_reconfigure): Changed to use - camel_operation rathre than mail_status. - (reconfigure_folder_describe): re-enabled this function. - - * mail-ops.c (get_messages_get): Changed to use camel-progress for - status reporting. - (save_messages_save): Likewise. - -2001-07-17 Not Zed <NotZed@Ximian.com> - - * mail-mt.c (struct _mail_msg_priv, destroy_objects, mail_msg_new, - mail_msg_free, do_op_status): Changed to use an EvolutionActivityClient for - progress. - -2001-07-18 Jason Leach <jleach@ximian.com> - - * mail-tools.h (mail_tool_get_local_inbox_url): Remove this - prototype for a function that was removed long ago. - (mail_tool_get_local_movemail_url): Ditto. - -2001-07-18 Jason Leach <jleach@ximian.com> - - [Simplifying how default account is stored and used internally, - fixes possabilities of having multiple default accounts and things - like deleting the current default account] - - * mail-account-gui.c (mail_account_gui_new): Update for new way of - finding out the default account. - (mail_account_gui_save): Ditto. - - * mail-accounts.c (load_accounts): Ditto. - - * mail-config-druid.c (make_default_account): Ditto. - - * mail-config.c: Added an int MailConfig::default_account, to be - used instead of a 'default_account' boolean on each mail account. - (mail_config_set_default_account_num): New function, facilitates - things. - - * Mail.idl: removed the Account::default_account boolean. - -2001-07-18 Jeffrey Stedfast <fejj@ximian.com> - - * mail-tools.c (mail_tool_generate_forward_subject): Do what was - suggested in #4596. - -2001-07-18 Peter Williams <peterw@ximian.com> - - * mail-accounts.c (construct): Add GTK_WIDGET to the charset - picker. Reportedly prevent a craash for someone... ? - - * mail-config.glade: Typo fix. - Later: And actually fix the typo. - -2001-07-17 Jeffrey Stedfast <fejj@ximian.com> - - * mail-accounts.c (mail_delete): Setup the auto-receive here - instead. - - * mail-config.c (mail_config_remove_account): Don't setup the - auto-recv here. - -2001-07-17 Iain Holmes <iain@ximian.com> - - * mail-accounts.c (mail_able): Reset the auto receive. - - * mail-config.h (mail_config_remove_account): Reset the autoreceive. - -2001-07-17 Jason Leach <jleach@ximian.com> - - * mail-account-gui.c (source_type_changed): Fix for last change: - hide the entire widget, not just the entry. - -2001-07-17 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser.c (message_list_drag_data_recieved): Fix to - correctly handle text/uri-lists that contain more than a single - url. - - * component-factory.c (destination_folder_handle_drop): Fix to - correctly handle text/uri-lists that contain more than a single - url. - -2001-07-17 Jason Leach <jleach@ximian.com> - - * mail-config.glade: Make the Path: entry into a GnomeFileEntry so - you get a nice "Browse..." button that pops up a file selector to - locate your mbox files. Bug #3501. - -2001-07-17 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (mail_part_toggle_displayed): Cleaned up a bit. - (handle_multipart_encrypted): Replace the encrypted part with the - decrypted part. - -2001-07-17 Iain Holmes <iain@ximian.com> - - * mail-accounts.c (mail_delete): Make a nicer dialog. - -2001-07-17 Jeffrey Stedfast <fejj@ximian.com> - - * mail-local.c (init_trash): Use CAMEL_VTRASH_NAME. - - * mail-ops.c (add_vtrash_info): Use CAMEL_VTRASH_NAME. - - * folder-browser.c: turned off some debugging - -2001-07-16 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (transfer_msg): Disallow vtrash for now... - - * mail-ops.c (add_vtrash_info): Use g_strcasecmp() when looking - for a Trash folder - it may be lowercase or something funky. - (transfer_messages_transfer): Special-case vtrash folders. - - * mail-local.c (init_trash): No need to specify the vfolder - expression here. This code was moved into camel-vtrash-folder.c - ages ago. - - * component-factory.c: Let VTrash folders accept/export the same - dnd types as normal folders. - -2001-07-16 Peter Williams <peterw@ximian.com> - - * mail-folder-cache.c (outbox_folder): prototype outbox_folder so - we can check if a folder is it. - (make_folder_name): If the folder is the outbox, display the count - of total messages as "unsent". - (make_folder_status): If the folder is the outbox, display - "unsent" instead of "total" - -2001-07-16 Peter Williams <peterw@ximian.com> - - * mail-display.c (mail_display_redisplay): Use our own - display_style member instead of the global setting. - (mail_display_init): Initialize display_style. - - * mail-display.h: Include "mail-config.h" and add a display_style - member. - - * mail-format.c (write_headers): Look at the MailDisplay's - display_style instead of using the full_headers data. - - * folder-browser.c (folder_browser_set_message_display_style): Set - the MailDisplay's display style as well as the global display - style. - (my_folder_browser_init): Don't save preference changes by - default. (This is only observered wrt. the message display style - but should apply to other items.) - - * folder-browser-factory.c (folder_browser_factory_new_control): - Set this FB to save the preferences set in it. - - * folder-browser-ui.c (folder_browser_ui_add_message): Read our - display's state instead of the global setting. - -2001-07-16 Peter Williams <peterw@ximian.com> - - * mail-folder-cache.c (mail_folder_cache_set_folder_browser): DUH. - No need to update every folder if we set the folder browser to - NULL. - -2001-07-15 Jeffrey Stedfast <fejj@ximian.com> - - * mail-account-gui.c (mail_account_gui_save): Call - mail_autoreceive_setup() so that any changes to the list of - accounts will be respected the next time mail is checked. - -2001-07-13 Peter Williams <peterw@ximian.com> - - * mail-callbacks.c (expunge_folder): Segfault prevention here if - no uid is currently loaded. - - * mail-vfolder.c (unlist_vfolder): New function. If a vfolder in - our list gets finalized, NULL out info->folder (Is it wrong if - this happens?) Also, locking issues? - (vfolder_uri_to_folder): Hook up to the finalize event here. - -2001-07-13 Jeffrey Stedfast <fejj@ximian.com> - - * mail-ops.c (filter_folder_filter): Updated to reflect changes in - the filter API by passing in the provided uid cache to - camel_filter_driver_filter_folder. - (mail_filter_folder): Set the cache to NULL. - (mail_fetch_mail): Set the cache to NULL. - (fetch_mail_fetch): If a cache exists for this folder, set - it. When we are finished filtering the incoming messages, the - logic changes a bit. We now save the cache if keep_on_server is - set *or* if there was an exception this way if the user's download - gets interrupted, he won't have to download all the messages - again. - (fetch_mail_fetch): Oh yea, and just so if we get an exception - with `delete' turned on, the next time the user checks mail and an - exception *doesn't* occur, it will go back and mark all the - messages for deletion. - -2001-07-12 Iain Holmes <iain@ximian.com> - - * importers/evolution-mbox-importer.c (load_file_fn): Check that - the folder does exist before trying to import it. - -2001-07-12 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (expunge_folder): Force-hide all deleted - messages before expunging. - (expunged_folder): Restore the user's "hide deleted messages" - preference. - -2001-07-12 Jason Leach <jleach@ximian.com> - - * mail-callbacks.c (expunge_folder): Only blank the mail display - if the message being viewed is one of those to be expunged. Bug - #4030. - -2001-07-12 Jason Leach <jleach@ximian.com> - - * mail-config.c (config_read): Should be saving the - 'identity_html_signature' and 'identity_has_html_signature" keys - in the /Mail/Accounts prefix (with the rest of the per-account - stuff, not on it's own) - -2001-07-11 JP Rosevear <jpr@ximian.com> - - * mail-display.c (get_embedded_for_component): no longer need to - set a my address property - -2001-07-10 Federico Mena Quintero <federico@ximian.com> - - * mail-display.c (link_copy_location): Set the CLIPBOARD selection - as well as the primary selection so that Edit/Paste will work in - other programs (e.g. Netscape). - (mail_display_new): Add the target for the CLIPBOARD selection. - -2001-07-10 Jason Leach <jleach@ximian.com> - - [Bug #4305: Make the automatic mark-as-read timer optional] - - * mail-config.glade: Necessary changes to make the Mark as "Read" - label a toggle button instead. - - * mail-accounts.c (construct): Connect to the "toggled" on our new - toggle. - (timeout_toggled): New callback, called from above. - - * mail-config.c (mail_config_get_do_seen_timeout): New. - (mail_config_set_do_seen_timeout): New. - (mail_config_write_on_exit): Save the preference here. - (config_read): Load it here. - -2001-07-10 JP Rosevear <jpr@ximian.com> - - * folder-browser.c: Cosmetic patch - replace our defines with the - e-popup ones - - * Makefile.am: Typo - -2001-07-10 Peter Williams <peterw@ximian.com> - - * mail-format.c (attachment_header): Took the logic of whether or - not to make the attachment header out of the actual function. - (mail_part_is_displayed_inline): Return if the part is being - displayed inline (regardless of whether it is actually inline). - (mail_part_toggle_displayed): Toggle whether it's displayed inline - or not. - (get_inline_flags): Determine whether the part is displayed inline - and whether it is actually inline. - (mail_format_mime_message): Initialize the attachment_status hash - table. - - * mail-display.c (inline_cb): Instead of modifying the - CamelMimePart, use mail_part_toggle_displayed - (button_press): As above. - (pixmap_press): Use mail_part_is_displayed_inline instead of - mail_part_is_inline. Get the MailDisplay from the popup to do - this. - - * mail.h: Add prototypes. - -2001-07-10 JP Rosevear <jpr@ximian.com> - - * Makefile.am: extra dist the news files - -2001-07-10 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.c (mail_config_write_on_exit): Use - bonobo_config_set_string_wrapper. - (mail_config_write): Same. - (bonobo_config_set_string_wrapper): Macro wrapping - bonobo_config_set_string that passes "" as the val if the val is - NULL. - - * mail-callbacks.c (mail_generate_reply): Make sure that the - reply-to addr i non-NULL before trying to add it to the hash - table. - -2001-07-09 JP Rosevear <jpr@ximian.com> - - * mail-account-gui.c (get_focused_widget): fix typo so it compiles - -2001-07-09 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (setup_mime_tables): Handle application/pgp using - the text/plain handler. - - * mail-account-gui.c (get_focused_widget): New function to - determine which widget is focused. - - * mail-account-editor.c (apply_changes): Not only flip to the - notebook page that wasn't finished, but also grab the focus of the - incomplete widget. - - * mail-config-druid.c (source_changed): Grab the focus of the - incomplete widget. - (transport_prepare): And here. - (identity_changed): Here too. - - * mail-account-gui.c (mail_account_gui_identity_complete): Take an - incomplete argument so we can set which widget is incomplete and - then the caller can focus it or whatever. - (service_complete): Same. - (mail_account_gui_transport_complete): And again here. - (mail_account_gui_management_complete): And here too. - -2001-07-09 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (decode_pgp): Update to pass in the `remember' - argument when creating a new pgp context. - (try_inline_pgp_sig): And here... - - * mail-crypto.c (mail_crypto_pgp_mime_part_sign): Update to pass - in the `remember' argument when creating a new pgp context. - (mail_crypto_pgp_mime_part_verify): Same. - (mail_crypto_pgp_mime_part_encrypt): And here... - (mail_crypto_pgp_mime_part_decrypt): And finally here. - - * mail-config.c (mail_config_get_remember_pgp_passphrase): New. - (mail_config_set_remember_pgp_passphrase): New. - (config_read): Read in the "remember passphrase" value. - (mail_config_write_on_exit): Save the remember-passphrase value. - - * mail-accounts.c (construct): Allow the user to set "Remember PGP - Passphrase". - (remember_pgp_passphrase_toggled): Set the toggle state. - -2001-07-09 Peter Williams <peterw@ximian.com> - - * mail-ops.c (get_folderinfo_got): Check for an exception and - print it. Call done anyway. - (do_update_subfolders): Check for NULL info. - -2001-07-09 Peter Williams <peterw@ximian.com> - - * mail-config.c (mail_config_write): Some NULL protection for our - strings: pgp_key, html_signature, smime_key. Probably we should do - this for all strings. Either that or change Bonobo Config. - - * message-list.c (message_list_init): Explicitly initialize search - to NULL. Bug 3951 might to be due to a problem wrt this, and it - can't hurt. - -2001-07-09 Dan Winship <danw@ximian.com> - - * mail-display.c (save_part): g_strdup the result of - g_get_home_dir since this variable will get free'd later. - - * mail-format.c (mail_lookup_handler): Use - gnome_vfs_mime_get_short_list_applications rather than - gnome_vfs_mime_get_default_application. - - * mail-display.c (pixmap_press): Construct the EPopupMenu array on - the fly, based on the number of applications available to open the - MIME type. - (launch_cb): Figure out which menu item was clicked, and invoke - the appropriate application. Ugh, messy, because of the EPopupMenu - interface. Probably should get rewritten some day. Also, make this - handle apps with expects_uris set too. - -2001-07-09 Peter Williams <peterw@ximian.com> - - * mail-config.c (mail_config_write): Change html_signature stuff - over to bonobo-config -- someone forgot to do this. - - * mail-folder-cache.c (dm): Gave up and got rid of dm. Just - replaced it with d(g_message()) and set G_LOG_DOMAIN. - -2001-07-09 Peter Williams <peterw@ximian.com> - - * mail-folder-cache.c (mail_folder_cache_set_update_shellview): - Deleted - (as opposed to #if 0) - (get_folder_info): Changed to assume it has the folder lock. - (make_folder_name): Same. - (make_folder_status): Same. - (update_idle): Don't unlock around the make_folder_ functions. - (*): Changed behavior wrt. get_folder_info. Lock before calling, - but also move preconditions before -- get_folder_info can only - return NULL if uri is NULL. Also add preconditions for other - arguments where necessary. - -2001-07-07 Christopher James Lahey <clahey@ximian.com> - - * message-list.c (on_cursor_activated_cmd): Check for new_uid != - NULL here before strcmping. - -2001-07-07 Dan Winship <danw@ximian.com> - - * main.c (main): Only install the segv_redirect handler if SEGV's - handler is not currently SIG_DFL. Otherwise you get an infinite - SEGV loop if you run with GNOME_DISABLE_CRASH_DIALOG. - -2001-07-07 Christopher James Lahey <clahey@ximian.com> - - * message-list.c (message_list_select): Made this handle being - given a row that's outside the range better. - -2001-07-06 Jason Leach <jleach@ximian.com> - - [Fix bug #1100, default account is stored strangely] - - * mail-config.c (mail_config_get_default_account_num): New - function, returns the integer of the position of the default - account, used to save which account is the default to the config - db. - (mail_config_write): Save the default account number here in - "/Mail/Accounts/default_account". - (config_read): Load in which is the default here. - -2001-07-06 Larry Ewing <lewing@ximian.com> - - * mail-callbacks.c (composer_send_cb): add a NULL check since that - is a valid return. - -2001-07-06 Peter Williams <peterw@ximian.com> - - * mail-format.c (format_mime_part): Prevent infinite recursion when - viewing attachments that we can't / shouldn't display but are some - form of plaintext. Cf bug #2234 - -2001-07-06 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser.c (folder_browser_copy): Freeze and Thaw the - folder. - -2001-07-06 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser.c (folder_browser_copy): Mark the messages as - Seen also. - (folder_browser_class_init): Create an atom type for - X-Evolution-Message selection type. - (my_folder_browser_init): Add our multiple selection types, one of - which is the default string type. - - * component-factory.c (destination_folder_handle_drop): Update to - use the new X-Evolution-Message type format. - - * folder-browser.c (selection_get): Convert the - X-Evolution-Message clipboard type to whatever format the target - wants. - (message_list_drag_data_get): Update because the - X-Evolution-Message type changed. - (folder_browser_copy): Same. - (x_evolution_message_parse): And here too. - -2001-07-06 Peter Williams <peterw@ximian.com> - - * mail-callbacks.c (composer_postpone_cb): Don't free the psd here -- - it will be freed on the "destroy" signal. - - * mail-folder-cache.c (maybe_update): Instead of an idle, use a very - short timeout in hopes of reducing the number of redundant updates. - - * mail-tools.c (mail_tool_uri_to_folder): Only note the folder in the - cache if we successfully got it. - -2001-07-06 Jason Leach <jleach@ximian.com> - - * mail-callbacks.c (delete_msg): Select the very next message - after deleting, not the next undeleted (it can make things jump - around in annoying ways if you are deleting many messages), bug #4032. - - * folder-browser.c: Forgot to commit the "Mark as Important" right - click menu item. - - * message-list.c (message_list_set_folder): Setup the strikeout - column here (after we've gotten the folder) so we can disable - strikeouts for vtrash folders, part of bug #2224. - -2001-07-06 Dan Winship <danw@ximian.com> - - * mail-folder-cache.c (mail_folder_cache_set_folder_browser): Fix - obvious bug in previous bugfix: Pass "fb" to check_for_fb_match() - so only the selected folder gets updated, instead of "all folders - that haven't yet been selected". - -2001-07-06 Ettore Perazzoli <ettore@ximian.com> - - * component-factory.c (populate_folder_context_menu): New function - to populate the right-click menu for mail folders. - (component_fn): Pass it to `evolution_shell_component_new()'. - -2001-07-05 Jeffrey Stedfast <fejj@ximian.com> - - * mail-accounts.c (construct): Add a checkbox for prompting when - sending a message with an empty subject. - - * mail-ops.c (mail_send_message): If filtering fails, return right - away. - - * mail-config.c (mail_config_set_show_preview): Okay, apparently I - was wrong. Oh well. - (mail_config_set_thread_list): Fix this one too. - -2001-07-05 Peter Williams <peterw@ximian.com> - - * mail-vfolder.c (vfolder_uri_to_folder): Add mail folder cache - hookups. - - * Makefile.am: Remove the ridiculuous relic known as - test-mail. Clean up a bit. - - * mail-vfolder.c (vfolder_uri_to_folder): Add mail folder cache - hookups. - -2001-07-05 Peter Williams <peterw@ximian.com> - - * mail-folder-cache.c (mail_folder_cache_set_folder_browser): - Clear the shell view label if mailer loses focus. - - * mail-ops.c (do_update_subfolders_rec): Check for NULL url before - calling folder cache functions. - -2001-07-04 Gediminas Paulauskas <menesis@delfi.lt> - - * folder-browser-ui.c (message_pixcache): set icon for - ApplyFilters command. - -2001-07-04 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.c (mail_config_set_show_preview): Revert Sam's - changes. - - Note: Uhm, g_hash_table_lookup_extended gives us a pointer to the - original value which we can just change to update the hash table - without the need to re-insert - it's already there!! Also, you - don't want to g_hash_table_insert the new value with the same key - without at least first removing the existing bucket. And, you - certainly don't want to g_free() the key after you insert it - - eek!! - -2001-07-03 Sam Creasey <sammy@oh.verio.com> - - * mail-config.c (mail_config_set_show_preview): Replace value in - config->preview_hash when it already exists. Old code never - re-inserted into the hash, just assigned to val -- it's an int - here, not a real pointer. - -2001-07-03 Joe Shaw <joe@ximian.com> - - * mail-callbacks.c (expunge_folder): Unset the message being displayed - when expunging. This makes expunged messages not show in the preview - pane when they're not there anymore. Fixes #3591. - -2001-07-03 Joe Shaw <joe@ximian.com> - - * mail-callbacks.c (mail_reply): If msg is NULL, fetch the message - and requeue a mail_reply call. Fixes bug #3816. - (requeue_mail_reply): Callback from mail_get_message(). - -2001-07-03 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.c (mail_config_get_show_preview): Use a better - GHashTable technique that will hopefully solve some bugs and also - use _with_default bonobo-config call. - (mail_config_set_show_preview): No sense in removing the entry - from the hash table and then re-inserting it. Just reset the - value. - (mail_config_get_thread_list): Use the same logic. - (mail_config_set_thread_list): And again here. - -2001-07-03 Peter Williams <peterw@ximian.com> - - * mail-folder-cache.c (make_folder_name, make_folder_status): - Split make_string into these. - (update_idle): Use (name and status) instead of (wide and thin) - for the text. - -2001-07-03 Jason Leach <jleach@ximian.com> - - * folder-browser-ui.c: "Mark as Important" menu thingy here. - -2001-07-03 Peter Williams <peterw@ximian.com> - - * folder-browser.c (message_list_drag_data_get): Compile fixes. - #include errno.h and gnome-dialog-utils.h. s/dirname/tmpdir/ - -2001-07-03 Peter Williams <peterw@ximian.com> - - Prevent folders from appearing to have -1 new messages. Prevent - nonactive folders from updating the title bar. Make the title bar - update when switching to an already-opened folder. - - * mail-folder-cache.c (update_message_counts): Ignore the value - for 'unread' if it is -1. - (get_mail_info_receive): Same - (mail_folder_cache_note_folderinfo): Same. - (get_folder_info): Initialize 'fb' to NULL. - (mail_folder_info): Add 'fb' member. - (mail_folder_cache_note_fb): Change note_message_list to this. - (update_idle): Only update the ShellView if the active folder - browser is the same as the one that the MFI references. - (mail_folder_cache_set_folder_browser): New function. Use it to - set the active folder browser. NULL is okay. - (check_for_fb_match): Called from the above. If the MFI has the - new folder browser as its view, queue an update. - - * mail-folder-cache.h: Fix prototypes. - - * mail-callbacks.c (create_folders): Check if fi->url is nonnull. - - * folder-browser.c (got_folder): Change to use note_fb instead of - note_messge_list. - - * folder-browser-factory.c (control_activate): Set the folder - browser - (control_deactivate): Clear it here. - (fb_get_svi): Kill some inappropriately cut-n-pasted code. - -2001-07-03 Dan Winship <danw@ximian.com> - - * mail-config.glade: Rename some of the widgets in the news config - to not conflict with the mail config stuff, so the mail config - druid will work again. - -2001-07-03 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser.c (message_list_drag_data_get): Use mkdtemp if we - have it, else use mktemp but make the code safer than it was - previously. - - * mail-display.c (launch_cb): Free the template string if the - tempdir failed to be created. - - * folder-browser.c (message_list_drag_data_get): Hide the URL - passwd, auth, and params. - (folder_browser_copy): Same. - -2001-07-03 Dan Winship <danw@ximian.com> - - * mail-ops.c (filter_folder_filter): Don't pass a dirty exception - to camel_folder_sync. Fixes an IMAP filtering crash. - -2001-07-02 Sam Creasey <sammy@oh.verio.com> - - * mail-account-editor-news.c: Added an MailAccountEditorNews, for - NNTP configuratuion. Based on MailAccountEditor, but stripped. - - * Makefile.am: added mail-account-editor-news.c and - mail-account-editor-news.h to SOURCES if ENABLE_NNTP is defined. - - * mail-accounts.c (load_news): Moved this function, and fixed some - slight brokenness. - (news_edit): Added functional code using MailAccountEditorNews - (news_add): Added functional code using news_edit after - allocation. - - * mail-config.glade: news_editor_window widget added. Used by - MailAccountEditorNews. - - * mail-display.c (save_data_cb): Store the pathname used when - saving messages so that the next save box will default to the - previous path. - - * message-browser.c (message_browser_new): add signal handler for - size_allocate on the message browser. Thus new windows are size - as they were last allocated. - (message_browser_size_allocate_cb): handler to store allocations. - - * message-list.c (message_list_setup_etree): connect to the - info_changed signals for the state of the message_list->tree. - Save the folder state to disk, so that when additional - message_lists are created, they are consistant. e.g. the next - buttons do the same thing in the browser, and in the message - viewer after changing sorting options. - - * subscribe-dialog.c (build_tree): freeze sc->folder model while - building the tree. Not doing so takes a very long time over 40000 - newsgroups. - -2001-07-02 Jeffrey Stedfast <fejj@ximian.com> - - * mail-accounts.c (construct): Setup the Empty Trash On Exit - widgets. - - * mail-config.c (config_read): Option to emtpy trash on exit. - (mail_config_write_on_exit): Same. - (mail_config_set_empty_trash_on_exit): Set the option. - (mail_config_get_empty_trash_on_exit): Get the option. - - * component-factory.c (owner_unset_cb): Empty the trash folders if - the user set the "empty trash on exit" option. - -2001-07-02 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (transfer_msg): Updated for the - mail_transfer_messages API. - - * folder-browser.c (message_list_drag_data_recieved): Update for - the mail_transfer_messages API. - (selection_received): Same. - - * mail-ops.c (mail_transfer_messages): Renamed from - mail_do_transfer_messages and also added a callback/data arguments - since we need it component_factory::xfer_folder. - - * component-factory.c (xfer_folder): Use mail_transfer_messages - instead. - (destination_folder_handle_drop): Update to pass in a NULL - callback arg and a NULL data argument to mail_transfer_messages. - -2001-07-02 Larry Ewing <lewing@ximian.com> - - * mail-display.c (save_part): move the saving logic out of save_cb - so that we can reuse it for the image saving code. - (save_cb): call save_part. - (save_url): new function to resolve an save an html url. - (image_save_as): save function for images and. Add it to the - link_menu, and add MASK_URL and MASK_SRC to the structure so that - we cans show the proper menus. - (html_button_press_event): call get_src as well to find external - urls references. Add popup masking. - -2001-07-02 Peter Williams <peterw@ximian.com> - - * README.async: Add a warning about how wrong this document is. - -2001-07-02 Peter Williams <peterw@ximian.com> - - * mail-folder-cache.h: New file. Protoypes for the Mail Folder - Cache, which provides a place for all the disparate pieces of the - mailer to save bits of information about a folder. Centralizes the - information display code. - - * mail-folder-cache.c: New file. Implements the Mail Folder Cache. - - * Makefile.am (evolution_mail_SOURCES): Add the - mail-folder-cache.{c,h} - - * folder-browser-factory.c (fb_get_svi): Copy of that absurdly - long-named function in mail-display.c that gets the - GNOME_Evolution_ShellView. - (control_activate): Set the ShellView for the folder cache. - - * folder-browser.c (got_folder): Tell the folder browser about - this folder. - - * mail-callbacks.c (create_folders): Tell the folder cache about - the new folders. - - * mail-local.c (reconfigure_folder_reconfigure): Don't unhook our - events as we no longer hook them up. - (register_folder_registered): Tell the folder cache about this - folder's place in the local storage. - (register_folder_register): No longer hook events; the Folder - Cache will do this. - (local_folder_changed, local_folder_changed_proxy): Move to - mail-folder-cache.c - (free_local_folder): No longer unhook events. - - * mail-ops.c (do_update_subfolders_rec): Instead of setting the - folder status ourselves, inform the Folder Cache about the - changes. - - * mail-tools.c (mail_tool_uri_to_folder): Replace danw's cache - with the new Mail Folder Cache. - (cache_folder, etc): removed. - -2001-07-02 Jeffrey Stedfast <fejj@ximian.com> - - * mail-accounts.c: #include widgets/misc/e-charset-picker.h since - it was moved there from libgal. - -2001-07-02 Peter Williams <peterw@ximian.com> - - * importers/evolution-mbox-importer.c (mbox_factory_fn): Kill - irritating "Returning" g_warning. - -2001-07-02 Dan Winship <danw@ximian.com> - - * mail-session.c (get_filter_driver): Implement this, based on - code that used to be in mail-ops.c - - * mail-ops.c (mail_load_filter_context, setup_filter_driver): - Moved into MailSession::get_filter_driver. - (filter_get_folder): Moved to mail-session.c - (mail_filter_folder, mail_filter_on_demand, mail_fetch_mail, - mail_send_mail, mail_send_queue): Remove FilterContext args, use - camel_session_get_filter_driver. - - * mail-send-recv.c (mail_send_receive, mail_receive_uri): - Remove FilterContexts - -2001-07-01 Chris Toshok <toshok@ximian.com> - - * subscribe-dialog.c (subscribe_dialog_gui_init): the FolderSearch - control is in a different dockitem now. - -2001-07-01 Dan Winship <danw@ximian.com> - - * mail-tools.c (update_unread_count): Ref the folder before - proxying the event, in case there's only one reference to it and - it gets unreffed before the other end of the event handler runs. - (update_unread_count_main): And unref it when we're done. - (mail_tool_uri_to_folder): Only hold the lock around the hash - table operations, not the entire function. Holding the lock the - whole time can cause deadlock when resolving vfolders, and the - CamelSession and CamelStore locks ensure that multiple threads - calling this function will end up with the same CamelFolder object - at the end anyway, so we just need to lock and re-check the cache - at the end before adding the folder to the cache. - -2001-06-30 Ettore Perazzoli <ettore@ximian.com> - - * folder-browser-ui.c: Get MailNext/MailPrevious to use - next-message.png and previous-message.png, respectively. Also - change Print to use print.png. - -2001-06-30 Jon Trowbridge <trow@ximian.com> - - * mail-display.c (make_popup_window): Changed to return the - created window. - (find_socket): Added. Copied from e-shell-view.c. The fact - that I'm copying this bit of code all over isn't cool. - (html_button_press_event): Properly destroy the popup window when - the widget inside the control is destroyed. - - * mail-callbacks.c (addrbook_sender): Added. Implements - the "Add sender to addressbook" right-click. (Bug #3645) - (find_socket): Added. Copied from e-shell-view.c. - - * folder-browser.c: Added "Add sender to addressbook" to - context_menu[]. - - * mail-display.c: (handle_embedded_address_object): Removed. - (on_object_requested): Removed handling for embedded address - objects. (Which was obsolete crap.) - -2001-06-29 Larry Ewing <lewing@ximian.com> - - * mail-display.c (html_button_press_event): remove redundant - logic. - - * mail-callbacks.c (create_msg_composer): make sure we show the - sig file. - -2001-06-29 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser-factory.c (control_deactivate): Turn folder - syncing back on here so that IMAP folders will sync without - needing to hit Send & Receive. - - * mail-callbacks.c (ask_confirm_for_only_bcc): Throw up the - confirmation dialog. - (composer_get_message): If the user only specified Bcc recipients, - prompt him/her to make sure we should continue and risk the server - adding an Apparently-To header. - - * mail-config.c (config_read): Read in config option for prompting - when only Bcc recipients are specified. - (mail_config_write_on_exit): Save the option. - (mail_config_get_prompt_only_bcc): New. - (mail_config_set_prompt_only_bcc): New. - -2001-06-29 Dan Winship <danw@ximian.com> - - * mail-account-gui.c (build_auth_menu): Take two authtypes lists, - "all", and "supported", and make the unsupported authtypes grayed - out in the menu rather than missing. - (source_type_changed, transport_type_changed, - service_check_supported): Update build_auth_menu calls. - -2001-06-29 Radek Doulik <rodo@ximian.com> - - * mail-account-gui.c (menu_file_save_cb): implemented plain saving - -2001-06-28 Radek Doulik <rodo@ximian.com> - - * mail-account-gui.c (load_signature): implemented plain load - (load_signature): use e_msg_composer_get_signature_html - -2001-06-28 Peter Williams <peterw@ximian.com> - - * mail-ops.c (mail_send_message): Revert fejj's Bcc header removal; - this unsets the BCC recipients and so doesn't send to the Bcc'd - people at all. - -2001-06-28 Jeffrey Stedfast <fejj@ximian.com> - - * mail-send-recv.c (free_send_data): The e_iterator_get() returns - a gconstpointer and we need a non-const BonoboControl so cast it. - - * mail-account-gui.c (mail_account_gui_new): - gui->check_html_signature is GtkToggleButton not a GtkCheckButton. - - * folder-info.c: Added some #include's to supress warnings. - -2001-06-28 Ettore Perazzoli <ettore@ximian.com> - - * mail-display.c: Fix case of labels in the `link_menu' so that it - is consistent with that of the other menus in Evolution - [i.e. "Copy Link Location" instead of "Copy Location" etc.]. - -2001-06-28 Ettore Perazzoli <ettore@ximian.com> - - * mail-display.c (invisible_selection_get_callback): New, signal - handler for "selection_get" on the GtkInvisible widget we use for - selections. - (invisible_selection_clear_event_callback): New, signal handler - for "selection_clear_event" on the same invisible widget. - (mail_display_init): Initialize the `selection' and `invisible' - members. Also, explicitly initialize all the other fields as - well. - (mail_display_destroy): Free `selection'. Destroy `invisible'. - (link_copy_location): Re-implemented to just make the mail display - become the owner of the primary selection. - (on_selection_get): Remove `#if 0'ed code. - (mail_display_new): Remove the `#if 0'ed code that would connect - selection stuff to the HTML widget. - (mail_display_new): Connect the signals and add the targets to the - invisible widget. - - * mail-display.h: New members `selection' and `GtkInvisible' in - `MailDisplay'. - -2001-06-28 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.c (mail_config_write_on_exit): Don't bother trying - to save the passwd if the url is NULL. - - * folder-browser.c (vfolder_mlist): Strip the mlist name to fix - bug #3732. - - * component-factory.c (destination_folder_handle_drop): Since we - have an exception variable, we might as well use it when getting - folders too. - - * folder-browser.c (message_list_drag_data_recieved): Call - gtk_drag_finish. - -2001-06-28 Dan Winship <danw@ximian.com> - - * mail-tools.c (mail_tool_uri_to_folder): After finding a folder, - attach to its "folder_changed" and "message_changed" signals. - (update_unread_count, update_unread_count_main): Moved here from - folder-browser but basically unchanged. Doing this here lets us - get folder tree updates for folders that have had messages - moved/copied/filtered into them, but which don't yet have a view - associated with them. - - * folder-browser.c (update_unread_count, update_unread_count_main, - etc): Moved to mail-tools.c - -2001-06-28 Radek Doulik <rodo@ximian.com> - - * mail-config.c: use new fields everywhere - - * mail-config.h: as below - - * Mail.idl: added html_signature and has_html_signature - -2001-06-28 Ettore Perazzoli <ettore@ximian.com> - - * component-factory.c (component_fn): Register for the "mailto" - schema. - (handle_external_uri_cb): Callback for the "handle_external_uri" - signal. - (component_fn): Connect it. - -2001-06-27 Ettore Perazzoli <ettore@ximian.com> - - * component-factory.c (component_fn): Pass NULL as the - @external_uri_schemas argument to - `evolution_shell_component_new()'. - -2001-06-27 Peter Williams <peterw@ximian.com> - - * folder-browser-ui.c: Uncomment EditSelectThread. Yaay! - - * mail-callbacks.c (select_thread): New function. Self-explanatory - name. Implementation is a little hairy. - - * mail-callbacks.h: Prototype it here. - - * mail-callbacks.c (invert_selection): Here too. - (select_all): Here too. - - * subscribe-dialog.c (subscribe_select_all): Update to use new - ETree accessors. - (subscribe_invert_selection): Here too. - -2001-06-27 jacob berkman <jacob@ximian.com> - - * folder-browser.c (save_cursor_pos): work around an e-tree bug - -2001-06-27 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser.c: Fixed Cut/Copy/Paste to work - it turns out I - couldn't share a single GtkInvisible between all the - FolderBrowser's after all. - -2001-06-27 Peter Williams <peterw@ximian.com> - - * folder-browser-factory.c (control_deactivate): Change to use - more reality-based API below. - Include folder-browser-ui.h too. - (control_activate): Remove now-unused 'int state'. - - * folder-browser-ui.h: Changed prototypes to match changes below. - - * folder-browser-ui.c (folder_browser_ui_rm_message): Commented out - to reflect reality of how this stuff works (you can't actually remove - the pieces). - (folder_browser_ui_rm_global): Same. - (folder_browser_ui_rm_list): Left because here we add the view menus. - (folder_browser_ui_add_list): ... which were moved here. - (folder_browser_ui_rm_all): New function, does the job of old ui_rm() - -2001-06-26 Peter Williams <peterw@ximian.com> - - * folder-browser-ui.c: New file derived from - folder-browser-factory.c. Contains the Bonobo UI code, split into - three groups as described in ui/ChangeLog. Also contains the - GalView stuff and the hookups into the Bonobo UI stuff. - - * folder-browser-factory.c: Move most of the UI stuff to - folder-browser-ui.c. - (control_activate): Add all three kinds of UI element to this - folderbrowser. - (control_deactivate): Remove all three kinds. - - * folder-browser-ui.h: New file. Prototypes functions to add UI - elements to a FolderBrowser. - - * Makefile.am: Add folder-browser-ui.{c,h} - - * message-browser.c (PARENT_TYPE): Change to BONOBO_TYPE_WINDOW - (message_browser_destroy): Chain to parent destroy function. - (set_bonobo_ui): New function. Add the 'message' functions from - the folder browser to our UI. - (message_browser_close): BonoboVerbify this. - - * message-browser.h: Convert to BonoboWindow. - -2001-06-26 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser.c (my_folder_browser_init): Helps if I spell - "received" correctly. - - * mail-config.c (mail_config_set_thread_list): If the value is - already in the hash table, first remove it before setting the new - value so we don't leak. - (mail_config_set_show_preview): Same. - -2001-06-26 Dan Winship <danw@ximian.com> - - * mail-mt.c (op_status_timeout): Don't pop up a progress dialog to - say "I already finished this a while ago". - - * component-factory.c (storage_create_folder): Pass the path - prefix to folder_created so it can add it to the folder tree in - the right place. - - * mail-callbacks.c (folder_created): Take a path prefix. - -2001-06-26 jacob berkman <jacob@ximian.com> - - * mail-config.c (mail_config_get_show_preview): make ettore stop - complaining so i can get back to work - -2001-06-26 Jeffrey Stedfast <fejj@ximian.com> - - * component-factory.c (message_rfc822_dnd): No longer returns a - gboolean and also takes a CamelException. - (destination_folder_handle_drop): Do better error checking. - - * folder-browser.c (my_folder_browser_init): Connect to the - tree-drag-data-recieved signal. - (message_list_drag_data_recieved): New function that handles the - recieving end of the DnD event. - (x_evolution_message_parse): New convenience function to parse the - x-evolution-message type so that the cut/paste and DnD code can - share it. - (selection_received): Use x_evolution_message_parse(). - - * mail-config.c (config_read): Read in the default show_preview - value. - (mail_config_write_on_exit): Save the default show_preview value - as well as saving the individual settings for each URI that has - been changed. - -2001-06-25 Joe Shaw <joe@ximian.com> - - * folder-browser.c (invisible_destroyed): Check to make sure that - clipboard_selection is non-NULL before we g_byte_array_free() it. - -2001-06-25 jacob berkman <jacob@ximian.com> - - * mail-send-recv.c (free_send_data): sync folders after we've - gotten mail - - * folder-browser-factory.c (control_activate): set the ui - component on the folder browser - (control_activate): update the view preview item - (control_deactivate): don't sync the folder here - (control_deactivate): unset the ui component of the folder browser - - * mail-callbacks.c (toggle_flags): stuff from jleach to add an - importance keybinding - (mark_as_important): ditto - (toggle_as_important): again - - * mail-config.c (mail_config_get_show_preview): - (mail_config_set_show_preview): basically a copy of - get_thread_list() but for the preview pane - - * folder-browser.c (folder_browser_destroy): unref the our ui - component - (folder_browser_set_ui_component): new function for setting the ui - component - (save_cursor_pos): - (set_cursor_pos): try to show the selected row when the preview - pane is shown - (folder_browser_set_message_preview): implement - (folder_browser_toggle_preview): toggle the preview (duh) - (on_key_press): add keybindings for marking as important (!), and - hiding the preview pane (q) - (etree_key): clean up a little bit, and make enter either show the - preview pane or open the message - (fb_resize_cb): only save the paned size if the preview is alread - shown - (folder_browser_gui_init): pass ourselves to fb_resize_cb - (on_message_selected): only add the timeout if the preview is - shown - -2001-06-25 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser.c (folder_browser_destroy): Unref the invisible - window that we use for slections. - (folder_browser_class_init): Init the clipboard_atam type. - (selection_get): New - (selection_clear_event): New - (selection_received): New - (folder_browser_copy): New function to copy the message-list - selection. - (folder_browser_cut): New function to cut the message-list - selection. - (folder_browser_paste): New function to paste the message-list - selection. - (my_folder_browser_init): Initialize `invisible` if it's NULL else - ref it - also set some signals on it. - - * folder-browser-factory.c: Added verbs for cut/copy/paste. - -2001-06-23 Jason Leach <jleach@ximian.com> - - * mail-local.c (local_storage_removed_folder_cb): Fixes here for - removing folders. - - * mail-ops.c (remove_folder_get): Some fixes in here too. - -2001-06-22 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.c (config_read): Duh, we saved the charset as - "default_charset", not "charset" - no wonder the correct charset - menu item was never being set. - -2001-06-21 Jeffrey Stedfast <fejj@ximian.com> - - * mail-ops.c (mail_send_message): Temporarily remove the Bcc - header before sending the message. - -2001-06-21 Jon Trowbridge <trow@ximian.com> - - * mail-display.c (html_button_press_event): Remove empty "name" - property setting from the popup control. - -2001-06-21 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (composer_get_message): Allow the message to be - sent even if there are no To recipients but only as long as there - are other recipients defined. - -2001-06-21 Jason Leach <jleach@ximian.com> - - * component-factory.c (mail_remove_storage): Deregister the - storage from the shell so it will get removed from the folder - tree. - -2001-06-20 Kjartan Maraas <kmaraas@gnome.org> - - * folder-browser.c: More than one accel key is a tad - confusing. - -2001-06-19 Jeffrey Stedfast <fejj@ximian.com> - - * mail-display.c: #include "folder-browser-factory.h" - - * component-factory.c (mail_remove_storage): New function to - remove an EvolutionStorage. - - * mail-accounts.c (mail_delete): Remove the storage from the - folder-tree. - (news_delete): Same. - -2001-06-19 Jeffrey Stedfast <fejj@ximian.com> - - * component-factory.c (destination_folder_handle_drop): Accept - text/uri-list mime types - this allows us to drag messages from - Nautilus into an Evolution folder. - - * folder-browser.c (message_list_drag_data_get): Do cleanup and - better error handling. - -2001-06-19 Jon Trowbridge <trow@ximian.com> - - * mail-tools.c (mail_tool_do_movemail): Properly clean up the - movemail files when no mail was received. - -2001-06-19 Radek Doulik <rodo@ximian.com> - - * mail-format.c (write_field_row_begin): add column with - between header name and value - (write_field_row_begin): hmm, use just bold as it looks - better - -2001-06-18 Jeffrey Stedfast <fejj@ximian.com> - - * component-factory.c (destination_folder_handle_drop): Use a nice - switch statement and use the new enum values. - - * mail-callbacks.c (list_add_addresses): Now takes a hash table of - already-used-recipients so that we don't get duplicates. - (mail_generate_reply): Pass in a rcpt_hash argument to - list_add_addresses(). These changes fix bug #1639. - -2001-06-18 Dan Winship <danw@ximian.com> - - * Makefile.am (evolution_mail_LDADD): Remove DB3_LDADD - -2001-06-18 Jeffrey Stedfast <fejj@ximian.com> - - * component-factory.c: Change the drop-type "x-evolution-dnd" to - "x-evolution-message" since we want to be able to DnD more than - one data type ;-) - - * folder-browser.c: Change supported DnD drop types to disclude - URI_LIST as that seems to crash Nautilus and seems overly - complicated. Since I am going to be supporting message/rfc822, - hopefully Nautilus can handle that or else maybe something like - text/plain. - (message_list_drag_data_get): Remove the code for URI_LIST. - -2001-06-14 Not Zed <NotZed@Ximian.com> - - * mail-tools.c (mail_tool_uri_to_folder): If we have a fragment in - the url, use that as the folder name, and not the path component. - -2001-06-13 Not Zed <NotZed@Ximian.com> - - * component-factory.c (mail_load_storages): Added temp hack to let - spool providers show up in the list. - -2001-06-16 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser.c (my_folder_browser_init): Allow user's to - "copy" drag & drop rather than just "move". - -2001-06-15 Jeffrey Stedfast <fejj@ximian.com> - - * component-factory.c (destination_folder_handle_drop): Implemented. - - * message-list.c (message_list_construct): Don't connect to the - DnD signals here. - (message_list_drag_data_get): Removed. - (add_uid): Removed. - - * folder-browser.c (my_folder_browser_init): Connect to DnD signals. - (message_list_drag_data_get): Implemented. - -2001-06-15 Jeffrey Stedfast <fejj@ximian.com> - - * mail-ops.c (mail_send_message): Fixed misuse of an uninitialized - variable. - - * component-factory.c (destination_folder_handle_drop): Implemented. - - * mail.h: Added prototype for evolution_folder_info_factory_init. - - * mail-ops.c (mail_do_transfer_messages): Now takes a const char* - as the dest_uri. This works better all around since we strdup'd - the string anyway. - -2001-06-15 Dan Winship <danw@ximian.com> - - * mail-format.c (mail_format_mime_message): We can't output - "<html>" and "</html>" here because it gets called recursively to - display message/rfc822 subparts. - (mail_format_raw_message): Add padding to match the formatted - display. - - * mail-display.c (mail_display_redisplay): Move rodo's html header - changes from mail_format_mime_message to here. - -2001-06-14 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser.c (got_folder): Updated to reflect changes to - mail_config_[g,s]et_thread_list(). - (folder_browser_toggle_threads): Same. - - * folder-browser-factory.c (control_activate): Updated to reflect - changes to mail_config_[g,s]et_thread_list(). - - * mail-config.c (mail_config_write_on_exit): Do cleanup when we're - done. - (mail_config_set_thread_list): Send in a URI so we can save the - state on a per-folder basis. - (mail_config_get_thread_list): Send in a URI so we can retrieve - the state on a per-folder basis. - - * component-factory.c: Setup the accepted_dnd_types. Also added - skeleton code for DnD. - -2001-06-14 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser-factory.c: Add Reply-to-List bonobo verbs. - - * folder-browser.c: Add Reply-to-List menu items. - - * mail-callbacks.c (mail_reply): Use an enum for specifying the - reply mode, becaus enow we can reply-to-list. - (reply_to_list): Implement. - (reply_to_sender): Use REPLY_SENDER. - (reply_to_all): Use REPLY_ALL. - (mail_generate_reply): Handle the different modes. - -2001-06-12 JP Rosevear <jpr@ximian.com> - - * Makefile.am: Remove folder-info.h until iain checks it in - -2001-06-12 Not Zed <NotZed@Ximian.com> - - * mail-account-gui.c (source_type_changed): Setup default spool - location same as for mbox mail retrieval. - -2001-06-08 Dan Winship <danw@ximian.com> - - * folder-browser-factory.c: fix some commands to match the ui file - again. - -2001-06-07 Iain Holmes <iain@ximian.com> - - * GNOME_Evolution_Mail.oaf.in: Add server info for FolderInfo - Remove server info for the Summary server - - * Mail.idl: Add a FolderInfo interface to retreive information about - a mail folder. - - * Makefile.am: Remove the executive summary stuff. Add the folder-info - files. - - * component-factory.c: Remove the mail-summary.h include. - Remove summary_factory. - (summary_fn): Remove. - (component_factory_init): Remove the summary_factory creation. - Initialise the info_factory. - -2001-06-08 Jon Trowbridge <trow@ximian.com> - - * mail-ops.c (mail_send_message): Reattach X-Evolution-Account - information to the message after sending it. This way it can - be used to set the identity properly if we later Resend the - message. - - * mail-tools.c (mail_tool_get_local_movemail_path): If you had - multiple accounts that used mboxes, and if you received mail in N - of those accounts, you would get N copies of each of your e-mail - messages. This is because everything was being dumped into one - big file by movemail, and the filters would run on that file N - times. To work around this, each mbox account now gets its own - distinct temporary movemail file. - -2001-06-07 Jon Trowbridge <trow@ximian.com> - - * mail-ops.c (fetch_mail_fetch): Pass the original source URI - to camel_filter_driver_filter_mbox. - (mail_send_message): Pass NULL as the orginal source URI - to camel_filter_driver_filter_message. - -2001-06-06 Jon Trowbridge <trow@ximian.com> - - * mail-account-gui.c (source_type_changed): Check that the chain - of deferences in gui->account->source->url is safe. This was - causing a segfault when adding a new account if any of the - existing accounts had their sources set to "None". - (i.e. gui->account->source == NULL) - - * mail-accounts.c (load_accounts): Check that account->source != - NULL before dereferencing it. - (load_accounts): The selection is cleared when the account clist - is rebuilt (say after a call to add), but no unselect event is - emitted. Yes, the clist is evil. We work around this by - explictly calling mail_unselect, our unselect signal handler. - (Otherwise, the edit and delete buttons remain sensitive and - accounts_row != 0, but the user can't see which row the dialog - thinks is selected.) - (load_news): Check the account->source != NULL before - dereferencing it. - (mail_unselect): If an insensitive button in a button box has the - focus, and if you hit tab, there is a segfault deep inside of gtk. - This is probably a gtk bug. We work around it by having the add - button (which is always sensitive) grab the focus on an unselect. - -2001-06-05 Jason Leach <jleach@ximian.com> - - (Fix bug #3211: Should undelete when flagging a delete message as - important) - - * message-list.c (on_click): When flagging a message as important, - check to see if it's flagged as deleted, if so, undelete it. - - (Fix bug #314: Display URLs in statusbar on mouseover) - - * mail-display.c (html_on_url): New function, callback for - GtkHTML's "on_url" signal. - -2001-06-05 Radek Doulik <rodo@ximian.com> - - * mail-format.c: make HTML and plain mails to have the same - boundary - -2001-06-03 Ettore Perazzoli <ettore@ximian.com> - - * Makefile.am (evolution_mail_LDADD): Move `$(DB3_LDADD)' before - libeutil. - -2001-06-01 Federico Mena Quintero <federico@ximian.com> - - * folder-browser.h (FolderBrowser): Added fields for the - GalViewMenus and GalViewCollection, since we need to keep them - around while the component is active. - - * folder-browser-factory.c (folder_browser_setup_view_menus): Plug - leaks; unref the spec and factory. Set the view collection and - the view menus on the FolderBrowser object. - (folder_browser_discard_view_menus): New function. - (control_deactivate): Discard the menus. - - * folder-browser.c (folder_browser_destroy): Destroy the view - collection and the view menus. - -2001-06-01 Ettore Perazzoli <ettore@ximian.com> - - * Makefile.am (evolution_mail_LDADD): Add `$(DB3_LDADD)'. - -2001-06-01 Jeffrey Stedfast <fejj@ximian.com> - - * mail-account-gui.c (mail_account_gui_save): Save the pgp and - smime settings. - (mail_account_gui_new): Setup the pgp and s/mime page (but disable - the s/mime frame if we are not compiled with s/mime support). - - * mail-config.c (account_copy): Updated to save extra pgp and - smime options. - (account_destroy): Free draft/sent folder info and also the new - pgp/smime keys. - (config_read): Read in the pgp and s/mime config options. - (mail_config_write): Save the account pgp and smime options. - -2001-06-01 Jeffrey Stedfast <fejj@ximian.com> - - * mail-account-gui.c (source_type_changed): Call - build_extra_conf() here too. This is when we REALLY want to call - it anyway, not on switch-page because then we'd lose any data on - the Receive Options page if we never switch to that page before - applying the changes. - - * mail-account-editor.c (construct): Don't connect to the - switch-page event, instead just call build_extra_conf() here with - the source->url. - -2001-06-01 Dan Winship <danw@ximian.com> - - * mail-config.c (config_read): Fix dumb misuse of g_get_charset. - -2001-05-31 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (handle_multipart_signed): Removed the code to - check for the validity of an S/MIME part. Stuff works differently - now. - - * mail-crypto.c: Rewrote how the S/MIME stuff is going to work. - -2001-05-30 Dan Winship <danw@ximian.com> - - * mail-config.glade: Rename the "PGP" page back to "Other" and add - a "default charset" option menu. - - * mail-config.c (config_read, mail_config_write_on_exit, - mail_config_get_default_charset, mail_config_set_default_charset): - Handle "default charset". - - * mail-accounts.c (construct): Fill in the "default_charset" menu - with an e_charset_picker menu. - (charset_menu_deactivate): Update the default charset. - -2001-05-29 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (list_add_addresses): Take another argument to - ignore a certain address. - (mail_generate_reply): Ignore references to the reply-to address - when constructing the Cc list. - -2001-05-29 Jason Leach <jleach@ximian.com> - - * message-browser.c (message_browser_new): one-line fix for bug - #2536: File->Close in message viewer doesn't work. - (message_browser_new): Also replaced like 4 lines of code with a - one-liner featuring gnome_app_create_toolbar_with_data(). - -2001-05-28 Jason Leach <jleach@ximian.com> - - * mail-local.c (load_metainfo): Don't need to check if (foo!=NULL) - before doing an xmlFreeDoc(). - -2001-05-28 Dan Winship <danw@ximian.com> - - * mail-format.c (write_text_header): Fix a bug that could cause a - crash on messages with an empty subject. Oops. - -2001-05-27 Jeffrey Stedfast <fejj@ximian.com> - - * message-list.c: Removed the etable spec string. - (message_list_construct): Load the etable spec from a file. - - * folder-browser-factory.c: Load the etable spec from the file, - not a string. - - * Makefile.am: Add message-list.etspec to be installed. - - * message-list.etspec: New file containing the ETable file - specification. - - * mail-config.h: Prototype evolution_mail_config_get_type. - -2001-05-27 Dan Winship <danw@ximian.com> - - * folder-browser-factory.c: #include - "evolution-shell-component-utils.h" rather than "e-gui-utils.h" - for e_pixmaps_update. - - * subscribe-dialog.c: Likewise. - -2001-05-26 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (try_inline_pgp_sig): Fix to work properly. - (handle_multipart_signed): Fixed a bug that caused some - multipart/signed messages to be handled by the multipart_mixed - handler. - -2001-05-25 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser-factory.c: Added callbacks for Next/Previous - Unread and Next/Previous Flagged message. - - * mail-callbacks.c (previous_flagged_msg): Implemented. - (next_flagged_msg): Implemented. - -2001-05-26 Dan Winship <danw@ximian.com> - - * mail-ops.c (mail_send_message, transfer_messages_transfer, - set_offline_do): When unreffing a folder we got ourselves (as - opposed to one passed in by the caller), sync before unreffing, - since we might be holding the only reference to it. - (mail_refresh_folder): New op, like mail_sync_folder, but does a - camel_folder_refresh_info instead. - - * folder-browser-factory.c (control_activate): Call - mail_refresh_folder, not mail_sync_folder. (The goal is to see new - messages: sync used to work with imap because imap_sync was - broken, but it doesn't work for that any more.) - -2001-05-25 Peter Williams <peterw@ximian.com> - - * Makefile.am: Reference libeshell.la instead of libeshell.a. - -2001-05-25 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser-factory.c (control_activate): Disable Resend on - non-Sent folder FolderBrowsers. Thanks to Wayne Davis for this - patch. - - * component-factory.c (xfer_folder): This code should be correct - now. Still waiting on the shell to do it's job of creating the - metadata xml file in the destination folder though. - -2001-05-24 Jeffrey Stedfast <fejj@ximian.com> - - * message-list.c (message_list_select_uid): g_strdup the uid into - the ml->cursor_uid. - - * message-browser.c (message_browser_forward_msg): Use the default - forward style. - -2001-05-24 Dan Winship <danw@ximian.com> - - * mail-identify.c (mail_identify_mime_part): If the message data - is online, sniff the data for a MIME type first, and use the - filename second. Makes it more reliable, and deals with the - specific case of "application/octet-stream; name=foo.vcf" which - gnome-vfs will identify as vcalendar, but which can also be a - vcard. - -2001-05-24 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (try_inline_pgp_sig): Only write the message up to - (but not including) the attached signature block. - -2001-05-23 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (composer_postpone_cb): Don't free the - folder-info here, instead have mail_append_mail() call our new - function, append_mail_cleanup() which'll free the - folder-info. This fixes the problem of send-later segfaulting. - - * message-list.c (message_list_set_folder): Make the message-list - respect the "hide deleted messages" setting. Fixes bug #2248. - - * component-factory.c (xfer_folder): New function that the shell - component calls to copy/move a folder. - (component_fn): Set the xfer_folder_fn argument. - - * mail-ops.c (mail_remove_folder): New async function to remove a - folder. God knows if it does what the ShellComponent needs or not - yet. - (mail_xfer_folder): Yet another yummy async function to move or - copy a folder to a new location. - - * component-factory.c (storage_remove_folder): New function for - removing folders. - (remove_folder): New function that the shell component calls to - delete a folder. - (component_fn): Set the remove_folder_fn argument. - -2001-05-22 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.c (mail_config_write_on_exit): Save the - message-display style. - (config_read): Read the message-display style. - -2001-05-22 Dan Winship <danw@ximian.com> - - * mail-display.c (on_url_requested): If http mode is - HTTP_SOMETIMES, use e_book_query_address_locally to check the From - address and load images if it's found. - - * mail-config.c (config_read): Default http_mode to - MAIL_CONFIG_HTTP_SOMETIMES. Fix typo to make default forward style - actually work. - -2001-05-22 Jeffrey Stedfast <fejj@ximian.com> - - * Makefile.am: Use MAILER_CFLAGS and MAILER_LIBS. - - * message-browser.c (message_browser_folder_loaded): Instead of - calling message_list_select_uid() here, instead connect to the - "message_list_loaded" signal since the message-list is not built - yet at this point. - (message_browser_message_list_built): Call - message_list_select_uid() here instead. - - * message-list.c: Lets have a new signal, MESSAGE_LIST_BUILT, that - gets emitted when the message-list has finished being built by one - of the built_*() functions. - (message_list_class_init): Setup the signal stuff. - (regen_list_regened): Emit the signal here (should this perhaps be - moved into each of the build_*() functions instead?). - -2001-05-21 Kjartan Maraas <kmaraas@gnome.org> - - * mail-local.c: Mark a string for translation. - -2001-05-18 Jon Trowbridge <trow@ximian.com> - - * Makefile.am (evolution_mail_LDADD): Added libebook.la (which is - now required by the composer.) - -2001-05-17 Dan Winship <danw@ximian.com> - - * mail-callbacks.c (composer_postpone_cb): mark Outbox messages as - read. - -2001-05-17 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (mail_write_authenticity): New convenience - function for all signature verification functions to use to - display whether or not the signed part was authentic. - (try_inline_pgp_sig): Use mail_write_authentic(). - (handle_multipart_signed): Add code to handle S/MIME - multipart/signed parts and also use mail_write_authenticity(). - -2001-05-17 Dan Winship <danw@ximian.com> - - * mail-config.glade: add new icons from jimmac. - -2001-05-16 Dan Winship <danw@ximian.com> - - * mail-format.c (mail_format_raw_message): add - E_TEXT_TO_HTML_ESCAPE_8BIT to the flags - -2001-05-16 Dan Winship <danw@ximian.com> - - * folder-browser.c (folder_browser_is_drafts, - folder_browser_is_sent, folder_browser_is_outbox): Functions to - determine if a folderbrowser is one of the drafts, sent, or outbox - folders. - (got_folder): Pass TRUE for the "outgoing" flag to - message_list_set_folder if this is a Sent, Drafts, or Outbox - folder. - - * message-list.c (message_list_set_folder): Take a flag saying - whether or not the folder is an "outgoing" folder. - (message_list_setup_etree): Ditto. Use that rather than a - hardcoded list of foldernames for deciding whether to swap From - and To in the default layout. - - * mail-config.c (mail_config_folder_to_cachename): Make IMAP - folders have unique cachenames rather than only one per store, so - that IMAP Sent and Drafts folders don't get forced into having the - same layout as the INBOX. - - * mail-callbacks.c: (is_sent_folder, is_drafts_folder): Gone. - Replaced with simpler folder_browser_is_* routines. - (edit_msg, resend_msg, open_msg): Use folder_browser_is_* - routines. - - * mail-local.c (reconfigure_clicked): Update call to - message_list_set_folder. - -2001-05-16 Jeffrey Stedfast <fejj@ximian.com> - - * mail-crypto.c (mail_crypto_is_smime_v3_signed): Removed (this - now exists in camel/camel-smime.c). - (mail_crypto_is_pkcs7_mime): Same. - (mail_crypto_smime_part_sign): new - (mail_crypto_smime_part_verify): new - (mail_crypto_smime_part_encrypt): new - (mail_crypto_smime_part_decrypt): new - (mail_crypto_pgp_mime_part_sign): Added code to set an exception - if the context fails to be created. - (mail_crypto_pgp_mime_part_verify): And here... - (mail_crypto_pgp_mime_part_encrypt): Same. - (mail_crypto_pgp_mime_part_decrypt): And here too. - -2001-05-16 Dan Winship <danw@ximian.com> - - * mail-display.c (mail_display_redisplay): Deal with full-header - mode in addition to source mode - - * mail-format.c (write_field_row_begin): Add WRITE_NOCOLUMNS flag - to write the header in a single table cell rather than two. Output - the second columns's "<td>" when not in NOCOLUMNS mode. Don't - include the ":" in the passed-in header name. - (write_date, write_address): Update for write_field_row_begin - changes. - (write_text_field): Genericified and updated from write_subject. - (write_headers): Deal with both normal and full-header mode. - -2001-05-15 Dan Winship <danw@ximian.com> - - * mail-display.c (on_url_requested): Load http images if the user - has force-loaded images too. - (mail_display_redisplay): Update for normal/headers/source changes. - (mail_display_load_images): New. Force HTTP image loading for the - current message. - - * mail-config.c (mail_config_get_message_display_style, - mail_config_set_message_display_style): Updated and renamed from - mail_config_{get,set}_view_source - - * mail-callbacks.c (load_images): New. - - * folder-browser.c (folder_browser_set_message_display_style): - Renamed and updated from folder_browser_toggle_view_source. - - * folder-browser-factory.c (verbs): Add ViewLoadImages. - (control_activate): Update for normal/headers/source change to - radio group. - -2001-05-15 Dan Winship <danw@ximian.com> - - * folder-browser-factory.c (verbs): Update for changes in - evolution-mail.xml (many commands were renamed to better match the - current menu layout). - (pixcache): Refer to commands via their paths in /commands/ - rather than hardcoding their menu paths. - -2001-05-14 Jon Trowbridge <trow@ximian.com> - - * mail-search.c (mail_search_construct): Put frame around dialog - vbox, put mail subject in that frame's label. (Patch by Duncan.) - (mail_search_set_subject): Break out subject-setting code. - Truncate long subjects with ellipses. - -2001-05-14 Duncan Mak <duncan@ximian.com> - - * mail-search.c (mail_search_construct): set the dialog's - window_icon to jimmac's new find_message.xpm. - -2001-05-13 Iain Holmes <iain@ximian.com> - - * Makefile.am: Make the LDADD line longer so it actually compiles - everything correctly. - -2001-05-14 Dan Winship <danw@ximian.com> - - * mail-config.glade: Split "Other" page into three pages, Display, - Composer, and PGP. Add HTML image stuff on the Display page and - default forward style on the Composer page. - - * mail-config.c (mail_config_get_default_forward_style, - mail_config_set_default_forward_style): User-specified default - style for forwarding messages. - (config_read, mail_config_write_on_exit): Deal with forward style. - - * mail-accounts.c: Handle HTML image display options and default - forward style. - - * mail-callbacks.c (forward): New. Forward in the user-selected - default style. - (forward_inline, forward_quoted): Simplify these some. Remove the - fallback to forward attached when forwarding multiple messages: it - should just forward the multiple messages inline or quoted in - those cases. (Which it doesn't yet, but that's a bug.) - - * folder-browser.c (context_menu): Remove "Forward inline" and - make "Forward" call forward() rather than forward_attached(). - - * folder-browser-factory.c: Update command/menu/toolbar/pixmap - gunk for the "MessageForwardAttached" vs "MessageForward" split. - - * mail-session.c (mail_session_get_type): - * mail-format.c (format_mime_part): - * mail-account-gui.c (setup_service): Fix warnings. - - * mail-mlist-magic.c: Remove this... it's not used any more. - - * folder-browser.c: - * message-browser.c: Remove references to mail-mlist-magic.h - -2001-05-14 Jon Trowbridge <trow@ximian.com> - - * folder-browser.c (folder_browser_config_search): Use secondary - searches here, so that we control the interference between the two - bits of searching UI. - -2001-05-13 Jon Trowbridge <trow@ximian.com> - - * mail-search.c (mail_search_construct): Destroy the MailSearch - dialog if the underlying MailDisplay is destroyed. I don't like - the way that label in the dialog with the message subject in it - looks, so I've #ifdef-ed it out for now. Center the Matches - label --- it makes the dialog look more balanced, I think. - (dialog_clicked_cb): Changed to reflect adjusted - ESearchingTokenizer API, using primary searches. - (toggled_case_cb): Use the primary search API. - - * e-searching-tokenizer.c: Make searching routines utf8-friendly. - Rationalize how the match begin/end markup is handled; allow for - begin/end markup that varies by search. Add concept of primary and - secondary matching, to disentangle possible interactions between - search-bar searches and search-dialog searches. - -2001-05-13 Jeffrey Stedfast <fejj@ximian.com> - - * mail-local.c (mail_local_storage_shutdown): Get rid of this - we - don't need it. - - * component-factory.c (owner_unset_cb): Don't unref the LocalStore - - we don't own a ref on it!! - -2001-05-12 Duncan Mak <duncan@ximian.com> - - * mail-search.c (begin_cb): Updates the subject on refresh and - sets subject to "Untitled Message" if subject is NULL. - (mail_search_construct): Moved msg_subject to its own GtkLabel, - sets subject to "Untitled Message" if subject is NULL. Give focus - to entry by default. Made <enter> in entry run - dialog_clicked_cb by setting gnome_dialog_editable_enters. - -2001-05-12 Gediminas Paulauskas <menesis@delfi.lt> - - * folder-browser-factory.c: load pixmaps for MessageCopy and - MessageForwardAttached. Thanks Wayne Davis <wfdavis@seas.upenn.edu> - for a patch. - -2001-05-11 Dan Winship <danw@ximian.com> - - * mail-display.c (load_http): callback to use GNOME-VFS to load - http data. - (on_url_requested): Handle http: URLs that refer to either MIME - parts or web data. - (mail_display_redisplay_when_loaded): Moved out of - mail_content_loaded and made more generic. - - * mail-format.c (add_url): Handle two different kinds of URLs - (URLs that point to CamelMimeParts and URLs that point to - GByteArrays). - (mail_content_loaded): Use mail_display_redisplay_when_loaded. - (format_mime_part): Renamed from "call_handler_function". Also, - record Content-Location if the part has one. (This is not yet 100% - correct: it doesn't deal with relative URLs at all.) - (handle_text_html): Use Content-Location URL rather than - Content-ID, when available (will help deal with relative URLs once - GtkHTML supports that better). - (etc): Update for changes. - - * mail-config.c (mail_config_get_http_mode, - mail_config_set_http_mode): get/set HTTP image downloading mode. - (config_read, mail_config_write_on_exit): save/load that data. - -2001-05-11 JP Rosevear <jpr@ximian.com> - - * mail-importer.h: add proto - - * mail-importer.c (mail_importer_uninit): release and unref the - local storage - - * mail-local.c (mail_local_store_finalize): use - bonobo_object_release_unref rather than doing Bonobo_Unknow_unref - and a corba release - (register_folder_registered): "sink" the local_store ref to - prevent circular ref - (mail_local_storage_shutdown): unref the local store - - * mail-local.h: new proto - - * component-factory.c (owner_unset_cb): uninit the importer and - shutdown the local storage - -2001-05-11 Jeffrey Stedfast <fejj@ximian.com> - - * mail-local.c (mail_local_reconfigure_folder): Set a title on the - window "Reconfigure %s" where %s is the folder name. Also, don't - allow more than one of these type windows to be opened per folder. - - * mail-tools.c (mail_tool_get_folder_name): Fix Danw's kludge to - actually work :-) - -2001-05-11 Martha Burke <martha@ximian.com> - - * gui/Makefile.am: sanitize LD_ADDS and CFLAGS so the libtool - lines are shorter (fixes problem on solaries due to sed) - -2001-05-11 Jeffrey Stedfast <fejj@ximian.com> - - * mail-vfolder.c (vfolder_edit): Don't allow multiple copies of - this to be run at a time. - - * mail-callbacks.c (providers_config): Don't allow multiple copies - of this to be run at a time. - (manage_subscriptions): Same, but this was a tad more kludgy since - we don't gnome_dialog_run_and_close() this one. I had to make the - widget a semi-global variable. yuck :\ - (filter_edit): Same. - -2001-05-11 Jon Trowbridge <trow@ximian.com> - - * e-searching-tokenizer.c (e_searching_tokenizer_new): - Remove a snippet of debugging code I left in by mistake. - -2001-05-11 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (forward_inlined): If the cursor_uid is NULL, - then we can't forward anything so just return. - (forward_quoted): Same. - -2001-05-10 Jon Trowbridge <trow@ximian.com> - - * folder-browser.c (folder_browser_config_search): Use the - ESearchingTokenizer to highlight search matches for folder-level - searches. Still mildly broken, but it works for the simple cases. - - * mail-display.c (mail_display_new): Use our ESearchingTokenizer - for the mail display GtkHTML widget. - - * mail-search.c (dialog_clicked_cb): Use the ESearchingTokenizer to - highlight search matches. - (mail_search_construct): Add a match count to the search dialog. - - * e-searching-tokenizer.c - (e_searching_tokenizer_set_search_string): Added. A custom HTML - tokenizer that does highlighting of search strings. - - * mail-config.c: No, we don't want to include - bonobo-running-context.h... just bonobo-context.h. - -2001-05-10 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.c: Fix some compiler warnings by including the - correct bonobo headers and by using the correct bonobo types. - (config_read): Some fixes so that we can never have an empty - string as a URL. - -2001-05-10 Dan Winship <danw@ximian.com> - - * folder-browser.c (on_key_press): Don't advance to the next - undeleted message after "Delete"... - - * mail-callbacks.c (delete_msg): ...instead, do it here, whether - the user used Delete, Alt+D, or the toolbar. (But only if they - only deleted a single message.) - - * message-list.c (message_list_select): Don't clear the display on - failure. - (build_tree): Clear the display when the currently-selected - message stops existing and we don't have an obvious message to - select instead of it. (Eg, when deleting the last message with - "hide deleted messages" set, or expunging while a deleted message - is selected.) - -2001-05-09 Dan Winship <danw@ximian.com> - - * mail-offline-handler.c: New file, started by Ettore, finished by - me, to implement the GNOME_Evolution_Offline interface. - - * Makefile.am (evolution_mail_SOURCES): Add - mail-offline-handler.[ch] - - * mail-ops.c (mail_store_set_offline): Set a store online or - offline. - - * mail-send-recv.c (auto_timeout): Don't run auto-check-for-mail - while the session is offline. - - * component-factory.c (component_fn): Set up offline handler. - -2001-05-09 Christopher James Lahey <clahey@ximian.com> - - * importers/evolution-mbox-importer.c (load_file_fn): Made a const - char * here. - -2001-05-08 Iain Holmes <iain@ximian.com> - - * mail-config.[ch]: Moved all references to the Bonobo stuff into the .c file - -2001-05-08 Iain Holmes <iain@ximian.com> - - * mail-callbacks.c (filter_edit): Set the title of the dialog. - - * GNOME_Evolution_Mail.oaf.in: Add a reference for the MailConfig - interface stuff. - - * Mail.idl: Add the MailConfig interface, and a MailFilter interface. - - * component-factory.c (component_factory_init): Call - evolution_mail_config_factory_init. - - * mail-account-gui.c (setup_service): Just return if url == NULL, - don't crash. - - * mail-config.c: #include bonobo-object.h, #include Mail.h and define - the Config factory IID. - Implement the MailConfig interface with a BonoboObject. - (impl_GNOME_Evolution_MailConfig_addAccount): Convert the CORBA struct - into the correct MailConfig structures and add the account. - (evolution_mail_config_class_init): Initialise the class. - (evolution_mail_config_init): This function is intentionally left blank. - - (evolution_mail_config_factory_fn): Create an EvolutionMailConfig object - and return it. - (evolution_mail_config_factory_init): Set up the bonobo factory. - - * mail-config.h: #include bonobo-xobject.h and Mail.h - Declare the object structures. - - * importers/Makefile.am: Remove the intelligent importers. - - * importers/evolution-mbox-importer.c (folder_created_cb): Callback - from when the folder is created. Opens the folder and unrefs the - listener. - (load_file_fn): Create the folder if it doesn't exist. - -2001-05-08 Jeffrey Stedfast <fejj@ximian.com> - - * mail-tools.c (mail_tool_forward_message): Convert the Subject - header to HTML and also make sure that the Subject, To, and From - header values are non-NULL before feeding them into - e_text_to_html(). - - * mail-callbacks.c (edit_msg_internal): Free the UIDs if the user - decides to not go through with editing all the messages he - selected. - (resend_msg): If the user attempts to resend more than 10 - messages, make sure he really means it. - (do_resend_messages): Richard Zach feels that "Resend" should open - the message(s) in a composer since he might want to edit at least - the recipients (maybe he needs to resend because the message - bounced the first time) and Ettore wants pretty much the same - thing. This makes "Resend" basically the same as "Edit" but for - previously sent messages, whereas "Edit" is only for Drafts. - -2001-05-08 Gediminas Paulauskas <menesis@delfi.lt> - - * mail-search.c: convert search entry to utf8. - - * mail-local.c: d() debugging message. - - * mail-send-recv.c: replace " ..." with "..." - - * Makefile.am: removed EVOLUTION_VERSION. - -2001-05-07 Jeffrey Stedfast <fejj@ximian.com> - - * mail-account-gui.c: s/HAVE_NSS/HAVE_SSL for the SSL checkbox - stuff. - -2001-05-07 Dan Winship <danw@ximian.com> - - * folder-browser.c (my_folder_browser_init): Connect to - key_press_event on the GtkHTML widget. - (etree_key): Only handle space/backspace here, pass the rest off - to on_key_press. - (on_key_press): Handle Delete/N/P/Menu in either MessageList or - MailDisplay. - - * message-list.c (message_list_select): Grab focus if we don't - have it. - -2001-05-03 Dan Winship <danw@ximian.com> - - * message-list.c: #include <camel/camel-file-utils.h> - - * mail-ops.c (get_folderinfo_get): - * subscribe-dialog.c (build_tree): Update for - camel_store_get_folder_info prototype change. - - * mail-format.c (handle_text_plain_flowed): Improve more on the - fix from the other day: the first level of indentation adds blank - lines, but further levels don't... - -2001-04-30 Dan Winship <danw@ximian.com> - - * folder-browser.c (folder_browser_destroy): Unhook event handlers - before syncing the folder, since the folder browser will have been - destroyed by the time the sync thread completes and calls the - signal handlers. - -2001-04-29 Dan Winship <danw@ximian.com> - - * mail-format.c (handle_text_plain_flowed): Mojo this a bit so - that "\n\n>" gets translated to "<br><blockquote>" rather than - "<br><br><blockquote>", since the transition to blockquote mode - creates a blank line itself. Makes Mozilla-generated flowed - replies look better. - -2001-04-27 Dan Winship <danw@ximian.com> - - * mail-session.c: Renamed from session.c and made to be a subclass - of CamelSession. - - * mail-mt.c (mail_user_message): Renamed from mail_get_accept and - made more general-purpose, to implement the new - camel_session_alert_user. - -2001-04-26 Jeffrey Stedfast <fejj@ximian.com> - - * main.c (main): No need to camel_shutdown() anymore... - - * mail-callbacks.c (next_msg): Don't filter on Seen status. - (previous_msg): Same. - (next_unread_msg): New function that does what the old callback - next_msg callback did (only better named). - (previous_unread_msg): Same. - - * message-list.c (hide_load_state): Updated to use camel-file-util - routines. - (hide_save_1): Same. - (hide_save_state): And here too. - -2001-04-26 Dan Winship <danw@ximian.com> - - * Makefile.am (INCLUDES): Remove UNICODE_CFLAGS - - * mail-format.c (handle_text_plain_flowed): Use <font color=...> - to mark citations rather than italicizing them, which has never - looked very nice. Now this is more consistent with the non-flowed - case. - -2001-04-26 Jon Trowbridge <trow@ximian.com> - - * folder-browser-factory.c: Added "MessageSearch" verb. - - * mail-callbacks.c (search_msg): Added search callback. - (are_you_sure): Added some casts to fix compiler warnings. - - * mail-search.c: Added. A simple search-in-message widget, - that uses GtkHTML's searching capabilities. - -2001-04-25 Dan Winship <danw@ximian.com> - - * mail-callbacks.c (are_you_sure): New foot-shooting-prevention - helper function. - (edit_msg_internal, view_msg): If the user has more than 10 - messages selected, ask before opening them all in separate - windows, to protect against misclicks/typos after "select all" - (which we've had at least two reports of now). - -2001-04-25 Radek Doulik <rodo@ximian.com> - - * mail-tools.c (mail_tool_quote_message): set object data directly - in HTML source - - * mail-callbacks.c (mail_generate_reply): remove \n from citation - (mail_generate_reply): don't use e_msg_composer_mark_text_orig - -2001-04-24 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser.c: Added a new signal, "message_loaded" that gets - emitted when the message has been loaded and set on the - mail_display. - (folder_browser_class_init): Define the "message_loaded" signal - stuff. - (done_message_selected): Emit the "message_loaded" signal here. - - * message-browser.c (message_browser_next_msg): Do our own - message-list manipulation. We want the next message, not the next - unread message. - (message_browser_prev_msg): Same here but for previous. - (message_browser_new): Connect to the folder browser's - "message_loaded" signal. - (message_browser_folder_loaded): Don't connect to the - message-list's "message_selected" signal. - (message_browser_message_loaded): Nw callback which replaces the - old message_browser_message_selected callback's functionality. - -2001-04-24 Dan Winship <danw@ximian.com> - - * folder-browser.c: Add accelerators to the context menu. - (on_right_click): Use e_tree_get_cell_geometry and a - GtkMenuPositionFunc when responding to a Menu-key press so we can - line the menu up with the selected row rather than the cursor. - - * message-browser.c: include <gal/util/e-util.h> for E_MAKE_TYPE. - -2001-04-23 Jon Trowbridge <trow@ximian.com> - - * mail-display.c (html_button_press_event): Check for mailto: - links, and pop up our mail address menu when we find one. - (make_popup_window): The main piece of code (ignoring a zillion - little callbacks) to pop up our windows with reasonable semantics - for having them close automatically. - (mail_text_write): Enable converting addresses to mailto links - in message bodies. - - * mail-format.c (write_address): Simplify code, removing Radek's - <DATA> hacks. Write out addresses as mailto: links. - -2001-04-23 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (do_view_message): Use the message-browser - widget rather than the mail-view window. - - * mail-view.c: Removed. - - * folder-browser.c: Added a folder_loaded signal. - - * message-browser.[c,h]: New window to solve all our message - browsing needs. This replaces mail-view.c. - - * message-list.c (message_list_select_uid): New function needed by - the new message-browser window. - -2001-04-23 Dan Winship <danw@ximian.com> - - * mail-callbacks.c (save_msg): Append a "/" to the result of - g_get_home_dir so gets the default dir it was supposed to. - -2001-04-22 Jeffrey Stedfast <fejj@ximian.com> - - * mail-ops.c (mail_send_message): Lets do proper refcounting on - the sent-folder. Also, g_strdup() the sent_folder_uri since we - later free it. If we don't, then we get lovely corrupt memory. - - * mail-crypto.c (mail_crypto_pgp_mime_part_sign): Make sure we - have a context before we try and use it. - -2001-04-22 Gediminas Paulauskas <menesis@delfi.lt> - - * folder-browser.c, mail-autofilter.c, mail-callbacks.c, - mail-ops.c, mail-summary.c, mail-vfolder.c: use system = - EVOLUTION_DATADIR "/file" instead of g_strdup_printf. Rename - userrules to user (and system) to be consistent. - - * mail-send-recv.c: set window icon to send-receive.xpm - -2001-04-21 Gediminas Paulauskas <menesis@delfi.lt> - - * mail-summary.c: translate "Mail summary". - -2001-04-20 Dan Winship <danw@ximian.com> - - * mail-config-druid.c (make_default_account): Convert the result - of g_get_real_name() from the locale charset to UTF8. Noted by - Petter Sundlöf (NOT "Petter Sundl_" :) - -2001-04-20 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.c (mail_config_set_pgp_type): Use a CamelPgpType. - (mail_config_get_pgp_type): Return a CamelPgpType. - (auto_detect_pgp_variables): auto-detect the user's pgp settings. - -2001-04-20 Dan Winship <danw@ximian.com> - - * mail-format.c (handle_text_plain): Fix a dumb thinko in my 04-11 - patch. - -2001-04-20 Kjartan Maraas <kmaraas@gnome.org> - - * mail-ops.c: (send_mail_desc): Convert subject from utf8 - before passing it on. - -2001-04-20 Gediminas Paulauskas <menesis@delfi.lt> - - * mail-display.c: #if 0'd out my not-working selection code - -2001-04-19 Dan Winship <danw@ximian.com> - - * mail-format.c (mail_format_raw_message): Make this more raw: - don't do URLs and citations. - -2001-04-18 Dan Winship <danw@ximian.com> - - * session.c (request_callback): Don't need to dup the string: the - relevant gnome-dialog routine already does. - - * message-list.c (message_list_destroy): Free the uid_nodemap. - (hide_save_state): Free the filename when we're done. - -2001-04-18 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (is_sent_folder): Implemented. - (resend_msg): Use is_sent_folder(). - -2001-04-17 Dan Winship <danw@ximian.com> - - * mail-mt.c (mail_msg_check_error): Fix a memory leak. - -2001-04-16 Ettore Perazzoli <ettore@ximian.com> - - * importers/Makefile.am (INCLUDES): Add `$(EXTRA_GNOME_CFLAGS)' - here. - -2001-04-15 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (mark_all_as_seen): Mark the messages as seen, - not unseen. - (is_drafts_folder): New function to attempt to determine if a - folder is a drafts folder. - (open_msg): Use is_drafts_folder(). - (edit_msg): And here. - (edit_msg_internal): New function that doesn't do the drafts - checking and is only to be used internally. This should save us - from having to doubly-check a folder to see if it's a drafts - folder when doing an Open on the message. - (open_msg): Call edit_msg_internal once we've established that the - folder is a drafts folder. - -2001-04-14 Jeffrey Stedfast <fejj@ximian.com> - - * mail-crypto.c (mail_crypto_pgp_mime_part_verify): Only use - non-NULL contexts. - (mail_crypto_pgp_mime_part_encrypt): Same. - (mail_crypto_pgp_mime_part_decrypt): And here too. - - * mail-format.c (try_inline_pgp_sig): Make sure to not use the - context if it is NULL. - (decode_pgp): Same. - - * folder-browser-factory.c: Added stuff for filtering/vfoldering - on mailinglists. - -2001-04-13 Dan Winship <danw@ximian.com> - - * Makefile.am (evolution_mail_LDADD): Remove some redundant LIBS - variables... purify complained that the command line was too - long. :-} - - * mail-account-gui.c: Plug leaks. - - * mail-display.c (on_url_requested): close the html stream on - error too. - - * mail-ops.c (fetch_mail_fetch): Move a line around that probably - doesn't affect anything, but it's correct. - - * session.c (auth_callback): Plug leak. - - * mail-send-recv.c (receive_status): Initialize "now". - -2001-04-13 Christopher James Lahey <clahey@ximian.com> - - * message-list.c (on_cursor_activated_cmd): Only activate the - message if the cursor has moved. - -2001-04-12 Christopher James Lahey <clahey@ximian.com> - - * message-list.c (e_mail_address_new): Updated this function to be - a correct full ordering. - (ml_has_get_node_by_id, ml_get_node_by_id): Implemented these - functions. - (find_next_undeleted): Changed this to find next sorted undeleted - message. Also, changed it so that if the current message is not - deleted, it returns NULL. - (build_tree, build_flat): Changed these to only set the cursor if - the cursor is changed. - - * subscribe-dialog.c: Changed this to pass NULL, NULL for - has_get_node_by_id and get_node_by_id. - -2001-04-12 Jeffrey Stedfast <fejj@ximian.com> - - * session.c (auth_callback): If the service is NULL, just use the - item as the key. - - * mail-crypto.c (mail_crypto_pgp_mime_part_sign): Use the - CamelCipherHash enum. - (mail_crypto_pgp_mime_part_verify): Use a CamelCipherValidity. - - * mail-format.c (try_inline_pgp_sig): Updated to use - CamelCipherValidity instead of CamelPgpValidity. - (handle_multipart_signed): Same. - -2001-04-12 Dan Winship <danw@ximian.com> - - * folder-browser.c (do_message_selected, on_message_selected): - Don't printf NULL - - * mail-format.c (mail_part_is_inline): Don't leak memory. - -2001-04-12 Jeffrey Stedfast <fejj@ximian.com> - - * mail-accounts.c (pgp_path_changed): Updated for changes to PGP - code. - - * component-factory.c (owner_set_cb): Don't init openpgp anymore - because we don't need it. - - * mail-crypto.c: Simply wrap the camel-pgp-mime functions (also - renamed the functions to be prefixed with mail_crypto). - - * mail-format.c (handle_multipart_signed): Update to use - camel_pgp_mime_is_rfc2015_signed() and other camel-pgp-mime - functions. - (handle_multipart_encrypted): Same but for rfc2015_encrypted. - (decode_pgp): Updated to use camel-pgp-context - (try_inline_pgp): Updated to use camel-pgp-context's. - (try_inline_pgp_sig): Same. - -2001-04-11 Dan Winship <danw@ximian.com> - - * mail-format.c (handle_text_plain): Only look for special - pseudo-multipart-isms (binhex, uucode, old pgp, etc) if the MIME - type is really text/plain. Otherwise, since there's no handler for - applciation/mac-binhex40, it gets sent to mail-identify.c, which - thinks it's text/plain because it starts with English words, and - so it gets sent back to the text/plain handler, which finds an - embedded binhex part... - - * mail-callbacks.c (do_view_message): mark messages as seen when - opening then in a separate window. - -2001-04-11 Jeffrey Stedfast <fejj@ximian.com> - - * openpgp-utils.c (openpgp_encrypt): Don't g_free the recipient - array members here because we free them in the caller. - -2001-04-11 Jeffrey Stedfast <fejj@ximian.com> - - * mail-crypto.c (pgp_mime_part_verify): Huh, somehow I forgot to - apply the from filter when verifying signed parts. Oh well, - probably not all that common. Fixed now though. - -2001-04-11 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (save_msg): Use the homedir as the default - filename. - -2001-04-11 Christopher James Lahey <clahey@ximian.com> - - * message-list.c (save_tree_state, message_list_setup_etree): Save - the expanded state using the ETree built in expanded state code. - -2001-04-05 Not Zed <NotZed@Ximian.com> - - * Merge from evolution-0-10 to evolution-0-10-merge-0 into head. - -2001-04-04 Kjartan Maraas <kmaraas@gnome.org> - - * mail-account-gui.c: Add prototype for service_changed(). - * message-list.h: Remove #include <gal/e-table/e-tree-simple.h> - since it doesn't get installed. - -2001-04-04 Gediminas Paulauskas <menesis@delfi.lt> - - * mail-config-druid.c (create_html): set content type to utf8. - * mail-config.c (mail_config_check_service): fix warning. - * mail-display.c (link_open_in_browser): just call on_link_clicked(). - (link_menu): Open link works. - (link_copy_location): claim selection. - (on_selection_get): new function, selection handler. - (mail_display_new): connect to selection_get. FIXME: does not work. - -2001-04-04 Gediminas Paulauskas <menesis@delfi.lt> - - * component-factory.c: use big trash icon, stolen from mc. - -2001-04-03 Jeffrey Stedfast <fejj@ximian.com> - - * openpgp-utils.c (openpgp_encrypt): Add --no-tty argument to gpg. - -2001-04-03 Dan Winship <danw@ximian.com> - - * folder-browser-factory.c (control_activate): Sync the folder on - activate. - - * session.c (mail_session_remember_password): Use the same - URL-transforming rules we use when hashing the password so this - actually works. - -2001-04-02 Iain Holmes <iain@ximian.com> - - * importers/elm-importer.c (elm_can_import): Call is_kmail to check for - KMail files. - (is_kmail): Checks if the given directory is a KMail directory. - -2001-04-02 Iain Holmes <iain@ximian.com> - - * importers/elm-importer.c (elm_can_import): Check for some MH files - to make sure that the dir really is an Elm dir. - -2001-04-02 Dan Winship <danw@ximian.com> - - * mail-account-gui.c: Add a "provider_type" arg to - MailAccountGuiService. - (transport_needs_auth_toggled): Call service_changed if enabling - the auth pane so the status of the "Check supported types" button - will be correct. - (service_check_supported): Use gsvc->provider_type, not - CAMEL_PROVIDER_STORE. - (mail_account_gui_new): Pass the transport as the user_data to the - "changed" signal on transport.hostname, not the store. - (mail_account_gui_setup): Set up provider_type fields - -2001-04-01 Gediminas Paulauskas <menesis@delfi.lt> - - * component-factory.c: changed vtrash icon to trash. doh - * folder-browser-factory.c: pixmap cache got moved from here to - e-util/e-gui-utils.c. Changed pixmap paths according to file renames. - Added icons for print, get mail, etc., changed get mail icon as Jacub - suggested. - * subscribe-dialog.c: also use new pixmap cache. - -2001-03-30 Dan Winship <danw@ximian.com> - - * mail-config.c (check_service_check): Register for cancellation. - (mail_config_check_service): Pop up a modal dialog with a message - and a "Cancel" button for the duration of the check. - -2001-03-30 Iain Holmes <iain@ximian.com> - - * importers/evolution-mbox-importer.c (load_file_fn): Check if - foldername is \0. - - * importers/evolution-outlook-importer.c (load_file_fn): Ditto. - -2001-03-30 Jon Trowbridge <trow@ximian.com> - - * mail-display.c (mail_text_write): Add (commented-out) - E_TEXT_TO_HTML_CONVERT_ADDRESSES. - - * mail-config.c (mail_config_get_account_by_source_url): - Call e_url_equal to compare URLs. - -2001-03-30 Dan Winship <danw@ximian.com> - - * component-factory.c (debug_cb): If the EvolutionShellComponent - emits a "debug" signal, turn on camel_verbose_debug. - -2001-03-30 Radek Doulik <rodo@ximian.com> - - * mail-display.c (mail_display_redisplay): reset last_active - -2001-03-29 Jon Trowbridge <trow@ximian.com> - - * mail-callbacks.c: Added #include <time.h> to get things - to compile. - - * mail-callbacks.c (mail_generate_reply): Look at the - X-Evolution-Source header, and try to find a corresponding - account. If this works, send the mail from this account. - If not, use the default account. - - * mail-ops.c (send_queue_send): Strip out the X-Evolution-Source - header before sending. - - * mail-config.c (mail_config_get_account_by_source_url): Added. - Look up accounts by source URL. - -2001-03-29 Dan Winship <danw@ximian.com> - - * mail-format.c (call_handler_function): if called with a - multipart that's really a 0-part, spew an error and display as - source. - - * message-list.c: #include <camel/camel-vtrash-folder.h> - - * mail-callbacks.c: #include <libgnome/gnome-paper.h> - for the gnome-print stuff. - - * mail-display.c (pixmap_press): Ignore "funky" button clicks - (like scroll wheel scrolls) - -2001-03-29 Kjartan Maraas <kmaraas@gnome.org> - - * *.*: Cleaned up #includes. Remove unneccesary includes of - <gnome.h>, <gtk/gtk.h>, <bonobo.h> and replaced with more - fine grained headers where needed. Also marked a bunch of - strings for translations and added some missing prototypes. - -2001-03-29 Dan Winship <danw@ximian.com> - - * mail-account-editor.c (switch_page): Fix this so the "Receiving - Options" page gets filled in again. - - * mail-send-recv.c (receive_get_folder): Doh! This was storing - "struct _folder_info"s in the cache and then trying to read them - back as CamelFolders. Fixicate. Fixes the "crash with 2 POP - accounts" bug. - - * session.c (auth_callback): Update call to camel_url_to_string. - (Don't include the params in the password hash table key.) - - * mail-config.c (mail_config_folder_to_cachename): Call - camel_url_to_string with HIDE_PASSWORD and HIDE_PARAMS so that - changing URL params doesn't change the cachename. - - * mail-ops.c (add_vtrash_info): - * mail-local.c (reconfigure_folder_reconfigure): - * mail-account-gui.c (save_service): Update calls to - camel_url_to_string. - -2001-04-03 Dan Winship <danw@ximian.com> - - * folder-browser-factory.c (control_activate): Sync the folder on - activate. - - * session.c (mail_session_remember_password): Use the same - URL-transforming rules we use when hashing the password so this - actually works. - -2001-04-03 Not Zed <NotZed@Ximian.com> - - * mail-ops.c (mail_send_message): Strip header content before using it. - -2001-04-02 Iain Holmes <iain@ximian.com> - - * importers/elm-importer.c (elm_can_import): Calls is_kmail to - check for kmail files. - (is_kmail): Checks if the given directory is a KMail directory. - -2001-04-02 Dan Winship <danw@ximian.com> - - * mail-account-gui.c: Add a "provider_type" arg to - MailAccountGuiService. - (transport_needs_auth_toggled): Call service_changed if enabling - the auth pane so the status of the "Check supported types" button - will be correct. - (service_check_supported): Use gsvc->provider_type, not - CAMEL_PROVIDER_STORE. - (mail_account_gui_new): Pass the transport as the user_data to the - "changed" signal on transport.hostname, not the store. - (mail_account_gui_setup): Set up provider_type fields - -2001-04-02 Iain Holmes <iain@ximian.com> - - * importers/elm-importer.c (elm_can_import): Check for some MH files - to make sure that the dir really is an Elm dir. - -2001-03-30 Not Zed <NotZed@Ximian.com> - - * folder-browser.c (folder_browser_toggle_hide_deleted): New - function to listen for hide_deleted changes. - (folder_browser_toggle_hide_deleted): Only svae the hide-deleted - state if we are not setting a trash folder. - - * folder-browser-factory.c (control_activate): Set the - hide_deleted flag appropriately/setup the menu's appropriately. - (control_activate): Workaround to Force setting of options by - bypassing bonobo notification, since it doesn't properly handle - changed components. - - * mail-config.c (mail_config_get_hide_deleted): - (mail_config_set_hide_deleted): New functions for - accessing/setting the hide deleted state. - (mail_config_write_on_exit): - (config_read): Save/load the hide_deleted flag. - - * message-list.c (main_folder_changed): Oops, remember to copy - over all the rest of the changes too if we removed some. - (find_next_undeleted): Find the first undeleted message below us. - This of course does not follow sorting conventions, but thats - etree. Have to ask chris if there is a way to make it work like - that. - (message_list_set_hidedeleted): Check we dont set hide_delete on a - vtrash. - (build_tree): If the message has vanished, try and get the next - undeleted message set, etc, if it still exists. The set_cursor() - function seems very broken but i'm sure e-lahey will get to it - soon. - (build_flat): Similarly for above. - -2001-03-30 Dan Winship <danw@ximian.com> - - * mail-config.c (check_service_check): Register for cancellation. - (mail_config_check_service): Pop up a modal dialog with a message - and a "Cancel" button for the duration of the check. - - * component-factory.c (debug_cb): If the EvolutionShellComponent - emits a "debug" signal, turn on camel_verbose_debug. - -2001-03-30 Radek Doulik <rodo@ximian.com> - - * mail-display.c (mail_display_redisplay): reset last_active - -2001-03-29 Dan Winship <danw@ximian.com> - - * mail-format.c (call_handler_function): if called with a - multipart that's really a 0-part, spew an error and display as - source. - - * mail-display.c (pixmap_press): Ignore "funky" button clicks - (like scroll wheel scrolls) - -2001-03-29 Dan Winship <danw@ximian.com> - - * mail-account-editor.c (switch_page): Fix this so the "Receiving - Options" page gets filled in again. - - * mail-send-recv.c (receive_get_folder): Doh! This was storing - "struct _folder_info"s in the cache and then trying to read them - back as CamelFolders. Fixicate. Fixes the "crash with 2 POP - accounts" bug. - - * session.c (auth_callback): Update call to camel_url_to_string. - (Don't include the params in the password hash table key.) - - * mail-config.c (mail_config_folder_to_cachename): Call - camel_url_to_string with HIDE_PASSWORD and HIDE_PARAMS so that - changing URL params doesn't change the cachename. - - * mail-ops.c (add_vtrash_info): - * mail-local.c (reconfigure_folder_reconfigure): - * mail-account-gui.c (save_service): Update calls to - camel_url_to_string. - -2001-03-29 Not Zed <NotZed@Ximian.com> - - * mail-local.c (init_trash): Create a vtrash folder, not a vee folder. - - * folder-browser-factory.c (control_activate): Hook in the hide - deleted thingy. - Removed MessageHideDeleted menu stuff. - - * message-list.c (message_list_set_hidedeleted): New function, to - set if we should hide deleted messages automatically/always. - (regen_list_regen): If we have hide deleted messages turned on, - then hide them. - (main_message_changed): Promote to a folder_changed event with a - change list, folder_changed has the optimisations to handle this - appropriately. - (main_folder_changed): IF we get changes events for - deleted/undeleted stuff, change to added/removed events, rebuild - if necessary. - (message_list_set_folder): Setup the default hidedeleted state to - be to hide everything unless it is in a vtrash folder. - -2001-03-28 Jeffrey Stedfast <fejj@ximian.com> - - * mail-account-gui.c (setup_service): Move the - gtk_toggle_button_set_active outside the if. - -2001-03-28 Dan Winship <danw@ximian.com> - - * mail-account-gui.c (mail_account_gui_new): Set up the - sent/drafts folder buttons. - (folder_picker_clicked): Pop up the folder selector when sent or - drafts is clicked. - (mail_account_gui_save): Save the sent/drafts folders. - - * mail-config.c (account_copy): copy sent/drafts info - (config_read): read sent/drafts info - (mail_config_write): write sent/drafts info - - * mail-callbacks.c (composer_send_cb, composer_postpone_cb): - split out some common code here (and fix inconsistencies). Always - set headers on the message giving the account name, transport, - and sent folder to use. - - * mail-ops.c (mail_send_message): If the message has an - X-Evolution-Account header, use the transport/sent folder info for - that account (assuming it still exists). Otherwise, if it has - X-Evolution-Transport and/or X-Evolution-Fcc, use those. If not, - use the default transport and sent folder. - FIXME: Falls back silently to the default sent folder if it can't - open the account-specific one... - (send_queue_send): remove the X-Evolution-Transport, etc - processing here, as it gets done by mail_send_message now. - FIXME: We only sync the default sent folder. - - * component-factory.c (owner_set_cb): While setting up the - standard folders, also record their URIs. - -2001-03-27 Jeffrey Stedfast <fejj@ximian.com> - - * mail-account-editor.c (switch_page): Lets do some NULL checking - here. First, make sure the gsrc isn't NULL and also make sure that - account->source isn't NULL either. - - * mail-account-gui.c (mail_account_gui_setup): If there isn't a - source_proto, make sure we select "None" as the source type. - -2001-03-27 Dan Winship <danw@ximian.com> - - * mail-config-druid.c (construct): set the initial druid button - state after doing the mail_account_gui_setup, since that may - invoke signal handlers that will change it. - - * mail-account-gui.c (mail_account_gui_new): Fill in signature and - organization too. - (mail_account_gui_save): Preserve the "enabled" flag on the source. - (save_service): Don't look at authtype if the widget is - insensitive. (Fixes the "smtp://;auth=PLAINservername" bug.) - -2001-03-27 Not Zed <NotZed@Ximian.com> - - * mail-send-recv.c (receive_done): Use gnome-dialog-close instead - of object_unref, for some reason it doesn't like being unref'd - with a refcount of 1, _who knows_. Gets rid of that refcount - warning on get mail. - -2001-03-27 Dan Winship <danw@ximian.com> - - * mail-config.glade: Probably the very last new config dialog - ever. (Ha ha). From Anna, based on a story by me. - - * mail-account-gui.c: New code for the new mail-config.glade. This - abstracts out all of the common code between the account editor - and the druid. It also handles the spiffy new provider-specific - config stuff. - - FIXME: The code to check if a service is ok or not is no longer - there... waiting until the online/offline stuff from the shell - appears. - - * mail-account-editor.c, mail-config-druid.c: These are much - smaller now, since most of the interesting bits moved to - mail-account-gui.c - - * mail-accounts.c: Add an enabled/disabled column/button to - replace the checkbox that used to be in the editor, because it - really makes more sense to have it out here. This looks ugly. - Probably ought to ETable it... - (load_accounts): Fill in the enabled column. - (mail_select, mail_unselect): toggle the sensitivity and name of - the Enable/Disable button appropriately - (mail_able): Handle the enable/disable button. - - * mail-config.c: Remove reply-to from MailConfigIdentity since it - didn't belong there (and wasn't being saved anyway). - (mail_config_check_service): Simplify this a bit. This really - needs to pop up a dialog with a "connecting..." message and a - cancel button. - - * mail-ops.c (uid_cachename_hack): Kludge, copied+modified from - mail_config_folder_to_cachename to deal with the different - behavior of the URL code now. Will go away when the keep-on-server - code moves. - (get_folderinfo_get): Only pass "subscribed_only" to - camel_store_get_folder_info if the store supports subscriptions... - - * mail-local.c (local_provider): Update this to reflect the - CamelProvider structure change - -2001-03-26 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (transfer_msg): Add "vtrash" as an allowed mail - folder type. - - * mail-ops.c (transfer_messages_transfer): Updated to reflect - changes made to the move/copy API in camel-folder.c - (add_vtrash_info): Use /Trash as the path instead of Trash. - - * mail-local.c (reconfigure_folder_reconfigure): Updated this too. - -2001-03-20 Not Zed <NotZed@Ximian.com> - - * mail-local.c (init_trash): Fixed vfolder_new api. - -2001-03-26 Dan Winship <danw@ximian.com> - - * mail-format.c (get_cid): Make fake content-id URLs be guaranteed - unique: the old way (with %p on the CamelMimePart *) would - generate duplicates if memory was freed and re-allocated the right - way. - - * mail-display.c (pixbuf_gen_idle, etc): Make the thumbnail cache - global rather than per-MailDisplay, since content-ids ought to be - globally unique. Also, don't leak content-id strings when the - pixbuf generation fails, and remove pixbufs from the cache after 5 - minutes. - - * component-factory.c (mail_load_storages): Simplify a bit using - camel_session_get_provider. - - * mail-callbacks.c (empty_trash): Ditto, and fix up use of - CamelException. - -2001-03-26 Radek Doulik <rodo@ximian.com> - - * mail-format.c (write_address): clear name and email data after - each address - -2001-03-25 Dan Winship <danw@ximian.com> - - * component-factory.c (unref_standard_folders): Fix a bug in this - that probably would have been noticed sooner if ETree hadn't always - made the mailer crash before you got here. :-) - -2001-03-25 Jeffrey Stedfast <fejj@ximian.com> - - * mail-account-editor.c (transport_auth_type_changed): Allow the - authtype to be NULL. - (transport_auth_init): If the provider allows authtypes but - doesn't *need* one, create a "None" menu item that the user can - choose. This should fix the bug people have been seeing recently - since dan removed the no_authtype authmech from the smtp provider. - -2001-03-24 Jeffrey Stedfast <fejj@ximian.com> - - * openpgp-utils.c (openpgp_verify): Default to iso-8859-1 as the - user's charset here if it is undefined. This is a better choice - than us-ascii. - -2001-03-23 Jon Trowbridge <trow@ximian.com> - - * mail-display.c (handle_embedded_address_object): #ifdef away - some code I don't quite want to delete yet. - (html_button_press_event): Remove some of Radek's placeholder - code, replace it with code to create my AddressPopup bonobo - control. - - * mail-format.c: Remove some obsolete code that if #ifdef-ed out - a while ago. - - * mail-ops.c (send_queue_send): Strip out the X-Evolution-Identity - header when sending. - -2001-03-23 Christopher James Lahey <clahey@ximian.com> - - * message-list.c: Turned on BROKEN_ETREE. - -2001-03-22 Iain Holmes <iain@ximian.com> - - * importers/evolution-outlook-importer.c: Update for new IDL. - - * importers/evolution-mbox-importer.c: Update for new IDL. - - * importers/Makefile.am: Build the elm importer. - -2001-03-22 Jeffrey Stedfast <fejj@ximian.com> - - * mail-accounts.c (mail_double_click): New callback to handle a - double-click event in the account clist. - (construct): Setup the double-click event for the account list. - -2001-03-22 Radek Doulik <rodo@ximian.com> - - * mail-display.c (mail_display_new): connect to button_press_event - and iframe_created events of GtkHTML widget - (html_button_press_event): new signal handler, runs popup on - address fields and on links, later we should add popups for images - and maybe some more? any ideas? - (html_iframe_created): new signal handler, takes care of - connecting to button_press_event of all iframes : plus bunch of - empty methods for popup menu items - to be implemented - (html_motion_notify_event): new handler, highlights addresses by - underline - (html_enter_notify_event): take care of enter event - (update_active): helper function, extracted from - html_motion_notify_event - (update_active): move to absolute coordinates - (html_button_press_event): ditto - - * mail-format.c (write_address): revert back to raw HTML text, - store name and email to Text objects, workaround gtkhtml tables - bug (to be fixed soon ;-) - -2001-03-21 Ettore Perazzoli <ettore@ximian.com> - - * folder-browser-factory.c (update_pixmaps): Don't return if - loading one image fails. - -2001-03-21 Dan Winship <danw@ximian.com> - - * mail-format.c (handle_multipart_related): Fix a bug in (illegal) - 0-part messages - - * mail-config-druid.c (incoming_check, incoming_type_changed, - transport_check, transport_type_changed): * mail-account-editor.c - (transport_type_changed, source_check): Use the new URL part - macros - - * mail-config.c (check_service_check): Use provider authtype list - if not connecting. - -2001-03-20 Miguel de Icaza <miguel@ximian.com> - - * folder-browser-factory.c: Added new icons. - -2001-03-18 Miguel de Icaza <miguel@ximian.com> - - * folder-browser-factory.c: Remove duplicated verb. - -2001-03-20 Iain Holmes <iain@ximian.com> - - * importers/evolution-mbox-importer.c (process_item_fn): Step the - parser so that it will import more than one message. - -2001-03-20 JP Rosevear <jpr@ximian.com> - - * importers/Makefile.am: extra dist the oaf files - -2001-03-20 Radek Doulik <rodo@ximian.com> - - * mail-tools.c (mail_tool_quote_message): set color in html - citation - - * mail-config.c: added citation highlighting configuration - - * mail-tools.c (mail_tool_quote_message): use citation - highlighting - - * mail-display.c (mail_text_write): use citation highlighting - -2001-03-20 Christopher James Lahey <clahey@ximian.com> - - * folder-browser.c (etree_key): Made this check if the control - mask is set. - -2001-03-20 Christopher James Lahey <clahey@ximian.com> - - * message-list.c (remove_node_diff, build_flat_diff): Remove the - node before freeing the data it points to. - -2001-03-19 Christopher James Lahey <clahey@ximian.com> - - * Merged e-tree-rework-branch: - -2001-03-18 Christopher James Lahey <clahey@ximian.com> - - * message-list.c: Added has_save_id and get_save_id methods. - - * subscribe-dialog.c: Added arguments for - e_tree_memory_callbacks_new of get_save_id and has_save_id to - NULL. - -2001-03-16 Christopher James Lahey <clahey@ximian.com> - - * message-list.c: Added a call to - e_tree_memory_set_expanded_default to TRUE. Removed all calls to - set_expanded on nodes while the tree is frozen since this fails - miserably now. - -2001-03-13 Christopher James Lahey <clahey@ximian.com> - - * message-list.c (message_list_get_layout): Turned off draw-grid. - -2001-03-09 Christopher James Lahey <clahey@ximian.com> - - * folder-browser-factory.c, folder-browser.c, message-list.c, - message-list.h, subscribe-dialog.c, subscribe-dialog.h, - mail-callbacks.c: Converted these all to use ETree instead of - ETable. - -End of branch - -2001-03-19 Iain Holmes <iain@ximian.com> - - * importers/pine-importer.c: Pine intelligent mail importer. - - * importer/elm-importer.c: Elm imtelligent mail importer. - - * importer/GNOME_Evolution_Mail_(Pine|Elm)_Intelligent_Importer.oaf.in: - Pine and Elm oafinfo files. - - * importer/netscape-importer.c (maybe_replace_name): Replace some invalid - names with valid ones (Trash -> Netscape-Trash). Change some netscape names - to Evolution names (Unsent Messages -> Outbox). - (scan_dir): Use less variables. - (netscape_import_file): Simplify. - -2001-03-19 Jeffrey Stedfast <fejj@ximian.com> - - * mail-ops.c: Removed gnome.h and ctype.h - (send_queue_send): Don't remove the X-Evolution header here. - (mail_send_message): Remove it here instead (so we only have to - remove it in one place - no matter if you send a single message or - send_queue. - -2001-03-19 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (write_headers): Write the date header. - - * component-factory.c (owner_unset_cb): Call - unref_standard_folders() here instead. - - * folder-browser-factory.c: Add Resend Message menu item. - - * folder-browser.c (on_right_click): Add resend to the right-click - menu. - - * mail-callbacks.c (composer_sent_cb): Unref the message. - (composer_postpone_cb): Unref the message here too. - (resend_msg): New callback to allow resending of messages in the - Sent folder. - -2001-03-18 Jeffrey Stedfast <fejj@ximian.com> - - * component-factory.c (unref_standard_folders): unref the standard - folders. - (owner_set_cb): Use g_atexit() to call unref_standard_folders() - when evolution-mail exits. This should solve the problem where - these folders are not synced when evolution-mail closes (because - they still had refs on them on close). - -2001-03-17 Not Zed <NotZed@Ximian.com> - - * mail-mt.c (mail_msg_free): Move the proxy event outside the lock - (otherwise we always deadlock). - - * mail-local.c (reconfigure_clicked): Clear the message list - during update inside the folder thingy. This is a hell mess, need - to move the gui stuff to mail-callbacks and make this reconfigure - thing a more generic func. - - * message-list.c (ml_value_to_string): Cleanup the logic to use - lookup tables. - (sort_uid_to_rows): Removed due to rewrite below. - (build_flat_diff): Changes for node/summary/etc changes. Also do - changed nodes too. - (clear_tree): Free the info reference for nodes in our hashtable. - (build_subtree): Ref the info reference in our hash/tree node. - (on_click): Dont free message info, since we just got our ref to - it. - (remove_node_diff): Free messageinfo off node. - (build_flat): Ref messageinfo. - (message_list_set_folder): Allow a NULL folder to be set - - i.e. clear the view. - (message_list_set_folder): Emit a no message sleeted signal. - (build_tree): Change cursor keeping stuff to work with new info. - - Turned off BROKEN_ETREE - well maybe it'll work. Check for - duplicate messages displayed, etc. - -2001-03-16 Not Zed <NotZed@Ximian.com> - - * message-list.h: Added uid_nodemap; mapping of uid's to e-tree - nodes. - - * message-list.c (build_flat): Changed to take a summary argument, - and to store node in node map, etc, and store info's in e-tree. - (build_subtree): Changed to store node in node map, and to store - info's in tree directly. - (ml_tree_value_at): Changed to get info directly from tree node, - removed allocated return value logic. - (ml_tree_value_at): Removed all "fake node" handling, no fake - nodes should ever exist. - (id_is_uid, id_is_subject, id_uid, id_subject): Removed macro's no - longer used. - (new_id_from_uid, new_id_from_subject): Removed no longer used. - (get_message_uid): - (get_message_info): Treat tree node data as messageinfo. - (message_list_select): Dont free the messageinfo, as its part of - our data, not retrieved from folder. - (message_list_drag_data_get): ditto. - (subtree_unread): Treat tree node data as messageinfo. - (subtree_size): ditto. - (subtree_earliest): ditto. - (clear_tree): Reset uid_nodemap on clear. - (save_node_state): tree nodes == messageinfo's. - (add_node_diff): ditto. - (remove_node_diff): ditto. - (main_folder_changed): use uid_nodemap to lookup changed nodes. - (main_message_changed): ditto. - -2001-03-16 Jeffrey Stedfast <fejj@ximian.com> - - * mail-crypto.c (pgp_mime_part_sign_prepare_part): New function to - prepare the mime part and any subparts for pgp signing. - (pgp_mime_part_sign_restore_part): New convenience function to - undo the prepare_part. - (pgp_mime_part_sign): Don't assume the part passed in is a leaf - part, we could very easily get a multipart (and in fact were which - is why people have been having unexpected results when signing - messages with attachments) and set the encoding as if it were a - leaf part. Use our 2 new convenience functions to set the - encoding(s) instead. - -2001-03-15 Miguel de Icaza <miguel@ximian.com> - - * folder-browser-factory.c (folder_browser_setup_view_menus): Fix - memory leak. - -2001-03-15 Jeffrey Stedfast <fejj@ximian.com> - - * mail-account-editor.c (apply_changes): We don't care about SSL, - yea baby... - (apply_changes): Don't care about SSL, no baby... - (construct): Yea, I said we don't care 'bout SSL, baby - (construct): That's exactly what I said, uh huh... - (transport_auth_type_changed): Set the sensitivity of the - user/passwd entries. - (transport_type_changed): If the hostname hasn't been set yet, - just use "localhost" as it doesn't really matter, since all we - need is a valid URL object. - - * mail-config.c: We no longer need `use_ssl' for sources and - transports. - -2001-03-15 Dan Winship <danw@ximian.com> - - * mail-display.c (mail_display_redisplay): Remove a stray - camel_object_ref that was causing messages to never be finalized - if they got redisplayed (because of attachments, delayed-loading - IMAP parts, etc) - -2001-03-15 Not Zed <NotZed@Ximian.com> - - * folder-browser.c: Added edit item to search-bar menu. - - * mail-callbacks.c (filter_edit): Changed for filter_editor_new() - api addition/change. - - * mail-vfolder.c (vfolder_edit): Use vfolder_editor_new intead. - -2001-03-14 Jeffrey Stedfast <fejj@ximian.com> - - * session.c (mail_session_init): Tell camel to init NSS. - (mail_session_accept_dialog): Doh! NULL terminate the list of - buttons and show the label. - - * mail-mt.c (do_get_accept): Same. - -2001-03-14 Ettore Perazzoli <ettore@ximian.com> - - * importers/Makefile.am (INCLUDES): Add `-I$(top_builddir)/shell' - and `-I$(top_srcdir)'. - -2001-03-13 Dan Winship <danw@ximian.com> - - * mail-display.c (on_url_requested): Call gtk_html_end() on the - stream so things happen. Fixes a problem with some inline images - (just very small ones maybe?) - - * importers/.cvsignore: create - -2001-03-13 Jeffrey Stedfast <fejj@ximian.com> - - * session.c (mail_session_init): Call camel_init with the - evolution directory passed in. Also, abort if camel cannot be - initialized. - - * main.c (main): Shutdown camel. - -2001-03-04 Michael Meeks <michael@ximian.com> - - * folder-browser-factory.c (free_pixmaps): impl. - (update_pixmaps): accelerate with cache. - -2001-03-13 Iain Holmes <iain@ximian.com> - - * Makefile.am: Removed the importers and created a subdirectory - for them to live happily as plugins. - - * mail-importer.c (mail_importer_create_folder): Modified the - function to take a BonoboListener for the callback. - (get_importer_list): Get a list of importer plugins. - (free_importer_list): Free the list of plugins. - (mail_importer_init): Initalise the list of plugins. - (main_importer_uninit): Unload the modules. - - * GNOME_Evolution_Mail.oaf.in: Remove the oaf_server entries for - the importers. - - * importers/*: Copy the importers in here. - -2001-03-12 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.c (mail_config_write): Make the transport save - whether or not it's supposed to use SSL as well. - (config_read): Read in whether or not we should remember the - transport password (for those that support SASL). - (mail_config_write): Save whether or not to save transport - passwords (needed for SASL enabled transports). - - * mail-ops.c (add_vtrash_info): Instead of always creating a new - vTrash folder, if the store already has a Trash folder, replace it - with the vTrash. Also, name the folder "Trash" instead of "vTrash" - and i18nify the name. - -2001-03-11 Jeffrey Stedfast <fejj@ximian.com> - - * mail-ops.h: Added protection. - - * folder-browser-factory.c: Add ActionsEmptyTrash. By the way - - should we rename the bonobo verbs now that our menu structure has - changed? - - * mail-callbacks.c (empty_trash): New callback to empty ALL of the - trash folders. - -2001-03-10 Jeffrey Stedfast <fejj@ximian.com> - - * mail-ops.c (send_queue_send): Remove our X-Evolution header - before we send. Also don't send messages that are marked for - deletion. - -2001-03-09 Jeffrey Stedfast <fejj@ximian.com> - - * mail-mt.c (mail_get_accept): New async function that will be - used for SSL certs later. - - * session.c (auth_callback): Changed to return a gpointer value. - (mail_session_accept_dialog): New function to handle the new - _ACCEPT authenticator mode. - -2001-03-08 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser-factory.c: Set the Forward->Quoted callback. - Also set the forward->Attachment callback. - - * mail-view.c (view_forward_msg): Specify FORWARD_ATTACHED. - - * mail-callbacks.c (forward_attached): Don't call - forward_messages() anymore...never really needed to. Just handle - it directly. - (forward_inlined): Specify FORWARD_INLINE as the flag argument. - (forward_quoted): New function sorta like forward_inlined except - this forwards the message quoted. - - * mail-tools.c (mail_tool_forward_message): New function to - prepare a message to be forwarded. - -2001-03-08 Jon Trowbridge <trow@ximian.com> - - * mail-format.c (write_field_row_begin): Added. Table row HTML - broken out into its own function. - (write_subject): Added. Emits the proper HTML for the subject - line. - (write_field_to_stream): #ifdef-ed out of existence. - (write_address): Take a CamelInternetAddress and spit out an - <object> tag with the appropriate <param>s. - - * mail-display.c (on_object_requested): Check for an "address" - object. If found, call... - (handle_embedded_address_object): ...this function, which creates - an AddressWidget bonobo control and passes in the necessary info. - I never really realized just quite how much GtkHTML kicks ass - until I figured out how to make this work. - -2001-03-08 Jeffrey Stedfast <fejj@ximian.com> - - * mail-vtrash.[c,h]: Removed from cvs - - * Makefile.am: Removed mail-vtrash.[c,h] - - * main.c: Don't #include "mail-vtrash" anymore. - - * component-factory.c: Add "vtrash" as a folder type we support. - (create_view): Kludgy-kludge around the vtrash type. - (owner_set_cb): Don't create the vTrash folder here anymore... - - * folder-browser.c (on_double_click): Call open_msg here so that - it does the Right Thing (tm). - -2001-03-08 Jeffrey Stedfast <fejj@ximian.com> - - * mail-local.c (mail_local_store_class_init): Override the default - init_trash() with the our custom one (since MailLocalStore doesn't - let the CamelStore keep a hash of opened folders and instead - keepts track of them itself). - (init_trash): custom implementation of the init_trash method for - MailLocalStores - (get_folder): i18nize. - (register_folder_registered): Don't add the folder to the vtrash - here. - -2001-03-08 Ettore Perazzoli <ettore@ximian.com> - - * component-factory.c (component_fn): Specify a NULL - `EvolutionShellComponentGetDndSelectionFn'. - -2001-03-07 Jeffrey Stedfast <fejj@ximian.com> - - * mail-autofilter.c (filter_rule_from_message): Add an action-part - widget. - (filter_rule_from_mlist): Same here. This should get rid of the - problem where people go to create a rule based on a message and - forget to fill-in the action part. - -2001-03-07 Jeffrey Stedfast <fejj@ximian.com> - - * mail-crypto.c (mail_crypto_is_smime_v3_signed): New function to - decide if a mime part is an S/MIME v3 signed part. - (mail_crypto_is_pkcs7_mime): New function to decide if a mime part - is an application/pkcs7-mime part (or an application/octet-stream - part with application/pkcs7-mime data). - - * mail-account-editor.c (source_auth_init): Move the signal - emittion to after the set_menu call so that it actually works. - (transport_type_changed): Updated to manipulate the user/passwd - fields for the transport. - (construct): Updated to init the user/passwd fields for the - transport. - (transport_auth_init): Renamed. Also fill in the user/passwd - fields if available. - -2001-03-06 Jeffrey Stedfast <fejj@ximian.com> - - * mail-accounts.c (construct): Disable the NNTP code if NNTP is - not enabled. This prevents some runtime warnings... - - * mail-config-druid.c: Updated to have a transport auth page. - -2001-03-01 Miguel de Icaza <miguel@ximian.com> - - * folder-browser.c (on_right_click): Move the context menus to - the toplevel code; Use enumerations for the various bitfield - constants. - - Add support for hiding items that are not required (read/unread - and delete/undelete). - - This requires my previous patch, as it assumes "Open" does the - right thing instead of having two operations: Open and Edit. - -2001-02-28 Miguel de Icaza <miguel@ximian.com> - - * folder-browser.c (on_right_click): Removed draft folders op - here, since open_msg now does the right thing (edit or view). - - * folder-browser-factory.c (update_pixmaps): Removed MessageEdit - from here. - - * mail-callbacks.c (open_msg): New function, does the "right - thing" to a message (either, edit or open). - - * folder-browser-factory.c: Register new command here. - (update_pixmaps): Rename keys that have been shuffled around. - (update_pixmaps): Rename to match new updates on xml file. - - Rename MessageOpenNewWindow to MessageOpen. Change action from - "view_message" to "open_message". - - * mail-callbacks.c (mark_all_as_seen): New command. Marks all - messages as seen. - -2001-03-06 Dan Winship <danw@ximian.com> - - * mail-ops.c (get_folderinfo_got): If the folderinfo has no URL - (ie, can't contain messages), don't add it as a vtrash source. - -2001-03-05 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config-druid.c: Don't access the `active` data member of a - GtkToggleButton directly - bad programming, shame on me. - - * mail-account-editor.c: Same here. - - * mail-accounts.c: And here too. - - * mail-callbacks.c (empty_subject_destroyed): And finally here. - - * mail-crypto.c (pgp_mime_part_sign): Correcty set the mime type - for the multipart. Hmmm, still doesn't wrap correctly. NotZed? - Ideas? - (pgp_mime_part_encrypt): Here too. - -2001-03-03 Not Zed <NotZed@Ximian.com> - - * mail-tools.c: Remove very old camel lock stuff. - - * mail-local.c (register_folder_registered): Add the local folder - as a potential vfolder source. - - * folder-browser.c (got_folder): When we have a new folder, - register it as a potential vfolder source. - - * mail-vfolder.c: Added the source rule to the vfolder_info. - (vfolder_refresh): Store the rule in the vfolder info, etc. - (vfolder_register_source): Function to register a newly opened - folder with us. - (vfolder_uri_to_folder): Save the folder in the vfolder_info too. - (source_finalise): Handle clenaup when the folder dies. - -2001-03-02 Not Zed <NotZed@Ximian.com> - - * mail-mt.c (set_stop): Check the container is not NIL before - trying to set thje prop. - -2001-03-01 Not Zed <NotZed@Ximian.com> - - * 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 <NotZed@Ximian.com> - - * folder-browser.c (folder_browser_config_search): New function to - configure the FilterRule for the search mechanism. - -2001-02-27 Not Zed <NotZed@Ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 X-Mailer. - -2001-02-26 Dan Winship <danw@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <iain@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <NotZed@Ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <NotZed@Ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * mail-ops.c (mail_send_message): Updated to reflect changes to - the filter-driver code. - -2001-02-22 Not Zed <NotZed@Ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <NotZed@Ximian.com> - - * 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 <danw@ximian.com> - - * 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 <NotZed@Ximian.com> - - * mail-vtrash.c: Include the camel-vee-store.h header from the - uninstalled copy. - -2001-02-19 Jeffrey Stedfast <fejj@ximian.com> - - * component-factory.c (mail_load_storages): Create vTrash folders - for all remote stores as well. - -2001-02-20 Not Zed <NotZed@Ximian.com> - - * mail-vtrash.c (create_trash_vfolder): Add the auto-update flag - to the folder open flags. - -2001-02-19 Jeffrey Stedfast <fejj@ximian.com> - - * 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 <NotZed@Ximian.com> - - * 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 <NotZed@Ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * main.c: * component-factory.c: Reverse the changes I made - yesterday. - -2001-02-15 Jeffrey Stedfast <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * openpgp-utils.c (openpgp_verify): Add the --no-tty flag. - -2001-02-14 Dan Winship <danw@ximian.com> - - * 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: <mailto:..." - (mail_mlist_magic_detect_list): Iterate through an array of - function pointers rather than calling each checker explicitly. - - * component-factory.c (add_storage): Connect to the - "create_folder" signal on the storage. - (storage_create_folder): Do folder creation. - -2001-02-14 Jeffrey Stedfast <fejj@ximian.com> - - * 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 <clahey@ximian.com> - - * mail-local.c (do_reconfigure_folder): Fix some uninitialized - variables. - -2001-02-12 Not Zed <NotZed@Ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <kmaraas@gnome.org> - - * Makefile.am: xml-i18n-tools setup. - * GNOME_Evolution_Mail.oaf.in: Mark strings for translation. - -2001-02-11 Dan Winship <danw@ximian.com> - - * mail-callbacks.[ch]: Re-add non-static forward_messages. - mail-view.c needs it. - -2001-02-11 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (forward_inlined): Don't leak memory. - (forward_messages): change doinline to be a gboolean argument. - -2001-02-10 Jeffrey Stedfast <fejj@ximian.com> - - * 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 <menesis@delfi.lt> - - * 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 <danw@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <NotZed@Ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <NotZed@Ximian.com> - - * 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 <NotZed@Ximian.com> - - * 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 <NotZed@Ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * mail-config.c (mail_config_write_on_exit): Oops, save the - seen_timeout variable. - -2001-02-06 Christopher James Lahey <clahey@ximian.com> - - * 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 <iain@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <clahey@ximian.com> - - * 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 - <libgnomeui/gnome-window-icon.h>. - (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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <michael@helixcode.com> - - * mail-local.c (load_metainfo): Fix dodgy libxml allocation - pollution, and potential faults on NULL attributes. - -2001-02-02 Not Zed <NotZed@Ximian.com> - - * 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 <ijc25@cam.ac.uk> - - * message-list.c: Add support for new icons for being - read/unread for fake root messages on threads. - -2001-01-30 Iain Holmes <iain@ximian.com> - - * 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 <kmaraas@gnome.org> - - * folder-browser.c: Fix typo. - -2001-01-29 Jeffrey Stedfast <fejj@helixcode.com> - - * mail-importer.c (mail_importer_add_line): Cast the - camel_stream_mem_new() to a CamelStreamMem. - -2001-01-29 JP Rosevear <jpr@ximian.com> - - * main.c: Return efence ifdefs to 0 for solaris build - -2001-01-29 Not Zed <NotZed@Ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <ettore@ximian.com> - - * 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 <ettore@ximian.com> - - * 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 <NotZed@Ximian.com> - - * 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 <clahey@helixcode.com> - - * folder-browser.c (etable_key): Don't handle home and end keys - since %ETable deals with them now. - -2001-01-27 Jeffrey Stedfast <fejj@ximian.com> - - * message-list.c (address_compare): Protect against NULL address - pointers. - (subject_compare): Same but for subject pointers. - -2001-01-27 Iain Holmes <iain@ximian.com> - - * 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 <ettore@ximian.com> - - * mail-display.c (get_embedded_for_component): Try a control - first, instead of an embeddable. - -2001-01-26 Jeffrey Stedfast <fejj@ximian.com> - - * 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 <iain@ximian.com> - - * 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 <danw@ximian.com> - - * mail-identify.c (mail_identify_mime_part): Fix an uninitialized - variable use. - -2001-01-26 Jason Leach <jasonleach@usa.net> - - (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 <NotZed@Ximian.com> - - * message-list.c (build_tree): Define BROKEN_ETREE again, till we - get this stuff fixed better. - -2001-01-25 Not Zed <NotZed@Ximian.com> - - * 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 <ettore@ximian.com> - - * 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 <iain@ximian.com> - - * 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 <fejj@ximian.com> - 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 <jasonleach@usa.net> - - (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 <danw@ximian.com> - - * 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 <clahey@helixcode.com> - - * 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 <ettore@ximian.com> - - * 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 <ettore@ximian.com> - - * 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 <NotZed@Ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <ettore@ximian.com> - - [Applied patch from Tuomas Kuosmanen <tigert@ximian.com>] - - * 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 <ettore@ximian.com> - - * GNOME_Evolution_Mail.oafinfo: Fixed the repo_ids so that they - use the right syntax. - -2001-01-23 Dan Winship <danw@ximian.com> - - * folder-browser-factory.c: - * mail-callbacks.c (send_receive_mail): Fix spelling. - -2001-01-24 Not Zed <NotZed@Ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <NotZed@Ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <iain@ximian.com> - - * 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 <danw@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <NotZed@Ximian.com> - - * mail-crypto.c (pgp_mime_part_verify): Fix a double-free problem. - -2001-01-22 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config-druid.c (incoming_type_changed): Oops, danw didn't - know 'provider' could be NULL :-) - -2001-01-22 Dan Winship <danw@ximian.com> - - * 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 <danw@ximian.com> - - * 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 <NotZed@Ximian.com> - - * .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 <fejj@ximian.com> - - * 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 <NotZed@Ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <clahey@helixcode.com> - - * 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 <NotZed@Ximian.com> - - * 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 <fejj@ximian.com> - - * mail-ops.c (do_send_queue): Strip leading space from the - transport url gotten from the message. - -2001-01-19 Jeffrey Stedfast <fejj@ximian.com> - - * mail-format.c (mail_generate_reply): If the name is empty - string, use the address. - -2001-01-19 Dan Winship <danw@ximian.com> - - * 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 <NotZed@Ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * mail-account-editor.c (construct): Oops. "url && url->host" - doesn't do much without the '?' and ':' ;-) - -2001-01-17 Ettore Perazzoli <ettore@ximian.com> - - * mail-ops.c (set_x_mailer): New function. - (send_mail_send): Use it. - (do_send_queue): Use it. - -2001-01-17 Martin Norbäck <d95mback@dtek.chalmers.se> - - * openpgp-utils.c (pgp_get_passphrase): Changed the word entry - to enter, which is the correct word to use. - -2001-01-17 Jeffrey Stedfast <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <danw@ximian.com> - - * mail-display.c (on_object_requested): Don't do thumbnails for - offline images - -2001-01-16 Jeffrey Stedfast <fejj@ximian.com> - - * 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 <toshok@helixcode.com> - - * 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 <rodo@helixcode.com> - - * mail-format.c (mail_generate_reply): use - e_msg_composer_mark_text_orig - -2001-01-16 Dan Winship <danw@ximian.com> - - * 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 <jasonleach@usa.net> - - * subscribe-dialog.c: removed unecessary #inlcude "e-title-bar.h" - -2001-01-16 Jason Leach <jasonleach@usa.net> - - * openpgp-utils.c (pgp_get_passphrase): Fix a string causing - translation problems. Bug #1147. - -2001-01-16 Not Zed <NotZed@Ximian.com> - - * 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 <clahey@ximian.com> - - * 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 <miguel@ximian.com> - - * mail-callbacks.c (configure_mail): Set the default button to - `Yes' here. - -2001-01-13 Jeffrey Stedfast <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <fejj@ximian.com> - - * 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 <clahey@helixcode.com> - - * message-list.c: Changed filter_date and filter_size to match the - changes in gal. - -2001-01-12 Jeffrey Stedfast <fejj@ximian.com> - - * 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 <fejj@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <miguel@ximian.com> - - * message-list.c: Add strings for localization - - * folder-browser.c: Rename "Save" to "Store search as vFolder". - -2001-01-11 Miguel de Icaza <miguel@gnu.org> - - * 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 <fejj@ximian.com> - - * 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 <miguel@gnu.org> - - * 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 <fejj@helixcode.com> - - * 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 <danw@ximian.com> - - * folder-browser.c (got_folder): Connect to folder_changed as well - as message_changed for updating unread count - -2001-01-10 Miguel de Icaza <miguel@helixcode.com> - - * GNOME_Evolution_Mail.oafinfo: Add Bonobo/ItemContainer as the - set of supported interfaces in GNOME_Evolution_Mail_Composer - component. - -2001-01-11 Dan Winship <danw@ximian.com> - - * mail-format.c (write_field_to_stream): Translate the header name - to UTF8. - -2001-01-10 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <miguel@helixcode.com> - - * mail-callbacks.c (print_msg): Fix proto. - (print_preview_msg): Fix proto. - - * subscribe-dialog.c: Remove more UNSAFE macros. - -2001-01-09 Jason Leach <jasonleach@usa.net> - - * mail-display.c (pixmap_press): Bugfix for #1077: scrollwheel - doesn't work while hovering over an attachment icon. - -2001-01-09 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * mail-local.c (local_folder_changed_proxy): Change - mail_op_forward_event to mail_proxy_event. - -2001-01-09 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * Makefile.am (evolution_mail_LDFLAGS): Add -export-dynamic, so - libglade can resolve evolution-mail symbols. - -2001-01-09 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <rodo@helixcode.com> - - * mail-format.c (write_headers): remove </center><p> - (handle_text_plain): add <font size=\"-3\"> </font><br> before - msg text - (handle_text_plain_flowed): ditto - -2001-01-09 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * mail-ops.c: Add an #include <errno.h> - -2001-01-08 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <clahey@helixcode.com> - - * 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 <fejj@helixcode.com> - - * mail-account-editor.c: Coded a bunch of the methods. - -2001-01-04 Iain Holmes <iain@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * mail-config-druid.glade: Updated. What else can I say? - -2001-01-04 Dan Winship <danw@helixcode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <gnome.h> 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 <fejj@helixcode.com> - - * mail-config-druid.c: New source file that implements - mail-config-druid. Note: this is not yet complete. - -2001-01-03 Not Zed <NotZed@HelixCode.com> - - * 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 <rodo@helixcode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * mail-crypto.c (mail_crypto_openpgp_verify): Implemented. - -2000-12-23 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * mail-crypto.c: Oops. Update this for CamelContentType stuff too. - -2000-12-28 Dan Winship <danw@helixcode.com> - - * 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 <iain@helixcode.com> - - * 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 <iain@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <clahey@helixcode.com> - - * 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 <clahey@helixcode.com> - - * message-list.c (filter_date): Changed this to do different - formatting of dates within the last week. - -2000-12-24 Not Zed <NotZed@HelixCode.com> - - * Merge from camel-mt-branch. - -2000-12-23 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c (filter_date): Changed this to do different - formatting of dates based on the current time. - -2000-12-23 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c (message_list_get_layout): Added titles to the - pixbuf columns. - -2000-12-21 Iain Holmes <iain@helixcode.com> - - * 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 <iain@helixcode.com> - - * component-factory.c (factory_destroy): Wait till all views have - gone and then destroy both factories. - -2000-12-21 Dan Winship <danw@helixcode.com> - - * 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 <toshok@helixcode.com> - - * 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 <danw@helixcode.com> - - * message-list.c (hide_save_state): Unlock camel when done to - prevent a hang later. - -2000-12-18 Miguel de Icaza <miguel@helixcode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <clahey@helixcode.com> - - * mail-threads.c (update_active_views): Unref the iterator when - we're done with it. - -2000-12-14 Larry Ewing <lewing@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <clahey@helixcode.com> - - * 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 <clahey@helixcode.com> - - * 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 <danw@helixcode.com> - - * mail-summary.h: Fix to use the right .h instead of the - deprecated one. - -2000-12-12 Jeffrey Stedfast <fejj@helixcode.com> - - * mail-callbacks.c (forward_message): Attach a signature when - forwarding, fixes bug #826. - -2000-12-11 Dan Winship <danw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <clahey@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <jpr@helixcode.com> - - * folder-browser.c (on_double_click): the e-table double-click - signal now has extra params - -2000-12-07 Ettore Perazzoli <ettore@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <clahey@helixcode.com> - - * 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 <clahey@helixcode.com> - - * message-list.c: Connect to signals on the ETable instead of the - ETableScrolled. - -2000-12-07 Christopher James Lahey <clahey@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * mail-vfolder.c (vfolder_gui_add_rule): Make the vfolder editor - resize correctly. Fixes bug #835. - -2000-12-06 Dan Winship <danw@helixcode.com> - - 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * message-list.c (e_mail_address_new): Perform better - error-handling. - -2000-12-01 Radek Doulik <rodo@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 As menu item. - - * mail-ops.c (cleanup_save_messages): Save all emails to the path - given. - -2000-11-28 Dan Winship <danw@helixcode.com> - - * mail-local.c (cleanup_register_folder): Fix the initial unread - counts after the last patch. - -2000-11-27 Dan Winship <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * mail-display.c: Removed some unecessary debugging printf's - -2000-11-27 Dan Winship <danw@helixcode.com> - - * 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 <iain@helixcode.com> - - * mail-config-gui.c (mail_config): Don't use the "delete-event" - signal. - -2000-11-21 Iain Holmes <iain@helixcode.com> - - * 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 <danw@helixcode.com> - - * Makefile.am: add GPGME_CFLAGS and GPGME_LIBS - -2000-11-21 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <rodo@helixcode.com> - - * mail-display.c: #include <gtkhtml/gtkhtml-embedded.h> - -2000-11-21 Not Zed <NotZed@HelixCode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <fejj@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <clahey@helixcode.com> - - * message-list.c: Removed some e_table_model calls and replaced - them with e_tree_model calls. - -2000-11-12 Dan Winship <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * mail-ops.c (do_filter_ondemand): Sync the source folder. - -2000-11-11 Matt Bissiri <bissiri@eecs.umich.edu> - - * 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 <michael@helixcode.com> - - * Makefile.am ($(EVOLUTION_MAIL_CORBA_GENERATED)): sort include order. - -2000-11-09 Jeffrey Stedfast <fejj@helixcode.com> - - * subscribe-dialog.glade[.h]: New glade file for possibly using to - create the subscribe dialog. - -2000-11-08 Radek Doulik <rodo@helixcode.com> - - * 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 <fejj@helixcode.com> - - * mail-search-dialogue.c (mail_search_dialogue_construct): Allow - rule part to expand when the user resizes the dialog. - -2000-11-07 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <jpavel@helixcode.com> - - * 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 <ettore@helixcode.com> - - * Makefile.am (INCLUDES): Add the composer dirs. - -2000-11-07 Not Zed <NotZed@HelixCode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <fejj@helixcode.com> - - * folder-browser.c (on_right_click): Move filter stuff into a - submenu of the popup menu. - -2000-11-06 Jesse Pavel <jpavel@helixcode.com> - - * mail-display.c: used Camel to parse the full address before - passing the email address to my iTip control. - -2000-11-06 Dan Winship <danw@helixcode.com> - - 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 <kmaraas@gnome.org> - - * mail-autofilter.c: Fix up #include <config.h> - * 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 <fejj@helixcode.com> - - * mail-callbacks.c (delete_msg): Don't invert the flag. - (undelete_msg): Same (when multiple messages are selected). - -2000-11-06 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * message-list.c (cleanup_regenerate_messagelist): don't free the - MessageList search when it's being reused - -2000-11-03 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <federico@helixcode.com> - - * Makefile.am: Clean the idl-generated files properly. - -2000-11-03 Not Zed <NotZed@HelixCode.com> - - * 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 <fejj@helixcode.com> - - * message-list.c (on_right_click): Sync with message - menu. Addresses bugzilla bug #778. - -2000-11-02 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Turn on draw grid for the main ETable (this may - not be working in ETable itself.) - -2000-11-01 Jeffrey Stedfast <fejj@helixcode.com> - - * mail-threads.c (mail_op_set_message): fmt argument should be - const. - -2000-11-01 Dan Winship <danw@helixcode.com> - - 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 <fejj@helixcode.com> - - * 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 <NotZed@HelixCode.com> - - ** 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 <toshok@helixcode.com> - - * 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 <iain@helixcode.com> - - * mail-summary.c (generate_folder_summaries): Fix spelling :) - Set folder->uri to NULL for the Inbox. - -2000-10-26 Iain Holmes <iain@helixcode.com> - - * mail-summary.c (generate_html_summary): Add view:// uris to - switch the display to that folder. - -2000-11-01 Jeffrey Stedfast <fejj@helixcode.com> - - * folder-browser-factory.c: Hmmm, someone can't spell Filder, - er...I mean Filter ;-) - -2000-11-01 Jeffrey Stedfast <fejj@helixcode.com> - - * mail-autofilter.c (rule_from_message): If the name is NULL or - empty, then set the title to "Mail from <address>". Closes - bugzilla bug #777. Also when filtering on Subject, set the file - name to "Subject is <subject>" rather than just "<subject>" - I - think this is a bit more user-friendly. - (strip_re): Use unsigned char when passing to is<type>() - functions from ctype.h. - (rule_add_subject): Use the "is" rule instead of "contains". - -2000-11-01 Jesse Pavel <jpavel@helixcode.com> - - * mail-display.c: added property bag support for Bonobo - controls, support which helps only the iTip control, currently. - -2000-11-01 Dan Winship <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * mail-config-gui.c (do_test_service): Update for - camel_service_disconnect change. - -2000-10-31 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * mail-display.c (write_data_to_file): Don't destroy a dialog - after run_and_close'ing it. - -2000-10-26 Jeffrey Stedfast <fejj@helixcode.com> - - * mail-callbacks.c (composer_send_cb): Check for the TO recipient - list being NULL and don't send. - -2000-10-25 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <iain@helixcode.com> - - * 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 <danw@helixcode.com> - - * main.c (main): Pass send/postpone signal handler functions to - evolution_composer_factory_init. - -2000-10-25 Jeffrey Stedfast <fejj@helixcode.com> - - * subscribe-dialog.c (subscribe_select_all): Implemented. - (subscribe_invert_selection): (was unselect_all) Implemented. - -2000-10-25 Dan Winship <danw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <danw@helixcode.com> - - * *: Add some missing _()s and N_()s. - -2000-10-23 Dan Winship <danw@helixcode.com> - - * Makefile.am (INCLUDES): Update EVOLUTION_LOCALEDIR. - -2000-10-23 Jeffrey Stedfast <fejj@helixcode.com> - - * mail-ops.c (do_send_mail): Apply outgoing filters to the - message. - -2000-10-23 Christopher James Lahey <clahey@helixcode.com> - - * 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 <clahey@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <fejj@helixcode.com> - - * mail-config.h: #include <camel/camel-folder.h> - -2000-10-20 Michael Meeks <michael@helixcode.com> - - * mail.h: s/BonoboUIHandler/BonoboUIComponent/ - - * mail-callbacks.c (run_filter_ondemand): ditto. - - * session.c (forget_passwords): ditto. - -2000-10-20 Dan Winship <danw@helixcode.com> - - * evolution-mail.oafinfo: Declare composer factory. - - * main.c (main): Initialize it - -2000-10-19 Chris Toshok <toshok@helixcode.com> - - * message-list.c (nuke_uids): e-tree-model is now opaque. use the - accessor to get the root node. - -2000-10-19 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <ettore@helixcode.com> - - * Makefile.am (glade_messages): New. - (EXTRA_DIST): Add `$(glade_messages)'. - -2000-10-19 Dan Winship <danw@helixcode.com> - - * mail-ops.c: Clean up some old #if 0 code. - -2000-10-19 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <michael@helixcode.com> - - * 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 <clahey@helixcode.com> - - * message-list.c: Fixed some column widths. - -2000-11-02 Not Zed <NotZed@HelixCode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <iain@helixcode.com> - - * 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 <iain@helixcode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <toshok@helixcode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <NotZed@HelixCode.com> - - * message-list.c (message_list_setup_etable): oops, chose the - wrong thing to cut out after a merge conflict. - -2000-10-15 Chris Toshok <toshok@helixcode.com> - - * 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 <ettore@helixcode.com> - - * evolution-mail.oafinfo: Add "evolution:shell-component-icon" - attribute. - -2000-10-13 Jeffrey Stedfast <fejj@helixcode.com> - - * message-list.c (message_list_setup_etable): Don't free the - service name. - -2000-10-12 Jeffrey Stedfast <fejj@helixcode.com> - - * mail-ops.c (do_fetch_mail): sync & expunge the source folder - after filtering. - -2000-10-12 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <NotZed@HelixCode.com> - - * message-list.c (message_list_setup_etable): Duh, fix the test - for the folder name, strstr != strcmp is it. - -2000-10-10 Not Zed <NotZed@HelixCode.com> - - * 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 <toshok@helixcode.com> - - * 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 <clahey@helixcode.com> - - * 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 <iain@helixcode.com> - - * component-factory.c: Disable the executive summary. - -2000-10-11 Chris Toshok <toshok@helixcode.com> - - * 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 <anna@helixcode.com> - * mail-threads.c: Changed the password-getting dialog so that the - text entry has focus. - -2000-10-11 Chris Toshok <toshok@helixcode.com> - - * 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 <clahey@helixcode.com> - - * 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 <clahey@helixcode.com> - - * message-list.c, message-list.h, subscribe-dialog.c: Updated - these to the new ETable style of specifications. - -2000-10-11 Chris Toshok <toshok@helixcode.com> - - * 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 <toshok@helixcode.com> - - * subscribe-dialog.c (subscribe_dialog_gui_init): remove the html - description stuff for now. - -2000-10-10 Chris Toshok <toshok@helixcode.com> - - * 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 <toshok@helixcode.com> - - * 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 <lewing@helixcode.com> - - * 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 <iain@helixcode.com> - - * mail-summary.c (generate_html_summary): Removed the <li> from the - HTML. - -2000-10-10 Cody Russell <bratsche@gnome.org> - - * mail-threads.c: Added #include <errno.h> - -2000-10-09 Iain Holmes <iain@helixcode.com> - - * mail-summary.c: Removed the extra arguments to rule_context_load. - -2000-10-09 Chris Toshok <toshok@helixcode.com> - - * 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 <iain@helixcode.com> - - * mail-summary.c (create_summary_view): Updated to use new icon code. - -2000-10-08 Iain Holmes <iain@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <michael@helixcode.com> - - * 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 <miguel@helixcode.com> - - * 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 <miguel@helixcode.com> - - * 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 <iain@helixcode.com> - - * 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 <toshok@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <michael@helixcode.com> - - * 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 <fejj@helixcode.com> - - * message-list.c (address_compare): Use CamelInternetAddress - instead of my quick hack (aka InternetAddress). - -2000-10-05 Iain Holmes <iain@helixcode.com> - - * mail-summary.c: Don't watch for the message-changed signal. - -2000-10-05 Iain Holmes <iain@helixcode.com> - - * 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 <iain@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <toshok@helixcode.com> - - * 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 <fejj@helixcode.com> - - * mail-ops.c (do_filter_ondemand): Don't expunge the source - mailbox on completion. - -2000-10-04 Dan Winship <danw@helixcode.com> - - * mail-ops.c (do_scan_subfolders): Don't try to add_folders if - get_folder_info returned NULL. - -2000-10-04 Not Zed <NotZed@HelixCode.com> - - * 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 <miguel@helixcode.com> - - * 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 <toshok@helixcode.com> - - * 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 <toshok@helixcode.com> - - * 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 <toshok@helixcode.com> - - * 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 <toshok@helixcode.com> - - * 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 <toshok@helixcode.com> - - * 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 <michael@helixcode.com> - - * folder-browser-factory.c (set_pixmap): upd. - (control_activate): upd. - -2000-10-02 Dan Winship <danw@helixcode.com> - - * 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 <toshok@helixcode.com> - - * 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 <toshok@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <iain@helixcode.com> - - * 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 <iain@helixcode.com> - - * 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 <iain@helixcode.com> - - * 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 <miguel@helixcode.com> - - * 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 <toshok@helixcode.com> - - * 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 <toshok@helixcode.com> - - * 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 <fejj@helixcode.com> - - * mail-ops.c (do_send_queue): Messages should be appended to Sent - as Seen. - (do_send_mail): Same. - -2000-09-28 Ettore Perazzoli <ettore@helixcode.com> - - * 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 <toshok@helixcode.com> - - * 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 <toshok@helixcode.com> - - * 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 <fejj@helixcode.com> - 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * folder-browser-factory.c: Shuffling (un)select all menu items to - the Edit menu. - -2000-09-25 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <michael@helixcode.com> - - * folder-browser-factory.c (set_pixmap): upd. - (control_activate): upd. - -2000-09-23 Ettore Perazzoli <ettore@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * mail-format.c (mail_generate_reply): Fixed some memory - leakage. Call free_recipients() so we don't leak memory. - -2000-09-19 Jeffrey Stedfast <fejj@helixcode.com> - - * mail-ops.c (do_scan_subfolders): Use the folder's full_name so - recursive directory structures display correctly ;-) - -2000-09-19 Dan Winship <danw@helixcode.com> - - * mail-ops.c (do_scan_subfolders): Update for CamelFolder changes - (subfolder_names -> subfolder_info). - -2000-09-19 Dan Winship <danw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <clahey@helixcode.com> - - * 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 <michael@helixcode.com> - - * Makefile.am (INCLUDES): add datadir - - * folder-browser-factory.c (control_activate): use it. - -2000-09-15 Dan Winship <danw@helixcode.com> - - * 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 <danw@helixcode.com> - - This bug was so much fun to fix the first time that I decided to - fix it again. - - 2000-07-11 Dan Winship <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <terrorist@gegl.org> - - * 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 <danw@helixcode.com> - - * mail-ops.c (setup_append_mail): camel_folder_append is perfectly - happy to take a NULL info. - -2000-09-14 Michael Meeks <michael@helixcode.com> - - * 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 <clahey@helixcode.com> - - * mail-config-gui.h: Changed the include here because it caused - make distcheck to fail for me. I changed it from <Evolution.h> to - "shell/Evolution.h". This seems to have fixed things. - -2000-09-14 Jeffrey Stedfast <fejj@helixcode.com> - - * mail-ops.c (do_fetch_mail): Only use the cache if the user plans - to keep_on_server. - -2000-09-14 Michael Meeks <michael@helixcode.com> - - * 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 <clahey@helixcode.com> - - * folder-browser-factory.c: Fixed a warning (Missing include - file.) - -2000-09-12 Ettore Perazzoli <ettore@helixcode.com> - - ($(EVOLUTION_MAIL_CORBA_GENERATED)): Add space after `-I'. - -2000-09-12 Ettore Perazzoli <ettore@helixcode.com> - - * Makefile.am: Remove `ui.xml' stuff. - -2000-09-12 Dan Winship <danw@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <fejj@helixcode.com> - - * mail-ops.c (do_fetch_mail): Was trying to unhook an event from - the wrong folder - oops. - -2000-09-12 Not Zed <NotZed@HelixCode.com> - - * 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * mail-ops.c (do_fetch_mail): Don't have the filter driver - self_destruct. - -2000-09-11 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <clahey@helixcode.com> - - * mail-display.c: Fixed some warnings. - -2000-09-11 Dan Winship <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <clahey@helixcode.com> - - * 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 <fejj@helixcode.com> - - * mail-ops.c (do_fetch_mail): Updated to pass a CamelMessageInfo - to filter_driver_run - (do_filter_ondemand): Same. - -2000-09-07 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <jpavel@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <peterw@helixcode.com> - - * folder-browser.c (folder_browser_destroy): Don't free the shell; - it's not ours. - -2000-09-05 Dan Winship <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <jpr@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <lauris@helixcode.com> - - * 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 <clahey@helixcode.com> - - * folder-browser.c: Removed a warning. - -2000-09-01 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <ettore@helixcode.com> - - * mail-view.c (mail_view_create): Make the HTML widget grab the - focus. - -2000-08-30 Peter Williams <peterw@helixcode.com> - - * 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 <peterw@helixcode.com> - - * folder-browser.c (folder_browser_new): Ref the Evolution_Shell. - Is this correct, or is it a circular reference? - -2000-08-29 Dan Winship <danw@helixcode.com> - - * 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 <peterw@helixcode.com> - - * mail-config-gui.c (mail_config_apply_clicked): Add new news sources, - not only stores. - -2000-08-28 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <peterw@helixcode.com> - - * *.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 <fejj@helixcode.com> - - * mail-crypto.c (mail_crypto_openpgp_encrypt): Fix to prevent - possible buffer overflows and a logic fix. - -2000-08-27 Jeffrey Stedfast <fejj@helixcode.com> - - * mail-crypto.c (mail_crypto_openpgp_clearsign): New crypto - function to clearsign plaintext - -2000-08-27 Ariel Rios <ariel@arcavia.com> - - * 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 <ettore@helixcode.com> - - * 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 <clahey@helixcode.com> - - * mail-crypto.c: Fixed an uninitialized variable. - -2000-08-26 JP Rosevear <jpr@helixcode.com> - - * evolution-mail.gnorba: Kill - - * Makefile.am: Remove gnorba related stuff - -2000-08-25 Peter Williams <peterw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <lauris@helixcode.com> - - * folder-browser.c: Use e_utf8 wrappers - - * mail-config-gui.c: Use e_utf8 wrappers - -2000-08-24 Peter Williams <peterw@helixcode.com> - - * 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 <clahey@helixcode.com> - - * folder-browser-factory.c: Fixed some warnings in the uihandler - code. - -2000-08-24 Peter Williams <peterw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <peterw@helixcode.com> - - * mail-ops.c (describe_fetch_mail): Don't use the camel calls - to describe the operation. - -2000-08-22 Peter Williams <peterw@helixcode.com> - - * 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 <jwise@pathwaynet.com> - * folder-browser.c: (fb_resize_cb) Added function to monitor resize - of the e_paned in the main view. - -2000-08-18 Peter Williams <peterw@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 `<Component Placeholder>' 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 <peterw@helixcode.com> - - 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 <rhult@hem.passagen.se> - - * 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 <peterw@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * mail-crypto.c (mail_crypto_openpgp_encrypt): Added support for - encrypting via PGP 5.0 - -2000-08-13 Ettore Perazzoli <ettore@helixcode.com> - - * mail-ops.c (cleanup_create_folder): Release the listener object - with `CORBA_Object_release()', not `CORBA_free()'. - -2000-08-13 Ettore Perazzoli <ettore@helixcode.com> - - * main.c (main): Set the signal handlers for `SIGSEGV' and - `SIGBUS' to the default ones. - -2000-08-13 Jeffrey Stedfast <fejj@helixcode.com> - - * mail-config.c (mail_config_write): Set config->configured to - TRUE - -2000-08-13 Ettore Perazzoli <ettore@helixcode.com> - - * mail-config-gui.c (mail_config_druid): Don't - `GDK_THREADS_ENTER()'/`GDK_THREADS_LEAVE()'. - -2000-08-13 Ettore Perazzoli <ettore@helixcode.com> - - * 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 <danw@helixcode.com> - - * Makefile.am (evolution_mail_SOURCES): add mail-local.h - -2000-08-13 Ettore Perazzoli <ettore@helixcode.com> - - * mail-threads.c (read_msg): For now, don't do anything about - errors. - -2000-08-13 Dan Winship <danw@helixcode.com> - - * 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 <ettore@helixcode.com> - - * mail-ops.c (mail_do_create_folder): Duplicate the listener - object. - (cleanup_create_folder): Free the listener. - -2000-08-13 Jeffrey Stedfast <fejj@helixcode.com> - - * mail-threads.c (get_password): Don't wrap the gnome_dialog_run - in GDK_THREADS_ENTER/LEAVE - -2000-08-13 Ettore Perazzoli <ettore@helixcode.com> - - * 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 - <peterw@helixcode.com>.] - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * mail-ops.c (do_scan_subfolders): Lose a reference to the store - on purpose. To be fixed later. - -2000-08-12 Dan Winship <danw@helixcode.com> - - * 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 <michael@helixcode.com> - - * main.c (main): kill using_oaf assertion. - -2000-08-11 Peter Williams <peterw@helixcode.com> - - * Makefile.am: Make it so that test-mail links - -2000-08-11 JP Rosevear <jpr@helixcode.com> - - * 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 <clahey@helixcode.com> - - * mail-format.c, mail-tools.h, message-list.c: Fixed a warning. - -2000-08-11 Dan Winship <danw@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <toshok@helixcode.com> - - * mail-config.c (mail_config_get_default_news): use config->news - instead of config->sources. - -2000-08-11 Dan Winship <danw@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <jpr@helixcode.com> - - * mail-config-gui.c (service_page_new): Work around - gtk option menu bug. - (service_page_item_auth_fill): ditto - -2000-08-11 Peter Williams <peterw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <jpr@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <jpr@helixcode.com> - - * mail-config-gui.c (identity_dialog): iddialog, not sdialog - (news_edit_clicked): Kill leftover c-p crud - -2000-08-11 JP Rosevear <jpr@helixcode.com> - - * mail-config-gui.c (news_edit_clicked): Check nrow, not srow. - -2000-08-11 JP Rosevear <jpr@helixcode.com> - - * 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 <danw@helixcode.com> - - * mail-ops.c (describe_fetch_mail): Use camel_service_get_name - rather than showing the URL to the user. - -2000-08-11 Peter Williams <peterw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <clahey@helixcode.com> - - * folder-browser-factory.c, message-list.c, message-thread.c, - session.c: Fixed some warnings. - -2000-08-10 Dan Winship <danw@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * mail-callbacks.c (composer_send_cb): Fix compile warning by - casting the object to a CamelObject - -2000-08-10 Peter Williams <peterw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <peterw@helixcode.com> - - * mail-display.c (part_for_url): Remove a gtk_object_get_data - -2000-08-09 Cody Russell <bratsche@gnome.org> - - * folder-browser-factory.c, mail-view.c: Make the toolbars - honor the user's gnomecc settings for detachable toolbars. - -2000-08-09 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * mail-display.c (on_object_requested): Support controls as well - as embeddables. - -2000-08-09 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <NotZed@HelixCode.com> - - * mail-autofilter.c: New file to hold auto filter/vfolder stuff. - -2000-08-09 Christopher James Lahey <clahey@helixcode.com> - - * 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 <ettore@helixcode.com> - - * folder-browser-factory.c (control_activate): Create a "print - message" menu item. - -2000-08-09 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <jwise@pathwaynet.com> - * 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 <fejj@helixcode.com> - - * mail-config.h: Added void as an argument to functions not - needing any parameters to avoid compile warnings. - -2000-08-08 Jeremy Wise <jwise@pathwaynet.com> - * 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 <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * mail-view.c: Lets get rid of the last separator in the toolbar - until we add n/p - -2000-08-08 Ettore Perazzoli <ettore@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <danw@helixcode.com> - - * main.c (main): Move mail_config_init after session_init, since - it depends on evolution_dir being set. - -2000-08-08 JP Rosevear <jpr@helixcode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <jpr@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <ettore@helixcode.com> - - * message-list.c (message_list_regenerate): Free the GPtrArray - correctly instead of using `g_strfreev()'. - -2000-08-04 Michael Meeks <michael@helixcode.com> - - * folder-browser-factory.c (control_activate): release the ui_handler - after set_container. - -2000-08-03 Michael Meeks <michael@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <jpr@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <peterw@helixcode.com> - - * component-factory.c (owner_unset_cb): Wait for async operations - to finish before exiting. - -2000-08-02 Christopher James Lahey <clahey@helixcode.com> - - * mail-ops.c, message-list.c: Emit "model_pre_change" where - appropriate. - -2000-08-02 Peter Williams <peterw@helixcode.com> - - * mail-config.h: #ifdef _MAIL_CONFIG_H protect the header. - -2000-08-01 Peter Williams <peterw@helixcode.com> - - * 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 <danw@helixcode.com> - - * mail-crypto.c: New code to spawn off GPG/PGP to do stuff. - Currently only deals with decryption. From Nathan Thompson-Amato - <ndt@jps.net>, 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 <clahey@helixcode.com> - - * component-factory.c, folder-browser.c: Fixed some warnings. - - * message-list.c: Made the icon column non sortable. - -2000-07-31 Dan Winship <danw@helixcode.com> - - * mail-config.c (service_page_set_url): Fix a NULL-pointer strcmp - noticed by peterw. - -2000-07-31 Not Zed <NotZed@HelixCode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <jpr@helixcode.com> - - * 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 <bratsche@gnome.org> - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <clahey@helixcode.com> - - * message-list.c, message-list.h: Removed counting of selected - messages. - -2000-07-26 Dan Winship <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <michael@helixcode.com> - - * mail-config.c (create_identity_page): set default signature to - ~/.signature - -2000-07-25 Peter Williams <peterw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <ettore@helixcode.com> - - * component-factory.c (factory_fn): Updated for the new - `evolution_shell_component_new()' arg. - -2000-07-19 Jeffrey Stedfast <fejj@helixcode.com> - - * message-thread.c (thread_messages): What if message info is NULL? - -2000-07-17 Peter Williams <peterw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <ettore@helixcode.com> - - * mail-ops.c (set_x_mailer_header): New helper function to set the - `X-Mailer:' header to to `Evolution <version> [Developer - Preview]". - (real_send_mail): Call it. - -2000-07-14 Peter Williams <peterw@curious-george.helixcode.com> - - * 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 <ettore@helixcode.com> - - * Makefile.am (evolution_mail_LDADD): Add `GCONF_LIBS'. - -2000-07-14 Dan Winship <danw@helixcode.com> - - * mail-format.c (write_headers): put a <p> 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 <PRE>. Instead, CONVERT_NL and - CONVERT_SPACES and wrap it in <TT>. 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 <danw@helixcode.com> - - * 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 <jrb@redhat.com> - - * mail-config.c (create_transport): - s/CAMEL_SERVICE_NEED_HOST/CAMEL_SERVICE_URL_NEED_HOST. - -2000-07-13 Dan Winship <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <toshok@helixcode.com> - - * mail-config.c (providers_config_new): fix some cut & paste bung. - -2000-07-12 Chris Toshok <toshok@helixcode.com> - - * 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 <toshok@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <danw@helixcode.com> - - * Update for CamelFolder API changes - -2000-07-11 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <ettore@helixcode.com> - - * mail-ops.c (forward_msg): Initialize `fwd_subj' to NULL if - `from' is NULL. - -2000-07-10 Jeffrey Stedfast <fejj@helixcode.com> - - * mail-ops.c (real_fetch_mail): Fixed broken POP fetching - -2000-07-10 Ettore Perazzoli <ettore@helixcode.com> - - * 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 <clahey@helixcode.com> - - * message-list.c, message-list.h: Switched from ETable to - ETableScrolled. - -2000-07-10 Jeffrey Stedfast <fejj@helixcode.com> - - * mail-ops.c (real_fetch_mail): Fixed movemail so that it too would - deliver to Inbox. - -2000-07-09 Dan Winship <danw@helixcode.com> - - * 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 <clahey@helixcode.com> - - * message-list.c: Remove setting of dnd_code since that's handled - internally to ETable. - -2000-07-08 Dan Winship <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * mail-ops.c (real_fetch_mail): Always dump incoming messages to - Inbox (assuming not filtered to another location). - -2000-07-08 Ettore Perazzoli <ettore@helixcode.com> - - * folder-browser-factory.c (control_activate): Move the - "Expunge" item to the "Action" menu. - (control_deactivate): Accordingly. - -2000-07-08 Dan Winship <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <clahey@helixcode.com> - - * message-list.c (get_message_info): Handle a row number of -1 - properly. - -2000-07-06 Dan Winship <danw@helixcode.com> - - * 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 <jpr@arcavia.com> - - * 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 <danw@helixcode.com> - - * 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 <NotZed@HelixCode.com> - - * 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 <danw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <ettore@helixcode.com> - - * folder-browser.c (mail_uri_to_folder): Fix double freeing of the - local exception `ex'. - -2000-07-01 Ettore Perazzoli <ettore@helixcode.com> - - * mail-ops.c (refile_msg): Only allow type "mail" in the folder - selection dialog. - -2000-07-01 Dan Winship <danw@helixcode.com> - - * pixmaps.h, pixmaps/*.xpm: Removed. These aren't being used any - more. (The real pixmaps are in ../art.) - -2000-07-01 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <peterw@curious-george.helixcode.com> - - * component-factory.c (create_news_storage, create_imap_storage): - Fixed to use new EvolutionShellClient proxy thingamajiggie. - -2000-06-30 Dan Winship <danw@helixcode.com> - - * 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 <ettore@helixcode.com> - - * component-factory.c: Eeek. Fix typo: add missing star in the - declaration of `global_shell_client'. - -2000-06-29 Ettore Perazzoli <ettore@helixcode.com> - - * component-factory.c: Replace `global_shell_interface' with - `global_shell_client'. - -2000-06-29 Jeffrey Stedfast <fejj@helixcode.com> - - * mail-ops.c (delete_msg): Clean up compile warnings - (real_fetch_mail): Fetching from IMAP should do nothing - -2000-06-29 Christopher James Lahey <clahey@helixcode.com> - - * mail-ops.c: Handle multiple deletes (change by Peter Williams.) - -2000-06-29 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <clahey@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * message-list.c: Added prototype for filter_date to make - it build cleanly - -2000-06-27 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Made dates display grouping information - properly. - -2000-06-27 Peter Williams <peterw@curious-george.helixcode.com> - - * 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 <clahey@helixcode.com> - - * message-list.c: Work around mismatched ctime_r functions. This - will be fixed. - -2000-06-27 Peter Williams <peterw@curious-george.helixcode.com> - - * 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 <zucchi@zedzone.mmc.com.au> - - * component-factory.c (owner_set_cb): Put in a gross hack to - export the shell reference elsewhere. - -2000-06-26 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Added a value_to_string handler. - -2000-06-26 Peter Williams <peterw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * mail-config.c (error_dialog): va_start() returns void, don't - assign it's retval to a variable. - -2000-06-26 Ettore Perazzoli <ettore@helixcode.com> - - * 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 <peterw@helixcode.com> - - * Makefile.am: Clean up the various _LIBS and _CFLAGS - to work with simpler THREADS_LIBS and THREADS_CFLAGS scheme. - -2000-06-23 Jeffrey Stedfast <fejj@helixcode.com> - - * folder-browser.c (folder_browser_load_folder): Improved the - code to separate the imap namespace from the folder name. - -2000-06-23 Peter Williams <peterw@curious-george.helixcode.com> - - * 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 <fejj@helixcode.com> - - * folder-browser.c (folder_browser_load_folder): Now should - correctly get the selected folder from the given URL. - -2000-06-22 Chris Toshok <toshok@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <toshok@helixcode.com> - - * 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 <clahey@helixcode.com> - - * message-list.c: Changed ml_value_at to return "" instead of NULL - in some cases. - -2000-06-22 Peter Williams <peterw@curious-george.helixcode.com> - * 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 <peterw@curious-george.helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <clahey@helixcode.com> - - * message-list.c: Removed an erroneous comment. - -2000-06-21 Dan Winship <danw@helixcode.com> - - * 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 <peterw@helixcode.com> - - * 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 <peterw@helixcode.com> - - * mail-format.c (mail_generate_reply): Include "e-setup.h" to - get the prototype for evolution_dir. - -2000-06-20 Jeffrey Stedfast <fejj@helixcode.com> - - * component-factory.c (create_imap_storage): Oops. Should - have checked for a NULL sources. - -2000-06-20 Dan Winship <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <fejj@helixcode.com> - - * component-factory.c (create_imap_storage): Now creates the IMAP - storage (listing subfolders and such) - -2000-06-19 Dan Winship <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * message-list.c (message_list_set_folder): Prevent double-freeing - action on summary_table and uid_rowmap. - -2000-06-16 Dan Winship <danw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <rodo@helixcode.com> - - * main.c (main): call gtkhtmllib_init here - -2000-06-13 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <ettore@helixcode.com> - - * Makefile.am (SHELL_OBJS): Removed. - (evolution_mail_LDADD): Use `libeshell.a'. Also use - `top_builddir' consistently. - -2000-06-12 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <federico@helixcode.com> - - * message-list.c: Removed the ETableModel thaw handler. - -2000-06-12 Dan Winship <danw@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <danw@helixcode.com> - - * mail-ops.c (composer_send_cb): Leave the composer window around - if the message doesn't get sent. - -2000-06-05 Matt Loper <matt@helixcode.com> - - * folder-browser.c (etable_key): Allow "GDK_KP_Delete", a keypad - delete key, to delete a message. - -2000-06-05 Dan Winship <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <clahey@helixcode.com> - - * 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 <clahey@helixcode.com> - - * session.c: Revert removal of e_setup_base_dir. - -2000-06-02 Dan Winship <danw@helixcode.com> - - * 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 <clahey@helixcode.com> - - * message-list.c: Made sent column as wide as from column. - -2000-06-02 Jeffrey Stedfast <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <clahey@helixcode.com> - - * session.c: Don't call e_setup_base_dir. - -2000-06-01 Dan Winship <danw@helixcode.com> - - * 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 <blockquote> rather - than <center><table border=1 width=95%> to frame the embedded - message. If <pre> text in the subtable won't fit in the 95% width, - GtkHTML will write past the border of the table (and - <blockquote><table border=1> causes creeping updates so it's not - usable for now). - -2000-06-01 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c (message_list_init): Turn off the grid in our - ETable. - -2000-06-01 Dan Winship <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <ettore@helixcode.com> - - * 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 <fejj@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <danw@helixcode.com> - - * 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 <iframe>s for these, - to protect the rest of the document from their possibily invalid - HTML. - (handle_via_bonobo): Use (new-and-improved) <object> tags for - this, moving most of the work back into mail-display.c - - * mail-display.c (on_object_requested): Move the Bonobo embedding - code back here again (reorganized a bit). - (on_url_requested): add x-evolution-data handler, for iframe - bodies. - (mail_html_new, mail_html_end): removed - (mail_display_set_message, mail_display_new): Update for NWO. - -2000-05-30 Not Zed <NotZed@HelixCode.com> - - * folder-browser.c (search_set): Properly encode the search string. - -2000-05-30 Jeffrey Stedfast <fejj@helixcode.com> - - * mail.h: Added a prototype for providers_config_new() which - is the constructor for the configuration dialog window - - * mail-config.c: Added set_service_url() which is basically - the reverse of get_service_url(). - Implemented on_cmdCamelServicesOK_clicked() - The configuration - window will now remember the Sendmail/SMTP data that the user - had entered in the previous session. - Removed on_cmdCamelServicesApply_clicked() - No need for this. - -2000-05-30 Dan Winship <danw@helixcode.com> - - * message-list.c (message_changed): call - e_table_model_row_changed, not e_table_model_changed so we do less - work, and don't lose the current selection. - (select_msg): Set up a timer to mark the displayed message as - "seen" if it's selected for longer than 1.5 seconds (a number - pulled out of Matt's butt). - (ml_value_at): Use the MESSAGE_STATUS column for read/unread as - well as deleted. - - * message-list.c: use the "new" tigert pixmaps rather than the - older ones. Includes a "replied to" icon (which is used now), but - no "deleted" icon (although we have the strikeout renderer for - that now). - -2000-05-30 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c, message-list.h: Added bold for unread messages. - -2000-05-30 Jeffrey Stedfast <fejj@helixcode.com> - - * mail.h: Added a prototype for providers_config() - which is the callback for a new menu item that - will construct a configuration dialog for the camel - providers and identities and display it - - * mail-config.c: Added some code to construct the - new providers dialog and a bunch of callbacks (most - of which are not yet useful) - - * mail-ops.c: Added the code for the providers_confi() - callback - - * folder-browser-factory.c: Added the - "Tools/Camel Providers Configuration ..." menu item - -2000-05-30 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Switched to using "cursor_change" signal instead - of "row_selection" for switching messages. Select the first row - (still doesn't work because of ETable.) Adapt to some small - ETable changes. Set drawfocus to FALSE. - -2000-05-29 Not Zed <NotZed@HelixCode.com> - - * folder-browser.c (folder_browser_load_folder): Hardcode the - vfolder source to just the inbox (so at least it returns - something). - - * component-factory.c (create_test_storage): Create a vfolder dir - first, and put the folders in that. - (create_test_storage): Create the storage as VFolders, not - "storage_name" :) - -2000-05-28 Dan Winship <danw@helixcode.com> - - * mail-config.c (error_dialog): helper function since we need to - set "modal" on the dialogs returned by gnome_error_dialog to make - them work when popped up from the modal Druid. - (service_acceptable): New function to check if the info entered on - a store/transport page actually checks out. - (mail_config_druid): Connect to the "next" signal on the store and - transport pages and don't let the user continue if the data is - bad and "check this before continuing" is checked. Also, only - display sources/transports in the "mail" domain. (Ie, not - "vfolder".) - - * mail-format.c (write_recipients_to_stream): Use `foo@bar' rather - than `<foo@bar>' for recipient with no name. - - * mail-ops.c (fetch_mail): don't put up an error message if the - user cancels the password dialog. - -2000-05-27 Not Zed <NotZed@HelixCode.com> - - * Makefile.am (SHELL_OBJS): Include mail storage so we can - initialise folders. - - * component-factory.c (create_test_storage): Parses vfolder - defintions and adds them to the storage. Definetly needs more - work. - - * folder-browser-factory.c (control_activate): Add the VFolder - druid menu item. - (control_deactivate): And remove it. - - * mail-ops.c (vfolder_editor_clicked): For editing vfolder - definitions (rather like filters, oddly enough :). Tries to - update the shell but it doesn't seem to work properly - requires a - mail component restart to take effect. - - * folder-browser.c (folder_browser_load_folder): Handle vfolder: - urls' appropriately and map to camel. Still needs a way to tell - the vfolder what folders to search! (all vfolders come up empty!). - -2000-05-28 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c, message-list.h: Added a COL_DELETED and made it - the strikeout column for both text renderers. - -2000-05-27 Dan Winship <danw@helixcode.com> - - * mail-format.c: Various improvements: - - (call_handler_function, etc): Add a "mime_type" argument to the - handlers, so that if a part is tagged as - "application/octet-stream", and we figure out that it's really - something else, the handler we call can know what that something - else is. - - (handle_text_enriched): Small fixes to make this not do - text/enriched-specific syntax in text/richtext or vice versa. - - (handle_mystery): Allow for mystery data that can't even be saved - to disk. (ie, unrecognized external-body). Let the caller specify - the URL to use. - - (handle_message_external_body): New function to deal with - message/external-body parts. Generates URLs for anon-ftp, - local-file, and URL access-types, and a more-useful-than-before - descriptive message for other types. - - (handle_audio, handle_undisplayable): Use gnome_mime_get_value to - try to get a description of the MIME type to display to the user - rather than the raw form. (This will only work if the user has - recent gnome-vfs installed. [If they don't, it works just like - it used to.]) - -2000-05-26 Dan Winship <danw@helixcode.com> - - * mail-format.c (handle_text_html): Fix a bug (security/stability) - in its usage of mail_html_write. - - * mail-ops.c (composer_send_cb, reply): set CAMEL_MESSAGE_ANSWERED - on a message after a successful reply. - - * message-list.c (folder_changed): free the summary with - camel_folder_free_summary rather than g_ptr_array_free. - - * mail-format.c (handle_via_bonobo): Update for PersistStream - changes - -2000-05-25 Ettore Perazzoli <ettore@helixcode.com> - - * main.c (main): Initialize the component factory. - - * Makefile.am (evolution_mail_LDADD): Link with - `evolution-shell-component.o' from the shell directory. - - * evolution-mail.oafinfo: Updated with the - Evolution::ShellComponent OAFIID. - - * evolution-mail.gnorba: Updated with the - Evolution::ShellComponent GOAD ID. - - * folder-browser-factory.c (folder_browser_factory_new_control): - New function; code moved out from `folder_browser_factory'. - (folder_browser_factory): Use it. - - * component-factory.c: New. - * component-factory.h: New. - -2000-05-24 Dan Winship <danw@helixcode.com> - - * mail-ops.c (composer_send_cb): connect to and disconnect from - the transport. - -2000-05-24 Christopher James Lahey <clahey@helixcode.com> - - * Makefile.am: Added libepaned.a. - - * folder-browser.c: Switched from GtkPaned to EPaned. - -2000-05-23 Ettore Perazzoli <ettore@helixcode.com> - - * Makefile.am: Don't link to `evolution-service-repository.o' - anymore. - - * folder-browser-factory.c: Don't use crufty service-repository - anymore. - -2000-05-21 Ettore Perazzoli <ettore@helixcode.com> - - * message-list.c (get_message_info): Made static. - (ml_initialize_value): Return NULL to placate compiler. - - * folder-browser.c (folder_browser_gui_init): Add cast. - - * mail-display.c (mail_html_new): Don't pass an empty URL to - `gtk_html_begin()' anymore. - - * mail-config.c (put_html): Don't pass an empty URL to - `gtk_html_begin()' anymore. - - * mail-display.h: Updated for the new GtkHTML API that uses - `GtkHTMLStream *' instead of `GtkHTMLStreamHandle'. - * mail-display.c: Likewise. - * mail-config.c: Likewise. - * mail-format.c: Likewise. - -2000-05-19 NotZed <NotZed@HelixCode.com> - - * mail-format.c: Fixes for stream stuff. - - * mail-display.c (save_data_cb): Remove exception stuff on streams. - -2000-05-19 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Added initialize_value and value_is_empty - callbacks. - -2000-05-18 Dan Winship <danw@helixcode.com> - - * folder-browser-factory.c (folder_browser_factory): Remove - development_warning (moved to shell) - - * message-list.c (select_msg): Update for camel_folder_get_uids - (folder_changed, message_list_set_folder): Update for - camel_folder_get_summary - - * mail-ops.c (fetch_mail): Update for camel_folder_get_uids - -2000-05-17 Dan Winship <danw@helixcode.com> - - * mail-component.c: This seems to be cruft. Nuke it. - - * mail-display.c (save_data_cb, save_data, on_url_requested): - * mail-format.c (handle_text_plain_flowed, handle_text_html): - Use camel_data_wrapper_write_to_stream rather than - camel_data_wrapper_get_output_stream. - -2000-05-16 NotZed <NotZed@HelixCode.com> - - * mail-ops.c (filter_edit): Function to bring up the filter editor. - (filter_druid_clicked): Save/close dialogue. - (fetch_mail): Apply filters to incoming mail ... *hold breath* - If we are coming from a non-indexed/searchable/etc source, then - copy it to an mbox first. When copying mail from an mbox source, - dont remove it aftewards, open it for append, so partially - filtered mail isn't lost. - - * Makefile.am (evolution_mail_LDADD): Added libfilter. - (INCLUDES): Add EVOLUTION_DATADIR, and fix matt's brokeneditor(tm) - for putting spaces instead of tabs in. - -2000-05-16 Christopher James Lahey <clahey@helixcode.com> - - * mail-format.c: Removed usage of bonobo_object_destroy. - -2000-05-14 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Updated to work with new ETable resizing. - -2000-05-12 NotZed <NotZed@HelixCode.com> - - * mail-ops.c (fetch_mail): Use 6 X's to mkstemp, as required by - the man page, just a temp fix, this should probably change to a - known filename. - -2000-05-11 Dan Winship <danw@helixcode.com> - - * folder-browser-factory.c (control_activate): Now that we depend - on current gnome-libs we can make the toolbar detachable again. - -2000-05-11 Federico Mena Quintero <federico@helixcode.com> - - * folder-browser-factory.c (development_warning): Left-justify the - message. - -2000-05-10 Christopher James Lahey <clahey@helixcode.com> - - * folder-browser-factory.c (development_warning): Made this dialog - have fewer buttons. - -2000-05-10 Christopher James Lahey <clahey@helixcode.com> - - * folder-browser-factory.c (development_warning): New development - warning text from Nat. - -2000-05-10 Larry Ewing <lewing@helixcode.com> - - * mail-config.c (html_new): only set the default background color - if style is not NULL. - -2000-05-09 Christopher James Lahey <clahey@helixcode.com> - - * Makefile.am: Removed folder-browser-factory.h since it doesn't - exist. Added mail-display.h, mail-types.h, pixmaps.h. - -2000-05-09 Matt Loper <matt@helixcode.com> - - * folder-browser-factory.c (control_activate): Remove "File->mail" - menuitem. - - * mail-config.c (mail_config_druid): Fill in "blah blah blah". - -2000-05-09 Dan Winship <danw@helixcode.com> - - * folder-browser.c (folder_browser_load_folder): make this a - little less kludgy. Use gnome_error_dialog rather than printf on - errors. - - * mail-ops.c (fetch_mail): Fix to work with the new shell stuff... - sorta. Will need more fixing later when the new shell framework is - more done. - - * mail-config.c (finish): Call gnome_config_sync so the data - actually gets written. - -2000-05-08 Dan Winship <danw@helixcode.com> - - * mail-display.c (save_data_cb): - (on_url_requested): Update for CamelStream CamelException changes. - - * mail-format.c: Pass NULL for a CamelException in a bunch of - places... the user will see that the data is not being displayed, - and there's not a lot we can do, and none of these things should - be failing anyway. Maybe fix this later. - -2000-05-07 NotZed <NotZed@HelixCode.com> - - * message-list.c (ml_value_at): Size moved to message info, rather - than content info structure. - -2000-05-07 Dan Winship <danw@helixcode.com> - - * message-list.c (select_msg): unref the message after displaying - it. - - * mail-format.c (get_data_wrapper_text): - (handle_text_plain_flowed): - (handle_via_bonobo): Replace camel_stream_close calls. - -2000-05-07 Matt Loper <matt@helixcode.com> - - * folder-browser-factory.c: Changed a toolbar button from saying - "New mail" (which suggests you might be composing new mail) to - "Get mail". - -2000-05-06 Dan Winship <danw@helixcode.com> - - * folder-browser-factory.c (folder_browser_factory): Don't - hardcode "inbox" here. - - * folder-browser.c (folder_browser_set_uri): Don't hardcode - "inbox" here either. - (folder_browser_load_folder): Create a new store according to the - folder browser's URI, and load the mbox file from that store. - Parts of this are temporary. - - * session.c, mail.h: There is no longer a global store, just a - global session. - - * mail-config.c, mail-ops.c: Update for default_session -> session - change. fetch_mail is currently broken. - -2000-05-06 Dan Winship <danw@helixcode.com> - - * mail-config.c: New code to configure identity, mail source, and - mail transport. - (mail_config_druid): A druid using the config widgets. (Only - allows configuration of a single identity, source, and transport.) - - * mail-ops.c (check_configured): New function to make sure the - user has configured stuff, and call the druid if not. - (fetch_mail, send_msg, send_to_url, reply, forward_msg): Call - check_configured - (composer_send_cb): Make this pass the message to a CamelTransport - rather than just printing it to stdout. - - * folder-browser-factory.c (development_warning): Add a warning - about sending mail, since you can do that now. - -2000-05-06 Chris Toshok <toshok@HelixCode.com> - - * .cvsignore: ignore evolution-mail.pure - - * Makefile.am: add support for building evolution-mail.pure - -2000-05-06 Dan Winship <danw@helixcode.com> - - * mail.h: consolidate mail-format.h, mail-identify.h, mail-ops.h, - main.h and session.h into this new file. There's no reason to have - a .h for every .c. - -2000-05-05 Anders Carlsson <andersca@gnu.org> - - * test-mail.c (create_container): Use the OAFIID when using an - OAF-enabled build of bonobo. - -2000-05-04 NotZed <NotZed@HelixCode.com> - - * message-list.c (message_list_set_folder): Get the whole message - summary right away. - (folder_changed): And if we change too. - (ml_row_count): Use the match count or summary table length as the - row count. - (get_message_info): Use array references to lookup message summary - info. For the search result list, use the summary_search_cache to - cache the info lookup. - (message_list_init): Allocate the summary search cache. - (message_list_destroy): Free the summary search cache and the - summary table, if there is one to free. - (message_list_set_search): Save the match count, and clear the - summary search cache for reuse. - (folder_changed): Re-retrieve the summary list if the folder has - changed. - (message_list_set_folder): Retrieve the summary list when opening - the folder. - -2000-05-03 Jason Leach <leach@wam.umd.edu> - - * Makefile.am (evolution_mail_LDADD): s/-lunicode/$(UNICODE_LIBS)/ - in the LDADD section. - -2000-05-03 Dan Winship <danw@helixcode.com> - - * mail-format.c (write_recipients_to_stream, write_headers): Make - the "Cc:" field optional again. (Before, we could check if - camel_mime_message_get_recipients returned NULL, but now we need - to actually look into the returned CamelInternetAddress object.) - -2000-05-03 Larry Ewing <lewing@helixcode.com> - - * folder-browser.c (folder_browser_gui_init): comment out the - changed signal for now. - -2000-05-02 Matt Loper <matt@helixcode.com> - - * Makefile.am: set G_LOG_DOMAIN. - -2000-05-02 Larry Ewing <lewing@helixcode.com> - - * message-list.c (message_list_set_search): only free search if it - is not NULL. - -2000-05-02 NotZed <NotZed@HelixCode.com> - - * folder-browser.c (folder_browser_gui_init): Connect the changed - signal to search, so it searched immediately? - -2000-05-01 NotZed <NotZed@HelixCode.com> - - * pixmaps.h: Added envelope-deleted state. - - * folder-browser-factory.c: Setup callback for actual delete op. - (control_activate): Setup a tool menu item to expnge deleted - messages. - - * mail-ops.c (delete_msg): Toggle the delete flag on a message. - (expunge_folder): New function to expunge deleted messages from - the current folder. - - * folder-browser.c (folder_browser_gui_init): A hackish little - quick-search entry. - (search_activate): Perform a quick-search on the folder subject - only. - (folder_browser_gui_init): Add an option meny to the search line. - (create_option_menu): Build the option menu from a table. - (search_set): Build a search from another string whent he option - menu or text item is changed. 5 search options are defined so - far. - - * message-list.c (get_message_info): If there is an active search, - then get the data from that ... use this instead of - _get_message_info(). - (ml_row_count): If we have an active search, get the info from its - result. - (select_msg): Changed to use get_message_info, so searches work. - (ml_value_at): And same here. - (message_list_init_renderers): Added a 3rd state to message_status - = deleted. - (ml_value_at): Show the message state as deleted, if it is marked - for deletion. - (folder_changed): When the folder changes, update the display. - (message_list_set_folder): Connect to the folder_changed event - here. - (message_changed): Callback to update the display when the message - changes. - (select_msg): And connect to the message_changed signal so we know - when it cahgnes. - (message_list_set_search): Save the search string. - (folder_changed): If the folder changes, re-run the search, - otherwise we may end up with invalid entries in the display. - - * mail-display.c: Include missing errno.h. - -2000-04-30 Dan Winship <danw@helixcode.com> - - * session.c (session_providers_init): This is no longer necessary. - - * mail-ops.c (fetch_mail): Remove kludge to load remote provider, - as camel can do it by itself now. - -2000-04-29 Dan Winship <danw@helixcode.com> - - * mail-display.c (on_link_clicked): Handle clicks on "cid" URLs by - popping up a "Save Attachment" dialog. - - * mail-format.c (get_cid): if the part has a Content-Disposition - with a filename specified, record (a sanitized version of) that on - the wrapper when creating the cid reference, so the "save - attachment" code can use it later. - (handle_mystery): fix a bug in the cid generation here. - -2000-04-29 Dan Winship <danw@helixcode.com> - - * mail-format.c (lookup_handler, etc): Improve the builtin vs - bonobo selection code. - (handle_mystery): Include name and Content-Description in the - "mystery data" info, when available - (handle_unknown_type): Call mail_identify_mime_part before - giving up. - (handle_undisplayable): Split out of handle_unknown_type now - that handle_unknown_type can try alternate viewers. - (handle_via_bonobo): Fall back to handle_undisplayable if the - bonobo control fails. - - * mail-identify.c (mail_identify_mime_part): New function to - attempt to identify a MIME part that we can't identify based on - Content-Type alone. - - * mail-display.c (on_url_requested): redo the mystery data icon - display stuff less kludgily. - -2000-04-28 Dan Winship <danw@helixcode.com> - - * mail-format.c (write_recipients_to_stream, write_headers, - mail_generate_reply): Update (minimally) for Camel recipient - changes. - -2000-04-28 Ettore Perazzoli <ettore@helixcode.com> - - * main.c (init_bonobo): Don't call `init_corba()' and don't get - any args. - (init_corba) [!USING_OAF]: Fix args. - -2000-04-27 Ettore Perazzoli <ettore@helixcode.com> - - * folder-browser-factory.c: New macro `CONTROL_FACTORY_ID', which - is #defined to a different value according to whether we are - `USING_OAF' or not. - (folder_browser_factory_init): Use `CONTROL_FACTORY_ID'. - - * test-mail.c - (init_corba): New helper function, implemented differently - according to `USING_OAF'. - (main): Use `init_corba()'. - - * main.c - (init_corba): New helper function, implemented differently - according to `USING_OAF'. - (init_bonobo): Use `init_corba()'. - - * Makefile.am: Install OAF stuff if `USING_OAF'. Add - `-I$(datadir)/idl' to the `orbit-idl' command-line so that we can - use Bonobo IDL files installed under our prefix as well. Also, - use `$(ORBIT_IDL)' instead of hardcoded `orbit-idl'. - - * evolution-mail.oafinfo: New file. - -2000-04-27 Dan Winship <danw@helixcode.com> - - * mail-format.c: Move text_to_html to e-util. - - * mail-ops.c (send_to_url): New routine. Thin wrapper for - e_msg_composer_new_from_url. - - * mail-display.c (on_link_clicked): print a warning for news or - nntp URLs (which we'll deal with some day), and call send_to_url - for mailto URLs. - - * mail-format.c (text_to_html): Improve URL conversion code. - Recognize https, recognize "www\..*" without a prefixed "http://". - Properly escape &, <, >, etc in URL strings. Don't be fooled by - "mailto:", "http://", etc with no following data. - -2000-04-26 Dan Winship <danw@helixcode.com> - - * mail-format.c (text_to_html): Reorganize a bit and add a new - flag, TEXT_TO_HTML_CONVERT_URLS to recognize and wrap URLs - in text. - - * mail-display.c (mail_html_new): Add link_clicked signal handler. - (on_link_clicked): Use gnome_url_show to launch a browser. - - * mail-format.c: update for CamelStream changes. Update for - CamelMimeBodyPart -> CamelMimePart - -2000-04-25 Dan Winship <danw@helixcode.com> - - * mail-display.c, mail-format.c: Redo large chunks of this. The - mail display now consists of a vbox in a scrolled window, in which - we put multiple GtkHTML objects. This means broken HTML in one - part can't corrupt other parts. The headers now scroll with the - body. Unrecognized attachments look prettier, but still don't do - anything, and will probably be changed later. We can also now - display nested message/rfc822 parts and multipart/alternatives - with multipart subparts. Oh, and text/{richtext,enriched}, since - we had all these ancient sample messages that use it and the lack - of support annoyed me. :) - - Bonobo embeddables are broken right now, but I don't think that's - my fault. - - * mail-format.c (reply_body): Fix some bugs that crept into reply - generation. This needs a lot more work to deal correctly with - complicated bodies. - (setup_function_table): pass unknown text subtypes to - handle_text_plain. - (handle_multipart_appledouble): new handler. Just ignores the - first (application/applefile) part and tries to display the - second part. Since the second part is usually - application/octet-stream, this doesn't work very well still - usually. - (reply_body): Make this deal better with multiparts. - - * mail-format.c, mail-display.c: Now that we're not limited to - a single GtkHTML for the display, there's no reason to embed - Bonobo objects for unrecognized content-types in GtkHTML rather - than embedded them into the vbox directly. So do that. - - Meanwhile, fix up the handler-selection code so that we can - declare which built-in handlers are more desirable than external - handlers and which are less. (Of course, eventually we'll want - this to be customizable.) Add some cleverness to - handle_multipart_alternative as well so it doesn't accept an - alternative which we can display generically over one we can - display specifically. - - * mail-format.c (text_to_html): add a convert_space_hack flag, - which turns N spaces into N-1 s and a space. - (handle_text_plain): Check for "format=flowed" in the - Content-Type. - (handle_text_plain_flowed): Spinoff of handle_text_plain to deal - with RFC 2646 flowed text. (All the examples I can find of it - are generated by Eudora, but it's a pretty cool idea that ought - to be used more widely.) - -2000-04-23 Dan Winship <danw@helixcode.com> - - * folder-browser-factory.c: rename "send" to "send_msg", to avoid - name clash with the tcp function. Connect the "forward" button. - - * mail-ops.c: rename "send" to "send_msg", to avoid name clash - with the tcp function. Add forward_msg function. - - * mail-format.c (mail_generate_forward): support function for - forward_msg. Pretty much a big kludge right now, pending the - attachment/attachment-bar changes. - -2000-04-22 Dan Winship <danw@helixcode.com> - - * mail-display.c (on_url_requested): Change cid expectations to - match current camel reality. - - * main.c (main): call glade_gnome_init, for composer. - - * folder-browser-factory.c: move msg_composer_cb and - msg_composer_send_cb to mail-ops. Attach send, reply, and "reply - to all" buttons. - - * mail-ops.c (composer_send_cb, send): moved from - folder-browser-factory.c. - (reply_to_sender, reply_to_all): new functions to do replies. - - * mail-format.c (text_to_html): Add an "add_pre" flag, to make - it wrap the output in <pre></pre>. - (mail_generate_reply): New function to create a composer and build - a reply in it. - -2000-04-21 Dan Winship <danw@helixcode.com> - - * mail-display.c (on_url_requested): deal with cid: URLs. - (find_cid): helper routine for above. (This could be much better.) - (mail_display_init): connect url_requested signal - - * mail-format.c (handle_multipart_related): Make this work. - - * mail-display.c (mail_display_set_message): ref the message we - display, since we're going to unref it when we remove it. Fixes a - bug that showed up with the new camel code, but it's not obvious - if it's due to a bug or a feature in the new code. - -2000-04-20 NotZed <NotZed@HelixCode.com> - - * Makefile.am (evolution_mail_LDADD): Add libibex.la to link. - - * message-list.h: Removed folder summary. - - * message-list.c: Dont include folder-summary anymore. - (select_msg): Changed to use folder, not summary in - summary_get_message_info(). God this code is grotty. - (ml_value_at): Ditto. - (ml_value_at): Changed to use new interface. Hmm, this returns a - static variable, that seems wrong. - (message_list_set_folder): Remove folder summary. - (ml_row_count): Oops, remove some debug i put there. - -2000-04-20 Dan Winship <danw@helixcode.com> - - * mail-display.c: update for bonobo change, and remove a - now-unused variable. - -2000-04-17 Chris Toshok <toshok@helixcode.com> - - * message-list.c (on_row_selection_idle): new function, actually - calls select_msg. - (on_row_selection_cmd): register an idle instead of calling - select_msg directly. this fixes the lag before the row is - selected - selection is instantaneous now, with message loading - happening afterward. - - * message-list.h: add row_to_select and an idle_id to the message - list to make the select_msg call happen in an idle func. - - * message-list.c (message_list_init_renderers): no more - e_cell_set_editable. this info always comes from the model. - -2000-04-14 Dan Winship <danw@helixcode.com> - - * mail-format.[ch]: Moved from camel/camel-formatter, and changed - slightly. (More to come.) - - * html-stream.[ch]: No longer necessary. mail-format uses - GtkHTMLStreamHandles directly. - - * mail-display.[ch]: update for new message formatting code. - -2000-04-14 Chris Toshok <toshok@helixcode.com> - - * folder-browser-factory.c (control_activate): use - gnome_app_fill_toolbar_with_data, so we get the beautiful gnome - toolbar. - -2000-04-14 Dan Winship <danw@helixcode.com> - - * folder-browser-factory.c (development_warning): Fix up the - warning message a bit. - (folder_browser_factory): Make the warning bypassable. - -2000-04-12 Miguel de Icaza <miguel@gnu.org> - - * main.c (main): Call e_cursors_init. - -2000-04-10 Dan Winship <danw@helixcode.com> - - * mail-ops.c (fetch_mail): use camel_movemail when fetching mail - from an mbox store. This leaves behind temp files for now, - because CamelMboxFolder::delete is too confused to use, and NotZed - is rewriting CamelMboxFolder, so I'm not going to bother to try to - fix it. - - * mail-ops.c: Add some #includes for the non-HAVE_MKSTEMP case - -2000-04-09 Matt Loper <matt@helixcode.com> - - * folder-browser.c (folder_browser_new): set folder_browser->uri - to NULL, so that we know when to free it. - -2000-04-07 Miguel de Icaza <miguel@gnu.org> - - * message-list.c (states_pixmaps): Add more beautiful art from - Miggue, the Diego Rivera of the next millenium. - (message_list_init_header): Use the beautiful art. - - * pixmaps: Miguel rediscovers the "transparent" concept. - -2000-04-07 Matt Loper <matt@helixcode.com> - - * folder-browser.c (folder_browser_destroy): Unref the shell - interface that we have a handle to. - - * folder-browser-factory.c (control_destroy_cb): New function; - destroys a folder-browser when its control is destroyed. - (folder_browser_factory): Hook up to the above. - -2000-04-07 Dan Winship <danw@helixcode.com> - - * mail-ops.c: new file, for toolbar/menu callbacks - (fetch_mail): fetch mail. Doesn't do mbox locking. Many kludges. - - * folder-browser-factory.c (control_activate): use new fetch_mail - function as the callback for the "New mail" icon. Rename check_cb - to random_cb. - - * Makefile.am: don't build test-sources since the version in - CVS doesn't do much and once I've fixed it it won't be a separate - program. Add mail-ops.[ch]. - -2000-04-06 Miguel de Icaza <miguel@gnu.org> - - * message-list.c: Stick pixmaps here. - - * mail-display.c (embeddable_destroy_cb): Replaced C++ comments - with C comments. - - * message-list.c (load_internal_images): New function, loads images. - (message_list_init_renderers): Load images, fix previous attempt - at loading images. - - * Makefile.am (dist-hook): Added distribution of pixmaps. - - * pixmaps: New directory, used to hold the XPMs we ship with. - - * pixmaps/envelope-closed.xpm, pixmaps/envelope-open.xpm: Tigert's - envelopes incorporated. - -2000-03-31 Miguel de Icaza <miguel@gnu.org> - - * message-list.c (ml_value_at): Fix miss-used variable. - -2000-04-01 Michael Meeks <michael@helixcode.com> - - * folder-browser.c (folder_browser_properties_init): update to - new property (folder_browser_property_changed): kill. - (get_prop, set_prop): do the donkey work + make properly RW. - -2000-03-31 Dan Winship <danw@helixcode.com> - - * folder-browser-factory.c (folder_browser_set_shell): - * folder-browser.c (folder_browser_new): - * message-list.c (on_row_selection_cmd, select_msg, - message_list_init, message_list_set_folder): - - remove debugging printf()s that no longer seem useful - -2000-03-29 Dan Winship <danw@helixcode.com> - - * folder-browser-factory.c (control_activate): build a toolbar. - (control_deactivate): and hide it. - -2000-03-27 Chris Toshok <toshok@helixcode.com> - * mail-display.c: quiet warnings when building in ../po - -2000-03-26 Miguel de Icaza <miguel@gnu.org> - - * folder-browser-factory.c (folder_browser_set_shell): Memory leak - fix. - -2000-03-25 Dan Winship <danw@helixcode.com> - - * message-list.c (select_msg, ml_value_at): update for summary - changes. Hey, neat, it really does make it more efficient. - -2000-03-22 Christopher James Lahey <clahey@helixcode.com> - - * .cvsignore: Updated .cvsignore. - -2000-03-21 Matt Loper <matt@helixcode.com> - - * mail-display.c: Minor cleanup & commenting. - - * folder-browser-factory.c: Minor cleanup & warning elimination. - -2000-03-21 bertrand <bertrand@helixcode.com> - - * message-list.c (ml_value_at): display message size - -2000-03-20 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Properly ref & sink the table and header models. - -2000-03-14 Dan Winship <danw@helixcode.com> - - * mail-sources.c: First cut at a mail source selection wizard. - Basically a rigged demo at this point. Doesn't use camel to get - its information, and is not yet complete or integrated with the - mail component. Did I mention that the code is ugly? - -2000-03-13 bertrand <bertrand@helixcode.com> - - * folder-browser-factory.c (folder_browser_set_shell): - for testing and demonstration purpose, immediately - register a fake service. - -2000-03-12 bertrand <bertrand@helixcode.com> - - * folder-browser-factory.c (folder_browser_factory_init): - name change. - (control_activate_cb): when the control is activated, - it merges its own UI with the remote UIHandler. - (control_add_menu): sample menu merging. - (folder_browser_factory): connect the control "activate" signal. - - * evolution-mail.gnorba: - name changes - - * folder-browser.h: added a reference to an - Evolution::Shell object. - - * folder-browser-factory.c (folder_browser_set_shell): - (folder_browser_control_add_service_repository_interface): - (folder_browser_factory): the folder-browser control now - implements the Evolution/ServiceRepository interface. - -2000-03-07 bertrand <bertrand@helixcode.com> - - * folder-browser-factory.c (development_warning): - added a warning so that the user knows that this - version may crash his mails. - -2000-03-05 bertrand <bertrand@helixcode.com> - - * message-list.h: include a referrence to the parent - folder browser. - - * message-list.c (ml_value_at): use the message summary - from the - - * html-stream.c (html_stream_close): when the stream - is closed, set the html stream to NULL - (html_stream_write): don't write anything if the - html handle does not exist. - (html_stream_reset): implemented. close the current - html handle and begins a new html parser. - - * session.c (session_store_new): use static exception - here. - -2000-03-05 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Added a prototype message listing. - -2000-03-04 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Set up the column headers properly. - - * folder-browser.c: Show the folder_browser widget. - -2000-03-04 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Define ml_duplicate_value and ml_free_value - correctly. - -2000-03-04 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Use g_int_compare and g_str_compare as we should - be instead of g_int_equal and g_str_equal. - -2000-03-04 bertrand <bertrand@helixcode.com> - - * test-mail.c (main): replace the bonobo-active/gtk-main - by bonobo-main. - Include Gnorba headers. - (main): don't call the container creation routine - before we entered the main loop. Use idle for that. - -2000-03-04 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Change this to use the ETable widget itself - instead of building it from all the parts. - -2000-03-03 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Ref the table columns since we unref them at the - end. - -2000-03-01 Ettore Perazzoli <ettore@helixcode.com> - - * Makefile.am (INCLUDES): Add `$(top_srcdir)'. Also, the - `top_srcdir' includes must come first everything else to avoid - including installed headers instead of our fresh ones. - -2000-02-28 NotZed <NotZed@HelixCode.com> - - * Makefile.am (evolution_mail_LDADD): Fixed references to eutil. - -2000-02-24 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Changed to match new e_table_simple interface. - -2000-02-24 Dan Winship <danw@helixcode.com> - - * message-list.c (message_list_set_folder): update for CamelFolder - changes - -2000-02-24 Christopher James Lahey <clahey@helixcode.com> - - * message-list.c: Changed this to not use the "x" and "y" - arguments to e-table-item. - -2000-02-23 Matt Loper <matt@helixcode.com> - - * message-list.c (message_list_set_folder): Check 'desc'riptions - of exceptions. - -2000-02-22 bertrand <Bertrand.Guiheneuf@aful.org> - - * message-list.c (message_list_set_folder): - fix to show a sample correct implementation. - -2000-02-21 Matt Loper <matt@helixcode.com> - - * Makefile.am: added -lunicode to evolution_mail_LDADD. - -2000-02-21 Dan Winship <danw@helixcode.com> - - * session.c (session_store_new): Pass a CamelAuthCallback - (evolution_auth_callback) to camel_session_new. - -2000-02-21 Dan Winship <danw@helixcode.com> - - * session.c (session_store_new): Update session_store_new to - deal with the fact that camel_session_get_store takes a - CamelException now. Doesn't actually do anything with the - exception yet, because nothing else does yet either. - -2000-02-19 Matt Loper <matt@helixcode.com> - - * .cvsignore: added test-mail. - -2000-02-14 Miguel de Icaza <miguel@gnu.org> - - * folder-browser.c (folder_browser_load_folder): New routine, - loads a camel folder. - (folder_browser_set_uri): redo. - - * session.c: new file. Implements SessionStores to keep track of - a Session/Store tuple. - -2000-02-13 Matt Loper <matt@helixcode.com> - - * html-stream.c (html_stream_new): Second param of gtk_html_begin - should be "", not NULL. - (html_stream_new): gtk_html_parse() is deprecated, so the call was - removed. - - * html-stream.h: HTMLStreamClass's parent changed to - CamelStreamClass, not CamelStream. - -2000-02-11 Christopher James Lahey <clahey@helixcode.com> - - * Makefile.am: Add the e-text directory to the includes list. - - * message-list.c: Change the call to e_cell_text_new, since - there's an added argument. - -2000-02-09 Christopher James Lahey <clahey@helixcode.com> - - * Makefile.am: Added libetext as libetable depends on it. - -2000-02-08 Iain Holmes <ih@csd.abdn.ac.uk> - - * Makefile.am: Changed the order of the compilation so the CORBA stuff - was made before it was needed. - -2000-01-19 Miguel de Icaza <miguel@gnu.org> - - * Started work on the mail display engine. - - * html-stream.c, html-stream.h: New files, they are CamelStreams - used to write to the GtkHTML widget. - diff --git a/mail/GNOME_Evolution_Mail.oaf.in b/mail/GNOME_Evolution_Mail.oaf.in deleted file mode 100644 index b693e8863d..0000000000 --- a/mail/GNOME_Evolution_Mail.oaf.in +++ /dev/null @@ -1,141 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:GNOME_Evolution_Mail_ControlFactory" - type="exe" - location="evolution-mail"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/ObjectFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Evolution mail folder factory component."/> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Mail_Control" - type="factory" - location="OAFIID:GNOME_Evolution_Mail_ControlFactory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:BonoboControl/evolution-mail:1.0"/> - <item value="IDL:GNOME/Control:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Evolution mail folder display component."/> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Mail_ShellComponent" - type="exe" - location="evolution-mail"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/Evolution/ShellComponent:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Evolution component for handling mail."/> - - <oaf_attribute name="evolution:shell-component-icon" type="string" - value="evolution-inbox.png"/> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Mail_ExecutiveSummaryComponentFactory" - type="exe" - location="evolution-mail"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:Bonobo/Unknown:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Factory for the Mail Summary component."/> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Mail_ExecutiveSummaryComponent" - type="factory" - location="OAFIID:GNOME_Evolution_Mail_ExecutiveSummaryComponentFactory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/Evolution:Summary:ComponentFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Evolution mail executive summary component."/> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Mail_ComposerFactory" - type="exe" - location="evolution-mail"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME:GenericFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Factory for the Evolution composer."/> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Mail_Composer" - type="factory" - location="OAFIID:GNOME_Evolution_Mail_ComposerFactory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/Evolution:Composer:1.0"/> - <item value="IDL:Bonobo/ItemContainer:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Evolution mail composer."/> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_MailConfig_Factory" - type="exe" - location="evolution-mail"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/GenericFactory:1.0"/> - </oaf_attribute> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_MailConfig" - type="factory" - location="OAFIID:GNOME_Evolution_MailConfig_Factory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/Evolution/MailConfig:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Mail configuration interface"/> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_FolderInfo_Factory" - type="exe" - location="evolution-mail"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/GenericFactory:1.0"/> - </oaf_attribute> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_FolderInfo" - type="factory" - location="OAFIID:GNOME_Evolution_FolderInfo_Factory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/Evolution/FolderInfo:1.0"/> - </oaf_attribute> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Mail_Wizard_Factory" - type="exe" - location="evolution-mail"> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Mail_Wizard" - type="factory" - location="OAFIID:GNOME_Evolution_Mail_Wizard_Factory"> -</oaf_server> - -</oaf_info> diff --git a/mail/Mail.idl b/mail/Mail.idl deleted file mode 100644 index f68889e0c2..0000000000 --- a/mail/Mail.idl +++ /dev/null @@ -1,86 +0,0 @@ -/* - * mail.idl: Mail interfaces for Evolution - * - * Author: - * Miguel de Icaza (miguel@ximian.com) - * - * (C) 2000 Ximian, Inc. - */ - -#include <Bonobo.idl> - -module GNOME { -module Evolution { - - interface MessageList : Bonobo::Unknown { - - void selectMessage (in long message_number); - void openMessage (in long message_number); - }; - - /* - * FolderBrowser object. - * - * configuration of this widget is done trough - * Bonobo Properties - */ - interface FolderBrowser : Bonobo::Unknown { - MessageList getMessageList (); - }; - - interface FolderInfo : Bonobo::Unknown { - struct MessageCount { - string path; - long count; - long unread; - }; - - void getInfo (in string foldername, - in Bonobo::Listener listener); - }; - - interface MailConfig : Bonobo::Unknown { - - struct Identity { - string name; - string address; - string organization; - string signature; - string html_signature; - boolean has_html_signature; - }; - - struct Service { - string url; - boolean keep_on_server; - boolean auto_check; - long auto_check_time; - boolean save_passwd; - boolean enabled; - }; - - struct Account { - string name; - - Identity id; - Service source; - Service transport; - - string drafts_folder_name; - string drafts_folder_uri; - string sent_folder_name; - string sent_folder_uri; - }; - - void addAccount (in Account acc); - }; - - interface MailFilter : Bonobo::Unknown { - - void addFilter (in string rule); - - void removeFilter (in string rule); - }; -}; -}; - diff --git a/mail/Makefile.am b/mail/Makefile.am deleted file mode 100644 index ae5d1e267c..0000000000 --- a/mail/Makefile.am +++ /dev/null @@ -1,175 +0,0 @@ -SUBDIRS = importers - -bin_PROGRAMS = evolution-mail - -providerdir = $(libdir)/evolution/camel-providers/$(VERSION) -importerdir = $(libdir)/evolution/evolution-mail-importers/$(VERSION) - -INCLUDES = \ - -I$(top_srcdir)/widgets \ - -I$(top_srcdir)/widgets/e-text \ - -I$(top_srcdir)/widgets/misc \ - -I$(top_srcdir)/camel \ - -I$(top_srcdir) \ - -I$(top_srcdir)/composer \ - -I$(top_builddir)/composer \ - -I$(top_builddir)/shell \ - -I$(top_srcdir)/shell \ - -I$(top_srcdir)/shell/importer \ - -I$(top_builddir)/shell/importer \ - $(MAILER_CFLAGS) \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \ - -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \ - -DEVOLUTION_BUTTONSDIR=\""$(buttonsdir)"\" \ - -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \ - -DCAMEL_PROVIDERDIR=\""$(providerdir)"\" \ - -DMAIL_IMPORTERSDIR=\""$(importerdir)"\" \ - -DG_LOG_DOMAIN=\"evolution-mail\" - -EVOLUTION_MAIL_CORBA_GENERATED = \ - Mail.h \ - Mail-common.c \ - Mail-skels.c \ - Mail-stubs.c - -if ENABLE_NNTP -EVOLUTION_MAIL_NNTP = \ - mail-account-editor-news.c \ - mail-account-editor-news.h -endif - - -evolution_mail_SOURCES = \ - $(EVOLUTION_MAIL_CORBA_GENERATED) \ - $(EVOLUTION_MAIL_NNTP) \ - component-factory.c \ - component-factory.h \ - e-searching-tokenizer.c \ - e-searching-tokenizer.h \ - folder-browser.c \ - folder-browser.h \ - folder-browser-factory.c \ - folder-browser-factory.h \ - folder-browser-ui.c \ - folder-browser-ui.h \ - folder-info.c \ - mail-accounts.c \ - mail-accounts.h \ - mail-account-editor.c \ - mail-account-editor.h \ - mail-account-gui.c \ - mail-account-gui.h \ - mail-autofilter.c \ - mail-autofilter.h \ - mail-callbacks.c \ - mail-callbacks.h \ - mail-config.c \ - mail-config.h \ - mail-config-druid.c \ - mail-config-druid.h \ - mail-crypto.c \ - mail-crypto.h \ - mail-display.c \ - mail-display.h \ - mail-folder-cache.c \ - mail-folder-cache.h \ - mail-format.c \ - mail-identify.c \ - mail-importer.c \ - mail-importer.h \ - mail-local.c \ - mail-local.h \ - mail-mt.c \ - mail-mt.h \ - mail-offline-handler.c \ - mail-offline-handler.h \ - mail-ops.c \ - mail-ops.h \ - mail-search.c \ - mail-search.h \ - mail-search-dialogue.c \ - mail-search-dialogue.h \ - mail-send-recv.c \ - mail-send-recv.h \ - mail-session.c \ - mail-session.h \ - mail-stream-gtkhtml.c \ - mail-stream-gtkhtml.h \ - mail-tools.c \ - mail-tools.h \ - mail-types.h \ - mail-vfolder.c \ - mail-vfolder.h \ - message-browser.c \ - message-browser.h \ - main.c \ - message-list.c \ - message-list.h \ - subscribe-dialog.c \ - subscribe-dialog.h \ - mail.h - -evolution_mail_LDADD = \ - $(top_builddir)/camel/libcamel.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/shell/libeshell.la \ - $(top_builddir)/composer/libcomposer.a \ - $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(top_builddir)/addressbook/backend/ebook/libebook.la \ - $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/e-util/ename/libename.la \ - $(top_builddir)/libibex/libibex.la \ - $(top_builddir)/filter/libfilter.la \ - $(top_builddir)/shell/importer/libevolution-importer.la \ - $(top_builddir)/widgets/menus/libmenus.la \ - $(MAILER_LIBS) - -evolution_mail_LDFLAGS = \ - -export-dynamic - -oafdir = $(datadir)/oaf -oaf_in_files = GNOME_Evolution_Mail.oaf.in -oaf_DATA = $(oaf_in_files:.oaf.in=.oaf) - -@XML_I18N_MERGE_OAF_RULE@ - -gladedir = $(datadir)/evolution/glade -glade_DATA = mail-config.glade local-config.glade subscribe-dialog.glade - -etspecdir = $(datadir)/evolution/etspec/ -etspec_DATA = message-list.etspec subscribe-dialog.etspec - -iconsdir = $(datadir)/images/evolution -buttonsdir = $(datadir)/images/evolution/buttons - -$(EVOLUTION_MAIL_CORBA_GENERATED): Mail.idl - $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl -I `$(GNOME_CONFIG) --cflags idl` \ - -I `$(GNOME_CONFIG) --datadir`/idl $(srcdir)/Mail.idl - -EXTRA_DIST = \ - Mail.idl \ - $(glade_DATA) \ - $(oaf_in_files) \ - $(oaf_DATA) \ - $(etspec_DATA) \ - mail-account-editor-news.c \ - mail-account-editor-news.h - -if ENABLE_PURIFY -PLINK = $(LIBTOOL) --mode=link $(PURIFY) $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ - -all-local: evolution-mail.pure - -evolution-mail.pure: evolution-mail - @rm -f evolution-mail.pure - $(PLINK) $(evolution_mail_LDFLAGS) $(evolution_mail_OBJECTS) $(evolution_mail_LDADD) $(LIBS) - -endif - -BUILT_SOURCES = $(EVOLUTION_MAIL_CORBA_GENERATED) -CLEANFILES = $(BUILT_SOURCES) - -dist-hook: - cd $(distdir); rm -f $(BUILT_SOURCES) diff --git a/mail/README.async b/mail/README.async deleted file mode 100644 index 3966b3a97b..0000000000 --- a/mail/README.async +++ /dev/null @@ -1,366 +0,0 @@ -******* -This document is absurdly, obscenely out of date. Don't read it. - - -- Peter Williams 7/2/2001 -******* - -Asynchronous Mailer Information -Peter Williams <peterw@helixcode.com> -8/4/2000 - -1. INTRODUCTION - -It's pretty clear that the Evolution mailer needs to be asynchronous in -some manner. Blocking the UI completely on IMAP calls or large disk reads -is unnacceptable, and it's really nice to be able to thread the message -view in the background, or do other things while a mailbox is downloading. - -The problem in making Evolution asynchronous is Camel. Camel is not -asynchronous for a few reasons. All of its interfaces are synchronous -- -calls like camel_store_get_folder, camel_folder_get_message, etc. can -take a very long time if they're being performed over a network or with -a large mbox mailbox file. However, these functions have no mechanism -for specifying that the operation is in progress but not complete, and -no mechanism for signaling when to operation does complete. - -2. WHY I DIDN'T MAKE CAMEL ASYNCHRONOUS - -It seems like it would be a good idea, then, to rewrite Camel to be -asynchonous. This presents several problems: - - * Many interfaces must be rewritten to support "completed" - callbacks, etc. Some of these interfaces are connected to - synchronous CORBA calls. - * Everything must be rewritten to be asynchonous. This includes - the CamelStore, CamelFolder, CamelMimeMessage, CamelProvider, - every subclass thereof, and all the code that touches these. - These include the files in camel/, mail/, filter/, and - composer/. The change would be a complete redesign for any - provider implementation. - * All the work on providers (IMAP, mh, mbox, nntp) up to this - point would be wasted. While they were being rewritten - evolution-mail would be useless. - -However, it is worth noting that the solution I chose is not optimal, -and I think that it would be worthwhile to write a libcamel2 or some -such thing that was designed from the ground up to work asynchronously. -Starting fresh from such a design would work, but trying to move the -existing code over would be more trouble than it's worth. - -3. WHY I MADE CAMEL THREADED - -If Camel was not going to be made asynchronous, really the only other -choice was to make it multithreaded. [1] No one has been particularly -excited by this plan, as debugging and writing MT-safe code is hard. -But there wasn't much of a choice, and I believed that a simple thread -wrapper could be written around Camel. - -The important thing to know is that while Camel is multithreaded, we -DO NOT and CANNOT share objects between threads. Instead, -evolution-mail sends a request to a dispatching thread, which performs -the action or queues it to be performed. (See section 4 for details) - -The goal that I was working towards is that there should be no calls -to camel made, ever, in the main thread. I didn't expect to and -didn't do this, but that was the intent. - -[1]. Well, we could fork off another process, but they share so much -data that this would be pretty impractical. - -4. IMPLEMENTATION - -a. CamelObject - -Threading presented a major problem regarding Camel. Camel is based -on the GTK Object system, and uses signals to communicate events. This -is okay in a nonthreaded application, but the GTK Object system is -not thread-safe. - -Particularly, signals and object allocations use static data. Using -either one inside Camel would guarantee that we'd be stuck with -random crashes forevermore. That's Bad (TM). - -There were two choices: make sure to limit our usage of GTK, or stop -using the GTK Object system. I decided to do the latter, as the -former would lead to a mess of "what GTK calls can we make" and -GDK_THREADS_ENTER and accidentally calling UI functions and upgrades -to GTK breaking everything. - -So I wrote a very very simple CamelObject system. It had three goals: - - * Be really straightforward, just encapsulate the type - heirarchy without all that GtkArg silliness or anything. - * Be as compatible as possible with the GTK Object system - to make porting easy - * Be threadsafe - -It supports: - - * Type inheritance - * Events (signals) - * Type checking - * Normal refcounting - * No unref/destroy messiness - * Threadsafety - * Class functions - -The entire code to the object system is in camel/camel-object.c. It's -a naive implementation and not full of features, but intentionally that -way. The main differences between GTK Objects and Camel Objects are: - - * s,gtk,camel,i of course - * Finalize is no longer a GtkObjectClass function. You specify - a finalize function along with an init function when declaring - a type, and it is called automatically and chained automatically. - * Declaring a type is a slightly different API - * The signal system is replaced with a not-so-clever event system. - Every event is equivalent to a NONE__POINTER signal. The syntax - is slightly different: a class "declares" an event and specifies - a name and a "prep func", that is called before the event is - triggered and can cancel it. - * There is only one CamelXXXClass in existence for every type. - All objects share it. - -There is a shell script, tools/make-camel-object.sh that will do all of -the common substitutions to make a file CamelObject-compatible. Usually -all that needs to be done is move the implementation of the finalize -event out of the class init, modify the get_type function, and replace -signals with events. - -Pitfalls in the transition that I ran into were: - - * gtk_object_ref -> camel_object_ref or you coredump - * some files return 'guint' instead of GtkType and must be changed - * Remove the #include <gtk/gtk.h> - * gtk_object_set_datas must be changed (This happened once; I - added a static hashtable) - * signals have to be fudged a bit to match the gpointer input - * the BAST_CASTARD option is on, meaning failed typecasts will - return NULL, almost guaranteeing a segfault -- gets those - bugs fixed double-quick! - -b. API -- mail_operation_spec - -I worked by creating a very specific definition of a "mail operation" -and wrote an engine to queue and dispatch them. - -A mail operation is defined by a structure mail_operation_spec -prototyped in mail-threads.h. It comes in three logical parts -- a -"setup" phase, executed in the main thread; a "do" phase, executed -in the dispatch thread; and a "cleanup" phase, executed in the main -thread. These three phases are guaranteed to be performed in order -and atomically with respect to other mail operations. - -Each of these phases is represented by a function pointer in the -mail_operation_spec structure. The function mail_operation_queue() is -called and passed a pointer to a mail_operation_spec and a user_data-style -pointer that fills in the operation's parameters. The "setup" callback -is called immediately, though that may change. - -Each callback is passed three parameters: a pointer to the user_data, -a pointer to the "operation data", and a pointer to a CamelException. -The "operation data" is allocated automatically and freed when the operation -completes. Internal data that needs to be shared between phases should -be stored here. The size allocated is specified in the mail_operation_spec -structure. - -Because all of the callbacks use Camel calls at some point, the -CamelException is provided as utility. The dispatcher will catch exceptions -and display error dialogs, unlike the synchronous code which lets -exceptions fall through the cracks fairly easily. - -I tried to implement all the operations following this convention. Basically -I used this skeleton code for all the operations, just filling in the -specifics: - -=================================== - -typedef struct operation_name_input_s { - parameters to operation -} operation_name_input_t; - -typedef struct operation_name_data_s { - internal data to operation, if any - (if none, omit the structure and set opdata_size to 0) -} operation_name_data_t; - -static gchar *describe_operation_name (gpointer in_data, gboolean gerund); -static void setup_operation_name (gpointer in_data, gpointer op_data, CamelException *ex); -static void do_operation_name (gpointer in_data, gpointer op_data, CamelException *ex); -static void cleanup_operation_name (gpointer in_data, gpointer op_data, CamelException *ex); - -static gchar *describe_operation_name (gpointer in_data, gboolean gerund) -{ - operation_name_input_t *input = (operation_name_input_t *) in_data; - - if (gerund) { - return a g_strdup'ed string describing what we're doing - } else { - return a g_strdup'ed string describing what we're about to do - } -} - -static void setup_operation_name (gpointer in_data, gpointer op_data, CamelException *ex) -{ - operation_name_input_t *input = (operation_name_input_t *) in_data; - operation_name_data_t *data = (operation_name_data_t *) op_data; - - verify that parameters are valid - - initialize op_data - - reference objects -} - -static void do_operation_name (gpointer in_data, gpointer op_data, CamelException *ex) -{ - operation_name_input_t *input = (operation_name_input_t *) in_data; - operation_name_data_t *data = (operation_name_data_t *) op_data; - - perform camel operations -} - -static void cleanup_operation_name (gpointer in_data, gpointer op_data, CamelException *ex) -{ - operation_name_input_t *input = (operation_name_input_t *) in_data; - operation_name_data_t *data = (operation_name_data_t *) op_data; - - perform UI updates - - free allocations - - dereference objects -} - -static const mail_operation_spec op_operation_name = { - describe_operation_name, - sizeof (operation_name_data_t), - setup_operation_name, - do_operation_name, - cleanup_operation_name -}; - -void -mail_do_operation_name (parameters) -{ - operation_name_input_t *input; - - input = g_new (operation_name_input_t, 1); - - store parameters in input - - mail_operation_queue (&op_operation_name, input, TRUE); -} - -=========================================== - -c. mail-ops.c - -Has been drawn and quartered. It has been split into: - - * mail-callbacks.c: the UI callbacks - * mail-tools.c: useful sequences wrapping common Camel operations - * mail-ops.c: implementations of all the mail_operation_specs - -An important part of mail-ops.c are the global functions -mail_tool_camel_lock_{up,down}. These simulate a recursize mutex around -camel. There are an extreme few, supposedly safe, calls to Camel made in -the main thread. These functions should go around evey call to Camel or -group thereof. I don't think they're necessary but it's nice to know -they're there. - -If you look at mail-tools.c, you'll notice that all the Camel calls are -protected with these functions. Remember that a mail tool is really -just another Camel call, so don't use them in the main thread either. - -All the mail operations are implemented in mail-ops.c EXCEPT: - - * filter-driver.c: the filter_mail operation - * message-list.c: the regenerate_messagelist operation - * message-thread.c: the thread_messages operation - -d. Using the operations - -The mail operations as implemented are very specific to evolution-mail. I -was thinking about leaving them mostly generic and then allowing extra -callbacks to be added to perform the more specific UI touches, but this -seemed kind of pointless. - -I basically looked through the code, found references to Camel, and split -the code into three parts -- the bit before the Camel calls, the bit after, -and the Camel calls. These were mapped onto the template, given a name, -and added to mail-ops.c. Additionally, I simplified the common tasks that -were taken care of in mail-tools.c, making some functions much simpler. - -Ninety-nine percent of the time, whatever operation is being done is being -done in a callback, so all that has to be done is this: - -================== - -void my_callback (GtkObject *obj, gchar *uid) -{ - camel_do_something (uid); -} - -==== becomes ==== - -void my_callback (GtkObject *obj, gchar *uid) -{ - mail_do_do_something (uid); -} - -================= - -There are, however, a few belligerents. Particularly, the function -mail_uri_to_folder returns a CamelFolder and yet should really be -asynchronous. This is called in a CORBA call that is sychronous, and -additionally is used in the filter code. - -I changed the first usage to return the folder immediately but -still fetch the CamelFolder asyncrhonously, and in the second case, -made filtering asynchronous, so the fact that the call is synchronous -doesn't matter. - -The function was renamed to mail_tool_uri_to_folder to emphasize that -it's a synchronous Camel call. - -e. The dispatcher - -mail_operation_queue () takes its parameters and assembles them in a -closure_t structure, which I abbreviate clur. It sets a timeout to -display a progress window if an operation is still running one second -later (we're not smart enough to check if it's the same operation, -but the issue is not a big deal). The other thread and some communication -pipes are created. - -The dispatcher thread sits in a loop reading from a pipe. Every time -the main thread queues an operation, it writes the closure_t into the pipe. -The dispatcher reads the closure, sends a STARTING message to the main -thread (see below for explanation), calls the callback specified in the -closure, and sends a FINISHED message. It then goes back to reading -from its pipe; it will either block until another operation comes along, -or find one right away and start it. This the pipe takes care of queueing -operations. - -The dispatch thread communicates with the main thread with another pipe; -however, the main thread has other things to do than read from the pipe, -so it adds registers a GIOReader that checks for messages in the glib -main loop. In addition to starting and finishing messages, the other -thread can communicate to the user using messages and a progress bar. -(This is currently implemented but unused.) - -5. ISSUES - - * Operations are queued and dequeued stupidly. Like if you click - on one message then click on another, the first will be retrieved - and displayed then overwritten by the second. Operations that could - be performed at the same time safely aren't. - * The CamelObject system is workable, but it'd be nice to work with - something established like the GtkObject - * The whole threading idea is not great. Concensus is that an - asynchronous interface is the Right Thing, eventually. - * Care still needs to be taken when designing evolution-mail code to - work with the asynchronous mail_do_ functions - * Some of the operations are extremely hacky. - * IMAP's timeout to send a NOOP had to be removed because we can't - use GTK. We need an alternative for this.
\ No newline at end of file diff --git a/mail/component-factory.c b/mail/component-factory.c deleted file mode 100644 index f77f76fa1b..0000000000 --- a/mail/component-factory.c +++ /dev/null @@ -1,1391 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* component-factory.c - * - * Authors: Ettore Perazzoli <ettore@ximian.com> - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include <bonobo/bonobo-generic-factory.h> -#include <gal/widgets/e-gui-utils.h> - -#include "camel.h" - -#include "Evolution.h" -#include "evolution-storage.h" -#include "evolution-wizard.h" - -#include "folder-browser-factory.h" -#include "evolution-shell-component.h" -#include "evolution-shell-component-dnd.h" -#include "folder-browser.h" -#include "mail.h" /* YUCK FIXME */ -#include "mail-config.h" -#include "mail-tools.h" -#include "mail-ops.h" -#include "mail-offline-handler.h" -#include "mail-local.h" -#include "mail-session.h" -#include "mail-mt.h" -#include "mail-importer.h" -#include "mail-folder-cache.h" - -#include "component-factory.h" - -#include "mail-send-recv.h" - -#include "mail-vfolder.h" -#include "mail-autofilter.h" - -#define d(x) - -char *default_drafts_folder_uri; -CamelFolder *drafts_folder = NULL; -char *default_sent_folder_uri; -CamelFolder *sent_folder = NULL; -char *default_outbox_folder_uri; -CamelFolder *outbox_folder = NULL; -char *evolution_dir; - -EvolutionShellClient *global_shell_client = NULL; - -RuleContext *search_context = NULL; - -static MailAsyncEvent *async_event = NULL; - -static GHashTable *storages_hash; -static EvolutionShellComponent *shell_component; - -enum { - ACCEPTED_DND_TYPE_MESSAGE_RFC822, - ACCEPTED_DND_TYPE_X_EVOLUTION_MESSAGE, - ACCEPTED_DND_TYPE_TEXT_URI_LIST, -}; - -static char *accepted_dnd_types[] = { - "message/rfc822", - "x-evolution-message", /* ...from an evolution message list... */ - "text/uri-list", /* ...from nautilus... */ - NULL -}; - -enum { - EXPORTED_DND_TYPE_TEXT_URI_LIST, -}; - -static char *exported_dnd_types[] = { - "text/uri-list", /* we have to export to nautilus as text/uri-list */ - NULL -}; - -static const EvolutionShellComponentFolderType folder_types[] = { - { "mail", "evolution-inbox.png", N_("Mail"), N_("Folder containing mail"), TRUE, accepted_dnd_types, exported_dnd_types }, - { "mailstorage", "evolution-inbox.png", "Mailstorage", N_("Mail storage folder (internal)"), FALSE, NULL, NULL }, - { "vtrash", "evolution-trash.png", N_("Virtual Trash"), N_("Virtual Trash folder"), FALSE, accepted_dnd_types, exported_dnd_types }, - { NULL, NULL, NULL, NULL, FALSE, NULL, NULL } -}; - -static const char *schema_types[] = { - "mailto", - NULL -}; - -/* EvolutionShellComponent methods and signals. */ - -static void -storage_activate (BonoboControl *control, gboolean activate, - const char *physical_uri) -{ - CamelService *store; - EvolutionStorage *storage; - CamelException ex; - - if (!activate) - return; - - camel_exception_init (&ex); - store = camel_session_get_service (session, physical_uri, - CAMEL_PROVIDER_STORE, &ex); - if (!store) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Cannot connect to store: %s"), - camel_exception_get_description (&ex)); - camel_exception_clear (&ex); - return; - } - camel_exception_clear (&ex); - - storage = g_hash_table_lookup (storages_hash, store); - if (storage && !gtk_object_get_data (GTK_OBJECT (storage), "connected")) - mail_note_store (CAMEL_STORE(store), storage, CORBA_OBJECT_NIL, NULL, NULL); - camel_object_unref (CAMEL_OBJECT (store)); -} - -static BonoboControl * -create_noselect_control (void) -{ - GtkWidget *label; - - label = gtk_label_new (_("This folder cannot contain messages.")); - gtk_widget_show (label); - return bonobo_control_new (label); -} - -static EvolutionShellComponentResult -create_view (EvolutionShellComponent *shell_component, - const char *physical_uri, - const char *folder_type, - BonoboControl **control_return, - void *closure) -{ - EvolutionShellClient *shell_client; - GNOME_Evolution_Shell corba_shell; - BonoboControl *control; - - shell_client = evolution_shell_component_get_owner (shell_component); - corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)); - - if (!g_strcasecmp (folder_type, "mail")) { - const char *noselect; - CamelURL *url; - - url = camel_url_new (physical_uri, NULL); - noselect = url ? camel_url_get_param (url, "noselect") : NULL; - if (noselect && !g_strcasecmp (noselect, "yes")) - control = create_noselect_control (); - else - control = folder_browser_factory_new_control (physical_uri, - corba_shell); - camel_url_free (url); - } else if (!g_strcasecmp (folder_type, "mailstorage")) { - char *uri_dup = g_strdup (physical_uri); - - control = create_noselect_control (); - gtk_object_set_data_full (GTK_OBJECT (control), "physical_uri", - uri_dup, g_free); - gtk_signal_connect (GTK_OBJECT (control), "activate", - storage_activate, uri_dup); - } else if (!g_strcasecmp (folder_type, "vtrash")) { - if (!g_strncasecmp (physical_uri, "file:", 5)) - control = folder_browser_factory_new_control ("vtrash:file:/", corba_shell); - else - control = folder_browser_factory_new_control (physical_uri, corba_shell); - } else - return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE; - - if (!control) - return EVOLUTION_SHELL_COMPONENT_NOTFOUND; - - *control_return = control; - return EVOLUTION_SHELL_COMPONENT_OK; -} - -static void -create_folder_done (char *uri, CamelFolder *folder, void *data) -{ - GNOME_Evolution_ShellComponentListener listener = data; - GNOME_Evolution_ShellComponentListener_Result result; - CORBA_Environment ev; - - if (folder) { - result = GNOME_Evolution_ShellComponentListener_OK; - } else { - result = GNOME_Evolution_ShellComponentListener_INVALID_URI; - } - - CORBA_exception_init (&ev); - GNOME_Evolution_ShellComponentListener_notifyResult (listener, result, &ev); - CORBA_Object_release (listener, &ev); - CORBA_exception_free (&ev); -} - -static void -create_folder (EvolutionShellComponent *shell_component, - const char *physical_uri, - const char *type, - const GNOME_Evolution_ShellComponentListener listener, - void *closure) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - if (!strcmp (type, "mail")) { - mail_get_folder (physical_uri, CAMEL_STORE_FOLDER_CREATE, create_folder_done, - CORBA_Object_duplicate (listener, &ev), mail_thread_new); - } else { - GNOME_Evolution_ShellComponentListener_notifyResult ( - listener, GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, &ev); - } - - CORBA_exception_free (&ev); -} - -static void -remove_folder_done (char *uri, gboolean removed, void *data) -{ - GNOME_Evolution_ShellComponentListener listener = data; - GNOME_Evolution_ShellComponentListener_Result result; - CORBA_Environment ev; - - if (removed) - result = GNOME_Evolution_ShellComponentListener_OK; - else - result = GNOME_Evolution_ShellComponentListener_INVALID_URI; - - CORBA_exception_init (&ev); - GNOME_Evolution_ShellComponentListener_notifyResult (listener, result, &ev); - CORBA_Object_release (listener, &ev); - CORBA_exception_free (&ev); -} - -static void -remove_folder (EvolutionShellComponent *shell_component, - const char *physical_uri, - const char *type, - const GNOME_Evolution_ShellComponentListener listener, - void *closure) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - if (strcmp (type, "mail") != 0) { - GNOME_Evolution_ShellComponentListener_notifyResult (listener, - GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, &ev); - CORBA_exception_free (&ev); - return; - } - - mail_remove_folder (physical_uri, remove_folder_done, CORBA_Object_duplicate (listener, &ev)); - CORBA_exception_free (&ev); -} - -typedef struct _xfer_folder_data { - GNOME_Evolution_ShellComponentListener listener; - gboolean remove_source; - char *source_uri; -} xfer_folder_data; - -static void -xfer_folder_done (gboolean ok, void *data) -{ - xfer_folder_data *xfd = (xfer_folder_data *)data; - GNOME_Evolution_ShellComponentListener listener = xfd->listener; - GNOME_Evolution_ShellComponentListener_Result result; - CORBA_Environment ev; - - if (xfd->remove_source && ok) { - mail_remove_folder (xfd->source_uri, remove_folder_done, xfd->listener); - } else { - if (ok) - result = GNOME_Evolution_ShellComponentListener_OK; - else - result = GNOME_Evolution_ShellComponentListener_INVALID_URI; - - CORBA_exception_init (&ev); - GNOME_Evolution_ShellComponentListener_notifyResult (listener, result, &ev); - CORBA_Object_release (listener, &ev); - CORBA_exception_free (&ev); - } - - g_free (xfd->source_uri); - g_free (xfd); -} - -static void -xfer_folder (EvolutionShellComponent *shell_component, - const char *source_physical_uri, - const char *destination_physical_uri, - const char *type, - gboolean remove_source, - const GNOME_Evolution_ShellComponentListener listener, - void *closure) -{ - CORBA_Environment ev; - CamelFolder *source; - CamelException ex; - GPtrArray *uids; - CamelURL *src, *dst; - - d(printf("Renaming folder '%s' to dest '%s' type '%s'\n", source_physical_uri, destination_physical_uri, type)); - - CORBA_exception_init (&ev); - - if (strcmp (type, "mail") != 0) { - GNOME_Evolution_ShellComponentListener_notifyResult (listener, - GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, &ev); - return; - } - - src = camel_url_new(source_physical_uri, NULL); - if (src == NULL) { - GNOME_Evolution_ShellComponentListener_notifyResult (listener, GNOME_Evolution_ShellComponentListener_INVALID_URI, &ev); - return; - } - - dst = camel_url_new(destination_physical_uri, NULL); - if (dst == NULL) { - camel_url_free(src); - GNOME_Evolution_ShellComponentListener_notifyResult (listener, GNOME_Evolution_ShellComponentListener_INVALID_URI, &ev); - return; - } - - if (camel_url_get_param(dst, "noselect") != NULL) { - camel_url_free(src); - camel_url_free(dst); - GNOME_Evolution_ShellComponentListener_notifyResult (listener, - GNOME_Evolution_ShellComponentListener_UNSUPPORTED_OPERATION, &ev); - return; - } - - camel_exception_init (&ex); - - /* If we are really doing a rename, implement it as a rename */ - if (remove && strcmp(src->protocol, dst->protocol) == 0) { - char *sname, *dname; - CamelStore *store; - - if (src->fragment) - sname = src->fragment; - else { - if (src->path && *src->path) - sname = src->path+1; - else - sname = ""; - } - - if (dst->fragment) - dname = dst->fragment; - else { - if (dst->path && *dst->path) - dname = dst->path+1; - else - dname = ""; - } - - store = camel_session_get_store(session, source_physical_uri, &ex); - if (store != NULL) - camel_store_rename_folder(store, sname, dname, &ex); - - if (camel_exception_is_set(&ex)) - GNOME_Evolution_ShellComponentListener_notifyResult (listener, GNOME_Evolution_ShellComponentListener_INVALID_URI, &ev); - else { - /* Since the shell doesn't play nice with local folders, we have to do this manually */ - mail_vfolder_rename_uri(store, source_physical_uri, destination_physical_uri); - mail_filter_rename_uri(store, source_physical_uri, destination_physical_uri); - GNOME_Evolution_ShellComponentListener_notifyResult (listener, GNOME_Evolution_ShellComponentListener_OK, &ev); - } - camel_object_unref((CamelObject *)store); - } else { - source = mail_tool_uri_to_folder (source_physical_uri, 0, &ex); - - if (source) { - xfer_folder_data *xfd; - - xfd = g_new0 (xfer_folder_data, 1); - xfd->remove_source = remove_source; - xfd->source_uri = g_strdup (source_physical_uri); - xfd->listener = CORBA_Object_duplicate (listener, &ev); - - uids = camel_folder_get_uids (source); - mail_transfer_messages (source, uids, remove_source, destination_physical_uri, CAMEL_STORE_FOLDER_CREATE, xfer_folder_done, xfd); - camel_object_unref (CAMEL_OBJECT (source)); - } else - GNOME_Evolution_ShellComponentListener_notifyResult (listener, GNOME_Evolution_ShellComponentListener_INVALID_URI, &ev); - } - - CORBA_exception_free (&ev); - camel_exception_clear (&ex); - - camel_url_free(src); - camel_url_free(dst); -} - -#if 0 -static void -populate_folder_context_menu (EvolutionShellComponent *shell_component, - BonoboUIComponent *uic, - const char *physical_uri, - const char *type, - void *closure) -{ -#ifdef TRANSLATORS_ONLY - static char popup_xml_i18n[] = {N_("Properties..."), N_("Change this folder's properties")}; -#endif - static char popup_xml[] = - "<menuitem name=\"ChangeFolderProperties\" verb=\"ChangeFolderProperties\"" - " _label=\"Properties...\" _tip=\"Change this folder's properties\"/>"; - - if (strcmp (type, "mail") != 0) - return; - - bonobo_ui_component_set_translate (uic, EVOLUTION_SHELL_COMPONENT_POPUP_PLACEHOLDER, - popup_xml, NULL); -} -#endif - -static char * -get_dnd_selection (EvolutionShellComponent *shell_component, - const char *physical_uri, - int type, - int *format_return, - const char **selection_return, - int *selection_length_return, - void *closure) -{ - g_print ("should get dnd selection for %s\n", physical_uri); - - return NULL; -} - -/* Destination side DnD */ -static CORBA_boolean -destination_folder_handle_motion (EvolutionShellComponentDndDestinationFolder *folder, - const char *physical_uri, - const char *folder_type, - const GNOME_Evolution_ShellComponentDnd_DestinationFolder_Context *destination_context, - GNOME_Evolution_ShellComponentDnd_Action *suggested_action_return, - gpointer user_data) -{ - const char *noselect; - CamelURL *url; - - url = camel_url_new (physical_uri, NULL); - noselect = camel_url_get_param (url, "noselect"); - - if (noselect && !g_strcasecmp (noselect, "yes")) - /* uh, no way to say "illegal" */ - *suggested_action_return = GNOME_Evolution_ShellComponentDnd_ACTION_DEFAULT; - else - *suggested_action_return = GNOME_Evolution_ShellComponentDnd_ACTION_MOVE; - - camel_url_free (url); - - return TRUE; -} - -static void -message_rfc822_dnd (CamelFolder *dest, CamelStream *stream, CamelException *ex) -{ - CamelMimeParser *mp; - - mp = camel_mime_parser_new (); - camel_mime_parser_scan_from (mp, TRUE); - camel_mime_parser_init_with_stream (mp, stream); - - while (camel_mime_parser_step (mp, 0, 0) == HSCAN_FROM) { - CamelMessageInfo *info; - CamelMimeMessage *msg; - - msg = camel_mime_message_new (); - if (camel_mime_part_construct_from_parser (CAMEL_MIME_PART (msg), mp) == -1) { - camel_object_unref (CAMEL_OBJECT (msg)); - break; - } - - /* append the message to the folder... */ - info = g_new0 (CamelMessageInfo, 1); - camel_folder_append_message (dest, msg, info, ex); - camel_object_unref (CAMEL_OBJECT (msg)); - - if (camel_exception_is_set (ex)) - break; - - /* skip over the FROM_END state */ - camel_mime_parser_step (mp, 0, 0); - } - - camel_object_unref (CAMEL_OBJECT (mp)); -} - -static CORBA_boolean -destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *dest_folder, - const char *physical_uri, - const char *folder_type, - const GNOME_Evolution_ShellComponentDnd_DestinationFolder_Context *destination_context, - const GNOME_Evolution_ShellComponentDnd_Action action, - const GNOME_Evolution_ShellComponentDnd_Data *data, - gpointer user_data) -{ - char *tmp, *url, **urls, *in, *inptr, *inend; - gboolean retval = FALSE; - const char *noselect; - CamelFolder *folder; - CamelStream *stream; - CamelException ex; - GPtrArray *uids; - CamelURL *uri; - int i, type, fd; - - if (action == GNOME_Evolution_ShellComponentDnd_ACTION_LINK) - return FALSE; /* we can't create links */ - - /* this means the drag was cancelled */ - if (!data->bytes._buffer || data->bytes._length == -1) - return FALSE; - - uri = camel_url_new (physical_uri, NULL); - noselect = uri ? camel_url_get_param (uri, "noselect") : NULL; - if (noselect && !g_strcasecmp (noselect, "yes")) { - camel_url_free (uri); - return FALSE; - } - camel_url_free (uri); - - g_print ("in destination_folder_handle_drop (%s)\n", physical_uri); - - for (type = 0; accepted_dnd_types[type]; type++) - if (!strcmp (destination_context->dndType, accepted_dnd_types[type])) - break; - - camel_exception_init (&ex); - - /* if this is a local vtrash folder, then it's uri is vtrash:file:/ */ - if (!strcmp (folder_type, "vtrash") && !strncmp (physical_uri, "file:", 5)) - physical_uri = "vtrash:file:/"; - - switch (type) { - case ACCEPTED_DND_TYPE_TEXT_URI_LIST: - folder = mail_tool_uri_to_folder (physical_uri, 0, NULL); - if (!folder) - return FALSE; - - tmp = g_strndup (data->bytes._buffer, data->bytes._length); - urls = g_strsplit (tmp, "\n", 0); - g_free (tmp); - - retval = TRUE; - for (i = 0; urls[i] != NULL && retval; i++) { - /* get the path component */ - url = g_strstrip (urls[i]); - - uri = camel_url_new (url, NULL); - g_free (url); - url = uri->path; - uri->path = NULL; - camel_url_free (uri); - - fd = open (url, O_RDONLY); - if (fd == -1) { - g_free (url); - /* FIXME: okay, so what do we do in this case? */ - continue; - } - - stream = camel_stream_fs_new_with_fd (fd); - message_rfc822_dnd (folder, stream, &ex); - camel_object_unref (CAMEL_OBJECT (stream)); - camel_object_unref (CAMEL_OBJECT (folder)); - - retval = !camel_exception_is_set (&ex); - - if (action == GNOME_Evolution_ShellComponentDnd_ACTION_MOVE && retval) - unlink (url); - - g_free (url); - } - - g_free (urls); - break; - case ACCEPTED_DND_TYPE_MESSAGE_RFC822: - folder = mail_tool_uri_to_folder (physical_uri, 0, &ex); - if (!folder) { - camel_exception_clear (&ex); - return FALSE; - } - - /* write the message(s) out to a CamelStream so we can use it */ - stream = camel_stream_mem_new (); - camel_stream_write (stream, data->bytes._buffer, data->bytes._length); - camel_stream_reset (stream); - - message_rfc822_dnd (folder, stream, &ex); - camel_object_unref (CAMEL_OBJECT (stream)); - camel_object_unref (CAMEL_OBJECT (folder)); - break; - case ACCEPTED_DND_TYPE_X_EVOLUTION_MESSAGE: - folder = mail_tools_x_evolution_message_parse (data->bytes._buffer, - data->bytes._length, - &uids); - - if (!folder) - return FALSE; - - mail_transfer_messages (folder, uids, - action == GNOME_Evolution_ShellComponentDnd_ACTION_MOVE, - physical_uri, 0, NULL, NULL); - - camel_object_unref (CAMEL_OBJECT (folder)); - break; - default: - break; - } - - camel_exception_clear (&ex); - - return retval; -} - - -static struct { - char *name, **uri; - CamelFolder **folder; -} standard_folders[] = { - { "Drafts", &default_drafts_folder_uri, &drafts_folder }, - { "Outbox", &default_outbox_folder_uri, &outbox_folder }, - { "Sent", &default_sent_folder_uri, &sent_folder }, -}; - -static void -unref_standard_folders (void) -{ - int i; - - for (i = 0; i < sizeof (standard_folders) / sizeof (standard_folders[0]); i++) { - if (standard_folders[i].folder) { - CamelFolder *folder = *standard_folders[i].folder; - - *standard_folders[i].folder = NULL; - - if (CAMEL_OBJECT (folder)->ref_count == 1) - d(printf ("About to finalise folder %s\n", folder->full_name)); - else - d(printf ("Folder %s still has %d extra ref%s on it\n", folder->full_name, - CAMEL_OBJECT (folder)->ref_count - 1, - CAMEL_OBJECT (folder)->ref_count - 1 == 1 ? "" : "s")); - - camel_object_unref (CAMEL_OBJECT (folder)); - } - } -} - -static void -got_folder (char *uri, CamelFolder *folder, void *data) -{ - CamelFolder **fp = data; - - if (folder) { - *fp = folder; - - camel_object_ref (CAMEL_OBJECT (folder)); - - /* emit a changed event, this is a little hack so that the folderinfo cache - will update knowing whether this is the outbox_folder or not, etc */ - if (folder == outbox_folder) { - CamelFolderChangeInfo *changes = camel_folder_change_info_new(); - - camel_object_trigger_event((CamelObject *)folder, "folder_changed", changes); - camel_folder_change_info_free(changes); - } - } -} - -static void -shell_client_destroy (GtkObject *object) -{ - global_shell_client = NULL; -} - -static void -warning_clicked (GtkWidget *dialog, gpointer user_data) -{ - gtk_widget_destroy (dialog); -} - -static void -owner_set_cb (EvolutionShellComponent *shell_component, - EvolutionShellClient *shell_client, - const char *evolution_homedir, - gpointer user_data) -{ - GNOME_Evolution_Shell corba_shell; - const GSList *accounts; -#ifdef ENABLE_NNTP - const GSList *news; -#endif - int i; - - /* FIXME: should we ref this? */ - global_shell_client = shell_client; - gtk_signal_connect (GTK_OBJECT (shell_client), "destroy", - shell_client_destroy, NULL); - - evolution_dir = g_strdup (evolution_homedir); - mail_session_init (); - - async_event = mail_async_event_new(); - - storages_hash = g_hash_table_new (NULL, NULL); - - corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)); - - vfolder_load_storage(corba_shell); - - accounts = mail_config_get_accounts (); - mail_load_storages (corba_shell, accounts, TRUE); - -#ifdef ENABLE_NNTP - news = mail_config_get_news (); - mail_load_storages (corba_shell, news, FALSE); -#endif - - mail_local_storage_startup (shell_client, evolution_dir); - mail_importer_init (shell_client); - - for (i = 0; i < sizeof (standard_folders) / sizeof (standard_folders[0]); i++) { - *standard_folders[i].uri = g_strdup_printf ("file://%s/local/%s", evolution_dir, standard_folders[i].name); - mail_msg_wait (mail_get_folder (*standard_folders[i].uri, CAMEL_STORE_FOLDER_CREATE, - got_folder, standard_folders[i].folder, mail_thread_new)); - } - - mail_autoreceive_setup (); - - { - /* setup the global quick-search context */ - char *user = g_strdup_printf ("%s/searches.xml", evolution_dir); - char *system = g_strdup (EVOLUTION_DATADIR "/evolution/vfoldertypes.xml"); - - search_context = rule_context_new (); - gtk_object_set_data_full (GTK_OBJECT (search_context), "user", user, g_free); - gtk_object_set_data_full (GTK_OBJECT (search_context), "system", system, g_free); - - rule_context_add_part_set (search_context, "partset", filter_part_get_type (), - rule_context_add_part, rule_context_next_part); - - rule_context_add_rule_set (search_context, "ruleset", filter_rule_get_type (), - rule_context_add_rule, rule_context_next_rule); - - rule_context_load (search_context, system, user); - } - - if (mail_config_is_corrupt ()) { - GtkWidget *dialog; - - dialog = gnome_warning_dialog (_("Some of your mail settings seem corrupt, " - "please check that everything is in order.")); - gtk_signal_connect (GTK_OBJECT (dialog), "clicked", warning_clicked, NULL); - gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); - gtk_widget_show (dialog); - } -} - -static void -free_storage (gpointer service, gpointer storage, gpointer data) -{ - if (service) { - mail_note_store_remove((CamelStore *)service); - camel_service_disconnect (CAMEL_SERVICE (service), TRUE, NULL); - camel_object_unref (CAMEL_OBJECT (service)); - } - - if (storage) - bonobo_object_unref (BONOBO_OBJECT (storage)); -} - -static void -debug_cb (EvolutionShellComponent *shell_component, gpointer user_data) -{ - extern gboolean camel_verbose_debug; - - camel_verbose_debug = 1; -} - -static void -interactive_cb (EvolutionShellComponent *shell_component, gboolean on, gpointer user_data) -{ - mail_session_enable_interaction(on); -} - -static void -handle_external_uri_cb (EvolutionShellComponent *shell_component, - const char *uri, - void *data) -{ - if (strncmp (uri, "mailto:", 7) != 0) { - /* FIXME: Exception? The EvolutionShellComponent object should - give me a chance to do so, but currently it doesn't. */ - g_warning ("Invalid URI requested to mail component -- %s", uri); - return; - } - - /* FIXME: Sigh. This shouldn't be here. But the code is messy, so - I'll just put it here anyway. */ - send_to_url (uri); -} - -static void -user_create_new_item_cb (EvolutionShellComponent *shell_component, - const char *id, - const char *parent_folder_physical_uri, - const char *parent_folder_type, - gpointer data) -{ - if (!strcmp (id, "message")) { - send_to_url (NULL); - return; - } - - g_warning ("Don't know how to create item of type \"%s\"", id); -} - -static gboolean -idle_quit (gpointer user_data) -{ - static int shutdown_vfolder = FALSE; - static int shutdown_shutdown = FALSE; - - if (!shutdown_shutdown) { - if (mail_msg_active(-1)) { - /* short sleep? */ - return TRUE; - } - - if (!shutdown_vfolder) { - shutdown_vfolder = TRUE; - mail_vfolder_shutdown(); - return TRUE; - } - - if (mail_async_event_destroy(async_event) == -1) - return TRUE; - - shutdown_shutdown = TRUE; - g_hash_table_foreach (storages_hash, free_storage, NULL); - g_hash_table_destroy (storages_hash); - storages_hash = NULL; - } - - if (e_list_length (folder_browser_factory_get_control_list ())) - return TRUE; - - gtk_main_quit (); - - return FALSE; -} - -static void owner_unset_cb (EvolutionShellComponent *shell_component, gpointer user_data); - -/* Table for signal handler setup/cleanup */ -static struct { - char *sig; - GtkSignalFunc func; - int hand; -} shell_component_handlers[] = { - { "owner_set", owner_set_cb, }, - { "owner_unset", owner_unset_cb, }, - { "debug", debug_cb, }, - { "interactive", interactive_cb }, - { "destroy", owner_unset_cb, }, - { "handle_external_uri", handle_external_uri_cb, }, - { "user_create_new_item", user_create_new_item_cb } -}; - -static void -owner_unset_cb (EvolutionShellComponent *shell_component, gpointer user_data) -{ - int i; - - for (i=0;i<sizeof(shell_component_handlers)/sizeof(shell_component_handlers[0]);i++) - gtk_signal_disconnect((GtkObject *)shell_component, shell_component_handlers[i].hand); - - if (mail_config_get_empty_trash_on_exit ()) - empty_trash (NULL, NULL, NULL); - - unref_standard_folders (); - mail_importer_uninit (); - - global_shell_client = NULL; - mail_session_enable_interaction (FALSE); - - gtk_object_unref (GTK_OBJECT (search_context)); - search_context = NULL; - - g_timeout_add(100, idle_quit, NULL); -} - -static BonoboObject * -create_component (void) -{ - EvolutionShellComponentDndDestinationFolder *destination_interface; - MailOfflineHandler *offline_handler; - int i; - - shell_component = evolution_shell_component_new (folder_types, - schema_types, - create_view, - create_folder, - remove_folder, - xfer_folder, - /*populate_folder_context_menu*/NULL, - get_dnd_selection, - NULL); - - destination_interface = evolution_shell_component_dnd_destination_folder_new (destination_folder_handle_motion, - destination_folder_handle_drop, - shell_component); - - bonobo_object_add_interface (BONOBO_OBJECT (shell_component), - BONOBO_OBJECT (destination_interface)); - - evolution_mail_config_wizard_init (); - - evolution_shell_component_add_user_creatable_item (shell_component, "message", _("New Mail Message"), _("New _Mail Message"), 'm'); - - for (i=0;i<sizeof(shell_component_handlers)/sizeof(shell_component_handlers[0]);i++) { - shell_component_handlers[i].hand = gtk_signal_connect(GTK_OBJECT(shell_component), - shell_component_handlers[i].sig, - shell_component_handlers[i].func, NULL); - } - - offline_handler = mail_offline_handler_new (); - bonobo_object_add_interface (BONOBO_OBJECT (shell_component), BONOBO_OBJECT (offline_handler)); - - return BONOBO_OBJECT (shell_component); -} - -void -component_factory_init (void) -{ - BonoboObject *shell_component; - int result; - - shell_component = create_component (); - result = oaf_active_server_register (COMPONENT_ID, bonobo_object_corba_objref (shell_component)); - if (result == OAF_REG_ERROR) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Cannot initialize Evolution's mail component.")); - exit (1); - } else if (result == OAF_REG_ALREADY_ACTIVE) { - g_warning ("evolution-mail is already running"); - exit (1); - } - - if (evolution_mail_config_factory_init () == FALSE) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Cannot initialize Evolution's mail config component.")); - exit (1); - } - - if (evolution_folder_info_factory_init () == FALSE) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Cannot initialize Evolution's folder info component.")); - exit (1); - } -} - -static void -notify_listener (const Bonobo_Listener listener, - GNOME_Evolution_Storage_Result corba_result) -{ - CORBA_any any; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - any._type = TC_GNOME_Evolution_Storage_Result; - any._value = &corba_result; - - Bonobo_Listener_event (listener, "result", &any, &ev); - - CORBA_exception_free (&ev); -} - -static void -storage_create_folder (EvolutionStorage *storage, - const Bonobo_Listener listener, - const char *path, - const char *type, - const char *description, - const char *parent_physical_uri, - gpointer user_data) -{ - CamelStore *store = user_data; - CamelFolderInfo *root, *fi; - char *name; - CamelURL *url; - CamelException ex; - - /* We could just use 'path' always here? */ - - if (strcmp (type, "mail") != 0) { - notify_listener (listener, GNOME_Evolution_Storage_UNSUPPORTED_TYPE); - return; - } - - name = strrchr (path, '/'); - if (!name) { - notify_listener (listener, GNOME_Evolution_Storage_INVALID_URI); - return; - } - name++; - - camel_exception_init (&ex); - if (*parent_physical_uri) { - url = camel_url_new (parent_physical_uri, NULL); - if (!url) { - notify_listener (listener, GNOME_Evolution_Storage_INVALID_URI); - return; - } - - root = camel_store_create_folder (store, url->fragment?url->fragment:url->path + 1, name, &ex); - camel_url_free (url); - } else - root = camel_store_create_folder (store, NULL, name, &ex); - - if (camel_exception_is_set (&ex)) { - /* FIXME: do better than this */ - camel_exception_clear (&ex); - notify_listener (listener, GNOME_Evolution_Storage_INVALID_URI); - return; - } - - if (camel_store_supports_subscriptions (store)) { - for (fi = root; fi; fi = fi->child) - camel_store_subscribe_folder (store, fi->full_name, NULL); - } - - camel_store_free_folder_info (store, root); - - notify_listener (listener, GNOME_Evolution_Storage_OK); -} - -static void -storage_remove_folder (EvolutionStorage *storage, - const Bonobo_Listener listener, - const char *path, - const char *physical_uri, - gpointer user_data) -{ - CamelStore *store = user_data; - CamelURL *url = NULL; - char *name; - CamelException ex; - - g_warning ("storage_remove_folder: path=\"%s\"; uri=\"%s\"", path, physical_uri); - - if (!path || !physical_uri || !strncmp (physical_uri, "vtrash:", 7)) { - notify_listener (listener, GNOME_Evolution_Storage_INVALID_URI); - return; - } - - url = camel_url_new (physical_uri, NULL); - if (!url) { - notify_listener (listener, GNOME_Evolution_Storage_INVALID_URI); - return; - } - - if (!*path) { - camel_url_free (url); - notify_listener (listener, GNOME_Evolution_Storage_INVALID_URI); - return; - } - - camel_exception_init (&ex); - - if (url->fragment) - name = url->fragment; - else if (url->path && url->path[0]) - name = url->path+1; - else - name = ""; - - if (camel_store_supports_subscriptions (store)) - camel_store_unsubscribe_folder (store, name, NULL); - - camel_store_delete_folder (store, name, &ex); - - camel_url_free (url); - if (camel_exception_is_set (&ex)) - goto exception; - - evolution_storage_removed_folder (storage, path); - - notify_listener (listener, GNOME_Evolution_Storage_OK); - return; - - exception: - /* FIXME: do better than this... */ - camel_exception_clear (&ex); - notify_listener (listener, GNOME_Evolution_Storage_INVALID_URI); -} - -static void -storage_xfer_folder (EvolutionStorage *storage, - const Bonobo_Listener listener, - const char *source_path, - const char *destination_path, - gboolean remove_source, - CamelStore *store) -{ - CamelException ex; - char *src, *dst; - char *p, c, sep; - - d(printf("Transfer folder on store source = '%s' dest = '%s'\n", source_path, destination_path)); - - /* Remap the 'path' to the camel friendly name based on the store dir separator */ - sep = store->dir_sep; - src = g_strdup(source_path[0]=='/'?source_path+1:source_path); - dst = g_strdup(destination_path[0]=='/'?destination_path+1:destination_path); - if (sep != '/') { - p = src; - while ((c = *p++)) - if (c == '/') - p[-1] = sep; - - p = dst; - while ((c = *p++)) - if (c == '/') - p[-1] = sep; - } - - camel_exception_init (&ex); - if (remove_source) { - d(printf("trying to rename\n")); - camel_store_rename_folder(store, src, dst, &ex); - if (camel_exception_is_set(&ex)) - notify_listener (listener, GNOME_Evolution_Storage_GENERIC_ERROR); - else - notify_listener (listener, GNOME_Evolution_Storage_OK); - } else { - d(printf("No remove, can't rename\n")); - /* FIXME: Implement folder 'copy' for remote stores */ - /* This exception never goes anywhere, so it doesn't need translating or using */ - notify_listener (listener, GNOME_Evolution_Storage_UNSUPPORTED_OPERATION); - } - - g_free(src); - g_free(dst); - - camel_exception_clear (&ex); -} - -static void -add_storage (const char *name, const char *uri, CamelService *store, - GNOME_Evolution_Shell corba_shell, CamelException *ex) -{ - EvolutionStorage *storage; - EvolutionStorageResult res; - - storage = evolution_storage_new (name, uri, "mailstorage"); - gtk_signal_connect (GTK_OBJECT (storage), "create_folder", storage_create_folder, store); - gtk_signal_connect (GTK_OBJECT (storage), "remove_folder", storage_remove_folder, store); - gtk_signal_connect ((GtkObject *)storage, "xfer_folder", storage_xfer_folder, store); - - res = evolution_storage_register_on_shell (storage, corba_shell); - - switch (res) { - case EVOLUTION_STORAGE_OK: - mail_hash_storage (store, storage); - mail_note_store((CamelStore *)store, storage, CORBA_OBJECT_NIL, NULL, NULL); - /* falllll */ - case EVOLUTION_STORAGE_ERROR_ALREADYREGISTERED: - case EVOLUTION_STORAGE_ERROR_EXISTS: - return; - default: - camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, - _("Cannot register storage with shell")); - break; - } -} - -void -mail_load_storage_by_uri (GNOME_Evolution_Shell shell, const char *uri, const char *name) -{ - CamelException ex; - CamelService *store; - CamelProvider *prov; - - camel_exception_init (&ex); - - /* Load the service (don't connect!). Check its provider and - * see if this belongs in the shell's folder list. If so, add - * it. - */ - - prov = camel_session_get_provider (session, uri, &ex); - if (prov == NULL) { - /* FIXME: real error dialog */ - g_warning ("couldn't get service %s: %s\n", uri, - camel_exception_get_description (&ex)); - camel_exception_clear (&ex); - return; - } - - if (!(prov->flags & CAMEL_PROVIDER_IS_STORAGE) || - (prov->flags & CAMEL_PROVIDER_IS_EXTERNAL)) - return; - - store = camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex); - if (store == NULL) { - /* FIXME: real error dialog */ - g_warning ("couldn't get service %s: %s\n", uri, - camel_exception_get_description (&ex)); - camel_exception_clear (&ex); - return; - } - - if (name == NULL) { - char *service_name; - - service_name = camel_service_get_name (store, TRUE); - add_storage (service_name, uri, store, shell, &ex); - g_free (service_name); - } else - add_storage (name, uri, store, shell, &ex); - - if (camel_exception_is_set (&ex)) { - /* FIXME: real error dialog */ - g_warning ("Cannot load storage: %s", - camel_exception_get_description (&ex)); - camel_exception_clear (&ex); - } - - camel_object_unref (CAMEL_OBJECT (store)); -} - -/* FIXME: 'is_account_data' is an ugly hack, if we remove support for NNTP we can take it out -- fejj */ -void -mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources, gboolean is_account_data) -{ - CamelException ex; - const GSList *iter; - - camel_exception_init (&ex); - - /* Load each service (don't connect!). Check its provider and - * see if this belongs in the shell's folder list. If so, add - * it. - */ - - for (iter = sources; iter; iter = iter->next) { - const MailConfigAccount *account = NULL; - const MailConfigService *service = NULL; - char *name; - - if (is_account_data) { - account = iter->data; - service = account->source; - name = account->name; - } else { - service = iter->data; - name = NULL; - } - - if (service == NULL || service->url == NULL || service->url[0] == '\0' || !service->enabled) - continue; - - mail_load_storage_by_uri (shell, service->url, name); - } -} - -void -mail_hash_storage (CamelService *store, EvolutionStorage *storage) -{ - camel_object_ref (CAMEL_OBJECT (store)); - g_hash_table_insert (storages_hash, store, storage); -} - -EvolutionStorage* -mail_lookup_storage (CamelStore *store) -{ - EvolutionStorage *storage; - - /* Because the storages_hash holds a reference to each store - * used as a key in it, none of them will ever be gc'ed, meaning - * any call to camel_session_get_{service,store} with the same - * URL will always return the same object. So this works. - */ - - storage = g_hash_table_lookup (storages_hash, store); - if (storage) - bonobo_object_ref (BONOBO_OBJECT (storage)); - - return storage; -} - -static void -store_disconnect(CamelStore *store, void *event_data, void *data) -{ - camel_service_disconnect (CAMEL_SERVICE (store), TRUE, NULL); - camel_object_unref (CAMEL_OBJECT (store)); -} - -void -mail_remove_storage (CamelStore *store) -{ - EvolutionStorage *storage; - EvolutionShellClient *shell_client; - GNOME_Evolution_Shell corba_shell; - - /* Because the storages_hash holds a reference to each store - * used as a key in it, none of them will ever be gc'ed, meaning - * any call to camel_session_get_{service,store} with the same - * URL will always return the same object. So this works. - */ - - storage = g_hash_table_lookup (storages_hash, store); - g_hash_table_remove (storages_hash, store); - - /* so i guess potentially we could have a race, add a store while one - being removed. ?? */ - mail_note_store_remove(store); - - shell_client = evolution_shell_component_get_owner (shell_component); - corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)); - - evolution_storage_deregister_on_shell (storage, corba_shell); - - mail_async_event_emit(async_event, MAIL_ASYNC_THREAD, (MailAsyncFunc)store_disconnect, store, NULL, NULL); -} - -void -mail_remove_storage_by_uri (const char *uri) -{ - CamelProvider *prov; - CamelService *store; - - prov = camel_session_get_provider (session, uri, NULL); - if (!prov) - return; - if (!(prov->flags & CAMEL_PROVIDER_IS_STORAGE) || - (prov->flags & CAMEL_PROVIDER_IS_EXTERNAL)) - return; - - store = camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, NULL); - if (store != NULL) { - mail_remove_storage (CAMEL_STORE (store)); - camel_object_unref (CAMEL_OBJECT (store)); - } -} - -int -mail_storages_count (void) -{ - return g_hash_table_size (storages_hash); -} - -void -mail_storages_foreach (GHFunc func, gpointer data) -{ - g_hash_table_foreach (storages_hash, func, data); -} diff --git a/mail/component-factory.h b/mail/component-factory.h deleted file mode 100644 index 780e04e7ae..0000000000 --- a/mail/component-factory.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* component-factory.h - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 - */ - -#ifndef COMPONENT_FACTORY_H -#define COMPONENT_FACTORY_H - -#define COMPONENT_ID "OAFIID:GNOME_Evolution_Mail_ShellComponent" -#define SUMMARY_FACTORY_ID "OAFIID:GNOME_Evolution_Mail_ExecutiveSummaryComponentFactory" - -void component_factory_init (void); - -#endif diff --git a/mail/e-attchmt.png b/mail/e-attchmt.png Binary files differdeleted file mode 100644 index b4bac8db67..0000000000 --- a/mail/e-attchmt.png +++ /dev/null diff --git a/mail/e-searching-tokenizer.c b/mail/e-searching-tokenizer.c deleted file mode 100644 index 602dd3858d..0000000000 --- a/mail/e-searching-tokenizer.c +++ /dev/null @@ -1,1037 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * e-searching-tokenizer.c - * - * Copyright (C) 2001 Ximian, Inc. - * - * Developed by Jon Trowbridge <trow@ximian.com> - */ - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#include <string.h> -#include <ctype.h> -#include <gal/unicode/gunicode.h> -#include "e-searching-tokenizer.h" - -enum { - EST_MATCH_SIGNAL, - EST_LAST_SIGNAL -}; -guint e_searching_tokenizer_signals[EST_LAST_SIGNAL] = { 0 }; - -#define START_MAGIC "<\n>S<\n>" -#define END_MAGIC "<\n>E<\n>" - -static void e_searching_tokenizer_begin (HTMLTokenizer *, gchar *); -static void e_searching_tokenizer_end (HTMLTokenizer *); -static gchar *e_searching_tokenizer_peek_token (HTMLTokenizer *); -static gchar *e_searching_tokenizer_next_token (HTMLTokenizer *); -static gboolean e_searching_tokenizer_has_more (HTMLTokenizer *); - -static HTMLTokenizer *e_searching_tokenizer_clone (HTMLTokenizer *); - -static const gchar *ignored_tags[] = { "b", "i", NULL }; -static const gchar *space_tags[] = { "br", NULL }; - -GtkObjectClass *parent_class = NULL; - -/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/ - -typedef enum { - MATCH_FAILED = 0, - MATCH_COMPLETE, - MATCH_START, - MATCH_CONTINUES, - MATCH_END -} MatchInfo; - -typedef struct _SearchInfo SearchInfo; -struct _SearchInfo { - gchar *search; - gchar *current; - - gboolean case_sensitive; - gboolean allow_space_tags_to_match_whitespace; - - gint match_size_incr; - gchar *match_color; - gboolean match_bold; -}; - -typedef struct _SharedState SharedState; -struct _SharedState { - gint refs; - gchar *str_primary; - gchar *str_secondary; - gboolean case_sensitive_primary; - gboolean case_sensitive_secondary; -}; - -struct _ESearchingTokenizerPrivate { - gint match_count; - SearchInfo *search; - GList *pending; - GList *trash; - SharedState *shared; -}; - -/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/ - -static SharedState * -shared_state_new (void) -{ - SharedState *shared = g_new0 (SharedState, 1); - shared->refs = 1; - return shared; -} - -static void -shared_state_ref (SharedState *shared) -{ - g_return_if_fail (shared != NULL); - g_return_if_fail (shared->refs > 0); - ++shared->refs; -} - -static void -shared_state_unref (SharedState *shared) -{ - if (shared) { - g_return_if_fail (shared->refs > 0); - --shared->refs; - if (shared->refs == 0) { - g_free (shared->str_primary); - g_free (shared->str_secondary); - g_free (shared); - } - } -} - -/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/ - -static SearchInfo * -search_info_new (void) -{ - SearchInfo *si; - - si = g_new0 (SearchInfo, 1); - si->case_sensitive = FALSE; - - si->match_size_incr = 1; - si->match_color = g_strdup ("red"); - si->match_bold = FALSE; - - si->allow_space_tags_to_match_whitespace = TRUE; - - return si; -} - -static void -search_info_free (SearchInfo *si) -{ - if (si) { - g_free (si->search); - g_free (si->match_color); - g_free (si); - } -} - -static SearchInfo * -search_info_clone (SearchInfo *si) -{ - SearchInfo *new_si = NULL; - - if (si) { - new_si = search_info_new (); - new_si->search = g_strdup (si->search); - new_si->case_sensitive = si->case_sensitive; - } - - return new_si; -} - -static void -search_info_set_string (SearchInfo *si, const gchar *str) -{ - g_return_if_fail (si); - g_return_if_fail (str); - - g_free (si->search); - si->search = g_strdup (str); - si->current = NULL; -} - -static void -search_info_set_case_sensitivity (SearchInfo *si, gboolean flag) -{ - g_return_if_fail (si); - - si->case_sensitive = flag; -} - -#if 0 -static void -search_info_set_match_size_increase (SearchInfo *si, gint incr) -{ - g_return_if_fail (si); - g_return_if_fail (incr >= 0); - - si->match_size_incr = incr; -} -#endif - -static void -search_info_set_match_color (SearchInfo *si, const gchar *color) -{ - g_return_if_fail (si); - - g_free (si->match_color); - si->match_color = g_strdup (color); -} - -static void -search_info_set_match_bold (SearchInfo *si, gboolean flag) -{ - g_return_if_fail (si); - - si->match_bold = flag; -} - -static void -search_info_reset (SearchInfo *si) -{ - if (si == NULL) - return; - si->current = NULL; -} - -/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */ - -static const gchar * -find_whole (SearchInfo *si, const gchar *haystack, const gchar *needle) -{ - const gchar *h, *n; - - g_return_val_if_fail (si, NULL); - g_return_val_if_fail (haystack && needle, NULL); - g_return_val_if_fail (g_utf8_validate (haystack, -1, NULL), NULL); - g_return_val_if_fail (g_utf8_validate (needle, -1, NULL), NULL); - - while (*haystack) { - h = haystack; - n = needle; - while (*h && *n) { - gunichar c1 = g_utf8_get_char (h); - gunichar c2 = g_utf8_get_char (n); - - if (!si->case_sensitive) { - c1 = g_unichar_tolower (c1); - c2 = g_unichar_tolower (c2); - } - - if (c1 != c2) - break; - - h = g_utf8_next_char (h); - n = g_utf8_next_char (n); - } - if (*n == '\0') - return haystack; - if (*h == '\0') - return NULL; - haystack = g_utf8_next_char (haystack); - } - - return NULL; -} - -/* This is a really stupid implementation of this function. */ -static const gchar * -find_head (SearchInfo *si, const gchar *haystack, const gchar *needle) -{ - const gchar *h, *n; - - g_return_val_if_fail (si, NULL); - g_return_val_if_fail (haystack && needle, NULL); - g_return_val_if_fail (g_utf8_validate (haystack, -1, NULL), NULL); - g_return_val_if_fail (g_utf8_validate (needle, -1, NULL), NULL); - - while (*haystack) { - h = haystack; - n = needle; - while (*h && *n) { - gunichar c1 = g_utf8_get_char (h); - gunichar c2 = g_utf8_get_char (n); - - if (!si->case_sensitive) { - c1 = g_unichar_tolower (c1); - c2 = g_unichar_tolower (c2); - } - - if (c1 != c2) - break; - - h = g_utf8_next_char (h); - n = g_utf8_next_char (n); - } - if (*h == '\0') - return haystack; - haystack = g_utf8_next_char (haystack); - } - - return NULL; -} - -static const gchar * -find_partial (SearchInfo *si, const gchar *haystack, const gchar *needle) -{ - g_return_val_if_fail (si, NULL); - g_return_val_if_fail (haystack && needle, NULL); - g_return_val_if_fail (g_utf8_validate (haystack, -1, NULL), NULL); - g_return_val_if_fail (g_utf8_validate (needle, -1, NULL), NULL); - - while (*needle) { - gunichar c1 = g_utf8_get_char (haystack); - gunichar c2 = g_utf8_get_char (needle); - - if (!si->case_sensitive) { - c1 = g_unichar_tolower (c1); - c2 = g_unichar_tolower (c2); - } - - if (c1 != c2) - return NULL; - - needle = g_utf8_next_char (needle); - haystack = g_utf8_next_char (haystack); - } - return haystack; -} - -static gboolean -tag_match (const gchar *token, const gchar *tag) -{ - token += 2; /* Skip past TAG_ESCAPE and < */ - if (*token == '/') - ++token; - while (*token && *tag) { - gunichar c1 = g_unichar_tolower (g_utf8_get_char (token)); - gunichar c2 = g_unichar_tolower (g_utf8_get_char (tag)); - if (c1 != c2) - return FALSE; - token = g_utf8_next_char (token); - tag = g_utf8_next_char (tag); - } - return (*tag == '\0' && *token == '>'); -} - -static MatchInfo -search_info_compare (SearchInfo *si, const gchar *token, gint *start_pos, gint *end_pos) -{ - gboolean token_is_tag; - const gchar *s; - gint i; - - g_return_val_if_fail (si != NULL, MATCH_FAILED); - g_return_val_if_fail (token != NULL, MATCH_FAILED); - g_return_val_if_fail (start_pos != NULL, MATCH_FAILED); - g_return_val_if_fail (end_pos != NULL, MATCH_FAILED); - - token_is_tag = (*token == TAG_ESCAPE); - - /* Try to start a new match. */ - if (si->current == NULL) { - - /* A match can never start on a token. */ - if (token_is_tag) - return MATCH_FAILED; - - /* Check to see if the search string is entirely embedded within the token. */ - s = find_whole (si, token, si->search); - if (s) { - const gchar *pos = s; - i = g_utf8_strlen (si->search, -1); - while (i > 0) { - pos = g_utf8_next_char (pos); - --i; - } - *start_pos = s - token; - *end_pos = pos - token; - - return MATCH_COMPLETE; - } - - /* Check to see if the beginning of the search string lies in this token. */ - s = find_head (si, token, si->search); - if (s) { - *start_pos = s - token; - si->current = si->search; - while (*s) { - s = g_utf8_next_char (s); - si->current = g_utf8_next_char (si->current); - } - - return MATCH_START; - } - - return MATCH_FAILED; - } - - /* Try to continue a previously-started match. */ - - /* Deal with tags that we encounter mid-match. */ - if (token_is_tag) { - - /* "Ignored tags" will never mess up a match. */ - for (i=0; ignored_tags[i]; ++i) { - if (tag_match (token, ignored_tags[i])) - return MATCH_CONTINUES; - } - - /* "Space tags" only match whitespace in our ongoing match. */ - if (si->allow_space_tags_to_match_whitespace - && g_unichar_isspace (g_utf8_get_char (si->current))) { - for (i=0; space_tags[i]; ++i) { - if (tag_match (token, space_tags[i])) { - si->current = g_utf8_next_char (si->current); - return MATCH_CONTINUES; - } - } - } - - /* All other tags derail our match. */ - return MATCH_FAILED; - } - - s = find_partial (si, token, si->current); - if (s) { - if (start_pos) - *start_pos = 0; - if (end_pos) - *end_pos = s - token; - return MATCH_END; - } - - s = find_partial (si, si->current, token); - if (s) { - si->current = (gchar *) s; - return MATCH_CONTINUES; - } - - return MATCH_FAILED; -} - -/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/ - -static void -e_searching_tokenizer_cleanup (ESearchingTokenizer *st) -{ - g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st)); - - if (st->priv->trash) { - g_list_foreach (st->priv->trash, (GFunc) g_free, NULL); - g_list_free (st->priv->trash); - st->priv->trash = NULL; - } - - if (st->priv->pending) { - g_list_foreach (st->priv->pending, (GFunc) g_free, NULL); - g_list_free (st->priv->pending); - st->priv->pending = NULL; - } -} - -static void -e_searching_tokenizer_destroy (GtkObject *obj) -{ - ESearchingTokenizer *st = E_SEARCHING_TOKENIZER (obj); - - e_searching_tokenizer_cleanup (st); - - search_info_free (st->priv->search); - shared_state_unref (st->priv->shared); - - g_free (st->priv); - st->priv = NULL; - - if (parent_class->destroy) - parent_class->destroy (obj); -} - -static void -e_searching_tokenizer_class_init (ESearchingTokenizerClass *klass) -{ - GtkObjectClass *obj_class = (GtkObjectClass *) klass; - HTMLTokenizerClass *tok_class = HTML_TOKENIZER_CLASS (klass); - - e_searching_tokenizer_signals[EST_MATCH_SIGNAL] = - gtk_signal_new ("match", - GTK_RUN_LAST, - obj_class->type, - GTK_SIGNAL_OFFSET (ESearchingTokenizerClass, match), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, - 0); - gtk_object_class_add_signals (obj_class, e_searching_tokenizer_signals, EST_LAST_SIGNAL); - - obj_class->destroy = e_searching_tokenizer_destroy; - - tok_class->begin = e_searching_tokenizer_begin; - tok_class->end = e_searching_tokenizer_end; - - tok_class->peek_token = e_searching_tokenizer_peek_token; - tok_class->next_token = e_searching_tokenizer_next_token; - tok_class->has_more = e_searching_tokenizer_has_more; - tok_class->clone = e_searching_tokenizer_clone; - - parent_class = gtk_type_class (HTML_TYPE_TOKENIZER); -} - -static void -e_searching_tokenizer_init (ESearchingTokenizer *st) -{ - st->priv = g_new0 (struct _ESearchingTokenizerPrivate, 1); - st->priv->shared = shared_state_new (); -} - -GtkType -e_searching_tokenizer_get_type (void) -{ - static GtkType e_searching_tokenizer_type = 0; - if (! e_searching_tokenizer_type) { - static GtkTypeInfo e_searching_tokenizer_info = { - "ESearchingTokenizer", - sizeof (ESearchingTokenizer), - sizeof (ESearchingTokenizerClass), - (GtkClassInitFunc) e_searching_tokenizer_class_init, - (GtkObjectInitFunc) e_searching_tokenizer_init, - NULL, NULL, - (GtkClassInitFunc) NULL - }; - e_searching_tokenizer_type = gtk_type_unique (HTML_TYPE_TOKENIZER, - &e_searching_tokenizer_info); - } - return e_searching_tokenizer_type; -} - -HTMLTokenizer * -e_searching_tokenizer_new (void) -{ - return (HTMLTokenizer *) gtk_type_new (E_TYPE_SEARCHING_TOKENIZER); -} - -/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/ - -static GList * -g_list_remove_head (GList *x) -{ - GList *repl = NULL; - if (x) { - repl = g_list_remove_link (x, x); - g_list_free_1 (x); - } - return repl; -} - -/* I can't believe that there isn't a better way to do this. */ -static GList * -g_list_insert_before (GList *list, GList *llink, gpointer data) -{ - gint pos = g_list_position (list, llink); - return g_list_insert (list, data, pos); -} - -static gchar * -pop_pending (ESearchingTokenizer *st) -{ - gchar *token = NULL; - if (st->priv->pending) { - token = (gchar *) st->priv->pending->data; - st->priv->trash = g_list_prepend (st->priv->trash, token); - st->priv->pending = g_list_remove_head (st->priv->pending); - } - return token; -} - -static inline void -add_pending (ESearchingTokenizer *st, gchar *tok) -{ - st->priv->pending = g_list_append (st->priv->pending, tok); -} - -static void -add_pending_match_begin (ESearchingTokenizer *st, SearchInfo *si) -{ - gchar *size_str = NULL; - gchar *color_str= NULL; - - if (si->match_size_incr > 0) - size_str = g_strdup_printf (" size=+%d", si->match_size_incr); - if (si->match_color) - color_str = g_strdup_printf (" color=%s", si->match_color); - - if (size_str || color_str) - add_pending (st, g_strdup_printf ("%c<font%s%s>", - TAG_ESCAPE, - size_str ? size_str : "", - color_str ? color_str : "")); - - g_free (size_str); - g_free (color_str); - - if (si->match_bold) - add_pending (st, g_strdup_printf ("%c<b>", TAG_ESCAPE)); -} - -static void -add_pending_match_end (ESearchingTokenizer *st, SearchInfo *si) -{ - if (si->match_bold) - add_pending (st, g_strdup_printf ("%c</b>", TAG_ESCAPE)); - - if (si->match_size_incr > 0 || si->match_color) - add_pending (st, g_strdup_printf ("%c</font>", TAG_ESCAPE)); -} - -static void -add_to_trash (ESearchingTokenizer *st, gchar *txt) -{ - st->priv->trash = g_list_prepend (st->priv->trash, txt); -} - -static gchar * -get_next_token (ESearchingTokenizer *st) -{ - HTMLTokenizer *ht = HTML_TOKENIZER (st); - HTMLTokenizerClass *klass = HTML_TOKENIZER_CLASS (parent_class); - - return klass->has_more (ht) ? klass->next_token (ht) : NULL; -} - -/* - * Move the matched part of the queue into pending, replacing the start and end placeholders by - * the appropriate tokens. - */ -static GList * -queue_matched (ESearchingTokenizer *st, SearchInfo *si, GList *q) -{ - GList *qh = q; - gboolean post_start = FALSE; - - while (q != NULL) { - GList *q_next = g_list_next (q); - if (!strcmp ((gchar *) q->data, START_MAGIC)) { - add_pending_match_begin (st, si); - post_start = TRUE; - } else if (!strcmp ((gchar *) q->data, END_MAGIC)) { - add_pending_match_end (st, si); - q_next = NULL; - } else { - gboolean is_tag = *((gchar *)q->data) == TAG_ESCAPE; - if (is_tag && post_start) - add_pending_match_end (st, si); - add_pending (st, g_strdup ((gchar *) q->data)); - if (is_tag && post_start) - add_pending_match_begin (st, si); - } - qh = g_list_remove_link (qh, q); - g_list_free_1 (q); - q = q_next; - } - - return qh; -} - -/* - * Strip the start and end placeholders out of the queue. - */ -static GList * -queue_match_failed (ESearchingTokenizer *st, GList *q) -{ - GList *qh = q; - - /* If we do find the START_MAGIC token in the queue, we want - to drop everything up to and including the token immediately - following START_MAGIC. */ - while (q != NULL && strcmp ((gchar *) q->data, START_MAGIC)) - q = g_list_next (q); - if (q) { - q = g_list_next (q); - /* If there is no token following START_MAGIC, something is - very wrong. */ - if (q == NULL) { - g_assert_not_reached (); - } - } - - /* Otherwise we just want to just drop the the first token. */ - if (q == NULL) - q = qh; - - /* Now move everything up to and including q to pending. */ - while (qh && qh != q) { - if (strcmp ((gchar *) qh->data, START_MAGIC)) - add_pending (st, g_strdup (qh->data)); - qh = g_list_remove_head (qh); - } - if (qh == q) { - if (strcmp ((gchar *) qh->data, START_MAGIC)) - add_pending (st, g_strdup (qh->data)); - qh = g_list_remove_head (qh); - } - - return qh; -} - -static void -matched (ESearchingTokenizer *st) -{ - ++st->priv->match_count; - gtk_signal_emit (GTK_OBJECT (st), e_searching_tokenizer_signals[EST_MATCH_SIGNAL]); -} - -static void -get_pending_tokens (ESearchingTokenizer *st) -{ - GList *queue = NULL; - gchar *token = NULL; - MatchInfo result; - gint start_pos, end_pos; - GList *start_after = NULL; - - /* Get an initial token into the queue. */ - token = get_next_token (st); - if (token) { - queue = g_list_append (queue, token); - } - - while (queue) { - GList *q; - gboolean finished = FALSE; - search_info_reset (st->priv->search); - - if (start_after) { - q = g_list_next (start_after); - start_after = NULL; - } else { - q = queue; - } - - while (q) { - GList *q_next = g_list_next (q); - token = (gchar *) q->data; - - result = search_info_compare (st->priv->search, token, &start_pos, &end_pos); - - switch (result) { - - case MATCH_FAILED: - - queue = queue_match_failed (st, queue); - - finished = TRUE; - break; - - case MATCH_COMPLETE: - - if (start_pos != 0) - add_pending (st, g_strndup (token, start_pos)); - add_pending_match_begin (st, st->priv->search); - add_pending (st, g_strndup (token+start_pos, end_pos-start_pos)); - add_pending_match_end (st, st->priv->search); - if (*(token+end_pos)) { - queue->data = g_strdup (token+end_pos); - add_to_trash (st, (gchar *) queue->data); - } else { - queue = g_list_remove_head (queue); - } - - matched (st); - - finished = TRUE; - break; - - case MATCH_START: { - - gchar *s1 = g_strndup (token, start_pos); - gchar *s2 = g_strdup (START_MAGIC); - gchar *s3 = g_strdup (token+start_pos); - - queue = g_list_insert_before (queue, q, s1); - queue = g_list_insert_before (queue, q, s2); - queue = g_list_insert_before (queue, q, s3); - - add_to_trash (st, s1); - add_to_trash (st, s2); - add_to_trash (st, s3); - - queue = g_list_remove_link (queue, q); - - finished = FALSE; - break; - } - - case MATCH_CONTINUES: - /* Do nothing... */ - finished = FALSE; - break; - - case MATCH_END: { - gchar *s1 = g_strndup (token, end_pos); - gchar *s2 = g_strdup (END_MAGIC); - gchar *s3 = g_strdup (token+end_pos); - - queue = g_list_insert_before (queue, q, s1); - queue = g_list_insert_before (queue, q, s2); - queue = g_list_insert_before (queue, q, s3); - - add_to_trash (st, s1); - add_to_trash (st, s2); - add_to_trash (st, s3); - - queue = g_list_remove_link (queue, q); - queue = queue_matched (st, st->priv->search, queue); - - matched (st); - - finished = TRUE; - break; - } - - default: - g_assert_not_reached (); - } - - /* If we reach the end of the queue but we aren't finished, try to pull in another - token and stick it onto the end. */ - if (q_next == NULL && !finished) { - gchar *next_token = get_next_token (st); - if (next_token) { - queue = g_list_append (queue, next_token); - q_next = g_list_last (queue); - } - } - q = finished ? NULL : q_next; - - } /* while (q) */ - - if (!finished && queue) { /* ...we add the token at the head of the queue to pending and try again. */ - add_pending (st, g_strdup ((gchar *) queue->data)); - queue = g_list_remove_head (queue); - } - - } /* while (queue) */ -} - -/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/ - -static void -e_searching_tokenizer_begin (HTMLTokenizer *t, gchar *content_type) -{ - ESearchingTokenizer *st = E_SEARCHING_TOKENIZER (t); - SearchInfo *si; - - /* Reset our search */ - search_info_free (st->priv->search); - st->priv->search = NULL; - - if (st->priv->shared && (st->priv->shared->str_primary || st->priv->shared->str_secondary)) { - st->priv->search = search_info_new (); - } - si = st->priv->search; - - if (st->priv->shared && si) { - if (st->priv->shared->str_primary) { - - search_info_set_string (si, st->priv->shared->str_primary); - search_info_set_case_sensitivity (si, st->priv->shared->case_sensitive_primary); - - search_info_set_match_color (si, "red"); - search_info_set_match_bold (si, TRUE); - - } else if (st->priv->shared->str_secondary) { - - search_info_set_string (si, st->priv->shared->str_secondary); - search_info_set_case_sensitivity (si, st->priv->shared->case_sensitive_secondary); - - search_info_set_match_color (si, "purple"); - search_info_set_match_bold (si, TRUE); - } - - } else { - - search_info_free (st->priv->search); - st->priv->search = NULL; - - } - - e_searching_tokenizer_cleanup (st); - search_info_reset (st->priv->search); - - st->priv->match_count = 0; - - HTML_TOKENIZER_CLASS (parent_class)->begin (t, content_type); -} - -static void -e_searching_tokenizer_end (HTMLTokenizer *t) -{ - ESearchingTokenizer *st = E_SEARCHING_TOKENIZER (t); - e_searching_tokenizer_cleanup (st); - - HTML_TOKENIZER_CLASS (parent_class)->end (t); -} - -static gchar * -e_searching_tokenizer_peek_token (HTMLTokenizer *tok) -{ - ESearchingTokenizer *st = E_SEARCHING_TOKENIZER (tok); - - /* If no search is active, just use the default method. */ - if (st->priv->search == NULL) - return HTML_TOKENIZER_CLASS (parent_class)->peek_token (tok); - - if (st->priv->pending == NULL) - get_pending_tokens (st); - return st->priv->pending ? (gchar *) st->priv->pending->data : NULL; -} - -static gchar * -e_searching_tokenizer_next_token (HTMLTokenizer *tok) -{ - ESearchingTokenizer *st = E_SEARCHING_TOKENIZER (tok); - - /* If no search is active, just use the default method. */ - if (st->priv->search == NULL) - return HTML_TOKENIZER_CLASS (parent_class)->next_token (tok); - - if (st->priv->pending == NULL) - get_pending_tokens (st); - return pop_pending (st); -} - -static gboolean -e_searching_tokenizer_has_more (HTMLTokenizer *tok) -{ - ESearchingTokenizer *st = E_SEARCHING_TOKENIZER (tok); - - /* If no search is active, pending will always be NULL and thus - we'll always fall back to using the default method. */ - - return st->priv->pending || HTML_TOKENIZER_CLASS (parent_class)->has_more (tok); -} - -static HTMLTokenizer * -e_searching_tokenizer_clone (HTMLTokenizer *tok) -{ - ESearchingTokenizer *orig_st = E_SEARCHING_TOKENIZER (tok); - ESearchingTokenizer *new_st = E_SEARCHING_TOKENIZER (e_searching_tokenizer_new ()); - - if (new_st->priv->search) { - search_info_free (new_st->priv->search); - } - - new_st->priv->search = search_info_clone (orig_st->priv->search); - - shared_state_ref (orig_st->priv->shared); - shared_state_unref (new_st->priv->shared); - new_st->priv->shared = orig_st->priv->shared; - - gtk_signal_connect_object (GTK_OBJECT (new_st), - "match", - GTK_SIGNAL_FUNC (matched), - GTK_OBJECT (orig_st)); - - return HTML_TOKENIZER (new_st); -} -/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */ - -static gboolean -only_whitespace (const gchar *p) -{ - gunichar c; - g_return_val_if_fail (p, FALSE); - - while (*p && g_unichar_validate (c = g_utf8_get_char (p))) { - if (!g_unichar_isspace (c)) - return FALSE; - p = g_utf8_next_char (p); - } - return TRUE; -} - -void -e_searching_tokenizer_set_primary_search_string (ESearchingTokenizer *st, const gchar *search_str) -{ - g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st)); - - g_free (st->priv->shared->str_primary); - st->priv->shared->str_primary = NULL; - - if (search_str != NULL - && g_utf8_validate (search_str, -1, NULL) - && !only_whitespace (search_str)) { - - st->priv->shared->str_primary = g_strdup (search_str); - } -} - -void -e_searching_tokenizer_set_primary_case_sensitivity (ESearchingTokenizer *st, gboolean is_case_sensitive) -{ - g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st)); - - st->priv->shared->case_sensitive_primary = is_case_sensitive; -} - -void -e_searching_tokenizer_set_secondary_search_string (ESearchingTokenizer *st, const gchar *search_str) -{ - g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st)); - - g_free (st->priv->shared->str_secondary); - st->priv->shared->str_secondary = NULL; - - if (search_str != NULL - && g_utf8_validate (search_str, -1, NULL) - && !only_whitespace (search_str)) { - - st->priv->shared->str_secondary = g_strdup (search_str); - } -} - -void -e_searching_tokenizer_set_secondary_case_sensitivity (ESearchingTokenizer *st, gboolean is_case_sensitive) -{ - g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st)); - - st->priv->shared->case_sensitive_secondary = is_case_sensitive; -} - -gint -e_searching_tokenizer_match_count (ESearchingTokenizer *st) -{ - g_return_val_if_fail (st && E_IS_SEARCHING_TOKENIZER (st), -1); - - return st->priv->match_count; -} - - - diff --git a/mail/e-searching-tokenizer.h b/mail/e-searching-tokenizer.h deleted file mode 100644 index d3dd7647f4..0000000000 --- a/mail/e-searching-tokenizer.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * e-searching-tokenizer.h - * - * Copyright (C) 2001 Ximian, Inc. - * - * Developed by Jon Trowbridge <trow@ximian.com> - */ - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 __E_SEARCHING_TOKENIZER_H__ -#define __E_SEARCHING_TOKENIZER_H__ - -#include <glib.h> -#include <gtkhtml/htmltokenizer.h> - -#define E_TYPE_SEARCHING_TOKENIZER (e_searching_tokenizer_get_type ()) -#define E_SEARCHING_TOKENIZER(o) (GTK_CHECK_CAST ((o), E_TYPE_SEARCHING_TOKENIZER, ESearchingTokenizer)) -#define E_SEARCHING_TOKENIZER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), E_TYPE_SEARCHING_TOKENIZER, ESearchingTokenizerClass)) -#define E_IS_SEARCHING_TOKENIZER(o) (GTK_CHECK_TYPE ((o), E_TYPE_SEARCHING_TOKENIZER)) -#define E_IS_SEARCHING_TOKENIZER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TYPE_SEARCHING_TOKENIZER)) - -typedef struct _ESearchingTokenizer ESearchingTokenizer; -typedef struct _ESearchingTokenizerClass ESearchingTokenizerClass; - -struct _ESearchingTokenizerPrivate; - -struct _ESearchingTokenizer { - HTMLTokenizer parent; - - struct _ESearchingTokenizerPrivate *priv; -}; - -struct _ESearchingTokenizerClass { - HTMLTokenizerClass parent_class; - - void (*match) (ESearchingTokenizer *); -}; - -GtkType e_searching_tokenizer_get_type (void); - -HTMLTokenizer *e_searching_tokenizer_new (void); - -/* For now, just a simple API */ - -void e_searching_tokenizer_set_primary_search_string (ESearchingTokenizer *, const gchar *); -void e_searching_tokenizer_set_primary_case_sensitivity (ESearchingTokenizer *, gboolean is_case_sensitive); - -void e_searching_tokenizer_set_secondary_search_string (ESearchingTokenizer *, const gchar *); -void e_searching_tokenizer_set_secondary_case_sensitivity (ESearchingTokenizer *, gboolean is_case_sensitive); - - -gint e_searching_tokenizer_match_count (ESearchingTokenizer *); - - -#endif /* __E_SEARCHING_TOKENIZER_H__ */ - diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c deleted file mode 100644 index 52f39a8218..0000000000 --- a/mail/folder-browser-factory.c +++ /dev/null @@ -1,211 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * folder-browser-factory.c: A Bonobo Control factory for Folder Browsers - * - * Author: - * Miguel de Icaza (miguel@ximian.com) - * - * (C) 2000 Ximian, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo/bonobo-main.h> -#include <bonobo/bonobo-object.h> -#include <bonobo/bonobo-generic-factory.h> -#include <bonobo/bonobo-control.h> -#include <bonobo/bonobo-ui-component.h> -#include <bonobo/bonobo-ui-util.h> - -#include <gal/util/e-util.h> -#include <gal/widgets/e-gui-utils.h> - -#include "widgets/menus/gal-view-menus.h" - -#include <gal/menus/gal-view-factory-etable.h> -#include <gal/menus/gal-view-etable.h> - -#include "folder-browser-factory.h" - -#include "folder-browser.h" -#include "folder-browser-ui.h" -#include "mail.h" -#include "mail-callbacks.h" -#include "shell/Evolution.h" -#include "mail-config.h" -#include "mail-ops.h" -#include "mail-session.h" -#include "mail-folder-cache.h" - -#include "evolution-shell-component-utils.h" - -/* The FolderBrowser BonoboControls we have. */ -static EList *control_list = NULL; - -/* copied from mail-display.c for now.... */ -static GNOME_Evolution_ShellView -fb_get_svi (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) - g_warning ("Control frame doesn't have Evolution/ShellView."); - - return shell_view_interface; -} - -static void -control_activate (BonoboControl *control, - BonoboUIComponent *uic, - FolderBrowser *fb) -{ - GtkWidget *folder_browser; - Bonobo_UIContainer container; - - container = bonobo_control_get_remote_ui_container (control); - bonobo_ui_component_set_container (uic, container); - bonobo_object_release_unref (container, NULL); - - g_assert (container == bonobo_ui_component_get_container (uic)); - g_return_if_fail (container != CORBA_OBJECT_NIL); - - folder_browser = bonobo_control_get_widget (control); - folder_browser_set_ui_component (FOLDER_BROWSER (folder_browser), uic); - - /*bonobo_ui_component_freeze (uic, NULL);*/ - - folder_browser_ui_add_global (fb); - folder_browser_ui_add_list (fb); - folder_browser_ui_add_message (fb); - - /*bonobo_ui_component_thaw (uic, NULL);*/ - - folder_browser_set_shell_view(fb, fb_get_svi (control)); - - if (fb->folder) - mail_refresh_folder (fb->folder, NULL, NULL); -} - -static void -control_deactivate (BonoboControl *control, - BonoboUIComponent *uic, - FolderBrowser *fb) -{ - /*bonobo_ui_component_freeze (uic, NULL);*/ - - folder_browser_ui_rm_list (fb); - folder_browser_ui_rm_all (fb); - - /*bonobo_ui_component_thaw (uic, NULL);*/ - - if (fb->folder) - mail_sync_folder (fb->folder, NULL, NULL); - - folder_browser_set_ui_component (fb, NULL); - folder_browser_set_shell_view (fb, CORBA_OBJECT_NIL); -} - -static void -control_activate_cb (BonoboControl *control, - gboolean activate, - gpointer user_data) -{ - BonoboUIComponent *uic; - - uic = bonobo_control_get_ui_component (control); - g_assert (uic != NULL); - - if (activate) - control_activate (control, uic, user_data); - else - control_deactivate (control, uic, user_data); -} - -static void -control_destroy_cb (BonoboControl *control, - GtkObject *folder_browser) -{ - gtk_object_destroy (folder_browser); -} - -static void -browser_destroy_cb (FolderBrowser *fb, - BonoboControl *control) -{ - EIterator *it; - - /* We do this from browser_destroy_cb rather than - * control_destroy_cb because currently, the controls - * don't seem to all get destroyed properly at quit - * time (but the widgets get destroyed by X). FIXME. - */ - - for (it = e_list_get_iterator (control_list); e_iterator_is_valid (it); e_iterator_next (it)) { - if (e_iterator_get (it) == control) { - e_iterator_delete (it); - break; - } - } - gtk_object_unref (GTK_OBJECT (it)); -} - -BonoboControl * -folder_browser_factory_new_control (const char *uri, - const GNOME_Evolution_Shell shell) -{ - BonoboControl *control; - GtkWidget *folder_browser; - - folder_browser = folder_browser_new (shell, uri); - if (folder_browser == NULL) - return NULL; - - FOLDER_BROWSER (folder_browser)->pref_master = TRUE; /* save UI settings changed in this FB */ - - gtk_widget_show (folder_browser); - - control = bonobo_control_new (folder_browser); - - if (control == NULL) { - gtk_object_unref (GTK_OBJECT (folder_browser)); - return NULL; - } - - gtk_signal_connect (GTK_OBJECT (control), "activate", - control_activate_cb, folder_browser); - - gtk_signal_connect (GTK_OBJECT (control), "destroy", - control_destroy_cb, folder_browser); - gtk_signal_connect (GTK_OBJECT (folder_browser), "destroy", - browser_destroy_cb, control); - - if (!control_list) - control_list = e_list_new (NULL, NULL, NULL); - - e_list_append (control_list, control); - - return control; -} - -EList * -folder_browser_factory_get_control_list (void) -{ - if (!control_list) - control_list = e_list_new (NULL, NULL, NULL); - return control_list; -} diff --git a/mail/folder-browser-factory.h b/mail/folder-browser-factory.h deleted file mode 100644 index a279e6abd0..0000000000 --- a/mail/folder-browser-factory.h +++ /dev/null @@ -1,22 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * folder-browser-factory.c: A Bonobo Control factory for Folder Browsers - * - * Author: - * Miguel de Icaza (miguel@ximian.com) - * - * (C) 2000 Ximian, Inc. - */ - -#ifndef _FOLDER_BROWSER_FACTORY_H -#define _FOLDER_BROWSER_FACTORY_H - -#include <bonobo/bonobo-control.h> -#include "Evolution.h" -#include "e-util/e-list.h" - -BonoboControl *folder_browser_factory_new_control (const char *uri, - const GNOME_Evolution_Shell shell); -EList *folder_browser_factory_get_control_list (void); - -#endif /* _FOLDER_BROWSER_FACTORY_H */ diff --git a/mail/folder-browser-ui.c b/mail/folder-browser-ui.c deleted file mode 100644 index 4099be2ce3..0000000000 --- a/mail/folder-browser-ui.c +++ /dev/null @@ -1,614 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * folder-browser-ui.c: Sets up the Bonobo UI for FolderBrowsers - * - * Author: - * Peter Williams <peterw@ximian.com> - * - * (C) 2001 Ximian, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-util.h> /* gnome_util_prepend_user_home */ - -#include <bonobo/bonobo-ui-component.h> -#include <bonobo/bonobo-ui-util.h> - -#include "widgets/misc/e-charset-picker.h" -#include "widgets/menus/gal-view-menus.h" /* GalView stuff */ -#include <gal/menus/gal-view-factory-etable.h> -#include <gal/menus/gal-view-etable.h> - -#include "mail-callbacks.h" /* almost all the verbs */ -#include "mail-session.h" /* mail_session_forget_passwords */ - -#include "folder-browser-ui.h" - -#include "evolution-shell-component-utils.h" /* Pixmap stuff */ - - -/* - * Add with 'folder_browser' - */ - -static BonoboUIVerb message_verbs [] = { - BONOBO_UI_UNSAFE_VERB ("MailNext", next_msg), - BONOBO_UI_UNSAFE_VERB ("MailNextFlagged", next_flagged_msg), - BONOBO_UI_UNSAFE_VERB ("MailNextUnread", next_unread_msg), -/* BONOBO_UI_UNSAFE_VERB ("MailNextThread", next_thread),*/ - BONOBO_UI_UNSAFE_VERB ("MailPrevious", previous_msg), - BONOBO_UI_UNSAFE_VERB ("MailPreviousFlagged", previous_flagged_msg), - BONOBO_UI_UNSAFE_VERB ("MailPreviousUnread", previous_unread_msg), - BONOBO_UI_UNSAFE_VERB ("MessageApplyFilters", apply_filters), - BONOBO_UI_UNSAFE_VERB ("MessageCopy", copy_msg), - BONOBO_UI_UNSAFE_VERB ("MessageDelete", delete_msg), - BONOBO_UI_UNSAFE_VERB ("MessageForward", forward), - BONOBO_UI_UNSAFE_VERB ("MessageForwardAttached", forward_attached), - BONOBO_UI_UNSAFE_VERB ("MessageForwardInline", forward_inline), - BONOBO_UI_UNSAFE_VERB ("MessageForwardQuoted", forward_quoted), - BONOBO_UI_UNSAFE_VERB ("MessageMarkAsRead", mark_as_seen), - BONOBO_UI_UNSAFE_VERB ("MessageMarkAsUnRead", mark_as_unseen), - BONOBO_UI_UNSAFE_VERB ("MessageMarkAsImportant", mark_as_important), - BONOBO_UI_UNSAFE_VERB ("MessageMarkAsUnimportant", mark_as_unimportant), - BONOBO_UI_UNSAFE_VERB ("MessageMove", move_msg), - BONOBO_UI_UNSAFE_VERB ("MessageOpen", open_message), - BONOBO_UI_UNSAFE_VERB ("MessageReplyAll", reply_to_all), - BONOBO_UI_UNSAFE_VERB ("MessageReplyList", reply_to_list), - BONOBO_UI_UNSAFE_VERB ("MessageReplySender", reply_to_sender), - BONOBO_UI_UNSAFE_VERB ("MessageResend", resend_msg), - BONOBO_UI_UNSAFE_VERB ("MessageSaveAs", save_msg), - BONOBO_UI_UNSAFE_VERB ("MessageSearch", search_msg), - BONOBO_UI_UNSAFE_VERB ("MessageUndelete", undelete_msg), - BONOBO_UI_UNSAFE_VERB ("PrintMessage", print_msg), - BONOBO_UI_UNSAFE_VERB ("TextZoomIn", zoom_in), - BONOBO_UI_UNSAFE_VERB ("TextZoomOut", zoom_out), - BONOBO_UI_UNSAFE_VERB ("TextZoomReset", zoom_reset), - BONOBO_UI_UNSAFE_VERB ("PrintPreviewMessage", print_preview_msg), - BONOBO_UI_UNSAFE_VERB ("ToolsFilterMailingList", filter_mlist), - BONOBO_UI_UNSAFE_VERB ("ToolsFilterRecipient", filter_recipient), - BONOBO_UI_UNSAFE_VERB ("ToolsFilterSender", filter_sender), - BONOBO_UI_UNSAFE_VERB ("ToolsFilterSubject", filter_subject), - BONOBO_UI_UNSAFE_VERB ("ToolsVFolderMailingList", vfolder_mlist), - BONOBO_UI_UNSAFE_VERB ("ToolsVFolderRecipient", vfolder_recipient), - BONOBO_UI_UNSAFE_VERB ("ToolsVFolderSender", vfolder_sender), - BONOBO_UI_UNSAFE_VERB ("ToolsVFolderSubject", vfolder_subject), - BONOBO_UI_UNSAFE_VERB ("ViewLoadImages", load_images), - /* ViewHeaders stuff is a radio */ - - BONOBO_UI_VERB_END -}; - -static BonoboUIVerb list_verbs [] = { - BONOBO_UI_UNSAFE_VERB ("EditCut", folder_browser_cut), - BONOBO_UI_UNSAFE_VERB ("EditCopy", folder_browser_copy), - BONOBO_UI_UNSAFE_VERB ("EditPaste", folder_browser_paste), - BONOBO_UI_UNSAFE_VERB ("EditInvertSelection", invert_selection), - BONOBO_UI_UNSAFE_VERB ("EditSelectAll", select_all), - BONOBO_UI_UNSAFE_VERB ("EditSelectThread", select_thread), - BONOBO_UI_UNSAFE_VERB ("ChangeFolderProperties", configure_folder), - BONOBO_UI_UNSAFE_VERB ("FolderExpunge", expunge_folder), - /* HideDeleted is a toggle */ - BONOBO_UI_UNSAFE_VERB ("MessageMarkAllAsRead", mark_all_as_seen), - BONOBO_UI_UNSAFE_VERB ("ViewHideRead", hide_read), - BONOBO_UI_UNSAFE_VERB ("ViewHideSelected", hide_selected), - BONOBO_UI_UNSAFE_VERB ("ViewShowAll", hide_none), - /* ViewThreaded is a toggle */ - - BONOBO_UI_VERB_END -}; - -static BonoboUIVerb global_verbs [] = { - BONOBO_UI_UNSAFE_VERB ("EmptyTrash", empty_trash), - BONOBO_UI_UNSAFE_VERB ("ForgetPasswords", mail_session_forget_passwords), - BONOBO_UI_UNSAFE_VERB ("MailCompose", compose_msg), - BONOBO_UI_UNSAFE_VERB ("MailGetSend", send_receive_mail), - BONOBO_UI_UNSAFE_VERB ("MailStop", stop_threads), - BONOBO_UI_UNSAFE_VERB ("ToolsFilters", filter_edit), - BONOBO_UI_UNSAFE_VERB ("ToolsSettings", providers_config), - BONOBO_UI_UNSAFE_VERB ("ToolsSubscriptions", manage_subscriptions), - BONOBO_UI_UNSAFE_VERB ("ToolsVFolders", vfolder_edit_vfolders), - /* ViewPreview is a toggle */ - - BONOBO_UI_VERB_END -}; - -static EPixmap message_pixcache [] = { - E_PIXMAP ("/commands/PrintMessage", "print.xpm"), - E_PIXMAP ("/commands/PrintPreviewMessage", "print-preview.xpm"), - E_PIXMAP ("/commands/MessageDelete", "evolution-trash-mini.png"), - E_PIXMAP ("/commands/MessageUndelete", "undelete_message-16.png"), - E_PIXMAP ("/commands/MessageCopy", "copy_16_message.xpm"), - E_PIXMAP ("/commands/MessageMove", "move_message.xpm"), - E_PIXMAP ("/commands/MessageReplyAll", "reply_to_all.xpm"), - E_PIXMAP ("/commands/MessageReplySender", "reply.xpm"), - E_PIXMAP ("/commands/MessageForward", "forward.xpm"), - E_PIXMAP ("/commands/MessageApplyFilters", "apply-filters-16.xpm"), - E_PIXMAP ("/commands/MessageSearch", "search-16.png"), - E_PIXMAP ("/commands/MessageSaveAs", "save-as-16.png"), - - E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageReplySender", "buttons/reply.png"), - E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageReplyAll", "buttons/reply-to-all.png"), - E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageForward", "buttons/forward.png"), - E_PIXMAP ("/Toolbar/MailMessageToolbar/PrintMessage", "buttons/print.png"), - E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageMove", "buttons/move-message.png"), - E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageCopy", "buttons/copy-message.png"), - E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageDelete", "buttons/delete-message.png"), - - E_PIXMAP ("/Toolbar/MailNextButtons/MailNext", "buttons/next-message.png"), - E_PIXMAP ("/Toolbar/MailNextButtons/MailPrevious", "buttons/previous-message.png"), - - E_PIXMAP_END -}; - -static EPixmap list_pixcache [] = { - E_PIXMAP ("/commands/ChangeFolderProperties", "configure_16_folder.xpm"), - E_PIXMAP ("/commands/ViewHideRead", "hide_read_messages.xpm"), - E_PIXMAP ("/commands/ViewHideSelected", "hide_selected_messages.xpm"), - E_PIXMAP ("/commands/ViewShowAll", "show_all_messages.xpm"), - - E_PIXMAP ("/commands/EditCut", "16_cut.png"), - E_PIXMAP ("/commands/EditCopy", "16_copy.png"), - E_PIXMAP ("/commands/EditPaste", "16_paste.png"), - - E_PIXMAP_END -}; - -static EPixmap global_pixcache [] = { - E_PIXMAP ("/commands/MailCompose", "new-message.xpm"), - E_PIXMAP ("/commands/MailGetSend", "send-receive.xpm"), - E_PIXMAP ("/commands/ToolsSettings", "configure_16_mail.xpm"), - - E_PIXMAP ("/Toolbar/MailGetSend", "buttons/send-24-receive.png"), - E_PIXMAP ("/Toolbar/MailCompose", "buttons/compose-message.png"), - - E_PIXMAP_END -}; - -static void ui_add (FolderBrowser *fb, - const gchar *name, - BonoboUIVerb verb[], - EPixmap pixcache[]) -{ - BonoboUIComponent *uic = fb->uicomp; - char *file; - - bonobo_ui_component_add_verb_list_with_data (uic, verb, fb); - - /*bonobo_ui_component_freeze (uic, NULL);*/ - - file = g_strconcat ("evolution-mail-", name, ".xml", NULL); - bonobo_ui_util_set_ui (uic, EVOLUTION_DATADIR, file, "evolution-mail"); - g_free (file); - - e_pixmaps_update (uic, pixcache); - - /*bonobo_ui_component_thaw (uic, NULL);*/ -} - -/* more complex stuff */ - -static void -display_view(GalViewCollection *collection, - GalView *view, - gpointer data) -{ - FolderBrowser *fb = data; - if (GAL_IS_VIEW_ETABLE(view)) { - e_tree_set_state_object(fb->message_list->tree, GAL_VIEW_ETABLE(view)->state); - } -} - -static void -folder_browser_setup_view_menus (FolderBrowser *fb, - BonoboUIComponent *uic) -{ - GalViewFactory *factory; - ETableSpecification *spec; - char *local_dir; - - g_assert (fb->view_collection == NULL); - g_assert (fb->view_menus == NULL); - - fb->view_collection = gal_view_collection_new(); - - local_dir = gnome_util_prepend_user_home ("/evolution/views/mail/"); - gal_view_collection_set_storage_directories( - fb->view_collection, - EVOLUTION_DATADIR "/evolution/views/mail/", - local_dir); - g_free (local_dir); - - spec = e_table_specification_new(); - e_table_specification_load_from_file(spec, EVOLUTION_ETSPECDIR "/message-list.etspec"); - - factory = gal_view_factory_etable_new (spec); - gtk_object_unref (GTK_OBJECT (spec)); - gal_view_collection_add_factory (fb->view_collection, factory); - gtk_object_unref (GTK_OBJECT (factory)); - - gal_view_collection_load(fb->view_collection); - - fb->view_menus = gal_view_menus_new(fb->view_collection); - gal_view_menus_apply(fb->view_menus, uic, NULL); - gtk_signal_connect(GTK_OBJECT(fb->view_collection), "display_view", - display_view, fb); -} - -/* Gets rid of the view collection and view menus objects */ -static void -folder_browser_discard_view_menus (FolderBrowser *fb) -{ - g_assert (fb->view_collection != NULL); - g_assert (fb->view_menus != NULL); - - gtk_object_unref (GTK_OBJECT (fb->view_collection)); - fb->view_collection = NULL; - - gtk_object_unref (GTK_OBJECT (fb->view_menus)); - fb->view_menus = NULL; -} - -static void -folder_browser_setup_property_menu (FolderBrowser *fb, - BonoboUIComponent *uic) -{ - char *name, *base = NULL; - CamelURL *url; - - url = camel_url_new(fb->uri, NULL); - if (url) { - if (url->fragment) - base = g_basename(url->fragment); - else - base = g_basename(url->path); - } - - if (base && base [0] != 0) - name = g_strdup_printf (_("Properties for \"%s\""), base); - else - name = g_strdup (_("Properties")); - - bonobo_ui_component_set_prop ( - uic, "/menu/File/Folder/ComponentPlaceholder/ChangeFolderProperties", - "label", name, NULL); - g_free (name); - - if (url) - camel_url_free(url); - - fbui_sensitise_item(fb, "ChangeFolderProperties", (strncmp(fb->uri, "vfolder:", 8) == 0 || strncmp(fb->uri, "file:", 5) == 0)); -} - -/* Must be in the same order as MailConfigDisplayStyle */ -/* used in folder-browser.c as well (therefore not static) */ -char *message_display_styles[] = { - "/commands/ViewNormal", - "/commands/ViewFullHeaders", - "/commands/ViewSource" -}; - -/* public */ - -void -folder_browser_ui_add_message (FolderBrowser *fb) -{ - int state; - BonoboUIComponent *uic = fb->uicomp; - FolderBrowserSelectionState prev_state; - - ui_add (fb, "message", message_verbs, message_pixcache); - - /* Display Style */ - state = fb->mail_display->display_style; - bonobo_ui_component_set_prop (uic, message_display_styles[state], - "state", "1", NULL); - bonobo_ui_component_add_listener (uic, "ViewNormal", folder_browser_set_message_display_style, fb); - bonobo_ui_component_add_listener (uic, "ViewFullHeaders", folder_browser_set_message_display_style, fb); - bonobo_ui_component_add_listener (uic, "ViewSource", folder_browser_set_message_display_style, fb); - /* FIXME: this kind of bypasses bonobo but seems the only way when we change components */ - folder_browser_set_message_display_style (uic, strrchr (message_display_styles[state], '/') + 1, - Bonobo_UIComponent_STATE_CHANGED, "1", fb); - - /* Resend Message */ - if (fb->folder && !folder_browser_is_sent (fb)) - fbui_sensitise_item(fb, "MessageResend", FALSE); - - /* sensitivity of message-specific commands */ - prev_state = fb->selection_state; - fb->selection_state = FB_SELSTATE_UNDEFINED; - folder_browser_ui_set_selection_state (fb, prev_state); - - /* Charset picker */ - e_charset_picker_bonobo_ui_populate (uic, "/menu/View", FB_DEFAULT_CHARSET, - folder_browser_charset_changed, - fb); -} - -/* -void -folder_browser_ui_rm_message (FolderBrowser *fb) -{ - ui_rm (fb, "message", message_verbs, message_pixcache); -} -*/ - -void -folder_browser_ui_add_list (FolderBrowser *fb) -{ - int state; - BonoboUIComponent *uic = fb->uicomp; - - ui_add (fb, "list", list_verbs, list_pixcache); - - /* Hide Deleted */ - if (fb->folder && (fb->folder->folder_flags & CAMEL_FOLDER_IS_TRASH)) { - fbui_sensitise_item(fb, "HideDeleted", FALSE); - state = FALSE; - } else { - state = mail_config_get_hide_deleted (); - } - bonobo_ui_component_set_prop (uic, "/commands/HideDeleted", "state", state ? "1" : "0", NULL); - bonobo_ui_component_add_listener (uic, "HideDeleted", folder_browser_toggle_hide_deleted, fb); - /* FIXME: this kind of bypasses bonobo but seems the only way when we change components */ - folder_browser_toggle_hide_deleted (uic, "", Bonobo_UIComponent_STATE_CHANGED, - state ? "1" : "0", fb); - - /* Threaded toggle */ - state = mail_config_get_thread_list (FOLDER_BROWSER (fb)->uri); - bonobo_ui_component_set_prop (uic, "/commands/ViewThreaded", "state", state ? "1" : "0", NULL); - bonobo_ui_component_add_listener (uic, "ViewThreaded", folder_browser_toggle_threads, fb); - /* FIXME: this kind of bypasses bonobo but seems the only way when we change components */ - folder_browser_toggle_threads (uic, "", Bonobo_UIComponent_STATE_CHANGED, - state ? "1" : "0", fb); - - /* Property menu */ - folder_browser_setup_property_menu (fb, fb->uicomp); - - /* View menu */ - folder_browser_setup_view_menus (fb, fb->uicomp); -} - -void -folder_browser_ui_rm_list (FolderBrowser *fb) -{ - /* View menu */ - folder_browser_discard_view_menus (fb); -} - -void -folder_browser_ui_add_global (FolderBrowser *fb) -{ - int state; - BonoboUIComponent *uic = fb->uicomp; - - ui_add (fb, "global", global_verbs, global_pixcache); - - /* (Pre)view toggle */ - - state = mail_config_get_show_preview (FOLDER_BROWSER (fb)->uri); - bonobo_ui_component_set_prop (uic, "/commands/ViewPreview", "state", state ? "1" : "0", NULL); - bonobo_ui_component_add_listener (uic, "ViewPreview", folder_browser_toggle_preview, fb); - /* FIXME: this kind of bypasses bonobo but seems the only way when we change components */ - folder_browser_toggle_preview (uic, "", Bonobo_UIComponent_STATE_CHANGED, state ? "1" : "0", fb); - - /* Stop button */ - /* TODO: Go through cache, but we can't becaus eof mail-mt.c:set_stop at the moment */ - bonobo_ui_component_set_prop(uic, "/commands/MailStop", "sensitive", "0", NULL); -} - -/* -void -folder_browser_ui_rm_global (FolderBrowser *fb) -{ -} -*/ - -void -folder_browser_ui_rm_all (FolderBrowser *fb) -{ - BonoboUIComponent *uic = fb->uicomp; - - bonobo_ui_component_rm (uic, "/", NULL); - bonobo_ui_component_unset_container (uic); - - if (fb->sensitise_state) { - g_hash_table_destroy(fb->sensitise_state); - fb->sensitise_state = NULL; - } -} - -void -fbui_sensitise_item(FolderBrowser *fb, const char *item, int state) -{ - char *name; - int val; - char *key; - - /* If this whole caching idea doesn't work, remove it here */ - if (fb->sensitise_state == NULL) - fb->sensitise_state = g_hash_table_new(g_str_hash, g_str_equal); - - if (g_hash_table_lookup_extended(fb->sensitise_state, item, (void **)&key, (void **)&val)) { - if (val == state) - return; - } - - g_hash_table_insert(fb->sensitise_state, (char *)item, (void *)state); - - if (fb->uicomp) { - name = alloca(strlen(item) + strlen("/commands/") + 1); - sprintf(name, "/commands/%s", item); - bonobo_ui_component_set_prop(fb->uicomp, name, "sensitive", state?"1":"0", NULL); - } -} - -struct sensitize_data { - const char **items; - gboolean enable; -}; - -static gboolean -fbui_sensitize_timeout (gpointer data) -{ - FolderBrowser *fb = FOLDER_BROWSER (data); - GSList *iter, *list; - struct sensitize_data *sd; - int i; - - list = fb->sensitize_changes; - fb->sensitize_changes = NULL; - iter = list; - fb->sensitize_timeout_id = 0; - - gtk_object_ref((GtkObject *)fb); - - /*bonobo_ui_component_freeze (uic, NULL);*/ - - for (; iter; iter = iter->next) { - sd = (struct sensitize_data *) iter->data; - for (i=0;sd->items[i];i++) { - if (fb->uicomp) - fbui_sensitise_item(fb, sd->items[i], sd->enable); - } - g_free(sd); - } - - g_slist_free (list); - gtk_object_unref((GtkObject *)fb); - - return FALSE; -} - -static void -fbui_sensitize_items (FolderBrowser *fb, const char **items, gboolean enable) -{ - struct sensitize_data *sd; - GSList *iter; - - /* If we're already updating these items, save an update by - * changing the item in the list. */ - - for (iter = fb->sensitize_changes; iter; iter = iter->next) { - sd = (struct sensitize_data *) iter->data; - - if (sd->items == items) - break; - } - - if (iter == NULL) { - sd = g_new (struct sensitize_data, 1); - sd->items = items; - sd->enable = enable; - - fb->sensitize_changes = g_slist_prepend (fb->sensitize_changes, sd); - } else { - /* Redundant, but shuts up the compiler. */ - sd = (struct sensitize_data *) iter->data; - sd->enable = enable; - } - - if (fb->sensitize_timeout_id == 0) - fb->sensitize_timeout_id = g_timeout_add (110, fbui_sensitize_timeout, fb); -} - -static const char *message_pane_enables[] = { - /* these only work if there's a message in the message pane - * (preview pane). This state is independent of how many are - * selected. */ - "PrintMessage", "PrintPreviewMessage", - "ViewFullHeaders", "ViewLoadImages", "ViewNormal", "ViewSource", - "MessageSearch", - NULL -}; - -void -folder_browser_ui_set_selection_state (FolderBrowser *fb, FolderBrowserSelectionState state) -{ - /* We'd like to keep the number of changes to be minimal cause - * this is a lot of corba traffic. So we break these sets of commands into bits: - * - * Also remember that everything defaults to sensitized - * - * Disable: - * NONE = none_disables + multiple_disables - * SINGLE = [nothing disabled] - * MULTIPLE = multiple_disables - * UNDEFINED = [nothing disabled] - */ - - static const char *none_disables[] = { - /* actions that work on > 0 messages */ - "MessageApplyFilters", - "MessageCopy", "MessageMove", - "MessageDelete", "MessageUndelete", - "MessageMarkAsRead", "MessageMarkAsUnRead", - "MessageMarkAsImportant", "MessageMarkAsUnimportant", - "MessageOpen", "MessageSaveAs", - "MessageForward", "MessageForwardAttached", - - "EditCut", "EditCopy", "EditPaste", "ViewHideSelected", - - "MailNext", "MailNextFlagged", "MailNextUnread", "MailNextThread", - "MailPrevious", "MailPreviousFlagged", "MailPreviousUnread", - - NULL - }; - - static const char *multiple_disables[] = { - /* actions that work on exactly 1 message */ - "MessageReplyAll", "MessageReplyList", "MessageReplySender", "MessageResend", - "MessageForwardInline", "MessageForwardQuoted", "MessageSearch", - - "ToolsFilterMailingList", "ToolsFilterRecipient", "ToolsFilterSender", - "ToolsFilterSubject", "ToolsVFolderMailingList", "ToolsVFolderRecipient", - "ToolsVFolderSender", "ToolsVFolderSubject", - - NULL - }; - - - fbui_sensitize_items (fb, message_pane_enables, state != FB_SELSTATE_NONE && fb->loaded_uid && fb->preview_shown); - - /* assumes that all the appropriate XML's have been loaded */ - - if (state == fb->selection_state) - return; - - switch (state) { - case FB_SELSTATE_NONE: - fbui_sensitize_items (fb, none_disables, FALSE); - if (fb->selection_state != FB_SELSTATE_MULTIPLE) - fbui_sensitize_items (fb, multiple_disables, FALSE); - break; - case FB_SELSTATE_SINGLE: - if (fb->selection_state != FB_SELSTATE_UNDEFINED) - fbui_sensitize_items (fb, multiple_disables, TRUE); - if (fb->selection_state == FB_SELSTATE_NONE) - fbui_sensitize_items (fb, none_disables, TRUE); - break; - case FB_SELSTATE_MULTIPLE: - if (fb->selection_state == FB_SELSTATE_NONE) - fbui_sensitize_items (fb, none_disables, TRUE); - else - fbui_sensitize_items (fb, multiple_disables, FALSE); - break; - case FB_SELSTATE_UNDEFINED: - printf ("changing to undefined selection state? hah!\n"); - return; - } - - fb->selection_state = state; -} - -void -folder_browser_ui_message_loaded (FolderBrowser *fb) -{ - BonoboUIComponent *uic = fb->uicomp; - - if (uic) - fbui_sensitize_items (fb, message_pane_enables, fb->loaded_uid && fb->preview_shown); -} diff --git a/mail/folder-browser-ui.h b/mail/folder-browser-ui.h deleted file mode 100644 index 788ebb7b8d..0000000000 --- a/mail/folder-browser-ui.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * folder-browser-ui.c: Sets up the Bonobo UI for FolderBrowsers - * - * Author: - * Peter Williams <peterw@ximian.com> - * - * (C) 2001 Ximian, Inc. - */ - -#ifndef _FOLDER_BROWSER_UI_H -#define _FOLDER_BROWSER_UI_H - -#include "folder-browser.h" - -void folder_browser_ui_add_message (FolderBrowser *fb); -void folder_browser_ui_add_list (FolderBrowser *fb); -void folder_browser_ui_add_global (FolderBrowser *fb); - -void folder_browser_ui_rm_list (FolderBrowser *fb); -void folder_browser_ui_rm_all (FolderBrowser *fb); - -/* these affect the sensitivity of UI elements */ -void folder_browser_ui_set_selection_state (FolderBrowser *fb, FolderBrowserSelectionState state); -void folder_browser_ui_message_loaded (FolderBrowser *fb); - -/* Set the sensitivity of a single item */ -void fbui_sensitise_item(FolderBrowser *fb, const char *item, int state); - -#endif /* _FOLDER_BROWSER_UI_H */ diff --git a/mail/folder-browser.c b/mail/folder-browser.c deleted file mode 100644 index ddcc305fe6..0000000000 --- a/mail/folder-browser.c +++ /dev/null @@ -1,2048 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Miguel De Icaza <miguel@ximian.com> - * Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright 2000,2001 Ximain, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include <ctype.h> -#include <errno.h> - -#include <gdk/gdkkeysyms.h> -#include <gtk/gtkinvisible.h> -#include <gal/e-paned/e-vpaned.h> -#include <gal/e-table/e-table.h> -#include <gal/util/e-util.h> -#include <gal/widgets/e-gui-utils.h> -#include <gal/widgets/e-popup-menu.h> -#include <gal/widgets/e-unicode.h> - -#include <libgnomeui/gnome-dialog-util.h> - -#include <gtkhtml/htmlengine.h> -#include <gtkhtml/htmlengine-edit-cut-and-paste.h> - -#include "filter/vfolder-rule.h" -#include "filter/vfolder-context.h" -#include "filter/filter-option.h" -#include "filter/filter-input.h" - -#include "mail-search-dialogue.h" -#include "e-util/e-sexp.h" -#include "e-util/e-mktemp.h" -#include "folder-browser.h" -#include "e-searching-tokenizer.h" -#include "mail.h" -#include "mail-callbacks.h" -#include "mail-tools.h" -#include "message-list.h" -#include "mail-ops.h" -#include "mail-vfolder.h" -#include "mail-autofilter.h" -#include "mail-mt.h" -#include "mail-folder-cache.h" -#include "folder-browser-ui.h" - -#include "mail-local.h" -#include "mail-config.h" - -#include <camel/camel-mime-message.h> -#include <camel/camel-stream-mem.h> - -#define d(x) - -#define PARENT_TYPE (gtk_table_get_type ()) - -static void folder_changed(CamelObject *o, void *event_data, void *data); -static void main_folder_changed(CamelObject *o, void *event_data, void *data); - -#define X_EVOLUTION_MESSAGE_TYPE "x-evolution-message" -#define MESSAGE_RFC822_TYPE "message/rfc822" -#define TEXT_URI_LIST_TYPE "text/uri-list" -#define TEXT_PLAIN_TYPE "text/plain" - -/* Drag & Drop types */ -enum DndTargetType { - DND_TARGET_TYPE_X_EVOLUTION_MESSAGE, - DND_TARGET_TYPE_MESSAGE_RFC822, - DND_TARGET_TYPE_TEXT_URI_LIST, -}; - -static GtkTargetEntry drag_types[] = { - { X_EVOLUTION_MESSAGE_TYPE, 0, DND_TARGET_TYPE_X_EVOLUTION_MESSAGE }, - { MESSAGE_RFC822_TYPE, 0, DND_TARGET_TYPE_MESSAGE_RFC822 }, - { TEXT_URI_LIST_TYPE, 0, DND_TARGET_TYPE_TEXT_URI_LIST }, -}; - -static const int num_drag_types = sizeof (drag_types) / sizeof (drag_types[0]); - -enum PasteTargetType { - PASTE_TARGET_TYPE_X_EVOLUTION_MESSAGE, - PASTE_TARGET_TYPE_TEXT_PLAIN, -}; - -static GtkTargetPair paste_types[] = { - { 0, 0, PASTE_TARGET_TYPE_X_EVOLUTION_MESSAGE }, - { GDK_SELECTION_TYPE_STRING, 0, PASTE_TARGET_TYPE_TEXT_PLAIN }, -}; - -static const int num_paste_types = sizeof (paste_types) / sizeof (paste_types[0]); - -static GdkAtom clipboard_atom = GDK_NONE; - -static GtkObjectClass *folder_browser_parent_class; - -enum { - FOLDER_LOADED, - MESSAGE_LOADED, - LAST_SIGNAL -}; - -static guint folder_browser_signals [LAST_SIGNAL] = {0, }; - -static void -folder_browser_finalise (GtkObject *object) -{ - FolderBrowser *folder_browser; - CORBA_Environment ev; - - folder_browser = FOLDER_BROWSER (object); - - CORBA_exception_init (&ev); - - if (folder_browser->search_full) - gtk_object_unref (GTK_OBJECT (folder_browser->search_full)); - - if (folder_browser->sensitize_timeout_id) - g_source_remove (folder_browser->sensitize_timeout_id); - - if (folder_browser->shell != CORBA_OBJECT_NIL) { - CORBA_Object_release (folder_browser->shell, &ev); - folder_browser->shell = CORBA_OBJECT_NIL; - } - - if (folder_browser->shell_view != CORBA_OBJECT_NIL) { - CORBA_Object_release(folder_browser->shell_view, &ev); - folder_browser->shell_view = CORBA_OBJECT_NIL; - } - - if (folder_browser->uicomp) - bonobo_object_unref (BONOBO_OBJECT (folder_browser->uicomp)); - - g_free (folder_browser->uri); - folder_browser->uri = NULL; - - CORBA_exception_free (&ev); - - if (folder_browser->view_collection) { - gtk_object_unref (GTK_OBJECT (folder_browser->view_collection)); - folder_browser->view_collection = NULL; - } - - if (folder_browser->view_menus) { - gtk_object_unref (GTK_OBJECT (folder_browser->view_menus)); - folder_browser->view_menus = NULL; - } - - gtk_object_unref (GTK_OBJECT (folder_browser->invisible)); - folder_browser->invisible = NULL; - - if (folder_browser->clipboard_selection) - g_byte_array_free (folder_browser->clipboard_selection, TRUE); - - if (folder_browser->sensitise_state) { - g_hash_table_destroy(folder_browser->sensitise_state); - folder_browser->sensitise_state = NULL; - } - - folder_browser_parent_class->finalize (object); -} - -static void -folder_browser_destroy (GtkObject *object) -{ - FolderBrowser *folder_browser; - - folder_browser = FOLDER_BROWSER (object); - - if (folder_browser->seen_id != 0) { - gtk_timeout_remove (folder_browser->seen_id); - folder_browser->seen_id = 0; - } - - if (folder_browser->loading_id != 0) { - gtk_timeout_remove(folder_browser->loading_id); - folder_browser->loading_id = 0; - } - - if (folder_browser->message_list) { - gtk_widget_destroy (GTK_WIDGET (folder_browser->message_list)); - folder_browser->message_list = NULL; - } - - if (folder_browser->mail_display) { - gtk_widget_destroy (GTK_WIDGET (folder_browser->mail_display)); - folder_browser->mail_display = NULL; - } - - /* wait for all outstanding async events against us */ - mail_async_event_destroy (folder_browser->async_event); - - if (folder_browser->get_id != -1) { - mail_msg_cancel(folder_browser->get_id); - folder_browser->get_id = -1; - } - - if (folder_browser->folder) { - camel_object_unhook_event (CAMEL_OBJECT (folder_browser->folder), "folder_changed", - folder_changed, folder_browser); - camel_object_unhook_event (CAMEL_OBJECT (folder_browser->folder), "message_changed", - folder_changed, folder_browser); - mail_sync_folder (folder_browser->folder, NULL, NULL); - camel_object_unref (CAMEL_OBJECT (folder_browser->folder)); - folder_browser->folder = NULL; - } - - folder_browser_parent_class->destroy (object); -} - -static void -folder_browser_class_init (GtkObjectClass *object_class) -{ - object_class->destroy = folder_browser_destroy; - object_class->finalize = folder_browser_finalise; - - folder_browser_parent_class = gtk_type_class (PARENT_TYPE); - - folder_browser_signals[FOLDER_LOADED] = - gtk_signal_new ("folder_loaded", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (FolderBrowserClass, folder_loaded), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, GTK_TYPE_STRING); - - folder_browser_signals[MESSAGE_LOADED] = - gtk_signal_new ("message_loaded", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (FolderBrowserClass, message_loaded), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, GTK_TYPE_STRING); - - gtk_object_class_add_signals (object_class, folder_browser_signals, LAST_SIGNAL); - - /* clipboard atom */ - if (!clipboard_atom) - clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE); - - if (!paste_types[0].target) - paste_types[0].target = gdk_atom_intern (X_EVOLUTION_MESSAGE_TYPE, FALSE); -} - -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 (ETree *tree, int row, ETreePath path, int col, - GdkDragContext *context, GtkSelectionData *selection_data, - guint info, guint time, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - GPtrArray *uids = NULL; - int i; - - uids = g_ptr_array_new (); - message_list_foreach (fb->message_list, add_uid, uids); - if (uids->len == 0) { - g_ptr_array_free (uids, TRUE); - return; - } - - switch (info) { - case DND_TARGET_TYPE_TEXT_URI_LIST: - { - const char *filename, *tmpdir; - CamelMimeMessage *message; - CamelStream *stream; - char *uri_list; - int fd; - - tmpdir = e_mkdtemp ("drag-n-drop-XXXXXX"); - - if (!tmpdir) { - char *msg = g_strdup_printf (_("Could not create temporary " - "directory: %s"), - g_strerror (errno)); - gnome_error_dialog (msg); - /* cleanup and abort */ - for (i = 0; i < uids->len; i++) - g_free (uids->pdata[i]); - g_ptr_array_free (uids, TRUE); - return; - } - - message = camel_folder_get_message (fb->folder, uids->pdata[0], NULL); - g_free (uids->pdata[0]); - - if (uids->len == 1) { - filename = camel_mime_message_get_subject (message); - if (!filename) - filename = "Unknown"; - } else - filename = "mbox"; - - uri_list = g_strdup_printf ("file://%s/%s", tmpdir, filename); - - fd = open (uri_list + 7, O_WRONLY | O_CREAT); - if (fd == -1) { - /* cleanup and abort */ - camel_object_unref (CAMEL_OBJECT (message)); - for (i = 1; i < uids->len; i++) - g_free (uids->pdata[i]); - g_ptr_array_free (uids, TRUE); - g_free (uri_list); - return; - } - - stream = camel_stream_fs_new_with_fd (fd); - - camel_stream_write (stream, "From - \n", 8); - camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), stream); - camel_object_unref (CAMEL_OBJECT (message)); - for (i = 1; i < uids->len; i++) { - message = camel_folder_get_message (fb->folder, uids->pdata[i], NULL); - camel_stream_write (stream, "From - \n", 8); - camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), stream); - camel_object_unref (CAMEL_OBJECT (message)); - g_free (uids->pdata[i]); - } - - camel_object_unref (CAMEL_OBJECT (stream)); - - gtk_selection_data_set (selection_data, selection_data->target, 8, - uri_list, strlen (uri_list)); - g_free (uri_list); - } - break; - case DND_TARGET_TYPE_MESSAGE_RFC822: - { - /* FIXME: this'll be fucking slow for the user... pthread this? */ - CamelStream *stream; - GByteArray *bytes; - - bytes = g_byte_array_new (); - stream = camel_stream_mem_new (); - camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (stream), bytes); - - for (i = 0; i < uids->len; i++) { - CamelMimeMessage *message; - - message = camel_folder_get_message (fb->folder, uids->pdata[i], NULL); - g_free (uids->pdata[i]); - - if (message) { - camel_stream_write (stream, "From - \n", 8); - camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), stream); - camel_object_unref (CAMEL_OBJECT (message)); - } - } - - g_ptr_array_free (uids, TRUE); - camel_object_unref (CAMEL_OBJECT (stream)); - - gtk_selection_data_set (selection_data, selection_data->target, 8, - bytes->data, bytes->len); - - g_byte_array_free (bytes, FALSE); - } - break; - case DND_TARGET_TYPE_X_EVOLUTION_MESSAGE: - { - GByteArray *array; - - /* format: "uri\0uid1\0uid2\0uid3\0...\0uidn" */ - - /* write the uri portion */ - array = g_byte_array_new (); - g_byte_array_append (array, fb->uri, strlen (fb->uri)); - g_byte_array_append (array, "", 1); - - /* write the uids */ - for (i = 0; i < uids->len; i++) { - g_byte_array_append (array, uids->pdata[i], strlen (uids->pdata[i])); - g_free (uids->pdata[i]); - - if (i + 1 < uids->len) - g_byte_array_append (array, "", 1); - } - - g_ptr_array_free (uids, TRUE); - - gtk_selection_data_set (selection_data, selection_data->target, 8, - array->data, array->len); - - g_byte_array_free (array, FALSE); - } - break; - default: - for (i = 0; i < uids->len; i++) - g_free (uids->pdata[i]); - - g_ptr_array_free (uids, TRUE); - break; - } -} - -static void -message_rfc822_dnd (CamelFolder *dest, CamelStream *stream, CamelException *ex) -{ - CamelMimeParser *mp; - - mp = camel_mime_parser_new (); - camel_mime_parser_scan_from (mp, TRUE); - camel_mime_parser_init_with_stream (mp, stream); - - while (camel_mime_parser_step (mp, 0, 0) == HSCAN_FROM) { - CamelMessageInfo *info; - CamelMimeMessage *msg; - - msg = camel_mime_message_new (); - if (camel_mime_part_construct_from_parser (CAMEL_MIME_PART (msg), mp) == -1) { - camel_object_unref (CAMEL_OBJECT (msg)); - break; - } - - /* append the message to the folder... */ - info = g_new0 (CamelMessageInfo, 1); - camel_folder_append_message (dest, msg, info, ex); - camel_object_unref (CAMEL_OBJECT (msg)); - - if (camel_exception_is_set (ex)) - break; - - /* skip over the FROM_END state */ - camel_mime_parser_step (mp, 0, 0); - } - - camel_object_unref (CAMEL_OBJECT (mp)); -} - -static void -message_list_drag_data_received (ETree *tree, int row, ETreePath path, int col, - GdkDragContext *context, gint x, gint y, - GtkSelectionData *selection_data, guint info, - guint time, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - CamelFolder *folder = NULL; - char *tmp, *url, **urls; - GPtrArray *uids = NULL; - CamelStream *stream; - CamelException ex; - CamelURL *uri; - int i, fd; - - /* this means we are receiving no data */ - if (!selection_data->data || selection_data->length == -1) - return; - - camel_exception_init (&ex); - - switch (info) { - case DND_TARGET_TYPE_TEXT_URI_LIST: - tmp = g_strndup (selection_data->data, selection_data->length); - urls = g_strsplit (tmp, "\n", 0); - g_free (tmp); - - for (i = 0; urls[i] != NULL; i++) { - /* get the path component */ - url = g_strstrip (urls[i]); - - uri = camel_url_new (url, NULL); - g_free (url); - url = uri->path; - uri->path = NULL; - camel_url_free (uri); - - fd = open (url, O_RDONLY); - if (fd == -1) { - g_free (url); - /* FIXME: okay, what do we do in this case? */ - continue; - } - - stream = camel_stream_fs_new_with_fd (fd); - message_rfc822_dnd (fb->folder, stream, &ex); - camel_object_unref (CAMEL_OBJECT (stream)); - - if (context->action == GDK_ACTION_MOVE && !camel_exception_is_set (&ex)) - unlink (url); - - g_free (url); - } - - g_free (urls); - break; - case DND_TARGET_TYPE_MESSAGE_RFC822: - /* write the message(s) out to a CamelStream so we can use it */ - stream = camel_stream_mem_new (); - camel_stream_write (stream, selection_data->data, selection_data->length); - camel_stream_reset (stream); - - message_rfc822_dnd (fb->folder, stream, &ex); - camel_object_unref (CAMEL_OBJECT (stream)); - break; - case DND_TARGET_TYPE_X_EVOLUTION_MESSAGE: - folder = mail_tools_x_evolution_message_parse (selection_data->data, selection_data->length, &uids); - if (folder == NULL) - goto fail; - - if (uids == NULL) { - camel_object_unref (CAMEL_OBJECT (folder)); - goto fail; - } - - mail_transfer_messages (folder, uids, context->action == GDK_ACTION_MOVE, - fb->uri, 0, NULL, NULL); - - camel_object_unref (CAMEL_OBJECT (folder)); - break; - } - - camel_exception_clear (&ex); - - gtk_drag_finish (context, TRUE, TRUE, GDK_CURRENT_TIME); - - fail: - camel_exception_clear (&ex); - - gtk_drag_finish (context, FALSE, TRUE, GDK_CURRENT_TIME); -} - -static void -selection_get (GtkWidget *widget, GtkSelectionData *selection_data, - guint info, guint time_stamp, FolderBrowser *fb) -{ - if (fb->clipboard_selection == NULL) - return; - - switch (info) { - default: - case PASTE_TARGET_TYPE_TEXT_PLAIN: - { - /* FIXME: this'll be fucking slow for the user... pthread this? */ - CamelFolder *source; - CamelStream *stream; - GByteArray *bytes; - GPtrArray *uids; - int i; - - bytes = fb->clipboard_selection; - - /* Note: source should == fb->folder, but we might as well use `source' instead of fb->folder */ - source = mail_tools_x_evolution_message_parse (bytes->data, bytes->len, &uids); - if (source == NULL) - return; - - if (uids == NULL) { - camel_object_unref (CAMEL_OBJECT (source)); - return; - } - - bytes = g_byte_array_new (); - stream = camel_stream_mem_new (); - camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (stream), bytes); - - for (i = 0; i < uids->len; i++) { - CamelMimeMessage *message; - - message = camel_folder_get_message (source, uids->pdata[i], NULL); - g_free (uids->pdata[i]); - - if (message) { - camel_stream_write (stream, "From - \n", 8); - camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), stream); - camel_object_unref (CAMEL_OBJECT (message)); - } - } - - g_ptr_array_free (uids, TRUE); - camel_object_unref (CAMEL_OBJECT (stream)); - camel_object_unref (CAMEL_OBJECT (source)); - - gtk_selection_data_set (selection_data, selection_data->target, 8, - bytes->data, bytes->len); - - g_byte_array_free (bytes, FALSE); - } - break; - case PASTE_TARGET_TYPE_X_EVOLUTION_MESSAGE: - /* we already have our data in the correct form */ - gtk_selection_data_set (selection_data, - selection_data->target, 8, - fb->clipboard_selection->data, - fb->clipboard_selection->len); - break; - } -} - -static void -selection_clear_event (GtkWidget *widget, GdkEventSelection *event, FolderBrowser *fb) -{ - if (fb->clipboard_selection != NULL) { - g_byte_array_free (fb->clipboard_selection, TRUE); - fb->clipboard_selection = NULL; - } -} - -static void -selection_received (GtkWidget *widget, GtkSelectionData *selection_data, - guint time, FolderBrowser *fb) -{ - CamelFolder *source = NULL; - GPtrArray *uids = NULL; - - if (selection_data == NULL || selection_data->length == -1) - return; - - source = mail_tools_x_evolution_message_parse (selection_data->data, selection_data->length, &uids); - if (source == NULL) - return; - - if (uids == NULL) { - camel_object_unref (CAMEL_OBJECT (source)); - return; - } - - mail_transfer_messages (source, uids, FALSE, fb->uri, 0, NULL, NULL); - - camel_object_unref (CAMEL_OBJECT (source)); -} - -void -folder_browser_copy (GtkWidget *menuitem, FolderBrowser *fb) -{ - GPtrArray *uids = NULL; - GByteArray *bytes; - gboolean cut; - int i; - - if (fb->message_list == NULL) - return; - - cut = menuitem == NULL; - - if (GTK_WIDGET_HAS_FOCUS (fb->mail_display->html)) { - gtk_html_copy (fb->mail_display->html); - return; - } - - if (fb->clipboard_selection) { - g_byte_array_free (fb->clipboard_selection, TRUE); - fb->clipboard_selection = NULL; - } - - uids = g_ptr_array_new (); - message_list_foreach (fb->message_list, add_uid, uids); - - /* format: "uri uid1\0uid2\0uid3\0...\0uidn" */ - - /* write the uri portion */ - bytes = g_byte_array_new (); - g_byte_array_append (bytes, fb->uri, strlen (fb->uri)); - g_byte_array_append (bytes, " ", 1); - - /* write the uids */ - camel_folder_freeze (fb->folder); - for (i = 0; i < uids->len; i++) { - if (cut) { - camel_folder_set_message_flags (fb->folder, uids->pdata[i], - CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_DELETED, - CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_DELETED); - } - g_byte_array_append (bytes, uids->pdata[i], strlen (uids->pdata[i])); - g_free (uids->pdata[i]); - - if (i + 1 < uids->len) - g_byte_array_append (bytes, "", 1); - } - camel_folder_thaw (fb->folder); - - g_ptr_array_free (uids, TRUE); - - fb->clipboard_selection = bytes; - - gtk_selection_owner_set (fb->invisible, clipboard_atom, GDK_CURRENT_TIME); -} - -void -folder_browser_cut (GtkWidget *menuitem, FolderBrowser *fb) -{ - folder_browser_copy (NULL, fb); -} - -void -folder_browser_paste (GtkWidget *menuitem, FolderBrowser *fb) -{ - gtk_selection_convert (fb->invisible, clipboard_atom, - paste_types[0].target, - GDK_CURRENT_TIME); -} - -/* all this crap so we can give the user a whoopee doo status bar */ -static void -update_status_bar(FolderBrowser *fb) -{ - CORBA_Environment ev; - int tmp; - GString *work; - extern CamelFolder *outbox_folder, *sent_folder; - - if (fb->folder == NULL - || fb->message_list == NULL - || fb->shell_view == CORBA_OBJECT_NIL) - return; - - work = g_string_new(""); - g_string_sprintfa(work, _("%d new"), camel_folder_get_unread_message_count(fb->folder)); - tmp = message_list_hidden(fb->message_list); - if (tmp) { - g_string_append(work, _(", ")); - g_string_sprintfa(work, _("%d hidden"), tmp); - } - tmp = e_selection_model_selected_count(e_tree_get_selection_model(fb->message_list->tree)); - if (tmp) { - g_string_append(work, _(", ")); - g_string_sprintfa(work, _("%d selected"), tmp); - } - if (!fb->message_list->hidedeleted || !camel_folder_has_summary_capability(fb->folder)) { - tmp = camel_folder_get_message_count(fb->folder); - } else { - GPtrArray *sum = camel_folder_get_summary(fb->folder); - int i; - - if (sum) { - tmp = 0; - for (i=0;i<sum->len;i++) { - CamelMessageInfo *info = sum->pdata[i]; - - if ((info->flags & CAMEL_MESSAGE_DELETED) == 0) - tmp++; - } - camel_folder_free_summary(fb->folder, sum); - } else { - tmp = camel_folder_get_message_count(fb->folder); - } - } - g_string_append(work, _(", ")); - if (fb->folder == outbox_folder) - g_string_sprintfa(work, _("%d unsent"), tmp); - else if (fb->folder == sent_folder) - g_string_sprintfa(work, _("%d sent"), tmp); - else - g_string_sprintfa(work, _("%d total"), tmp); - - CORBA_exception_init(&ev); - GNOME_Evolution_ShellView_setFolderBarLabel(fb->shell_view, work->str, &ev); - CORBA_exception_free(&ev); - - if (fb->update_status_bar_idle_id != 0) { - g_source_remove (fb->update_status_bar_idle_id); - fb->update_status_bar_idle_id = 0; - } - - g_string_free(work, TRUE); -} - -static gboolean -update_status_bar_idle_cb(gpointer data) -{ - FolderBrowser *fb = data; - if (!GTK_OBJECT_DESTROYED (fb)) - update_status_bar (fb); - fb->update_status_bar_idle_id = 0; - gtk_object_unref (GTK_OBJECT (fb)); - return FALSE; -} - -static void -update_status_bar_idle(FolderBrowser *fb) -{ - if (fb->update_status_bar_idle_id == 0) { - gtk_object_ref (GTK_OBJECT (fb)); - fb->update_status_bar_idle_id = g_idle_add (update_status_bar_idle_cb, fb); - } -} - -static void main_folder_changed(CamelObject *o, void *event_data, void *data) -{ - FolderBrowser *fb = data; - - /* so some corba unref doesnt blow us away while we're busy */ - gtk_object_ref((GtkObject *)fb); - update_status_bar(fb); - gtk_object_unref((GtkObject *)fb); -} - -static void folder_changed(CamelObject *o, void *event_data, void *data) -{ - FolderBrowser *fb = data; - - mail_async_event_emit(fb->async_event, MAIL_ASYNC_GUI, (MailAsyncFunc)main_folder_changed, o, NULL, data); -} - -static void -got_folder(char *uri, CamelFolder *folder, void *data) -{ - FolderBrowser *fb = data; - - fb->get_id = -1; - - d(printf ("got folder '%s' = %p, previous folder was %p\n", uri, folder, fb->folder)); - - if (fb->message_list == NULL) - goto done; - - fb->folder = folder; - if (folder == NULL) - goto done; - - camel_object_ref (CAMEL_OBJECT (folder)); - - gtk_widget_set_sensitive (GTK_WIDGET (fb->search), camel_folder_has_search_capability (folder)); - message_list_set_folder (fb->message_list, folder, - folder_browser_is_drafts (fb) || - folder_browser_is_sent (fb) || - folder_browser_is_outbox (fb)); - - camel_object_hook_event(CAMEL_OBJECT(fb->folder), "folder_changed", - folder_changed, fb); - camel_object_hook_event(CAMEL_OBJECT(fb->folder), "message_changed", - folder_changed, fb); - - /* when loading a new folder, nothing is selected initially */ - - if (fb->uicomp) - folder_browser_ui_set_selection_state (fb, FB_SELSTATE_NONE); - - done: - gtk_signal_emit (GTK_OBJECT (fb), folder_browser_signals [FOLDER_LOADED], fb->uri); - gtk_object_unref (GTK_OBJECT (fb)); -} - -void -folder_browser_set_ui_component (FolderBrowser *fb, BonoboUIComponent *uicomp) -{ - g_return_if_fail (IS_FOLDER_BROWSER (fb)); - - if (fb->sensitize_timeout_id) { - g_source_remove (fb->sensitize_timeout_id); - fb->sensitize_timeout_id = 0; - } - - if (fb->sensitise_state) { - g_hash_table_destroy(fb->sensitise_state); - fb->sensitise_state = NULL; - } - - if (fb->uicomp) - bonobo_object_unref (BONOBO_OBJECT (fb->uicomp)); - - if (uicomp) - bonobo_object_ref (BONOBO_OBJECT (uicomp)); - - fb->uicomp = uicomp; -} - -void -folder_browser_set_shell_view(FolderBrowser *fb, GNOME_Evolution_ShellView shell_view) -{ - CORBA_Environment ev; - - CORBA_exception_init(&ev); - if (fb->shell_view != CORBA_OBJECT_NIL) - CORBA_Object_release(fb->shell_view, &ev); - CORBA_exception_free(&ev); - - fb->shell_view = CORBA_Object_duplicate(shell_view, &ev); - CORBA_exception_free(&ev); - - /* small hack, at this point we've just been activated */ - if (fb->shell_view != CORBA_OBJECT_NIL) - update_status_bar(fb); -} - -extern CamelFolder *drafts_folder, *sent_folder, *outbox_folder; - -/** - * folder_browser_is_drafts: - * @fb: a FolderBrowser - * - * Return value: %TRUE if @fb refers to /local/Drafts or any other - * configured Drafts folder. - **/ -gboolean -folder_browser_is_drafts (FolderBrowser *fb) -{ - const GSList *accounts; - MailConfigAccount *account; - - g_return_val_if_fail (IS_FOLDER_BROWSER (fb), FALSE); - - if (fb->uri == NULL || fb->folder == NULL) - return FALSE; - - if (fb->folder == drafts_folder) - return TRUE; - - accounts = mail_config_get_accounts (); - while (accounts) { - account = accounts->data; - if (account->drafts_folder_uri && camel_store_uri_cmp(fb->folder->parent_store, account->drafts_folder_uri, fb->uri)) - return TRUE; - accounts = accounts->next; - } - - return FALSE; -} - -/** - * folder_browser_is_sent: - * @fb: a FolderBrowser - * - * Return value: %TRUE if @fb refers to /local/Sent or any other - * configured Sent folder. - **/ -gboolean -folder_browser_is_sent (FolderBrowser *fb) -{ - const GSList *accounts; - MailConfigAccount *account; - - g_return_val_if_fail (IS_FOLDER_BROWSER (fb), FALSE); - - if (fb->uri == NULL || fb->folder == NULL) - return FALSE; - - if (fb->folder == sent_folder) - return TRUE; - - accounts = mail_config_get_accounts (); - while (accounts) { - account = accounts->data; - if (account->sent_folder_uri && camel_store_uri_cmp(fb->folder->parent_store, account->sent_folder_uri, fb->uri)) - return TRUE; - accounts = accounts->next; - } - - return FALSE; -} - -/** - * folder_browser_is_outbox: - * @fb: a FolderBrowser - * - * Return value: %TRUE if @fb refers to /local/Outbox or any other - * configured Outbox folder. - **/ -gboolean -folder_browser_is_outbox (FolderBrowser *fb) -{ - /* There can be only one. */ - return fb->folder == outbox_folder; -} - -static int -save_cursor_pos (FolderBrowser *fb) -{ - ETreePath node; - GtkAdjustment *adj; - int row, y, height; - - node = e_tree_get_cursor (fb->message_list->tree); - if (!node) - return -1; - - row = e_tree_row_of_node (fb->message_list->tree, node); - - if (row == -1) - return 0; - - e_tree_get_cell_geometry (fb->message_list->tree, row, 0, - NULL, &y, NULL, &height); - - adj = e_scroll_frame_get_vadjustment (E_SCROLL_FRAME (fb->message_list)); - y += adj->value - ((mail_config_get_paned_size () - height) / 2); - - return y; -} - -static void -set_cursor_pos (FolderBrowser *fb, int y) -{ - GtkAdjustment *adj; - - if (y == -1) - return; - - adj = e_scroll_frame_get_vadjustment (E_SCROLL_FRAME (fb->message_list)); - gtk_adjustment_set_value (adj, (gfloat)y); -} - -static gboolean do_message_selected(FolderBrowser *fb); - -void -folder_browser_set_message_preview (FolderBrowser *folder_browser, gboolean show_message_preview) -{ - if (folder_browser->preview_shown == show_message_preview - || folder_browser->message_list == NULL) - return; - - folder_browser->preview_shown = show_message_preview; - - if (show_message_preview) { - int y; - y = save_cursor_pos (folder_browser); - e_paned_set_position (E_PANED (folder_browser->vpaned), mail_config_get_paned_size ()); - gtk_widget_show (GTK_WIDGET (folder_browser->mail_display)); - do_message_selected (folder_browser); - set_cursor_pos (folder_browser, y); - } else { - e_paned_set_position (E_PANED (folder_browser->vpaned), 10000); - gtk_widget_hide (GTK_WIDGET (folder_browser->mail_display)); - mail_display_set_message(folder_browser->mail_display, NULL); - folder_browser_ui_message_loaded(folder_browser); - } -} - -enum { - ESB_SAVE, -}; - -static ESearchBarItem folder_browser_search_menu_items[] = { - E_FILTERBAR_RESET, - E_FILTERBAR_SAVE, - { N_("Create vFolder from Search"), ESB_SAVE, NULL }, - E_FILTERBAR_EDIT, - { NULL, -1, NULL } -}; - -static void -folder_browser_search_menu_activated (ESearchBar *esb, int id, FolderBrowser *fb) -{ - EFilterBar *efb = (EFilterBar *)esb; - - d(printf("menu activated\n")); - - switch (id) { - case ESB_SAVE: - d(printf("Save vfolder\n")); - if (efb->current_query) { - FilterRule *rule = vfolder_clone_rule(efb->current_query); - - filter_rule_set_source(rule, FILTER_SOURCE_INCOMING); - vfolder_rule_add_source((VfolderRule *)rule, fb->uri); - vfolder_gui_add_rule((VfolderRule *)rule); - } - break; - } -} - -static void -folder_browser_config_search (EFilterBar *efb, FilterRule *rule, int id, const char *query, void *data) -{ - FolderBrowser *fb = FOLDER_BROWSER (data); - ESearchingTokenizer *st; - GList *partl; - - st = E_SEARCHING_TOKENIZER (fb->mail_display->html->engine->ht); - - e_searching_tokenizer_set_secondary_search_string (st, NULL); - - /* we scan the parts of a rule, and set all the types we know about to the query string */ - partl = rule->parts; - while (partl) { - FilterPart *part = partl->data; - - if (!strcmp(part->name, "subject")) { - FilterInput *input = (FilterInput *)filter_part_find_element(part, "subject"); - if (input) - filter_input_set_value(input, query); - } else if (!strcmp(part->name, "body")) { - FilterInput *input = (FilterInput *)filter_part_find_element(part, "word"); - if (input) - filter_input_set_value(input, query); - e_searching_tokenizer_set_secondary_search_string (st, query); - } else if(!strcmp(part->name, "sender")) { - FilterInput *input = (FilterInput *)filter_part_find_element(part, "sender"); - if (input) - filter_input_set_value(input, query); - } else if(!strcmp(part->name, "to")) { - FilterInput *input = (FilterInput *)filter_part_find_element(part, "recipient"); - if (input) - filter_input_set_value(input, query); - } - - partl = partl->next; - } - - d(printf("configuring search for search string '%s', rule is '%s'\n", query, rule->name)); - - mail_display_redisplay (fb->mail_display, FALSE); -} - -static void -folder_browser_search_query_changed (ESearchBar *esb, FolderBrowser *fb) -{ - char *search_word; - - if (fb->message_list == NULL) - return; - - d(printf("query changed\n")); - - gtk_object_get (GTK_OBJECT (esb), - "query", &search_word, - NULL); - - message_list_set_search (fb->message_list, search_word); - - d(printf("query is %s\n", search_word)); - g_free(search_word); - return; -} - -void -folder_browser_toggle_preview (BonoboUIComponent *component, - const char *path, - Bonobo_UIComponent_EventType type, - const char *state, - gpointer user_data) -{ - FolderBrowser *fb = user_data; - - if (type != Bonobo_UIComponent_STATE_CHANGED - || fb->message_list == NULL) - return; - - mail_config_set_show_preview (fb->uri, atoi (state)); - folder_browser_set_message_preview (fb, atoi (state)); -} - -void -folder_browser_toggle_threads (BonoboUIComponent *component, - const char *path, - Bonobo_UIComponent_EventType type, - const char *state, - gpointer user_data) -{ - FolderBrowser *fb = user_data; - - if (type != Bonobo_UIComponent_STATE_CHANGED - || fb->message_list == NULL) - return; - - mail_config_set_thread_list (fb->uri, atoi (state)); - message_list_set_threaded (fb->message_list, atoi (state)); -} - -void -folder_browser_toggle_hide_deleted (BonoboUIComponent *component, - const char *path, - Bonobo_UIComponent_EventType type, - const char *state, - gpointer user_data) -{ - FolderBrowser *fb = user_data; - - if (type != Bonobo_UIComponent_STATE_CHANGED - || fb->message_list == NULL) - return; - - if (!(fb->folder && (fb->folder->folder_flags & CAMEL_FOLDER_IS_TRASH))) - mail_config_set_hide_deleted (atoi (state)); - message_list_set_hidedeleted (fb->message_list, atoi (state)); -} - -void -folder_browser_set_message_display_style (BonoboUIComponent *component, - const char *path, - Bonobo_UIComponent_EventType type, - const char *state, - gpointer user_data) -{ - extern char *message_display_styles[]; - FolderBrowser *fb = user_data; - int i; - - if (type != Bonobo_UIComponent_STATE_CHANGED - || atoi(state) == 0 - || fb->message_list == NULL) - return; - - for (i = 0; i < MAIL_CONFIG_DISPLAY_MAX; i++) { - if (strstr (message_display_styles[i], path)) { - fb->mail_display->display_style = i; - mail_display_redisplay (fb->mail_display, TRUE); - - if (fb->pref_master) - mail_config_set_message_display_style (i); - return; - } - } -} - -void -folder_browser_charset_changed (BonoboUIComponent *component, - const char *path, - Bonobo_UIComponent_EventType type, - const char *state, - gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - const char *charset; - - if (type != Bonobo_UIComponent_STATE_CHANGED - || fb->message_list == NULL) - return; - - if (atoi (state)) { - /* Charset menu names are "Charset-%s" where %s is the charset name */ - charset = path + strlen ("Charset-"); - if (!strcmp (charset, FB_DEFAULT_CHARSET)) - charset = NULL; - - mail_display_set_charset (fb->mail_display, charset); - } -} - -void -vfolder_subject (GtkWidget *w, FolderBrowser *fb) -{ - vfolder_gui_add_from_message (fb->mail_display->current_message, AUTO_SUBJECT, fb->uri); -} - -void -vfolder_sender (GtkWidget *w, FolderBrowser *fb) -{ - vfolder_gui_add_from_message (fb->mail_display->current_message, AUTO_FROM, fb->uri); -} - -void -vfolder_recipient (GtkWidget *w, FolderBrowser *fb) -{ - vfolder_gui_add_from_message (fb->mail_display->current_message, AUTO_TO, fb->uri); -} - -void -vfolder_mlist (GtkWidget *w, FolderBrowser *fb) -{ - char *name; - - g_return_if_fail (fb->mail_display->current_message != NULL); - - name = header_raw_check_mailing_list(&((CamelMimePart *)fb->mail_display->current_message)->headers); - if (name) { - g_strstrip (name); - vfolder_gui_add_from_mlist(fb->mail_display->current_message, name, fb->uri); - g_free(name); - } -} - -void -filter_subject (GtkWidget *w, FolderBrowser *fb) -{ - filter_gui_add_from_message (fb->mail_display->current_message, AUTO_SUBJECT); -} - -void -filter_sender (GtkWidget *w, FolderBrowser *fb) -{ - filter_gui_add_from_message (fb->mail_display->current_message, AUTO_FROM); -} - -void -filter_recipient (GtkWidget *w, FolderBrowser *fb) -{ - filter_gui_add_from_message (fb->mail_display->current_message, AUTO_TO); -} - -void -filter_mlist (GtkWidget *w, FolderBrowser *fb) -{ - char *name; - - g_return_if_fail (fb->mail_display->current_message != NULL); - - name = header_raw_check_mailing_list(&((CamelMimePart *)fb->mail_display->current_message)->headers); - if (name) { - filter_gui_add_from_mlist(name); - g_free(name); - } -} - -void -hide_none(GtkWidget *w, FolderBrowser *fb) -{ - message_list_hide_clear(fb->message_list); -} - -void -hide_selected(GtkWidget *w, FolderBrowser *fb) -{ - GPtrArray *uids; - int i; - - uids = g_ptr_array_new(); - message_list_foreach(fb->message_list, enumerate_msg, uids); - message_list_hide_uids(fb->message_list, uids); - for (i=0; i<uids->len; i++) - g_free(uids->pdata[i]); - g_ptr_array_free(uids, TRUE); -} - -void -hide_deleted(GtkWidget *w, FolderBrowser *fb) -{ - MessageList *ml = fb->message_list; - - message_list_hide_add(ml, "(match-all (system-flag \"deleted\"))", ML_HIDE_SAME, ML_HIDE_SAME); -} - -void -hide_read(GtkWidget *w, FolderBrowser *fb) -{ - MessageList *ml = fb->message_list; - - message_list_hide_add(ml, "(match-all (system-flag \"seen\"))", ML_HIDE_SAME, ML_HIDE_SAME); -} - -/* dum de dum, about the 3rd copy of this function throughout the mailer/camel */ -static const char * -strip_re(const char *subject) -{ - const unsigned char *s, *p; - - s = (unsigned char *) subject; - - while (*s) { - while(isspace (*s)) - s++; - if (s[0] == 0) - break; - if ((s[0] == 'r' || s[0] == 'R') - && (s[1] == 'e' || s[1] == 'E')) { - p = s+2; - while (isdigit(*p) || (ispunct(*p) && (*p != ':'))) - p++; - if (*p == ':') { - s = p + 1; - } else - break; - } else - break; - } - return (char *) s; -} - -void -hide_subject(GtkWidget *w, FolderBrowser *fb) -{ - const char *subject; - GString *expr; - - if (fb->mail_display->current_message) { - subject = camel_mime_message_get_subject(fb->mail_display->current_message); - if (subject) { - subject = strip_re(subject); - if (subject && subject[0]) { - expr = g_string_new("(match-all (header-contains \"subject\" "); - e_sexp_encode_string(expr, subject); - g_string_append(expr, "))"); - message_list_hide_add(fb->message_list, expr->str, ML_HIDE_SAME, ML_HIDE_SAME); - g_string_free(expr, TRUE); - return; - } - } - } -} - -void -hide_sender(GtkWidget *w, FolderBrowser *fb) -{ - const CamelInternetAddress *from; - const char *real, *addr; - GString *expr; - - if (fb->mail_display->current_message) { - from = camel_mime_message_get_from(fb->mail_display->current_message); - if (camel_internet_address_get(from, 0, &real, &addr)) { - expr = g_string_new("(match-all (header-contains \"from\" "); - e_sexp_encode_string(expr, addr); - g_string_append(expr, "))"); - message_list_hide_add(fb->message_list, expr->str, ML_HIDE_SAME, ML_HIDE_SAME); - g_string_free(expr, TRUE); - return; - } - } -} - -enum { - SELECTION_SET = 2, - CAN_MARK_READ = 4, - CAN_MARK_UNREAD = 8, - CAN_DELETE = 16, - CAN_UNDELETE = 32, - IS_MAILING_LIST = 64, - CAN_RESEND = 128, - CAN_MARK_IMPORTANT = 256, - CAN_MARK_UNIMPORTANT = 512 -}; - -#define MLIST_VFOLDER (3) -#define MLIST_FILTER (8) - -static EPopupMenu filter_menu[] = { - { N_("VFolder on _Subject"), NULL, GTK_SIGNAL_FUNC (vfolder_subject), NULL, SELECTION_SET }, - { N_("VFolder on Se_nder"), NULL, GTK_SIGNAL_FUNC (vfolder_sender), NULL, SELECTION_SET }, - { N_("VFolder on _Recipients"), NULL, GTK_SIGNAL_FUNC (vfolder_recipient), NULL, SELECTION_SET }, - { N_("VFolder on Mailing _List"), NULL, GTK_SIGNAL_FUNC (vfolder_mlist), NULL, SELECTION_SET | IS_MAILING_LIST }, - - E_POPUP_SEPARATOR, - - { N_("Filter on Sub_ject"), NULL, GTK_SIGNAL_FUNC (filter_subject), NULL, SELECTION_SET }, - { N_("Filter on Sen_der"), NULL, GTK_SIGNAL_FUNC (filter_sender), NULL, SELECTION_SET }, - { N_("Filter on Re_cipients"), NULL, GTK_SIGNAL_FUNC (filter_recipient), NULL, SELECTION_SET }, - { N_("Filter on _Mailing List"), NULL, GTK_SIGNAL_FUNC (filter_mlist), NULL, SELECTION_SET | IS_MAILING_LIST }, - - E_POPUP_TERMINATOR -}; - - -static EPopupMenu context_menu[] = { - { N_("_Open"), NULL, GTK_SIGNAL_FUNC (open_msg), NULL, 0 }, - { N_("_Edit as New Message..."), NULL, GTK_SIGNAL_FUNC (resend_msg), NULL, CAN_RESEND }, - { N_("_Save As..."), NULL, GTK_SIGNAL_FUNC (save_msg), NULL, 0 }, - { N_("_Print"), NULL, GTK_SIGNAL_FUNC (print_msg), NULL, SELECTION_SET }, - - E_POPUP_SEPARATOR, - - { N_("_Reply to Sender"), NULL, GTK_SIGNAL_FUNC (reply_to_sender), NULL, 0 }, - { N_("Reply to _List"), NULL, GTK_SIGNAL_FUNC (reply_to_list), NULL, 0 }, - { N_("Reply to _All"), NULL, GTK_SIGNAL_FUNC (reply_to_all), NULL, 0 }, - { N_("_Forward"), NULL, GTK_SIGNAL_FUNC (forward), NULL, 0 }, - { "", NULL, (NULL), NULL, 0 }, - { N_("Mar_k as Read"), NULL, GTK_SIGNAL_FUNC (mark_as_seen), NULL, CAN_MARK_READ }, - { N_("Mark as U_nread"), NULL, GTK_SIGNAL_FUNC (mark_as_unseen), NULL, CAN_MARK_UNREAD }, - { N_("Mark as _Important"), NULL, GTK_SIGNAL_FUNC (mark_as_important), NULL, CAN_MARK_IMPORTANT }, - { N_("Mark as Unim_portant"), NULL, GTK_SIGNAL_FUNC (mark_as_unimportant), NULL, CAN_MARK_UNIMPORTANT }, - - E_POPUP_SEPARATOR, - - { N_("_Move to Folder..."), NULL, GTK_SIGNAL_FUNC (move_msg_cb), NULL, 0 }, - { N_("_Copy to Folder..."), NULL, GTK_SIGNAL_FUNC (copy_msg_cb), NULL, 0 }, - { N_("_Delete"), NULL, GTK_SIGNAL_FUNC (delete_msg), NULL, CAN_DELETE }, - { N_("_Undelete"), NULL, GTK_SIGNAL_FUNC (undelete_msg), NULL, CAN_UNDELETE }, - - E_POPUP_SEPARATOR, - - { N_("Add Sender to Address Book"), NULL, GTK_SIGNAL_FUNC (addrbook_sender), NULL, SELECTION_SET }, - { "", NULL, GTK_SIGNAL_FUNC (NULL), NULL, 0 }, - - { N_("Apply Filters"), NULL, GTK_SIGNAL_FUNC (apply_filters), NULL, 0 }, - { "", NULL, GTK_SIGNAL_FUNC (NULL), NULL, 0 }, - { N_("Create Ru_le From Message"), NULL, GTK_SIGNAL_FUNC (NULL), filter_menu, SELECTION_SET }, - - E_POPUP_TERMINATOR -}; - - -struct cmpf_data { - ETree *tree; - int row, col; -}; - -static void -context_menu_position_func (GtkMenu *menu, gint *x, gint *y, - gpointer user_data) -{ - int tx, ty, tw, th; - struct cmpf_data *closure = user_data; - - gdk_window_get_origin (GTK_WIDGET (closure->tree)->window, x, y); - e_tree_get_cell_geometry (closure->tree, closure->row, closure->col, - &tx, &ty, &tw, &th); - *x += tx + tw / 2; - *y += ty + th / 2; -} - -/* handle context menu over message-list */ -static gint -on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, FolderBrowser *fb) -{ - extern CamelFolder *sent_folder; - CamelMessageInfo *info; - GPtrArray *uids; - int enable_mask = 0; - int hide_mask = 0; - int i; - char *mlist = NULL; - GtkMenu *menu; - - if (fb->folder != sent_folder) { - enable_mask |= CAN_RESEND; - hide_mask |= CAN_RESEND; - } - - if (fb->mail_display->current_message == NULL) { - enable_mask |= SELECTION_SET; - } else { - char *mname, *p, c, *o; - - mname = header_raw_check_mailing_list (&((CamelMimePart *)fb->mail_display->current_message)->headers); - /* Escape the mailing list name before showing it */ - if (mname) { - mlist = alloca (strlen (mname)+2); - p = mname; - o = mlist; - while ((c = *p++)) { - if (c == '_') - *o++ = '_'; - *o++ = c; - } - *o = 0; - g_free (mname); - } - } - - /* get a list of uids */ - uids = g_ptr_array_new (); - message_list_foreach (fb->message_list, enumerate_msg, uids); - if (uids->len >= 1) { - /* gray-out any items we don't need */ - gboolean have_deleted = FALSE; - gboolean have_undeleted = FALSE; - gboolean have_seen = FALSE; - gboolean have_unseen = FALSE; - gboolean have_important = FALSE; - gboolean have_unimportant = FALSE; - - for (i = 0; i < uids->len; i++) { - info = camel_folder_get_message_info (fb->folder, uids->pdata[i]); - if (info == NULL) - continue; - - if (info->flags & CAMEL_MESSAGE_SEEN) - have_seen = TRUE; - else - have_unseen = TRUE; - - if (info->flags & CAMEL_MESSAGE_DELETED) - have_deleted = TRUE; - else - have_undeleted = TRUE; - - if (info->flags & CAMEL_MESSAGE_FLAGGED) - have_important = TRUE; - else - have_unimportant = TRUE; - - camel_folder_free_message_info (fb->folder, info); - - if (have_seen && have_unseen && have_deleted && have_undeleted) - break; - } - - if (!have_unseen) - enable_mask |= CAN_MARK_READ; - if (!have_seen) - enable_mask |= CAN_MARK_UNREAD; - - if (!have_undeleted) - enable_mask |= CAN_DELETE; - if (!have_deleted) - enable_mask |= CAN_UNDELETE; - - if (!have_unimportant) - enable_mask |= CAN_MARK_IMPORTANT; - if (!have_important) - enable_mask |= CAN_MARK_UNIMPORTANT; - - /* - * Hide items that wont get used. - */ - if (!(have_unseen && have_seen)){ - if (have_seen) - hide_mask |= CAN_MARK_READ; - else - hide_mask |= CAN_MARK_UNREAD; - } - - if (!(have_undeleted && have_deleted)){ - if (have_deleted) - hide_mask |= CAN_DELETE; - else - hide_mask |= CAN_UNDELETE; - } - - if (!(have_important && have_unimportant)){ - if (have_important) - hide_mask |= CAN_MARK_IMPORTANT; - else - hide_mask |= CAN_MARK_UNIMPORTANT; - } - } - - /* free uids */ - for (i = 0; i < uids->len; i++) - g_free (uids->pdata[i]); - g_ptr_array_free (uids, TRUE); - - /* generate the "Filter on Mailing List menu item name */ - if (mlist == NULL) { - enable_mask |= IS_MAILING_LIST; - filter_menu[MLIST_FILTER].name = g_strdup (_("Filter on Mailing List")); - filter_menu[MLIST_VFOLDER].name = g_strdup (_("VFolder on Mailing List")); - } else { - filter_menu[MLIST_FILTER].name = g_strdup_printf (_("Filter on Mailing List (%s)"), mlist); - filter_menu[MLIST_VFOLDER].name = g_strdup_printf (_("VFolder on Mailing List (%s)"), mlist); - } - - menu = e_popup_menu_create (context_menu, enable_mask, hide_mask, fb); - e_auto_kill_popup_menu_on_hide (menu); - - if (event->type == GDK_KEY_PRESS) { - struct cmpf_data closure; - - closure.tree = tree; - closure.row = row; - closure.col = col; - gtk_menu_popup (menu, NULL, NULL, context_menu_position_func, - &closure, 0, event->key.time); - } else { - gtk_menu_popup (menu, NULL, NULL, NULL, NULL, - event->button.button, event->button.time); - } - - g_free (filter_menu[MLIST_FILTER].name); - g_free (filter_menu[MLIST_VFOLDER].name); - - return TRUE; -} - -static gint -on_key_press (GtkWidget *widget, GdkEventKey *key, gpointer data) -{ - FolderBrowser *fb = data; - ETreePath *path; - int row; - - if (key->state & GDK_CONTROL_MASK) - return FALSE; - - path = e_tree_get_cursor (fb->message_list->tree); - row = e_tree_row_of_node (fb->message_list->tree, path); - - switch (key->keyval) { - case GDK_Delete: - case GDK_KP_Delete: - delete_msg (NULL, fb); - return TRUE; - - case GDK_Menu: - on_right_click (fb->message_list->tree, row, path, 2, - (GdkEvent *)key, fb); - return TRUE; - case '!': - toggle_as_important (NULL, fb, NULL); - return TRUE; - } - - return FALSE; -} - -static int -etree_key (ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, FolderBrowser *fb) -{ - GtkAdjustment *vadj; - gfloat page_size; - - if ((ev->key.state & GDK_CONTROL_MASK) != 0) - return FALSE; - - vadj = e_scroll_frame_get_vadjustment (fb->mail_display->scroll); - page_size = vadj->page_size - vadj->step_increment; - - switch (ev->key.keyval) { - case GDK_space: - /* Work around Ximian 4939 */ - if (vadj->upper < vadj->page_size) - break; - if (vadj->value < vadj->upper - vadj->page_size - page_size) - vadj->value += page_size; - else - vadj->value = vadj->upper - vadj->page_size; - gtk_adjustment_value_changed (vadj); - break; - case GDK_BackSpace: - if (vadj->value > vadj->lower + page_size) - vadj->value -= page_size; - else - vadj->value = vadj->lower; - gtk_adjustment_value_changed (vadj); - break; - case GDK_Return: - case GDK_KP_Enter: - case GDK_ISO_Enter: - open_msg (NULL, fb); - break; - default: - return on_key_press ((GtkWidget *)tree, (GdkEventKey *)ev, fb); - } - - return TRUE; -} - -static void -on_double_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, FolderBrowser *fb) -{ - /* Ignore double-clicks on columns where single-click doesn't - * just select. - */ - if (MESSAGE_LIST_COLUMN_IS_ACTIVE (col)) - return; - - open_msg (NULL, fb); -} - -static void -on_selection_changed (GtkObject *obj, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - FolderBrowserSelectionState state; - - /* we can get this signal at strange times... - * if no uicomp, don't even bother */ - - if (fb->uicomp == NULL) - return; - - switch (e_selection_model_selected_count (E_SELECTION_MODEL (obj))) { - case 0: - state = FB_SELSTATE_NONE; - break; - case 1: - state = FB_SELSTATE_SINGLE; - break; - default: - state = FB_SELSTATE_MULTIPLE; - break; - } - - folder_browser_ui_set_selection_state (fb, state); - - update_status_bar_idle(fb); -} - -static void -fb_resize_cb (GtkWidget *w, GtkAllocation *a, FolderBrowser *fb) -{ - if (fb->preview_shown) - mail_config_set_paned_size (a->height); -} - -static void -folder_browser_gui_init (FolderBrowser *fb) -{ - extern RuleContext *search_context; - ESelectionModel *esm; - - /* The panned container */ - fb->vpaned = e_vpaned_new (); - gtk_widget_show (fb->vpaned); - - gtk_table_attach (GTK_TABLE (fb), fb->vpaned, - 0, 1, 1, 3, - GTK_FILL | GTK_EXPAND, - GTK_FILL | GTK_EXPAND, - 0, 0); - - /* quick-search bar */ - if (search_context) { - const char *systemrules = gtk_object_get_data (GTK_OBJECT (search_context), "system"); - const char *userrules = gtk_object_get_data (GTK_OBJECT (search_context), "user"); - - fb->search = e_filter_bar_new (search_context, systemrules, userrules, - folder_browser_config_search, fb); - e_search_bar_set_menu ((ESearchBar *)fb->search, folder_browser_search_menu_items); - } - - gtk_widget_show (GTK_WIDGET (fb->search)); - - gtk_signal_connect (GTK_OBJECT (fb->search), "query_changed", - GTK_SIGNAL_FUNC (folder_browser_search_query_changed), fb); - gtk_signal_connect (GTK_OBJECT (fb->search), "menu_activated", - GTK_SIGNAL_FUNC (folder_browser_search_menu_activated), fb); - - - gtk_table_attach (GTK_TABLE (fb), GTK_WIDGET (fb->search), - 0, 1, 0, 1, - GTK_FILL | GTK_EXPAND, - 0, - 0, 0); - - esm = e_tree_get_selection_model (E_TREE (fb->message_list->tree)); - gtk_signal_connect (GTK_OBJECT (esm), "selection_changed", on_selection_changed, fb); - fb->selection_state = FB_SELSTATE_NONE; /* default to none */ - - e_paned_add1 (E_PANED (fb->vpaned), GTK_WIDGET (fb->message_list)); - gtk_widget_show (GTK_WIDGET (fb->message_list)); - - gtk_signal_connect (GTK_OBJECT (fb->message_list), "size_allocate", - GTK_SIGNAL_FUNC (fb_resize_cb), fb); - - e_paned_add2 (E_PANED (fb->vpaned), GTK_WIDGET (fb->mail_display)); - e_paned_set_position (E_PANED (fb->vpaned), mail_config_get_paned_size ()); - gtk_widget_show (GTK_WIDGET (fb->mail_display)); - gtk_widget_show (GTK_WIDGET (fb)); -} - -/* mark the message seen if the current message still matches */ -static gint -do_mark_seen (gpointer data) -{ - FolderBrowser *fb = FOLDER_BROWSER (data); - - if (fb->new_uid && fb->loaded_uid && !strcmp (fb->new_uid, fb->loaded_uid)) { - camel_folder_set_message_flags (fb->folder, fb->new_uid, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN); - } - - return FALSE; -} - -/* callback when we have the message to display, after async loading it (see below) */ -/* if we have pending uid's, it means another was selected before we finished displaying - the last one - so we cycle through and start loading the pending one immediately now */ -static void -done_message_selected (CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *data) -{ - FolderBrowser *fb = data; - int timeout = mail_config_get_mark_as_seen_timeout (); - - if (folder != fb->folder || fb->mail_display == NULL) - return; - - mail_display_set_message (fb->mail_display, (CamelMedium *)msg); - - /* FIXME: should this signal be emitted here?? */ - gtk_signal_emit (GTK_OBJECT (fb), folder_browser_signals [MESSAGE_LOADED], uid); - - /* pain, if we have pending stuff, re-run */ - if (fb->pending_uid) { - g_free (fb->loading_uid); - fb->loading_uid = fb->pending_uid; - fb->pending_uid = NULL; - - mail_get_message (fb->folder, fb->loading_uid, done_message_selected, fb, mail_thread_new); - return; - } - - g_free (fb->loaded_uid); - fb->loaded_uid = fb->loading_uid; - fb->loading_uid = NULL; - - folder_browser_ui_message_loaded (fb); - - /* if we are still on the same message, do the 'idle read' thing */ - if (fb->seen_id) - gtk_timeout_remove (fb->seen_id); - - if (mail_config_get_do_seen_timeout () && msg) { - if (timeout > 0) - fb->seen_id = gtk_timeout_add (timeout, do_mark_seen, fb); - else - do_mark_seen (fb); - } -} - -/* ok we waited enough, display it anyway (see below) */ -static gboolean -do_message_selected (FolderBrowser *fb) -{ - d(printf ("%p: selecting uid %s (delayed)\n", fb, fb->new_uid ? fb->new_uid : "NONE")); - - fb->loading_id = 0; - - /* if we are loading, then set a pending, but leave the loading, coudl cancel here (?) */ - if (fb->loading_uid) { - g_free (fb->pending_uid); - fb->pending_uid = g_strdup (fb->new_uid); - } else { - if (fb->new_uid) { - fb->loading_uid = g_strdup (fb->new_uid); - mail_get_message (fb->folder, fb->loading_uid, done_message_selected, fb, mail_thread_new); - } else { - mail_display_set_message (fb->mail_display, NULL); - } - } - - return FALSE; -} - -/* when a message is selected, wait a while before trying to display it */ -static void -on_message_selected (MessageList *ml, const char *uid, FolderBrowser *fb) -{ - d(printf ("%p: selecting uid %s (direct)\n", fb, uid ? uid : "NONE")); - - if (fb->loading_id != 0) - gtk_timeout_remove (fb->loading_id); - - g_free (fb->new_uid); - fb->new_uid = g_strdup (uid); - - if (fb->preview_shown) - fb->loading_id = gtk_timeout_add (100, (GtkFunction)do_message_selected, fb); -} - -static void -folder_browser_init (GtkObject *object) -{ - FolderBrowser *fb = (FolderBrowser *)object; - - fb->async_event = mail_async_event_new(); - fb->get_id = -1; -} - -static void -my_folder_browser_init (GtkObject *object) -{ - FolderBrowser *fb = FOLDER_BROWSER (object); - int i; - - fb->view_collection = NULL; - fb->view_menus = NULL; - - fb->pref_master = FALSE; - - /* - * Setup parent class fields. - */ - GTK_TABLE (fb)->homogeneous = FALSE; - gtk_table_resize (GTK_TABLE (fb), 1, 2); - - /* - * Our instance data - */ - fb->message_list = (MessageList *)message_list_new (); - fb->mail_display = (MailDisplay *)mail_display_new (); - - fb->preview_shown = TRUE; - - gtk_signal_connect (GTK_OBJECT (fb->mail_display->html), - "key_press_event", GTK_SIGNAL_FUNC (on_key_press), fb); - - gtk_signal_connect (GTK_OBJECT (fb->message_list->tree), - "key_press", GTK_SIGNAL_FUNC (etree_key), fb); - - gtk_signal_connect (GTK_OBJECT (fb->message_list->tree), - "right_click", GTK_SIGNAL_FUNC (on_right_click), fb); - - gtk_signal_connect (GTK_OBJECT (fb->message_list->tree), - "double_click", GTK_SIGNAL_FUNC (on_double_click), fb); - - gtk_signal_connect (GTK_OBJECT (fb->message_list), "message_selected", - on_message_selected, fb); - - /* drag & drop */ - e_tree_drag_source_set (fb->message_list->tree, GDK_BUTTON1_MASK, - drag_types, num_drag_types, GDK_ACTION_MOVE | GDK_ACTION_COPY); - - gtk_signal_connect (GTK_OBJECT (fb->message_list->tree), "tree_drag_data_get", - GTK_SIGNAL_FUNC (message_list_drag_data_get), fb); - - e_tree_drag_dest_set (fb->message_list->tree, GTK_DEST_DEFAULT_ALL, - drag_types, num_drag_types, GDK_ACTION_MOVE | GDK_ACTION_COPY); - - gtk_signal_connect (GTK_OBJECT (fb->message_list->tree), "tree_drag_data_received", - GTK_SIGNAL_FUNC (message_list_drag_data_received), fb); - - /* cut, copy & paste */ - fb->invisible = gtk_invisible_new (); - - for (i = 0; i < num_paste_types; i++) - gtk_selection_add_target (fb->invisible, clipboard_atom, - paste_types[i].target, - paste_types[i].info); - - gtk_signal_connect (GTK_OBJECT (fb->invisible), - "selection_get", - GTK_SIGNAL_FUNC (selection_get), - (gpointer) fb); - gtk_signal_connect (GTK_OBJECT (fb->invisible), - "selection_clear_event", - GTK_SIGNAL_FUNC (selection_clear_event), - (gpointer) fb); - gtk_signal_connect (GTK_OBJECT (fb->invisible), - "selection_received", - GTK_SIGNAL_FUNC (selection_received), - (gpointer) fb); - - folder_browser_gui_init (fb); -} - -GtkWidget * -folder_browser_new (const GNOME_Evolution_Shell shell, const char *uri) -{ - CORBA_Environment ev; - FolderBrowser *folder_browser; - - CORBA_exception_init (&ev); - - folder_browser = gtk_type_new (folder_browser_get_type ()); - - my_folder_browser_init (GTK_OBJECT (folder_browser)); - - folder_browser->shell = CORBA_Object_duplicate (shell, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - folder_browser->shell = CORBA_OBJECT_NIL; - gtk_widget_destroy (GTK_WIDGET (folder_browser)); - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - folder_browser->uri = g_strdup (uri); - gtk_object_ref (GTK_OBJECT (folder_browser)); - folder_browser->get_id = mail_get_folder (folder_browser->uri, 0, got_folder, folder_browser, mail_thread_new); - - return GTK_WIDGET (folder_browser); -} - - -E_MAKE_TYPE (folder_browser, "FolderBrowser", FolderBrowser, folder_browser_class_init, folder_browser_init, PARENT_TYPE); diff --git a/mail/folder-browser.h b/mail/folder-browser.h deleted file mode 100644 index 848a312327..0000000000 --- a/mail/folder-browser.h +++ /dev/null @@ -1,175 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - - -#ifndef _FOLDER_BROWSER_H_ -#define _FOLDER_BROWSER_H_ - -#include <gtk/gtktable.h> -#include "camel/camel-stream.h" -#include <bonobo/bonobo-property-bag.h> -#include <bonobo/bonobo-ui-component.h> -#include <widgets/misc/e-filter-bar.h> -#include "widgets/menus/gal-view-menus.h" -#include "filter/filter-rule.h" -#include "filter/filter-context.h" /*eek*/ -#include "message-list.h" -#include "mail-display.h" -#include "mail-types.h" -#include "shell/Evolution.h" - -#define FOLDER_BROWSER_TYPE (folder_browser_get_type ()) -#define FOLDER_BROWSER(o) (GTK_CHECK_CAST ((o), FOLDER_BROWSER_TYPE, FolderBrowser)) -#define FOLDER_BROWSER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), FOLDER_BROWSER_TYPE, FolderBrowserClass)) -#define IS_FOLDER_BROWSER(o) (GTK_CHECK_TYPE ((o), FOLDER_BROWSER_TYPE)) -#define IS_FOLDER_BROWSER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), FOLDER_BROWSER_TYPE)) - -#define FB_DEFAULT_CHARSET _("Default") - -#define FOLDER_BROWSER_IS_DESTROYED(fb) (!fb || !fb->message_list || !fb->mail_display) - -typedef enum _FolderBrowserSelectionState { - FB_SELSTATE_NONE, - FB_SELSTATE_SINGLE, - FB_SELSTATE_MULTIPLE, - FB_SELSTATE_UNDEFINED -} FolderBrowserSelectionState; - -struct _FolderBrowser { - GtkTable parent; - - BonoboPropertyBag *properties; - - GNOME_Evolution_Shell shell; - GNOME_Evolution_ShellView shell_view; - - BonoboUIComponent *uicomp; - - /* - * The current URI being displayed by the FolderBrowser - */ - char *uri; - CamelFolder *folder; - int unread_count; /* last known unread message count */ - - /* async loading stuff */ - char *loading_uid;/* what uid am i loading now */ - char *pending_uid; /* what uid should i load next */ - char *new_uid; /* place to save the next uid during idle timeout */ - char *loaded_uid; /* what we have loaded */ - guint loading_id, seen_id; - - /* a folder we are expunging, dont use other than to compare the pointer value */ - CamelFolder *expunging; - - MessageList *message_list; - MailDisplay *mail_display; - GtkWidget *vpaned; - - EFilterBar *search; - FilterRule *search_full; /* if we have a full search active */ - - gboolean preview_shown; - gboolean threaded; - gboolean pref_master; - - FolderBrowserSelectionState selection_state; - GSList *sensitize_changes; - GHashTable *sensitise_state; /* the last sent sensitise state, to avoid much bonobo overhead */ - int sensitize_timeout_id; - int update_status_bar_idle_id; - - /* View collection and the menu handler object */ - GalViewCollection *view_collection; - GalViewMenus *view_menus; - - GtkWidget *invisible; - GByteArray *clipboard_selection; - - /* for async events */ - struct _MailAsyncEvent *async_event; - - int get_id; /* for getting folder op */ -}; - -typedef struct { - GtkTableClass parent_class; - - /* signals */ - void (*folder_loaded) (FolderBrowser *fb, const char *uri); - void (*message_loaded) (FolderBrowser *fb, const char *uid); -} FolderBrowserClass; - -struct fb_ondemand_closure { - FilterRule *rule; - FolderBrowser *fb; - gchar *path; -}; - -GtkType folder_browser_get_type (void); -GtkWidget *folder_browser_new (const GNOME_Evolution_Shell shell, - const char *uri); - -void folder_browser_set_ui_component (FolderBrowser *fb, BonoboUIComponent *uicomp); -void folder_browser_set_shell_view (FolderBrowser *fb, GNOME_Evolution_ShellView shell_view); - -void folder_browser_set_message_preview (FolderBrowser *folder_browser, - gboolean show_message_preview); -void folder_browser_clear_search (FolderBrowser *fb); - -void folder_browser_cut (GtkWidget *widget, FolderBrowser *fb); -void folder_browser_copy (GtkWidget *widget, FolderBrowser *fb); -void folder_browser_paste (GtkWidget *widget, FolderBrowser *fb); - -/* callbacks for functions on the folder-browser */ -void vfolder_subject (GtkWidget *w, FolderBrowser *fb); -void vfolder_sender (GtkWidget *w, FolderBrowser *fb); -void vfolder_recipient (GtkWidget *w, FolderBrowser *fb); -void vfolder_mlist (GtkWidget *w, FolderBrowser *fb); - -void filter_subject (GtkWidget *w, FolderBrowser *fb); -void filter_sender (GtkWidget *w, FolderBrowser *fb); -void filter_recipient (GtkWidget *w, FolderBrowser *fb); -void filter_mlist (GtkWidget *w, FolderBrowser *fb); - -void hide_read(GtkWidget *w, FolderBrowser *fb); -void hide_deleted(GtkWidget *w, FolderBrowser *fb); -void hide_selected(GtkWidget *w, FolderBrowser *fb); -void hide_none(GtkWidget *w, FolderBrowser *fb); -void hide_subject(GtkWidget *w, FolderBrowser *fb); -void hide_sender(GtkWidget *w, FolderBrowser *fb); - -void folder_browser_toggle_preview (BonoboUIComponent *component, - const char *path, - Bonobo_UIComponent_EventType type, - const char *state, - gpointer user_data); - -void folder_browser_toggle_threads (BonoboUIComponent *component, - const char *path, - Bonobo_UIComponent_EventType type, - const char *state, - gpointer user_data); - -void folder_browser_toggle_hide_deleted (BonoboUIComponent *component, - const char *path, - Bonobo_UIComponent_EventType type, - const char *state, - gpointer user_data); - -void folder_browser_set_message_display_style (BonoboUIComponent *component, - const char *path, - Bonobo_UIComponent_EventType type, - const char *state, - gpointer user_data); - -void folder_browser_charset_changed (BonoboUIComponent *component, - const char *path, - Bonobo_UIComponent_EventType type, - const char *state, - gpointer user_data); - -gboolean folder_browser_is_drafts (FolderBrowser *fb); -gboolean folder_browser_is_sent (FolderBrowser *fb); -gboolean folder_browser_is_outbox (FolderBrowser *fb); - -#endif /* _FOLDER_BROWSER_H_ */ diff --git a/mail/folder-info.c b/mail/folder-info.c deleted file mode 100644 index b916f2fb16..0000000000 --- a/mail/folder-info.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * folder-info.c: Implementation of GNOME_Evolution_FolderInfo - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Iain Holmes <iain@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "Mail.h" - -#include <glib.h> -#include <libgnome/gnome-defs.h> - -#include <bonobo/bonobo-xobject.h> -#include <bonobo/bonobo-generic-factory.h> -#include <bonobo/bonobo-context.h> -#include <bonobo/bonobo-exception.h> - -#include "mail.h" -#include "mail-mt.h" -#include "mail-tools.h" - -#include <camel/camel-folder.h> -#include <camel/camel-exception.h> - -#define FOLDER_INFO_IID "OAFIID:GNOME_Evolution_FolderInfo_Factory" - -#define PARENT_TYPE BONOBO_X_OBJECT_TYPE -static BonoboObjectClass *parent_class = NULL; - -typedef struct _EvolutionFolderInfo EvolutionFolderInfo; -typedef struct _EvolutionFolderInfoClass EvolutionFolderInfoClass; - -struct _EvolutionFolderInfo { - BonoboXObject parent; -}; - -struct _EvolutionFolderInfoClass { - BonoboXObjectClass parent_class; - - POA_GNOME_Evolution_FolderInfo__epv epv; -}; - -/* MT stuff */ -struct _folder_info_msg { - struct _mail_msg msg; - - Bonobo_Listener listener; - char *foldername; - - int read; - int unread; -}; - -static GtkType evolution_folder_info_get_type (void); - -static char * -do_describe_info (struct _mail_msg *mm, gint complete) -{ - return g_strdup (_("Getting Folder Information")); -} - -static void -do_get_info (struct _mail_msg *mm) -{ - struct _folder_info_msg *m = (struct _folder_info_msg *) mm; - CamelFolder *folder; - CamelException *ex; -#if 0 - char *uri_dup; - char *foldername, *start, *end; - char *storage, *protocol, *uri; - /* Fixme: Do other stuff. Different stuff to the stuff below */ - uri_dup = g_strdup (m->foldername); - start = uri_dup + 11; - g_warning ("Start: %s", start); - - end = strrchr (start, '/'); - if (end == NULL) { - g_warning ("Bugger"); - return; - } - - storage = g_strndup (start, end - start); - start = end + 1; - foldername = g_strdup (start); - - g_free (uri_dup); - - /* Work out the protocol. - The storage is going to start as local, or vfolder, or an imap - server. */ - g_warning ("Storage: %s", storage); - if (strncmp (storage, "local", 5) == 0) { - char *evolution_dir; - char *proto; - - evolution_dir = gnome_util_prepend_user_home ("evolution/local"); - proto = g_strconcat ("file://", evolution_dir, NULL); - uri = e_path_to_physical (proto, foldername); - g_free (evolution_dir); - g_free (proto); - - } else if (strncmp (storage, "vfolder", 7) == 0) { - uri = g_strconcat ("vfolder://", foldername, NULL); - } else { - uri = g_strconcat ("imap://", storage, foldername, NULL); - } -#endif - - ex = camel_exception_new (); - folder = mail_tool_uri_to_folder (m->foldername, 0, ex); - if (camel_exception_is_set (ex)) { - g_warning ("Camel exception: %s", camel_exception_get_description (ex)); - } - - camel_exception_free (ex); - - m->read = camel_folder_get_message_count (folder); - m->unread = camel_folder_get_unread_message_count (folder); -} - -static void -do_got_info (struct _mail_msg *mm) -{ - struct _folder_info_msg *m = (struct _folder_info_msg *) mm; - CORBA_Environment ev; - CORBA_any a; - GNOME_Evolution_FolderInfo_MessageCount count; - - /*g_print ("You've got mail: %d, %d\n", m->read, m->unread);*/ - - count.path = m->foldername; - count.count = m->read; - count.unread = m->unread; - - a._type = (CORBA_TypeCode) TC_GNOME_Evolution_FolderInfo_MessageCount; - a._value = &count; - - CORBA_exception_init (&ev); - Bonobo_Listener_event (m->listener, "youve-got-mail", &a, &ev); - if (BONOBO_EX (&ev)) { - g_warning ("Got exception on listener: %s", CORBA_exception_id (&ev)); - } - CORBA_exception_free (&ev); -} - -static void -do_free_info (struct _mail_msg *mm) -{ - struct _folder_info_msg *m = (struct _folder_info_msg *) mm; - - g_free (m->foldername); -} - -struct _mail_msg_op get_info_op = { - do_describe_info, - do_get_info, - do_got_info, - do_free_info, -}; - -typedef struct { - int read; - int unread; -} MailFolderInfo; - -/* Returns a MailFolderInfo struct or NULL on error */ -static void -mail_get_info (const char *foldername, - Bonobo_Listener listener) -{ - CORBA_Environment ev; - struct _folder_info_msg *m; - - m = mail_msg_new (&get_info_op, NULL, sizeof (*m)); - - /*g_print ("Folder: %s", foldername);*/ - m->foldername = g_strdup (foldername); - - CORBA_exception_init (&ev); - m->listener = bonobo_object_dup_ref (listener, &ev); - CORBA_exception_free (&ev); - - e_thread_put (mail_thread_new, (EMsg *) m); -} - -static void -impl_GNOME_Evolution_FolderInfo_getInfo (PortableServer_Servant servant, - const CORBA_char *foldername, - const Bonobo_Listener listener, - CORBA_Environment *ev) -{ - mail_get_info (foldername, listener); -} - -static void -evolution_folder_info_class_init (EvolutionFolderInfoClass *klass) -{ - POA_GNOME_Evolution_FolderInfo__epv *epv = &klass->epv; - - parent_class = gtk_type_class (PARENT_TYPE); - epv->getInfo = impl_GNOME_Evolution_FolderInfo_getInfo; -} - -static void -evolution_folder_info_init (EvolutionFolderInfo *info) -{ -} - -BONOBO_X_TYPE_FUNC_FULL (EvolutionFolderInfo, - GNOME_Evolution_FolderInfo, - PARENT_TYPE, - evolution_folder_info); - -static BonoboObject * -evolution_folder_info_factory_fn (BonoboGenericFactory *factory, - void *closure) -{ - EvolutionFolderInfo *info; - - info = gtk_type_new (evolution_folder_info_get_type ()); - return BONOBO_OBJECT (info); -} - -gboolean -evolution_folder_info_factory_init (void) -{ - BonoboGenericFactory *factory; - - factory = bonobo_generic_factory_new (FOLDER_INFO_IID, - evolution_folder_info_factory_fn, - NULL); - - if (factory == NULL) { - g_warning ("Error starting FolderInfo"); - return FALSE; - } - - bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory)); - return TRUE; -} diff --git a/mail/importers/.cvsignore b/mail/importers/.cvsignore deleted file mode 100644 index ee1568b9e0..0000000000 --- a/mail/importers/.cvsignore +++ /dev/null @@ -1,12 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -*.bb -*.bbg -*.da -*.gcov -*.oaf -*.lo -*.la
\ No newline at end of file diff --git a/mail/importers/GNOME_Evolution_Mail_Mbox_Importer.oaf.in b/mail/importers/GNOME_Evolution_Mail_Mbox_Importer.oaf.in deleted file mode 100644 index b9da9ce3c8..0000000000 --- a/mail/importers/GNOME_Evolution_Mail_Mbox_Importer.oaf.in +++ /dev/null @@ -1,29 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:GNOME_Evolution_Mail_Mbox_ImporterFactory" - type="exe" - location="evolution-mail"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/ObjectFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Factory to import mbox into Evolution"/> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Mail_Mbox_Importer" - type="factory" - location="OAFIID:GNOME_Evolution_Mail_Mbox_ImporterFactory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/Evolution/Importer:1.0"/> - </oaf_attribute> - - <oaf_attribute name="evolution:menu-name" type="string" - value="MBox (mbox)"/> - <oaf_attribute name="description" type="string" - _value="Imports mbox files into Evolution"/> -</oaf_server> - -</oaf_info> diff --git a/mail/importers/GNOME_Evolution_Mail_Outlook_Importer.oaf.in b/mail/importers/GNOME_Evolution_Mail_Outlook_Importer.oaf.in deleted file mode 100644 index 66317e3d7a..0000000000 --- a/mail/importers/GNOME_Evolution_Mail_Outlook_Importer.oaf.in +++ /dev/null @@ -1,29 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:GNOME_Evolution_Mail_Outlook_ImporterFactory" - type="exe" - location="evolution-mail"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/ObjectFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Factory to import Outlook Express 4 mails into Evolution"/> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Mail_Outlook_Importer" - type="factory" - location="OAFIID:GNOME_Evolution_Mail_Outlook_ImporterFactory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/Evolution/Importer:1.0"/> - </oaf_attribute> - - <oaf_attribute name="evolution:menu-name" type="string" - value="Outlook Express 4 (.mbx)"/> - <oaf_attribute name="description" type="string" - _value="Imports Outlook Express 4 files into Evolution"/> -</oaf_server> - -</oaf_info> diff --git a/mail/importers/Makefile.am b/mail/importers/Makefile.am deleted file mode 100644 index 6767fde715..0000000000 --- a/mail/importers/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -importersdir = $(pkglibdir)/evolution-mail-importers/$(VERSION) - -importers_LTLIBRARIES = liboutlook.la libmbox.la - -INCLUDES = -I.. \ - -I$(srcdir)/.. \ - -I$(top_srcdir) \ - -I$(top_srcdir)/shell \ - -I$(top_builddir)/shell \ - -I$(includedir) \ - $(EXTRA_GNOME_CFLAGS) \ - $(BONOBO_GNOME_CFLAGS) \ - -DG_LOG_DOMAIN=\"evolution-mail-importer\" - -liboutlook_la_SOURCES = \ - evolution-outlook-importer.c -liboutlook_la_LDFLAGS = -version-info 0:0:0 - -libmbox_la_SOURCES = evolution-mbox-importer.c -libmbox_la_LDFLAGS = -version-info 0:0:0 - -oafdir = $(datadir)/oaf -oaf_in_files = GNOME_Evolution_Mail_Mbox_Importer.oaf.in \ - GNOME_Evolution_Mail_Outlook_Importer.oaf.in - -oaf_DATA = $(oaf_in_files:.oaf.in=.oaf) - -EXTRA_DIST = $(oaf_in_files) $(oaf_DATA) - -@XML_I18N_MERGE_OAF_RULE@ diff --git a/mail/importers/evolution-mbox-importer.c b/mail/importers/evolution-mbox-importer.c deleted file mode 100644 index b977ce6ac7..0000000000 --- a/mail/importers/evolution-mbox-importer.c +++ /dev/null @@ -1,357 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* evolution-mbox-importer.c - * - * Authors: Iain Holmes <iain@ximian.com> - * - * Copyright (C) 2001 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include <stdio.h> - -#include <bonobo/bonobo-object.h> -#include <bonobo/bonobo-generic-factory.h> - -#include <camel/camel-exception.h> -#include <camel/camel-mime-message.h> -#include <camel/camel-mime-parser.h> -#include <camel/camel-mime-part.h> - -#include <importer/evolution-importer.h> -#include <importer/GNOME_Evolution_Importer.h> - -#include "mail/mail-importer.h" -#include "mail-tools.h" - -#include "e-util/e-path.h" - -/* #define IMPORTER_DEBUG */ -#ifdef IMPORTER_DEBUG -#define IN g_print ("=====> %s (%d)\n", __FUNCTION__, __LINE__) -#define OUT g_print ("<==== %s (%d)\n", __FUNCTION__, __LINE__) -#else -#define IN -#define OUT -#endif - -#define MBOX_FACTORY_IID "OAFIID:GNOME_Evolution_Mail_Mbox_ImporterFactory" - -typedef struct { - MailImporter importer; /* Parent */ - - char *filename; - int num; - CamelMimeParser *mp; - gboolean is_folder; -} MboxImporter; - -void mail_importer_module_init (void); - -/* EvolutionImporter methods */ - -static void -process_item_fn (EvolutionImporter *eimporter, - CORBA_Object listener, - void *closure, - CORBA_Environment *ev) -{ - MboxImporter *mbi = (MboxImporter *) closure; - MailImporter *importer = (MailImporter *) mbi; - gboolean done = FALSE; - CamelException *ex; - - if (importer->folder == NULL) { - GNOME_Evolution_ImporterListener_notifyResult (listener, - GNOME_Evolution_ImporterListener_NOT_READY, - TRUE, ev); - return; - } - - if (mbi->is_folder == TRUE) { - GNOME_Evolution_ImporterListener_notifyResult (listener, - GNOME_Evolution_ImporterListener_OK, - FALSE, ev); - return; - } - - ex = camel_exception_new (); - if (camel_mime_parser_step (mbi->mp, 0, 0) == HSCAN_FROM) { - /* Import the next message */ - CamelMimeMessage *msg; - CamelMessageInfo *info; - - IN; - msg = camel_mime_message_new (); - if (camel_mime_part_construct_from_parser (CAMEL_MIME_PART (msg), - mbi->mp) == -1) { - g_warning ("Failed message %d", mbi->num); - camel_object_unref (CAMEL_OBJECT (msg)); - done = TRUE; - } - - /* write the mesg */ - info = g_new0 (CamelMessageInfo, 1); - camel_folder_append_message (importer->folder, msg, info, ex); - g_free (info); - camel_object_unref (CAMEL_OBJECT (msg)); - if (camel_exception_is_set (ex)) { - g_warning ("Failed message %d", mbi->num); - done = TRUE; - } - OUT; - } else { - IN; - /* all messages have now been imported */ - camel_folder_sync (importer->folder, FALSE, ex); - camel_folder_thaw (importer->folder); - importer->frozen = FALSE; - done = TRUE; - OUT; - } - - if (!done) { - camel_mime_parser_step (mbi->mp, 0, 0); - } - - camel_exception_free (ex); - GNOME_Evolution_ImporterListener_notifyResult (listener, - GNOME_Evolution_ImporterListener_OK, - !done, ev); - return; -} - -static gboolean -support_format_fn (EvolutionImporter *importer, - const char *filename, - void *closure) -{ - char signature[6]; - gboolean ret = FALSE; - int fd, n; - - fd = open (filename, O_RDONLY); - if (fd == -1) - return FALSE; - - n = read (fd, signature, 5); - if (n > 0) { - signature[n] = '\0'; - if (!g_strncasecmp (signature, "From ", 5)) - ret = TRUE; - } - - close (fd); - - return ret; -} - -static void -importer_destroy_cb (GtkObject *object, - MboxImporter *mbi) -{ - MailImporter *importer; - - importer = (MailImporter *) mbi; - if (importer->frozen) { - camel_folder_sync (importer->folder, FALSE, NULL); - camel_folder_thaw (importer->folder); - } - - if (importer->folder) - camel_object_unref (CAMEL_OBJECT (importer->folder)); - - g_free (mbi->filename); - if (mbi->mp) - camel_object_unref (CAMEL_OBJECT (mbi->mp)); - - g_free (mbi); -} - -static void -folder_created_cb (BonoboListener *listener, - const char *event_name, - const BonoboArg *event_data, - CORBA_Environment *ev, - MailImporter *importer) -{ - char *fullpath; - GNOME_Evolution_Storage_FolderResult *result; - CamelException *ex; - - if (strcmp (event_name, "evolution-shell:folder_created") != 0) { - return; /* Unknown event */ - } - - result = event_data->_value; - fullpath = g_strconcat ("file://", result->path, NULL); - - ex = camel_exception_new (); - importer->folder = mail_tool_uri_to_folder (fullpath, CAMEL_STORE_FOLDER_CREATE, ex); - if (camel_exception_is_set (ex)) { - g_warning ("Error opening %s", fullpath); - camel_exception_free (ex); - - g_free (fullpath); - return; - } - - camel_folder_freeze (importer->folder); - importer->frozen = TRUE; - - g_free (fullpath); - bonobo_object_unref (BONOBO_OBJECT (listener)); -} - -static gboolean -load_file_fn (EvolutionImporter *eimporter, - const char *filename, - const char *folderpath, - void *closure) -{ - MboxImporter *mbi; - MailImporter *importer; - gboolean delayed = FALSE; - struct stat buf; - int fd; - - mbi = (MboxImporter *) closure; - importer = (MailImporter *) mbi; - - mbi->filename = g_strdup (filename); - - fd = open (filename, O_RDONLY); - if (fd == -1) { - g_warning ("Cannot open file"); - return FALSE; - } - - fstat (fd, &buf); - if (S_ISREG (buf.st_mode)) { - mbi->mp = camel_mime_parser_new (); - camel_mime_parser_scan_from (mbi->mp, TRUE); - if (camel_mime_parser_init_with_fd (mbi->mp, fd) == -1) { - g_warning ("Unable to process spool folder"); - goto fail; - } - mbi->is_folder = FALSE; - } else { - mbi->is_folder = TRUE; - } - - importer->mstream = NULL; - if (folderpath == NULL || *folderpath == '\0') { - importer->folder = mail_tool_get_local_inbox (NULL); - } else { - char *parent, *tmp, *fullpath, *homedir; - const char *name; - BonoboListener *listener; - CamelException *ex; - - tmp = gnome_util_prepend_user_home ("evolution/local"); - homedir = g_strconcat ("file://", tmp, NULL); - g_free (tmp); - - fullpath = e_path_to_physical (homedir, folderpath); - ex = camel_exception_new (); - importer->folder = mail_tool_uri_to_folder (fullpath, 0, ex); - g_free (homedir); - - if (camel_exception_is_set (ex) || importer->folder == NULL) { - /* Make a new directory */ - name = strrchr (folderpath, '/'); - if (name == NULL) { - parent = g_strdup ("/"); - name = folderpath; - } else { - name += 1; - parent = g_dirname (folderpath); - } - - listener = bonobo_listener_new (NULL, NULL); - gtk_signal_connect (GTK_OBJECT (listener), "event-notify", - GTK_SIGNAL_FUNC (folder_created_cb), - importer); - - mail_importer_create_folder (parent, name, NULL, listener); - camel_exception_free (ex); - ex = camel_exception_new (); - importer->folder = NULL; - g_print ("No folder yet\n"); - delayed = TRUE; - g_free (parent); - } - camel_exception_free (ex); - g_free (fullpath); - } - - if (importer->folder == NULL && delayed == FALSE){ - g_warning ("Bad folder\n"); - goto fail; - } - - if (importer->folder != NULL) { - camel_folder_freeze (importer->folder); - importer->frozen = TRUE; - } - - return TRUE; - - fail: - camel_object_unref (CAMEL_OBJECT (mbi->mp)); - mbi->mp = NULL; - - return FALSE; -} - -static BonoboObject * -mbox_factory_fn (BonoboGenericFactory *_factory, - void *closure) -{ - EvolutionImporter *importer; - MboxImporter *mbox; - - mbox = g_new0 (MboxImporter, 1); - importer = evolution_importer_new (support_format_fn, load_file_fn, - process_item_fn, NULL, mbox); - gtk_signal_connect (GTK_OBJECT (importer), "destroy", - GTK_SIGNAL_FUNC (importer_destroy_cb), mbox); - - return BONOBO_OBJECT (importer); -} - -/* Entry point */ -void -mail_importer_module_init (void) -{ - static gboolean initialised = FALSE; - BonoboGenericFactory *factory; - - if (initialised == TRUE) - return; - - factory = bonobo_generic_factory_new (MBOX_FACTORY_IID, - mbox_factory_fn, NULL); - - if (factory == NULL) - g_warning ("Could not initialise Outlook importer factory."); - - initialised = TRUE; -} - diff --git a/mail/importers/evolution-outlook-importer.c b/mail/importers/evolution-outlook-importer.c deleted file mode 100644 index 977d610055..0000000000 --- a/mail/importers/evolution-outlook-importer.c +++ /dev/null @@ -1,318 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* evolution-outlook-importer.c - * - * Authors: Iain Holmes <iain@ximian.com> - * - * Copyright (C) 2001 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include <bonobo/bonobo-object.h> -#include <bonobo/bonobo-generic-factory.h> - -#include <stdio.h> - -#include <importer/evolution-importer.h> -#include <importer/GNOME_Evolution_Importer.h> - -#include <camel/camel-exception.h> - -#include "e-util/e-memory.h" - -#include "mail-importer.h" -#include "mail-tools.h" - - -#define OUTLOOK_FACTORY_IID "OAFIID:GNOME_Evolution_Mail_Outlook_ImporterFactory" - -extern char *evolution_dir; -typedef struct { - MailImporter importer; - - char *filename; - gboolean oe4; /* Is file OE4 or not? */ - FILE *handle; - long pos; - off_t size; - - gboolean busy; -} OutlookImporter; - -struct oe_msg_segmentheader { - int self; - int increase; - int include; - int next; - int usenet; -}; - -typedef struct oe_msg_segmentheader oe_msg_segmentheader; - -/* Prototype */ - -void mail_importer_module_init (void); - - -/* EvolutionImporter methods */ - -/* Based on code from liboe 0.92 (STABLE) - Copyright (C) 2000 Stephan B. Nedregård (stephan@micropop.com) - Modified 2001 Iain Holmes <iain@ximian.com> - Copyright (C) 2001 Ximian, Inc. */ - -static void -process_item_fn (EvolutionImporter *eimporter, - CORBA_Object listener, - void *closure, - CORBA_Environment *ev) -{ - OutlookImporter *oli = (OutlookImporter *) closure; - MailImporter *importer = (MailImporter *) oli; - oe_msg_segmentheader *header; - gboolean more = TRUE; - char *cb, *sfull, *s; - long end_pos = 0; - int i; - - if (oli->busy == TRUE) { - GNOME_Evolution_ImporterListener_notifyResult (listener, - GNOME_Evolution_ImporterListener_BUSY, - more, ev); - return; - } - - oli->busy = TRUE; - header = g_new (oe_msg_segmentheader, 1); - fread (header, 16, 1, oli->handle); - - /* Write a From line */ - mail_importer_add_line (importer, - "From evolution-outlook-importer", FALSE); - end_pos = oli->pos + header->include; - if (end_pos >= oli->size) { - end_pos = oli->size; - more = FALSE; - } - - oli->pos += 4; - - cb = g_new (char, 4); - sfull = g_new (char, 65536); - s = sfull; - - while (oli->pos < end_pos) { - fread (cb, 1, 4, oli->handle); - for (i = 0; i < 4; i++, oli->pos++) { - if (*(cb + i ) != 0x0d) { - *s++ = *(cb + i); - - if (*(cb + i) == 0x0a) { - *s = '\0'; - mail_importer_add_line (importer, - sfull, FALSE); - s = sfull; - } - } - } - } - - if (s != sfull) { - *s = '\0'; - mail_importer_add_line (importer, sfull, FALSE); - s = sfull; - } - - mail_importer_add_line (importer, "\n", TRUE); - - oli->pos = end_pos; - fseek (oli->handle, oli->pos, SEEK_SET); - - g_free (header); - g_free (sfull); - g_free (cb); - - GNOME_Evolution_ImporterListener_notifyResult (listener, - GNOME_Evolution_ImporterListener_OK, - more, ev); - if (more == FALSE) { - CamelException *ex; - - ex = camel_exception_new (); - camel_folder_thaw (importer->folder); - camel_folder_sync (importer->folder, FALSE, ex); - camel_exception_free (ex); - fclose (oli->handle); - oli->handle = NULL; - } - - oli->busy = FALSE; - return; -} - - -/* EvolutionImporterFactory methods */ - -static gboolean -support_format_fn (EvolutionImporter *importer, - const char *filename, - void *closure) -{ - FILE *handle; - int signature[4]; - - /* Outlook Express sniffer. - Taken from liboe 0.92 (STABLE) - Copyright (C) 2000 Stephan B. Nedregård (stephan@micropop.com) */ - - handle = fopen (filename, "rb"); - if (handle == NULL) - return FALSE; /* Can't open file: Can't support it :) */ - - /* SIGNATURE */ - fread (&signature, 16, 1, handle); - if ((signature[0]!=0xFE12ADCF) || /* OE 5 & OE 5 BETA SIGNATURE */ - (signature[1]!=0x6F74FDC5) || - (signature[2]!=0x11D1E366) || - (signature[3]!=0xC0004E9A)) { - if ((signature[0]==0x36464D4A) && - (signature[1]==0x00010003)) /* OE4 SIGNATURE */ { - fclose (handle); - return TRUE; /* OE 4 */ - } - fclose (handle); - return FALSE; /* Not Outlook 4 or 5 */ - } - - fclose (handle); - return FALSE; /* Can't handle OE 5 yet */ -} - -static void -importer_destroy_cb (GtkObject *object, - OutlookImporter *oli) -{ - MailImporter *importer; - - importer = (MailImporter *) oli; - if (importer->folder) - camel_object_unref (CAMEL_OBJECT (importer->folder)); - - g_free (oli->filename); - if (oli->handle) - fclose (oli->handle); - - g_free (oli); -} - -static gboolean -load_file_fn (EvolutionImporter *eimporter, - const char *filename, - const char *folderpath, - void *closure) -{ - OutlookImporter *oli; - MailImporter *importer; - struct stat buf; - long pos = 0x54; - - oli = (OutlookImporter *) closure; - importer = (MailImporter *) oli; - - oli->filename = g_strdup (filename); - /* Will return TRUE if oe4 format */ - oli->oe4 = support_format_fn (NULL, filename, NULL); - if (oli->oe4 == FALSE) { - g_warning ("Not OE4 format"); - return FALSE; - } - - oli->handle = fopen (filename, "rb"); - if (oli->handle == NULL) { - g_warning ("Cannot open the file"); - return FALSE; - } - - /* Get size of file */ - if (stat (filename, &buf) == -1) { - g_warning ("Cannot stat file"); - return FALSE; - } - - oli->size = buf.st_size; - - /* Set the fposition to the begining */ - fseek (oli->handle, pos, SEEK_SET); - oli->pos = pos; - - importer->mstream = NULL; - - if (folderpath == NULL || *folderpath == '\0') - importer->folder = mail_tool_get_local_inbox (NULL); - else - importer->folder = mail_tool_uri_to_folder (folderpath, CAMEL_STORE_FOLDER_CREATE, NULL); - - if (importer->folder == NULL){ - g_warning ("Bad folder"); - return FALSE; - } - - camel_folder_freeze (importer->folder); - oli->busy = FALSE; - return TRUE; -} - -static BonoboObject * -outlook_factory_fn (BonoboGenericFactory *_factory, - void *closure) -{ - EvolutionImporter *importer; - OutlookImporter *oli; - - oli = g_new0 (OutlookImporter, 1); - - importer = evolution_importer_new (support_format_fn, load_file_fn, - process_item_fn, NULL, oli); - gtk_signal_connect (GTK_OBJECT (importer), "destroy", - GTK_SIGNAL_FUNC (importer_destroy_cb), oli); - - return BONOBO_OBJECT (importer); -} - -/* Entry point */ -void -mail_importer_module_init (void) -{ - static gboolean initialised = FALSE; - BonoboGenericFactory *factory; - - if (initialised == TRUE) - return; - - factory = bonobo_generic_factory_new (OUTLOOK_FACTORY_IID, - outlook_factory_fn, NULL); - - if (factory == NULL) - g_warning ("Could not initialise Outlook importer factory."); - - initialised = TRUE; -} - - diff --git a/mail/local-config.glade b/mail/local-config.glade deleted file mode 100644 index 291c25c1cc..0000000000 --- a/mail/local-config.glade +++ /dev/null @@ -1,270 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>Mail</name> - <program_name>mail</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> -</project> - -<widget> - <class>GnomeDialog</class> - <name>dialog_format</name> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>False</allow_grow> - <auto_shrink>False</auto_shrink> - <auto_close>False</auto_close> - <hide_on_close>False</hide_on_close> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDialog:vbox</child_name> - <name>dialog-vbox1</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>dialog-action_area1</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>8</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - <pack>GTK_PACK_END</pack> - </child> - - <widget> - <class>GtkButton</class> - <name>apply_format</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> - </widget> - - <widget> - <class>GtkButton</class> - <name>cancel_format</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frame_format</name> - <label>Mailbox Format</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkTable</class> - <name>table1</name> - <border_width>2</border_width> - <rows>3</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>0</row_spacing> - <column_spacing>2</column_spacing> - - <widget> - <class>GtkLabel</class> - <name>label2</name> - <label>New store format:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label1</name> - <label>Current store format:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label_format</name> - <label>mbox</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>7.45058e-09</xalign> - <yalign>0.5</yalign> - <xpad>8</xpad> - <ypad>0</ypad> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>option_format</name> - <can_focus>True</can_focus> - <items>mbox -maildir -mh -</items> - <initial_choice>0</initial_choice> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label5</name> - <label>Indexing:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>check_index_body</name> - <can_focus>True</can_focus> - <label>Body contents</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label4</name> - <label>Note: When converting between mailbox formats, a failure -(such as lack of disk space) may not be automatically -recoverable. Please use this feature with care.</label> - <justify>GTK_JUSTIFY_LEFT</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/mail/mail-account-editor-news.c b/mail/mail-account-editor-news.c deleted file mode 100644 index 34aeea247a..0000000000 --- a/mail/mail-account-editor-news.c +++ /dev/null @@ -1,193 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Cloned from mail-account-editor by Sam Creasey <sammy@oh.verio.com> - * - * Authors: - * Jeffrey Stedfast <fejj@ximian.com> - * Dan Winship <danw@ximian.com> - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <libgnomeui/gnome-messagebox.h> -#include <libgnomeui/gnome-stock.h> -#include <camel/camel-url.h> -#include <gal/widgets/e-unicode.h> -#include <gal/widgets/e-gui-utils.h> - -#include "mail-account-editor-news.h" -#include "mail-session.h" - -static void mail_account_editor_news_class_init (MailAccountEditorNewsClass *class); -static void mail_account_editor_news_finalize (GtkObject *obj); - -static GnomeDialogClass *parent_class; - - -GtkType -mail_account_editor_news_get_type () -{ - static GtkType type = 0; - - if (!type) { - GtkTypeInfo type_info = { - "MailAccountEditorNews", - sizeof (MailAccountEditorNews), - sizeof (MailAccountEditorNewsClass), - (GtkClassInitFunc) mail_account_editor_news_class_init, - (GtkObjectInitFunc) NULL, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL - }; - - type = gtk_type_unique (gnome_dialog_get_type (), &type_info); - } - - return type; -} - -static void -mail_account_editor_news_class_init (MailAccountEditorNewsClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - parent_class = gtk_type_class (gnome_dialog_get_type ()); - - object_class->finalize = mail_account_editor_news_finalize; -} - -static void -mail_account_editor_news_finalize (GtkObject *obj) -{ - MailAccountEditorNews *editor = (MailAccountEditorNews *) obj; - - gtk_object_unref (GTK_OBJECT (editor->xml)); - - ((GtkObjectClass *)(parent_class))->finalize (obj); -} - -static gboolean -apply_changes(MailAccountEditorNews *editor) -{ - - CamelURL *url; - GtkEntry *service_ent; - - service_ent = GTK_ENTRY(glade_xml_get_widget(editor->xml, "source_name")); - url = g_new0 (CamelURL, 1); - - url->protocol = g_strdup("nntp"); - url->host = g_strdup(gtk_entry_get_text(service_ent)); - if(strlen(url->host) == 0) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, _("You have not filled in all of the required information.")); - camel_url_free(url); - return FALSE; - } - - if(editor->service->url == NULL) - mail_config_add_news(editor->service); - - editor->service->url = camel_url_to_string(url, 0); - - mail_config_write(); - return TRUE; -} - -static void -apply_clicked (GtkWidget *widget, gpointer data) -{ - MailAccountEditorNews *editor = data; - - apply_changes (editor); -} - -static void -ok_clicked (GtkWidget *widget, gpointer data) -{ - MailAccountEditorNews *editor = data; - - if (apply_changes (editor)) - gtk_widget_destroy (GTK_WIDGET (editor)); -} - -static void -cancel_clicked (GtkWidget *widget, gpointer data) -{ - MailAccountEditorNews *editor = data; - - gtk_widget_destroy (GTK_WIDGET (editor)); -} - -MailAccountEditorNews * -mail_account_editor_news_new (MailConfigService *service) -{ - MailAccountEditorNews *editor; - GtkEntry *service_ent; - - editor = (MailAccountEditorNews *) gtk_type_new (mail_account_editor_news_get_type ()); - - editor->service = service; - editor->xml = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", NULL); - - /* get our toplevel widget and reparent it */ - editor->notebook = GTK_NOTEBOOK (glade_xml_get_widget (editor->xml, "news_editor_notebook")); - gtk_widget_reparent (GTK_WIDGET (editor->notebook), GNOME_DIALOG (editor)->vbox); - - /* give our dialog an OK button and title */ - gtk_window_set_title (GTK_WINDOW (editor), _("Evolution News Editor")); - gtk_window_set_policy (GTK_WINDOW (editor), FALSE, TRUE, TRUE); - gtk_window_set_modal (GTK_WINDOW (editor), TRUE); - gnome_dialog_append_buttons (GNOME_DIALOG (editor), - GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_APPLY, - GNOME_STOCK_BUTTON_CANCEL, - NULL); - - gnome_dialog_button_connect (GNOME_DIALOG (editor), 0 /* OK */, - GTK_SIGNAL_FUNC (ok_clicked), - editor); - gnome_dialog_button_connect (GNOME_DIALOG (editor), 1 /* APPLY */, - GTK_SIGNAL_FUNC (apply_clicked), - editor); - gnome_dialog_button_connect (GNOME_DIALOG (editor), 2 /* CANCEL */, - GTK_SIGNAL_FUNC (cancel_clicked), - editor); - - if(service->url) { - CamelURL *url; - - url = camel_url_new(service->url, NULL); - - if(url->host) { - service_ent = GTK_ENTRY(glade_xml_get_widget(editor->xml, "source_name")); - gtk_entry_set_text(service_ent, url->host); - } - - camel_url_free(url); - } - - return editor; -} diff --git a/mail/mail-account-editor-news.h b/mail/mail-account-editor-news.h deleted file mode 100644 index a89b60eab5..0000000000 --- a/mail/mail-account-editor-news.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Cloned from mail-account-editor by Sam Creasey <sammy@oh.verio.com> - * - * Authors: Jeffrey Stedfast <fejj@helixcode.com> - * - * Copyright 2001 Helix Code, Inc. (www.helixcode.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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_ACCOUNT_EDITOR_NEWS_H -#define MAIL_ACCOUNT_EDITOR_NEWS_H - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-file-entry.h> -#include <gtk/gtk.h> -#include <glade/glade-xml.h> -#include <camel/camel-provider.h> - -#include "mail-config.h" - -#define MAIL_ACCOUNT_EDITOR_NEWS_TYPE (mail_account_editor_news_get_type ()) -#define MAIL_ACCOUNT_EDITOR_NEWS(o) (GTK_CHECK_CAST ((o), MAIL_ACCOUNT_EDITOR_NEWS_TYPE, MailAccountEditorNews)) -#define MAIL_ACCOUNT_EDITOR_NEWS_CLASS(k) (GTK_CHECK_CLASS_CAST((k), MAIL_ACCOUNT_EDITOR_NEWS_TYPE, MailAccountEditorNewsClass)) -#define MAIL_IS_ACCOUNT_EDITOR_NEWS(o) (GTK_CHECK_TYPE ((o), MAIL_ACCOUNT_EDITOR_NEWS_TYPE)) -#define MAIL_IS_ACCOUNT_EDITOR_NEWS_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MAIL_ACCOUNT_EDITOR_NEWS_TYPE)) - -struct _MailAccountEditorNews { - GnomeDialog parent; - - GladeXML *xml; - MailConfigService *service; - GtkNotebook *notebook; -}; - -typedef struct _MailAccountEditorNews MailAccountEditorNews; - -typedef struct { - GnomeDialogClass parent_class; - - /* signals */ - -} MailAccountEditorNewsClass; - -GtkType mail_account_editor_news_get_type (void); - -MailAccountEditorNews *mail_account_editor_news_new (MailConfigService *service); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* MAIL_ACCOUNT_EDITOR_NEWS_H */ diff --git a/mail/mail-account-editor.c b/mail/mail-account-editor.c deleted file mode 100644 index 893cdd7426..0000000000 --- a/mail/mail-account-editor.c +++ /dev/null @@ -1,193 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Jeffrey Stedfast <fejj@ximian.com> - * Dan Winship <danw@ximian.com> - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <libgnomeui/gnome-messagebox.h> -#include <libgnomeui/gnome-stock.h> -#include <camel/camel-url.h> -#include <gal/widgets/e-unicode.h> -#include <gal/widgets/e-gui-utils.h> - -#include "mail-account-editor.h" -#include "mail-session.h" - -static void mail_account_editor_class_init (MailAccountEditorClass *class); -static void mail_account_editor_finalize (GtkObject *obj); - -static GnomeDialogClass *parent_class; - - -GtkType -mail_account_editor_get_type () -{ - static GtkType type = 0; - - if (!type) { - GtkTypeInfo type_info = { - "MailAccountEditor", - sizeof (MailAccountEditor), - sizeof (MailAccountEditorClass), - (GtkClassInitFunc) mail_account_editor_class_init, - (GtkObjectInitFunc) NULL, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL - }; - - type = gtk_type_unique (gnome_dialog_get_type (), &type_info); - } - - return type; -} - -static void -mail_account_editor_class_init (MailAccountEditorClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - parent_class = gtk_type_class (gnome_dialog_get_type ()); - - object_class->finalize = mail_account_editor_finalize; -} - -static void -mail_account_editor_finalize (GtkObject *obj) -{ - MailAccountEditor *editor = (MailAccountEditor *) obj; - - mail_account_gui_destroy (editor->gui); - ((GtkObjectClass *)(parent_class))->finalize (obj); -} - -static gboolean -apply_changes (MailAccountEditor *editor) -{ - MailConfigAccount *account; - GtkWidget *incomplete; - int page = -1; - - if (!mail_account_gui_identity_complete (editor->gui, &incomplete) || - !mail_account_gui_management_complete (editor->gui, &incomplete)) - page = 0; - else if (!mail_account_gui_source_complete (editor->gui, &incomplete)) - page = 1; - else if (!mail_account_gui_transport_complete (editor->gui, &incomplete)) - page = 3; - - if (page != -1) { - gtk_notebook_set_page (editor->notebook, page); - gtk_widget_grab_focus (incomplete); - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, _("You have not filled in all of the required information.")); - return FALSE; - } - - if (mail_account_gui_save (editor->gui) == FALSE) - return FALSE; - - /* save any changes we may have */ - mail_config_write (); - - /* FIXME: #1549: if the account was a remote store, delete it from the folder-tree and re-add it */ - /* FIXME: preferably, we'd only do this if there were changes... oh well */ - - return TRUE; -} - -static void -apply_clicked (GtkWidget *widget, gpointer data) -{ - MailAccountEditor *editor = data; - - apply_changes (editor); -} - -static void -ok_clicked (GtkWidget *widget, gpointer data) -{ - MailAccountEditor *editor = data; - - if (apply_changes (editor)) - gtk_widget_destroy (GTK_WIDGET (editor)); -} - -static void -cancel_clicked (GtkWidget *widget, gpointer data) -{ - MailAccountEditor *editor = data; - - gtk_widget_destroy (GTK_WIDGET (editor)); -} - -static void -construct (MailAccountEditor *editor, MailConfigAccount *account) -{ - MailConfigService *source = account->source; - - editor->gui = mail_account_gui_new (account); - - /* get our toplevel widget and reparent it */ - editor->notebook = GTK_NOTEBOOK (glade_xml_get_widget (editor->gui->xml, "account_editor_notebook")); - gtk_widget_reparent (GTK_WIDGET (editor->notebook), GNOME_DIALOG (editor)->vbox); - - /* give our dialog an OK button and title */ - gtk_window_set_title (GTK_WINDOW (editor), _("Evolution Account Editor")); - gtk_window_set_policy (GTK_WINDOW (editor), FALSE, TRUE, TRUE); - gtk_window_set_modal (GTK_WINDOW (editor), FALSE); - gnome_dialog_append_buttons (GNOME_DIALOG (editor), - GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_APPLY, - GNOME_STOCK_BUTTON_CANCEL, - NULL); - - gnome_dialog_button_connect (GNOME_DIALOG (editor), 0 /* OK */, - GTK_SIGNAL_FUNC (ok_clicked), - editor); - gnome_dialog_button_connect (GNOME_DIALOG (editor), 1 /* APPLY */, - GTK_SIGNAL_FUNC (apply_clicked), - editor); - gnome_dialog_button_connect (GNOME_DIALOG (editor), 2 /* CANCEL */, - GTK_SIGNAL_FUNC (cancel_clicked), - editor); - - mail_account_gui_setup (editor->gui, GTK_WIDGET (editor)); - - mail_account_gui_build_extra_conf (editor->gui, source->url); -} - -MailAccountEditor * -mail_account_editor_new (MailConfigAccount *account) -{ - MailAccountEditor *new; - - new = (MailAccountEditor *) gtk_type_new (mail_account_editor_get_type ()); - construct (new, account); - - return new; -} diff --git a/mail/mail-account-editor.h b/mail/mail-account-editor.h deleted file mode 100644 index 71be3b14d5..0000000000 --- a/mail/mail-account-editor.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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_ACCOUNT_EDITOR_H -#define MAIL_ACCOUNT_EDITOR_H - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-file-entry.h> -#include "mail-account-gui.h" - -#define MAIL_ACCOUNT_EDITOR_TYPE (mail_account_editor_get_type ()) -#define MAIL_ACCOUNT_EDITOR(o) (GTK_CHECK_CAST ((o), MAIL_ACCOUNT_EDITOR_TYPE, MailAccountEditor)) -#define MAIL_ACCOUNT_EDITOR_CLASS(k) (GTK_CHECK_CLASS_CAST((k), MAIL_ACCOUNT_EDITOR_TYPE, MailAccountEditorClass)) -#define MAIL_IS_ACCOUNT_EDITOR(o) (GTK_CHECK_TYPE ((o), MAIL_ACCOUNT_EDITOR_TYPE)) -#define MAIL_IS_ACCOUNT_EDITOR_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MAIL_ACCOUNT_EDITOR_TYPE)) - -struct _MailAccountEditor { - GnomeDialog parent; - - MailAccountGui *gui; - GtkNotebook *notebook; -}; - -typedef struct _MailAccountEditor MailAccountEditor; - -typedef struct { - GnomeDialogClass parent_class; - - /* signals */ - -} MailAccountEditorClass; - -GtkType mail_account_editor_get_type (void); - -MailAccountEditor *mail_account_editor_new (MailConfigAccount *account); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* MAIL_ACCOUNT_EDITOR_H */ diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c deleted file mode 100644 index 4f42b960a1..0000000000 --- a/mail/mail-account-gui.c +++ /dev/null @@ -1,1761 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Dan Winship <danw@ximian.com> - * Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include <string.h> -#include <stdarg.h> - -#include <bonobo.h> -#include <bonobo/bonobo-stream-memory.h> -#include <gal/widgets/e-unicode.h> -#include <gal/widgets/e-gui-utils.h> - -#include "shell/evolution-shell-client.h" -#include "mail-account-gui.h" -#include "mail-session.h" -#include "mail-send-recv.h" -#include "e-msg-composer.h" - -#define d(x) - -extern char *default_drafts_folder_uri, *default_sent_folder_uri; - -static void save_service (MailAccountGuiService *gsvc, GHashTable *extra_conf, MailConfigService *service); -static void service_changed (GtkEntry *entry, gpointer user_data); - -static gboolean -is_email (const char *address) -{ - const char *at, *hname; - - at = strchr (address, '@'); - /* make sure we have an '@' and that it's not the first or last char */ - if (!at || at == address || *(at + 1) == '\0') - return FALSE; - - hname = at + 1; - /* make sure the first and last chars aren't '.' */ - if (*hname == '.' || hname[strlen (hname) - 1] == '.') - return FALSE; - - return strchr (hname, '.') != NULL; -} - -static GtkWidget * -get_focused_widget (GtkWidget *def, ...) -{ - GtkWidget *widget, *ret = NULL; - va_list args; - - va_start (args, def); - widget = va_arg (args, GtkWidget *); - while (widget) { - if (GTK_WIDGET_HAS_FOCUS (widget)) { - ret = widget; - break; - } - - widget = va_arg (args, GtkWidget *); - } - va_end (args); - - if (ret) - return ret; - else - return def; -} - -gboolean -mail_account_gui_identity_complete (MailAccountGui *gui, GtkWidget **incomplete) -{ - char *text; - - text = gtk_entry_get_text (gui->full_name); - if (!text || !*text) { - if (incomplete) - *incomplete = get_focused_widget (GTK_WIDGET (gui->full_name), - GTK_WIDGET (gui->email_address), - NULL); - return FALSE; - } - - text = gtk_entry_get_text (gui->email_address); - if (!text || !is_email (text)) { - if (incomplete) - *incomplete = get_focused_widget (GTK_WIDGET (gui->email_address), - GTK_WIDGET (gui->full_name), - NULL); - return FALSE; - } - - return TRUE; -} - -static gboolean -service_complete (MailAccountGuiService *service, GtkWidget **incomplete) -{ - const CamelProvider *prov = service->provider; - char *text; - GtkWidget *path; - - if (!prov) - return TRUE; - - /* transports don't have a path */ - if (service->path) - path = GTK_WIDGET (service->path); - else - path = NULL; - - if (CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_HOST)) { - text = gtk_entry_get_text (service->hostname); - if (!text || !*text) { - if (incomplete) - *incomplete = get_focused_widget (GTK_WIDGET (service->hostname), - GTK_WIDGET (service->username), - path, - NULL); - return FALSE; - } - } - - if (CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_USER)) { - text = gtk_entry_get_text (service->username); - if (!text || !*text) { - if (incomplete) - *incomplete = get_focused_widget (GTK_WIDGET (service->username), - GTK_WIDGET (service->hostname), - path, - NULL); - return FALSE; - } - } - - if (CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_PATH)) { - if (!path) { - d(printf ("aagh, transports aren't supposed to have paths.\n")); - return TRUE; - } - - text = gtk_entry_get_text (service->path); - if (!text || !*text) { - if (incomplete) - *incomplete = get_focused_widget (GTK_WIDGET (service->path), - GTK_WIDGET (service->hostname), - GTK_WIDGET (service->username), - NULL); - return FALSE; - } - } - - return TRUE; -} - -gboolean -mail_account_gui_source_complete (MailAccountGui *gui, GtkWidget **incomplete) -{ - return service_complete (&gui->source, incomplete); -} - -gboolean -mail_account_gui_transport_complete (MailAccountGui *gui, GtkWidget **incomplete) -{ - if (!service_complete (&gui->transport, incomplete)) - return FALSE; - - /* FIXME? */ - if (gtk_toggle_button_get_active (gui->transport_needs_auth) && - CAMEL_PROVIDER_ALLOWS (gui->transport.provider, CAMEL_URL_PART_USER)) { - char *text = gtk_entry_get_text (gui->transport.username); - - if (!text || !*text) { - if (incomplete) - *incomplete = get_focused_widget (GTK_WIDGET (gui->transport.username), - GTK_WIDGET (gui->transport.hostname), - NULL); - return FALSE; - } - } - - return TRUE; -} - -gboolean -mail_account_gui_management_complete (MailAccountGui *gui, GtkWidget **incomplete) -{ - char *text; - - text = gtk_entry_get_text (gui->account_name); - if (text && *text) - return TRUE; - - if (incomplete) - *incomplete = GTK_WIDGET (gui->account_name); - - return FALSE; -} - - -static void -service_authtype_changed (GtkWidget *widget, gpointer user_data) -{ - MailAccountGuiService *service = user_data; - CamelServiceAuthType *authtype; - - service->authitem = widget; - authtype = gtk_object_get_data (GTK_OBJECT (widget), "authtype"); - - gtk_widget_set_sensitive (GTK_WIDGET (service->remember), authtype->need_password); -} - -static void -build_auth_menu (MailAccountGuiService *service, GList *all_authtypes, - GList *supported_authtypes, gboolean check_supported) -{ - GtkWidget *menu, *item, *first = NULL; - CamelServiceAuthType *current, *authtype, *sauthtype; - int history = 0, i; - GList *l, *s; - - if (service->authitem) - current = gtk_object_get_data (GTK_OBJECT (service->authitem), "authtype"); - else - current = NULL; - - service->authitem = NULL; - - menu = gtk_menu_new (); - - for (l = all_authtypes, i = 0; l; l = l->next, i++) { - authtype = l->data; - - item = gtk_menu_item_new_with_label (authtype->name); - for (s = supported_authtypes; s; s = s->next) { - sauthtype = s->data; - if (!strcmp (authtype->name, sauthtype->name)) - break; - } - - if (check_supported && !s) { - gtk_widget_set_sensitive (item, FALSE); - } else if (current && !strcmp (authtype->name, current->name)) { - first = item; - history = i; - } else if (!first) { - first = item; - history = i; - } - - gtk_object_set_data (GTK_OBJECT (item), "authtype", authtype); - gtk_signal_connect (GTK_OBJECT (item), "activate", - service_authtype_changed, service); - - gtk_menu_append (GTK_MENU (menu), item); - - gtk_widget_show (item); - } - - gtk_option_menu_remove_menu (service->authtype); - gtk_option_menu_set_menu (service->authtype, menu); - - if (first) { - gtk_option_menu_set_history (service->authtype, history); - gtk_signal_emit_by_name (GTK_OBJECT (first), "activate", service); - } -} - -static void -source_type_changed (GtkWidget *widget, gpointer user_data) -{ - MailAccountGui *gui = user_data; - GtkWidget *file_entry, *label, *frame, *dwidget = NULL; - CamelProvider *provider; - - provider = gtk_object_get_data (GTK_OBJECT (widget), "provider"); - - gui->source.provider = provider; - - if (provider) - gtk_label_set_text (gui->source.description, provider->description); - else - gtk_label_set_text (gui->source.description, ""); - - frame = glade_xml_get_widget (gui->xml, "source_frame"); - if (provider) { - gtk_widget_show (frame); - - /* hostname */ - label = glade_xml_get_widget (gui->xml, "source_host_label"); - - if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_HOST)) { - dwidget = GTK_WIDGET (gui->source.hostname); - gtk_widget_show (GTK_WIDGET (gui->source.hostname)); - gtk_widget_show (label); - } else { - gtk_widget_hide (GTK_WIDGET (gui->source.hostname)); - gtk_widget_hide (label); - } - - /* username */ - label = glade_xml_get_widget (gui->xml, "source_user_label"); - - if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_USER)) { - if (!dwidget) - dwidget = GTK_WIDGET (gui->source.username); - gtk_widget_show (GTK_WIDGET (gui->source.username)); - gtk_widget_show (label); - } else { - gtk_widget_hide (GTK_WIDGET (gui->source.username)); - gtk_widget_hide (label); - } - - /* path */ - label = glade_xml_get_widget (gui->xml, "source_path_label"); - file_entry = glade_xml_get_widget (gui->xml, "source_path_entry"); - - if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_PATH)) { - if (!dwidget) - dwidget = GTK_WIDGET (gui->source.path); - - if (!strcmp (provider->protocol, "mbox") - || !strcmp(provider->protocol, "spool")) { - char *path; - - if (getenv ("MAIL")) - path = g_strdup (getenv ("MAIL")); - else - path = g_strdup_printf (SYSTEM_MAIL_DIR "/%s", g_get_user_name ()); - gtk_entry_set_text (gui->source.path, path); - g_free (path); - } else if (!strcmp (provider->protocol, "maildir") && - getenv ("MAILDIR")) { - gtk_entry_set_text (gui->source.path, getenv ("MAILDIR")); - } else { - gtk_entry_set_text (gui->source.path, ""); - } - - gtk_widget_show (GTK_WIDGET (file_entry)); - gtk_widget_show (label); - } else { - gtk_entry_set_text (gui->source.path, ""); - gtk_widget_hide (GTK_WIDGET (file_entry)); - gtk_widget_hide (label); - } - - /* ssl */ -#ifdef HAVE_SSL - if (provider && provider->flags & CAMEL_PROVIDER_SUPPORTS_SSL) - gtk_widget_show (GTK_WIDGET (gui->source.use_ssl)); - else - gtk_widget_hide (GTK_WIDGET (gui->source.use_ssl)); - gtk_widget_hide (GTK_WIDGET (gui->source.no_ssl)); -#else - gtk_widget_hide (GTK_WIDGET (gui->source.use_ssl)); - gtk_widget_show (GTK_WIDGET (gui->source.no_ssl)); -#endif - - /* auth */ - frame = glade_xml_get_widget (gui->xml, "source_auth_frame"); - if (provider && CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH)) { - build_auth_menu (&gui->source, provider->authtypes, NULL, FALSE); - gtk_widget_show (frame); - } else - gtk_widget_hide (frame); - } else { - gtk_widget_hide (frame); - frame = glade_xml_get_widget (gui->xml, "source_auth_frame"); - gtk_widget_hide (frame); - } - - gtk_signal_emit_by_name (GTK_OBJECT (gui->source.username), "changed"); - - if (dwidget) - gtk_widget_grab_focus (dwidget); - - mail_account_gui_build_extra_conf (gui, gui && gui->account && gui->account->source ? gui->account->source->url : NULL); -} - - -static void -transport_needs_auth_toggled (GtkToggleButton *toggle, gpointer data) -{ - MailAccountGui *gui = data; - gboolean need = gtk_toggle_button_get_active (toggle); - GtkWidget *widget; - - widget = glade_xml_get_widget (gui->xml, "transport_auth_frame"); - gtk_widget_set_sensitive (widget, need); - if (need) - service_changed (NULL, &gui->transport); -} - -static void -transport_type_changed (GtkWidget *widget, gpointer user_data) -{ - MailAccountGui *gui = user_data; - CamelProvider *provider; - GtkWidget *label, *frame; - - provider = gtk_object_get_data (GTK_OBJECT (widget), "provider"); - gui->transport.provider = provider; - - /* description */ - if (provider) - gtk_label_set_text (gui->transport.description, provider->description); - else - gtk_label_set_text (gui->transport.description, ""); - - frame = glade_xml_get_widget (gui->xml, "transport_frame"); - if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_HOST) || - (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH) && - !CAMEL_PROVIDER_NEEDS (provider, CAMEL_URL_PART_AUTH))) { - gtk_widget_show (frame); - - label = glade_xml_get_widget (gui->xml, "transport_host_label"); - if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_HOST)) { - gtk_widget_grab_focus (GTK_WIDGET (gui->transport.hostname)); - gtk_widget_show (GTK_WIDGET (gui->transport.hostname)); - gtk_widget_show (label); - } else { - gtk_widget_hide (GTK_WIDGET (gui->transport.hostname)); - gtk_widget_hide (label); - } - - /* ssl */ -#ifdef HAVE_SSL - if (provider && provider->flags & CAMEL_PROVIDER_SUPPORTS_SSL) - gtk_widget_show (GTK_WIDGET (gui->transport.use_ssl)); - else - gtk_widget_hide (GTK_WIDGET (gui->transport.use_ssl)); - gtk_widget_hide (GTK_WIDGET (gui->transport.no_ssl)); -#else - gtk_widget_hide (GTK_WIDGET (gui->transport.use_ssl)); - gtk_widget_show (GTK_WIDGET (gui->transport.no_ssl)); -#endif - - /* auth */ - if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH) && - !CAMEL_PROVIDER_NEEDS (provider, CAMEL_URL_PART_AUTH)) - gtk_widget_show (GTK_WIDGET (gui->transport_needs_auth)); - else - gtk_widget_hide (GTK_WIDGET (gui->transport_needs_auth)); - } else - gtk_widget_hide (frame); - - frame = glade_xml_get_widget (gui->xml, "transport_auth_frame"); - if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH)) { - gtk_widget_show (frame); - - label = glade_xml_get_widget (gui->xml, "transport_user_label"); - if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_USER)) { - gtk_widget_show (GTK_WIDGET (gui->transport.username)); - gtk_widget_show (label); - } else { - gtk_widget_hide (GTK_WIDGET (gui->transport.username)); - gtk_widget_hide (label); - } - - build_auth_menu (&gui->transport, provider->authtypes, NULL, FALSE); - transport_needs_auth_toggled (gui->transport_needs_auth, gui); - } else - gtk_widget_hide (frame); - - gtk_signal_emit_by_name (GTK_OBJECT (gui->transport.hostname), "changed"); -} - -static void -service_changed (GtkEntry *entry, gpointer user_data) -{ - MailAccountGuiService *service = user_data; - - gtk_widget_set_sensitive (GTK_WIDGET (service->check_supported), - service_complete (service, NULL)); -} - -static void -service_check_supported (GtkButton *button, gpointer user_data) -{ - MailAccountGuiService *gsvc = user_data; - MailConfigService *service; - GList *authtypes = NULL; - GtkWidget *authitem; - GtkWidget *window; - - service = g_new0 (MailConfigService, 1); - - /* This is sort of a hack, when checking for supported AUTH - types we don't want to use whatever authtype is selected - because it may not be available. */ - authitem = gsvc->authitem; - gsvc->authitem = NULL; - - save_service (gsvc, NULL, service); - - gsvc->authitem = authitem; - - window = gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_WINDOW); - - if (mail_config_check_service (service->url, gsvc->provider_type, &authtypes, GTK_WINDOW (window))) { - build_auth_menu (gsvc, gsvc->provider->authtypes, authtypes, TRUE); - if (!authtypes) { - /* provider doesn't support any authtypes */ - gtk_widget_set_sensitive (GTK_WIDGET (gsvc->check_supported), FALSE); - } - g_list_free (authtypes); - } - - service_destroy (service); -} - - -static void -toggle_sensitivity (GtkToggleButton *toggle, GtkWidget *widget) -{ - gtk_widget_set_sensitive (widget, gtk_toggle_button_get_active (toggle)); -} - -static void -setup_toggle (GtkWidget *widget, const char *depname, MailAccountGui *gui) -{ - GtkToggleButton *toggle; - - if (!strcmp (depname, "UNIMPLEMENTED")) { - gtk_widget_set_sensitive (widget, FALSE); - return; - } - - toggle = g_hash_table_lookup (gui->extra_config, depname); - gtk_signal_connect (GTK_OBJECT (toggle), "toggled", - GTK_SIGNAL_FUNC (toggle_sensitivity), - widget); - toggle_sensitivity (toggle, widget); -} - -void -mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url_string) -{ - CamelURL *url; - GtkWidget *mailcheck_frame, *main_vbox, *cur_vbox; - CamelProviderConfEntry *entries; - GList *children, *child; - char *name; - int i; - - if (url_string) - url = camel_url_new (url_string, NULL); - else - url = NULL; - - main_vbox = glade_xml_get_widget (gui->xml, "extra_vbox"); - - mailcheck_frame = glade_xml_get_widget (gui->xml, "extra_mailcheck_frame"); - - /* Remove any additional mailcheck items. */ - children = gtk_container_children (GTK_CONTAINER (mailcheck_frame)); - if (children) { - cur_vbox = children->data; - g_list_free (children); - children = gtk_container_children (GTK_CONTAINER (cur_vbox)); - for (child = children; child; child = child->next) { - if (child != children) { - gtk_container_remove (GTK_CONTAINER (cur_vbox), - child->data); - } - } - g_list_free (children); - } - - /* Remove the contents of the extra_vbox except for the - * mailcheck_frame. - */ - children = gtk_container_children (GTK_CONTAINER (main_vbox)); - for (child = children; child; child = child->next) { - if (child != children) { - gtk_container_remove (GTK_CONTAINER (main_vbox), - child->data); - } - } - g_list_free (children); - - if (!gui->source.provider) { - gtk_widget_set_sensitive (main_vbox, FALSE); - if (url) - camel_url_free (url); - return; - } else - gtk_widget_set_sensitive (main_vbox, TRUE); - - /* Set up our hash table. */ - if (gui->extra_config) - g_hash_table_destroy (gui->extra_config); - gui->extra_config = g_hash_table_new (g_str_hash, g_str_equal); - - entries = gui->source.provider->extra_conf; - if (!entries) - goto done; - - cur_vbox = main_vbox; - for (i = 0; ; i++) { - switch (entries[i].type) { - case CAMEL_PROVIDER_CONF_SECTION_START: - { - GtkWidget *frame; - - if (entries[i].name && !strcmp (entries[i].name, "mailcheck")) - cur_vbox = glade_xml_get_widget (gui->xml, "extra_mailcheck_vbox"); - else { - frame = gtk_frame_new (entries[i].text); - gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); - cur_vbox = gtk_vbox_new (FALSE, 4); - gtk_container_set_border_width (GTK_CONTAINER (cur_vbox), 4); - gtk_container_add (GTK_CONTAINER (frame), cur_vbox); - } - break; - } - case CAMEL_PROVIDER_CONF_SECTION_END: - cur_vbox = main_vbox; - break; - - case CAMEL_PROVIDER_CONF_CHECKBOX: - { - GtkWidget *checkbox; - gboolean active; - - checkbox = gtk_check_button_new_with_label (entries[i].text); - if (url) - active = camel_url_get_param (url, entries[i].name) != NULL; - else - active = atoi (entries[i].value); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), active); - gtk_box_pack_start (GTK_BOX (cur_vbox), checkbox, FALSE, FALSE, 0); - g_hash_table_insert (gui->extra_config, entries[i].name, checkbox); - if (entries[i].depname) - setup_toggle (checkbox, entries[i].depname, gui); - break; - } - - case CAMEL_PROVIDER_CONF_ENTRY: - { - GtkWidget *hbox, *label, *entry; - const char *text; - - hbox = gtk_hbox_new (FALSE, 8); - label = gtk_label_new (entries[i].text); - entry = gtk_entry_new (); - if (url) - text = camel_url_get_param (url, entries[i].name); - else - text = entries[i].value; - if (text) - gtk_entry_set_text (GTK_ENTRY (entry), text); - - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - gtk_box_pack_end (GTK_BOX (hbox), entry, TRUE, TRUE, 0); - - gtk_box_pack_start (GTK_BOX (cur_vbox), hbox, FALSE, FALSE, 0); - g_hash_table_insert (gui->extra_config, entries[i].name, entry); - if (entries[i].depname) { - setup_toggle (entry, entries[i].depname, gui); - setup_toggle (label, entries[i].depname, gui); - } - break; - } - - case CAMEL_PROVIDER_CONF_CHECKSPIN: - { - GtkWidget *hbox, *checkbox, *spin, *label; - GtkObject *adj; - char *data, *pre, *post, *p; - double min, def, max; - gboolean enable; - - data = entries[i].text; - p = strstr (data, "%s"); - g_return_if_fail (p != NULL); - - pre = g_strndup (data, p - data); - post = p + 2; - - data = entries[i].value; - enable = *data++ == 'y'; - g_return_if_fail (*data == ':'); - min = strtod (++data, &data); - g_return_if_fail (*data == ':'); - def = strtod (++data, &data); - g_return_if_fail (*data == ':'); - max = strtod (++data, NULL); - - if (url) { - const char *val; - - val = camel_url_get_param (url, entries[i].name); - if (!val) - enable = FALSE; - else { - enable = TRUE; - def = atof (val); - } - } - - hbox = gtk_hbox_new (FALSE, 0); - checkbox = gtk_check_button_new_with_label (pre); - g_free (pre); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), enable); - adj = gtk_adjustment_new (def, min, max, 1, 1, 1); - spin = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1, 0); - label = gtk_label_new (post); - - gtk_box_pack_start (GTK_BOX (hbox), checkbox, FALSE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (hbox), spin, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 4); - - gtk_box_pack_start (GTK_BOX (cur_vbox), hbox, FALSE, FALSE, 0); - g_hash_table_insert (gui->extra_config, entries[i].name, checkbox); - name = g_strdup_printf ("%s_value", entries[i].name); - g_hash_table_insert (gui->extra_config, name, spin); - if (entries[i].depname) { - setup_toggle (checkbox, entries[i].depname, gui); - setup_toggle (spin, entries[i].depname, gui); - setup_toggle (label, entries[i].depname, gui); - } - break; - } - - case CAMEL_PROVIDER_CONF_END: - goto done; - } - } - - done: - gtk_widget_show_all (main_vbox); - if (url) - camel_url_free (url); -} - -static void -extract_values (MailAccountGuiService *source, GHashTable *extra_config, CamelURL *url) -{ - CamelProviderConfEntry *entries; - GtkToggleButton *toggle; - GtkEntry *entry; - GtkSpinButton *spin; - char *name; - int i; - - if (!source->provider || !source->provider->extra_conf) - return; - entries = source->provider->extra_conf; - - for (i = 0; ; i++) { - if (entries[i].depname) { - toggle = g_hash_table_lookup (extra_config, entries[i].depname); - if (!toggle || !gtk_toggle_button_get_active (toggle)) - continue; - } - - switch (entries[i].type) { - case CAMEL_PROVIDER_CONF_CHECKBOX: - toggle = g_hash_table_lookup (extra_config, entries[i].name); - if (gtk_toggle_button_get_active (toggle)) - camel_url_set_param (url, entries[i].name, ""); - break; - - case CAMEL_PROVIDER_CONF_ENTRY: - entry = g_hash_table_lookup (extra_config, entries[i].name); - camel_url_set_param (url, entries[i].name, gtk_entry_get_text (entry)); - break; - - case CAMEL_PROVIDER_CONF_CHECKSPIN: - toggle = g_hash_table_lookup (extra_config, entries[i].name); - if (!gtk_toggle_button_get_active (toggle)) - break; - name = g_strdup_printf ("%s_value", entries[i].name); - spin = g_hash_table_lookup (extra_config, name); - g_free (name); - name = g_strdup_printf ("%d", gtk_spin_button_get_value_as_int (spin)); - camel_url_set_param (url, entries[i].name, name); - g_free (name); - break; - - case CAMEL_PROVIDER_CONF_END: - return; - - default: - break; - } - } -} - - -extern EvolutionShellClient *global_shell_client; - -static void -set_folder_picker_label (GtkButton *button, const char *name) -{ - char *string; - - string = e_utf8_to_gtk_string (GTK_WIDGET (button), name); - gtk_label_set_text (GTK_LABEL (GTK_BIN (button)->child), string); - g_free (string); -} - -static void -folder_picker_clicked (GtkButton *button, gpointer user_data) -{ - MailAccountGuiFolder *folder = user_data; - const char *allowed_types[] = { "mail", NULL }; - char *physical_uri, *evolution_uri; - - physical_uri = evolution_uri = NULL; - evolution_shell_client_user_select_folder ( - global_shell_client, - GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (button))), - _("Select Folder"), folder->uri, - allowed_types, &evolution_uri, &physical_uri); - if (!physical_uri || !*physical_uri) { - g_free (physical_uri); - g_free (evolution_uri); - return; - } - - g_free (folder->uri); - folder->uri = physical_uri; - g_free (folder->name); - folder->name = g_strdup (g_basename (evolution_uri)); - g_free (evolution_uri); - set_folder_picker_label (button, folder->name); -} - - -static gboolean -setup_service (MailAccountGuiService *gsvc, MailConfigService *service) -{ - CamelURL *url = camel_url_new (service->url, NULL); - gboolean has_auth = FALSE; - - if (url == NULL) - return FALSE; - - if (url->user && CAMEL_PROVIDER_ALLOWS (gsvc->provider, CAMEL_URL_PART_USER)) - gtk_entry_set_text (gsvc->username, url->user); - - if (url->host && CAMEL_PROVIDER_ALLOWS (gsvc->provider, CAMEL_URL_PART_HOST)) { - char *hostname; - - if (url->port) - hostname = g_strdup_printf ("%s:%d", url->host, url->port); - else - hostname = g_strdup (url->host); - - gtk_entry_set_text (gsvc->hostname, hostname); - g_free (hostname); - } - - if (url->path && CAMEL_PROVIDER_ALLOWS (gsvc->provider, CAMEL_URL_PART_PATH)) - gtk_entry_set_text (gsvc->path, url->path); - - if (gsvc->provider->flags & CAMEL_PROVIDER_SUPPORTS_SSL) { - gboolean use_ssl = camel_url_get_param (url, "use_ssl") != NULL; - gtk_toggle_button_set_active (gsvc->use_ssl, use_ssl); - } - - if (url->authmech && CAMEL_PROVIDER_ALLOWS (gsvc->provider, CAMEL_URL_PART_AUTH)) { - GList *children, *item; - CamelServiceAuthType *authtype; - int i; - - children = gtk_container_children (GTK_CONTAINER (gtk_option_menu_get_menu (gsvc->authtype))); - for (item = children, i = 0; item; item = item->next, i++) { - authtype = gtk_object_get_data (item->data, "authtype"); - if (!authtype) - continue; - if (!strcmp (authtype->authproto, url->authmech)) { - gtk_option_menu_set_history (gsvc->authtype, i); - gtk_signal_emit_by_name (item->data, "activate"); - break; - } - } - g_list_free (children); - - has_auth = TRUE; - } - camel_url_free (url); - - gtk_toggle_button_set_active (gsvc->remember, service->save_passwd); - - return has_auth; -} - -static gint -provider_compare (const CamelProvider *p1, const CamelProvider *p2) -{ - /* sort providers based on "location" (ie. local or remote) */ - if (p1->flags & CAMEL_PROVIDER_IS_REMOTE) { - if (p2->flags & CAMEL_PROVIDER_IS_REMOTE) - return 0; - return -1; - } else { - if (p2->flags & CAMEL_PROVIDER_IS_REMOTE) - return 1; - return 0; - } -} - -/* - * Signature editor - * - */ - -struct _ESignatureEditor { - MailAccountGui *gui; - GtkWidget *win; - GtkWidget *control; - - gchar *filename; - gboolean html; - gboolean has_changed; -}; -typedef struct _ESignatureEditor ESignatureEditor; - -#define E_SIGNATURE_EDITOR(o) ((ESignatureEditor *) o) - -#define DEFAULT_WIDTH 600 -#define DEFAULT_HEIGHT 500 - -enum { REPLY_YES = 0, REPLY_NO, REPLY_CANCEL }; - -static void -destroy_editor (ESignatureEditor *editor) -{ - gtk_widget_destroy (editor->win); - g_free (editor->filename); - g_free (editor); -} - -static void -menu_file_save_error (BonoboUIComponent *uic, CORBA_Environment *ev) { - e_notice (GTK_WINDOW (uic), GNOME_MESSAGE_BOX_ERROR, - _("Could not save signature file.")); - - g_warning ("Exception while saving signature (%s)", - bonobo_exception_get_text (ev)); -} - -static void -menu_file_save_cb (BonoboUIComponent *uic, - void *data, - const char *path) -{ - ESignatureEditor *editor; - Bonobo_PersistFile pfile_iface; - CORBA_Environment ev; - - editor = E_SIGNATURE_EDITOR (data); - if (editor->html) { - CORBA_exception_init (&ev); - - pfile_iface = bonobo_object_client_query_interface (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)), - "IDL:Bonobo/PersistFile:1.0", NULL); - Bonobo_PersistFile_save (pfile_iface, editor->filename, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - menu_file_save_error (uic, &ev); - - CORBA_exception_free (&ev); - } else { - BonoboStream *stream; - CORBA_Environment ev; - Bonobo_PersistStream pstream_iface; - - CORBA_exception_init (&ev); - - stream = bonobo_stream_open (BONOBO_IO_DRIVER_FS, editor->filename, - Bonobo_Storage_WRITE | Bonobo_Storage_CREATE, 0); - - pstream_iface = bonobo_object_client_query_interface - (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)), - "IDL:Bonobo/PersistStream:1.0", NULL); - - Bonobo_PersistStream_save (pstream_iface, - (Bonobo_Stream) bonobo_object_corba_objref (BONOBO_OBJECT (stream)), - "text/plain", &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - menu_file_save_error (uic, &ev); - - CORBA_exception_free (&ev); - bonobo_object_unref (BONOBO_OBJECT (stream)); - } -} - -static void -exit_dialog_cb (int reply, ESignatureEditor *editor) -{ - switch (reply) { - case REPLY_YES: - menu_file_save_cb (NULL, editor, NULL); - destroy_editor (editor); - break; - case REPLY_NO: - destroy_editor (editor); - break; - case REPLY_CANCEL: - default: - } -} - -static void -do_exit (ESignatureEditor *editor) -{ - if (editor->has_changed) { - GtkWidget *dialog; - GtkWidget *label; - gint button; - - dialog = gnome_dialog_new (_("Save signature"), - GNOME_STOCK_BUTTON_YES, /* Save */ - GNOME_STOCK_BUTTON_NO, /* Don't save */ - GNOME_STOCK_BUTTON_CANCEL, /* Cancel */ - NULL); - - label = gtk_label_new (_("This signature has been changed, but hasn't been saved.\n" - "\nDo you wish to save your changes?")); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label, TRUE, TRUE, 0); - gtk_widget_show (label); - gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (editor->win)); - gnome_dialog_set_default (GNOME_DIALOG (dialog), 0); - button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); - - exit_dialog_cb (button, editor); - } else - destroy_editor (editor); -} - -static int -delete_event_cb (GtkWidget *w, GdkEvent *event, ESignatureEditor *editor) -{ - do_exit (editor); -} - -static void -menu_file_close_cb (BonoboUIComponent *uic, gpointer data, const gchar *path) -{ - ESignatureEditor *editor; - - editor = E_SIGNATURE_EDITOR (data); - do_exit (editor); -} - -static void -menu_file_save_close_cb (BonoboUIComponent *uic, gpointer data, const gchar *path) -{ - ESignatureEditor *editor; - - editor = E_SIGNATURE_EDITOR (data); - - menu_file_save_cb (uic, editor, path); - destroy_editor (editor); -} - -static BonoboUIVerb verbs [] = { - - BONOBO_UI_VERB ("FileSave", menu_file_save_cb), - BONOBO_UI_VERB ("FileClose", menu_file_close_cb), - BONOBO_UI_VERB ("FileSaveClose", menu_file_save_close_cb), - - BONOBO_UI_VERB_END -}; - -static void -load_signature (ESignatureEditor *editor) -{ - CORBA_Environment ev; - - if (editor->html) { - Bonobo_PersistFile pfile_iface; - - pfile_iface = bonobo_object_client_query_interface (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)), - "IDL:Bonobo/PersistFile:1.0", NULL); - CORBA_exception_init (&ev); - Bonobo_PersistFile_load (pfile_iface, editor->filename, &ev); - CORBA_exception_free (&ev); - } else { - Bonobo_PersistStream pstream_iface; - BonoboStream *stream; - gchar *data, *html; - - data = e_msg_composer_get_sig_file_content (editor->filename, FALSE); - html = g_strdup_printf ("<PRE>\n%s", data); - g_free (data); - - pstream_iface = bonobo_object_client_query_interface - (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)), - "IDL:Bonobo/PersistStream:1.0", NULL); - CORBA_exception_init (&ev); - stream = bonobo_stream_mem_create (html, strlen (html), TRUE, FALSE); - - if (stream == NULL) { - g_warning ("Couldn't create memory stream\n"); - } else { - BonoboObject *stream_object; - Bonobo_Stream corba_stream; - - stream_object = BONOBO_OBJECT (stream); - corba_stream = bonobo_object_corba_objref (stream_object); - Bonobo_PersistStream_load (pstream_iface, corba_stream, - "text/html", &ev); - } - - Bonobo_Unknown_unref (pstream_iface, &ev); - CORBA_Object_release (pstream_iface, &ev); - CORBA_exception_free (&ev); - bonobo_object_unref (BONOBO_OBJECT (stream)); - - g_free (html); - } -} - -static void -launch_signature_editor (MailAccountGui *gui, const gchar *filename, gboolean html) -{ - ESignatureEditor *editor; - BonoboUIComponent *component; - BonoboUIContainer *container; - gchar *title; - - if (!filename || !*filename) - return; - - editor = g_new0 (ESignatureEditor, 1); - - editor->html = html; - editor->filename = g_strdup (filename); - editor->has_changed = TRUE; - - title = g_strdup_printf ("Edit %ssignature (%s)", html ? "HTML " : "", filename); - editor->win = bonobo_window_new ("e-sig-editor", title); - editor->gui = gui; - gtk_window_set_default_size (GTK_WINDOW (editor->win), DEFAULT_WIDTH, DEFAULT_HEIGHT); - gtk_window_set_policy (GTK_WINDOW (editor->win), FALSE, TRUE, FALSE); - gtk_window_set_modal (GTK_WINDOW (editor->win), TRUE); - g_free (title); - - container = bonobo_ui_container_new (); - bonobo_ui_container_set_win (container, BONOBO_WINDOW (editor->win)); - - 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, editor); - bonobo_ui_util_set_ui (component, EVOLUTION_DATADIR, "evolution-signature-editor.xml", "evolution-signature-editor"); - - editor->control = bonobo_widget_new_control ("OAFIID:GNOME_GtkHTML_Editor", - bonobo_ui_component_get_container (component)); - - if (editor->control == NULL) { - g_warning ("Cannot get 'OAFIID:GNOME_GtkHTML_Editor'."); - - destroy_editor (editor); - return; - } - - load_signature (editor); - - gtk_signal_connect (GTK_OBJECT (editor->win), "delete_event", - GTK_SIGNAL_FUNC (delete_event_cb), editor); - - bonobo_window_set_contents (BONOBO_WINDOW (editor->win), editor->control); - bonobo_widget_set_property (BONOBO_WIDGET (editor->control), "FormatHTML", html, NULL); - gtk_widget_show (GTK_WIDGET (editor->win)); - gtk_widget_show (GTK_WIDGET (editor->control)); - gtk_widget_grab_focus (editor->control); -} - -static void -edit_signature (GtkWidget *w, MailAccountGui *gui) -{ - launch_signature_editor (gui, gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (gui->signature))), FALSE); -} - -static void -edit_html_signature (GtkWidget *w, MailAccountGui *gui) -{ - launch_signature_editor (gui, gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (gui->html_signature))), TRUE); -} - -static void -signature_changed (GtkWidget *entry, MailAccountGui *gui) -{ - gtk_widget_set_sensitive (GTK_WIDGET (gui->edit_signature), - *gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (gui->signature))) != 0); -} - -static void -html_signature_changed (GtkWidget *entry, MailAccountGui *gui) -{ - gtk_widget_set_sensitive (GTK_WIDGET (gui->edit_html_signature), - *gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (gui->html_signature))) != 0); -} - -MailAccountGui * -mail_account_gui_new (MailConfigAccount *account) -{ - MailAccountGui *gui; - - gui = g_new0 (MailAccountGui, 1); - gui->account = account; - gui->xml = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", NULL); - - /* Management */ - gui->account_name = GTK_ENTRY (glade_xml_get_widget (gui->xml, "management_name")); - gui->default_account = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "management_default")); - if (account->name) - e_utf8_gtk_entry_set_text (gui->account_name, account->name); - if (!mail_config_get_default_account () - || (account == mail_config_get_default_account ())) - gtk_toggle_button_set_active (gui->default_account, TRUE); - - /* Identity */ - gui->full_name = GTK_ENTRY (glade_xml_get_widget (gui->xml, "identity_full_name")); - gui->email_address = GTK_ENTRY (glade_xml_get_widget (gui->xml, "identity_address")); - gui->organization = GTK_ENTRY (glade_xml_get_widget (gui->xml, "identity_organization")); - gui->signature = GNOME_FILE_ENTRY (glade_xml_get_widget (gui->xml, "fileentry_signature")); - gui->html_signature = GNOME_FILE_ENTRY (glade_xml_get_widget (gui->xml, "fileentry_html_signature")); - gui->has_html_signature = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "check_html_signature")); - gnome_file_entry_set_default_path (gui->signature, g_get_home_dir ()); - gnome_file_entry_set_default_path (gui->html_signature, g_get_home_dir ()); - gui->edit_signature = GTK_BUTTON (glade_xml_get_widget (gui->xml, "button_edit_signature")); - gtk_widget_set_sensitive (GTK_WIDGET (gui->edit_signature), FALSE); - gui->edit_html_signature = GTK_BUTTON (glade_xml_get_widget (gui->xml, "button_edit_html_signature")); - gtk_widget_set_sensitive (GTK_WIDGET (gui->edit_html_signature), FALSE); - - gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (gui->signature)), "changed", signature_changed, gui); - gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (gui->html_signature)), "changed", - html_signature_changed, gui); - gtk_signal_connect (GTK_OBJECT (gui->edit_signature), "clicked", edit_signature, gui); - gtk_signal_connect (GTK_OBJECT (gui->edit_html_signature), "clicked", edit_html_signature, gui); - - if (account->id) { - if (account->id->name) - e_utf8_gtk_entry_set_text (gui->full_name, account->id->name); - if (account->id->address) - gtk_entry_set_text (gui->email_address, account->id->address); - if (account->id->organization) - e_utf8_gtk_entry_set_text (gui->organization, account->id->organization); - if (account->id->signature) { - gnome_file_entry_set_default_path (gui->signature, account->id->signature); - gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (gui->signature)), - account->id->signature); - } - if (account->id->html_signature) { - gnome_file_entry_set_default_path (gui->html_signature, account->id->html_signature); - gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (gui->html_signature)), - account->id->html_signature); - } - gtk_toggle_button_set_active (gui->has_html_signature, account->id->has_html_signature); - } - - /* Source */ - gui->source.provider_type = CAMEL_PROVIDER_STORE; - gui->source.type = GTK_OPTION_MENU (glade_xml_get_widget (gui->xml, "source_type_omenu")); - gui->source.description = GTK_LABEL (glade_xml_get_widget (gui->xml, "source_description")); - gui->source.hostname = GTK_ENTRY (glade_xml_get_widget (gui->xml, "source_host")); - gtk_signal_connect (GTK_OBJECT (gui->source.hostname), "changed", - GTK_SIGNAL_FUNC (service_changed), &gui->source); - gui->source.username = GTK_ENTRY (glade_xml_get_widget (gui->xml, "source_user")); - gtk_signal_connect (GTK_OBJECT (gui->source.username), "changed", - GTK_SIGNAL_FUNC (service_changed), &gui->source); - gui->source.path = GTK_ENTRY (glade_xml_get_widget (gui->xml, "source_path")); - gtk_signal_connect (GTK_OBJECT (gui->source.path), "changed", - GTK_SIGNAL_FUNC (service_changed), &gui->source); - gui->source.use_ssl = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "source_use_ssl")); - gui->source.no_ssl = glade_xml_get_widget (gui->xml, "source_ssl_disabled"); - gui->source.authtype = GTK_OPTION_MENU (glade_xml_get_widget (gui->xml, "source_auth_omenu")); - gui->source.remember = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "source_remember_password")); - gui->source.check_supported = GTK_BUTTON (glade_xml_get_widget (gui->xml, "source_check_supported")); - gtk_signal_connect (GTK_OBJECT (gui->source.check_supported), "clicked", - GTK_SIGNAL_FUNC (service_check_supported), &gui->source); - gui->source_auto_check = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "extra_auto_check")); - gui->source_auto_check_min = GTK_SPIN_BUTTON (glade_xml_get_widget (gui->xml, "extra_auto_check_min")); - - /* Transport */ - gui->transport.provider_type = CAMEL_PROVIDER_TRANSPORT; - gui->transport.type = GTK_OPTION_MENU (glade_xml_get_widget (gui->xml, "transport_type_omenu")); - gui->transport.description = GTK_LABEL (glade_xml_get_widget (gui->xml, "transport_description")); - gui->transport.hostname = GTK_ENTRY (glade_xml_get_widget (gui->xml, "transport_host")); - gtk_signal_connect (GTK_OBJECT (gui->transport.hostname), "changed", - GTK_SIGNAL_FUNC (service_changed), &gui->transport); - gui->transport.username = GTK_ENTRY (glade_xml_get_widget (gui->xml, "transport_user")); - gtk_signal_connect (GTK_OBJECT (gui->transport.username), "changed", - GTK_SIGNAL_FUNC (service_changed), &gui->source); - gui->transport.use_ssl = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "transport_use_ssl")); - gui->transport.no_ssl = glade_xml_get_widget (gui->xml, "transport_ssl_disabled"); - gui->transport_needs_auth = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "transport_needs_auth")); - gtk_signal_connect (GTK_OBJECT (gui->transport_needs_auth), "toggled", transport_needs_auth_toggled, gui); - gui->transport.authtype = GTK_OPTION_MENU (glade_xml_get_widget (gui->xml, "transport_auth_omenu")); - gui->transport.remember = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "transport_remember_password")); - gui->transport.check_supported = GTK_BUTTON (glade_xml_get_widget (gui->xml, "transport_check_supported")); - gtk_signal_connect (GTK_OBJECT (gui->transport.check_supported), "clicked", - GTK_SIGNAL_FUNC (service_check_supported), &gui->transport); - - /* Drafts folder */ - gui->drafts_folder_button = GTK_BUTTON (glade_xml_get_widget (gui->xml, "drafts_button")); - gtk_signal_connect (GTK_OBJECT (gui->drafts_folder_button), "clicked", - GTK_SIGNAL_FUNC (folder_picker_clicked), &gui->drafts_folder); - if (account->drafts_folder_uri) { - gui->drafts_folder.uri = g_strdup (account->drafts_folder_uri); - gui->drafts_folder.name = g_strdup (account->drafts_folder_name); - } else { - gui->drafts_folder.uri = g_strdup (default_drafts_folder_uri); - gui->drafts_folder.name = g_strdup (strrchr (default_drafts_folder_uri, '/') + 1); - } - set_folder_picker_label (gui->drafts_folder_button, gui->drafts_folder.name); - - /* Sent folder */ - gui->sent_folder_button = GTK_BUTTON (glade_xml_get_widget (gui->xml, "sent_button")); - gtk_signal_connect (GTK_OBJECT (gui->sent_folder_button), "clicked", - GTK_SIGNAL_FUNC (folder_picker_clicked), &gui->sent_folder); - if (account->sent_folder_uri) { - gui->sent_folder.uri = g_strdup (account->sent_folder_uri); - gui->sent_folder.name = g_strdup (account->sent_folder_name); - } else { - gui->sent_folder.uri = g_strdup (default_sent_folder_uri); - gui->sent_folder.name = g_strdup (strrchr (default_sent_folder_uri, '/') + 1); - } - set_folder_picker_label (gui->sent_folder_button, gui->sent_folder.name); - - /* Security */ - gui->pgp_key = GTK_ENTRY (glade_xml_get_widget (gui->xml, "pgp_key")); - if (account->pgp_key) - e_utf8_gtk_entry_set_text (gui->pgp_key, account->pgp_key); - gui->pgp_encrypt_to_self = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "pgp_encrypt_to_self")); - gtk_toggle_button_set_active (gui->pgp_encrypt_to_self, account->pgp_encrypt_to_self); - gui->pgp_always_sign = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "pgp_always_sign")); - gtk_toggle_button_set_active (gui->pgp_always_sign, account->pgp_always_sign); - gui->smime_key = GTK_ENTRY (glade_xml_get_widget (gui->xml, "smime_key")); - if (account->smime_key) - e_utf8_gtk_entry_set_text (gui->smime_key, account->smime_key); - gui->smime_encrypt_to_self = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "smime_encrypt_to_self")); - gtk_toggle_button_set_active (gui->smime_encrypt_to_self, account->smime_encrypt_to_self); - gui->smime_always_sign = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "smime_always_sign")); - gtk_toggle_button_set_active (gui->smime_always_sign, account->smime_always_sign); - -#if !defined(HAVE_NSS) || !defined(SMIME_SUPPORTED) - { - /* Since we don't have NSS, hide the S/MIME config options */ - GtkWidget *frame; - - frame = glade_xml_get_widget (gui->xml, "smime_frame"); - gtk_widget_set_sensitive (frame, FALSE); - } -#endif - - return gui; -} - -void -mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top) -{ - GtkWidget *stores, *transports, *item; - GtkWidget *fstore = NULL, *ftransport = NULL; - int si = 0, hstore = 0, ti = 0, htransport = 0; - int max_width = 0; - char *max_authname = NULL; - char *source_proto, *transport_proto; - GList *providers, *l; - - if (gui->account->source && gui->account->source->url) { - source_proto = gui->account->source->url; - source_proto = g_strndup (source_proto, strcspn (source_proto, ":")); - } else - source_proto = NULL; - - if (gui->account->transport && gui->account->transport->url) { - transport_proto = gui->account->transport->url; - transport_proto = g_strndup (transport_proto, strcspn (transport_proto, ":")); - } else - transport_proto = NULL; - - /* Construct source/transport option menus */ - stores = gtk_menu_new (); - transports = gtk_menu_new (); - providers = camel_session_list_providers (session, TRUE); - - /* sort the providers, remote first */ - providers = g_list_sort (providers, (GCompareFunc) provider_compare); - - for (l = providers; l; l = l->next) { - CamelProvider *provider = l->data; - - if (strcmp (provider->domain, "mail")) - continue; - - item = NULL; - if (provider->object_types[CAMEL_PROVIDER_STORE] && provider->flags & CAMEL_PROVIDER_IS_SOURCE) { - item = gtk_menu_item_new_with_label (provider->name); - gtk_object_set_data (GTK_OBJECT (item), "provider", provider); - gtk_signal_connect (GTK_OBJECT (item), "activate", - GTK_SIGNAL_FUNC (source_type_changed), - gui); - - gtk_menu_append (GTK_MENU (stores), item); - - gtk_widget_show (item); - - if (!fstore) { - fstore = item; - hstore = si; - } - - if (source_proto && !g_strcasecmp (provider->protocol, source_proto)) { - fstore = item; - hstore = si; - } - - si++; - } - - if (provider->object_types[CAMEL_PROVIDER_TRANSPORT]) { - item = gtk_menu_item_new_with_label (provider->name); - gtk_object_set_data (GTK_OBJECT (item), "provider", provider); - gtk_signal_connect (GTK_OBJECT (item), "activate", - GTK_SIGNAL_FUNC (transport_type_changed), - gui); - - gtk_menu_append (GTK_MENU (transports), item); - - gtk_widget_show (item); - - if (!ftransport) { - ftransport = item; - htransport = ti; - } - - if (transport_proto && !g_strcasecmp (provider->protocol, transport_proto)) { - ftransport = item; - htransport = ti; - } - - ti++; - } - - if (item && provider->authtypes) { - GdkFont *font = GTK_WIDGET (item)->style->font; - CamelServiceAuthType *at; - int width; - GList *a; - - for (a = provider->authtypes; a; a = a->next) { - at = a->data; - - width = gdk_string_width (font, at->name); - if (width > max_width) { - max_authname = at->name; - max_width = width; - } - } - } - } - g_list_free (providers); - - /* add a "None" option to the stores menu */ - item = gtk_menu_item_new_with_label (_("None")); - gtk_object_set_data (GTK_OBJECT (item), "provider", NULL); - gtk_signal_connect (GTK_OBJECT (item), "activate", - GTK_SIGNAL_FUNC (source_type_changed), - gui); - - gtk_menu_append (GTK_MENU (stores), item); - - gtk_widget_show (item); - - if (!fstore || !source_proto) { - fstore = item; - hstore = si; - } - - /* set the menus on the optionmenus */ - gtk_option_menu_remove_menu (gui->source.type); - gtk_option_menu_set_menu (gui->source.type, stores); - gtk_option_menu_set_history (gui->source.type, hstore); - - gtk_option_menu_remove_menu (gui->transport.type); - gtk_option_menu_set_menu (gui->transport.type, transports); - gtk_option_menu_set_history (gui->transport.type, htransport); - - /* Force the authmenus to the width of the widest element */ - if (max_authname) { - GtkWidget *menu; - GtkRequisition size_req; - - menu = gtk_menu_new (); - item = gtk_menu_item_new_with_label (max_authname); - gtk_menu_append (GTK_MENU (menu), item); - gtk_widget_show_all (menu); - gtk_option_menu_set_menu (gui->source.authtype, menu); - gtk_widget_show (GTK_WIDGET (gui->source.authtype)); - gtk_widget_size_request (GTK_WIDGET (gui->source.authtype), - &size_req); - - gtk_widget_set_usize (GTK_WIDGET (gui->source.authtype), - size_req.width, -1); - gtk_widget_set_usize (GTK_WIDGET (gui->transport.authtype), - size_req.width, -1); - } - - if (top != NULL) { - gtk_widget_show_all (top); - } - - if (fstore) - gtk_signal_emit_by_name (GTK_OBJECT (fstore), "activate", gui); - - if (ftransport) - gtk_signal_emit_by_name (GTK_OBJECT (ftransport), "activate", gui); - - if (source_proto) { - setup_service (&gui->source, gui->account->source); - gui->source.provider_type = CAMEL_PROVIDER_STORE; - g_free (source_proto); - if (gui->account->source->auto_check) { - gtk_toggle_button_set_active (gui->source_auto_check, TRUE); - gtk_spin_button_set_value (gui->source_auto_check_min, - gui->account->source->auto_check_time); - } - } - - if (transport_proto) { - if (setup_service (&gui->transport, gui->account->transport)) - gtk_toggle_button_set_active (gui->transport_needs_auth, TRUE); - gui->transport.provider_type = CAMEL_PROVIDER_TRANSPORT; - g_free (transport_proto); - } -} - -static void -save_service (MailAccountGuiService *gsvc, GHashTable *extra_config, - MailConfigService *service) -{ - CamelURL *url; - char *str; - - if (!gsvc->provider) { - g_free (service->url); - service->url = NULL; - return; - } - - url = g_new0 (CamelURL, 1); - url->protocol = g_strdup (gsvc->provider->protocol); - - if (CAMEL_PROVIDER_ALLOWS (gsvc->provider, CAMEL_URL_PART_USER)) { - str = gtk_entry_get_text (gsvc->username); - if (str && *str) - url->user = g_strdup (str); - } - - if (CAMEL_PROVIDER_ALLOWS (gsvc->provider, CAMEL_URL_PART_AUTH) && - GTK_WIDGET_IS_SENSITIVE (gsvc->authtype) && gsvc->authitem && url->user) { - CamelServiceAuthType *authtype; - - authtype = gtk_object_get_data (GTK_OBJECT (gsvc->authitem), "authtype"); - if (authtype && authtype->authproto && *authtype->authproto) - url->authmech = g_strdup (authtype->authproto); - - service->save_passwd = gtk_toggle_button_get_active (gsvc->remember); - } - - if (CAMEL_PROVIDER_ALLOWS (gsvc->provider, CAMEL_URL_PART_HOST)) { - char *pport; - - str = gtk_entry_get_text (gsvc->hostname); - if (str && *str) { - pport = strchr (str, ':'); - if (pport) { - url->host = g_strndup (str, pport - str); - url->port = atoi (pport + 1); - } else - url->host = g_strdup (str); - } - } - - if (CAMEL_PROVIDER_ALLOWS (gsvc->provider, CAMEL_URL_PART_PATH)) { - str = gtk_entry_get_text (gsvc->path); - if (str && *str) - url->path = g_strdup (str); - } - - if (gsvc->provider->flags & CAMEL_PROVIDER_SUPPORTS_SSL) { - if (gtk_toggle_button_get_active (gsvc->use_ssl)) - camel_url_set_param (url, "use_ssl", ""); - } - - if (extra_config) - extract_values (gsvc, extra_config, url); - - g_free (service->url); - service->url = camel_url_to_string (url, 0); - - /* Temporary until keep_on_server moves into the POP provider */ - if (camel_url_get_param (url, "keep_on_server")) - service->keep_on_server = TRUE; - - camel_url_free (url); -} - -gboolean -mail_account_gui_save (MailAccountGui *gui) -{ - MailConfigAccount *account = gui->account; - const MailConfigAccount *old_account; - CamelProvider *provider = NULL; - CamelURL *source_url = NULL, *url; - gchar *new_name; - gboolean old_enabled; - - if (!mail_account_gui_identity_complete (gui, NULL) || - !mail_account_gui_source_complete (gui, NULL) || - !mail_account_gui_transport_complete (gui, NULL) || - !mail_account_gui_management_complete (gui, NULL)) - return FALSE; - - /* this would happen at an inconvenient time in the druid, - * but the druid performs its own check so this can't happen - * here. */ - - new_name = e_utf8_gtk_entry_get_text (gui->account_name); - old_account = mail_config_get_account_by_name (new_name); - - if (old_account && old_account != account) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("You may not create two accounts with the same name.")); - return FALSE; - } - - g_free (account->name); - account->name = new_name; - - /* construct the identity */ - identity_destroy (account->id); - account->id = g_new0 (MailConfigIdentity, 1); - account->id->name = e_utf8_gtk_entry_get_text (gui->full_name); - account->id->address = e_utf8_gtk_entry_get_text (gui->email_address); - account->id->organization = e_utf8_gtk_entry_get_text (gui->organization); - account->id->signature = gnome_file_entry_get_full_path (gui->signature, TRUE); - account->id->html_signature = gnome_file_entry_get_full_path (gui->html_signature, TRUE); - account->id->has_html_signature = gtk_toggle_button_get_active (gui->has_html_signature); - - old_enabled = account->source && account->source->enabled; - service_destroy (account->source); - account->source = g_new0 (MailConfigService, 1); - save_service (&gui->source, gui->extra_config, account->source); - if (account->source && account->source->url) { - provider = camel_session_get_provider (session, account->source->url, NULL); - source_url = provider ? camel_url_new (account->source->url, NULL) : NULL; - - if (old_enabled) - account->source->enabled = TRUE; - } - account->source->auto_check = gtk_toggle_button_get_active (gui->source_auto_check); - if (account->source->auto_check) - account->source->auto_check_time = gtk_spin_button_get_value_as_int (gui->source_auto_check_min); - - service_destroy (account->transport); - account->transport = g_new0 (MailConfigService, 1); - save_service (&gui->transport, NULL, account->transport); - - /* Check to make sure that the Drafts folder uri is "valid" before assigning it */ - url = source_url && gui->drafts_folder.uri ? camel_url_new (gui->drafts_folder.uri, NULL) : NULL; - if (mail_config_get_account_by_source_url (gui->drafts_folder.uri) || - (url && provider->url_equal (source_url, url))) { - g_free (account->drafts_folder_name); - account->drafts_folder_name = g_strdup (gui->drafts_folder.name); - g_free (account->drafts_folder_uri); - account->drafts_folder_uri = g_strdup (gui->drafts_folder.uri); - } else { - /* assign defaults - the uri is unknown to us (probably pointed to an old source url) */ - g_free (account->drafts_folder_name); - account->drafts_folder_name = g_strdup (strrchr (default_drafts_folder_uri, '/') + 1); - g_free (account->drafts_folder_uri); - account->drafts_folder_uri = g_strdup (default_drafts_folder_uri); - } - - if (url) - camel_url_free (url); - - /* Check to make sure that the Sent folder uri is "valid" before assigning it */ - url = source_url && gui->sent_folder.uri ? camel_url_new (gui->sent_folder.uri, NULL) : NULL; - if (mail_config_get_account_by_source_url (gui->sent_folder.uri) || - (url && provider->url_equal (source_url, url))) { - g_free (account->sent_folder_name); - account->sent_folder_name = g_strdup (gui->sent_folder.name); - g_free (account->sent_folder_uri); - account->sent_folder_uri = g_strdup (gui->sent_folder.uri); - } else { - /* assign defaults - the uri is unknown to us (probably pointed to an old source url) */ - g_free (account->sent_folder_name); - account->sent_folder_name = g_strdup (strrchr (default_sent_folder_uri, '/') + 1); - g_free (account->sent_folder_uri); - account->sent_folder_uri = g_strdup (default_sent_folder_uri); - } - - if (url) - camel_url_free (url); - - if (source_url) - camel_url_free (source_url); - - g_free (account->pgp_key); - account->pgp_key = e_utf8_gtk_entry_get_text (gui->pgp_key); - account->pgp_encrypt_to_self = gtk_toggle_button_get_active (gui->pgp_encrypt_to_self); - account->pgp_always_sign = gtk_toggle_button_get_active (gui->pgp_always_sign); - g_free (account->smime_key); - account->smime_key = e_utf8_gtk_entry_get_text (gui->smime_key); - account->smime_encrypt_to_self = gtk_toggle_button_get_active (gui->smime_encrypt_to_self); - account->smime_always_sign = gtk_toggle_button_get_active (gui->smime_always_sign); - - if (!mail_config_find_account (account)) - mail_config_add_account (account); - if (gtk_toggle_button_get_active (gui->default_account)) - mail_config_set_default_account (account); - - mail_autoreceive_setup (); - - return TRUE; -} - -void -mail_account_gui_destroy (MailAccountGui *gui) -{ - gtk_object_unref (GTK_OBJECT (gui->xml)); - if (gui->extra_config) - g_hash_table_destroy (gui->extra_config); - g_free (gui->drafts_folder.name); - g_free (gui->drafts_folder.uri); - g_free (gui->sent_folder.name); - g_free (gui->sent_folder.uri); - g_free (gui); -} diff --git a/mail/mail-account-gui.h b/mail/mail-account-gui.h deleted file mode 100644 index 23ee016198..0000000000 --- a/mail/mail-account-gui.h +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Jeffrey Stedfast <fejj@ximian.com> - * Dan Winship <danw@ximian.com> - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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_ACCOUNT_GUI_H -#define MAIL_ACCOUNT_GUI_H - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#include <gtk/gtk.h> -#include <libgnomeui/gnome-file-entry.h> -#include <glade/glade-xml.h> -#include <camel/camel-provider.h> - -#include "mail-config.h" - -typedef struct { - GtkOptionMenu *type; - GtkLabel *description; - GtkEntry *hostname; - GtkEntry *username; - GtkEntry *path; - GtkToggleButton *use_ssl; - GtkWidget *no_ssl; - GtkOptionMenu *authtype; - GtkWidget *authitem; - GtkToggleButton *remember; - GtkButton *check_supported; - - CamelProvider *provider; - CamelProviderType provider_type; -} MailAccountGuiService; - -typedef struct { - char *name, *uri; -} MailAccountGuiFolder; - -typedef struct { - GtkWidget *top; - MailConfigAccount *account; - GladeXML *xml; - - /* identity */ - GtkEntry *full_name; - GtkEntry *email_address; - GtkEntry *organization; - GnomeFileEntry *signature; - GnomeFileEntry *html_signature; - GtkToggleButton *has_html_signature; - GtkButton *edit_signature; - GtkButton *edit_html_signature; - - /* incoming mail */ - MailAccountGuiService source; - GtkToggleButton *source_auto_check; - GtkSpinButton *source_auto_check_min; - - /* extra incoming config */ - GHashTable *extra_config; - - /* outgoing mail */ - MailAccountGuiService transport; - GtkToggleButton *transport_needs_auth; - - /* account management */ - GtkEntry *account_name; - GtkToggleButton *default_account; - - /* special folders */ - GtkButton *drafts_folder_button; - MailAccountGuiFolder drafts_folder; - GtkButton *sent_folder_button; - MailAccountGuiFolder sent_folder; - - /* Security */ - GtkEntry *pgp_key; - GtkToggleButton *pgp_encrypt_to_self; - GtkToggleButton *pgp_always_sign; - GtkEntry *smime_key; - GtkToggleButton *smime_encrypt_to_self; - GtkToggleButton *smime_always_sign; -} MailAccountGui; - - -MailAccountGui *mail_account_gui_new (MailConfigAccount *account); -void mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top); -gboolean mail_account_gui_save (MailAccountGui *gui); -void mail_account_gui_destroy (MailAccountGui *gui); - -gboolean mail_account_gui_identity_complete (MailAccountGui *gui, GtkWidget **incomplete); -gboolean mail_account_gui_source_complete (MailAccountGui *gui, GtkWidget **incomplete); -gboolean mail_account_gui_transport_complete (MailAccountGui *gui, GtkWidget **incomplete); -gboolean mail_account_gui_management_complete (MailAccountGui *gui, GtkWidget **incomplete); - -void mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* MAIL_ACCOUNT_GUI_H */ diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c deleted file mode 100644 index 5d7945c614..0000000000 --- a/mail/mail-accounts.c +++ /dev/null @@ -1,976 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <libgnomeui/gnome-stock.h> -#include <libgnomeui/gnome-messagebox.h> -#include <camel/camel-url.h> -#include <camel/camel-pgp-context.h> - -#include <gal/widgets/e-unicode.h> - -#include "widgets/misc/e-charset-picker.h" - -#include "mail.h" -#include "mail-accounts.h" -#include "mail-config.h" -#include "mail-config-druid.h" -#include "mail-account-editor.h" -#ifdef ENABLE_NNTP -#include "mail-account-editor-news.h" -#endif -#include "mail-send-recv.h" -#include "mail-session.h" - -#include "art/mark.xpm" - -static void mail_accounts_dialog_class_init (MailAccountsDialogClass *class); -static void mail_accounts_dialog_init (MailAccountsDialog *dialog); -static void mail_accounts_dialog_finalise (GtkObject *obj); -static void mail_unselect (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data); - -static MailConfigDruid *druid = NULL; -static MailAccountEditor *editor = NULL; -#ifdef ENABLE_NNTP -static MailAccountEditorNews *news_editor = NULL; -#endif - -static GnomeDialogClass *parent_class; - -GtkType -mail_accounts_dialog_get_type () -{ - static GtkType type = 0; - - if (!type) { - GtkTypeInfo type_info = { - "MailAccountsDialog", - sizeof (MailAccountsDialog), - sizeof (MailAccountsDialogClass), - (GtkClassInitFunc) mail_accounts_dialog_class_init, - (GtkObjectInitFunc) mail_accounts_dialog_init, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL - }; - - type = gtk_type_unique (gnome_dialog_get_type (), &type_info); - } - - return type; -} - -static void -mail_accounts_dialog_class_init (MailAccountsDialogClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - parent_class = gtk_type_class (gnome_dialog_get_type ()); - - object_class->finalize = mail_accounts_dialog_finalise; - /* override methods */ - -} - -static void -mail_accounts_dialog_init (MailAccountsDialog *o) -{ - GdkPixbuf *pixbuf; - - pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) mark_xpm); - gdk_pixbuf_render_pixmap_and_mask (pixbuf, &(o->mark_pixmap), &(o->mark_bitmap), 128); - gdk_pixbuf_unref (pixbuf); -} - -static void -mail_accounts_dialog_finalise (GtkObject *obj) -{ - MailAccountsDialog *dialog = (MailAccountsDialog *) obj; - - gtk_object_unref (GTK_OBJECT (dialog->gui)); - gdk_pixmap_unref (dialog->mark_pixmap); - gdk_bitmap_unref (dialog->mark_bitmap); - - ((GtkObjectClass *)(parent_class))->finalize (obj); -} - -static void -load_accounts (MailAccountsDialog *dialog) -{ - const MailConfigAccount *account, *default_account; - const GSList *node = dialog->accounts; - int i = 0; - - gtk_clist_freeze (dialog->mail_accounts); - - gtk_clist_clear (dialog->mail_accounts); - - default_account = mail_config_get_default_account (); - - while (node) { - CamelURL *url; - char *text[3]; - - account = node->data; - - if (account->source && account->source->url) - url = camel_url_new (account->source->url, NULL); - else - url = NULL; - - text[0] = ""; - text[1] = e_utf8_to_gtk_string (GTK_WIDGET (dialog->mail_accounts), account->name); - text[2] = g_strdup_printf ("%s%s", url && url->protocol ? url->protocol : _("None"), - (account == default_account) ? _(" (default)") : ""); - - if (url) - camel_url_free (url); - - gtk_clist_append (dialog->mail_accounts, text); - g_free (text[1]); - g_free (text[2]); - - if (account->source->enabled) - gtk_clist_set_pixmap (dialog->mail_accounts, i, 0, - dialog->mark_pixmap, - dialog->mark_bitmap); - - /* set the account on the row */ - gtk_clist_set_row_data (dialog->mail_accounts, i, (gpointer) account); - - node = node->next; - i++; - } - - gtk_clist_thaw (dialog->mail_accounts); - - /* - * The selection gets cleared when we rebuild the clist, but no - * unselect event is emitted. So we simulate it here. - * I hate the clist. - */ - mail_unselect (dialog->mail_accounts, 0, 0, NULL, dialog); -} - - -/* mail callbacks */ -static void -mail_select (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data) -{ - MailAccountsDialog *dialog = data; - MailConfigAccount *account = gtk_clist_get_row_data (clist, row); - - dialog->accounts_row = row; - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), TRUE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), TRUE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), TRUE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_able), TRUE); - if (account->source && account->source->enabled) - gtk_label_set_text (GTK_LABEL (GTK_BIN (dialog->mail_able)->child), _("Disable")); - else - gtk_label_set_text (GTK_LABEL (GTK_BIN (dialog->mail_able)->child), _("Enable")); -} - -static void -mail_unselect (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data) -{ - MailAccountsDialog *dialog = data; - - dialog->accounts_row = -1; - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_able), FALSE); - - /* - * If an insensitive button in a button box has the focus, and if you hit tab, - * there is a segfault. I think that this might be a gtk bug. Anyway, this - * is a workaround. - */ - gtk_widget_grab_focus (GTK_WIDGET (dialog->mail_add)); -} - -static void -mail_add_finished (GtkWidget *widget, gpointer data) -{ - /* Either Cancel or Finished was clicked in the druid so reload the accounts */ - MailAccountsDialog *dialog = data; - - dialog->accounts = mail_config_get_accounts (); - load_accounts (dialog); - druid = NULL; -} - -static void -mail_add (GtkButton *button, gpointer data) -{ - MailAccountsDialog *dialog = data; - - if (druid == NULL) { - druid = mail_config_druid_new (dialog->shell); - gtk_signal_connect (GTK_OBJECT (druid), "destroy", - GTK_SIGNAL_FUNC (mail_add_finished), dialog); - - gtk_widget_show (GTK_WIDGET (druid)); - } else { - gdk_window_raise (GTK_WIDGET (druid)->window); - } -} - -static void -mail_editor_destroyed (GtkWidget *widget, gpointer data) -{ - load_accounts (MAIL_ACCOUNTS_DIALOG (data)); - editor = NULL; -} - -static void -mail_edit (GtkButton *button, gpointer data) -{ - MailAccountsDialog *dialog = data; - - if (editor == NULL) { - if (dialog->accounts_row >= 0) { - MailConfigAccount *account; - - account = gtk_clist_get_row_data (dialog->mail_accounts, dialog->accounts_row); - editor = mail_account_editor_new (account); - gnome_dialog_set_parent (GNOME_DIALOG (editor), GTK_WINDOW (dialog)); - gtk_signal_connect (GTK_OBJECT (editor), "destroy", - GTK_SIGNAL_FUNC (mail_editor_destroyed), - dialog); - gtk_widget_show (GTK_WIDGET (editor)); - } - } else { - gdk_window_raise (GTK_WIDGET (editor)->window); - } -} - -static void -mail_double_click (GtkWidget *widget, GdkEventButton *event, gpointer data) -{ - if (event->type == GDK_2BUTTON_PRESS) - mail_edit (NULL, data); -} - -static void -mail_delete (GtkButton *button, gpointer data) -{ - MailAccountsDialog *dialog = data; - MailConfigAccount *account; - GnomeDialog *confirm; - int ans; - - /* make sure we have a valid account selected and that we aren't editing anything... */ - if (dialog->accounts_row < 0 || editor != NULL) - return; - - confirm = GNOME_DIALOG (gnome_message_box_new (_("Are you sure you want to delete this account?"), - GNOME_MESSAGE_BOX_QUESTION, - NULL)); - gnome_dialog_append_button_with_pixmap (confirm, _("Delete"), GNOME_STOCK_BUTTON_YES); - gnome_dialog_append_button_with_pixmap (confirm, _("Don't delete"), GNOME_STOCK_BUTTON_NO); - gtk_window_set_policy (GTK_WINDOW (confirm), TRUE, TRUE, TRUE); - gtk_window_set_modal (GTK_WINDOW (confirm), TRUE); - gtk_window_set_title (GTK_WINDOW (confirm), _("Really delete account?")); - gnome_dialog_set_parent (confirm, GTK_WINDOW (dialog)); - ans = gnome_dialog_run_and_close (confirm); - - if (ans == 0) { - int sel, row, len; - - sel = dialog->accounts_row; - - account = gtk_clist_get_row_data (dialog->mail_accounts, sel); - - /* remove it from the folder-tree in the shell */ - if (account->source && account->source->url && account->source->enabled) - mail_remove_storage_by_uri (account->source->url); - - /* remove it from the config file */ - dialog->accounts = mail_config_remove_account (account); - mail_config_write (); - mail_autoreceive_setup (); - - gtk_clist_remove (dialog->mail_accounts, sel); - - len = dialog->accounts ? g_slist_length ((GSList *) dialog->accounts) : 0; - if (len > 0) { - row = sel >= len ? len - 1 : sel; - load_accounts (dialog); - gtk_clist_select_row (dialog->mail_accounts, row, 0); - } else { - dialog->accounts_row = -1; - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_able), FALSE); - } - } -} - -static void -mail_default (GtkButton *button, gpointer data) -{ - MailAccountsDialog *dialog = data; - const MailConfigAccount *account; - - if (dialog->accounts_row >= 0) { - int row; - - row = dialog->accounts_row; - account = gtk_clist_get_row_data (dialog->mail_accounts, row); - mail_config_set_default_account (account); - mail_config_write (); - load_accounts (dialog); - gtk_clist_select_row (dialog->mail_accounts, row, 0); - } -} - -static void -mail_able (GtkButton *button, gpointer data) -{ - MailAccountsDialog *dialog = data; - const MailConfigAccount *account; - - if (dialog->accounts_row >= 0) { - int row; - - row = dialog->accounts_row; - account = gtk_clist_get_row_data (dialog->mail_accounts, row); - account->source->enabled = !account->source->enabled; - - if (account->source && account->source->url) { - if (account->source->enabled) - mail_load_storage_by_uri (dialog->shell, account->source->url, account->name); - else - mail_remove_storage_by_uri (account->source->url); - } - - mail_autoreceive_setup (); - mail_config_write (); - load_accounts (dialog); - gtk_clist_select_row (dialog->mail_accounts, row, 0); - } -} - -#ifdef ENABLE_NNTP -static void -load_news (MailAccountsDialog *dialog) -{ - const MailConfigService *service; - const GSList *node = dialog->news; - int i = 0; - - gtk_clist_freeze (dialog->news_accounts); - - gtk_clist_clear (dialog->news_accounts); - - while (node) { - CamelURL *url; - gchar *text[1]; - - service = node->data; - - if (service->url) - url = camel_url_new (service->url, NULL); - else - url = NULL; - - text[0] = g_strdup_printf ("%s", url && url->host ? url->host : _("None")); - - if (url) - camel_url_free (url); - - gtk_clist_append (dialog->news_accounts, text); - g_free (text[0]); - - /* set the account on the row */ - gtk_clist_set_row_data (dialog->news_accounts, i, (gpointer) service); - - node = node->next; - i++; - } - - gtk_clist_thaw (dialog->news_accounts); -} - - -/* news callbacks */ -static void -news_select (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data) -{ - MailAccountsDialog *dialog = data; - - dialog->news_row = row; - gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_edit), TRUE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_delete), TRUE); -} - -static void -news_unselect (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data) -{ - MailAccountsDialog *dialog = data; - - dialog->news_row = -1; - gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_edit), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_delete), FALSE); -} - -static void -news_editor_destroyed (GtkWidget *widget, gpointer data) -{ - load_news (MAIL_ACCOUNTS_DIALOG (data)); - news_editor = NULL; -} - -static void -news_edit (GtkButton *button, gpointer data) -{ - MailAccountsDialog *dialog = data; - - if (news_editor == NULL) { - if (dialog->news_row >= 0) { - MailConfigService *service; - - service = gtk_clist_get_row_data (dialog->news_accounts, dialog->news_row); - news_editor = mail_account_editor_news_new (service); - gtk_signal_connect (GTK_OBJECT (news_editor), "destroy", - GTK_SIGNAL_FUNC (news_editor_destroyed), - dialog); - gtk_widget_show (GTK_WIDGET (news_editor)); - } - } else { - gdk_window_raise (GTK_WIDGET (news_editor)->window); - } -} - -static void -news_add_destroyed (GtkWidget *widget, gpointer data) -{ - gpointer *send = data; - MailAccountsDialog *dialog; - MailConfigService *service; - - service = send[0]; - dialog = send[1]; - g_free(send); - - dialog->news = mail_config_get_news (); - load_news (dialog); - - mail_load_storage_by_uri(dialog->shell, service->url, NULL); - - dialog->news = mail_config_get_news (); - load_news (dialog); - -} - -static void -news_add (GtkButton *button, gpointer data) -{ - MailAccountsDialog *dialog = data; - MailConfigService *service; - gpointer *send; - - if (news_editor == NULL) { - send = g_new (gpointer, 2); - - service = g_new0 (MailConfigService, 1); - service->url = NULL; - - news_editor = mail_account_editor_news_new (service); - send[0] = service; - send[1] = dialog; - gtk_signal_connect (GTK_OBJECT (news_editor), "destroy", - GTK_SIGNAL_FUNC (news_add_destroyed), - send); - gtk_widget_show (GTK_WIDGET (news_editor)); - } else { - gdk_window_raise (GTK_WIDGET (news_editor)->window); - } -} - -static void -news_delete (GtkButton *button, gpointer data) -{ - MailAccountsDialog *dialog = data; - MailConfigService *server; - GnomeDialog *confirm; - GtkWidget *label; - int ans; - - /* don't allow user to delete an account if he might be editing it */ - if (dialog->news_row < 0 || news_editor != NULL) - return; - - confirm = GNOME_DIALOG (gnome_dialog_new (_("Are you sure you want to delete this news account?"), - GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO, NULL)); - gtk_window_set_policy (GTK_WINDOW (confirm), TRUE, TRUE, TRUE); - gtk_window_set_modal (GTK_WINDOW (confirm), TRUE); - label = gtk_label_new (_("Are you sure you want to delete this news account?")); - gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); - gtk_box_pack_start (GTK_BOX (confirm->vbox), label, TRUE, TRUE, 0); - gtk_widget_show (label); - gnome_dialog_set_parent (confirm, GTK_WINDOW (dialog)); - ans = gnome_dialog_run_and_close (confirm); - - if (ans == 0) { - int row, len; - - server = gtk_clist_get_row_data (dialog->news_accounts, dialog->news_row); - - /* remove it from the folder-tree in the shell */ - if (server && server->url) { - CamelProvider *prov; - CamelException ex; - - camel_exception_init (&ex); - prov = camel_session_get_provider (session, server->url, &ex); - if (prov != NULL && prov->flags & CAMEL_PROVIDER_IS_STORAGE && - prov->flags & CAMEL_PROVIDER_IS_REMOTE) { - CamelService *store; - - store = camel_session_get_service (session, server->url, - CAMEL_PROVIDER_STORE, &ex); - if (store != NULL) { - g_warning ("removing news storage: %s", server->url); - mail_remove_storage (CAMEL_STORE (store)); - camel_object_unref (CAMEL_OBJECT (store)); - } - } else - g_warning ("%s is not a remote news storage.", server->url); - camel_exception_clear (&ex); - } - - /* remove it from the config file */ - dialog->news = mail_config_remove_news (server); - mail_config_write (); - - gtk_clist_remove (dialog->news_accounts, dialog->news_row); - - len = dialog->news ? g_slist_length ((GSList *) dialog->news) : 0; - if (len > 0) { - row = dialog->news_row; - row = row >= len ? len - 1 : row; - gtk_clist_select_row (dialog->news_accounts, row, 0); - } else { - dialog->news_row = -1; - gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_edit), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_delete), FALSE); - } - } -} -#endif /* ENABLE_NNTP */ - -/* temp widget callbacks */ -static void -send_html_toggled (GtkToggleButton *button, gpointer data) -{ - mail_config_set_send_html (gtk_toggle_button_get_active (button)); -} - -static void -citation_highlight_toggled (GtkToggleButton *button, gpointer data) -{ - mail_config_set_citation_highlight (gtk_toggle_button_get_active (button)); -} - -static void -timeout_toggled (GtkToggleButton *button, gpointer data) -{ - mail_config_set_do_seen_timeout (gtk_toggle_button_get_active (button)); -} - -static void -citation_color_set (GnomeColorPicker *cp, guint r, guint g, guint b, guint a) -{ - guint32 rgb; - - rgb = r >> 8; - rgb <<= 8; - rgb |= g >> 8; - rgb <<= 8; - rgb |= b >> 8; - - mail_config_set_citation_color (rgb); -} - -/* FIXME: */ - -static void -timeout_changed (GtkEntry *entry, gpointer data) -{ - MailAccountsDialog *dialog = data; - gint val; - - val = (gint) (gtk_spin_button_get_value_as_float (dialog->timeout) * 1000); - - mail_config_set_mark_as_seen_timeout (val); -} - -static void -pgp_path_changed (GtkEntry *entry, gpointer data) -{ - CamelPgpType type; - const char *path; - - path = gtk_entry_get_text (entry); - - type = mail_config_pgp_type_detect_from_path (path); - - mail_config_set_pgp_path (path && *path ? path : NULL); - mail_config_set_pgp_type (type); -} - -static void -filter_log_path_changed (GtkEntry *entry, gpointer data) -{ - const char *path; - - path = gtk_entry_get_text (entry); - - mail_config_set_filter_log_path (path && *path ? path : NULL); -} - -static void -set_color (GnomeColorPicker *cp) -{ - guint32 rgb = mail_config_get_citation_color (); - - gnome_color_picker_set_i8 (cp, (rgb & 0xff0000) >> 16, (rgb & 0xff00) >> 8, rgb & 0xff, 0xff); -} - -static void -images_radio_toggled (GtkWidget *radio, gpointer data) -{ - MailAccountsDialog *dialog = data; - - if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio))) - return; - - if (radio == (GtkWidget *)dialog->images_always) - mail_config_set_http_mode (MAIL_CONFIG_HTTP_ALWAYS); - else if (radio == (GtkWidget *)dialog->images_sometimes) - mail_config_set_http_mode (MAIL_CONFIG_HTTP_SOMETIMES); - else - mail_config_set_http_mode (MAIL_CONFIG_HTTP_NEVER); -} - -static void -empty_trash_toggled (GtkWidget *toggle, gpointer data) -{ - mail_config_set_empty_trash_on_exit (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle))); -} - -static void -prompt_empty_subject_toggled (GtkWidget *toggle, gpointer data) -{ - mail_config_set_prompt_empty_subject (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle))); -} - -static void -prompt_bcc_only_toggled (GtkWidget *toggle, gpointer data) -{ - mail_config_set_prompt_only_bcc (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle))); -} - -static void -prompt_unwanted_html_toggled (GtkWidget *toggle, gpointer data) -{ - mail_config_set_confirm_unwanted_html (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle))); -} - -#if 0 -/* Note: Please see construct() for a reason as to why these 2 options are disabled */ -static void -thread_list_toggled (GtkWidget *toggle, gpointer data) -{ - mail_config_set_thread_list (NULL, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle))); -} - -static void -show_preview_toggled (GtkWidget *toggle, gpointer data) -{ - mail_config_set_show_preview (NULL, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle))); -} -#endif - -static void -filter_log_toggled (GtkWidget *toggle, gpointer data) -{ - mail_config_set_filter_log (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle))); -} - -static void -confirm_expunge_toggled (GtkWidget *toggle, gpointer data) -{ - mail_config_set_confirm_expunge (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle))); -} - -static void -forward_style_activated (GtkWidget *item, gpointer data) -{ - int style = GPOINTER_TO_INT (data); - - mail_config_set_default_forward_style (style); -} - -static void -attach_forward_style_signal (GtkWidget *item, gpointer data) -{ - int *num = data; - - gtk_signal_connect (GTK_OBJECT (item), "activate", - forward_style_activated, GINT_TO_POINTER (*num)); - (*num)++; -} - -static void -charset_menu_deactivate (GtkWidget *menu, gpointer data) -{ - char *charset; - - charset = e_charset_picker_get_charset (menu); - if (charset) { - mail_config_set_default_charset (charset); - g_free (charset); - } -} - -static void -construct (MailAccountsDialog *dialog) -{ - GladeXML *gui; - GtkWidget *notebook, *menu; - int num; - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", NULL); - dialog->gui = gui; - - /* get our toplevel widget */ - notebook = glade_xml_get_widget (gui, "notebook"); - - /* reparent */ - gtk_widget_reparent (notebook, GNOME_DIALOG (dialog)->vbox); - - /* give our dialog an Close button and title */ - gtk_window_set_title (GTK_WINDOW (dialog), _("Mail Settings")); - gtk_window_set_policy (GTK_WINDOW (dialog), FALSE, TRUE, TRUE); - gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 300); - gnome_dialog_append_button (GNOME_DIALOG (dialog), GNOME_STOCK_BUTTON_CLOSE); - - dialog->mail_accounts = GTK_CLIST (glade_xml_get_widget (gui, "clistAccounts")); - gtk_signal_connect (GTK_OBJECT (dialog->mail_accounts), "select-row", - GTK_SIGNAL_FUNC (mail_select), dialog); - gtk_signal_connect (GTK_OBJECT (dialog->mail_accounts), "unselect-row", - GTK_SIGNAL_FUNC (mail_unselect), dialog); - gtk_signal_connect (GTK_OBJECT (dialog->mail_accounts), "button_press_event", - mail_double_click, dialog); - dialog->mail_add = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailAdd")); - gtk_signal_connect (GTK_OBJECT (dialog->mail_add), "clicked", - GTK_SIGNAL_FUNC (mail_add), dialog); - dialog->mail_edit = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailEdit")); - gtk_signal_connect (GTK_OBJECT (dialog->mail_edit), "clicked", - GTK_SIGNAL_FUNC (mail_edit), dialog); - dialog->mail_delete = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailDelete")); - gtk_signal_connect (GTK_OBJECT (dialog->mail_delete), "clicked", - GTK_SIGNAL_FUNC (mail_delete), dialog); - dialog->mail_default = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailDefault")); - gtk_signal_connect (GTK_OBJECT (dialog->mail_default), "clicked", - GTK_SIGNAL_FUNC (mail_default), dialog); - dialog->mail_able = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailAble")); - gtk_signal_connect (GTK_OBJECT (dialog->mail_able), "clicked", - GTK_SIGNAL_FUNC (mail_able), dialog); - -#ifdef ENABLE_NNTP - dialog->news_accounts = GTK_CLIST (glade_xml_get_widget (gui, "clistNews")); - gtk_signal_connect (GTK_OBJECT (dialog->news_accounts), "select-row", - GTK_SIGNAL_FUNC (news_select), dialog); - gtk_signal_connect (GTK_OBJECT (dialog->news_accounts), "unselect-row", - GTK_SIGNAL_FUNC (news_unselect), dialog); - dialog->news_add = GTK_BUTTON (glade_xml_get_widget (gui, "cmdNewsAdd")); - gtk_signal_connect (GTK_OBJECT (dialog->news_add), "clicked", - GTK_SIGNAL_FUNC (news_add), dialog); - dialog->news_edit = GTK_BUTTON (glade_xml_get_widget (gui, "cmdNewsEdit")); - gtk_signal_connect (GTK_OBJECT (dialog->news_edit), "clicked", - GTK_SIGNAL_FUNC (news_edit), dialog); - dialog->news_delete = GTK_BUTTON (glade_xml_get_widget (gui, "cmdNewsDelete")); - gtk_signal_connect (GTK_OBJECT (dialog->news_delete), "clicked", - GTK_SIGNAL_FUNC (news_delete), dialog); -#else - /* remove the news tab since we don't support nntp */ - gtk_notebook_remove_page (GTK_NOTEBOOK (notebook), 1); -#endif - - /* Display page */ - dialog->citation_highlight = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chckHighlightCitations")); - gtk_toggle_button_set_active (dialog->citation_highlight, mail_config_get_citation_highlight ()); - gtk_signal_connect (GTK_OBJECT (dialog->citation_highlight), "toggled", - GTK_SIGNAL_FUNC (citation_highlight_toggled), dialog); - dialog->citation_color = GNOME_COLOR_PICKER (glade_xml_get_widget (gui, "colorpickerCitations")); - set_color (dialog->citation_color); - gtk_signal_connect (GTK_OBJECT (dialog->citation_color), "color_set", - GTK_SIGNAL_FUNC (citation_color_set), dialog); - - dialog->timeout_toggle = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "checkMarkTimeout")); - gtk_toggle_button_set_active (dialog->timeout_toggle, mail_config_get_do_seen_timeout ()); - gtk_signal_connect (GTK_OBJECT (dialog->timeout_toggle), "toggled", - GTK_SIGNAL_FUNC (timeout_toggled), dialog); - - dialog->timeout = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spinMarkTimeout")); - gtk_spin_button_set_value (dialog->timeout, (1.0 * mail_config_get_mark_as_seen_timeout ()) / 1000.0); - gtk_signal_connect (GTK_OBJECT (dialog->timeout), "changed", - GTK_SIGNAL_FUNC (timeout_changed), dialog); - - dialog->images_never = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radioImagesNever")); - gtk_toggle_button_set_active (dialog->images_never, mail_config_get_http_mode () == MAIL_CONFIG_HTTP_NEVER); - gtk_signal_connect (GTK_OBJECT (dialog->images_never), "toggled", - GTK_SIGNAL_FUNC (images_radio_toggled), dialog); - dialog->images_sometimes = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radioImagesSometimes")); - gtk_toggle_button_set_active (dialog->images_sometimes, mail_config_get_http_mode () == MAIL_CONFIG_HTTP_SOMETIMES); - gtk_signal_connect (GTK_OBJECT (dialog->images_sometimes), "toggled", - GTK_SIGNAL_FUNC (images_radio_toggled), dialog); - dialog->images_always = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radioImagesAlways")); - gtk_toggle_button_set_active (dialog->images_always, mail_config_get_http_mode () == MAIL_CONFIG_HTTP_ALWAYS); - gtk_signal_connect (GTK_OBJECT (dialog->images_always), "toggled", - GTK_SIGNAL_FUNC (images_radio_toggled), dialog); - -#if 0 - /* These options are disabled because they are completely non-intuitive and evil */ - dialog->thread_list = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkThreadedList")); - gtk_toggle_button_set_active (dialog->thread_list, mail_config_get_thread_list (NULL)); - gtk_signal_connect (GTK_OBJECT (dialog->thread_list), "toggled", - GTK_SIGNAL_FUNC (thread_list_toggled), dialog); - - dialog->show_preview = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkShowPreview")); - gtk_toggle_button_set_active (dialog->show_preview, mail_config_get_show_preview (NULL)); - gtk_signal_connect (GTK_OBJECT (dialog->show_preview), "toggled", - GTK_SIGNAL_FUNC (show_preview_toggled), dialog); -#endif - - /* Composer page */ - dialog->send_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkSendHTML")); - gtk_toggle_button_set_active (dialog->send_html, mail_config_get_send_html ()); - gtk_signal_connect (GTK_OBJECT (dialog->send_html), "toggled", - GTK_SIGNAL_FUNC (send_html_toggled), dialog); - - dialog->forward_style = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuForwardStyle")); - gtk_option_menu_set_history (dialog->forward_style, mail_config_get_default_forward_style ()); - /* Hm. This sucks... */ - num = 0; - gtk_container_foreach (GTK_CONTAINER (gtk_option_menu_get_menu (dialog->forward_style)), - attach_forward_style_signal, &num); - - dialog->prompt_empty_subject = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptEmptySubject")); - gtk_toggle_button_set_active (dialog->prompt_empty_subject, mail_config_get_prompt_empty_subject ()); - gtk_signal_connect (GTK_OBJECT (dialog->prompt_empty_subject), "toggled", - GTK_SIGNAL_FUNC (prompt_empty_subject_toggled), dialog); - - dialog->prompt_bcc_only = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptBccOnly")); - gtk_toggle_button_set_active (dialog->prompt_bcc_only, mail_config_get_prompt_only_bcc ()); - gtk_signal_connect (GTK_OBJECT (dialog->prompt_bcc_only), "toggled", - GTK_SIGNAL_FUNC (prompt_bcc_only_toggled), dialog); - - dialog->prompt_unwanted_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptWantHTML")); - gtk_toggle_button_set_active (dialog->prompt_unwanted_html, mail_config_get_confirm_unwanted_html ()); - gtk_signal_connect (GTK_OBJECT (dialog->prompt_unwanted_html), "toggled", - GTK_SIGNAL_FUNC (prompt_unwanted_html_toggled), dialog); - - /* Other page */ - dialog->pgp_path = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "filePgpPath")); - gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (dialog->pgp_path)), - mail_config_get_pgp_path ()); - gnome_file_entry_set_default_path (dialog->pgp_path, mail_config_get_pgp_path ()); - gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (dialog->pgp_path)), - "changed", GTK_SIGNAL_FUNC (pgp_path_changed), dialog); - - dialog->charset = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuCharset")); - menu = e_charset_picker_new (mail_config_get_default_charset ()); - gtk_option_menu_set_menu (dialog->charset, GTK_WIDGET (menu)); - gtk_signal_connect (GTK_OBJECT (menu), "deactivate", - GTK_SIGNAL_FUNC (charset_menu_deactivate), NULL); - - dialog->empty_trash = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkEmptyTrashOnExit")); - gtk_toggle_button_set_active (dialog->empty_trash, mail_config_get_empty_trash_on_exit ()); - gtk_signal_connect (GTK_OBJECT (dialog->empty_trash), "toggled", - GTK_SIGNAL_FUNC (empty_trash_toggled), dialog); - - dialog->filter_log = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkFilterLog")); - gtk_toggle_button_set_active (dialog->filter_log, mail_config_get_filter_log ()); - gtk_signal_connect (GTK_OBJECT (dialog->filter_log), "toggled", - GTK_SIGNAL_FUNC (filter_log_toggled), dialog); - - dialog->filter_log_path = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "fileFilterLog")); - gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (dialog->filter_log_path)), - mail_config_get_filter_log_path ()); - gnome_file_entry_set_default_path (dialog->filter_log_path, mail_config_get_filter_log_path ()); - gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (dialog->filter_log_path)), - "changed", GTK_SIGNAL_FUNC (filter_log_path_changed), dialog); - - dialog->confirm_expunge = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkConfirmExpunge")); - gtk_toggle_button_set_active (dialog->confirm_expunge, mail_config_get_confirm_expunge ()); - gtk_signal_connect (GTK_OBJECT (dialog->confirm_expunge), "toggled", - GTK_SIGNAL_FUNC (confirm_expunge_toggled), dialog); - - /* now to fill in the clists */ - dialog->accounts_row = -1; - dialog->accounts = mail_config_get_accounts (); - if (dialog->accounts) { - load_accounts (dialog); - gtk_clist_select_row (dialog->mail_accounts, 0, 0); - } else { - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), FALSE); - } - -#ifdef ENABLE_NNTP - dialog->news_row = -1; - dialog->news = mail_config_get_news (); - if (dialog->news) { - load_news (dialog); - gtk_clist_select_row (dialog->news_accounts, 0, 0); - } else { - gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_edit), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_delete), FALSE); - } -#endif /* ENABLE_NNTP */ -} - -MailAccountsDialog * -mail_accounts_dialog_new (GNOME_Evolution_Shell shell) -{ - MailAccountsDialog *new; - - new = (MailAccountsDialog *) gtk_type_new (mail_accounts_dialog_get_type ()); - construct (new); - new->shell = shell; - - return new; -} diff --git a/mail/mail-accounts.h b/mail/mail-accounts.h deleted file mode 100644 index f2580874d3..0000000000 --- a/mail/mail-accounts.h +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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_ACCOUNTS_H -#define MAIL_ACCOUNTS_H - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#include <gtk/gtkclist.h> -#include <gtk/gtktogglebutton.h> -#include <gtk/gtkoptionmenu.h> -#include <gtk/gtkspinbutton.h> -#include <libgnomeui/gnome-color-picker.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-file-entry.h> -#include <glade/glade.h> -#include <shell/Evolution.h> - -#define MAIL_ACCOUNTS_DIALOG_TYPE (mail_accounts_dialog_get_type ()) -#define MAIL_ACCOUNTS_DIALOG(o) (GTK_CHECK_CAST ((o), MAIL_ACCOUNTS_DIALOG_TYPE, MailAccountsDialog)) -#define MAIL_ACCOUNTS_DIALOG_CLASS(k) (GTK_CHECK_CLASS_CAST((k), MAIL_ACCOUNTS_DIALOG_TYPE, MailAccountsDialogClass)) -#define IS_MAIL_ACCOUNTS_DIALOG(o) (GTK_CHECK_TYPE ((o), MAIL_ACCOUNTS_DIALOG_TYPE)) -#define IS_MAIL_ACCOUNTS_DIALOG_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MAIL_ACCOUNTS_DIALOG_TYPE)) - -struct _MailAccountsDialog { - GnomeDialog parent; - - GNOME_Evolution_Shell shell; - - GladeXML *gui; - - const GSList *accounts; - gint accounts_row; - - /* Accounts page */ - GtkCList *mail_accounts; - GtkButton *mail_add; - GtkButton *mail_edit; - GtkButton *mail_delete; - GtkButton *mail_default; - GtkButton *mail_able; - - const GSList *news; - gint news_row; - - /* News page */ - GtkCList *news_accounts; - GtkButton *news_add; - GtkButton *news_edit; - GtkButton *news_delete; - - /* Display page */ - GtkToggleButton *citation_highlight; - GnomeColorPicker *citation_color; - GtkToggleButton *timeout_toggle; - GtkSpinButton *timeout; - GtkToggleButton *images_always, *images_sometimes, *images_never; - /*GtkToggleButton *thread_list;*/ - /*GtkToggleButton *show_preview;*/ - - /* Composer page */ - GtkToggleButton *send_html; - GtkOptionMenu *forward_style; - GtkOptionMenu *charset; - GtkToggleButton *prompt_empty_subject; - GtkToggleButton *prompt_bcc_only; - GtkToggleButton *prompt_unwanted_html; - - /* Other page */ - GtkToggleButton *empty_trash; - GtkToggleButton *filter_log; - GnomeFileEntry *filter_log_path; - GtkToggleButton *confirm_expunge; - - /* PGP page */ - GnomeFileEntry *pgp_path; - - /* Pixmaps for the clist */ - GdkPixmap *mark_pixmap; - GdkBitmap *mark_bitmap; -}; - -typedef struct _MailAccountsDialog MailAccountsDialog; - -typedef struct { - GnomeDialogClass parent_class; - - /* signals */ - -} MailAccountsDialogClass; - -GtkType mail_accounts_dialog_get_type (void); - -MailAccountsDialog *mail_accounts_dialog_new (GNOME_Evolution_Shell shell); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* MAIL_ACCOUNTS_H */ diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c deleted file mode 100644 index eba956e1f1..0000000000 --- a/mail/mail-autofilter.c +++ /dev/null @@ -1,403 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* mail-autofilter.c - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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. - * - * Authors: - * Michael Zucchi <notzed@ximian.com> - * Ettore Perazzoli <ettore@ximian.com> - */ - -/* Code for autogenerating rules or filters from a message. */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <ctype.h> - -#include <libgnomeui/gnome-app.h> -#include <libgnomeui/gnome-app-helper.h> -#include <libgnomeui/gnome-popup-menu.h> -#include <gal/util/e-unicode-i18n.h> - -#include "mail-vfolder.h" -#include "mail-autofilter.h" - -#include "camel/camel.h" - -#include "filter/vfolder-context.h" -#include "filter/vfolder-rule.h" -#include "filter/vfolder-editor.h" - -#include "filter/filter-context.h" -#include "filter/filter-filter.h" -#include "filter/filter-editor.h" -#include "filter/filter-option.h" - -extern char *evolution_dir; - -static void -rule_match_recipients (RuleContext *context, FilterRule *rule, CamelInternetAddress *iaddr) -{ - FilterPart *part; - FilterElement *element; - int i; - const char *real, *addr; - char *namestr; - - /* address types etc should handle multiple values */ - for (i = 0; camel_internet_address_get (iaddr, i, &real, &addr); i++) { - part = rule_context_create_part (context, "to"); - filter_rule_add_part ((FilterRule *)rule, part); - element = filter_part_find_element (part, "recipient-type"); - filter_option_set_current ((FilterOption *)element, "contains"); - element = filter_part_find_element (part, "recipient"); - filter_input_set_value ((FilterInput *)element, addr); - - namestr = g_strdup_printf (U_("Mail to %s"), real && real[0] ? real : addr); - filter_rule_set_name (rule, namestr); - g_free (namestr); - } -} - - -/* remove 're' part of a subject */ -static const char * -strip_re (const char *subject) -{ - const unsigned char *s, *p; - - s = (unsigned char *) subject; - - while (*s) { - while (isspace (*s)) - s++; - if (s[0] == 0) - break; - if ((s[0] == 'r' || s[0] == 'R') - && (s[1] == 'e' || s[1] == 'E')) { - p = s+2; - while (isdigit (*p) || (ispunct (*p) && (*p != ':'))) - p++; - if (*p == ':') { - s = p + 1; - } else - break; - } else - break; - } - return (char *) s; -} - -#if 0 -int -reg_match (char *str, char *regstr) -{ - regex_t reg; - int error; - int ret; - - error = regcomp(®, regstr, REG_EXTENDED|REG_ICASE|REG_NOSUB); - if (error != 0) { - return 0; - } - error = regexec(®, str, 0, NULL, 0); - regfree(®); - return (error == 0); -} -#endif - -static void -rule_add_subject (RuleContext *context, FilterRule *rule, const char *text) -{ - FilterPart *part; - FilterElement *element; - - /* dont match on empty strings ever */ - if (*text == 0) - return; - part = rule_context_create_part (context, "subject"); - filter_rule_add_part ((FilterRule *)rule, part); - element = filter_part_find_element (part, "subject-type"); - filter_option_set_current ((FilterOption *)element, "contains"); - element = filter_part_find_element (part, "subject"); - filter_input_set_value ((FilterInput *)element, text); -} - -static void -rule_add_sender (RuleContext *context, FilterRule *rule, const char *text) -{ - FilterPart *part; - FilterElement *element; - - /* dont match on empty strings ever */ - if (*text == 0) - return; - part = rule_context_create_part (context, "sender"); - filter_rule_add_part ((FilterRule *)rule, part); - element = filter_part_find_element (part, "sender-type"); - filter_option_set_current ((FilterOption *)element, "contains"); - element = filter_part_find_element (part, "sender"); - filter_input_set_value ((FilterInput *)element, text); -} - -/* do a bunch of things on the subject to try and detect mailing lists, remove - unneeded stuff, etc */ -static void -rule_match_subject (RuleContext *context, FilterRule *rule, const char *subject) -{ - const char *s; - const char *s1, *s2; - char *tmp; - - s = strip_re (subject); - /* dont match on empty subject */ - if (*s == 0) - return; - - /* [blahblah] is probably a mailing list, match on it separately */ - s1 = strchr (s, '['); - s2 = strchr (s, ']'); - if (s1 && s2 && s1 < s2) { - /* probably a mailing list, match on the mailing list name */ - tmp = alloca (s2 - s1 + 2); - memcpy (tmp, s1, s2 - s1 + 1); - tmp[s2 - s1 + 1] = 0; - g_strstrip (tmp); - rule_add_subject (context, rule, tmp); - s = s2 + 1; - } - /* Froblah: at the start is probably something important (e.g. bug number) */ - s1 = strchr (s, ':'); - if (s1) { - tmp = alloca (s1 - s + 1); - memcpy (tmp, s, s1-s); - tmp[s1 - s] = 0; - g_strstrip (tmp); - rule_add_subject (context, rule, tmp); - s = s1+1; - } - - /* just lump the rest together */ - tmp = alloca (strlen (s) + 1); - strcpy (tmp, s); - g_strstrip (tmp); - rule_add_subject (context, rule, tmp); -} - -static void -rule_from_message (FilterRule *rule, RuleContext *context, CamelMimeMessage *msg, int flags) -{ - CamelInternetAddress *addr; - - rule->grouping = FILTER_GROUP_ANY; - - if (flags & AUTO_SUBJECT) { - char *namestr; - - rule_match_subject (context, rule, msg->subject); - - namestr = g_strdup_printf (U_("Subject is %s"), strip_re (msg->subject)); - filter_rule_set_name (rule, namestr); - g_free (namestr); - } - /* should parse the from address into an internet address? */ - if (flags & AUTO_FROM) { - const CamelInternetAddress *from; - int i; - const char *name, *addr; - char *namestr; - - from = camel_mime_message_get_from(msg); - for (i=0;camel_internet_address_get(from, i, &name, &addr); i++) { - rule_add_sender(context, rule, addr); - if (name==NULL || name[0]==0) - name = addr; - namestr = g_strdup_printf(U_("Mail from %s"), name); - filter_rule_set_name(rule, namestr); - g_free(namestr); - } - } - if (flags & AUTO_TO) { - addr = (CamelInternetAddress *)camel_mime_message_get_recipients (msg, CAMEL_RECIPIENT_TYPE_TO); - rule_match_recipients (context, rule, addr); - addr = (CamelInternetAddress *)camel_mime_message_get_recipients (msg, CAMEL_RECIPIENT_TYPE_CC); - rule_match_recipients (context, rule, addr); - } -} - -FilterRule * -vfolder_rule_from_message (VfolderContext *context, CamelMimeMessage *msg, int flags, const char *source) -{ - VfolderRule *rule; - - rule = vfolder_rule_new (); - vfolder_rule_add_source (rule, source); - rule_from_message ((FilterRule *)rule, (RuleContext *)context, msg, flags); - - return (FilterRule *)rule; -} - -FilterRule * -filter_rule_from_message (FilterContext *context, CamelMimeMessage *msg, int flags) -{ - FilterFilter *rule; - FilterPart *part; - - rule = filter_filter_new (); - rule_from_message ((FilterRule *)rule, (RuleContext *)context, msg, flags); - - part = filter_context_next_action (context, NULL); - filter_filter_add_action (rule, filter_part_clone (part)); - - return (FilterRule *)rule; -} - -static void -rule_from_mlist(FilterRule *rule, RuleContext *context, const char *mlist) -{ - FilterPart *part; - FilterElement *element; - char *rule_name; - - part = rule_context_create_part(context, "mlist"); - filter_rule_add_part(rule, part); - - element = filter_part_find_element(part, "mlist-type"); - filter_option_set_current((FilterOption *)element, "is"); - - element = filter_part_find_element (part, "mlist"); - filter_input_set_value((FilterInput *)element, mlist); - - rule_name = g_strdup_printf(U_("%s mailing list"), mlist); - filter_rule_set_name((FilterRule *) rule, rule_name); - g_free (rule_name); -} - -FilterRule * -vfolder_rule_from_mlist(VfolderContext *context, const char *mlist, const char *source) -{ - VfolderRule *rule; - - rule = vfolder_rule_new (); - vfolder_rule_add_source (rule, source); - rule_from_mlist((FilterRule *)rule, (RuleContext *)context, mlist); - - return (FilterRule *)rule; -} - -FilterRule * -filter_rule_from_mlist (FilterContext *context, const char *mlist) -{ - FilterFilter *rule; - FilterPart *part; - - rule = filter_filter_new (); - rule_from_mlist((FilterRule *)rule, (RuleContext *)context, mlist); - - part = filter_context_next_action (context, NULL); - filter_filter_add_action (rule, filter_part_clone (part)); - - return (FilterRule *)rule; -} - -void -filter_gui_add_from_message (CamelMimeMessage *msg, int flags) -{ - FilterContext *fc; - char *user, *system; - FilterRule *rule; - - g_return_if_fail (msg != NULL); - - fc = filter_context_new (); - user = g_strdup_printf ("%s/filters.xml", evolution_dir); - system = EVOLUTION_DATADIR "/evolution/filtertypes.xml"; - rule_context_load ((RuleContext *)fc, system, user); - rule = filter_rule_from_message (fc, msg, flags); - - filter_rule_set_source (rule, FILTER_SOURCE_INCOMING); - - rule_context_add_rule_gui ((RuleContext *)fc, rule, _("Add Filter Rule"), user); - g_free (user); - gtk_object_unref (GTK_OBJECT (fc)); -} - -void -filter_gui_add_from_mlist (const char *mlist) -{ - FilterContext *fc; - char *user, *system; - FilterRule *rule; - - fc = filter_context_new (); - user = g_strdup_printf ("%s/filters.xml", evolution_dir); - system = EVOLUTION_DATADIR "/evolution/filtertypes.xml"; - rule_context_load ((RuleContext *)fc, system, user); - rule = filter_rule_from_mlist(fc, mlist); - - filter_rule_set_source (rule, FILTER_SOURCE_INCOMING); - - rule_context_add_rule_gui ((RuleContext *)fc, rule, _("Add Filter Rule"), user); - g_free (user); - gtk_object_unref (GTK_OBJECT (fc)); -} - -void -mail_filter_rename_uri(CamelStore *store, const char *olduri, const char *newuri) -{ - GCompareFunc uri_cmp = CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->compare_folder_name; - FilterContext *fc; - char *user, *system; - - fc = filter_context_new (); - user = g_strdup_printf ("%s/filters.xml", evolution_dir); - system = EVOLUTION_DATADIR "/evolution/filtertypes.xml"; - rule_context_load ((RuleContext *)fc, system, user); - - if (rule_context_rename_uri((RuleContext *)fc, olduri, newuri, uri_cmp) > 0) { - printf("Folder rename '%s' -> '%s' changed filters, resaving\n", olduri, newuri); - if (rule_context_save((RuleContext *)fc, user) == -1) - g_warning("Could not write out changed filter rules\n"); - } - - g_free(user); - gtk_object_unref (GTK_OBJECT (fc)); -} - -void -mail_filter_delete_uri(CamelStore *store, const char *uri) -{ - GCompareFunc uri_cmp = CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->compare_folder_name; - FilterContext *fc; - char *user, *system; - - fc = filter_context_new (); - user = g_strdup_printf ("%s/filters.xml", evolution_dir); - system = EVOLUTION_DATADIR "/evolution/filtertypes.xml"; - rule_context_load ((RuleContext *)fc, system, user); - - if (rule_context_delete_uri((RuleContext *)fc, uri, uri_cmp) > 0) { - printf("Folder deleterename '%s' changed filters, resaving\n", uri); - if (rule_context_save((RuleContext *)fc, user) == -1) - g_warning("Could not write out changed filter rules\n"); - } - - g_free(user); - gtk_object_unref (GTK_OBJECT (fc)); -} diff --git a/mail/mail-autofilter.h b/mail/mail-autofilter.h deleted file mode 100644 index 5a2dbe52e5..0000000000 --- a/mail/mail-autofilter.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* mail-autofilter.h - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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. - * - * Authors: - * Michael Zucchi <notzed@ximian.com> - * Ettore Perazzoli <ettore@ximian.com> - */ - -#ifndef _MAIL_AUTOFILTER_H -#define _MAIL_AUTOFILTER_H - -#include <filter/filter-rule.h> -#include <filter/filter-context.h> -#include <filter/vfolder-context.h> -#include <camel/camel-mime-message.h> - -enum { - AUTO_SUBJECT = 1, - AUTO_FROM = 2, - AUTO_TO = 4 -}; - -FilterRule *vfolder_rule_from_message(VfolderContext *context, CamelMimeMessage *msg, int flags, const char *source); -FilterRule *filter_rule_from_message(FilterContext *context, CamelMimeMessage *msg, int flags); -FilterRule *vfolder_rule_from_mlist(VfolderContext *context, const char *mlist, const char *source); -FilterRule *filter_rule_from_mlist(FilterContext *context, const char *mlist); - -/* easiest place to put this */ - -void filter_gui_add_from_message(CamelMimeMessage *msg, int flags); -void filter_gui_add_from_mlist(const char *mlist); - -/* Also easiest place for these, we should really share a global rule context for this stuff ... */ -void mail_filter_rename_uri(CamelStore *store, const char *olduri, const char *newuri); -void mail_filter_delete_uri(CamelStore *store, const char *uri); - -#endif diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c deleted file mode 100644 index 4a704b077d..0000000000 --- a/mail/mail-callbacks.c +++ /dev/null @@ -1,2566 +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 <danw@ximian.com> - * Peter Williams <peterw@ximian.com> - * Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright 2000 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include <errno.h> -#include <time.h> -#include <libgnome/gnome-paper.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-dialog-util.h> -#include <libgnomeui/gnome-stock.h> -#include <libgnome/gnome-paper.h> -#include <libgnomeprint/gnome-print-master.h> -#include <libgnomeprint/gnome-print-master-preview.h> -#include <bonobo/bonobo-widget.h> -#include <bonobo/bonobo-socket.h> -#include <gal/e-table/e-table.h> -#include <gal/widgets/e-gui-utils.h> -#include <gal/widgets/e-unicode.h> -#include <filter/filter-editor.h> -#include "mail.h" -#include "message-browser.h" -#include "mail-callbacks.h" -#include "mail-config.h" -#include "mail-accounts.h" -#include "mail-config-druid.h" -#include "mail-mt.h" -#include "mail-tools.h" -#include "mail-ops.h" -#include "mail-local.h" -#include "mail-search.h" -#include "mail-send-recv.h" -#include "mail-vfolder.h" -#include "mail-folder-cache.h" -#include "folder-browser.h" -#include "subscribe-dialog.h" -#include "e-messagebox.h" - -#include "Evolution.h" -#include "evolution-storage.h" - -#include "evolution-shell-client.h" - -#ifndef HAVE_MKSTEMP -#include <fcntl.h> -#include <sys/stat.h> -#endif - -#define FB_WINDOW(fb) GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (fb), GTK_TYPE_WINDOW)) - -/* These e_gnome_dialog* functions are to handle the brokenness that is gnome-dialog */ -static void -e_gnome_dialog_parent_destroyed (GtkWidget *parent, GtkWidget *dialog) -{ - gnome_dialog_close (GNOME_DIALOG (dialog)); -} - -static void -e_gnome_dialog_set_parent (GnomeDialog *dialog, GtkWindow *parent) -{ - gnome_dialog_set_parent (dialog, parent); - gtk_signal_connect_while_alive (GTK_OBJECT (parent), "destroy", - e_gnome_dialog_parent_destroyed, - dialog, GTK_OBJECT (dialog)); -} - -static GtkWidget * -e_gnome_warning_dialog_parented (const char *warning, GtkWindow *parent) -{ - GtkWidget *dialog; - - dialog = gnome_warning_dialog_parented (warning, parent); - gtk_signal_connect (GTK_OBJECT (parent), "destroy", - e_gnome_dialog_parent_destroyed, dialog); - - return dialog; -} - -static GtkWidget * -e_gnome_ok_cancel_dialog_parented (const char *message, GnomeReplyCallback callback, - gpointer data, GtkWindow *parent) -{ - GtkWidget *dialog; - - dialog = gnome_ok_cancel_dialog_parented (message, callback, data, parent); - gtk_signal_connect (GTK_OBJECT (parent), "destroy", - e_gnome_dialog_parent_destroyed, dialog); - - return dialog; -} - - -struct post_send_data { - CamelFolder *folder; - gchar *uid; - guint32 flags; -}; - -static void -druid_destroyed (void) -{ - gtk_main_quit (); -} - -static gboolean -configure_mail (FolderBrowser *fb) -{ - MailConfigDruid *druid; - GtkWidget *dialog; - - dialog = gnome_message_box_new ( - _("You have not configured the mail client.\n" - "You need to do this before you can send,\n" - "receive or compose mail.\n" - "Would you like to configure it now?"), - GNOME_MESSAGE_BOX_QUESTION, - GNOME_STOCK_BUTTON_YES, - GNOME_STOCK_BUTTON_NO, NULL); - - /* - * Focus YES - */ - gnome_dialog_set_default (GNOME_DIALOG (dialog), 0); - gtk_widget_grab_focus (GTK_WIDGET (GNOME_DIALOG (dialog)->buttons->data)); - - e_gnome_dialog_set_parent (GNOME_DIALOG (dialog), FB_WINDOW (fb)); - - switch (gnome_dialog_run_and_close (GNOME_DIALOG (dialog))) { - case 0: - druid = mail_config_druid_new (fb->shell); - gtk_signal_connect (GTK_OBJECT (druid), "destroy", - GTK_SIGNAL_FUNC (druid_destroyed), NULL); - gtk_widget_show (GTK_WIDGET (druid)); - gtk_grab_add (GTK_WIDGET (druid)); - gtk_main (); - break; - case 1: - default: - break; - } - - return mail_config_is_configured (); -} - -static gboolean -check_send_configuration (FolderBrowser *fb) -{ - const MailConfigAccount *account; - - /* Check general */ - if (!mail_config_is_configured () && !configure_mail (fb)) - return FALSE; - - /* Get the default account */ - account = mail_config_get_default_account (); - - /* Check for an identity */ - if (!account) { - GtkWidget *message; - - message = e_gnome_warning_dialog_parented (_("You need to configure an identity\n" - "before you can compose mail."), - FB_WINDOW (fb)); - - gnome_dialog_set_close (GNOME_DIALOG (message), TRUE); - gtk_widget_show (message); - - return FALSE; - } - - /* Check for a transport */ - if (!account->transport || !account->transport->url) { - GtkWidget *message; - - message = e_gnome_warning_dialog_parented (_("You need to configure a mail transport\n" - "before you can compose mail."), - GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (fb), - GTK_TYPE_WINDOW))); - - gnome_dialog_set_close (GNOME_DIALOG (message), TRUE); - gtk_widget_show (message); - - return FALSE; - } - - return TRUE; -} - -void -send_receive_mail (GtkWidget *widget, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - const MailConfigAccount *account; - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - if (!mail_config_is_configured () && !configure_mail (fb)) - return; - - account = mail_config_get_default_account (); - if (!account || !account->transport) { - GtkWidget *dialog; - - dialog = gnome_error_dialog_parented (_("You have not set a mail transport method"), - FB_WINDOW (fb)); - gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE); - gtk_widget_show (dialog); - - return; - } - - mail_send_receive (); -} - -static void -msgbox_destroyed (GtkWidget *widget, gpointer data) -{ - gboolean *show_again = data; - GtkWidget *checkbox; - - checkbox = e_message_box_get_checkbox (E_MESSAGE_BOX (widget)); - *show_again = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox)); -} - -static gboolean -ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EDestination **recipients) -{ - gboolean show_again = TRUE; - GString *str; - GtkWidget *mbox; - gint i, button; - - if (!mail_config_get_confirm_unwanted_html ()) { - g_message ("doesn't want to see confirm html messages!"); - return TRUE; - } - - /* FIXME: this wording sucks */ - str = g_string_new (_("You are sending an HTML-formatted message, but the following recipients " - "do not want HTML-formatted mail:\n")); - for (i = 0; recipients[i] != NULL; ++i) { - if (!e_destination_get_html_mail_pref (recipients[i])) { - const char *name; - char *buf; - - name = e_destination_get_textrep (recipients[i]); - buf = e_utf8_to_locale_string (name); - - g_string_sprintfa (str, " %s\n", buf); - g_free (buf); - } - } - - g_string_append (str, _("Send anyway?")); - - mbox = e_message_box_new (str->str, - E_MESSAGE_BOX_QUESTION, - GNOME_STOCK_BUTTON_YES, - GNOME_STOCK_BUTTON_NO, - NULL); - - g_string_free (str, TRUE); - - gtk_signal_connect (GTK_OBJECT (mbox), "destroy", - msgbox_destroyed, &show_again); - - button = gnome_dialog_run_and_close (GNOME_DIALOG (mbox)); - - if (!show_again) { - mail_config_set_confirm_unwanted_html (show_again); - g_message ("don't show HTML warning again"); - } - - if (button == 0) - return TRUE; - else - return FALSE; -} - -static gboolean -ask_confirm_for_empty_subject (EMsgComposer *composer) -{ - /* FIXME: EMessageBox should really handle this stuff - automagically. What Miguel thinks would be nice is to pass - in a unique id which could be used as a key in the config - file and the value would be an int. -1 for always show or - the button pressed otherwise. This probably means we'd have - to write e_messagebox_run () */ - gboolean show_again = TRUE; - GtkWidget *mbox; - int button; - - if (!mail_config_get_prompt_empty_subject ()) - return TRUE; - - mbox = e_message_box_new (_("This message has no subject.\nReally send?"), - E_MESSAGE_BOX_QUESTION, - GNOME_STOCK_BUTTON_YES, - GNOME_STOCK_BUTTON_NO, - NULL); - - gtk_signal_connect (GTK_OBJECT (mbox), "destroy", - msgbox_destroyed, &show_again); - - button = gnome_dialog_run_and_close (GNOME_DIALOG (mbox)); - - mail_config_set_prompt_empty_subject (show_again); - - if (button == 0) - return TRUE; - else - return FALSE; -} - -static gboolean -ask_confirm_for_only_bcc (EMsgComposer *composer, gboolean hidden_list_case) -{ - /* FIXME: EMessageBox should really handle this stuff - automagically. What Miguel thinks would be nice is to pass - in a message-id which could be used as a key in the config - file and the value would be an int. -1 for always show or - the button pressed otherwise. This probably means we'd have - to write e_messagebox_run () */ - gboolean show_again = TRUE; - GtkWidget *mbox; - int button; - const gchar *first_text; - gchar *message_text; - - if (!mail_config_get_prompt_only_bcc ()) - return TRUE; - - /* If the user is mailing a hidden contact list, it is possible for - them to create a message with only Bcc recipients without really - realizing it. To try to avoid being totally confusing, I've changed - this dialog to provide slightly different text in that case, to - better explain what the hell is going on. */ - - if (hidden_list_case) { - first_text = _("Since the contact list you are sending to " - "is configured to hide the list's addresses, " - "this message will contain only Bcc recipients."); - } else { - first_text = _("This message contains only Bcc recipients."); - } - - message_text = g_strdup_printf ("%s\n%s", first_text, - _("It is possible that the mail server may reveal the recipients " - "by adding an Apparently-To header.\nSend anyway?")); - - mbox = e_message_box_new (message_text, - E_MESSAGE_BOX_QUESTION, - GNOME_STOCK_BUTTON_YES, - GNOME_STOCK_BUTTON_NO, - NULL); - - gtk_signal_connect (GTK_OBJECT (mbox), "destroy", - msgbox_destroyed, &show_again); - - button = gnome_dialog_run_and_close (GNOME_DIALOG (mbox)); - - mail_config_set_prompt_only_bcc (show_again); - - g_free (message_text); - - if (button == 0) - return TRUE; - else - return FALSE; -} - -static void -free_psd (GtkWidget *composer, gpointer user_data) -{ - struct post_send_data *psd = user_data; - - if (psd->folder) - camel_object_unref (CAMEL_OBJECT (psd->folder)); - if (psd->uid) - g_free (psd->uid); - g_free (psd); -} - -struct _send_data { - EMsgComposer *composer; - struct post_send_data *psd; -}; - -static void -composer_sent_cb (char *uri, CamelMimeMessage *message, gboolean sent, void *data) -{ - struct _send_data *send = data; - - if (sent) { - if (send->psd) { - camel_folder_set_message_flags (send->psd->folder, send->psd->uid, - send->psd->flags, send->psd->flags); - } - gtk_widget_destroy (GTK_WIDGET (send->composer)); - } else { - e_msg_composer_set_enable_autosave(send->composer, TRUE); - gtk_widget_show (GTK_WIDGET (send->composer)); - gtk_object_unref (GTK_OBJECT (send->composer)); - } - - g_free (send); - camel_object_unref (CAMEL_OBJECT (message)); -} - -static CamelMimeMessage * -composer_get_message (EMsgComposer *composer) -{ - static char *recipient_type[] = { - CAMEL_RECIPIENT_TYPE_TO, - CAMEL_RECIPIENT_TYPE_CC, - CAMEL_RECIPIENT_TYPE_BCC - }; - const CamelInternetAddress *iaddr; - const MailConfigAccount *account; - CamelMimeMessage *message; - const char *subject; - int num_addrs, i; - EDestination **recipients; - - message = e_msg_composer_get_message (composer); - if (message == NULL) - return NULL; - - recipients = e_msg_composer_get_recipients (composer); - - /* Check for invalid recipients */ - if (recipients) { - gboolean have_invalid = FALSE; - gchar *msg, *new_msg; - GtkWidget *message_box; - - for (i = 0; recipients[i] && !have_invalid; ++i) { - if (!e_destination_is_valid (recipients[i])) - have_invalid = TRUE; - } - - if (have_invalid) { - msg = g_strdup (_("This message contains invalid recipients:")); - for (i = 0; recipients[i]; ++i) { - if (!e_destination_is_valid (recipients[i])) { - new_msg = g_strdup_printf ("%s\n %s", msg, - e_destination_get_address (recipients[i])); - g_free (msg); - msg = new_msg; - } - } - - new_msg = e_utf8_from_locale_string (msg); - g_free (msg); - msg = new_msg; - - message_box = gnome_message_box_new (msg, GNOME_MESSAGE_BOX_WARNING, GNOME_STOCK_BUTTON_OK, NULL); - g_free (msg); - - gnome_dialog_run_and_close (GNOME_DIALOG (message_box)); - - camel_object_unref (CAMEL_OBJECT (message)); - message = NULL; - goto finished; - } - } - - /* Check for recipients */ - for (num_addrs = 0, i = 0; i < 3; i++) { - iaddr = camel_mime_message_get_recipients (message, recipient_type[i]); - num_addrs += iaddr ? camel_address_length (CAMEL_ADDRESS (iaddr)) : 0; - } - - /* I'm sensing a lack of love, er, I mean recipients. */ - if (num_addrs == 0) { - GtkWidget *message_box; - - message_box = gnome_message_box_new (_("You must specify recipients in order to " - "send this message."), - GNOME_MESSAGE_BOX_WARNING, - GNOME_STOCK_BUTTON_OK, - NULL); - - gnome_dialog_run_and_close (GNOME_DIALOG (message_box)); - - camel_object_unref (CAMEL_OBJECT (message)); - message = NULL; - goto finished; - } - - if (iaddr && num_addrs == camel_address_length (CAMEL_ADDRESS (iaddr))) { - /* this means that the only recipients are Bcc's */ - - /* OK, this is an abusive hack. If someone sends a mail with a - hidden contact list on to to: line and no other recipients, - they will unknowingly create a message with only bcc: recipients. - We try to detect this and pass a flag to ask_confirm_for_only_bcc, - so that it can present the user with a dialog whose text has been - modified to reflect this situation. */ - - const gchar *to_header = camel_medium_get_header (CAMEL_MEDIUM (message), CAMEL_RECIPIENT_TYPE_TO); - gboolean hidden_list_case = FALSE; - - if (to_header && !strcmp (to_header, "Undisclosed-Recipient:;")) - hidden_list_case = TRUE; - - if (!ask_confirm_for_only_bcc (composer, hidden_list_case)) { - camel_object_unref (CAMEL_OBJECT (message)); - message = NULL; - goto finished; - } - } - - /* Only show this warning if our default is to send html. If it isn't, we've - manually switched into html mode in the composer and (presumably) had a good - reason for doing this. */ - if (e_msg_composer_get_send_html (composer) - && mail_config_get_send_html () - && mail_config_get_confirm_unwanted_html ()) { - gboolean html_problem = FALSE; - for (i = 0; recipients[i] != NULL && !html_problem; ++i) { - if (! e_destination_get_html_mail_pref (recipients[i])) - html_problem = TRUE; - } - - if (html_problem) { - html_problem = ! ask_confirm_for_unwanted_html_mail (composer, recipients); - if (html_problem) { - camel_object_unref (CAMEL_OBJECT (message)); - message = NULL; - goto finished; - } - } - } - - /* Check for no subject */ - subject = camel_mime_message_get_subject (message); - if (subject == NULL || subject[0] == '\0') { - if (!ask_confirm_for_empty_subject (composer)) { - camel_object_unref (CAMEL_OBJECT (message)); - message = NULL; - goto finished; - } - } - - /* Add info about the sending account */ - account = e_msg_composer_get_preferred_account (composer); - if (account) { - camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Account", account->name); - camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Transport", account->transport->url); - camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc", account->sent_folder_uri); - } - - /* Get the message recipients and 'touch' them, boosting their use scores */ - recipients = e_msg_composer_get_recipients (composer); - e_destination_touchv (recipients); - - finished: - e_destination_freev (recipients); - return message; -} - -void -composer_send_cb (EMsgComposer *composer, gpointer data) -{ - const MailConfigService *transport; - CamelMimeMessage *message; - struct post_send_data *psd = data; - struct _send_data *send; - - if (!mail_config_is_configured ()) { - GtkWidget *dialog; - - dialog = gnome_ok_dialog_parented (_("You must configure an account before you " - "can send this email."), - GTK_WINDOW (composer)); - gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE); - gtk_widget_show (dialog); - return; - } - - message = composer_get_message (composer); - if (!message) - return; - - transport = mail_config_get_default_transport (); - if (!transport) - return; - - send = g_malloc (sizeof (*send)); - send->psd = psd; - send->composer = composer; - gtk_object_ref (GTK_OBJECT (composer)); - gtk_widget_hide (GTK_WIDGET (composer)); - e_msg_composer_set_enable_autosave(composer, FALSE); - mail_send_mail (transport->url, message, composer_sent_cb, send); -} - -static void -append_mail_cleanup (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, int ok, void *data) -{ - camel_message_info_free (info); -} - -void -composer_postpone_cb (EMsgComposer *composer, gpointer data) -{ - extern CamelFolder *outbox_folder; - CamelMimeMessage *message; - CamelMessageInfo *info; - struct post_send_data *psd = data; - - message = composer_get_message (composer); - if (message == NULL) - return; - info = camel_message_info_new (); - info->flags = CAMEL_MESSAGE_SEEN; - - mail_append_mail (outbox_folder, message, info, append_mail_cleanup, NULL); - camel_object_unref (CAMEL_OBJECT (message)); - - if (psd) - camel_folder_set_message_flags (psd->folder, psd->uid, psd->flags, psd->flags); - - gtk_widget_destroy (GTK_WIDGET (composer)); -} - -static GtkWidget * -create_msg_composer (const char *url) -{ - const MailConfigAccount *account; - gboolean send_html; - EMsgComposer *composer; - - account = mail_config_get_default_account (); - send_html = mail_config_get_send_html (); - - composer = url ? e_msg_composer_new_from_url (url) : e_msg_composer_new (); - - if (composer) { - e_msg_composer_hdrs_set_from_account (E_MSG_COMPOSER_HDRS (composer->hdrs), account->name); - e_msg_composer_set_send_html (composer, send_html); - e_msg_composer_show_sig_file (composer); - return GTK_WIDGET (composer); - } else - return NULL; -} - -void -compose_msg (GtkWidget *widget, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - GtkWidget *composer; - - if (FOLDER_BROWSER_IS_DESTROYED (fb) || !check_send_configuration (fb)) - return; - - composer = create_msg_composer (NULL); - if (!composer) - return; - - gtk_signal_connect (GTK_OBJECT (composer), "send", - GTK_SIGNAL_FUNC (composer_send_cb), NULL); - gtk_signal_connect (GTK_OBJECT (composer), "postpone", - GTK_SIGNAL_FUNC (composer_postpone_cb), NULL); - - gtk_widget_show (composer); -} - -/* Send according to a mailto (RFC 2368) URL. */ -void -send_to_url (const char *url) -{ - GtkWidget *composer; - - /* FIXME: no way to get folder browser? Not without - * big pain in the ass, as far as I can tell */ - if (!check_send_configuration (NULL)) - return; - - composer = create_msg_composer (url); - if (!composer) - return; - - gtk_signal_connect (GTK_OBJECT (composer), "send", - GTK_SIGNAL_FUNC (composer_send_cb), NULL); - gtk_signal_connect (GTK_OBJECT (composer), "postpone", - GTK_SIGNAL_FUNC (composer_postpone_cb), NULL); - - gtk_widget_show (composer); -} - -static GList * -list_add_addresses (GList *list, const CamelInternetAddress *cia, const GSList *accounts, - GHashTable *rcpt_hash, const MailConfigAccount **me, - const char *ignore_addr) -{ - const char *name, *addr; - const GSList *l; - gboolean notme; - int i; - - for (i = 0; camel_internet_address_get (cia, i, &name, &addr); i++) { - /* Make sure we don't want to ignore this address */ - if (!ignore_addr || g_strcasecmp (ignore_addr, addr)) { - - /* Here I'll check to see if the cc:'d address is the address - of the sender, and if so, don't add it to the cc: list; this - is to fix Bugzilla bug #455. */ - notme = TRUE; - l = accounts; - while (l) { - const MailConfigAccount *acnt = l->data; - - if (!g_strcasecmp (acnt->id->address, addr)) { - notme = FALSE; - if (me && !*me) - *me = acnt; - break; - } - - l = l->next; - } - - if (notme && !g_hash_table_lookup (rcpt_hash, addr)) { - EDestination *dest; - - dest = e_destination_new (); - e_destination_set_name (dest, name); - e_destination_set_email (dest, addr); - - list = g_list_append (list, dest); - g_hash_table_insert (rcpt_hash, (char *) addr, GINT_TO_POINTER (1)); - } - } - } - - return list; -} - -static const MailConfigAccount * -guess_me (const CamelInternetAddress *to, const CamelInternetAddress *cc, const GSList *accounts) -{ - const char *name, *addr; - const GSList *l; - gboolean notme; - char *full; - int i; - - if (to) { - for (i = 0; camel_internet_address_get (to, i, &name, &addr); i++) { - full = camel_internet_address_format_address (name, addr); - l = accounts; - while (l) { - const MailConfigAccount *acnt = l->data; - - if (!g_strcasecmp (acnt->id->address, addr)) { - notme = FALSE; - return acnt; - } - - l = l->next; - } - } - } - - if (cc) { - for (i = 0; camel_internet_address_get (cc, i, &name, &addr); i++) { - full = camel_internet_address_format_address (name, addr); - l = accounts; - while (l) { - const MailConfigAccount *acnt = l->data; - - if (!g_strcasecmp (acnt->id->address, addr)) { - notme = FALSE; - return acnt; - } - - l = l->next; - } - } - } - - return NULL; -} - -static EMsgComposer * -mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char *uid, int mode) -{ - const CamelInternetAddress *reply_to, *sender, *to_addrs, *cc_addrs; - const char *name = NULL, *address = NULL, *source = NULL; - const char *message_id, *references, *reply_addr = NULL; - char *text, *subject, date_str[100], *format; - const MailConfigAccount *me = NULL; - const GSList *accounts = NULL; - GList *to = NULL, *cc = NULL; - EDestination **tov, **ccv; - EMsgComposer *composer; - time_t date; - const int max_subject_length = 1024; - - composer = e_msg_composer_new (); - e_msg_composer_add_message_attachments (composer, message, TRUE); - - if (!composer) - return NULL; - - sender = camel_mime_message_get_from (message); - if (sender != NULL && camel_address_length (CAMEL_ADDRESS (sender)) > 0) { - camel_internet_address_get (sender, 0, &name, &address); - } else { - name = _("an unknown sender"); - } - - date = camel_mime_message_get_date (message, NULL); - - strftime (date_str, sizeof (date_str), _("On %a, %Y-%m-%d at %H:%M, %%s wrote:"), - localtime (&date)); - format = e_utf8_from_locale_string (date_str); - text = mail_tool_quote_message (message, format, name && *name ? name : address); - g_free (format); - - if (text) { - e_msg_composer_set_body_text (composer, text); - g_free (text); - } - - /* Set the recipients */ - accounts = mail_config_get_accounts (); - - to_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO); - cc_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC); - - if (mode == REPLY_LIST) { - CamelMessageInfo *info; - const char *mlist; - int i, max, len; - - info = camel_folder_get_message_info (folder, uid); - mlist = camel_message_info_mlist (info); - - if (mlist) { - /* look through the recipients to find the *real* mailing list address */ - len = strlen (mlist); - - to_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO); - max = camel_address_length (CAMEL_ADDRESS (to_addrs)); - for (i = 0; i < max; i++) { - camel_internet_address_get (to_addrs, i, &name, &address); - if (!g_strncasecmp (address, mlist, len)) - break; - } - - if (i == max) { - cc_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC); - max = camel_address_length (CAMEL_ADDRESS (cc_addrs)); - for (i = 0; i < max; i++) { - camel_internet_address_get (cc_addrs, i, &name, &address); - if (!g_strncasecmp (address, mlist, len)) - break; - } - } - - if (address && i != max) { - EDestination *dest; - - dest = e_destination_new (); - e_destination_set_name (dest, name); - e_destination_set_email (dest, address); - - to = g_list_append (to, dest); - } - } - - me = guess_me (to_addrs, cc_addrs, accounts); - } else { - GHashTable *rcpt_hash; - - rcpt_hash = g_hash_table_new (g_str_hash, g_str_equal); - - reply_to = camel_mime_message_get_reply_to (message); - if (!reply_to) - reply_to = camel_mime_message_get_from (message); - if (reply_to) { - /* Get the Reply-To address so we can ignore references to it in the Cc: list */ - if (camel_internet_address_get (reply_to, 0, &name, &reply_addr)) { - EDestination *dest; - - dest = e_destination_new (); - e_destination_set_name (dest, name); - e_destination_set_email (dest, reply_addr); - to = g_list_append (to, dest); - g_hash_table_insert (rcpt_hash, (char *) reply_addr, GINT_TO_POINTER (1)); - } - } - - if (mode == REPLY_ALL) { - cc = list_add_addresses (cc, to_addrs, accounts, rcpt_hash, &me, NULL); - cc = list_add_addresses (cc, cc_addrs, accounts, rcpt_hash, me ? NULL : &me, reply_addr); - } else { - me = guess_me (to_addrs, cc_addrs, accounts); - } - - g_hash_table_destroy (rcpt_hash); - } - - if (me == NULL) { - /* as a last resort, set the replying account (aka me) - to the account this was fetched from */ - source = camel_mime_message_get_source (message); - me = mail_config_get_account_by_source_url (source); - } - - /* Set the subject of the new message. */ - subject = (char *)camel_mime_message_get_subject (message); - if (!subject) - subject = g_strdup (""); - else { - if (!g_strncasecmp (subject, "Re: ", 4)) - subject = g_strndup (subject, max_subject_length); - else { - if (strlen (subject) < max_subject_length) { - subject = g_strdup_printf ("Re: %s", subject); - } else { - /* We can't use %.*s because it depends on the locale being C/POSIX - or UTF-8 to work correctly in glibc */ - char *sub; - - /*subject = g_strdup_printf ("Re: %.*s...", max_subject_length, subject);*/ - sub = g_malloc (max_subject_length + 8); - memcpy (sub, "Re: ", 4); - memcpy (sub + 4, subject, max_subject_length); - memcpy (sub + 4 + max_subject_length, "...", 4); - subject = sub; - } - } - } - - tov = e_destination_list_to_vector (to); - ccv = e_destination_list_to_vector (cc); - - g_list_free (to); - g_list_free (cc); - - e_msg_composer_set_headers (composer, me ? me->name : NULL, tov, ccv, NULL, subject); - - e_destination_freev (tov); - e_destination_freev (ccv); - - g_free (subject); - - /* Add In-Reply-To and References. */ - message_id = camel_medium_get_header (CAMEL_MEDIUM (message), "Message-Id"); - references = camel_medium_get_header (CAMEL_MEDIUM (message), "References"); - if (message_id) { - char *reply_refs; - - e_msg_composer_add_header (composer, "In-Reply-To", message_id); - - if (references) - reply_refs = g_strdup_printf ("%s %s", references, message_id); - else - reply_refs = g_strdup (message_id); - - e_msg_composer_add_header (composer, "References", reply_refs); - g_free (reply_refs); - } else if (references) { - e_msg_composer_add_header (composer, "References", references); - } - - return composer; -} - -static void -requeue_mail_reply (CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *data) -{ - int mode = GPOINTER_TO_INT (data); - - mail_reply (folder, msg, uid, mode); -} - -void -mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const char *uid, int mode) -{ - EMsgComposer *composer; - struct post_send_data *psd; - - g_return_if_fail (folder != NULL); - g_return_if_fail (uid != NULL); - - if (!msg) { - mail_get_message (folder, uid, requeue_mail_reply, - GINT_TO_POINTER (mode), mail_thread_new); - return; - } - - psd = g_new (struct post_send_data, 1); - psd->folder = folder; - camel_object_ref (CAMEL_OBJECT (psd->folder)); - psd->uid = g_strdup (uid); - psd->flags = CAMEL_MESSAGE_ANSWERED; - - composer = mail_generate_reply (folder, msg, uid, mode); - if (!composer) - return; - - gtk_signal_connect (GTK_OBJECT (composer), "send", - GTK_SIGNAL_FUNC (composer_send_cb), psd); - gtk_signal_connect (GTK_OBJECT (composer), "postpone", - GTK_SIGNAL_FUNC (composer_postpone_cb), psd); - gtk_signal_connect (GTK_OBJECT (composer), "destroy", - GTK_SIGNAL_FUNC (free_psd), psd); - - gtk_widget_show (GTK_WIDGET (composer)); - e_msg_composer_unset_changed (composer); -} - -void -reply_to_sender (GtkWidget *widget, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - - /* FIXME: make this always load the message based on cursor */ - - if (FOLDER_BROWSER_IS_DESTROYED (fb) || !check_send_configuration (fb)) - return; - - mail_reply (fb->folder, fb->mail_display->current_message, - fb->message_list->cursor_uid, REPLY_SENDER); -} - -void -reply_to_list (GtkWidget *widget, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - - if (FOLDER_BROWSER_IS_DESTROYED (fb) || !check_send_configuration (fb)) - return; - - /* FIXME: make this always load the message based on cursor */ - - mail_reply (fb->folder, fb->mail_display->current_message, - fb->message_list->cursor_uid, REPLY_LIST); -} - -void -reply_to_all (GtkWidget *widget, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - - if (FOLDER_BROWSER_IS_DESTROYED (fb) || !check_send_configuration (fb)) - return; - - /* FIXME: make this always load the message based on cursor */ - - mail_reply (fb->folder, fb->mail_display->current_message, - fb->message_list->cursor_uid, REPLY_ALL); -} - -void -enumerate_msg (MessageList *ml, const char *uid, gpointer data) -{ - g_return_if_fail (ml != NULL); - - g_ptr_array_add ((GPtrArray *) data, g_strdup (uid)); -} - - -static EMsgComposer * -forward_get_composer (CamelMimeMessage *message, const char *subject) -{ - const MailConfigAccount *account = NULL; - EMsgComposer *composer; - - if (message) { - const CamelInternetAddress *to_addrs, *cc_addrs; - const GSList *accounts = NULL; - - accounts = mail_config_get_accounts (); - to_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO); - cc_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC); - - account = guess_me (to_addrs, cc_addrs, accounts); - - if (!account) { - const char *source; - - source = camel_mime_message_get_source (message); - account = mail_config_get_account_by_source_url (source); - } - } - - if (!account) - account = mail_config_get_default_account (); - - composer = e_msg_composer_new (); - if (composer) { - gtk_signal_connect (GTK_OBJECT (composer), "send", - GTK_SIGNAL_FUNC (composer_send_cb), NULL); - gtk_signal_connect (GTK_OBJECT (composer), "postpone", - GTK_SIGNAL_FUNC (composer_postpone_cb), NULL); - e_msg_composer_set_headers (composer, account->name, NULL, NULL, NULL, subject); - } else { - g_warning ("Could not create composer"); - } - - return composer; -} - -static void -do_forward_non_attached (CamelFolder *folder, char *uid, CamelMimeMessage *message, void *data) -{ - MailConfigForwardStyle style = GPOINTER_TO_INT (data); - char *subject, *text; - - if (!message) - return; - - subject = mail_tool_generate_forward_subject (message); - text = mail_tool_forward_message (message, style == MAIL_CONFIG_FORWARD_QUOTED); - - if (text) { - EMsgComposer *composer = forward_get_composer (message, subject); - if (composer) { - CamelDataWrapper *wrapper; - - e_msg_composer_set_body_text (composer, text); - - wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (message)); - if (CAMEL_IS_MULTIPART (wrapper)) - e_msg_composer_add_message_attachments (composer, message, FALSE); - - gtk_widget_show (GTK_WIDGET (composer)); - e_msg_composer_unset_changed (composer); - } - g_free (text); - } - - g_free (subject); -} - -static void -forward_message (FolderBrowser *fb, MailConfigForwardStyle style) -{ - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - if (!check_send_configuration (fb)) - return; - - if (fb->mail_display && fb->mail_display->current_message) { - do_forward_non_attached (fb->folder, NULL, - fb->mail_display->current_message, - GINT_TO_POINTER (style)); - } else { - mail_get_message (fb->folder, fb->message_list->cursor_uid, - do_forward_non_attached, GINT_TO_POINTER (style), - mail_thread_new); - } -} - -void -forward_inline (GtkWidget *widget, gpointer user_data) -{ - forward_message (user_data, MAIL_CONFIG_FORWARD_INLINE); -} - -void -forward_quoted (GtkWidget *widget, gpointer user_data) -{ - forward_message (user_data, MAIL_CONFIG_FORWARD_QUOTED); -} - -static void -do_forward_attach (CamelFolder *folder, GPtrArray *messages, CamelMimePart *part, char *subject, void *data) -{ - CamelMimeMessage *message = data; - - if (part) { - EMsgComposer *composer = forward_get_composer (message, subject); - if (composer) { - e_msg_composer_attach (composer, part); - gtk_widget_show (GTK_WIDGET (composer)); - e_msg_composer_unset_changed (composer); - } - } -} - -void -forward_attached (GtkWidget *widget, gpointer user_data) -{ - FolderBrowser *fb = (FolderBrowser *) user_data; - GPtrArray *uids; - - if (FOLDER_BROWSER_IS_DESTROYED (fb) || !check_send_configuration (fb)) - return; - - uids = g_ptr_array_new (); - message_list_foreach (fb->message_list, enumerate_msg, uids); - mail_build_attachment (fb->folder, uids, do_forward_attach, - uids->len == 1 ? fb->mail_display->current_message : NULL); -} - -void -forward (GtkWidget *widget, gpointer user_data) -{ - MailConfigForwardStyle style = mail_config_get_default_forward_style (); - - if (style == MAIL_CONFIG_FORWARD_ATTACHED) - forward_attached (widget, user_data); - else - forward_message (user_data, style); -} - -static void -transfer_msg_done (gboolean ok, void *data) -{ - FolderBrowser *fb = data; - int row; - - if (ok && !FOLDER_BROWSER_IS_DESTROYED (fb)) { - row = e_tree_row_of_node (fb->message_list->tree, - e_tree_get_cursor (fb->message_list->tree)); - - /* If this is the last message and deleted messages - are hidden, select the previous */ - if ((row + 1 == e_tree_row_count (fb->message_list->tree)) - && mail_config_get_hide_deleted ()) - message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_PREVIOUS, - 0, CAMEL_MESSAGE_DELETED, FALSE); - else - message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_NEXT, - 0, 0, FALSE); - } - - gtk_object_unref (GTK_OBJECT (fb)); -} - -static void -transfer_msg (FolderBrowser *fb, gboolean delete_from_source) -{ - const char *allowed_types[] = { "mail", "vtrash", NULL }; - extern EvolutionShellClient *global_shell_client; - char *uri, *physical, *path, *desc; - static char *last = NULL; - GPtrArray *uids; - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - if (last == NULL) - last = g_strdup (""); - - if (delete_from_source) - desc = _("Move message(s) to"); - else - desc = _("Copy message(s) to"); - - uri = NULL; - physical = NULL; - evolution_shell_client_user_select_folder (global_shell_client, - GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (fb))), - desc, last, - allowed_types, &uri, &physical); - if (!uri) - return; - - path = strchr (uri, '/'); - if (path && strcmp (last, path) != 0) { - g_free (last); - last = g_strdup_printf ("evolution:%s", path); - } - g_free (uri); - - uids = g_ptr_array_new (); - message_list_foreach (fb->message_list, enumerate_msg, uids); - - if (delete_from_source) { - gtk_object_ref (GTK_OBJECT (fb)); - mail_transfer_messages (fb->folder, uids, delete_from_source, - physical, 0, transfer_msg_done, fb); - } else { - mail_transfer_messages (fb->folder, uids, delete_from_source, - physical, 0, NULL, NULL); - } - g_free(physical); -} - -void -move_msg_cb (GtkWidget *widget, gpointer user_data) -{ - transfer_msg (user_data, TRUE); -} - -void -move_msg (BonoboUIComponent *uih, void *user_data, const char *path) -{ - transfer_msg (user_data, TRUE); -} - -void -copy_msg_cb (GtkWidget *widget, gpointer user_data) -{ - transfer_msg (user_data, FALSE); -} - -void -copy_msg (BonoboUIComponent *uih, void *user_data, const char *path) -{ - transfer_msg (user_data, FALSE); -} - -/* Copied from e-shell-view.c */ -static GtkWidget * -find_socket (GtkContainer *container) -{ - GList *children, *tmp; - - children = gtk_container_children (container); - while (children) { - if (BONOBO_IS_SOCKET (children->data)) - return children->data; - else if (GTK_IS_CONTAINER (children->data)) { - GtkWidget *socket = find_socket (children->data); - if (socket) - return socket; - } - tmp = children->next; - g_list_free_1 (children); - children = tmp; - } - return NULL; -} - -static void -popup_listener_cb (BonoboListener *listener, - char *event_name, - CORBA_any *any, - CORBA_Environment *ev, - gpointer user_data) -{ - char *type = bonobo_event_subtype (event_name); - - if (!strcmp (type, "Destroy")) { - gtk_widget_destroy (GTK_WIDGET (user_data)); - } - - g_free (type); -} - -void -addrbook_sender (GtkWidget *widget, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - CamelMimeMessage *msg = NULL; - const CamelInternetAddress *addr; - gchar *addr_str; - GtkWidget *win; - GtkWidget *control; - GtkWidget *socket; - - /* FIXME: make this use the cursor message id */ - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - msg = fb->mail_display->current_message; - if (msg == NULL) - return; - - addr = camel_mime_message_get_from (msg); - if (addr == NULL) - return; - - addr_str = camel_address_format (CAMEL_ADDRESS (addr)); - - win = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title (GTK_WINDOW (win), _("Sender")); - - control = bonobo_widget_new_control ("OAFIID:GNOME_Evolution_Addressbook_AddressPopup", - CORBA_OBJECT_NIL); - bonobo_widget_set_property (BONOBO_WIDGET (control), - "email", addr_str, - NULL); - - bonobo_event_source_client_add_listener (bonobo_widget_get_objref (BONOBO_WIDGET (control)), - popup_listener_cb, NULL, NULL, win); - - socket = find_socket (GTK_CONTAINER (control)); - gtk_signal_connect_object (GTK_OBJECT (socket), - "destroy", - GTK_SIGNAL_FUNC (gtk_widget_destroy), - GTK_OBJECT (win)); - - gtk_container_add (GTK_CONTAINER (win), control); - gtk_widget_show_all (win); -} - -void -apply_filters (GtkWidget *widget, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - GPtrArray *uids; - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - uids = g_ptr_array_new (); - message_list_foreach (fb->message_list, enumerate_msg, uids); - - mail_filter_on_demand (fb->folder, uids); -} - -void -select_all (BonoboUIComponent *uih, void *user_data, const char *path) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - ESelectionModel *etsm; - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - etsm = e_tree_get_selection_model (fb->message_list->tree); - - e_selection_model_select_all (etsm); -} - -/* Thread selection */ - -typedef struct thread_select_info { - MessageList *ml; - GPtrArray *paths; -} thread_select_info_t; - -static gboolean -select_node (ETreeModel *tm, ETreePath path, gpointer user_data) -{ - thread_select_info_t *tsi = (thread_select_info_t *) user_data; - - g_ptr_array_add (tsi->paths, path); - return FALSE; /*not done yet*/ -} - -static void -thread_select_foreach (ETreePath path, gpointer user_data) -{ - thread_select_info_t *tsi = (thread_select_info_t *) user_data; - ETreeModel *tm = tsi->ml->model; - ETreePath node; - - /* @path part of the initial selection. If it has children, - * we select them as well. If it doesn't, we select its siblings and - * their children (ie, the current node must be inside the thread - * that the user wants to mark. - */ - - if (e_tree_model_node_get_first_child (tm, path)) - node = path; - else { - node = e_tree_model_node_get_parent (tm, path); - - /* Let's make an exception: if no parent, then we're about - * to mark the whole tree. No. */ - if (e_tree_model_node_is_root (tm, node)) - node = path; - } - - e_tree_model_node_traverse (tm, node, select_node, tsi); -} - -void -select_thread (BonoboUIComponent *uih, void *user_data, const char *path) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - ETreeSelectionModel *selection_model; - thread_select_info_t tsi; - int i; - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - /* For every selected item, select the thread containing it. - * We can't alter the selection while iterating through it, - * so build up a list of paths. - */ - - tsi.ml = fb->message_list; - tsi.paths = g_ptr_array_new (); - - e_tree_selected_path_foreach (fb->message_list->tree, thread_select_foreach, &tsi); - - selection_model = E_TREE_SELECTION_MODEL (e_tree_get_selection_model (fb->message_list->tree)); - - for (i = 0; i < tsi.paths->len; i++) - e_tree_selection_model_add_to_selection (selection_model, - tsi.paths->pdata[i]); - g_ptr_array_free (tsi.paths, TRUE); -} - -void -invert_selection (BonoboUIComponent *uih, void *user_data, const char *path) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - ESelectionModel *etsm; - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - etsm = e_tree_get_selection_model (fb->message_list->tree); - - e_selection_model_invert_selection (etsm); -} - -/* flag all selected messages. Return number flagged */ -static int -flag_messages (FolderBrowser *fb, guint32 mask, guint32 set) -{ - GPtrArray *uids; - int i; - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return 0; - - /* could just use specific callback but i'm lazy */ - uids = g_ptr_array_new (); - message_list_foreach (fb->message_list, enumerate_msg, uids); - camel_folder_freeze (fb->folder); - for (i = 0; i < uids->len; i++) { - camel_folder_set_message_flags (fb->folder, uids->pdata[i], mask, set); - g_free (uids->pdata[i]); - } - camel_folder_thaw (fb->folder); - - g_ptr_array_free (uids, TRUE); - - return i; -} - -static int -toggle_flags (FolderBrowser *fb, guint32 mask) -{ - GPtrArray *uids; - int i; - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return 0; - - /* could just use specific callback but i'm lazy */ - uids = g_ptr_array_new (); - message_list_foreach (fb->message_list, enumerate_msg, uids); - camel_folder_freeze (fb->folder); - for (i = 0; i < uids->len; i++) { - int flags; - - flags = camel_folder_get_message_flags (fb->folder, uids->pdata[i]); - - if (flags & mask) - camel_folder_set_message_flags (fb->folder, uids->pdata[i], mask, 0); - else { - if ((mask & CAMEL_MESSAGE_FLAGGED) && (flags & CAMEL_MESSAGE_DELETED)) - camel_folder_set_message_flags (fb->folder, uids->pdata[i], CAMEL_MESSAGE_DELETED, 0); - camel_folder_set_message_flags (fb->folder, uids->pdata[i], mask, mask); - } - - g_free (uids->pdata[i]); - } - camel_folder_thaw (fb->folder); - - g_ptr_array_free (uids, TRUE); - - return i; -} - -void -mark_as_seen (BonoboUIComponent *uih, void *user_data, const char *path) -{ - flag_messages (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN); -} - -void -mark_as_unseen (BonoboUIComponent *uih, void *user_data, const char *path) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - /* Remove the automatic mark-as-read timer first */ - if (fb->seen_id) { - gtk_timeout_remove (fb->seen_id); - fb->seen_id = 0; - } - - flag_messages (fb, CAMEL_MESSAGE_SEEN, 0); -} - -void -mark_all_as_seen (BonoboUIComponent *uih, void *user_data, const char *path) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - GPtrArray *uids; - int i; - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - uids = camel_folder_get_uids (fb->folder); - camel_folder_freeze (fb->folder); - for (i = 0; i < uids->len; i++) - camel_folder_set_message_flags (fb->folder, uids->pdata[i], CAMEL_MESSAGE_SEEN, ~0); - camel_folder_thaw (fb->folder); - g_ptr_array_free (uids, TRUE); -} - -void -mark_as_important (BonoboUIComponent *uih, void *user_data, const char *path) -{ - flag_messages (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_DELETED, 0); - flag_messages (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_FLAGGED, CAMEL_MESSAGE_FLAGGED); -} - -void -mark_as_unimportant (BonoboUIComponent *uih, void *user_data, const char *path) -{ - flag_messages (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_FLAGGED, 0); -} - -void -toggle_as_important (BonoboUIComponent *uih, void *user_data, const char *path) -{ - toggle_flags (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_FLAGGED); -} - -void -zoom_in (BonoboUIComponent *uih, void *user_data, const char *path) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - gtk_html_zoom_in (fb->mail_display->html); -} - -void -zoom_out (BonoboUIComponent *uih, void *user_data, const char *path) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - gtk_html_zoom_out (fb->mail_display->html); -} - -void -zoom_reset (BonoboUIComponent *uih, void *user_data, const char *path) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - gtk_html_zoom_reset (fb->mail_display->html); -} - -static void -do_edit_messages (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, void *data) -{ - /*FolderBrowser *fb = data;*/ - int i; - - if (messages == NULL) - return; - - for (i = 0; i < messages->len; i++) { - EMsgComposer *composer; - XEvolution *hdrs; - - hdrs = mail_tool_remove_xevolution_headers (messages->pdata[i]); - mail_tool_destroy_xevolution (hdrs); - camel_medium_remove_header (CAMEL_MEDIUM (messages->pdata[i]), "X-Mailer"); - - composer = e_msg_composer_new_with_message (messages->pdata[i]); - - if (composer) { - gtk_signal_connect (GTK_OBJECT (composer), "send", - composer_send_cb, NULL); - gtk_signal_connect (GTK_OBJECT (composer), "postpone", - composer_postpone_cb, NULL); - - gtk_widget_show (GTK_WIDGET (composer)); - } - } -} - -static gboolean -are_you_sure (const char *msg, GPtrArray *uids, FolderBrowser *fb) -{ - GtkWidget *dialog; - char *buf; - int button, i; - - buf = g_strdup_printf (msg, uids->len); - dialog = e_gnome_ok_cancel_dialog_parented (buf, NULL, NULL, FB_WINDOW (fb)); - button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); - if (button != 0) { - for (i = 0; i < uids->len; i++) - g_free (uids->pdata[i]); - g_ptr_array_free (uids, TRUE); - } - - return button == 0; -} - -static void -edit_msg_internal (FolderBrowser *fb) -{ - GPtrArray *uids; - - if (!check_send_configuration (fb)) - return; - - uids = g_ptr_array_new (); - message_list_foreach (fb->message_list, enumerate_msg, uids); - - if (uids->len > 10 && !are_you_sure (_("Are you sure you want to edit all %d messages?"), uids, fb)) { - int i; - - for (i = 0; i < uids->len; i++) - g_free (uids->pdata[i]); - - g_ptr_array_free (uids, TRUE); - - return; - } - - mail_get_messages (fb->folder, uids, do_edit_messages, fb); -} - -void -edit_msg (GtkWidget *widget, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - if (!folder_browser_is_drafts (fb)) { - GtkWidget *dialog; - - dialog = gnome_warning_dialog_parented (_("You may only edit messages saved\n" - "in the Drafts folder."), - FB_WINDOW (fb)); - gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE); - gtk_widget_show (dialog); - return; - } - - edit_msg_internal (fb); -} - -static void -do_resend_messages (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, void *data) -{ - int i; - - for (i = 0; i < messages->len; i++) { - /* generate a new Message-Id because they need to be unique */ - camel_mime_message_set_message_id (messages->pdata[i], NULL); - } - - /* "Resend" should open up the composer to let the user edit the message */ - do_edit_messages (folder, uids, messages, data); -} - - - -void -resend_msg (GtkWidget *widget, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - GPtrArray *uids; - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - if (!folder_browser_is_sent (fb)) { - GtkWidget *dialog; - - dialog = gnome_warning_dialog_parented (_("You may only resend messages\n" - "in the Sent folder."), - FB_WINDOW (fb)); - gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE); - gtk_widget_show (dialog); - return; - } - - if (!check_send_configuration (fb)) - return; - - uids = g_ptr_array_new (); - message_list_foreach (fb->message_list, enumerate_msg, uids); - - if (uids->len > 10 && !are_you_sure (_("Are you sure you want to resend all %d messages?"), uids, fb)) { - int i; - - for (i = 0; i < uids->len; i++) - g_free (uids->pdata[i]); - - g_ptr_array_free (uids, TRUE); - - return; - } - - mail_get_messages (fb->folder, uids, do_resend_messages, fb); -} - -void -search_msg (GtkWidget *widget, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - GtkWidget *w; - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - if (fb->mail_display->current_message == NULL) { - GtkWidget *dialog; - - dialog = gnome_warning_dialog_parented (_("No Message Selected"), FB_WINDOW (fb)); - gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE); - gtk_widget_show (dialog); - return; - } - - w = mail_search_new (fb->mail_display); - gtk_widget_show_all (w); -} - -void -load_images (GtkWidget *widget, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - mail_display_load_images (fb->mail_display); -} - -static void -save_msg_ok (GtkWidget *widget, gpointer user_data) -{ - CamelFolder *folder; - GPtrArray *uids; - const char *path; - int fd, ret = 0; - struct stat st; - - path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (user_data)); - if (path[0] == '\0') - return; - - /* make sure we can actually save to it... */ - if (stat (path, &st) != -1 && !S_ISREG (st.st_mode)) - return; - - fd = open (path, O_RDONLY); - if (fd != -1) { - GtkWidget *dialog; - GtkWidget *text; - - close (fd); - - dialog = gnome_dialog_new (_("Overwrite file?"), - GNOME_STOCK_BUTTON_YES, - GNOME_STOCK_BUTTON_NO, - NULL); - - e_gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (user_data)); - - text = gtk_label_new (_("A file by that name already exists.\nOverwrite it?")); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), text, TRUE, TRUE, 4); - gtk_window_set_policy (GTK_WINDOW (dialog), FALSE, TRUE, FALSE); - gtk_widget_show (text); - - ret = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); - } - - if (ret == 0) { - folder = gtk_object_get_data (GTK_OBJECT (user_data), "folder"); - uids = gtk_object_get_data (GTK_OBJECT (user_data), "uids"); - gtk_object_remove_no_notify (GTK_OBJECT (user_data), "uids"); - mail_save_messages (folder, uids, path, NULL, NULL); - gtk_widget_destroy (GTK_WIDGET (user_data)); - } -} - -static void -save_msg_destroy (gpointer user_data) -{ - GPtrArray *uids = user_data; - - if (uids) { - int i; - - for (i = 0; i < uids->len; i++) - g_free (uids->pdata[i]); - - g_ptr_array_free (uids, TRUE); - } -} - -void -save_msg (GtkWidget *widget, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - GtkFileSelection *filesel; - GPtrArray *uids; - char *title, *path; - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - uids = g_ptr_array_new (); - message_list_foreach (fb->message_list, enumerate_msg, uids); - - if (uids->len == 1) - title = _("Save Message As..."); - else - title = _("Save Messages As..."); - - filesel = GTK_FILE_SELECTION (gtk_file_selection_new (title)); - path = g_strdup_printf ("%s/", g_get_home_dir ()); - gtk_file_selection_set_filename (filesel, path); - g_free (path); - gtk_object_set_data_full (GTK_OBJECT (filesel), "uids", uids, save_msg_destroy); - gtk_object_set_data (GTK_OBJECT (filesel), "folder", fb->folder); - gtk_signal_connect (GTK_OBJECT (filesel->ok_button), - "clicked", GTK_SIGNAL_FUNC (save_msg_ok), filesel); - gtk_signal_connect_object (GTK_OBJECT (filesel->cancel_button), - "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), - GTK_OBJECT (filesel)); - - gtk_widget_show (GTK_WIDGET (filesel)); -} - -void -delete_msg (GtkWidget *button, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - int deleted, row; - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - deleted = flag_messages (fb, CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN, - CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN); - - /* Select the next message if we are only deleting one message */ - if (deleted == 1) { - row = e_tree_row_of_node (fb->message_list->tree, - e_tree_get_cursor (fb->message_list->tree)); - - /* If this is the last message and deleted messages - are hidden, select the previous */ - if ((row+1 == e_tree_row_count (fb->message_list->tree)) - && mail_config_get_hide_deleted ()) - message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_PREVIOUS, - 0, CAMEL_MESSAGE_DELETED, FALSE); - else - message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_NEXT, - 0, 0, FALSE); - } -} - -void -undelete_msg (GtkWidget *button, gpointer user_data) -{ - flag_messages (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_DELETED, 0); -} - -void -next_msg (GtkWidget *button, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - int row; - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree)); - message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_NEXT, 0, 0, FALSE); -} - -void -next_unread_msg (GtkWidget *button, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - int row; - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree)); - message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_NEXT, - 0, CAMEL_MESSAGE_SEEN, TRUE); -} - -void -next_flagged_msg (GtkWidget *button, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - int row; - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree)); - message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_NEXT, - CAMEL_MESSAGE_FLAGGED, CAMEL_MESSAGE_FLAGGED, FALSE); -} - -void -previous_msg (GtkWidget *button, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - int row; - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree)); - message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_PREVIOUS, - 0, 0, FALSE); -} - -void -previous_unread_msg (GtkWidget *button, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - int row; - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree)); - message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_PREVIOUS, - 0, CAMEL_MESSAGE_SEEN, TRUE); -} - -void -previous_flagged_msg (GtkWidget *button, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - int row; - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree)); - message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_PREVIOUS, - CAMEL_MESSAGE_FLAGGED, CAMEL_MESSAGE_FLAGGED, TRUE); -} - -struct _expunged_folder_data { - FolderBrowser *fb; - gboolean hidedeleted; -}; - -static void -expunged_folder (CamelFolder *f, void *data) -{ - FolderBrowser *fb = ((struct _expunged_folder_data *) data)->fb; - gboolean hidedeleted = ((struct _expunged_folder_data *) data)->hidedeleted; - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - fb->expunging = NULL; - message_list_set_hidedeleted (fb->message_list, hidedeleted); - - g_free (data); -} - -static gboolean -confirm_expunge (FolderBrowser *fb) -{ - GtkWidget *dialog, *label, *checkbox; - int button; - - if (!mail_config_get_confirm_expunge ()) - return TRUE; - - dialog = gnome_dialog_new (_("Warning"), - GNOME_STOCK_BUTTON_YES, - GNOME_STOCK_BUTTON_NO, - NULL); - - e_gnome_dialog_set_parent (GNOME_DIALOG (dialog), FB_WINDOW (fb)); - - label = gtk_label_new (_("This operation will permanently erase all messages marked as deleted. If you continue, you will not be able to recover these messages.\n\nReally erase these messages?")); - - gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); - gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label, TRUE, TRUE, 4); - - checkbox = gtk_check_button_new_with_label (_("Do not ask me again.")); - gtk_object_ref (GTK_OBJECT (checkbox)); - gtk_widget_show (checkbox); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), checkbox, TRUE, TRUE, 4); - - button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); - - if (button == 0 && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox))) - mail_config_set_confirm_expunge (FALSE); - - gtk_object_unref (GTK_OBJECT (checkbox)); - - if (button == 0) - return TRUE; - else - return FALSE; -} - -void -expunge_folder (BonoboUIComponent *uih, void *user_data, const char *path) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - if (fb->folder && (fb->expunging == NULL || fb->folder != fb->expunging) && confirm_expunge (fb)) { - struct _expunged_folder_data *data; - CamelMessageInfo *info; - - data = g_malloc (sizeof (*data)); - data->fb = fb; - data->hidedeleted = fb->message_list->hidedeleted; - - /* hide the deleted messages so user can't click on them while we expunge */ - message_list_set_hidedeleted (fb->message_list, TRUE); - - /* Only blank the mail display if the message being - viewed is one of those to be expunged */ - if (fb->loaded_uid) { - info = camel_folder_get_message_info (fb->folder, fb->loaded_uid); - - if (!info || info->flags & CAMEL_MESSAGE_DELETED) - mail_display_set_message (fb->mail_display, NULL); - } - - fb->expunging = fb->folder; - mail_expunge_folder (fb->folder, expunged_folder, data); - } -} - -/********************** Begin Filter Editor ********************/ - -static GtkWidget *filter_editor = NULL; - -static void -filter_editor_destroy (GtkWidget *dialog, gpointer user_data) -{ - filter_editor = NULL; -} - -static void -filter_editor_clicked (GtkWidget *dialog, int button, FolderBrowser *fb) -{ - FilterContext *fc; - - if (button == 0) { - char *user; - - fc = gtk_object_get_data (GTK_OBJECT (dialog), "context"); - user = g_strdup_printf ("%s/filters.xml", evolution_dir); - rule_context_save ((RuleContext *)fc, user); - g_free (user); - } - - if (button != -1) { - gnome_dialog_close (GNOME_DIALOG (dialog)); - } -} - -static const char *filter_source_names[] = { - "incoming", - "outgoing", - NULL, -}; - -void -filter_edit (BonoboUIComponent *uih, void *user_data, const char *path) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - FilterContext *fc; - char *user, *system; - - if (filter_editor) { - gdk_window_raise (GTK_WIDGET (filter_editor)->window); - return; - } - - fc = filter_context_new (); - user = g_strdup_printf ("%s/filters.xml", evolution_dir); - system = EVOLUTION_DATADIR "/evolution/filtertypes.xml"; - rule_context_load ((RuleContext *)fc, system, user); - g_free (user); - - if (((RuleContext *)fc)->error) { - GtkWidget *dialog; - char *err; - - err = g_strdup_printf (_("Error loading filter information:\n%s"), - ((RuleContext *)fc)->error); - dialog = gnome_warning_dialog_parented (err, FB_WINDOW (fb)); - g_free (err); - - gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE); - gtk_widget_show (dialog); - return; - } - - filter_editor = (GtkWidget *)filter_editor_new (fc, filter_source_names); - gnome_dialog_set_parent (GNOME_DIALOG (filter_editor), FB_WINDOW (fb)); - gtk_window_set_title (GTK_WINDOW (filter_editor), _("Filters")); - - gtk_object_set_data_full (GTK_OBJECT (filter_editor), "context", fc, (GtkDestroyNotify)gtk_object_unref); - gtk_signal_connect (GTK_OBJECT (filter_editor), "clicked", filter_editor_clicked, fb); - gtk_signal_connect (GTK_OBJECT (filter_editor), "destroy", filter_editor_destroy, NULL); - gtk_widget_show (GTK_WIDGET (filter_editor)); -} - -/********************** End Filter Editor ********************/ - -void -vfolder_edit_vfolders (BonoboUIComponent *uih, void *user_data, const char *path) -{ - vfolder_edit (); -} - - -static MailAccountsDialog *accounts_dialog = NULL; - -static void -accounts_dialog_close (GtkWidget *widget, gpointer user_data) -{ - accounts_dialog = NULL; -} - -void -providers_config (BonoboUIComponent *uih, void *user_data, const char *path) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - if (!accounts_dialog) { - accounts_dialog = mail_accounts_dialog_new (fb->shell); - gtk_widget_set_parent_window (GTK_WIDGET (accounts_dialog), - GTK_WIDGET (FB_WINDOW (fb))->window); - gtk_signal_connect (GTK_OBJECT (accounts_dialog), "destroy", - accounts_dialog_close, NULL); - gnome_dialog_set_close (GNOME_DIALOG (accounts_dialog), TRUE); - gtk_widget_show (GTK_WIDGET (accounts_dialog)); - } else { - gdk_window_raise (GTK_WIDGET (accounts_dialog)->window); - gtk_widget_grab_focus (GTK_WIDGET (accounts_dialog)); - } -} - -/* - * FIXME: This routine could be made generic, by having a closure - * function plus data, and having the whole process be taken care - * of for you - */ -static void -do_mail_print (FolderBrowser *fb, gboolean preview) -{ - GnomePrintContext *print_context; - GnomePrintMaster *print_master; - GnomePrintDialog *dialog; - GnomePrinter *printer = NULL; - int copies = 1; - int collate = FALSE; - - if (!preview) { - dialog = GNOME_PRINT_DIALOG (gnome_print_dialog_new (_("Print Message"), - GNOME_PRINT_DIALOG_COPIES)); - gnome_dialog_set_default (GNOME_DIALOG (dialog), GNOME_PRINT_PRINT); - e_gnome_dialog_set_parent (GNOME_DIALOG (dialog), FB_WINDOW (fb)); - - switch (gnome_dialog_run (GNOME_DIALOG (dialog))) { - case GNOME_PRINT_PRINT: - break; - case GNOME_PRINT_PREVIEW: - preview = TRUE; - break; - case -1: - return; - default: - gnome_dialog_close (GNOME_DIALOG (dialog)); - return; - } - - gnome_print_dialog_get_copies (dialog, &copies, &collate); - printer = gnome_print_dialog_get_printer (dialog); - gnome_dialog_close (GNOME_DIALOG (dialog)); - } - - print_master = gnome_print_master_new (); - -/* FIXME: set paper size gnome_print_master_set_paper (print_master, */ - - if (printer) - gnome_print_master_set_printer (print_master, printer); - gnome_print_master_set_copies (print_master, copies, collate); - print_context = gnome_print_master_get_context (print_master); - gtk_html_print (fb->mail_display->html, print_context); - gnome_print_master_close (print_master); - - if (preview){ - gboolean landscape = FALSE; - GnomePrintMasterPreview *preview; - - preview = gnome_print_master_preview_new_with_orientation ( - print_master, _("Print Preview"), landscape); - gtk_widget_show (GTK_WIDGET (preview)); - } else { - int result = gnome_print_master_print (print_master); - - if (result == -1){ - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Printing of message failed")); - } - } - gtk_object_unref (GTK_OBJECT (print_master)); -} - -void -print_msg (GtkWidget *button, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - do_mail_print (fb, FALSE); -} - -void -print_preview_msg (GtkWidget *button, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - do_mail_print (fb, TRUE); -} - -/******************** Begin Subscription Dialog ***************************/ - -static GtkObject *subscribe_dialog = NULL; - -static void -subscribe_dialog_destroy (GtkWidget *widget, gpointer user_data) -{ - gtk_object_unref (subscribe_dialog); - subscribe_dialog = NULL; -} - -void -manage_subscriptions (BonoboUIComponent *uih, void *user_data, const char *path) -{ - if (!subscribe_dialog) { - subscribe_dialog = subscribe_dialog_new (); - gtk_signal_connect (GTK_OBJECT (SUBSCRIBE_DIALOG (subscribe_dialog)->app), "destroy", - subscribe_dialog_destroy, NULL); - - gnome_dialog_set_close (GNOME_DIALOG (SUBSCRIBE_DIALOG (subscribe_dialog)->app), TRUE); - - subscribe_dialog_show (subscribe_dialog); - } else { - gdk_window_raise (SUBSCRIBE_DIALOG (subscribe_dialog)->app->window); - } -} - -/******************** End Subscription Dialog ***************************/ - -void -configure_folder (BonoboUIComponent *uih, void *user_data, const char *path) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - if (fb->uri && strncmp (fb->uri, "vfolder:", 8) == 0) { - vfolder_edit_rule (fb->uri); - } else { - mail_local_reconfigure_folder (fb); - } -} - -static void -do_view_message (CamelFolder *folder, char *uid, CamelMimeMessage *message, void *data) -{ - FolderBrowser *fb = FOLDER_BROWSER (data); - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - if (message) { - GtkWidget *mb; - - camel_folder_set_message_flags (folder, uid, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN); - mb = message_browser_new (fb->shell, fb->uri, uid); - gtk_widget_show (mb); - } -} - -void -view_msg (GtkWidget *widget, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - GPtrArray *uids; - int i; - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - uids = g_ptr_array_new (); - message_list_foreach (fb->message_list, enumerate_msg, uids); - - if (uids->len > 10 && !are_you_sure (_("Are you sure you want to open all %d messages in separate windows?"), uids, fb)) - return; - - for (i = 0; i < uids->len; i++) { - mail_get_message (fb->folder, uids->pdata [i], do_view_message, fb, mail_thread_queued); - g_free (uids->pdata [i]); - } - g_ptr_array_free (uids, TRUE); -} - -void -open_msg (GtkWidget *widget, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - extern CamelFolder *outbox_folder; - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - if (folder_browser_is_drafts (fb) || fb->folder == outbox_folder) - edit_msg_internal (fb); - else - view_msg (NULL, user_data); -} - -void -open_message (BonoboUIComponent *uih, void *user_data, const char *path) -{ - open_msg (NULL, user_data); -} - -void -edit_message (BonoboUIComponent *uih, void *user_data, const char *path) -{ - edit_msg (NULL, user_data); -} - -void -stop_threads (BonoboUIComponent *uih, void *user_data, const char *path) -{ - camel_operation_cancel (NULL); -} - -static void -empty_trash_expunged_cb (CamelFolder *folder, void *data) -{ - camel_object_unref (CAMEL_OBJECT (folder)); -} - -void -empty_trash (BonoboUIComponent *uih, void *user_data, const char *path) -{ - MailConfigAccount *account; - CamelProvider *provider; - const GSList *accounts; - CamelFolder *vtrash; - FolderBrowser *fb; - CamelException ex; - - fb = user_data ? FOLDER_BROWSER (user_data) : NULL; - - if (fb && !confirm_expunge (fb)) - return; - - camel_exception_init (&ex); - - /* expunge all remote stores */ - accounts = mail_config_get_accounts (); - while (accounts) { - account = accounts->data; - - /* make sure this is a valid source */ - if (account->source && account->source->enabled && account->source->url) { - provider = camel_session_get_provider (session, account->source->url, &ex); - if (provider) { - /* make sure this store is a remote store */ - if (provider->flags & CAMEL_PROVIDER_IS_STORAGE && - provider->flags & CAMEL_PROVIDER_IS_REMOTE) { - vtrash = mail_tool_get_trash (account->source->url, FALSE, &ex); - - if (vtrash) { - mail_expunge_folder (vtrash, empty_trash_expunged_cb, NULL); - } - } - } - - /* clear the exception for the next round */ - camel_exception_clear (&ex); - } - accounts = accounts->next; - } - - /* Now empty the local trash folder */ - vtrash = mail_tool_get_trash ("file:/", TRUE, &ex); - if (vtrash) { - mail_expunge_folder (vtrash, empty_trash_expunged_cb, NULL); - } - - camel_exception_clear (&ex); -} diff --git a/mail/mail-callbacks.h b/mail/mail-callbacks.h deleted file mode 100644 index d67b21a874..0000000000 --- a/mail/mail-callbacks.h +++ /dev/null @@ -1,131 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright 2000 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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_CALLBACKS_H -#define MAIL_CALLBACKS_H - -#include <camel/camel.h> -#include "composer/e-msg-composer.h" -#include <mail/mail-types.h> -#include "evolution-storage.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus }*/ - -/* these are the possible modes for replying */ -enum { - REPLY_SENDER, - REPLY_LIST, - REPLY_ALL -}; - -void enumerate_msg (MessageList *ml, const char *uid, gpointer data); - -void fetch_mail (GtkWidget *widget, gpointer user_data); -void send_queued_mail (GtkWidget *widget, gpointer user_data); -void send_receive_mail (GtkWidget *widget, gpointer user_data); - -void compose_msg (GtkWidget *widget, gpointer user_data); -void send_to_url (const char *url); - -void forward_inline (GtkWidget *widget, gpointer user_data); -void forward_quoted (GtkWidget *widget, gpointer user_data); -void forward_attached (GtkWidget *widget, gpointer user_data); -void forward (GtkWidget *widget, gpointer user_data); - -void reply_to_sender (GtkWidget *widget, gpointer user_data); -void reply_to_list (GtkWidget *widget, gpointer user_data); -void reply_to_all (GtkWidget *widget, gpointer user_data); - -void delete_msg (GtkWidget *widget, gpointer user_data); -void undelete_msg (GtkWidget *widget, gpointer user_data); -void move_msg_cb (GtkWidget *widget, gpointer user_data); -void copy_msg_cb (GtkWidget *widget, gpointer user_data); -void addrbook_sender (GtkWidget *widget, gpointer user_data); -void apply_filters (GtkWidget *widget, gpointer user_data); -void print_msg (GtkWidget *widget, gpointer user_data); -void print_preview_msg (GtkWidget *widget, gpointer user_data); -void edit_msg (GtkWidget *widget, gpointer user_data); -void open_msg (GtkWidget *widget, gpointer user_data); -void save_msg (GtkWidget *widget, gpointer user_data); -void view_msg (GtkWidget *widget, gpointer user_data); -void view_source (GtkWidget *widget, gpointer user_data); -void next_msg (GtkWidget *widget, gpointer user_data); -void next_unread_msg (GtkWidget *widget, gpointer user_data); -void next_flagged_msg (GtkWidget *widget, gpointer user_data); -void previous_msg (GtkWidget *widget, gpointer user_data); -void previous_unread_msg (GtkWidget *widget, gpointer user_data); -void previous_flagged_msg (GtkWidget *widget, gpointer user_data); -void resend_msg (GtkWidget *widget, gpointer user_data); -void search_msg (GtkWidget *widget, gpointer user_data); -void load_images (GtkWidget *widget, gpointer user_data); - -void move_msg (BonoboUIComponent *uih, void *user_data, const char *path); -void copy_msg (BonoboUIComponent *uih, void *user_data, const char *path); -void select_all (BonoboUIComponent *uih, void *user_data, const char *path); -void select_thread (BonoboUIComponent *uih, void *user_data, const char *path); -void invert_selection (BonoboUIComponent *uih, void *user_data, const char *path); -void mark_as_seen (BonoboUIComponent *uih, void *user_data, const char *path); -void mark_all_as_seen (BonoboUIComponent *uih, void *user_data, const char *path); -void mark_as_unseen (BonoboUIComponent *uih, void *user_data, const char *path); -void mark_as_important (BonoboUIComponent *uih, void *user_data, const char *path); -void mark_as_unimportant (BonoboUIComponent *uih, void *user_data, const char *path); -void toggle_as_important (BonoboUIComponent *uih, void *user_data, const char *path); - -void zoom_in (BonoboUIComponent *uih, void *user_data, const char *path); -void zoom_out (BonoboUIComponent *uih, void *user_data, const char *path); -void zoom_reset (BonoboUIComponent *uih, void *user_data, const char *path); - -void edit_message (BonoboUIComponent *uih, void *user_data, const char *path); -void open_message (BonoboUIComponent *uih, void *user_data, const char *path); -void expunge_folder (BonoboUIComponent *uih, void *user_data, const char *path); -void filter_edit (BonoboUIComponent *uih, void *user_data, const char *path); -void vfolder_edit_vfolders (BonoboUIComponent *uih, void *user_data, const char *path); -void providers_config (BonoboUIComponent *uih, void *user_data, const char *path); -void manage_subscriptions (BonoboUIComponent *uih, void *user_data, const char *path); - -void configure_folder (BonoboUIComponent *uih, void *user_data, const char *path); - -void stop_threads (BonoboUIComponent *uih, void *user_data, const char *path); - -void empty_trash (BonoboUIComponent *uih, void *user_data, const char *path); - -void mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const char *uid, int mode); - -void composer_send_cb (EMsgComposer *composer, gpointer data); -void composer_postpone_cb (EMsgComposer *composer, gpointer data); - -void forward_messages (CamelFolder *folder, GPtrArray *uids, gboolean inline); - -/* CamelStore callbacks */ -void folder_created (CamelStore *store, const char *prefix, CamelFolderInfo *fi); -void folder_deleted (CamelStore *store, CamelFolderInfo *fi); - -void mail_storage_create_folder (EvolutionStorage *storage, CamelStore *store, CamelFolderInfo *fi); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ! MAIL_CALLBACKS_H */ diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c deleted file mode 100644 index 41d272a626..0000000000 --- a/mail/mail-config-druid.c +++ /dev/null @@ -1,954 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Jeffrey Stedfast <fejj@ximian.com> - * Dan Winship <danw@ximian.com> - * Iain Holmes <iain@ximian.com> - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include <sys/types.h> -#include <sys/utsname.h> -#include <string.h> -#include <unistd.h> - -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-dialog-util.h> -#include <libgnomeui/gnome-druid.h> -#include <libgnomeui/gnome-druid-page-standard.h> -#include <glade/glade.h> -#include <gtkhtml/gtkhtml.h> -#include <gal/widgets/e-unicode.h> -#include "mail-config-druid.h" -#include "mail-config.h" -#include "mail-ops.h" -#include "mail.h" -#include "mail-session.h" - -#include <bonobo/bonobo-exception.h> -#include <bonobo/bonobo-control.h> -#include <bonobo/bonobo-widget.h> -#include <bonobo/bonobo-generic-factory.h> -#include <bonobo/bonobo-context.h> - -#include <evolution-wizard.h> - -static void mail_config_druid_class_init (MailConfigDruidClass *class); -static void mail_config_druid_finalize (GtkObject *obj); - -static GtkWindowClass *parent_class; - -/* These globals need fixed FIXME FIXME FIXME FIXME*/ -static GHashTable *page_hash = NULL; -static GList *page_list = NULL; -static EvolutionWizard *account_wizard; - -#define WIZARD_IID "OAFIID:GNOME_Evolution_Mail_Wizard_Factory" - -typedef enum { - MAIL_CONFIG_WIZARD_PAGE_NONE = -1, - MAIL_CONFIG_WIZARD_PAGE_IDENTITY, - MAIL_CONFIG_WIZARD_PAGE_SOURCE, - MAIL_CONFIG_WIZARD_PAGE_EXTRA, - MAIL_CONFIG_WIZARD_PAGE_TRANSPORT, - MAIL_CONFIG_WIZARD_PAGE_MANAGEMENT, -} MailConfigWizardPage; - -typedef struct { - MailAccountGui *gui; - - MailConfigAccount *account; - EvolutionWizard *wizard; - - gboolean identity_copied; - CamelProvider *last_source; - MailConfigWizardPage page; -} MailConfigWizard; - -GtkType -mail_config_druid_get_type (void) -{ - static GtkType type = 0; - - if (!type) { - GtkTypeInfo type_info = { - "MailConfigDruid", - sizeof (MailConfigDruid), - sizeof (MailConfigDruidClass), - (GtkClassInitFunc) mail_config_druid_class_init, - (GtkObjectInitFunc) NULL, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL - }; - - type = gtk_type_unique (gtk_window_get_type (), &type_info); - } - - return type; -} - -static void -mail_config_druid_class_init (MailConfigDruidClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - parent_class = gtk_type_class (gtk_window_get_type ()); - - /* override methods */ - object_class->finalize = mail_config_druid_finalize; -} - -static void -mail_config_druid_finalize (GtkObject *obj) -{ - MailConfigDruid *druid = (MailConfigDruid *) obj; - CORBA_Environment ev; - - gtk_object_destroy (GTK_OBJECT (druid->xml)); - - CORBA_exception_init (&ev); - Bonobo_EventSource_removeListener ((Bonobo_EventSource) druid->event_source, druid->id, &ev); - CORBA_exception_free (&ev); - - bonobo_object_release_unref ((Bonobo_Unknown) druid->event_source, &ev); - bonobo_object_unref (BONOBO_OBJECT (druid->listener)); - - ((GtkObjectClass *)(parent_class))->finalize (obj); -} - - -static struct { - char *name; - char *text; -} info[] = { - { "identity_html", - N_("Please enter your name and email address below. The \"optional\" fields below do not need to be filled in,\nunless you wish to include this information in email you send.") }, - { "source_html", - N_("Please enter information about your incoming mail server below. If you are not sure, ask your system\nadministrator or Internet Service Provider.") }, - { "extra_html", - N_("Please select among the following options") }, - { "transport_html", - N_("Please enter information about the way you will send mail. If you are not sure, ask your system\nadministrator or Internet Service Provider.") }, - { "management_html", - N_("You are almost done with the mail configuration process. The identity, incoming mail server and\noutgoing mail transport method which you provided will be grouped together to\nmake an Evolution mail account. Please enter a name for this account in the space below.\nThis name will be used for display purposes only.") } -}; -static int num_info = (sizeof (info) / sizeof (info[0])); - -static GtkWidget * -create_label (const char *name) -{ - GtkWidget *widget, *align; - int i; - - for (i = 0; i < num_info; i++) { - if (!strcmp (name, info[i].name)) - break; - } - g_return_val_if_fail (i != num_info, NULL); - - widget = gtk_label_new (_(info[i].text)); - - align = gtk_alignment_new (0.0, 0.5, 1.0, 1.0); - gtk_container_add (GTK_CONTAINER (align), widget); - - gtk_widget_show_all (align); - return align; -} - -static void -druid_cancel (GnomeDruid *druid, gpointer user_data) -{ - MailConfigDruid *config = user_data; - GNOME_Evolution_Wizard wiz; - CORBA_Environment ev; - - wiz = bonobo_object_corba_objref (BONOBO_OBJECT (account_wizard)); - CORBA_exception_init (&ev); - - GNOME_Evolution_Wizard_notifyAction (wiz, 0, GNOME_Evolution_Wizard_CANCEL, &ev); - CORBA_exception_free (&ev); - - if (page_list != NULL) { - g_list_free (page_list); - page_list = NULL; - } - - if (page_hash != NULL) { - g_hash_table_destroy (page_hash); - page_hash = NULL; - } - - gtk_widget_destroy (GTK_WIDGET (config)); -} - -static void -druid_finish (GnomeDruidPage *page, gpointer arg1, gpointer user_data) -{ - MailConfigDruid *druid = user_data; - - gtk_object_set_data (GTK_OBJECT (account_wizard), "account-data", NULL); - if (page_list != NULL) { - g_list_free (page_list); - page_list = NULL; - } - - if (page_hash != NULL) { - g_hash_table_destroy (page_hash); - page_hash = NULL; - } - - gtk_widget_destroy (GTK_WIDGET (druid)); -} - -/* Identity Page */ -static void -identity_changed (GtkWidget *widget, gpointer data) -{ - MailConfigWizard *gui = data; - GtkWidget *incomplete; - gboolean next_sensitive; - - if (gui->page != MAIL_CONFIG_WIZARD_PAGE_IDENTITY) - return; - - next_sensitive = mail_account_gui_identity_complete (gui->gui, &incomplete); - - evolution_wizard_set_buttons_sensitive (gui->wizard, TRUE, next_sensitive, TRUE, NULL); - - if (!next_sensitive) - gtk_widget_grab_focus (incomplete); -} - -static void -identity_prepare (EvolutionWizard *wizard, gpointer data) -{ - MailConfigWizard *gui = data; - - gui->page = MAIL_CONFIG_WIZARD_PAGE_IDENTITY; - gtk_widget_grab_focus (GTK_WIDGET (gui->gui->full_name)); - identity_changed (NULL, data); -} - -static gboolean -identity_next (EvolutionWizard *wizard, gpointer data) -{ - MailConfigWizard *gui = data; - - if (!gui->identity_copied) { - char *username; - - /* Copy the username part of the email address into - * the Username field of the source and transport pages. - */ - username = gtk_entry_get_text (gui->gui->email_address); - username = g_strndup (username, strcspn (username, "@")); - gtk_entry_set_text (gui->gui->source.username, username); - gtk_entry_set_text (gui->gui->transport.username, username); - g_free (username); - - gui->identity_copied = TRUE; - } - - return FALSE; -} - -/* Incoming mail Page */ -static void -source_changed (GtkWidget *widget, gpointer data) -{ - MailConfigWizard *gui = data; - GtkWidget *incomplete; - gboolean next_sensitive; - - if (gui->page != MAIL_CONFIG_WIZARD_PAGE_SOURCE) - return; - - next_sensitive = mail_account_gui_source_complete (gui->gui, &incomplete); - - evolution_wizard_set_buttons_sensitive (gui->wizard, TRUE, next_sensitive, TRUE, NULL); - - if (!next_sensitive) - gtk_widget_grab_focus (incomplete); -} - -static void -source_prepare (EvolutionWizard *wizard, gpointer data) -{ - MailConfigWizard *gui = data; - - gui->page = MAIL_CONFIG_WIZARD_PAGE_SOURCE; - source_changed (NULL, gui); -} - -static gboolean -source_next (EvolutionWizard *wizard, gpointer data) -{ - MailConfigWizard *gui = data; - - /* FIXME: if online, check that the data is good. */ - - if (gui->gui->source.provider && gui->gui->source.provider->extra_conf) - return FALSE; - - /* Otherwise, skip to transport page. */ - evolution_wizard_set_page (gui->wizard, MAIL_CONFIG_WIZARD_PAGE_TRANSPORT, NULL); - - return TRUE; -} - -/* Extra Config Page */ -static void -extra_prepare (EvolutionWizard *wizard, gpointer data) -{ - MailConfigWizard *gui = data; - - gui->page = MAIL_CONFIG_WIZARD_PAGE_EXTRA; - if (gui->gui->source.provider != gui->last_source) { - gui->last_source = gui->gui->source.provider; - mail_account_gui_build_extra_conf (gui->gui, NULL); - } -} - -/* Transport Page */ -static gboolean -transport_next (EvolutionWizard *wizard, gpointer data) -{ - /* FIXME: if online, check that the data is good. */ - return FALSE; -} - -static gboolean -transport_back (EvolutionWizard *wizard, gpointer data) -{ - MailConfigWizard *gui = data; - - if (gui->gui->source.provider && gui->gui->source.provider->extra_conf) - return FALSE; - else { - evolution_wizard_set_page (wizard, MAIL_CONFIG_WIZARD_PAGE_SOURCE, NULL); - return TRUE; - } -} - -static void -transport_changed (GtkWidget *widget, gpointer data) -{ - MailConfigWizard *gui = data; - GtkWidget *incomplete; - gboolean next_sensitive; - - if (gui->page != MAIL_CONFIG_WIZARD_PAGE_TRANSPORT) - return; - next_sensitive = mail_account_gui_transport_complete (gui->gui, &incomplete); - - evolution_wizard_set_buttons_sensitive (gui->wizard, TRUE, next_sensitive, TRUE, NULL); - - if (!next_sensitive) - gtk_widget_grab_focus (incomplete); -} - -static void -transport_prepare (EvolutionWizard *wizard, gpointer data) -{ - MailConfigWizard *gui = data; - - gui->page = MAIL_CONFIG_WIZARD_PAGE_TRANSPORT; - transport_changed (NULL, data); -} - -/* Management page */ -static void -management_check (MailConfigWizard *wizard) -{ - gboolean next_sensitive; - char *text; - - text = gtk_entry_get_text (wizard->gui->account_name); - next_sensitive = text && *text; - - /* no accounts with the same name */ - if (next_sensitive && mail_config_get_account_by_name (text)) - next_sensitive = FALSE; - - evolution_wizard_set_buttons_sensitive (wizard->wizard, TRUE, - next_sensitive, TRUE, NULL); -} - -static void -management_prepare (EvolutionWizard *wizard, gpointer data) -{ - MailConfigWizard *gui = data; - char *name; - - gui->page = MAIL_CONFIG_WIZARD_PAGE_MANAGEMENT; - name = gtk_entry_get_text (gui->gui->email_address); - if (name && *name) - gtk_entry_set_text (gui->gui->account_name, name); - - management_check (gui); -} - -static void -management_changed (GtkWidget *widget, gpointer data) -{ - MailConfigWizard *gui = data; - - if (gui->page != MAIL_CONFIG_WIZARD_PAGE_MANAGEMENT) - return; - management_check (gui); -} - -static MailConfigAccount * -make_account (void) -{ - MailConfigAccount *account; - char *name, *user; - struct utsname uts; - - account = g_new0 (MailConfigAccount, 1); - - account->id = g_new0 (MailConfigIdentity, 1); - name = g_get_real_name (); - account->id->name = e_utf8_from_locale_string (name); - user = getenv ("USER"); - if (user && !uname (&uts) && strchr (uts.nodename, '.')) - account->id->address = g_strdup_printf ("%s@%s", user, uts.nodename); - - if (mail_config_get_default_transport ()) - account->transport = service_copy (mail_config_get_default_transport ()); - - return account; -} - -static const char *pages[] = { - "identity_page", - "source_page", - "extra_page", - "transport_page", - "management_page", - "finish_page", - NULL -}; - -static int -page_to_num (gpointer page) -{ - gpointer r; - - r = g_hash_table_lookup (page_hash, page); - if (r == NULL) { - return 0; - } - - return GPOINTER_TO_INT (r); -} - -static gboolean -next_func (GnomeDruidPage *page, - GnomeDruid *druid, - gpointer data) -{ - GNOME_Evolution_Wizard wiz; - CORBA_Environment ev; - int pagenum; - - wiz = bonobo_object_corba_objref (BONOBO_OBJECT (account_wizard)); - CORBA_exception_init (&ev); - - pagenum = page_to_num (page); - GNOME_Evolution_Wizard_notifyAction (wiz, pagenum, GNOME_Evolution_Wizard_NEXT, &ev); - CORBA_exception_free (&ev); - - if (pagenum < 5-1) - return TRUE; - - return FALSE; -} - -static gboolean -prepare_func (GnomeDruidPage *page, - GnomeDruid *druid, - gpointer data) -{ - GNOME_Evolution_Wizard wiz; - CORBA_Environment ev; - int pagenum; - - wiz = bonobo_object_corba_objref (BONOBO_OBJECT (account_wizard)); - CORBA_exception_init (&ev); - - pagenum = page_to_num (page); - GNOME_Evolution_Wizard_notifyAction (wiz, pagenum, GNOME_Evolution_Wizard_PREPARE, &ev); - CORBA_exception_free (&ev); - return FALSE; -} - -static gboolean -back_func (GnomeDruidPage *page, - GnomeDruid *druid, - gpointer data) -{ - GNOME_Evolution_Wizard wiz; - CORBA_Environment ev; - int pagenum; - - wiz = bonobo_object_corba_objref (BONOBO_OBJECT (account_wizard)); - CORBA_exception_init (&ev); - - pagenum = page_to_num (page); - GNOME_Evolution_Wizard_notifyAction (wiz, pagenum, GNOME_Evolution_Wizard_BACK, &ev); - CORBA_exception_free (&ev); - - if (pagenum > 0) - return TRUE; - - return FALSE; -} - -static gboolean -finish_func (GnomeDruidPage *page, - GnomeDruid *druid, - gpointer data) -{ - GNOME_Evolution_Wizard wiz; - CORBA_Environment ev; - int pagenum; - - wiz = bonobo_object_corba_objref (BONOBO_OBJECT (account_wizard)); - CORBA_exception_init (&ev); - - pagenum = page_to_num (page); - GNOME_Evolution_Wizard_notifyAction (wiz, 0, GNOME_Evolution_Wizard_FINISH, &ev); - CORBA_exception_free (&ev); - - druid_finish (page, druid, data); - return FALSE; -} - -static void -wizard_listener_event (BonoboListener *listener, - char *event_name, - BonoboArg *event_data, - CORBA_Environment *ev, - MailConfigDruid *druid) -{ - CORBA_short buttons, pagenum; - GnomeDruidPage *page; - - if (strcmp (event_name, EVOLUTION_WIZARD_SET_BUTTONS_SENSITIVE) == 0) { - buttons = (int) *((CORBA_short *)event_data->_value); - gnome_druid_set_buttons_sensitive (GNOME_DRUID (druid->druid), - (buttons & 4) >> 2, - (buttons & 2) >> 1, - (buttons & 1)); - } else if (strcmp (event_name, EVOLUTION_WIZARD_SET_SHOW_FINISH) == 0) { - gnome_druid_set_show_finish (GNOME_DRUID (druid->druid), - (gboolean) *((CORBA_boolean *)event_data->_value)); - } else if (strcmp (event_name, EVOLUTION_WIZARD_SET_PAGE) == 0) { - pagenum = (int) *((CORBA_short *) event_data->_value); - - page = g_list_nth_data (page_list, pagenum); - gnome_druid_set_page (GNOME_DRUID (druid->druid), page); - } -} - -static void -construct (MailConfigDruid *druid) -{ - GtkWidget *widget; - GNOME_Evolution_Wizard corba_wizard; - Bonobo_Listener corba_listener; - CORBA_Environment ev; - int i; - - /* Start account wizard */ - CORBA_exception_init (&ev); - corba_wizard = oaf_activate_from_id ("OAFIID:GNOME_Evolution_Mail_Wizard", 0, NULL, &ev); - CORBA_exception_free (&ev); - g_assert (account_wizard != NULL); - - druid->xml = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", NULL); - /* get our toplevel widget and reparent it */ - widget = glade_xml_get_widget (druid->xml, "druid"); - gtk_widget_reparent (widget, GTK_WIDGET (druid)); - - druid->druid = GNOME_DRUID (widget); - - /* set window title */ - gtk_window_set_title (GTK_WINDOW (druid), _("Evolution Account Assistant")); - gtk_window_set_policy (GTK_WINDOW (druid), FALSE, TRUE, FALSE); - gtk_window_set_modal (GTK_WINDOW (druid), FALSE); - gtk_object_set (GTK_OBJECT (druid), "type", GTK_WINDOW_DIALOG, NULL); - - druid->listener = bonobo_listener_new (NULL, NULL); - gtk_signal_connect (GTK_OBJECT (druid->listener), "event-notify", - GTK_SIGNAL_FUNC (wizard_listener_event), druid); - corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (druid->listener)); - CORBA_exception_init (&ev); - druid->event_source = (Bonobo_Unknown) bonobo_object_query_interface ( - BONOBO_OBJECT (account_wizard), "IDL:Bonobo/EventSource:1.0"); - g_assert (druid->event_source != CORBA_OBJECT_NIL); - druid->id = Bonobo_EventSource_addListener ((Bonobo_EventSource) druid->event_source, corba_listener, &ev); - if (BONOBO_EX (&ev)) { - g_warning ("Error adding listener (%s)", - CORBA_exception_id (&ev)); - } - CORBA_exception_free (&ev); - - if (page_hash != NULL) { - g_hash_table_destroy (page_hash); - } - page_hash = g_hash_table_new (NULL, NULL); - for (i = 0; pages[i] != NULL; i++) { - GtkWidget *page; - GnomeDruidPageStandard *dpage; - - page = glade_xml_get_widget (druid->xml, pages[i]); - /* Store pages */ - g_hash_table_insert (page_hash, page, GINT_TO_POINTER (i)); - page_list = g_list_append (page_list, page); - - gtk_signal_connect (GTK_OBJECT (page), "next", - GTK_SIGNAL_FUNC (next_func), druid); - gtk_signal_connect (GTK_OBJECT (page), "prepare", - GTK_SIGNAL_FUNC (prepare_func), druid); - gtk_signal_connect (GTK_OBJECT (page), "back", - GTK_SIGNAL_FUNC (back_func), druid); - - gtk_signal_connect (GTK_OBJECT (page), "finish", - GTK_SIGNAL_FUNC (finish_func), druid); - - if (i != 5) { - Bonobo_Control control; - GtkWidget *w; - CORBA_Environment ev; - - dpage = GNOME_DRUID_PAGE_STANDARD (page); - - CORBA_exception_init (&ev); - control = GNOME_Evolution_Wizard_getControl (corba_wizard, i, &ev); - if (BONOBO_EX (&ev)) { - g_warning ("Error getting page %d: %s", i, - CORBA_exception_id (&ev)); - CORBA_exception_free (&ev); - continue; - } - - w = bonobo_widget_new_control_from_objref (control, - CORBA_OBJECT_NIL); - gtk_box_pack_start (GTK_BOX (dpage->vbox), w, TRUE, - TRUE, 0); - gtk_widget_show_all (w); - } - } - gtk_signal_connect (GTK_OBJECT (druid->druid), "cancel", druid_cancel, druid); - - gnome_druid_set_buttons_sensitive (druid->druid, FALSE, TRUE, TRUE); -} - -MailConfigDruid * -mail_config_druid_new (GNOME_Evolution_Shell shell) -{ - MailConfigDruid *new; - - new = (MailConfigDruid *) gtk_type_new (mail_config_druid_get_type ()); - construct (new); - new->shell = shell; - - return new; -} - -static BonoboControl * -get_fn (EvolutionWizard *wizard, - int page_num, - void *closure) -{ - MailConfigWizard *gui = closure; - BonoboControl *control; - GtkWidget *vbox, *widget; - static gboolean first_time = TRUE; - - if (gui->gui == NULL) { - if (gui->account == NULL) { - gui->account = make_account (); - gtk_object_set_data (GTK_OBJECT (wizard), "account-data", - gui->account); - } - - gui->gui = mail_account_gui_new (gui->account); - - /* set up signals, etc */ - gtk_signal_connect (GTK_OBJECT (gui->gui->account_name), - "changed", management_changed, gui); - gtk_signal_connect (GTK_OBJECT (gui->gui->full_name), - "changed", identity_changed, gui); - gtk_signal_connect (GTK_OBJECT (gui->gui->email_address), - "changed", identity_changed, gui); - gtk_signal_connect (GTK_OBJECT (gui->gui->source.hostname), - "changed", source_changed, gui); - gtk_signal_connect (GTK_OBJECT (gui->gui->source.username), - "changed", source_changed, gui); - gtk_signal_connect (GTK_OBJECT (gui->gui->source.path), - "changed", source_changed, gui); - gtk_signal_connect (GTK_OBJECT (gui->gui->transport.hostname), - "changed", transport_changed, gui); - gtk_signal_connect (GTK_OBJECT (gui->gui->transport.username), - "changed", transport_changed, gui); - first_time = TRUE; - } - - /* Fill in the druid pages */ - vbox = gtk_vbox_new (FALSE, 0); - switch (page_num) { - case 0: - widget = create_label ("identity_html"); - gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0); - widget = glade_xml_get_widget (gui->gui->xml, "identity_required_frame"); - gtk_widget_reparent (widget, vbox); - gtk_box_set_child_packing (GTK_BOX (vbox), widget, FALSE, FALSE, 0, GTK_PACK_START); - widget = glade_xml_get_widget (gui->gui->xml, "identity_optional_frame"); - gtk_widget_reparent (widget, vbox); - gtk_box_set_child_packing (GTK_BOX (vbox), widget, FALSE, FALSE, 0, GTK_PACK_START); - break; - - case 1: - widget = create_label ("source_html"); - gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0); - widget = glade_xml_get_widget (gui->gui->xml, "source_vbox"); - gtk_widget_reparent (widget, vbox); - gtk_widget_show (widget); - break; - - case 2: - widget = create_label ("extra_html"); - gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0); - widget = glade_xml_get_widget (gui->gui->xml, "extra_vbox"); - gtk_widget_reparent (widget, vbox); - break; - - case 3: - widget = create_label ("transport_html"); - gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0); - widget = glade_xml_get_widget (gui->gui->xml, "transport_vbox"); - gtk_widget_reparent (widget, vbox); - gtk_widget_show (widget); - break; - - case 4: - widget = glade_xml_get_widget (gui->gui->xml, "management_frame"); - gtk_widget_reparent (widget, vbox); - break; - - default: - return NULL; - } - - gtk_widget_show (vbox); - control = bonobo_control_new (vbox); - - if (first_time) { - mail_account_gui_setup (gui->gui, NULL); - first_time = FALSE; - } - - return control; -} - -typedef gboolean (*NextFunc)(EvolutionWizard *wizard, gpointer data); - -static struct { - NextFunc next_func; - GtkSignalFunc prepare_func; - NextFunc back_func; - GtkSignalFunc finish_func; - GtkSignalFunc help_func; -} wizard_pages[] = { - { identity_next, - GTK_SIGNAL_FUNC (identity_prepare), - NULL, - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL) }, - { source_next, - GTK_SIGNAL_FUNC (source_prepare), - NULL, - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL) }, - { NULL, - GTK_SIGNAL_FUNC (extra_prepare), - NULL, - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL) }, - { transport_next, - GTK_SIGNAL_FUNC (transport_prepare), - transport_back, - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL) }, - { NULL, - GTK_SIGNAL_FUNC (management_prepare), - NULL, - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL) } -}; - -static void -wizard_next_cb (EvolutionWizard *wizard, - int page_num, - MailConfigWizard *gui) -{ - if (wizard_pages[page_num].next_func == NULL - || !(wizard_pages[page_num].next_func (wizard, gui))) { - if (page_num < 5-1) { - evolution_wizard_set_page(wizard, page_num+1, NULL); - } - } -} - -static void -wizard_prepare_cb (EvolutionWizard *wizard, - int page_num, - MailConfigWizard *gui) -{ - if (wizard_pages[page_num].prepare_func != NULL) { - wizard_pages[page_num].prepare_func (wizard, gui); - } -} - -static void -wizard_back_cb (EvolutionWizard *wizard, - int page_num, - MailConfigWizard *gui) -{ - if (wizard_pages[page_num].back_func == NULL - || !(wizard_pages[page_num].back_func (wizard, gui))) { - if (page_num > 0) - evolution_wizard_set_page(wizard, page_num-1, NULL); - } -} - -static void -wizard_finish_cb (EvolutionWizard *wizard, - int page_num, - MailConfigWizard *w) -{ - MailAccountGui *gui = w->gui; - - /* Save the settings for that account */ - if (mail_account_gui_save (gui) == FALSE) - /* problem. Um, how to keep the druid alive? */ - return; - - if (gui->account->source) - gui->account->source->enabled = TRUE; - - /* Write out the config info */ - mail_config_write (); - mail_account_gui_destroy (gui); - w->gui = NULL; - w->account = NULL; -} - -static void -wizard_cancel_cb (EvolutionWizard *wizard, - int page_num, - MailConfigWizard *gui) -{ - mail_account_gui_destroy (gui->gui); - gui->gui = NULL; -} - -static void -wizard_help_cb (EvolutionWizard *wizard, - int page_num, - MailConfigWizard *gui) -{ -} - -static void -wizard_free (MailConfigWizard *wizard) -{ - if (wizard->gui) - mail_account_gui_destroy (wizard->gui); - - if (wizard->account) - account_destroy (wizard->account); - - g_free (wizard); -} - -static BonoboObject * -evolution_mail_config_wizard_factory_fn (BonoboGenericFactory *factory, - void *closure) -{ - EvolutionWizard *wizard; - MailConfigAccount *account; - MailConfigWizard *gui; - - account = make_account (); - - gui = g_new (MailConfigWizard, 1); - gui->gui = NULL; - gui->account = account; - gui->identity_copied = FALSE; - gui->last_source = NULL; - gui->page = MAIL_CONFIG_WIZARD_PAGE_NONE; - - wizard = evolution_wizard_new (get_fn, 5, gui); - account_wizard = wizard; - - gtk_object_set_data_full (GTK_OBJECT (account_wizard), - "account-data", gui, - (GtkDestroyNotify) wizard_free); - gui->wizard = wizard; - - gtk_signal_connect (GTK_OBJECT (wizard), "next", - GTK_SIGNAL_FUNC (wizard_next_cb), gui); - gtk_signal_connect (GTK_OBJECT (wizard), "prepare", - GTK_SIGNAL_FUNC (wizard_prepare_cb), gui); - gtk_signal_connect (GTK_OBJECT (wizard), "back", - GTK_SIGNAL_FUNC (wizard_back_cb), gui); - gtk_signal_connect (GTK_OBJECT (wizard), "finish", - GTK_SIGNAL_FUNC (wizard_finish_cb), gui); - gtk_signal_connect (GTK_OBJECT (wizard), "cancel", - GTK_SIGNAL_FUNC (wizard_cancel_cb), gui); - gtk_signal_connect (GTK_OBJECT (wizard), "help", - GTK_SIGNAL_FUNC (wizard_help_cb), gui); - - return BONOBO_OBJECT (wizard); -} - -void -evolution_mail_config_wizard_init (void) -{ - BonoboGenericFactory *factory; - - factory = bonobo_generic_factory_new (WIZARD_IID, - evolution_mail_config_wizard_factory_fn, NULL); - - if (factory == NULL) { - g_warning ("Error starting factory"); - return; - } - - bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory)); -} diff --git a/mail/mail-config-druid.h b/mail/mail-config-druid.h deleted file mode 100644 index a85ee97baa..0000000000 --- a/mail/mail-config-druid.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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_CONFIG_DRUID_H -#define MAIL_CONFIG_DRUID_H - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#include <libgnomeui/gnome-druid.h> -#include <libgnomeui/gnome-file-entry.h> -#include <glade/glade.h> -#include <camel.h> -#include <bonobo/bonobo-listener.h> -#include "shell/Evolution.h" -#include "mail-account-gui.h" - -#define MAIL_CONFIG_DRUID_TYPE (mail_config_druid_get_type ()) -#define MAIL_CONFIG_DRUID(o) (GTK_CHECK_CAST ((o), MAIL_CONFIG_DRUID_TYPE, MailConfigDruid)) -#define MAIL_CONFIG_DRUID_CLASS(k) (GTK_CHECK_CLASS_CAST((k), MAIL_CONFIG_DRUID_TYPE, MailConfigDruidClass)) -#define MAIL_IS_CONFIG_DRUID(o) (GTK_CHECK_TYPE ((o), MAIL_CONFIG_DRUID_TYPE)) -#define MAIL_IS_CONFIG_DRUID_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MAIL_CONFIG_DRUID_TYPE)) - -typedef struct { - GtkWindow parent; - - GnomeDruid *druid; - MailAccountGui *gui; - GladeXML *xml; - - GNOME_Evolution_Shell shell; - gboolean identity_copied; - CamelProvider *last_source; - - int id; - BonoboListener *listener; - Bonobo_EventSource event_source; -} MailConfigDruid; - -typedef struct { - GtkWindowClass parent_class; - - /* signals */ - -} MailConfigDruidClass; - -GtkType mail_config_druid_get_type (void); - -MailConfigDruid *mail_config_druid_new (GNOME_Evolution_Shell shell); - -char *mail_config_druid_get_account_name (MailConfigDruid *druid); -gboolean mail_config_druid_get_default_account (MailConfigDruid *druid); - -char *mail_config_druid_get_source_url (MailConfigDruid *druid); - -gboolean mail_config_druid_get_keep_mail_on_server (MailConfigDruid *druid); -gboolean mail_config_druid_get_save_source_password (MailConfigDruid *druid); -gboolean mail_config_druid_get_auto_check (MailConfigDruid *druid); -gint mail_config_druid_get_auto_check_minutes (MailConfigDruid *druid); - -char *mail_config_druid_get_transport_url (MailConfigDruid *druid); -gboolean mail_config_druid_get_save_transport_password (MailConfigDruid *druid); -gboolean mail_config_druid_get_transport_requires_auth (MailConfigDruid *druid); -void evolution_mail_config_wizard_init (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* MAIL_CONFIG_DRUID_H */ diff --git a/mail/mail-config.c b/mail/mail-config.c deleted file mode 100644 index 91acb931ab..0000000000 --- a/mail/mail-config.c +++ /dev/null @@ -1,2334 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -/* this group of headers is for pgp detection */ -#include <signal.h> -#include <sys/ioctl.h> -#include <sys/time.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <termios.h> -#include <unistd.h> -#include <errno.h> - -#include <pwd.h> -#include <ctype.h> - -#include <glib.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-config.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-stock.h> -#include <gtkhtml/gtkhtml.h> -#include <glade/glade.h> - -#include <bonobo/bonobo-object.h> -#include <bonobo/bonobo-generic-factory.h> -#include <bonobo/bonobo-context.h> -#include <bonobo/bonobo-moniker-util.h> -#include <bonobo/bonobo-exception.h> -#include <bonobo-conf/bonobo-config-database.h> - -#include <shell/evolution-shell-client.h> - -#include <gal/util/e-unicode-i18n.h> -#include <gal/util/e-util.h> -#include <gal/unicode/gunicode.h> -#include <gal/widgets/e-gui-utils.h> -#include <e-util/e-html-utils.h> -#include <e-util/e-url.h> -#include <e-util/e-passwords.h> -#include "mail.h" -#include "mail-config.h" -#include "mail-mt.h" -#include "mail-tools.h" - -#include "Mail.h" - -typedef struct { - Bonobo_ConfigDatabase db; - - gboolean corrupt; - - gboolean show_preview; - gboolean thread_list; - gboolean hide_deleted; - gint paned_size; - gboolean send_html; - gboolean confirm_unwanted_html; - gboolean citation_highlight; - guint32 citation_color; - gboolean prompt_empty_subject; - gboolean prompt_only_bcc; - gboolean confirm_expunge; - gboolean do_seen_timeout; - gint seen_timeout; - gboolean empty_trash_on_exit; - - GSList *accounts; - gint default_account; - - GSList *news; - - char *pgp_path; - CamelPgpType pgp_type; - - MailConfigHTTPMode http_mode; - MailConfigForwardStyle default_forward_style; - MailConfigDisplayStyle message_display_style; - char *default_charset; - - GHashTable *threaded_hash; - GHashTable *preview_hash; - - gboolean filter_log; - char *filter_log_path; -} MailConfig; - -static MailConfig *config = NULL; - -#define MAIL_CONFIG_IID "OAFIID:GNOME_Evolution_MailConfig_Factory" - -/* Prototypes */ -static void config_read (void); -static void mail_config_set_default_account_num (gint new_default); - - -/* Identity */ -MailConfigIdentity * -identity_copy (const MailConfigIdentity *id) -{ - MailConfigIdentity *new; - - g_return_val_if_fail (id != NULL, NULL); - - new = g_new0 (MailConfigIdentity, 1); - new->name = g_strdup (id->name); - new->address = g_strdup (id->address); - new->organization = g_strdup (id->organization); - new->signature = g_strdup (id->signature); - new->html_signature = g_strdup (id->html_signature); - new->has_html_signature = id->has_html_signature; - - return new; -} - -void -identity_destroy (MailConfigIdentity *id) -{ - if (!id) - return; - - g_free (id->name); - g_free (id->address); - g_free (id->organization); - g_free (id->signature); - g_free (id->html_signature); - - g_free (id); -} - -/* Service */ -MailConfigService * -service_copy (const MailConfigService *source) -{ - MailConfigService *new; - - g_return_val_if_fail (source != NULL, NULL); - - new = g_new0 (MailConfigService, 1); - new->url = g_strdup (source->url); - new->keep_on_server = source->keep_on_server; - new->auto_check = source->auto_check; - new->auto_check_time = source->auto_check_time; - new->enabled = source->enabled; - new->save_passwd = source->save_passwd; - - return new; -} - -void -service_destroy (MailConfigService *source) -{ - if (!source) - return; - - g_free (source->url); - - g_free (source); -} - -void -service_destroy_each (gpointer item, gpointer data) -{ - service_destroy ((MailConfigService *)item); -} - -/* Account */ -MailConfigAccount * -account_copy (const MailConfigAccount *account) -{ - MailConfigAccount *new; - - g_return_val_if_fail (account != NULL, NULL); - - new = g_new0 (MailConfigAccount, 1); - new->name = g_strdup (account->name); - - new->id = identity_copy (account->id); - new->source = service_copy (account->source); - new->transport = service_copy (account->transport); - - new->drafts_folder_name = g_strdup (account->drafts_folder_name); - new->drafts_folder_uri = g_strdup (account->drafts_folder_uri); - new->sent_folder_name = g_strdup (account->sent_folder_name); - new->sent_folder_uri = g_strdup (account->sent_folder_uri); - - new->pgp_key = g_strdup (account->pgp_key); - new->pgp_encrypt_to_self = account->pgp_encrypt_to_self; - new->pgp_always_sign = account->pgp_always_sign; - - new->smime_key = g_strdup (account->smime_key); - new->smime_encrypt_to_self = account->smime_encrypt_to_self; - new->smime_always_sign = account->smime_always_sign; - - return new; -} - -void -account_destroy (MailConfigAccount *account) -{ - if (!account) - return; - - g_free (account->name); - - identity_destroy (account->id); - service_destroy (account->source); - service_destroy (account->transport); - - g_free (account->drafts_folder_name); - g_free (account->drafts_folder_uri); - g_free (account->sent_folder_name); - g_free (account->sent_folder_uri); - - g_free (account->pgp_key); - g_free (account->smime_key); - - g_free (account); -} - -void -account_destroy_each (gpointer item, gpointer data) -{ - account_destroy ((MailConfigAccount *)item); -} - -/* Config struct routines */ -void -mail_config_init (void) -{ - Bonobo_ConfigDatabase db; - CORBA_Environment ev; - - if (config) - return; - - CORBA_exception_init (&ev); - - db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev); - - if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) { - char *err; - g_error ("Very serious error, cannot activate config database '%s'", - (err = bonobo_exception_get_text (&ev))); - g_free (err); - CORBA_exception_free (&ev); - return; - } - - CORBA_exception_free (&ev); - - config = g_new0 (MailConfig, 1); - - config->db = db; - - config_read (); -} - -void -mail_config_clear (void) -{ - if (!config) - return; - - if (config->accounts) { - g_slist_foreach (config->accounts, account_destroy_each, NULL); - g_slist_free (config->accounts); - config->accounts = NULL; - } - - if (config->news) { - g_slist_foreach (config->news, service_destroy_each, NULL); - g_slist_free (config->news); - config->news = NULL; - } -} - -static void -config_read (void) -{ - int len, i, default_num; - - mail_config_clear (); - - len = bonobo_config_get_long_with_default (config->db, - "/Mail/Accounts/num", 0, NULL); - - for (i = 0; i < len; i++) { - MailConfigAccount *account; - MailConfigIdentity *id; - MailConfigService *source; - MailConfigService *transport; - char *path, *val; - - account = g_new0 (MailConfigAccount, 1); - path = g_strdup_printf ("/Mail/Accounts/account_name_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); - g_free (path); - if (val && *val) { - account->name = val; - } else { - g_free (val); - account->name = g_strdup_printf (U_("Account %d"), i + 1); - config->corrupt = TRUE; - } - - path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_name_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); - g_free (path); - if (val && *val) - account->drafts_folder_name = val; - else - g_free (val); - - path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_uri_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); - g_free (path); - if (val && *val) - account->drafts_folder_uri = val; - else - g_free (val); - - path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_name_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); - g_free (path); - if (val && *val) - account->sent_folder_name = val; - else - g_free (val); - - path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_uri_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); - g_free (path); - if (val && *val) - account->sent_folder_uri = val; - else - g_free (val); - - /* get the pgp info */ - path = g_strdup_printf ("/Mail/Accounts/account_pgp_key_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); - g_free (path); - if (val && *val) - account->pgp_key = val; - else - g_free (val); - - path = g_strdup_printf ("/Mail/Accounts/account_pgp_always_sign_%d", i); - account->pgp_always_sign = bonobo_config_get_boolean_with_default ( - config->db, path, FALSE, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/account_pgp_encrypt_to_self_%d", i); - account->pgp_encrypt_to_self = bonobo_config_get_boolean_with_default ( - config->db, path, TRUE, NULL); - g_free (path); - - /* get the s/mime info */ - path = g_strdup_printf ("/Mail/Accounts/account_smime_key_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); - g_free (path); - if (val && *val) - account->smime_key = val; - else - g_free (val); - - path = g_strdup_printf ("/Mail/Accounts/account_smime_always_sign_%d", i); - account->smime_always_sign = bonobo_config_get_boolean_with_default ( - config->db, path, FALSE, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/account_smime_encrypt_to_self_%d", i); - account->smime_encrypt_to_self = bonobo_config_get_boolean_with_default ( - config->db, path, TRUE, NULL); - g_free (path); - - /* get the identity info */ - id = g_new0 (MailConfigIdentity, 1); - path = g_strdup_printf ("/Mail/Accounts/identity_name_%d", i); - id->name = bonobo_config_get_string (config->db, path, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/identity_address_%d", i); - id->address = bonobo_config_get_string (config->db, path, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/identity_organization_%d", i); - id->organization = bonobo_config_get_string (config->db, path, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/identity_signature_%d", i); - id->signature = bonobo_config_get_string (config->db, path, NULL); - g_free (path); - path = g_strdup_printf ("/Mail/Accounts/identity_html_signature_%d", i); - id->html_signature = bonobo_config_get_string (config->db, path, NULL); - g_free (path); - path = g_strdup_printf ("/Mail/Accounts/identity_has_html_signature_%d", i); - id->has_html_signature = bonobo_config_get_boolean_with_default ( - config->db, path, FALSE, NULL); - g_free (path); - - /* get the source */ - source = g_new0 (MailConfigService, 1); - - path = g_strdup_printf ("/Mail/Accounts/source_url_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); - g_free (path); - if (val && *val) - source->url = val; - else - g_free (val); - - path = g_strdup_printf ("/Mail/Accounts/source_keep_on_server_%d", i); - source->keep_on_server = bonobo_config_get_boolean (config->db, path, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/source_auto_check_%d", i); - source->auto_check = bonobo_config_get_boolean_with_default ( - config->db, path, FALSE, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/source_auto_check_time_%d", i); - source->auto_check_time = bonobo_config_get_long_with_default ( - config->db, path, -1, NULL); - - if (source->auto_check && source->auto_check_time <= 0) { - source->auto_check_time = 5; - source->auto_check = FALSE; - } - - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/source_enabled_%d", i); - source->enabled = bonobo_config_get_boolean_with_default ( - config->db, path, TRUE, NULL); - g_free (path); - - path = g_strdup_printf - ("/Mail/Accounts/source_save_passwd_%d", i); - source->save_passwd = bonobo_config_get_boolean_with_default ( - config->db, path, TRUE, NULL); - g_free (path); - - /* get the transport */ - transport = g_new0 (MailConfigService, 1); - path = g_strdup_printf ("/Mail/Accounts/transport_url_%d", i); - val = bonobo_config_get_string (config->db, path, NULL); - g_free (path); - if (val && *val) - transport->url = val; - else - g_free (val); - - path = g_strdup_printf ("/Mail/Accounts/transport_save_passwd_%d", i); - transport->save_passwd = bonobo_config_get_boolean (config->db, path, NULL); - g_free (path); - - account->id = id; - account->source = source; - account->transport = transport; - - config->accounts = g_slist_append (config->accounts, account); - } - - default_num = bonobo_config_get_long_with_default (config->db, - "/Mail/Accounts/default_account", 0, NULL); - - mail_config_set_default_account_num (default_num); - -#ifdef ENABLE_NNTP - /* News */ - - len = bonobo_config_get_long_with_default (config->db, - "/News/Sources/num", 0, NULL); - for (i = 0; i < len; i++) { - MailConfigService *n; - gchar *path, *r; - - path = g_strdup_printf ("/News/Sources/url_%d", i); - - if ((r = bonobo_config_get_string (config->db, path, NULL))) { - n = g_new0 (MailConfigService, 1); - n->url = r; - n->enabled = TRUE; - config->news = g_slist_append (config->news, n); - } - - g_free (path); - - } -#endif - - /* Format */ - config->send_html = bonobo_config_get_boolean_with_default (config->db, - "/Mail/Format/send_html", FALSE, NULL); - - /* Confirm Sending Unwanted HTML */ - config->confirm_unwanted_html = bonobo_config_get_boolean_with_default (config->db, - "/Mail/Format/confirm_unwanted_html", TRUE, NULL); - - /* Citation */ - config->citation_highlight = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/Display/citation_highlight", TRUE, NULL); - - config->citation_color = bonobo_config_get_long_with_default ( - config->db, "/Mail/Display/citation_color", 0x737373, NULL); - - /* Mark as seen toggle */ - config->do_seen_timeout = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/Display/do_seen_timeout", TRUE, NULL); - - /* Mark as seen timeout */ - config->seen_timeout = bonobo_config_get_long_with_default (config->db, - "/Mail/Display/seen_timeout", 1500, NULL); - - /* Show Messages Threaded */ - config->thread_list = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/Display/thread_list", FALSE, NULL); - - config->show_preview = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/Display/preview_pane", TRUE, NULL); - - /* Hide deleted automatically */ - config->hide_deleted = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/Display/hide_deleted", FALSE, NULL); - - /* Size of vpaned in mail view */ - config->paned_size = bonobo_config_get_long_with_default (config->db, - "/Mail/Display/paned_size", 200, NULL); - - /* Empty Subject */ - config->prompt_empty_subject = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/Prompts/empty_subject", TRUE, NULL); - - /* Only Bcc */ - config->prompt_only_bcc = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/Prompts/only_bcc", TRUE, NULL); - - /* Expunge */ - config->confirm_expunge = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/Prompts/confirm_expunge", TRUE, NULL); - - /* PGP/GPG */ - config->pgp_path = bonobo_config_get_string (config->db, - "/Mail/PGP/path", NULL); - - config->pgp_type = bonobo_config_get_long_with_default (config->db, - "/Mail/PGP/type", CAMEL_PGP_TYPE_NONE, NULL); - - /* HTTP images */ - config->http_mode = bonobo_config_get_long_with_default (config->db, - "/Mail/Display/http_images", MAIL_CONFIG_HTTP_NEVER, NULL); - - /* Forwarding */ - config->default_forward_style = bonobo_config_get_long_with_default ( - config->db, "/Mail/Format/default_forward_style", - MAIL_CONFIG_FORWARD_ATTACHED, NULL); - - /* Message Display */ - config->message_display_style = bonobo_config_get_long_with_default ( - config->db, "/Mail/Format/message_display_style", - MAIL_CONFIG_DISPLAY_NORMAL, NULL); - - /* Default charset */ - config->default_charset = bonobo_config_get_string (config->db, - "/Mail/Format/default_charset", NULL); - - if (!config->default_charset) { - g_get_charset (&config->default_charset); - if (!config->default_charset || - !g_strcasecmp (config->default_charset, "US-ASCII")) - config->default_charset = g_strdup ("ISO-8859-1"); - else - config->default_charset = g_strdup (config->default_charset); - } - - /* Trash folders */ - config->empty_trash_on_exit = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/Trash/empty_on_exit", FALSE, NULL); - - /* Filter logging */ - config->filter_log = bonobo_config_get_boolean_with_default ( - config->db, "/Mail/Filters/log", FALSE, NULL); - - config->filter_log_path = bonobo_config_get_string ( - config->db, "/Mail/Filters/log_path", NULL); -} - -#define bonobo_config_set_string_wrapper(db, path, val, ev) bonobo_config_set_string (db, path, val ? val : "", ev) - -void -mail_config_write (void) -{ - CORBA_Environment ev; - int len, i, default_num; - - /* Accounts */ - - if (!config) - return; - - CORBA_exception_init (&ev); - Bonobo_ConfigDatabase_removeDir (config->db, "/Mail/Accounts", &ev); - CORBA_exception_init (&ev); - Bonobo_ConfigDatabase_removeDir (config->db, "/News/Sources", &ev); - CORBA_exception_init (&ev); - Bonobo_ConfigDatabase_sync (config->db, &ev); - - len = g_slist_length (config->accounts); - bonobo_config_set_long (config->db, - "/Mail/Accounts/num", len, NULL); - - default_num = mail_config_get_default_account_num (); - bonobo_config_set_long (config->db, - "/Mail/Accounts/default_account", default_num, NULL); - - for (i = 0; i < len; i++) { - MailConfigAccount *account; - char *path; - - account = g_slist_nth_data (config->accounts, i); - - /* account info */ - path = g_strdup_printf ("/Mail/Accounts/account_name_%d", i); - bonobo_config_set_string_wrapper (config->db, path, account->name, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_name_%d", i); - bonobo_config_set_string_wrapper (config->db, path, - account->drafts_folder_name, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_uri_%d", i); - bonobo_config_set_string_wrapper (config->db, path, - account->drafts_folder_uri, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_name_%d", i); - bonobo_config_set_string_wrapper (config->db, path, - account->sent_folder_name, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_uri_%d", i); - bonobo_config_set_string_wrapper (config->db, path, - account->sent_folder_uri, NULL); - g_free (path); - - /* account pgp options */ - path = g_strdup_printf ("/Mail/Accounts/account_pgp_key_%d", i); - bonobo_config_set_string_wrapper (config->db, path, account->pgp_key, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/account_pgp_always_sign_%d", i); - bonobo_config_set_boolean (config->db, path, account->pgp_always_sign, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/account_pgp_encrypt_to_self_%d", i); - bonobo_config_set_boolean (config->db, path, - account->pgp_encrypt_to_self, NULL); - g_free (path); - - /* account s/mime options */ - path = g_strdup_printf ("/Mail/Accounts/account_smime_key_%d", i); - bonobo_config_set_string_wrapper (config->db, path, account->smime_key, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/account_smime_always_sign_%d", i); - bonobo_config_set_boolean (config->db, path, account->smime_always_sign, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/account_smime_encrypt_to_self_%d", i); - bonobo_config_set_boolean (config->db, path, account->smime_encrypt_to_self, NULL); - g_free (path); - - /* identity info */ - path = g_strdup_printf ("/Mail/Accounts/identity_name_%d", i); - bonobo_config_set_string_wrapper (config->db, path, account->id->name, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/identity_address_%d", i); - bonobo_config_set_string_wrapper (config->db, path, account->id->address, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/identity_organization_%d", i); - bonobo_config_set_string_wrapper (config->db, path, account->id->organization, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/identity_signature_%d", i); - bonobo_config_set_string_wrapper (config->db, path, account->id->signature, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/identity_html_signature_%d", i); - bonobo_config_set_string_wrapper (config->db, path, account->id->html_signature, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/identity_has_html_signature_%d", i); - bonobo_config_set_boolean (config->db, path, account->id->has_html_signature, NULL); - g_free (path); - - /* source info */ - path = g_strdup_printf ("/Mail/Accounts/source_url_%d", i); - bonobo_config_set_string_wrapper (config->db, path, account->source->url, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/source_keep_on_server_%d", i); - bonobo_config_set_boolean (config->db, path, account->source->keep_on_server, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/source_auto_check_%d", i); - bonobo_config_set_boolean (config->db, path, account->source->auto_check, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/source_auto_check_time_%d", i); - bonobo_config_set_long (config->db, path, account->source->auto_check_time, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/source_enabled_%d", i); - bonobo_config_set_boolean (config->db, path, account->source->enabled, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/source_save_passwd_%d", i); - bonobo_config_set_boolean (config->db, path, account->source->save_passwd, NULL); - g_free (path); - - /* transport info */ - path = g_strdup_printf ("/Mail/Accounts/transport_url_%d", i); - bonobo_config_set_string_wrapper (config->db, path, account->transport->url, NULL); - g_free (path); - - path = g_strdup_printf ("/Mail/Accounts/transport_save_passwd_%d", i); - bonobo_config_set_boolean (config->db, path, account->transport->save_passwd, NULL); - g_free (path); - } - -#ifdef ENABLE_NNTP - /* News */ - - len = g_slist_length (config->news); - bonobo_config_set_long (config->db, "/News/Sources/num", len, NULL); - for (i = 0; i < len; i++) { - MailConfigService *n; - gchar *path; - - n = g_slist_nth_data (config->news, i); - - path = g_strdup_printf ("/News/Sources/url_%d", i); - bonobo_config_set_string_wrapper (config->db, path, n->url, NULL); - g_free (path); - } - -#endif - - CORBA_exception_init (&ev); - Bonobo_ConfigDatabase_sync (config->db, &ev); - CORBA_exception_free (&ev); -} - -static gboolean -hash_save_state (gpointer key, gpointer value, gpointer user_data) -{ - char *path; - gboolean bool = GPOINTER_TO_INT (value); - - path = g_strconcat ("/Mail/", (char *)user_data, "/", (char *)key, - NULL); - bonobo_config_set_boolean (config->db, path, bool, NULL); - g_free (path); - g_free (key); - - return TRUE; -} - -void -mail_config_write_on_exit (void) -{ - CORBA_Environment ev; - MailConfigAccount *account; - const GSList *accounts; - - /* Show Messages Threaded */ - bonobo_config_set_boolean (config->db, "/Mail/Display/thread_list", - config->thread_list, NULL); - - /* Show Message Preview */ - bonobo_config_set_boolean (config->db, "/Mail/Display/preview_pane", - config->show_preview, NULL); - - /* Hide deleted automatically */ - bonobo_config_set_boolean (config->db, "/Mail/Display/hide_deleted", - config->hide_deleted, NULL); - - /* Size of vpaned in mail view */ - bonobo_config_set_long (config->db, "/Mail/Display/paned_size", - config->paned_size, NULL); - - /* Mark as seen toggle */ - bonobo_config_set_boolean (config->db, "/Mail/Display/do_seen_timeout", - config->do_seen_timeout, NULL); - /* Mark as seen timeout */ - bonobo_config_set_long (config->db, "/Mail/Display/seen_timeout", - config->seen_timeout, NULL); - - /* Format */ - bonobo_config_set_boolean (config->db, "/Mail/Format/send_html", - config->send_html, NULL); - - /* Confirm Sending Unwanted HTML */ - bonobo_config_set_boolean (config->db, "/Mail/Format/confirm_unwanted_html", - config->confirm_unwanted_html, NULL); - - /* Citation */ - bonobo_config_set_boolean (config->db, - "/Mail/Display/citation_highlight", - config->citation_highlight, NULL); - - bonobo_config_set_long (config->db, "/Mail/Display/citation_color", - config->citation_color, NULL); - - /* Empty Subject */ - bonobo_config_set_boolean (config->db, "/Mail/Prompts/empty_subject", - config->prompt_empty_subject, NULL); - - /* Only Bcc */ - bonobo_config_set_boolean (config->db, "/Mail/Prompts/only_bcc", - config->prompt_only_bcc, NULL); - - /* Expunge */ - bonobo_config_set_boolean (config->db, "/Mail/Prompts/confirm_expunge", - config->confirm_expunge, NULL); - - /* PGP/GPG */ - bonobo_config_set_string_wrapper (config->db, "/Mail/PGP/path", - config->pgp_path, NULL); - - bonobo_config_set_long (config->db, "/Mail/PGP/type", - config->pgp_type, NULL); - - /* HTTP images */ - bonobo_config_set_long (config->db, "/Mail/Display/http_images", - config->http_mode, NULL); - - /* Forwarding */ - bonobo_config_set_long (config->db, - "/Mail/Format/default_forward_style", - config->default_forward_style, NULL); - - /* Message Display */ - bonobo_config_set_long (config->db, - "/Mail/Format/message_display_style", - config->message_display_style, NULL); - - /* Default charset */ - bonobo_config_set_string_wrapper (config->db, "/Mail/Format/default_charset", - config->default_charset, NULL); - - /* Trash folders */ - bonobo_config_set_boolean (config->db, "/Mail/Trash/empty_on_exit", - config->empty_trash_on_exit, NULL); - - /* Filter logging */ - bonobo_config_set_boolean (config->db, "/Mail/Filters/log", - config->filter_log, NULL); - - bonobo_config_set_string_wrapper (config->db, "/Mail/Filters/log_path", - config->filter_log_path, NULL); - - if (config->threaded_hash) - g_hash_table_foreach_remove (config->threaded_hash, hash_save_state, "Threads"); - - if (config->preview_hash) - g_hash_table_foreach_remove (config->preview_hash, hash_save_state, "Preview"); - - CORBA_exception_init (&ev); - Bonobo_ConfigDatabase_sync (config->db, &ev); - CORBA_exception_free (&ev); - - /* Passwords */ - - /* then we make sure the ones we want to remember are in the - session cache */ - accounts = mail_config_get_accounts (); - for ( ; accounts; accounts = accounts->next) { - char *passwd; - account = accounts->data; - if (account->source->save_passwd && account->source->url) { - passwd = mail_session_get_password (account->source->url); - mail_session_forget_password (account->source->url); - mail_session_add_password (account->source->url, passwd); - g_free (passwd); - } - - if (account->transport->save_passwd && account->transport->url) { - passwd = mail_session_get_password (account->transport->url); - mail_session_forget_password (account->transport->url); - mail_session_add_password (account->transport->url, passwd); - g_free (passwd); - } - } - - /* then we clear out our component passwords */ - e_passwords_clear_component_passwords (); - - /* then we remember them */ - accounts = mail_config_get_accounts (); - for ( ; accounts; accounts = accounts->next) { - account = accounts->data; - if (account->source->save_passwd && account->source->url) - mail_session_remember_password (account->source->url); - - if (account->transport->save_passwd && account->transport->url) - mail_session_remember_password (account->transport->url); - } - - /* now do cleanup */ - mail_config_clear (); -} - -/* Accessor functions */ -gboolean -mail_config_is_configured (void) -{ - return config->accounts != NULL; -} - -gboolean -mail_config_is_corrupt (void) -{ - return config->corrupt; -} - -static char * -uri_to_key (const char *uri) -{ - char *rval, *ptr; - - if (!uri) - return NULL; - - rval = g_strdup (uri); - - for (ptr = rval; *ptr; ptr++) - if (*ptr == '/' || *ptr == ':') - *ptr = '_'; - - return rval; -} - -gboolean -mail_config_get_empty_trash_on_exit (void) -{ - return config->empty_trash_on_exit; -} - -void -mail_config_set_empty_trash_on_exit (gboolean value) -{ - config->empty_trash_on_exit = value; -} - -gboolean -mail_config_get_show_preview (const char *uri) -{ - if (uri && *uri) { - gpointer key, val; - char *dbkey; - - dbkey = uri_to_key (uri); - - if (!config->preview_hash) - config->preview_hash = g_hash_table_new (g_str_hash, g_str_equal); - - if (!g_hash_table_lookup_extended (config->preview_hash, dbkey, &key, &val)) { - gboolean value; - char *str; - - str = g_strdup_printf ("/Mail/Preview/%s", dbkey); - value = bonobo_config_get_boolean_with_default (config->db, str, TRUE, NULL); - g_free (str); - - g_hash_table_insert (config->preview_hash, dbkey, - GINT_TO_POINTER (value)); - - return value; - } else { - g_free (dbkey); - return GPOINTER_TO_INT (val); - } - } - - /* return the default value */ - - return config->show_preview; -} - -void -mail_config_set_show_preview (const char *uri, gboolean value) -{ - if (uri && *uri) { - char *dbkey = uri_to_key (uri); - gpointer key, val; - - if (!config->preview_hash) - config->preview_hash = g_hash_table_new (g_str_hash, g_str_equal); - - if (g_hash_table_lookup_extended (config->preview_hash, dbkey, &key, &val)) { - g_hash_table_insert (config->preview_hash, dbkey, - GINT_TO_POINTER (value)); - g_free (dbkey); - } else { - g_hash_table_insert (config->preview_hash, dbkey, - GINT_TO_POINTER (value)); - } - } else - config->show_preview = value; -} - -gboolean -mail_config_get_thread_list (const char *uri) -{ - if (uri && *uri) { - gpointer key, val; - char *dbkey; - - dbkey = uri_to_key (uri); - - if (!config->threaded_hash) - config->threaded_hash = g_hash_table_new (g_str_hash, g_str_equal); - - if (!g_hash_table_lookup_extended (config->threaded_hash, dbkey, &key, &val)) { - gboolean value; - char *str; - - str = g_strdup_printf ("/Mail/Threads/%s", dbkey); - value = bonobo_config_get_boolean_with_default (config->db, str, FALSE, NULL); - g_free (str); - - g_hash_table_insert (config->threaded_hash, dbkey, - GINT_TO_POINTER (value)); - - return value; - } else { - g_free(dbkey); - return GPOINTER_TO_INT (val); - } - } - - /* return the default value */ - - return config->thread_list; -} - -void -mail_config_set_thread_list (const char *uri, gboolean value) -{ - if (uri && *uri) { - char *dbkey = uri_to_key (uri); - gpointer key, val; - - if (!config->threaded_hash) - config->threaded_hash = g_hash_table_new (g_str_hash, g_str_equal); - - if (g_hash_table_lookup_extended (config->threaded_hash, dbkey, &key, &val)) { - g_hash_table_insert (config->threaded_hash, dbkey, - GINT_TO_POINTER (value)); - g_free (dbkey); - } else { - g_hash_table_insert (config->threaded_hash, dbkey, - GINT_TO_POINTER (value)); - } - } else - config->thread_list = value; -} - -gboolean -mail_config_get_filter_log (void) -{ - return config->filter_log; -} - -void -mail_config_set_filter_log (gboolean value) -{ - config->filter_log = value; -} - -const char * -mail_config_get_filter_log_path (void) -{ - return config->filter_log_path; -} - -void -mail_config_set_filter_log_path (const char *path) -{ - g_free (config->filter_log_path); - config->filter_log_path = g_strdup (path); -} - -gboolean -mail_config_get_hide_deleted (void) -{ - return config->hide_deleted; -} - -void -mail_config_set_hide_deleted (gboolean value) -{ - config->hide_deleted = value; -} - -gint -mail_config_get_paned_size (void) -{ - return config->paned_size; -} - -void -mail_config_set_paned_size (gint value) -{ - config->paned_size = value; -} - -gboolean -mail_config_get_send_html (void) -{ - return config->send_html; -} - -void -mail_config_set_send_html (gboolean send_html) -{ - config->send_html = send_html; -} - -gboolean -mail_config_get_confirm_unwanted_html (void) -{ - return config->confirm_unwanted_html; -} - -void -mail_config_set_confirm_unwanted_html (gboolean confirm) -{ - config->confirm_unwanted_html = confirm; -} - -gboolean -mail_config_get_citation_highlight (void) -{ - return config->citation_highlight; -} - -void -mail_config_set_citation_highlight (gboolean citation_highlight) -{ - config->citation_highlight = citation_highlight; -} - -guint32 -mail_config_get_citation_color (void) -{ - return config->citation_color; -} - -void -mail_config_set_citation_color (guint32 citation_color) -{ - config->citation_color = citation_color; -} - -gboolean -mail_config_get_do_seen_timeout (void) -{ - return config->do_seen_timeout; -} - -void -mail_config_set_do_seen_timeout (gboolean do_seen_timeout) -{ - config->do_seen_timeout = do_seen_timeout; -} - -gint -mail_config_get_mark_as_seen_timeout (void) -{ - return config->seen_timeout; -} - -void -mail_config_set_mark_as_seen_timeout (gint timeout) -{ - config->seen_timeout = timeout; -} - -gboolean -mail_config_get_prompt_empty_subject (void) -{ - return config->prompt_empty_subject; -} - -void -mail_config_set_prompt_empty_subject (gboolean value) -{ - config->prompt_empty_subject = value; -} - -gboolean -mail_config_get_prompt_only_bcc (void) -{ - return config->prompt_only_bcc; -} - -void -mail_config_set_prompt_only_bcc (gboolean value) -{ - config->prompt_only_bcc = value; -} - -gboolean -mail_config_get_confirm_expunge (void) -{ - return config->confirm_expunge; -} - -void -mail_config_set_confirm_expunge (gboolean value) -{ - config->confirm_expunge = value; -} - - -struct { - char *bin; - char *version; - CamelPgpType type; -} binaries[] = { - { "gpg", NULL, CAMEL_PGP_TYPE_GPG }, - { "pgp", "6.5.8", CAMEL_PGP_TYPE_PGP6 }, - { "pgp", "5.0", CAMEL_PGP_TYPE_PGP5 }, - { "pgp", "2.6", CAMEL_PGP_TYPE_PGP2 }, - { NULL, NULL, CAMEL_PGP_TYPE_NONE } -}; - - -typedef struct _PGPFILE { - FILE *fp; - pid_t pid; -} PGPFILE; - -static PGPFILE * -pgpopen (const char *command, const char *mode) -{ - int in_fds[2], out_fds[2]; - PGPFILE *pgp = NULL; - char **argv = NULL; - pid_t child; - int fd; - - g_return_val_if_fail (command != NULL, NULL); - - if (*mode != 'r' && *mode != 'w') - return NULL; - - argv = g_strsplit (command, " ", 0); - if (!argv) - return NULL; - - if (pipe (in_fds) == -1) - goto error; - - if (pipe (out_fds) == -1) { - close (in_fds[0]); - close (in_fds[1]); - goto error; - } - - if ((child = fork ()) == 0) { - /* In child */ - int maxfd; - - if ((dup2 (in_fds[0], STDIN_FILENO) < 0 ) || - (dup2 (out_fds[1], STDOUT_FILENO) < 0 ) || - (dup2 (out_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 all open fds that we aren't using */ - maxfd = sysconf (_SC_OPEN_MAX); - for (fd = 0; fd < maxfd; fd++) { - if (fd != STDIN_FILENO && fd != STDOUT_FILENO && fd != STDERR_FILENO) - close (fd); - } - - execvp (argv[0], argv); - fprintf (stderr, "Could not execute %s: %s\n", argv[0], - g_strerror (errno)); - _exit (255); - } else if (child < 0) { - close (in_fds[0]); - close (in_fds[1]); - close (out_fds[0]); - close (out_fds[1]); - goto error; - } - - /* Parent */ - g_strfreev (argv); - - close (in_fds[0]); /* pgp's stdin */ - close (out_fds[1]); /* pgp's stdout */ - - if (mode[0] == 'r') { - /* opening in read-mode */ - fd = out_fds[0]; - close (in_fds[1]); - } else { - /* opening in write-mode */ - fd = in_fds[1]; - close (out_fds[0]); - } - - pgp = g_new (PGPFILE, 1); - pgp->fp = fdopen (fd, mode); - pgp->pid = child; - - return pgp; - error: - g_strfreev (argv); - - return NULL; -} - -static int -pgpclose (PGPFILE *pgp) -{ - sigset_t mask, omask; - pid_t wait_result; - int status; - - if (pgp->fp) { - fclose (pgp->fp); - pgp->fp = NULL; - } - - /* 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 (pgp->pid, &status, 0); - alarm (0); - sigprocmask (SIG_SETMASK, &omask, NULL); - - if (wait_result == -1 && errno == EINTR) { - /* PGP is hanging: send a friendly reminder. */ - kill (pgp->pid, SIGTERM); - sleep (1); - wait_result = waitpid (pgp->pid, &status, WNOHANG); - if (wait_result == 0) { - /* Still hanging; use brute force. */ - kill (pgp->pid, SIGKILL); - sleep (1); - wait_result = waitpid (pgp->pid, &status, WNOHANG); - } - } - - if (wait_result != -1 && WIFEXITED (status)) { - g_free (pgp); - return 0; - } else - return -1; -} - -CamelPgpType -mail_config_pgp_type_detect_from_path (const char *pgp) -{ - const char *bin = g_basename (pgp); - struct stat st; - int i; - - /* make sure the file exists *and* is executable? */ - if (stat (pgp, &st) == -1 || !(st.st_mode & (S_IXOTH | S_IXGRP | S_IXUSR))) - return CAMEL_PGP_TYPE_NONE; - - for (i = 0; binaries[i].bin; i++) { - if (binaries[i].version) { - /* compare version strings */ - char buffer[256], *command; - gboolean found = FALSE; - PGPFILE *fp; - - command = g_strdup_printf ("%s --version", pgp); - fp = pgpopen (command, "r"); - g_free (command); - if (fp) { - while (!feof (fp->fp) && !found) { - memset (buffer, 0, sizeof (buffer)); - fgets (buffer, sizeof (buffer), fp->fp); - found = strstr (buffer, binaries[i].version) != NULL; - } - - pgpclose (fp); - - if (found) - return binaries[i].type; - } - } else if (!strcmp (binaries[i].bin, bin)) { - /* no version string to compare against... */ - return binaries[i].type; - } - } - - return CAMEL_PGP_TYPE_NONE; -} - -static void -auto_detect_pgp_variables (void) -{ - CamelPgpType type = CAMEL_PGP_TYPE_NONE; - const char *PATH, *path; - char *pgp = NULL; - - PATH = getenv ("PATH"); - - path = PATH; - while (path && *path && !type) { - const char *pend = strchr (path, ':'); - gboolean found = FALSE; - char *dirname; - int i; - - if (pend) { - /* don't even think of using "." */ - if (!strncmp (path, ".", pend - path)) { - path = pend + 1; - continue; - } - - dirname = g_strndup (path, pend - path); - path = pend + 1; - } else { - /* don't even think of using "." */ - if (!strcmp (path, ".")) - break; - - dirname = g_strdup (path); - path = NULL; - } - - for (i = 0; binaries[i].bin; i++) { - struct stat st; - - pgp = g_strdup_printf ("%s/%s", dirname, binaries[i].bin); - /* make sure the file exists *and* is executable? */ - if (stat (pgp, &st) != -1 && st.st_mode & (S_IXOTH | S_IXGRP | S_IXUSR)) { - if (binaries[i].version) { - /* compare version strings */ - char buffer[256], *command; - PGPFILE *fp; - - command = g_strdup_printf ("%s --version", pgp); - fp = pgpopen (command, "r"); - g_free (command); - if (fp) { - while (!feof (fp->fp) && !found) { - memset (buffer, 0, sizeof (buffer)); - fgets (buffer, sizeof (buffer), fp->fp); - found = strstr (buffer, binaries[i].version) != NULL; - } - - pgpclose (fp); - } - } else { - /* no version string to compare against... */ - found = TRUE; - } - - if (found) { - type = binaries[i].type; - break; - } - } - - g_free (pgp); - pgp = NULL; - } - - g_free (dirname); - } - - if (pgp && type) { - mail_config_set_pgp_path (pgp); - mail_config_set_pgp_type (type); - } - - g_free (pgp); -} - -CamelPgpType -mail_config_get_pgp_type (void) -{ - if (!config->pgp_path || !config->pgp_type) - auto_detect_pgp_variables (); - - return config->pgp_type; -} - -void -mail_config_set_pgp_type (CamelPgpType pgp_type) -{ - config->pgp_type = pgp_type; -} - -const char * -mail_config_get_pgp_path (void) -{ - if (!config->pgp_path || !config->pgp_type) - auto_detect_pgp_variables (); - - return config->pgp_path; -} - -void -mail_config_set_pgp_path (const char *pgp_path) -{ - g_free (config->pgp_path); - - config->pgp_path = g_strdup (pgp_path); -} - -MailConfigHTTPMode -mail_config_get_http_mode (void) -{ - return config->http_mode; -} - -void -mail_config_set_http_mode (MailConfigHTTPMode mode) -{ - config->http_mode = mode; -} - -MailConfigForwardStyle -mail_config_get_default_forward_style (void) -{ - return config->default_forward_style; -} - -void -mail_config_set_default_forward_style (MailConfigForwardStyle style) -{ - config->default_forward_style = style; -} - -MailConfigDisplayStyle -mail_config_get_message_display_style (void) -{ - return config->message_display_style; -} - -void -mail_config_set_message_display_style (MailConfigDisplayStyle style) -{ - config->message_display_style = style; -} - -const char * -mail_config_get_default_charset (void) -{ - return config->default_charset; -} - -void -mail_config_set_default_charset (const char *charset) -{ - g_free (config->default_charset); - config->default_charset = g_strdup (charset); -} - - -gboolean -mail_config_find_account (const MailConfigAccount *account) -{ - return g_slist_find (config->accounts, (gpointer) account) != NULL; -} - -const MailConfigAccount * -mail_config_get_default_account (void) -{ - MailConfigAccount *account; - - if (config == NULL) { - mail_config_init (); - } - - if (!config->accounts) - return NULL; - - account = g_slist_nth_data (config->accounts, - config->default_account); - - /* Looks like we have no default, so make the first account - the default */ - if (account == NULL) { - mail_config_set_default_account_num (0); - account = config->accounts->data; - } - - return account; -} - -const MailConfigAccount * -mail_config_get_account_by_name (const char *account_name) -{ - /* FIXME: this should really use a hash */ - const MailConfigAccount *account; - GSList *l; - - l = config->accounts; - while (l) { - account = l->data; - if (account && !strcmp (account->name, account_name)) - return account; - - l = l->next; - } - - return NULL; -} - -const MailConfigAccount * -mail_config_get_account_by_source_url (const char *source_url) -{ - const MailConfigAccount *account; - CamelProvider *provider; - CamelURL *source; - GSList *l; - - g_return_val_if_fail (source_url != NULL, NULL); - - provider = camel_session_get_provider (session, source_url, NULL); - if (!provider) - return NULL; - - source = camel_url_new (source_url, NULL); - if (!source) - return NULL; - - l = config->accounts; - while (l) { - account = l->data; - - if (account && account->source && account->source->url) { - CamelURL *url; - - url = camel_url_new (account->source->url, NULL); - if (url && provider->url_equal (url, source)) { - camel_url_free (url); - camel_url_free (source); - return account; - } - - if (url) - camel_url_free (url); - } - - l = l->next; - } - - camel_url_free (source); - - return NULL; -} - -const MailConfigAccount * -mail_config_get_account_by_transport_url (const char *transport_url) -{ - const MailConfigAccount *account; - CamelProvider *provider; - CamelURL *transport; - GSList *l; - - g_return_val_if_fail (transport_url != NULL, NULL); - - provider = camel_session_get_provider (session, transport_url, NULL); - if (!provider) - return NULL; - - transport = camel_url_new (transport_url, NULL); - if (!transport) - return NULL; - - l = config->accounts; - while (l) { - account = l->data; - - if (account && account->transport && account->transport->url) { - CamelURL *url; - - url = camel_url_new (account->transport->url, NULL); - if (url && provider->url_equal (url, transport)) { - camel_url_free (url); - camel_url_free (transport); - return account; - } - - if (url) - camel_url_free (url); - } - - l = l->next; - } - - camel_url_free (transport); - - return NULL; -} - -const GSList * -mail_config_get_accounts (void) -{ - g_assert (config != NULL); - - return config->accounts; -} - -static void -add_shortcut_entry (const char *name, const char *uri, const char *type) -{ - extern EvolutionShellClient *global_shell_client; - CORBA_Environment ev; - GNOME_Evolution_Shortcuts shortcuts_interface; - GNOME_Evolution_Shortcuts_Group *the_group; - GNOME_Evolution_Shortcuts_Shortcut *the_shortcut; - int i; - - if (!global_shell_client) - return; - - CORBA_exception_init (&ev); - - shortcuts_interface = evolution_shell_client_get_shortcuts_interface (global_shell_client); - if (CORBA_Object_is_nil (shortcuts_interface, &ev)) { - g_warning ("No ::Shortcut interface on the shell"); - CORBA_exception_free (&ev); - return; - } - - the_group = GNOME_Evolution_Shortcuts_getGroup (shortcuts_interface, 0, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Exception getting first group: %s", ev._repo_id); - CORBA_exception_free (&ev); - return; - } - - the_shortcut = NULL; - for (i = 0; i < the_group->shortcuts._length; i++) { - GNOME_Evolution_Shortcuts_Shortcut *iter; - - iter = the_group->shortcuts._buffer + i; - if (!strcmp (iter->name, name)) { - the_shortcut = iter; - break; - } - } - - if (the_shortcut == NULL) { - the_shortcut = GNOME_Evolution_Shortcuts_Shortcut__alloc (); - the_shortcut->name = CORBA_string_dup (name); - the_shortcut->uri = CORBA_string_dup (uri); - the_shortcut->type = CORBA_string_dup (type); - - GNOME_Evolution_Shortcuts_add (shortcuts_interface, - 0, -1, /* "end of list" */ - the_shortcut, - &ev); - - CORBA_free (the_shortcut); - - if (ev._major != CORBA_NO_EXCEPTION) - g_warning ("Exception creating shortcut \"%s\": %s", name, ev._repo_id); - } - - CORBA_free (the_group); - CORBA_exception_free (&ev); -} - -static void -add_new_storage (const char *url, const char *name) -{ - extern EvolutionShellClient *global_shell_client; - GNOME_Evolution_Shell corba_shell; - - corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (global_shell_client)); - mail_load_storage_by_uri (corba_shell, url, name); -} - -static void -new_source_created (MailConfigAccount *account) -{ - CamelProvider *prov; - CamelFolder *inbox; - CamelException ex; - gchar *name; - gchar *url; - - /* no source, don't bother. */ - if (!account->source || !account->source->url) - return; - - camel_exception_init (&ex); - prov = camel_session_get_provider (session, account->source->url, &ex); - if (camel_exception_is_set (&ex)) { - g_warning ("Configured provider that doesn't exist?"); - camel_exception_clear (&ex); - return; - } - - /* not a storage, don't bother. */ - if (!(prov->flags & CAMEL_PROVIDER_IS_STORAGE) || - (prov->flags & CAMEL_PROVIDER_IS_EXTERNAL)) - return; - - inbox = mail_tool_get_inbox (account->source->url, &ex); - if (camel_exception_is_set (&ex)) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Could not get inbox for new mail store:\n%s\n" - "No shortcut will be created."), - camel_exception_get_description (&ex)); - camel_exception_clear (&ex); - return; - } - - if (inbox) { - /* Create the shortcut. FIXME: This only works if the - * full name matches the path. - */ - name = g_strdup_printf (U_("%s: Inbox"), account->name); - url = g_strdup_printf ("evolution:/%s/%s", account->name, - inbox->full_name); - add_shortcut_entry (name, url, "mail"); - g_free (name); - g_free (url); - - /* If we unref inbox here, it will disconnect from the - * store, but then add_new_storage will reconnect. So - * we'll keep holding the ref until after that. - */ - } - - /* add the storage to the folder tree */ - add_new_storage (account->source->url, account->name); - - if (inbox) - camel_object_unref (CAMEL_OBJECT (inbox)); -} - -void -mail_config_add_account (MailConfigAccount *account) -{ - config->accounts = g_slist_append (config->accounts, account); - - if (account->source && account->source->url) - new_source_created (account); -} - -static void -remove_account_shortcuts (MailConfigAccount *account) -{ - extern EvolutionShellClient *global_shell_client; - CORBA_Environment ev; - GNOME_Evolution_Shortcuts shortcuts_interface; - GNOME_Evolution_Shortcuts_GroupList *groups; - int i, j, len;; - - CORBA_exception_init (&ev); - - shortcuts_interface = evolution_shell_client_get_shortcuts_interface (global_shell_client); - if (CORBA_Object_is_nil (shortcuts_interface, &ev)) { - g_warning ("No ::Shortcut interface on the shell"); - CORBA_exception_free (&ev); - return; - } - - groups = GNOME_Evolution_Shortcuts__get_groups (shortcuts_interface, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Exception getting the groups: %s", ev._repo_id); - CORBA_exception_free (&ev); - return; - } - - len = strlen (account->name); - - for (i = 0; i < groups->_length; i++) { - GNOME_Evolution_Shortcuts_Group *iter; - - iter = groups->_buffer + i; - - for (j = 0; j < iter->shortcuts._length; j++) { - GNOME_Evolution_Shortcuts_Shortcut *sc; - - sc = iter->shortcuts._buffer + j; - - /* "evolution:/" = 11 */ - if (!strncmp (sc->uri + 11, account->name, len)) { - GNOME_Evolution_Shortcuts_remove (shortcuts_interface, i, j, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Exception removing shortcut \"%s\": %s", sc->name, ev._repo_id); - break; - } - } - } - } - - CORBA_exception_free (&ev); - CORBA_free (groups); -} - -const GSList * -mail_config_remove_account (MailConfigAccount *account) -{ - int index; - - /* Removing the current default, so make the first account the - default */ - if (account == mail_config_get_default_account ()) { - config->default_account = 0; - } else { - /* adjust the default to make sure it points to the same one */ - index = g_slist_index (config->accounts, account); - if (config->default_account > index) - config->default_account--; - } - - config->accounts = g_slist_remove (config->accounts, account); - remove_account_shortcuts (account); - account_destroy (account); - - return config->accounts; -} - -gint -mail_config_get_default_account_num (void) -{ - return config->default_account; -} - -static void -mail_config_set_default_account_num (gint new_default) -{ - config->default_account = new_default; -} - -void -mail_config_set_default_account (const MailConfigAccount *account) -{ - int index; - - index = g_slist_index (config->accounts, (void *) account); - if (index == -1) - return; - - config->default_account = index; - - return; -} - -const MailConfigIdentity * -mail_config_get_default_identity (void) -{ - const MailConfigAccount *account; - - account = mail_config_get_default_account (); - if (account) - return account->id; - else - return NULL; -} - -const MailConfigService * -mail_config_get_default_transport (void) -{ - const MailConfigAccount *account; - - account = mail_config_get_default_account (); - if (account) - return account->transport; - else - return NULL; -} - -const MailConfigService * -mail_config_get_default_news (void) -{ - if (!config->news) - return NULL; - - return (MailConfigService *)config->news->data; -} - -const GSList * -mail_config_get_news (void) -{ - return config->news; -} - -void -mail_config_add_news (MailConfigService *news) -{ - config->news = g_slist_append (config->news, news); -} - -const GSList * -mail_config_remove_news (MailConfigService *news) -{ - config->news = g_slist_remove (config->news, news); - service_destroy (news); - - return config->news; -} - -GSList * -mail_config_get_sources (void) -{ - const GSList *accounts; - GSList *sources = NULL; - - accounts = mail_config_get_accounts (); - while (accounts) { - const MailConfigAccount *account = accounts->data; - - if (account->source) - sources = g_slist_append (sources, account->source); - - accounts = accounts->next; - } - - return sources; -} - -void -mail_config_service_set_save_passwd (MailConfigService *service, gboolean save_passwd) -{ - service->save_passwd = save_passwd; -} - -char * -mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix) -{ - CamelService *service = CAMEL_SERVICE (folder->parent_store); - char *service_url, *url, *filename; - - service_url = camel_url_to_string (service->url, CAMEL_URL_HIDE_ALL); - url = g_strdup_printf ("%s/%s", service_url, folder->full_name); - g_free (service_url); - - e_filename_make_safe (url); - - filename = g_strdup_printf ("%s/config/%s%s", evolution_dir, prefix, url); - g_free (url); - - return filename; -} - - -/* Async service-checking/authtype-lookup code. */ -struct _check_msg { - struct _mail_msg msg; - - const char *url; - CamelProviderType type; - GList **authtypes; - gboolean *success; -}; - -static char * -check_service_describe (struct _mail_msg *mm, int complete) -{ - return g_strdup (_("Checking Service")); -} - -static void -check_service_check (struct _mail_msg *mm) -{ - struct _check_msg *m = (struct _check_msg *)mm; - CamelService *service = NULL; - - camel_operation_register(mm->cancel); - - service = camel_session_get_service (session, m->url, m->type, &mm->ex); - if (!service) { - camel_operation_unregister(mm->cancel); - return; - } - - if (m->authtypes) - *m->authtypes = camel_service_query_auth_types (service, &mm->ex); - else - camel_service_connect (service, &mm->ex); - - camel_object_unref (CAMEL_OBJECT (service)); - *m->success = !camel_exception_is_set(&mm->ex); - - camel_operation_unregister(mm->cancel); -} - -static struct _mail_msg_op check_service_op = { - check_service_describe, - check_service_check, - NULL, - NULL -}; - -static void -check_cancelled (GnomeDialog *dialog, int button, gpointer data) -{ - int *msg_id = data; - - mail_msg_cancel (*msg_id); -} - -/** - * mail_config_check_service: - * @url: service url - * @type: provider type - * @authtypes: set to list of supported authtypes on return if non-%NULL. - * - * Checks the service for validity. If @authtypes is non-%NULL, it will - * be filled in with a list of supported authtypes. - * - * Return value: %TRUE on success or %FALSE on error. - **/ -gboolean -mail_config_check_service (const char *url, CamelProviderType type, GList **authtypes, GtkWindow *window) -{ - gboolean ret = FALSE; - struct _check_msg *m; - int id; - GtkWidget *dialog, *label; - - m = mail_msg_new(&check_service_op, NULL, sizeof(*m)); - m->url = url; - m->type = type; - m->authtypes = authtypes; - m->success = &ret; - - id = m->msg.seq; - e_thread_put(mail_thread_queued, (EMsg *)m); - - dialog = gnome_dialog_new (_("Connecting to server..."), - GNOME_STOCK_BUTTON_CANCEL, - NULL); - gnome_dialog_set_parent (GNOME_DIALOG (dialog), window); - label = gtk_label_new (_("Connecting to server...")); - gtk_box_pack_start (GTK_BOX(GNOME_DIALOG (dialog)->vbox), - label, TRUE, TRUE, 10); - gnome_dialog_set_close (GNOME_DIALOG (dialog), FALSE); - gtk_signal_connect (GTK_OBJECT (dialog), "clicked", - GTK_SIGNAL_FUNC (check_cancelled), &id); - gtk_window_set_modal (GTK_WINDOW (dialog), FALSE); - gtk_widget_show_all (dialog); - - mail_msg_wait(id); - - gtk_widget_destroy (dialog); - - return ret; -} - -/* MailConfig Bonobo object */ -#define PARENT_TYPE BONOBO_X_OBJECT_TYPE -static BonoboObjectClass *parent_class = NULL; - -/* For the bonobo object */ -typedef struct _EvolutionMailConfig EvolutionMailConfig; -typedef struct _EvolutionMailConfigClass EvolutionMailConfigClass; - -struct _EvolutionMailConfig { - BonoboXObject parent; -}; - -struct _EvolutionMailConfigClass { - BonoboXObjectClass parent_class; - - POA_GNOME_Evolution_MailConfig__epv epv; -}; - -static void -impl_GNOME_Evolution_MailConfig_addAccount (PortableServer_Servant servant, - const GNOME_Evolution_MailConfig_Account *account, - CORBA_Environment *ev) -{ - GNOME_Evolution_MailConfig_Service source, transport; - GNOME_Evolution_MailConfig_Identity id; - MailConfigAccount *mail_account; - MailConfigService *mail_service; - MailConfigIdentity *mail_id; - - if (mail_config_get_account_by_name (account->name)) { - /* FIXME: we need an exception. */ - return; - } - - mail_account = g_new0 (MailConfigAccount, 1); - mail_account->name = g_strdup (account->name); - - /* Copy ID */ - id = account->id; - mail_id = g_new0 (MailConfigIdentity, 1); - mail_id->name = g_strdup (id.name); - mail_id->address = g_strdup (id.address); - mail_id->organization = g_strdup (id.organization); - mail_id->signature = g_strdup (id.signature); - mail_id->html_signature = g_strdup (id.html_signature); - mail_id->has_html_signature = id.has_html_signature; - - mail_account->id = mail_id; - - /* Copy source */ - source = account->source; - mail_service = g_new0 (MailConfigService, 1); - if (source.url == NULL || strcmp (source.url, "none://") == 0) { - mail_service->url = NULL; - } else { - mail_service->url = g_strdup (source.url); - } - mail_service->keep_on_server = source.keep_on_server; - mail_service->auto_check = source.auto_check; - mail_service->auto_check_time = source.auto_check_time; - mail_service->save_passwd = source.save_passwd; - mail_service->enabled = source.enabled; - - mail_account->source = mail_service; - - /* Copy transport */ - transport = account->transport; - mail_service = g_new0 (MailConfigService, 1); - if (transport.url == NULL) { - mail_service->url = NULL; - } else { - mail_service->url = g_strdup (transport.url); - } - mail_service->url = g_strdup (transport.url); - mail_service->keep_on_server = transport.keep_on_server; - mail_service->auto_check = transport.auto_check; - mail_service->auto_check_time = transport.auto_check_time; - mail_service->save_passwd = transport.save_passwd; - mail_service->enabled = transport.enabled; - - mail_account->transport = mail_service; - - /* Add new account */ - mail_config_add_account (mail_account); -} - -static void -evolution_mail_config_class_init (EvolutionMailConfigClass *klass) -{ - POA_GNOME_Evolution_MailConfig__epv *epv = &klass->epv; - - parent_class = gtk_type_class (PARENT_TYPE); - epv->addAccount = impl_GNOME_Evolution_MailConfig_addAccount; -} - -static void -evolution_mail_config_init (EvolutionMailConfig *config) -{ -} - -BONOBO_X_TYPE_FUNC_FULL (EvolutionMailConfig, - GNOME_Evolution_MailConfig, - PARENT_TYPE, - evolution_mail_config); - -static BonoboObject * -evolution_mail_config_factory_fn (BonoboGenericFactory *factory, - void *closure) -{ - EvolutionMailConfig *config; - - config = gtk_type_new (evolution_mail_config_get_type ()); - return BONOBO_OBJECT (config); -} - -gboolean -evolution_mail_config_factory_init (void) -{ - BonoboGenericFactory *factory; - - factory = bonobo_generic_factory_new (MAIL_CONFIG_IID, - evolution_mail_config_factory_fn, - NULL); - if (factory == NULL) { - g_warning ("Error starting MailConfig"); - return FALSE; - } - - bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory)); - return TRUE; -} diff --git a/mail/mail-config.glade b/mail/mail-config.glade deleted file mode 100644 index 4f53b4c583..0000000000 --- a/mail/mail-config.glade +++ /dev/null @@ -1,3145 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>config</name> - <program_name>config</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>../art</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> - <output_main_file>False</output_main_file> - <output_support_files>False</output_support_files> - <output_build_files>False</output_build_files> -</project> - -<widget> - <class>GtkWindow</class> - <name>druid_window</name> - <visible>False</visible> - <title>window1</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - - <widget> - <class>GnomeDruid</class> - <name>druid</name> - - <widget> - <class>GnomeDruidPageStart</class> - <name>druidpagestart1</name> - <title>Mail Configuration</title> - <text>Welcome to the Evolution Mail Configuration Assistant. - -Click "Next" to begin. </text> - <title_color>255,255,255</title_color> - <text_color>0,0,0</text_color> - <background_color>0,0,0</background_color> - <logo_background_color>0,0,0</logo_background_color> - <textbox_color>255,255,255</textbox_color> - <logo_image>mail-config-druid.png</logo_image> - </widget> - - <widget> - <class>GnomeDruidPageStandard</class> - <name>identity_page</name> - <title>Identity</title> - <title_color>255,255,255</title_color> - <background_color>0,0,0</background_color> - <logo_background_color>0,0,0</logo_background_color> - <logo_image>mail-config-druid-identity.png</logo_image> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDruidPageStandard:vbox</child_name> - <name>druid_identity_vbox</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GnomeDruidPageStandard</class> - <name>source_page</name> - <title>Receiving Email</title> - <title_color>255,255,255</title_color> - <background_color>0,0,0</background_color> - <logo_background_color>0,0,0</logo_background_color> - <logo_image>mail-config-druid-receive.png</logo_image> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDruidPageStandard:vbox</child_name> - <name>druid_source_vbox</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GnomeDruidPageStandard</class> - <name>extra_page</name> - <title>Receiving Email</title> - <title_color>255,255,255</title_color> - <background_color>0,0,0</background_color> - <logo_background_color>0,0,0</logo_background_color> - <logo_image>mail-config-druid-receive.png</logo_image> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDruidPageStandard:vbox</child_name> - <name>druid_extra_vbox</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GnomeDruidPageStandard</class> - <name>transport_page</name> - <title>Sending Email</title> - <title_color>255,255,255</title_color> - <background_color>0,0,0</background_color> - <logo_background_color>0,0,0</logo_background_color> - <logo_image>mail-config-druid-send.png</logo_image> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDruidPageStandard:vbox</child_name> - <name>druid_transport_vbox</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GnomeDruidPageStandard</class> - <name>management_page</name> - <title>Account Management</title> - <title_color>255,255,255</title_color> - <background_color>0,0,0</background_color> - <logo_background_color>0,0,0</logo_background_color> - <logo_image>mail-config-druid-account-name.png</logo_image> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDruidPageStandard:vbox</child_name> - <name>druid_management_vbox</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GnomeDruidPageFinish</class> - <name>finish_page</name> - <title>Done</title> - <text>Congratulations, your mail configuration is complete. - -You are now ready to send and receive email -using Evolution. - -Click "Finish" to save your settings.</text> - <background_color>0,0,0</background_color> - <logo_background_color>0,0,0</logo_background_color> - <textbox_color>255,255,255</textbox_color> - <text_color>0,0,0</text_color> - <title_color>255,255,255</title_color> - <logo_image>thankyou.png</logo_image> - </widget> - </widget> -</widget> - -<widget> - <class>GtkWindow</class> - <name>account_editor_window</name> - <visible>False</visible> - <title>window1</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - - <widget> - <class>GtkNotebook</class> - <name>account_editor_notebook</name> - <can_focus>True</can_focus> - <show_tabs>True</show_tabs> - <show_border>True</show_border> - <tab_pos>GTK_POS_TOP</tab_pos> - <scrollable>False</scrollable> - <tab_hborder>2</tab_hborder> - <tab_vborder>2</tab_vborder> - <popup_enable>False</popup_enable> - - <widget> - <class>GtkVBox</class> - <name>identity_vbox</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkFrame</class> - <name>management_frame</name> - <border_width>3</border_width> - <label>Account Information</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkVBox</class> - <name>vbox31</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkHBox</class> - <name>hbox24</name> - <border_width>3</border_width> - <homogeneous>False</homogeneous> - <spacing>5</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>management_name_label</name> - <label>_Name:</label> - <justify>GTK_JUSTIFY_RIGHT</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>management_name</focus_target> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>management_name</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>management_default</name> - <can_focus>True</can_focus> - <label>Make this my _default account</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>identity_required_frame</name> - <border_width>3</border_width> - <label>Required Information</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkTable</class> - <name>table1</name> - <border_width>4</border_width> - <rows>2</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>4</row_spacing> - <column_spacing>4</column_spacing> - - <widget> - <class>GtkEntry</class> - <name>identity_full_name</name> - <width>80</width> - <height>20</height> - <can_focus>True</can_focus> - <has_focus>True</has_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>50</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>identity_address</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>50</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>identity_address_label</name> - <label>_Email Address:</label> - <justify>GTK_JUSTIFY_RIGHT</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>identity_address</focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>identity_full_name_label</name> - <label>_Full Name:</label> - <justify>GTK_JUSTIFY_RIGHT</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>identity_full_name</focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>identity_optional_frame</name> - <border_width>3</border_width> - <label>Optional Information</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkTable</class> - <name>table2</name> - <border_width>4</border_width> - <rows>3</rows> - <columns>3</columns> - <homogeneous>False</homogeneous> - <row_spacing>4</row_spacing> - <column_spacing>4</column_spacing> - - <widget> - <class>GnomeFileEntry</class> - <name>fileentry_signature</name> - <history_id>sig-file-gnome-entry</history_id> - <max_saved>10</max_saved> - <title>Signature file:</title> - <directory>False</directory> - <modal>False</modal> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - - <widget> - <class>GtkEntry</class> - <child_name>GnomeEntry:entry</child_name> - <name>entry_signature</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <name>identity_organization_label</name> - <label>_Organization:</label> - <justify>GTK_JUSTIFY_RIGHT</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>7</xpad> - <ypad>0</ypad> - <focus_target>identity_organization</focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>check_html_signature</name> - <can_focus>True</can_focus> - <label>_HTML Signature:</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GnomeFileEntry</class> - <name>fileentry_html_signature</name> - <history_id>html-sig-file-gnome-entry</history_id> - <max_saved>10</max_saved> - <title>HTML signature file:</title> - <directory>False</directory> - <modal>False</modal> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - - <widget> - <class>GtkEntry</class> - <child_name>GnomeEntry:entry</child_name> - <name>entry_html_signature</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <name>identity_signature_label</name> - <label>_Signature file:</label> - <justify>GTK_JUSTIFY_RIGHT</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>7</xpad> - <ypad>0</ypad> - <focus_target>entry_signature</focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>identity_organization</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>3</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button_edit_signature</name> - <can_focus>True</can_focus> - <label>Edit...</label> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <left_attach>2</left_attach> - <right_attach>3</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button_edit_html_signature</name> - <can_focus>True</can_focus> - <label>Edit...</label> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <left_attach>2</left_attach> - <right_attach>3</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>label31</name> - <label>Identity</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - - <widget> - <class>GtkVBox</class> - <name>source_vbox</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkTable</class> - <name>table3</name> - <border_width>3</border_width> - <rows>1</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>0</row_spacing> - <column_spacing>2</column_spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>source_type_label</name> - <label>_Server Type: </label> - <justify>GTK_JUSTIFY_RIGHT</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>2</xpad> - <ypad>0</ypad> - <focus_target>source_type_omenu</focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>source_type_omenu</name> - <can_focus>True</can_focus> - <items>POP -IMAPv4 -Standard Unix mbox -Qmail maildir -None -</items> - <initial_choice>1</initial_choice> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>False</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox58</name> - <border_width>3</border_width> - <homogeneous>False</homogeneous> - <spacing>2</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label46</name> - <label>Description:</label> - <justify>GTK_JUSTIFY_RIGHT</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>2</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>source_description</name> - <label>description</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>source_frame</name> - <border_width>3</border_width> - <label>Configuration</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkTable</class> - <name>table4</name> - <border_width>3</border_width> - <rows>5</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>3</row_spacing> - <column_spacing>3</column_spacing> - - <widget> - <class>GtkLabel</class> - <name>source_host_label</name> - <label>_Host:</label> - <justify>GTK_JUSTIFY_RIGHT</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>source_host</focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>source_user_label</name> - <label>_Username:</label> - <justify>GTK_JUSTIFY_RIGHT</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>source_user</focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>source_host</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>source_user</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>source_path_label</name> - <label>_Path:</label> - <justify>GTK_JUSTIFY_RIGHT</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>source_path</focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>source_use_ssl</name> - <can_focus>True</can_focus> - <label>Use s_ecure connection (SSL)</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <left_attach>0</left_attach> - <right_attach>2</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GnomeFileEntry</class> - <name>source_path_entry</name> - <max_saved>10</max_saved> - <title>Mailbox location</title> - <directory>False</directory> - <modal>False</modal> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - - <widget> - <class>GtkEntry</class> - <child_name>GnomeEntry:entry</child_name> - <name>source_path</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <name>source_ssl_disabled</name> - <sensitive>False</sensitive> - <label>(SSL is not supported in this build of evolution)</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>2</right_attach> - <top_attach>4</top_attach> - <bottom_attach>5</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>source_auth_frame</name> - <border_width>3</border_width> - <label>Authentication</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkVBox</class> - <name>vbox60</name> - <border_width>3</border_width> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkHBox</class> - <name>hbox44</name> - <homogeneous>False</homogeneous> - <spacing>3</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>source_auth_label</name> - <label>_Authentication Type: </label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <default_focus_target>source_auth_omenu</default_focus_target> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>source_auth_omenu</name> - <can_focus>True</can_focus> - <items>Password -Kerberos -</items> - <initial_choice>0</initial_choice> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment1</name> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xscale>1</xscale> - <yscale>1</yscale> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - <pack>GTK_PACK_END</pack> - </child> - - <widget> - <class>GtkButton</class> - <name>source_check_supported</name> - <can_focus>True</can_focus> - <label> _Check for supported types </label> - <relief>GTK_RELIEF_NORMAL</relief> - </widget> - </widget> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>source_remember_password</name> - <can_focus>True</can_focus> - <label>Re_member this password</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>label32</name> - <label>Receiving Mail</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - - <widget> - <class>GtkVBox</class> - <name>extra_vbox</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkFrame</class> - <name>extra_mailcheck_frame</name> - <label>Checking for New Mail</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkVBox</class> - <name>extra_mailcheck_vbox</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkHBox</class> - <name>hbox53</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkCheckButton</class> - <name>extra_auto_check</name> - <can_focus>True</can_focus> - <label>_Automatically check for new mail</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label53</name> - <label>_every</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>3</xpad> - <ypad>0</ypad> - <focus_target>extra_auto_check_min</focus_target> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkSpinButton</class> - <name>extra_auto_check_min</name> - <can_focus>True</can_focus> - <climb_rate>1</climb_rate> - <digits>0</digits> - <numeric>True</numeric> - <update_policy>GTK_UPDATE_ALWAYS</update_policy> - <snap>False</snap> - <wrap>False</wrap> - <value>10</value> - <lower>1</lower> - <upper>1440</upper> - <step>1</step> - <page>10</page> - <page_size>10</page_size> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label36</name> - <label>minute(s)</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>label33</name> - <label>Receiving Options</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - - <widget> - <class>GtkVBox</class> - <name>transport_vbox</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkTable</class> - <name>table5</name> - <border_width>3</border_width> - <rows>1</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>0</row_spacing> - <column_spacing>2</column_spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>transport_type_label</name> - <label>Server _Type: </label> - <justify>GTK_JUSTIFY_RIGHT</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>2</xpad> - <ypad>0</ypad> - <focus_target>transport_type_omenu</focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>transport_type_omenu</name> - <can_focus>True</can_focus> - <items>SMTP -Sendmail -</items> - <initial_choice>0</initial_choice> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>False</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox59</name> - <border_width>3</border_width> - <homogeneous>False</homogeneous> - <spacing>2</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label50</name> - <label>Description:</label> - <justify>GTK_JUSTIFY_RIGHT</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0</yalign> - <xpad>2</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>transport_description</name> - <label>description</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>7.45058e-09</xalign> - <yalign>0</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>transport_frame</name> - <border_width>3</border_width> - <label>Server Configuration</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkVBox</class> - <name>vbox12</name> - <border_width>3</border_width> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkTable</class> - <name>table6</name> - <rows>1</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>4</row_spacing> - <column_spacing>4</column_spacing> - <child> - <padding>4</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>transport_host_label</name> - <label>_Host:</label> - <justify>GTK_JUSTIFY_RIGHT</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>transport_host</focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>transport_host</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>transport_use_ssl</name> - <can_focus>True</can_focus> - <label>Use s_ecure connection (SSL)</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>transport_ssl_disabled</name> - <sensitive>False</sensitive> - <label>(SSL is not supported in this build of evolution)</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>transport_needs_auth</name> - <can_focus>True</can_focus> - <label>Ser_ver requires authentication</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>transport_auth_frame</name> - <border_width>3</border_width> - <label>Authentication</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkVBox</class> - <name>vbox61</name> - <border_width>3</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkHBox</class> - <name>hbox49</name> - <homogeneous>False</homogeneous> - <spacing>3</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>transport_auth_label</name> - <label>_Authentication Type: </label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <default_focus_target>transport_auth_omenu</default_focus_target> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>transport_auth_omenu</name> - <can_focus>True</can_focus> - <items>Password -Kerberos -</items> - <initial_choice>1</initial_choice> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment2</name> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xscale>1</xscale> - <yscale>1</yscale> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - <pack>GTK_PACK_END</pack> - </child> - - <widget> - <class>GtkButton</class> - <name>transport_check_supported</name> - <can_focus>True</can_focus> - <label> _Check for supported types </label> - <relief>GTK_RELIEF_NORMAL</relief> - </widget> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox52</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>transport_user_label</name> - <label>_Username:</label> - <justify>GTK_JUSTIFY_RIGHT</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <default_focus_target>transport_user</default_focus_target> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>transport_user</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>transport_remember_password</name> - <can_focus>True</can_focus> - <label>_Remember this password</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>label34</name> - <label>Sending Mail</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - - <widget> - <class>GtkVBox</class> - <name>folders_vbox</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkFrame</class> - <name>folders_frame</name> - <border_width>3</border_width> - <label>Sent and Draft Messages</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkTable</class> - <name>table7</name> - <border_width>3</border_width> - <rows>2</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>4</row_spacing> - <column_spacing>4</column_spacing> - - <widget> - <class>GtkLabel</class> - <name>drafts_label</name> - <label>_Drafts folder:</label> - <justify>GTK_JUSTIFY_RIGHT</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>drafts_button</focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>sent_label</name> - <label>Sent _messages folder:</label> - <justify>GTK_JUSTIFY_RIGHT</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>sent_button</focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>drafts_button</name> - <can_focus>True</can_focus> - <label>Drafts</label> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>sent_button</name> - <can_focus>True</can_focus> - <label>Sent</label> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>label35</name> - <label>Special Folders</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - - <widget> - <class>GtkVBox</class> - <name>security_vbox</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkFrame</class> - <name>pgp_frame</name> - <border_width>4</border_width> - <label>Pretty Good Privacy</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkTable</class> - <name>pgp_table</name> - <border_width>3</border_width> - <rows>3</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>4</row_spacing> - <column_spacing>4</column_spacing> - - <widget> - <class>GtkLabel</class> - <name>pgp_key_id_label</name> - <label>PGP _Key ID:</label> - <justify>GTK_JUSTIFY_RIGHT</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <default_focus_target>pgp_key</default_focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>pgp_key</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>pgp_encrypt_to_self</name> - <can_focus>True</can_focus> - <label>Always _encrypt to myself when sending encrypted mail</label> - <active>True</active> - <draw_indicator>True</draw_indicator> - <child> - <left_attach>0</left_attach> - <right_attach>2</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>pgp_always_sign</name> - <can_focus>True</can_focus> - <label>Always _sign outgoing messages when using this account</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <left_attach>0</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>smime_frame</name> - <border_width>4</border_width> - <label>Secure MIME</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkTable</class> - <name>smime_table</name> - <border_width>3</border_width> - <rows>3</rows> - <columns>3</columns> - <homogeneous>False</homogeneous> - <row_spacing>4</row_spacing> - <column_spacing>4</column_spacing> - - <widget> - <class>GtkLabel</class> - <name>smime_key_label</name> - <label>_Certificate ID:</label> - <justify>GTK_JUSTIFY_RIGHT</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <default_focus_target>smime_key</default_focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>smime_key</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>smime_encrypt_to_self</name> - <can_focus>True</can_focus> - <label>A_lways encrypt to myself when sending encrypted mail</label> - <active>True</active> - <draw_indicator>True</draw_indicator> - <child> - <left_attach>0</left_attach> - <right_attach>2</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>digital_ids</name> - <can_focus>True</can_focus> - <label>Digital IDs...</label> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <left_attach>2</left_attach> - <right_attach>3</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>smime_always_sign</name> - <can_focus>True</can_focus> - <label>_Always sign outgoing messages when using this account</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <left_attach>0</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GnomeHRef</class> - <name>get_digital_id</name> - <can_focus>True</can_focus> - <url>http://www.verisign.com/products/class1/index.html</url> - <label>Get Digital ID...</label> - <child> - <left_attach>2</left_attach> - <right_attach>3</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>lblSecurity</name> - <label>Security</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> -</widget> - -<widget> - <class>GtkWindow</class> - <name>news_editor_window</name> - <visible>False</visible> - <title>newswindow1</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - - <widget> - <class>GtkNotebook</class> - <name>news_editor_notebook</name> - <can_focus>True</can_focus> - <show_tabs>True</show_tabs> - <show_border>True</show_border> - <tab_pos>GTK_POS_TOP</tab_pos> - <scrollable>False</scrollable> - <tab_hborder>2</tab_hborder> - <tab_vborder>2</tab_vborder> - <popup_enable>False</popup_enable> - - <widget> - <class>GtkVBox</class> - <name>news_vbox</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkFrame</class> - <name>news_frame</name> - <border_width>3</border_width> - <label>Source Information</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkVBox</class> - <name>vbox31</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkHBox</class> - <name>hbox24</name> - <border_width>3</border_width> - <homogeneous>False</homogeneous> - <spacing>5</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>source_name_label</name> - <label>NNTP Server:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>source_name</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>label38</name> - <label>Source</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> -</widget> - -<widget> - <class>GtkWindow</class> - <name>mail_accounts_window</name> - <visible>False</visible> - <title>Mail Settings</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - - <widget> - <class>GtkNotebook</class> - <name>notebook</name> - <can_focus>True</can_focus> - <show_tabs>True</show_tabs> - <show_border>True</show_border> - <tab_pos>GTK_POS_TOP</tab_pos> - <scrollable>False</scrollable> - <tab_hborder>2</tab_hborder> - <tab_vborder>2</tab_vborder> - <popup_enable>False</popup_enable> - - <widget> - <class>GtkHBox</class> - <name>hbox54</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkScrolledWindow</class> - <name>scrolledwindow1</name> - <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy> - <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> - <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> - <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkCList</class> - <name>clistAccounts</name> - <can_focus>True</can_focus> - <columns>3</columns> - <column_widths>53,145,38</column_widths> - <selection_mode>GTK_SELECTION_SINGLE</selection_mode> - <show_titles>True</show_titles> - <shadow_type>GTK_SHADOW_IN</shadow_type> - - <widget> - <class>GtkLabel</class> - <child_name>CList:title</child_name> - <name>lblEnable</name> - <label>Enabled</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>CList:title</child_name> - <name>lblAccount</name> - <label>Account</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>CList:title</child_name> - <name>lblType</name> - <label>Type</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox62</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label52</name> - <label> -</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkVButtonBox</class> - <name>vbuttonbox1</name> - <layout_style>GTK_BUTTONBOX_START</layout_style> - <spacing>0</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkButton</class> - <name>cmdMailAdd</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <label>_Add</label> - <relief>GTK_RELIEF_NORMAL</relief> - </widget> - - <widget> - <class>GtkButton</class> - <name>cmdMailEdit</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <label>_Edit</label> - <relief>GTK_RELIEF_NORMAL</relief> - </widget> - - <widget> - <class>GtkButton</class> - <name>cmdMailDelete</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <label>_Delete</label> - <relief>GTK_RELIEF_NORMAL</relief> - </widget> - </widget> - - <widget> - <class>GtkHSeparator</class> - <name>hseparator1</name> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkVButtonBox</class> - <name>vbuttonbox3</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>0</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkButton</class> - <name>cmdMailDefault</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <label>De_fault</label> - <relief>GTK_RELIEF_NORMAL</relief> - </widget> - - <widget> - <class>GtkButton</class> - <name>cmdMailAble</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <label>E_nable</label> - <relief>GTK_RELIEF_NORMAL</relief> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>accounts_config_label</name> - <label>Accounts</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox37</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkScrolledWindow</class> - <name>scrolledwindow2</name> - <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy> - <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> - <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> - <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkCList</class> - <name>clistNews</name> - <can_focus>True</can_focus> - <columns>1</columns> - <column_widths>80</column_widths> - <selection_mode>GTK_SELECTION_SINGLE</selection_mode> - <show_titles>True</show_titles> - <shadow_type>GTK_SHADOW_IN</shadow_type> - - <widget> - <class>GtkLabel</class> - <child_name>CList:title</child_name> - <name>lblSources</name> - <label>Sources</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> - </widget> - - <widget> - <class>GtkVButtonBox</class> - <name>vbuttonbox2</name> - <layout_style>GTK_BUTTONBOX_START</layout_style> - <spacing>0</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkButton</class> - <name>cmdNewsAdd</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <label>_Add</label> - <relief>GTK_RELIEF_NORMAL</relief> - </widget> - - <widget> - <class>GtkButton</class> - <name>cmdNewsEdit</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <label>_Edit</label> - <relief>GTK_RELIEF_NORMAL</relief> - </widget> - - <widget> - <class>GtkButton</class> - <name>cmdNewsDelete</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <label>_Delete</label> - <relief>GTK_RELIEF_NORMAL</relief> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>news_config_label</name> - <label>News</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox38</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkHBox</class> - <name>hbox42</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkCheckButton</class> - <name>chckHighlightCitations</name> - <can_focus>True</can_focus> - <label>_Highlight citations with</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GnomeColorPicker</class> - <name>colorpickerCitations</name> - <can_focus>True</can_focus> - <dither>True</dither> - <use_alpha>False</use_alpha> - <title>Pick a color</title> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label1</name> - <label> color</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox38</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkCheckButton</class> - <name>checkMarkTimeout</name> - <can_focus>True</can_focus> - <label>_Mark messages as Read after</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkSpinButton</class> - <name>spinMarkTimeout</name> - <can_focus>True</can_focus> - <climb_rate>1</climb_rate> - <digits>1</digits> - <numeric>True</numeric> - <update_policy>GTK_UPDATE_IF_VALID</update_policy> - <snap>False</snap> - <wrap>False</wrap> - <value>1.5</value> - <lower>0</lower> - <upper>10</upper> - <step>0.1</step> - <page>1</page> - <page_size>1</page_size> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>lblSeconds</name> - <label>seconds.</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>4</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frame1</name> - <label>In HTML mail</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkVBox</class> - <name>vbox65</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkRadioButton</class> - <name>radioImagesNever</name> - <can_focus>True</can_focus> - <label>_Never load images off the net</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>images</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkRadioButton</class> - <name>radioImagesSometimes</name> - <can_focus>True</can_focus> - <label>_Load images if sender is in addressbook</label> - <active>True</active> - <draw_indicator>True</draw_indicator> - <group>images</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkRadioButton</class> - <name>radioImagesAlways</name> - <can_focus>True</can_focus> - <label>_Always load images off the net</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>images</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>display_config_label</name> - <label>Display</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox63</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkCheckButton</class> - <name>chkSendHTML</name> - <can_focus>True</can_focus> - <label>_Send mail in HTML format by default.</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox55</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label39</name> - <label>Default Forward style is: </label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>omenuForwardStyle</name> - <can_focus>True</can_focus> - <items>Attachment -Inline -Quoted -</items> - <initial_choice>0</initial_choice> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>chkPromptEmptySubject</name> - <can_focus>True</can_focus> - <label>Prompt when sending messages with an _empty subject</label> - <active>True</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>chkPromptBccOnly</name> - <can_focus>True</can_focus> - <label>Prompt when sending messages with only _Bcc recipients defined</label> - <active>True</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>chkPromptWantHTML</name> - <can_focus>True</can_focus> - <label>Prompt when sending HTML messages to contacts that don't want them</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>composer_config_label</name> - <label>Composer</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox64</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - - <widget> - <class>GtkHBox</class> - <name>hbox41</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>lblPgpPath</name> - <label>_PGP binary path:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <default_focus_target>combo-entry1</default_focus_target> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GnomeFileEntry</class> - <name>filePgpPath</name> - <max_saved>10</max_saved> - <title>Select PGP binary</title> - <directory>False</directory> - <modal>True</modal> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkEntry</class> - <child_name>GnomeEntry:entry</child_name> - <name>combo-entry1</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - </widget> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox56</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>lblCharset</name> - <label>Default character encoding: </label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>omenuCharset</name> - <can_focus>True</can_focus> - <items>placeholder -</items> - <initial_choice>0</initial_choice> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>chkEmptyTrashOnExit</name> - <can_focus>True</can_focus> - <label>_Empty trash folders on exit</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox57</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkCheckButton</class> - <name>chkFilterLog</name> - <can_focus>True</can_focus> - <label>_Log filter actions to:</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GnomeFileEntry</class> - <name>fileFilterLog</name> - <max_saved>10</max_saved> - <title>Select Filter Log file...</title> - <directory>False</directory> - <modal>True</modal> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkEntry</class> - <child_name>GnomeEntry:entry</child_name> - <name>combo-entry2</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - </widget> - </widget> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>chkConfirmExpunge</name> - <can_focus>True</can_focus> - <label>Confirm when Expunging a folder</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>other_config_label</name> - <label>Other</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/mail/mail-config.h b/mail/mail-config.h deleted file mode 100644 index ce71d0e1ea..0000000000 --- a/mail/mail-config.h +++ /dev/null @@ -1,220 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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_CONFIG_H -#define MAIL_CONFIG_H - -#include <gtk/gtk.h> -#include <camel/camel.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -typedef struct { - gchar *name; - gchar *address; - gchar *organization; - gchar *signature; - gchar *html_signature; - gboolean has_html_signature; -} MailConfigIdentity; - -typedef struct { - gchar *url; - gboolean keep_on_server; - gboolean auto_check; - gint auto_check_time; - gboolean save_passwd; - gboolean enabled; -} MailConfigService; - -typedef struct { - gchar *name; - - MailConfigIdentity *id; - MailConfigService *source; - MailConfigService *transport; - - gchar *drafts_folder_name, *drafts_folder_uri; - gchar *sent_folder_name, *sent_folder_uri; - - gchar *pgp_key; - gboolean pgp_encrypt_to_self; - gboolean pgp_always_sign; - - gchar *smime_key; - gboolean smime_encrypt_to_self; - gboolean smime_always_sign; -} MailConfigAccount; - -typedef enum { - MAIL_CONFIG_HTTP_NEVER, - MAIL_CONFIG_HTTP_SOMETIMES, - MAIL_CONFIG_HTTP_ALWAYS -} MailConfigHTTPMode; - -typedef enum { - MAIL_CONFIG_FORWARD_ATTACHED, - MAIL_CONFIG_FORWARD_INLINE, - MAIL_CONFIG_FORWARD_QUOTED -} MailConfigForwardStyle; - -typedef enum { - MAIL_CONFIG_DISPLAY_NORMAL, - MAIL_CONFIG_DISPLAY_FULL_HEADERS, - MAIL_CONFIG_DISPLAY_SOURCE, - MAIL_CONFIG_DISPLAY_MAX -} MailConfigDisplayStyle; - -/* Identities */ -MailConfigIdentity *identity_copy (const MailConfigIdentity *id); -void identity_destroy (MailConfigIdentity *id); - -/* Services */ -MailConfigService *service_copy (const MailConfigService *source); -void service_destroy (MailConfigService *source); -void service_destroy_each (gpointer item, gpointer data); - -/* Accounts */ -MailConfigAccount *account_copy (const MailConfigAccount *account); -void account_destroy (MailConfigAccount *account); -void account_destroy_each (gpointer item, gpointer data); - -/* Configuration */ -void mail_config_init (void); -void mail_config_clear (void); -void mail_config_write (void); -void mail_config_write_on_exit (void); - -/* General Accessor functions */ -gboolean mail_config_is_configured (void); -gboolean mail_config_is_corrupt (void); - -gboolean mail_config_get_filter_log (void); -void mail_config_set_filter_log (gboolean value); -const char *mail_config_get_filter_log_path (void); -void mail_config_set_filter_log_path (const char *path); - -gboolean mail_config_get_empty_trash_on_exit (void); -void mail_config_set_empty_trash_on_exit (gboolean value); - -gboolean mail_config_get_thread_list (const char *uri); -void mail_config_set_thread_list (const char *uri, gboolean value); - -gboolean mail_config_get_show_preview (const char *uri); -void mail_config_set_show_preview (const char *uri, gboolean value); - -gboolean mail_config_get_hide_deleted (void); -void mail_config_set_hide_deleted (gboolean value); - -gint mail_config_get_paned_size (void); -void mail_config_set_paned_size (gint size); - -gboolean mail_config_get_send_html (void); -void mail_config_set_send_html (gboolean send_html); - -gboolean mail_config_get_confirm_unwanted_html (void); -void mail_config_set_confirm_unwanted_html (gboolean html_warning); - -gboolean mail_config_get_citation_highlight (void); -void mail_config_set_citation_highlight (gboolean); - -guint32 mail_config_get_citation_color (void); -void mail_config_set_citation_color (guint32); - -gint mail_config_get_do_seen_timeout (void); -void mail_config_set_do_seen_timeout (gboolean do_seen_timeout); - -gint mail_config_get_mark_as_seen_timeout (void); -void mail_config_set_mark_as_seen_timeout (gint timeout); - -gboolean mail_config_get_prompt_empty_subject (void); -void mail_config_set_prompt_empty_subject (gboolean value); - -gboolean mail_config_get_prompt_only_bcc (void); -void mail_config_set_prompt_only_bcc (gboolean value); - -gboolean mail_config_get_confirm_expunge (void); -void mail_config_set_confirm_expunge (gboolean value); - -CamelPgpType mail_config_pgp_type_detect_from_path (const char *pgp); - -CamelPgpType mail_config_get_pgp_type (void); -void mail_config_set_pgp_type (CamelPgpType pgp_type); - -const char *mail_config_get_pgp_path (void); -void mail_config_set_pgp_path (const char *pgp_path); - -MailConfigHTTPMode mail_config_get_http_mode (void); -void mail_config_set_http_mode (MailConfigHTTPMode); - -MailConfigForwardStyle mail_config_get_default_forward_style (void); -void mail_config_set_default_forward_style (MailConfigForwardStyle style); - -MailConfigDisplayStyle mail_config_get_message_display_style (void); -void mail_config_set_message_display_style (MailConfigDisplayStyle style); - -const char *mail_config_get_default_charset (void); -void mail_config_set_default_charset (const char *charset); - -void mail_config_service_set_save_passwd (MailConfigService *service, gboolean save_passwd); - -gboolean mail_config_find_account (const MailConfigAccount *account); -const MailConfigAccount *mail_config_get_default_account (void); -gint mail_config_get_default_account_num (void); -const MailConfigAccount *mail_config_get_account_by_name (const char *account_name); -const MailConfigAccount *mail_config_get_account_by_source_url (const char *url); -const MailConfigAccount *mail_config_get_account_by_transport_url (const char *url); -const GSList *mail_config_get_accounts (void); -void mail_config_add_account (MailConfigAccount *account); -const GSList *mail_config_remove_account (MailConfigAccount *account); - -void mail_config_set_default_account (const MailConfigAccount *account); - -const MailConfigIdentity *mail_config_get_default_identity (void); -const MailConfigService *mail_config_get_default_transport (void); - -const MailConfigService *mail_config_get_default_news (void); -const GSList *mail_config_get_news (void); -void mail_config_add_news (MailConfigService *news); -const GSList *mail_config_remove_news (MailConfigService *news); -GtkType evolution_mail_config_get_type (void); - -/* convenience functions to help ease the transition over to the new codebase */ -GSList *mail_config_get_sources (void); - -/* static utility functions */ -char *mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix); - -gboolean mail_config_check_service (const char *url, CamelProviderType type, GList **authtypes, GtkWindow *window); - - - -gboolean evolution_mail_config_factory_init (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* MAIL_CONFIG_H */ diff --git a/mail/mail-crypto.c b/mail/mail-crypto.c deleted file mode 100644 index 7be3eadf41..0000000000 --- a/mail/mail-crypto.c +++ /dev/null @@ -1,300 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include <stdlib.h> -#include <string.h> - -#include "mail-crypto.h" -#include "mail-session.h" -#include "mail-config.h" - - -/** - * mail_crypto_pgp_mime_part_sign: - * @mime_part: a MIME part that will be replaced by a pgp signed part - * @userid: userid to sign with - * @hash: one of CAMEL_CIPHER_HASH_MD5 or CAMEL_CIPHER_HASH_SHA1 - * @ex: exception which will be set if there are any errors. - * - * Constructs a PGP/MIME multipart in compliance with rfc2015 and - * replaces #part with the generated multipart/signed. On failure, - * #ex will be set and #part will remain untouched. - **/ -void -mail_crypto_pgp_mime_part_sign (CamelMimePart **mime_part, const char *userid, CamelCipherHash hash, CamelException *ex) -{ - CamelPgpContext *context; - - context = camel_pgp_context_new (session, mail_config_get_pgp_type (), - mail_config_get_pgp_path ()); - - if (context) { - camel_pgp_mime_part_sign (context, mime_part, userid, hash, ex); - camel_object_unref (CAMEL_OBJECT (context)); - } else - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not create a PGP signature context.")); -} - - -/** - * mail_crypto_pgp_mime_part_verify: - * @mime_part: a multipart/signed MIME Part - * @ex: exception - * - * Returns a CamelCipherValidity on success or NULL on fail. - **/ -CamelCipherValidity * -mail_crypto_pgp_mime_part_verify (CamelMimePart *mime_part, CamelException *ex) -{ - CamelCipherValidity *valid = NULL; - CamelPgpContext *context; - - context = camel_pgp_context_new (session, mail_config_get_pgp_type (), - mail_config_get_pgp_path ()); - - if (context) { - valid = camel_pgp_mime_part_verify (context, mime_part, ex); - camel_object_unref (CAMEL_OBJECT (context)); - } else - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not create a PGP verification context.")); - - return valid; -} - - -/** - * mail_crypto_pgp_mime_part_encrypt: - * @mime_part: a MIME part that will be replaced by a pgp encrypted part - * @recipients: list of recipient PGP Key IDs - * @ex: exception which will be set if there are any errors. - * - * Constructs a PGP/MIME multipart in compliance with rfc2015 and - * replaces #mime_part with the generated multipart/encrypted. On failure, - * #ex will be set and #part will remain untouched. - **/ -void -mail_crypto_pgp_mime_part_encrypt (CamelMimePart **mime_part, GPtrArray *recipients, CamelException *ex) -{ - CamelPgpContext *context; - - context = camel_pgp_context_new (session, mail_config_get_pgp_type (), - mail_config_get_pgp_path ()); - - if (context) { - camel_pgp_mime_part_encrypt (context, mime_part, recipients, ex); - camel_object_unref (CAMEL_OBJECT (context)); - } else - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not create a PGP encryption context.")); -} - - -/** - * mail_crypto_pgp_mime_part_decrypt: - * @mime_part: a multipart/encrypted MIME Part - * @ex: exception - * - * Returns the decrypted MIME Part on success or NULL on fail. - **/ -CamelMimePart * -mail_crypto_pgp_mime_part_decrypt (CamelMimePart *mime_part, CamelException *ex) -{ - CamelPgpContext *context; - CamelMimePart *part = NULL; - - context = camel_pgp_context_new (session, mail_config_get_pgp_type (), - mail_config_get_pgp_path ()); - - if (context) { - part = camel_pgp_mime_part_decrypt (context, mime_part, ex); - camel_object_unref (CAMEL_OBJECT (context)); - } else - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not create a PGP decryption context.")); - - return part; -} - - -/** - * mail_crypto_smime_sign: - * @message: MIME message to sign - * @userid: userid to sign with - * @signing_time: Include signing time - * @detached: create detached signature - * @ex: exception which will be set if there are any errors. - * - * Returns a S/MIME message in compliance with rfc2633. Returns %NULL - * on failure and @ex will be set. - **/ -CamelMimeMessage * -mail_crypto_smime_sign (CamelMimeMessage *message, const char *userid, - gboolean signing_time, gboolean detached, - CamelException *ex) -{ - CamelSMimeContext *context = NULL; - CamelMimeMessage *mesg = NULL; - -#ifdef HAVE_NSS - context = camel_smime_context_new (session, NULL); -#endif - - if (context) { - mesg = camel_cms_sign (CAMEL_CMS_CONTEXT (context), message, - userid, signing_time, detached, ex); - camel_object_unref (CAMEL_OBJECT (context)); - } else - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not create a S/MIME signature context.")); - - return mesg; -} - - -/** - * mail_crypto_smime_certsonly: - * @message: MIME message - * @userid: userid - * @recipients: recipients - * @ex: exception - * - * Returns a S/MIME message. - **/ -CamelMimeMessage * -mail_crypto_smime_certsonly (CamelMimeMessage *message, const char *userid, - GPtrArray *recipients, CamelException *ex) -{ - CamelSMimeContext *context = NULL; - CamelMimeMessage *mesg = NULL; - -#ifdef HAVE_NSS - context = camel_smime_context_new (session, NULL); -#endif - - if (context) { - mesg = camel_cms_certsonly (CAMEL_CMS_CONTEXT (context), message, - userid, recipients, ex); - camel_object_unref (CAMEL_OBJECT (context)); - } else - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not create a S/MIME certsonly context.")); - - return mesg; -} - -/** - * mail_crypto_smime_encrypt: - * @message: MIME message - * @userid: userid - * @recipients: recipients - * @ex: exception - * - * Returns a S/MIME message. - **/ -CamelMimeMessage * -mail_crypto_smime_encrypt (CamelMimeMessage *message, const char *userid, - GPtrArray *recipients, CamelException *ex) -{ - CamelSMimeContext *context = NULL; - CamelMimeMessage *mesg = NULL; - -#ifdef HAVE_NSS - context = camel_smime_context_new (session, NULL); -#endif - - if (context) { - mesg = camel_cms_encrypt (CAMEL_CMS_CONTEXT (context), message, - userid, recipients, ex); - camel_object_unref (CAMEL_OBJECT (context)); - } else - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not create a S/MIME encryption context.")); - - return mesg; -} - -/** - * mail_crypto_smime_envelope: - * @message: MIME message - * @userid: userid - * @recipients: recipients - * @ex: exception - * - * Returns a S/MIME message. - **/ -CamelMimeMessage * -mail_crypto_smime_envelope (CamelMimeMessage *message, const char *userid, - GPtrArray *recipients, CamelException *ex) -{ - CamelSMimeContext *context = NULL; - CamelMimeMessage *mesg = NULL; - -#ifdef HAVE_NSS - context = camel_smime_context_new (session, NULL); -#endif - - if (context) { - mesg = camel_cms_envelope (CAMEL_CMS_CONTEXT (context), message, - userid, recipients, ex); - camel_object_unref (CAMEL_OBJECT (context)); - } else - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not create a S/MIME envelope context.")); - - return mesg; -} - -/** - * mail_crypto_smime_decode: - * @message: MIME message - * @info: pointer to a CamelCMSValidityInfo structure (or %NULL) - * @ex: exception - * - * Returns a decoded S/MIME message. - **/ -CamelMimeMessage * -mail_crypto_smime_decode (CamelMimeMessage *message, CamelCMSValidityInfo **info, - CamelException *ex) -{ - CamelSMimeContext *context = NULL; - CamelMimeMessage *mesg = NULL; - -#ifdef HAVE_NSS - context = camel_smime_context_new (session, NULL); -#endif - - if (context) { - mesg = camel_cms_decode (CAMEL_CMS_CONTEXT (context), - message, info, ex); - camel_object_unref (CAMEL_OBJECT (context)); - } else - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not create a S/MIME decode context.")); - - return mesg; -} diff --git a/mail/mail-crypto.h b/mail/mail-crypto.h deleted file mode 100644 index 42467613e2..0000000000 --- a/mail/mail-crypto.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright 2000 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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_CRYPTO_H -#define MAIL_CRYPTO_H - -#include <camel/camel.h> -#include <camel/camel-pgp-mime.h> -#include <camel/camel-smime-context.h> -#include <camel/camel-smime-utils.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus } */ - -/* PGP/MIME convenience wrappers */ -void mail_crypto_pgp_mime_part_sign (CamelMimePart **mime_part, - const char *userid, - CamelCipherHash hash, - CamelException *ex); - -CamelCipherValidity *mail_crypto_pgp_mime_part_verify (CamelMimePart *mime_part, - CamelException *ex); - -void mail_crypto_pgp_mime_part_encrypt (CamelMimePart **mime_part, - GPtrArray *recipients, - CamelException *ex); - -CamelMimePart *mail_crypto_pgp_mime_part_decrypt (CamelMimePart *mime_part, - CamelException *ex); - -/* S/MIME v3 convenience wrappers */ -CamelMimeMessage *mail_crypto_smime_sign (CamelMimeMessage *message, const char *userid, - gboolean signing_time, gboolean detached, - CamelException *ex); - -CamelMimeMessage *mail_crypto_smime_certsonly (CamelMimeMessage *message, const char *userid, - GPtrArray *recipients, CamelException *ex); - -CamelMimeMessage *mail_crypto_smime_encrypt (CamelMimeMessage *message, const char *userid, - GPtrArray *recipients, CamelException *ex); - -CamelMimeMessage *mail_crypto_smime_envelope (CamelMimeMessage *message, const char *userid, - GPtrArray *recipients, CamelException *ex); - -CamelMimeMessage *mail_crypto_smime_decode (CamelMimeMessage *message, - CamelCMSValidityInfo **info, CamelException *ex); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ! MAIL_CRYPTO_H */ diff --git a/mail/mail-display.c b/mail/mail-display.c deleted file mode 100644 index 47709c1897..0000000000 --- a/mail/mail-display.c +++ /dev/null @@ -1,2102 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * mail-display.c: Mail display widget - * - * Author: - * Miguel de Icaza - * Bertrand Guiheneuf (bg@aful.org) - * - * (C) 2000 Ximian, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <sys/stat.h> -#include <ctype.h> -#include <fcntl.h> -#include <errno.h> -#include <libgnorba/gnorba.h> -#include <libgnomevfs/gnome-vfs-mime-info.h> -#include <libgnomevfs/gnome-vfs-mime-handlers.h> -#include <libgnomevfs/gnome-vfs.h> -#include <bonobo/bonobo-control-frame.h> -#include <bonobo/bonobo-stream-memory.h> -#include <bonobo/bonobo-ui-toolbar-icon.h> -#include <bonobo/bonobo-widget.h> -#include <bonobo/bonobo-socket.h> -#include <gdk-pixbuf/gdk-pixbuf.h> -#include <gdk-pixbuf/gdk-pixbuf-loader.h> -#include <gal/util/e-util.h> -#include <gal/widgets/e-popup-menu.h> -#include <gal/widgets/e-unicode.h> -#include <gtk/gtkinvisible.h> -#include <gtkhtml/gtkhtml-embedded.h> -#include <gtkhtml/htmlengine.h> /* XXX */ -#include <gtkhtml/htmlobject.h> /* XXX */ -#include <gtkhtml/htmltext.h> /* XXX */ -#include <gtkhtml/htmlinterval.h> /* XXX */ -#include <gtkhtml/gtkhtml-stream.h> - -#include "e-util/e-html-utils.h" -#include "e-util/e-mktemp.h" -#include "addressbook/backend/ebook/e-book-util.h" - -#include "e-searching-tokenizer.h" -#include "folder-browser-factory.h" -#include "mail-stream-gtkhtml.h" -#include "mail-display.h" -#include "mail-config.h" -#include "mail-ops.h" -#include "mail-mt.h" -#include "mail.h" - -#include "art/empty.xpm" - -#define PARENT_TYPE (gtk_vbox_get_type ()) - -static GtkObjectClass *mail_display_parent_class; - -struct _PixbufLoader { - CamelDataWrapper *wrapper; /* The data */ - CamelStream *mstream; - GdkPixbufLoader *loader; - GtkHTMLEmbedded *eb; - char *type; /* Type of data, in case the conversion fails */ - char *cid; /* Strdupped on creation, but not freed until - the hashtable is destroyed */ - GtkWidget *pixmap; - guint32 destroy_id; -}; -static GHashTable *thumbnail_cache = NULL; - -static gchar *save_pathname = NULL; /* preserves last directory in save dialog */ - -/*----------------------------------------------------------------------* - * Callbacks - *----------------------------------------------------------------------*/ - -static void -write_data_written(CamelMimePart *part, char *name, int done, void *data) -{ - int *ret = data; - - /* should we popup a dialogue to say its done too? */ - *ret = done; -} - -static gboolean -write_data_to_file (CamelMimePart *part, const char *name, gboolean unique) -{ - int fd; - int ret = FALSE; - - g_return_val_if_fail (CAMEL_IS_MIME_PART (part), FALSE); - - fd = open (name, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); - if (fd == -1 && errno == EEXIST && !unique) { - GtkWidget *dlg; - GtkWidget *text; - - dlg = gnome_dialog_new (_("Overwrite file?"), - GNOME_STOCK_BUTTON_YES, - GNOME_STOCK_BUTTON_NO, - NULL); - text = gtk_label_new (_("A file by that name already exists.\nOverwrite it?")); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox), text, TRUE, TRUE, 4); - gtk_window_set_policy(GTK_WINDOW(dlg), FALSE, TRUE, FALSE); - gtk_widget_show (text); - - if (gnome_dialog_run_and_close (GNOME_DIALOG (dlg)) != 0) - return FALSE; - } - - if (fd != -1) - close (fd); - - /* should this have progress of what its doing? */ - mail_msg_wait (mail_save_part (part, name, write_data_written, &ret)); - - return ret; -} - -static char * -make_safe_filename (const char *prefix,CamelMimePart *part) -{ - const char *name = NULL; - char *safe, *p; - - if (part) { - name = camel_mime_part_get_filename (part); - } - - if (!name) { - /* This is a filename. Translators take note. */ - name = _("attachment"); - } - - p = strrchr (name, '/'); - if (p) - safe = g_strdup_printf ("%s%s", prefix, p); - else - safe = g_strdup_printf ("%s/%s", prefix, name); - - p = strrchr (safe, '/') + 1; - if (p) - e_filename_make_safe (p); - - return safe; -} - -static void -save_data_cb (GtkWidget *widget, gpointer user_data) -{ - GtkFileSelection *file_select = (GtkFileSelection *) - gtk_widget_get_ancestor (widget, GTK_TYPE_FILE_SELECTION); - gchar *p; - - /* uh, this doesn't really feel right, but i dont know what to do better */ - gtk_widget_hide (GTK_WIDGET (file_select)); - write_data_to_file (user_data, - gtk_file_selection_get_filename (file_select), - FALSE); - - /* preserve the pathname */ - g_free(save_pathname); - save_pathname = g_strdup(gtk_file_selection_get_filename(file_select)); - if((p = strrchr(save_pathname, '/')) != NULL) - p[0] = 0; - else { - g_free(save_pathname); - save_pathname = NULL; - } - - gtk_widget_destroy (GTK_WIDGET (file_select)); -} - -static void -save_destroy_cb (GtkWidget *widget, CamelMimePart *part) -{ - camel_object_unref (CAMEL_OBJECT (part)); -} - -static gboolean -idle_redisplay (gpointer data) -{ - MailDisplay *md = data; - - md->idle_id = 0; - mail_display_redisplay (md, FALSE); - return FALSE; -} - -void -mail_display_queue_redisplay (MailDisplay *md) -{ - if (!md->idle_id) { - md->idle_id = g_idle_add_full (G_PRIORITY_LOW, idle_redisplay, - md, NULL); - } -} - -static void -mail_display_jump_to_anchor (MailDisplay *md, const char *url) -{ - char *anchor = strstr (url, "#"); - - g_return_if_fail (anchor != NULL); - - if (anchor) - gtk_html_jump_to_anchor (md->html, anchor + 1); -} - -static void -on_link_clicked (GtkHTML *html, const char *url, MailDisplay *md) -{ - if (!g_strncasecmp (url, "news:", 5) || - !g_strncasecmp (url, "nntp:", 5)) - g_warning ("Can't handle news URLs yet."); - else if (!g_strncasecmp (url, "mailto:", 7)) - send_to_url (url); - else if (*url == '#') - mail_display_jump_to_anchor (md, url); - else - gnome_url_show (url); -} - -static void -save_part (CamelMimePart *part) -{ - GtkFileSelection *file_select; - char *filename; - - g_return_if_fail (part != NULL); - camel_object_ref (CAMEL_OBJECT (part)); - - if (save_pathname == NULL) - save_pathname = g_strdup (g_get_home_dir ()); - - filename = make_safe_filename (save_pathname, part); - - file_select = GTK_FILE_SELECTION ( - gtk_file_selection_new (_("Save Attachment"))); - gtk_file_selection_set_filename (file_select, filename); - /* set the GtkEntry with the locale filename by breaking abstraction */ - e_utf8_gtk_entry_set_text (GTK_ENTRY (file_select->selection_entry), g_basename (filename)); - g_free (filename); - - gtk_signal_connect (GTK_OBJECT (file_select->ok_button), "clicked", - GTK_SIGNAL_FUNC (save_data_cb), part); - gtk_signal_connect_object (GTK_OBJECT (file_select->cancel_button), - "clicked", - GTK_SIGNAL_FUNC (gtk_widget_destroy), - GTK_OBJECT (file_select)); - - gtk_signal_connect (GTK_OBJECT (file_select), "destroy", - GTK_SIGNAL_FUNC (save_destroy_cb), part); - - gtk_widget_show (GTK_WIDGET (file_select)); -} - -static void -save_cb (GtkWidget *widget, gpointer user_data) -{ - CamelMimePart *part = gtk_object_get_data (GTK_OBJECT (user_data), "CamelMimePart"); - - save_part (part); -} - -static void -launch_cb (GtkWidget *widget, gpointer user_data) -{ - CamelMimePart *part = gtk_object_get_data (user_data, "CamelMimePart"); - MailMimeHandler *handler; - GList *apps, *children, *c; - GnomeVFSMimeApplication *app; - char *command, *filename; - const char *tmpdir; - - handler = mail_lookup_handler (gtk_object_get_data (user_data, "mime_type")); - g_return_if_fail (handler != NULL && handler->applications != NULL); - - /* Yum. Too bad EPopupMenu doesn't allow per-item closures. */ - children = gtk_container_children (GTK_CONTAINER (widget->parent)); - g_return_if_fail (children != NULL && children->next != NULL && children->next->next != NULL); - - for (c = children->next->next, apps = handler->applications; c && apps; c = c->next, apps = apps->next) { - if (c->data == widget) - break; - } - g_list_free (children); - g_return_if_fail (c != NULL && apps != NULL); - app = apps->data; - - tmpdir = e_mkdtemp ("evolution.XXXXXX"); - - if (!tmpdir) { - char *msg = g_strdup_printf (_("Could not create temporary " - "directory: %s"), - g_strerror (errno)); - gnome_error_dialog (msg); - g_free (msg); - return; - } - - filename = make_safe_filename (tmpdir, part); - - if (!write_data_to_file (part, filename, TRUE)) { - g_free (filename); - return; - } - - command = g_strdup_printf ("%s %s%s &", app->command, - app->expects_uris == GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS ? "file:" : "", - filename); - system (command); - g_free (command); - g_free (filename); -} - -static void -inline_cb (GtkWidget *widget, gpointer user_data) -{ - MailDisplay *md = gtk_object_get_data (user_data, "MailDisplay"); - CamelMimePart *part = gtk_object_get_data (user_data, "CamelMimePart"); - - mail_part_toggle_displayed (part, md); - mail_display_queue_redisplay (md); -} - -static void -button_press (GtkWidget *widget, CamelMimePart *part) -{ - MailDisplay *md; - - md = gtk_object_get_data (GTK_OBJECT (widget), "MailDisplay"); - if (md == NULL) { - g_warning ("No MailDisplay on button!"); - return; - } - - mail_part_toggle_displayed (part, md); - mail_display_queue_redisplay (md); -} - -static gboolean -pixmap_press (GtkWidget *widget, GdkEventButton *event, EScrollFrame *user_data) -{ - EPopupMenu *menu; - EPopupMenu save_item = { N_("Save to Disk..."), NULL, - GTK_SIGNAL_FUNC (save_cb), NULL, 0 }; - EPopupMenu view_item = { N_("View Inline"), NULL, - GTK_SIGNAL_FUNC (inline_cb), NULL, 2 }; - EPopupMenu open_item = { N_("Open in %s..."), NULL, - GTK_SIGNAL_FUNC (launch_cb), NULL, 1 }; - MailDisplay *md; - CamelMimePart *part; - MailMimeHandler *handler; - int mask = 0, i, nitems; - -#ifdef USE_OLD_DISPLAY_STYLE - if (event->button != 3) { - gtk_propagate_event (GTK_WIDGET (user_data), - (GdkEvent *)event); - return TRUE; - } -#endif - - if (event->button != 1 && event->button != 3) { - gtk_propagate_event (GTK_WIDGET (user_data), - (GdkEvent *)event); - return TRUE; - } - - /* Stop the signal, since we don't want the button's class method to - mess up our popup. */ - gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "button_press_event"); - - part = gtk_object_get_data (GTK_OBJECT (widget), "CamelMimePart"); - handler = mail_lookup_handler (gtk_object_get_data (GTK_OBJECT (widget), - "mime_type")); - - if (handler && handler->applications) - nitems = g_list_length (handler->applications) + 2; - else - nitems = 3; - menu = g_new0 (EPopupMenu, nitems + 1); - - /* Save item */ - memcpy (&menu[0], &save_item, sizeof (menu[0])); - menu[0].name = _(menu[0].name); - - /* Inline view item */ - memcpy (&menu[1], &view_item, sizeof (menu[1])); - if (handler && handler->builtin) { - md = gtk_object_get_data (GTK_OBJECT (widget), "MailDisplay"); - - if (!mail_part_is_displayed_inline (part, md)) { - if (handler->component) { - OAF_Property *prop; - char *name; - - prop = oaf_server_info_prop_find ( - handler->component, "name"); - if (!prop) { - prop = oaf_server_info_prop_find ( - handler->component, - "description"); - } - if (prop && prop->v._d == OAF_P_STRING) - name = prop->v._u.value_string; - else - name = "bonobo"; - menu[1].name = g_strdup_printf ( - _("View Inline (via %s)"), name); - } else - menu[1].name = g_strdup (_(menu[1].name)); - } else - menu[1].name = g_strdup (_("Hide")); - } else { - menu[1].name = g_strdup (_(menu[1].name)); - mask |= 2; - } - - /* External views */ - if (handler && handler->applications) { - GnomeVFSMimeApplication *app; - GList *apps; - int i; - - apps = handler->applications; - for (i = 2; i < nitems; i++, apps = apps->next) { - app = apps->data; - memcpy (&menu[i], &open_item, sizeof (menu[i])); - menu[i].name = g_strdup_printf (_(menu[i].name), app->name); - } - } else { - memcpy (&menu[2], &open_item, sizeof (menu[2])); - menu[2].name = g_strdup_printf (_(menu[2].name), - _("External Viewer")); - mask |= 1; - } - - e_popup_menu_run (menu, (GdkEvent *)event, mask, 0, widget); - - for (i = 1; i < nitems; i++) - g_free (menu[i].name); - g_free (menu); - return TRUE; -} - -static GdkPixbuf * -pixbuf_for_mime_type (const char *mime_type) -{ - const char *icon_name; - char *filename = NULL; - GdkPixbuf *pixbuf = NULL; - - icon_name = gnome_vfs_mime_get_value (mime_type, "icon-filename"); - if (icon_name) { - if (*icon_name == '/') { - pixbuf = gdk_pixbuf_new_from_file (icon_name); - if (pixbuf) - return pixbuf; - } - - filename = gnome_pixmap_file (icon_name); - if (!filename) { - char *fm_icon; - - fm_icon = g_strdup_printf ("nautilus/%s", icon_name); - filename = gnome_pixmap_file (fm_icon); - if (!filename) { - fm_icon = g_strdup_printf ("mc/%s", icon_name); - filename = gnome_pixmap_file (fm_icon); - } - g_free (fm_icon); - } - } - - if (filename) { - pixbuf = gdk_pixbuf_new_from_file (filename); - g_free (filename); - } - - if (!pixbuf) { - filename = gnome_pixmap_file ("gnome-unknown.png"); - if (filename) { - pixbuf = gdk_pixbuf_new_from_file (filename); - g_free (filename); - } else { - g_warning ("Could not get any icon for %s!",mime_type); - pixbuf = gdk_pixbuf_new_from_xpm_data ( - (const char **)empty_xpm); - } - } - - return pixbuf; -} - -static gboolean -pixbuf_uncache (gpointer key) -{ - GdkPixbuf *pixbuf; - - pixbuf = g_hash_table_lookup (thumbnail_cache, key); - gdk_pixbuf_unref (pixbuf); - g_hash_table_remove (thumbnail_cache, key); - g_free (key); - return FALSE; -} - -static gint -pixbuf_gen_idle (struct _PixbufLoader *pbl) -{ - GdkPixbuf *pixbuf, *mini; - gboolean error = FALSE; - char tmp[4096]; - int len, width, height, ratio; - gpointer orig_key; - - /* Get the pixbuf from the cache */ - if (g_hash_table_lookup_extended (thumbnail_cache, pbl->cid, - &orig_key, (gpointer *)&mini)) { - width = gdk_pixbuf_get_width (mini); - height = gdk_pixbuf_get_height (mini); - - bonobo_ui_toolbar_icon_set_pixbuf ( - BONOBO_UI_TOOLBAR_ICON (pbl->pixmap), mini); - gtk_widget_set_usize (pbl->pixmap, width, height); - - /* Restart the cache-cleaning timer */ - g_source_remove_by_user_data (orig_key); - g_timeout_add (5 * 60 * 1000, pixbuf_uncache, orig_key); - - if (pbl->loader) { - gdk_pixbuf_loader_close (pbl->loader); - gtk_object_destroy (GTK_OBJECT (pbl->loader)); - camel_object_unref (CAMEL_OBJECT (pbl->mstream)); - } - gtk_signal_disconnect (GTK_OBJECT (pbl->eb), pbl->destroy_id); - g_free (pbl->type); - g_free (pbl->cid); - g_free (pbl); - - return FALSE; - } - - /* Not in cache, so get a pixbuf from the wrapper */ - - if (!GTK_IS_WIDGET (pbl->pixmap)) { - /* Widget has died */ - if (pbl->mstream) - camel_object_unref (CAMEL_OBJECT (pbl->mstream)); - - if (pbl->loader) { - gdk_pixbuf_loader_close (pbl->loader); - gtk_object_destroy (GTK_OBJECT (pbl->loader)); - } - - g_free (pbl->type); - g_free (pbl->cid); - g_free (pbl); - return FALSE; - } - - if (pbl->mstream) { - if (pbl->loader == NULL) - pbl->loader = gdk_pixbuf_loader_new (); - - len = camel_stream_read (pbl->mstream, tmp, 4096); - if (len > 0) { - error = !gdk_pixbuf_loader_write (pbl->loader, tmp, len); - if (!error) - return TRUE; - } else if (!camel_stream_eos (pbl->mstream)) - error = TRUE; - } - - if (error || !pbl->mstream) { - if (pbl->type) - pixbuf = pixbuf_for_mime_type (pbl->type); - else - pixbuf = gdk_pixbuf_new_from_file (EVOLUTION_ICONSDIR "/pgp-signature-nokey.png"); - } else - pixbuf = gdk_pixbuf_loader_get_pixbuf (pbl->loader); - - width = gdk_pixbuf_get_width (pixbuf); - height = gdk_pixbuf_get_height (pixbuf); - - if (width >= height) { - if (width > 24) { - ratio = width / 24; - width = 24; - height /= ratio; - } - } else { - if (height > 24) { - ratio = height / 24; - height = 24; - width /= ratio; - } - } - - mini = gdk_pixbuf_scale_simple (pixbuf, width, height, - GDK_INTERP_BILINEAR); - if (error || !pbl->mstream) - gdk_pixbuf_unref (pixbuf); - bonobo_ui_toolbar_icon_set_pixbuf ( - BONOBO_UI_TOOLBAR_ICON (pbl->pixmap), mini); - - /* Add the pixbuf to the cache */ - g_hash_table_insert (thumbnail_cache, pbl->cid, mini); - g_timeout_add (5 * 60 * 1000, pixbuf_uncache, pbl->cid); - - gtk_signal_disconnect (GTK_OBJECT (pbl->eb), pbl->destroy_id); - if (pbl->loader) { - gdk_pixbuf_loader_close (pbl->loader); - gtk_object_unref (GTK_OBJECT (pbl->loader)); - camel_object_unref (CAMEL_OBJECT (pbl->mstream)); - } - g_free (pbl->type); - g_free (pbl); - return FALSE; -} - -/* Stop the idle function and free the pbl structure - as the widget that the pixbuf was to be rendered to - has died on us. */ -static void -embeddable_destroy_cb (GtkObject *embeddable, - struct _PixbufLoader *pbl) -{ - g_idle_remove_by_data (pbl); - if (pbl->mstream) - camel_object_unref (CAMEL_OBJECT (pbl->mstream)); - - if (pbl->loader) { - gdk_pixbuf_loader_close (pbl->loader); - gtk_object_destroy (GTK_OBJECT (pbl->loader)); - } - - g_free (pbl->type); - g_free (pbl->cid); - g_free (pbl); -}; - -static GtkWidget * -get_embedded_for_component (const char *iid, MailDisplay *md) -{ - GtkWidget *embedded; - BonoboControlFrame *control_frame; - Bonobo_PropertyBag prop_bag; - - /* - * First try a control. - */ - embedded = bonobo_widget_new_control (iid, NULL); - if (embedded == NULL) { - /* - * No control, try an embeddable instead. - */ - embedded = bonobo_widget_new_subdoc (iid, NULL); - if (embedded != NULL) { - /* FIXME: as of bonobo 0.18, there's an extra - * client_site dereference in the BonoboWidget - * destruction path that we have to balance out to - * prevent problems. - */ - bonobo_object_ref (BONOBO_OBJECT(bonobo_widget_get_client_site ( - BONOBO_WIDGET (embedded)))); - - return embedded; - } - } - - if (embedded == NULL) - return NULL; - - control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (embedded)); - - prop_bag = bonobo_control_frame_get_control_property_bag ( control_frame, NULL ); - - if (prop_bag != CORBA_OBJECT_NIL){ - CORBA_Environment ev; - /* - * Now we can take care of business. Currently, the only control - * that needs something passed to it through a property bag is - * the iTip control, and it needs only the From email address, - * but perhaps in the future we can generalize this section of code - * to pass a bunch of useful things to all embedded controls. - */ - const CamelInternetAddress *from; - char *from_address; - - CORBA_exception_init (&ev); - - from = camel_mime_message_get_from (md->current_message); - from_address = camel_address_encode((CamelAddress *)from); - bonobo_property_bag_client_set_value_string ( - prop_bag, "from_address", - from_address, &ev); - g_free(from_address); - - Bonobo_Unknown_unref (prop_bag, &ev); - CORBA_exception_free (&ev); - } - - return embedded; -} - -static void * -save_url (MailDisplay *md, const char *url) -{ - GHashTable *urls; - CamelMimePart *part; - - urls = g_datalist_get_data (md->data, "part_urls"); - g_return_val_if_fail (urls != NULL, NULL); - - part = g_hash_table_lookup (urls, url); - if (part == NULL) { - GByteArray *ba; - - urls = g_datalist_get_data (md->data, "data_urls"); - g_return_val_if_fail (urls != NULL, NULL); - - /* See if it's some piece of cached data if it is then pretend it - * is a mime part so that we can use the mime part saveing routines. - * It is gross but it keeps duplicated code to a minimum and helps - * out with ref counting and the like. - */ - ba = g_hash_table_lookup (urls, url); - if (ba) { - CamelStream *memstream; - CamelDataWrapper *wrapper; - const char *name; - - name = strrchr (url, '/'); - name = name ? name : url; - - /* we have to copy the data here since the ba may be long gone - * by the time the user actually saves the file - */ - memstream = camel_stream_mem_new_with_buffer (ba->data, ba->len); - wrapper = camel_data_wrapper_new (); - camel_data_wrapper_construct_from_stream (wrapper, memstream); - camel_object_unref (CAMEL_OBJECT (memstream)); - part = camel_mime_part_new (); - camel_medium_set_content_object (CAMEL_MEDIUM (part), wrapper); - camel_object_unref (CAMEL_OBJECT (wrapper)); - camel_mime_part_set_filename (part, name); - } - } else { - camel_object_ref (CAMEL_OBJECT (part)); - } - - if (part) { - CamelDataWrapper *data; - - g_return_val_if_fail (CAMEL_IS_MIME_PART (part), NULL); - - data = camel_medium_get_content_object ((CamelMedium *)part); - if (!mail_content_loaded (data, md, TRUE, NULL, NULL)) { - return NULL; - } - - save_part (part); - camel_object_unref (CAMEL_OBJECT (part)); - return NULL; - } - - g_warning ("part not found"); - return NULL; -} - -static gboolean -do_attachment_header (GtkHTML *html, GtkHTMLEmbedded *eb, - CamelMimePart *part, MailDisplay *md) -{ - GtkWidget *button, *mainbox, *hbox, *arrow, *popup; - MailMimeHandler *handler; - struct _PixbufLoader *pbl; - - pbl = g_new0 (struct _PixbufLoader, 1); - if (g_strncasecmp (eb->type, "image/", 6) == 0) { - CamelDataWrapper *content; - - content = camel_medium_get_content_object (CAMEL_MEDIUM (part)); - if (!camel_data_wrapper_is_offline (content)) { - pbl->mstream = camel_stream_mem_new (); - camel_data_wrapper_write_to_stream (content, pbl->mstream); - camel_stream_reset (pbl->mstream); - } - } - pbl->type = g_strdup (eb->type); - pbl->cid = g_strdup (eb->classid + 6); - pbl->pixmap = bonobo_ui_toolbar_icon_new (); - gtk_widget_set_usize (pbl->pixmap, 24, 24); - pbl->eb = eb; - pbl->destroy_id = gtk_signal_connect (GTK_OBJECT (eb), "destroy", - embeddable_destroy_cb, pbl); - - g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc)pixbuf_gen_idle, - pbl, NULL); - - mainbox = gtk_hbox_new (FALSE, 0); - - button = gtk_button_new (); - gtk_object_set_data (GTK_OBJECT (button), "MailDisplay", md); - - gtk_signal_connect (GTK_OBJECT (button), "clicked", - GTK_SIGNAL_FUNC (button_press), part); - - hbox = gtk_hbox_new (FALSE, 2); - gtk_container_set_border_width (GTK_CONTAINER (hbox), 2); - - if (mail_part_is_displayed_inline (part, md)) - arrow = gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_DOWN); - else - arrow = gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_FORWARD); - gtk_box_pack_start (GTK_BOX (hbox), arrow, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (hbox), pbl->pixmap, TRUE, TRUE, 0); - gtk_container_add (GTK_CONTAINER (button), hbox); - - popup = gtk_button_new (); - gtk_container_add (GTK_CONTAINER (popup), - gtk_arrow_new (GTK_ARROW_DOWN, - GTK_SHADOW_ETCHED_IN)); - - gtk_object_set_data (GTK_OBJECT (popup), "MailDisplay", md); - gtk_object_set_data (GTK_OBJECT (popup), "CamelMimePart", part); - gtk_object_set_data_full (GTK_OBJECT (popup), "mime_type", - g_strdup (eb->type), (GDestroyNotify)g_free); - - gtk_signal_connect (GTK_OBJECT (popup), "button_press_event", - GTK_SIGNAL_FUNC (pixmap_press), md->scroll); - - gtk_box_pack_start (GTK_BOX (mainbox), button, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (mainbox), popup, TRUE, TRUE, 0); - gtk_widget_show_all (mainbox); - - handler = mail_lookup_handler (eb->type); - if (handler && handler->builtin) - gtk_widget_set_sensitive (button, TRUE); - else - gtk_widget_set_sensitive (button, FALSE); - - gtk_container_add (GTK_CONTAINER (eb), mainbox); - - return TRUE; -} - -static gboolean -do_external_viewer (GtkHTML *html, GtkHTMLEmbedded *eb, - CamelMimePart *part, MailDisplay *md) -{ - CamelDataWrapper *wrapper; - OAF_ServerInfo *component; - GtkWidget *embedded; - BonoboObjectClient *server; - Bonobo_PersistStream persist; - CORBA_Environment ev; - GByteArray *ba; - CamelStream *cstream; - BonoboStream *bstream; - - component = gnome_vfs_mime_get_default_component (eb->type); - if (!component) - return FALSE; - - embedded = get_embedded_for_component (component->iid, md); - CORBA_free (component); - if (!embedded) - return FALSE; - - server = bonobo_widget_get_server (BONOBO_WIDGET (embedded)); - persist = (Bonobo_PersistStream) bonobo_object_client_query_interface ( - server, "IDL:Bonobo/PersistStream:1.0", NULL); - if (persist == CORBA_OBJECT_NIL) { - gtk_object_sink (GTK_OBJECT (embedded)); - return FALSE; - } - - /* Write the data to a CamelStreamMem... */ - ba = g_byte_array_new (); - cstream = camel_stream_mem_new_with_byte_array (ba); - wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part)); - camel_data_wrapper_write_to_stream (wrapper, cstream); - - /* ...convert the CamelStreamMem to a BonoboStreamMem... */ - bstream = bonobo_stream_mem_create (ba->data, ba->len, TRUE, FALSE); - camel_object_unref (CAMEL_OBJECT (cstream)); - - /* ...and hydrate the PersistStream from the BonoboStream. */ - CORBA_exception_init (&ev); - Bonobo_PersistStream_load (persist, - bonobo_object_corba_objref ( - BONOBO_OBJECT (bstream)), - eb->type, &ev); - bonobo_object_unref (BONOBO_OBJECT (bstream)); - Bonobo_Unknown_unref (persist, &ev); - CORBA_Object_release (persist, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - gtk_object_sink (GTK_OBJECT (embedded)); - CORBA_exception_free (&ev); - return FALSE; - } - CORBA_exception_free (&ev); - - gtk_widget_show (embedded); - gtk_container_add (GTK_CONTAINER (eb), embedded); - - return TRUE; -} - -static gboolean -do_signature (GtkHTML *html, GtkHTMLEmbedded *eb, - CamelMimePart *part, MailDisplay *md) -{ - GtkWidget *button; - struct _PixbufLoader *pbl; - - pbl = g_new0 (struct _PixbufLoader, 1); - pbl->type = NULL; - pbl->cid = g_strdup (eb->classid); - pbl->pixmap = bonobo_ui_toolbar_icon_new (); - gtk_widget_set_usize (pbl->pixmap, 24, 24); - pbl->eb = eb; - pbl->destroy_id = gtk_signal_connect (GTK_OBJECT (eb), "destroy", - embeddable_destroy_cb, pbl); - - g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc)pixbuf_gen_idle, - pbl, NULL); - - button = gtk_button_new (); - gtk_object_set_data (GTK_OBJECT (button), "MailDisplay", md); - gtk_signal_connect (GTK_OBJECT (button), "clicked", - GTK_SIGNAL_FUNC (button_press), part); - gtk_container_add (GTK_CONTAINER (button), pbl->pixmap); - gtk_widget_show_all (button); - gtk_container_add (GTK_CONTAINER (eb), button); - - return TRUE; -} - -static gboolean -on_object_requested (GtkHTML *html, GtkHTMLEmbedded *eb, gpointer data) -{ - MailDisplay *md = data; - GHashTable *urls; - CamelMimePart *part; - - urls = g_datalist_get_data (md->data, "part_urls"); - if (!urls) - return FALSE; - - if (!strncmp (eb->classid, "popup:", 6)) { - part = g_hash_table_lookup (urls, eb->classid + 6); - if (!CAMEL_IS_MIME_PART (part)) - return FALSE; - return do_attachment_header (html, eb, part, md); - } else if (!strncmp (eb->classid, "signature:", 10)) { - part = g_hash_table_lookup (urls, eb->classid); - if (!CAMEL_IS_MIME_PART (part)) - return FALSE; - return do_signature (html, eb, part, md); - } else if (!strncmp (eb->classid, "cid:", 4)) { - part = g_hash_table_lookup (urls, eb->classid); - if (!CAMEL_IS_MIME_PART (part)) - return FALSE; - return do_external_viewer (html, eb, part, md); - } - - return FALSE; -} - -static void -load_http (MailDisplay *md, gpointer data) -{ - char *url = data; - GHashTable *urls; - GnomeVFSHandle *handle; - GnomeVFSFileSize read; - GByteArray *ba; - char buf[8192]; - - urls = g_datalist_get_data (md->data, "data_urls"); - ba = g_hash_table_lookup (urls, url); - g_return_if_fail (ba != NULL); - - if (gnome_vfs_open (&handle, url, GNOME_VFS_OPEN_READ) != GNOME_VFS_OK) { -#if 0 - printf ("failed to open %s\n", url); -#endif - g_free (url); - return; - } - - while (gnome_vfs_read (handle, buf, sizeof (buf), &read) == GNOME_VFS_OK) - g_byte_array_append (ba, buf, read); - gnome_vfs_close (handle); - -#if 0 - if (!ba->len) - printf ("no data in %s\n", url); -#endif - - g_free (url); -} - -static void -ebook_callback (EBook *book, const gchar *addr, ECard *card, gpointer data) -{ - MailDisplay *md = data; - - if (card && md->current_message) { - const CamelInternetAddress *from = camel_mime_message_get_from (md->current_message); - const char *md_name = NULL, *md_addr = NULL; - - /* We are extra anal, in case we are dealing with some sort of pathological message - w/o a From: header. */ - if (from != NULL && camel_internet_address_get (from, 0, &md_name, &md_addr)) { - if (md_addr != NULL && !strcmp (addr, md_addr)) - mail_display_load_images (md); - } - } -} - -static void -on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle, - gpointer user_data) -{ - MailDisplay *md = user_data; - GHashTable *urls; - CamelMedium *medium; - GByteArray *ba; - - urls = g_datalist_get_data (md->data, "part_urls"); - g_return_if_fail (urls != NULL); - - /* See if it refers to a MIME part (cid: or http:) */ - medium = g_hash_table_lookup (urls, url); - if (medium) { - CamelContentType *content_type; - CamelDataWrapper *data; - - g_return_if_fail (CAMEL_IS_MEDIUM (medium)); - - data = camel_medium_get_content_object (medium); - if (!mail_content_loaded (data, md, FALSE, url, handle)) - return; - - content_type = camel_data_wrapper_get_mime_type_field (data); - - if (header_content_type_is (content_type, "text", "*")) { - ba = mail_format_get_data_wrapper_text (data, md); - if (ba) { - gtk_html_write (html, handle, ba->data, ba->len); - - g_byte_array_free (ba, TRUE); - } - } else { - CamelStream *html_stream; - - html_stream = mail_stream_gtkhtml_new (html, handle); - camel_data_wrapper_write_to_stream (data, html_stream); - camel_object_unref (CAMEL_OBJECT (html_stream)); - } - - gtk_html_end (html, handle, GTK_HTML_STREAM_OK); - return; - } - - urls = g_datalist_get_data (md->data, "data_urls"); - g_return_if_fail (urls != NULL); - - /* See if it's some piece of cached data */ - ba = g_hash_table_lookup (urls, url); - if (ba) { - if (ba->len) { - gtk_html_write (html, handle, ba->data, ba->len); - /* printf ("-- begin --\n"); - printf (ba->data); - printf ("-- end --\n"); */ - } - gtk_html_end (html, handle, GTK_HTML_STREAM_OK); - return; - } - - /* See if it's something we can load. */ - if (strncmp (url, "http:", 5) == 0) { - if (mail_config_get_http_mode () == MAIL_CONFIG_HTTP_ALWAYS || - g_datalist_get_data (md->data, "load_images")) { - ba = g_byte_array_new (); - g_hash_table_insert (urls, g_strdup (url), ba); - mail_display_stream_write_when_loaded (md, ba, url, load_http, handle, - g_strdup (url)); - } else if (mail_config_get_http_mode () == MAIL_CONFIG_HTTP_SOMETIMES && - !g_datalist_get_data (md->data, "checking_from")) { - const CamelInternetAddress *from = camel_mime_message_get_from (md->current_message); - const char *name, *addr; - - g_datalist_set_data (md->data, "checking_from", - GINT_TO_POINTER (1)); - - /* Make sure we aren't deal w/ some sort of a pathological message w/o a From: header */ - if (from != NULL && camel_internet_address_get (from, 0, &name, &addr)) - e_book_query_address_locally (addr, ebook_callback, md); - else - gtk_html_end (html, handle, GTK_HTML_STREAM_ERROR); - } - } -} - -struct _load_content_msg { - struct _mail_msg msg; - - MailDisplay *display; - - GtkHTMLStream *handle; - gint redisplay_counter; - gchar *url; - CamelMimeMessage *message; - void (*callback)(MailDisplay *, gpointer); - gpointer data; -}; - -static char * -load_content_desc (struct _mail_msg *mm, int done) -{ - return g_strdup (_("Loading message content")); -} - -static void -load_content_load (struct _mail_msg *mm) -{ - struct _load_content_msg *m = (struct _load_content_msg *)mm; - - m->callback (m->display, m->data); -} - -static gboolean -try_part_urls (struct _load_content_msg *m) -{ - GHashTable *urls; - CamelMedium *medium; - - urls = g_datalist_get_data (m->display->data, "part_urls"); - g_return_val_if_fail (urls != NULL, FALSE); - - /* See if it refers to a MIME part (cid: or http:) */ - medium = g_hash_table_lookup (urls, m->url); - if (medium) { - CamelDataWrapper *data; - CamelStream *html_stream; - - g_return_val_if_fail (CAMEL_IS_MEDIUM (medium), FALSE); - - data = camel_medium_get_content_object (medium); - if (!mail_content_loaded (data, m->display, FALSE, m->url, m->handle)) { - g_warning ("This code should not be reached\n"); - return TRUE; - } - - html_stream = mail_stream_gtkhtml_new (m->display->html, m->handle); - camel_data_wrapper_write_to_stream (data, html_stream); - camel_object_unref (CAMEL_OBJECT (html_stream)); - - gtk_html_end (m->display->html, m->handle, GTK_HTML_STREAM_OK); - return TRUE; - } - - return FALSE; -} - -static gboolean -try_data_urls (struct _load_content_msg *m) -{ - GHashTable *urls; - GByteArray *ba; - - urls = g_datalist_get_data (m->display->data, "data_urls"); - ba = g_hash_table_lookup (urls, m->url); - - printf ("url: %s data: %p len: %d\n", m->url, ba, ba ? ba->len : -1); - if (ba) { - if (ba->len) { - printf ("writing ...\n"); - gtk_html_write (m->display->html, m->handle, ba->data, ba->len); - } - gtk_html_end (m->display->html, m->handle, GTK_HTML_STREAM_OK); - return TRUE; - } - - return FALSE; -} - -static void -load_content_loaded (struct _mail_msg *mm) -{ - struct _load_content_msg *m = (struct _load_content_msg *)mm; - - if (GTK_OBJECT_DESTROYED (m->display)) - return; - - if (m->display->current_message == m->message) { - if (m->handle) { - printf ("handle: %p orig: %d actual: %d\n", m->handle, - m->redisplay_counter, - m->display->redisplay_counter); - if (m->redisplay_counter == m->display->redisplay_counter) { - if (!try_part_urls (m) && !try_data_urls (m)) - gtk_html_end (m->display->html, m->handle, GTK_HTML_STREAM_ERROR); - } - } else - mail_display_redisplay (m->display, FALSE); - } -} - -static void -load_content_free (struct _mail_msg *mm) -{ - struct _load_content_msg *m = (struct _load_content_msg *)mm; - - g_free (m->url); - gtk_object_unref (GTK_OBJECT (m->display)); - camel_object_unref (CAMEL_OBJECT (m->message)); -} - -static struct _mail_msg_op load_content_op = { - load_content_desc, - load_content_load, - load_content_loaded, - load_content_free, -}; - -static void -stream_write_or_redisplay_when_loaded (MailDisplay *md, - gconstpointer key, - const gchar *url, - void (*callback)(MailDisplay *, gpointer), - GtkHTMLStream *handle, - gpointer data) -{ - struct _load_content_msg *m; - GHashTable *loading; - - loading = g_datalist_get_data (md->data, "loading"); - if (loading) { - if (g_hash_table_lookup (loading, key)) - return; - } else { - loading = g_hash_table_new (NULL, NULL); - g_datalist_set_data_full (md->data, "loading", loading, - (GDestroyNotify)g_hash_table_destroy); - } - g_hash_table_insert (loading, (gpointer)key, GINT_TO_POINTER (1)); - - m = mail_msg_new (&load_content_op, NULL, sizeof (*m)); - m->display = md; - gtk_object_ref (GTK_OBJECT (m->display)); - m->handle = handle; - m->url = g_strdup (url); - m->redisplay_counter = md->redisplay_counter; - m->message = md->current_message; - camel_object_ref (CAMEL_OBJECT (m->message)); - m->callback = callback; - m->data = data; - - e_thread_put (mail_thread_queued, (EMsg *)m); - return; -} - -void -mail_display_stream_write_when_loaded (MailDisplay *md, - gconstpointer key, - const gchar *url, - void (*callback)(MailDisplay *, gpointer), - GtkHTMLStream *handle, - gpointer data) -{ - stream_write_or_redisplay_when_loaded (md, key, url, callback, handle, data); -} - -void -mail_display_redisplay_when_loaded (MailDisplay *md, - gconstpointer key, - void (*callback)(MailDisplay *, gpointer), - gpointer data) -{ - stream_write_or_redisplay_when_loaded (md, key, NULL, callback, NULL, data); -} - -void -mail_text_write (GtkHTML *html, GtkHTMLStream *stream, const char *text) -{ - char *htmltext; - - htmltext = e_text_to_html_full (text, E_TEXT_TO_HTML_CONVERT_URLS | - E_TEXT_TO_HTML_CONVERT_ADDRESSES | - E_TEXT_TO_HTML_CONVERT_NL | - E_TEXT_TO_HTML_CONVERT_SPACES | - (mail_config_get_citation_highlight () ? E_TEXT_TO_HTML_MARK_CITATION : 0), - mail_config_get_citation_color ()); - - gtk_html_write (html, stream, "<tt>", 4); - gtk_html_write (html, stream, htmltext, strlen (htmltext)); - gtk_html_write (html, stream, "</tt>", 5); - g_free (htmltext); -} - -void -mail_error_printf (GtkHTML *html, GtkHTMLStream *stream, - const char *format, ...) -{ - char *buf, *htmltext; - va_list ap; - - va_start (ap, format); - buf = g_strdup_vprintf (format, ap); - va_end (ap); - - htmltext = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS); - g_free (buf); - - gtk_html_stream_printf (stream, "<em><font color=red>"); - gtk_html_stream_write (stream, htmltext, strlen (htmltext)); - gtk_html_stream_printf (stream, "</font></em>"); - - g_free (htmltext); -} - -static void -clear_data (CamelObject *object, gpointer event_data, gpointer user_data) -{ - GData *data = user_data; - - g_datalist_clear (&data); -} - -/** - * mail_display_redisplay: - * @mail_display: the mail display object - * @unscroll: specifies whether or not to lose current scroll - * - * Force a redraw of the message display. - **/ -void -mail_display_redisplay (MailDisplay *md, gboolean unscroll) -{ - md->last_active = NULL; - md->redisplay_counter ++; - /* printf ("md %p redisplay %d\n", md, md->redisplay_counter); */ - - md->stream = gtk_html_begin (GTK_HTML (md->html)); - if (!unscroll) { - /* This is a hack until there's a clean way to do this. */ - GTK_HTML (md->html)->engine->newPage = FALSE; - } - - mail_html_write (md->html, md->stream, "<!doctype html public \"-//W3C//DTD HTML 4.0 TRANSITIONAL//EN\">\n<html>\n<head>\n<meta name=\"generator\" content=\"Evolution Mail Component\">\n</head>\n"); - mail_html_write (md->html, md->stream, "<body marginwidth=0 marginheight=0>\n"); - - if (md->current_message) { - if (md->display_style == MAIL_CONFIG_DISPLAY_SOURCE) - mail_format_raw_message (md->current_message, md); - else - mail_format_mime_message (md->current_message, md); - } - - mail_html_write (md->html, md->stream, "</body></html>\n"); - gtk_html_end (md->html, md->stream, GTK_HTML_STREAM_OK); - md->stream = NULL; -} - - -/** - * mail_display_set_message: - * @mail_display: the mail display object - * @medium: the input camel medium, or %NULL - * - * Makes the mail_display object show the contents of the medium - * param. - **/ -void -mail_display_set_message (MailDisplay *md, CamelMedium *medium) -{ - /* For the moment, we deal only with CamelMimeMessage, but in - * the future, we should be able to deal with any medium. - */ - if (medium && !CAMEL_IS_MIME_MESSAGE (medium)) - return; - - /* Clean up from previous message. */ - if (md->current_message) - camel_object_unref (CAMEL_OBJECT (md->current_message)); - - md->current_message = (CamelMimeMessage*)medium; - - g_datalist_init (md->data); - mail_display_redisplay (md, TRUE); - if (medium) { - camel_object_hook_event (CAMEL_OBJECT (medium), "finalize", - clear_data, *(md->data)); - } -} - -/** - * mail_display_set_message: - * @mail_display: the mail display object - * @medium: the input camel medium, or %NULL - * - * Makes the mail_display object show the contents of the medium - * param. - **/ -void -mail_display_set_charset (MailDisplay *mail_display, const char *charset) -{ - g_free (mail_display->charset); - mail_display->charset = g_strdup (charset); - - mail_display_queue_redisplay (mail_display); -} - -/** - * mail_display_load_images: - * @md: the mail display object - * - * Load all HTTP images in the current message - **/ -void -mail_display_load_images (MailDisplay *md) -{ - g_datalist_set_data (md->data, "load_images", GINT_TO_POINTER (1)); - mail_display_redisplay (md, FALSE); -} - -/*----------------------------------------------------------------------* - * Standard Gtk+ Class functions - *----------------------------------------------------------------------*/ - -static void -mail_display_init (GtkObject *object) -{ - MailDisplay *mail_display = MAIL_DISPLAY (object); - - mail_display->current_message = NULL; - mail_display->scroll = NULL; - mail_display->html = NULL; - mail_display->redisplay_counter = 0; - mail_display->stream = NULL; - mail_display->last_active = NULL; - mail_display->idle_id = 0; - mail_display->selection = NULL; - mail_display->current_message = NULL; - mail_display->data = NULL; - - mail_display->invisible = gtk_invisible_new (); - - mail_display->display_style = mail_config_get_message_display_style (); -} - -static void -mail_display_destroy (GtkObject *object) -{ - MailDisplay *mail_display = MAIL_DISPLAY (object); - - g_free (mail_display->charset); - g_free (mail_display->selection); - - g_datalist_clear (mail_display->data); - g_free (mail_display->data); - mail_display->data = NULL; - - if (mail_display->idle_id) - gtk_timeout_remove(mail_display->idle_id); - - gtk_widget_unref (mail_display->invisible); - - mail_display_parent_class->destroy (object); -} - -static void -invisible_selection_get_callback (GtkWidget *widget, - GtkSelectionData *selection_data, - guint info, - guint time, - void *data) -{ - MailDisplay *display; - - display = MAIL_DISPLAY (data); - - if (!display->selection) - return; - - g_assert (info == 1); - - gtk_selection_data_set (selection_data, GDK_SELECTION_TYPE_STRING, 8, - display->selection, strlen (display->selection)); -} - -static gint -invisible_selection_clear_event_callback (GtkWidget *widget, - GdkEventSelection *event, - void *data) -{ - MailDisplay *display; - - display = MAIL_DISPLAY (data); - - g_free (display->selection); - display->selection = NULL; - - return TRUE; -} - -static void -mail_display_class_init (GtkObjectClass *object_class) -{ - object_class->destroy = mail_display_destroy; - mail_display_parent_class = gtk_type_class (PARENT_TYPE); - - thumbnail_cache = g_hash_table_new (g_str_hash, g_str_equal); -} - -static void -link_open_in_browser (GtkWidget *w, MailDisplay *mail_display) -{ - on_link_clicked (mail_display->html, mail_display->html->pointer_url, - mail_display); -} - -#if 0 -static void -link_save_as (GtkWidget *w, MailDisplay *mail_display) -{ - g_print ("FIXME save %s\n", mail_display->html->pointer_url); -} -#endif - -static void -link_copy_location (GtkWidget *w, MailDisplay *mail_display) -{ - GdkAtom clipboard_atom; - - g_free (mail_display->selection); - mail_display->selection = g_strdup (mail_display->html->pointer_url); - - clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE); - if (clipboard_atom == GDK_NONE) - return; /* failed */ - - /* We don't check the return values of the following since there is not - * much we can do if we cannot assert the selection. - */ - - gtk_selection_owner_set (GTK_WIDGET (mail_display->invisible), - GDK_SELECTION_PRIMARY, - GDK_CURRENT_TIME); - gtk_selection_owner_set (GTK_WIDGET (mail_display->invisible), - clipboard_atom, - GDK_CURRENT_TIME); -} - -static void -image_save_as (GtkWidget *w, MailDisplay *mail_display) -{ - const char *src; - - src = gtk_object_get_data (GTK_OBJECT (mail_display), "current_src_uri"); - - g_warning ("loading uri=%s", src); - - save_url (mail_display, src); -} - -enum { - /* - * This is used to mask the link specific menu items. - */ - MASK_URL = 1, - - /* - * This is used to mask src specific menu items. - */ - MASK_SRC = 2 -}; - -#define SEPARATOR { "", NULL, (NULL), NULL, 0 } -#define TERMINATOR { NULL, NULL, (NULL), NULL, 0 } - -static EPopupMenu link_menu [] = { - { N_("Open Link in Browser"), NULL, - GTK_SIGNAL_FUNC (link_open_in_browser), NULL, MASK_URL }, - { N_("Copy Link Location"), NULL, - GTK_SIGNAL_FUNC (link_copy_location), NULL, MASK_URL }, -#if 0 - { N_("Save Link as (FIXME)"), NULL, - GTK_SIGNAL_FUNC (link_save_as), NULL, MASK_URL }, -#endif - { N_("Save Image as..."), NULL, - GTK_SIGNAL_FUNC (image_save_as), NULL, MASK_SRC }, - - TERMINATOR -}; - - -/* - * Create a window and popup our widget, with reasonable semantics for the popup - * disappearing, etc. - */ - -typedef struct _PopupInfo PopupInfo; -struct _PopupInfo { - GtkWidget *w; - GtkWidget *win; - guint destroy_timeout; - guint widget_destroy_handle; - Bonobo_EventSource_ListenerId listener_id; - gboolean hidden; -}; - -/* Aiieee! Global Data! */ -static GtkWidget *the_popup = NULL; - -static void -popup_info_free (PopupInfo *pop) -{ - if (pop) { - if (pop->destroy_timeout) - gtk_timeout_remove (pop->destroy_timeout); - - bonobo_event_source_client_remove_listener (bonobo_widget_get_objref (BONOBO_WIDGET (pop->w)), - pop->listener_id, - NULL); - - g_free (pop); - } -} - -static void -popup_window_destroy_cb (GtkWidget *w, gpointer user_data) -{ - PopupInfo *pop = (PopupInfo *) user_data; - - the_popup = NULL; - - popup_info_free (pop); -} - -static gint -popup_timeout_cb (gpointer user_data) -{ - PopupInfo *pop = (PopupInfo *) user_data; - - pop->destroy_timeout = 0; - gtk_widget_destroy (pop->win); - - return 0; -} - -static gint -popup_enter_cb (GtkWidget *w, GdkEventCrossing *ev, gpointer user_data) -{ - PopupInfo *pop = (PopupInfo *) user_data; - - if (pop->destroy_timeout) - gtk_timeout_remove (pop->destroy_timeout); - pop->destroy_timeout = 0; - - return 0; -} - -static gint -popup_leave_cb (GtkWidget *w, GdkEventCrossing *ev, gpointer user_data) -{ - PopupInfo *pop = (PopupInfo *) user_data; - - if (pop->destroy_timeout) - gtk_timeout_remove (pop->destroy_timeout); - - if (!pop->hidden) - pop->destroy_timeout = gtk_timeout_add (500, popup_timeout_cb, pop); - - return 0; -} - -static void -popup_realize_cb (GtkWidget *widget, gpointer user_data) -{ - PopupInfo *pop = (PopupInfo *) user_data; - - gtk_widget_add_events (pop->win, GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); - - if (pop->destroy_timeout == 0) { - if (!pop->hidden) { - pop->destroy_timeout = gtk_timeout_add (5000, popup_timeout_cb, pop); - } else { - pop->destroy_timeout = 0; - } - } -} - -static void -popup_size_allocate_cb (GtkWidget *widget, GtkAllocation *alloc, gpointer user_data) -{ - gint x, y, w, h, xmax, ymax; - - xmax = gdk_screen_width (); - ymax = gdk_screen_height (); - - gdk_window_get_pointer (NULL, &x, &y, NULL); - w = alloc->width; - h = alloc->height; - x = CLAMP (x - w/2, 0, xmax - w); - y = CLAMP (y - h/2, 0, ymax - h); - gtk_widget_set_uposition (widget, x, y); - -} - -static PopupInfo * -make_popup_window (GtkWidget *w) -{ - PopupInfo *pop = g_new0 (PopupInfo, 1); - GtkWidget *fr; - - /* Only allow for one popup at a time. Ugly. */ - if (the_popup) - gtk_widget_destroy (the_popup); - - pop->w = w; - the_popup = pop->win = gtk_window_new (GTK_WINDOW_POPUP); - fr = gtk_frame_new (NULL); - - gtk_container_add (GTK_CONTAINER (pop->win), fr); - gtk_container_add (GTK_CONTAINER (fr), w); - - gtk_window_set_policy (GTK_WINDOW (pop->win), FALSE, FALSE, FALSE); - - gtk_signal_connect (GTK_OBJECT (pop->win), - "destroy", - GTK_SIGNAL_FUNC (popup_window_destroy_cb), - pop); - gtk_signal_connect (GTK_OBJECT (pop->win), - "enter_notify_event", - GTK_SIGNAL_FUNC (popup_enter_cb), - pop); - gtk_signal_connect (GTK_OBJECT (pop->win), - "leave_notify_event", - GTK_SIGNAL_FUNC (popup_leave_cb), - pop); - gtk_signal_connect_after (GTK_OBJECT (pop->win), - "realize", - GTK_SIGNAL_FUNC (popup_realize_cb), - pop); - gtk_signal_connect (GTK_OBJECT (pop->win), - "size_allocate", - GTK_SIGNAL_FUNC (popup_size_allocate_cb), - pop); - - gtk_widget_show (w); - gtk_widget_show (fr); - gtk_widget_show (pop->win); - - return pop; -} - -static void -listener_cb (BonoboListener *listener, - char *event_name, - CORBA_any *any, - CORBA_Environment *ev, - gpointer user_data) -{ - PopupInfo *pop; - char *type; - - pop = user_data; - - if (pop->destroy_timeout) - gtk_timeout_remove (pop->destroy_timeout); - pop->destroy_timeout = 0; - - type = bonobo_event_subtype (event_name); - - if (!strcmp (type, "Destroy")) { - gtk_widget_destroy (GTK_WIDGET (pop->win)); - } else if (!strcmp (type, "Hide")) { - pop->hidden = TRUE; - gtk_widget_hide (GTK_WIDGET (pop->win)); - } - - g_free (type); -} - -static int -html_button_press_event (GtkWidget *widget, GdkEventButton *event, MailDisplay *mail_display) -{ - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - if (event->type == GDK_BUTTON_PRESS) { - if (event->button == 3) { - HTMLEngine *e; - HTMLPoint *point; - GtkWidget *popup_thing; - - e = GTK_HTML (widget)->engine; - point = html_engine_get_point_at (e, event->x + e->x_offset, event->y + e->y_offset, FALSE); - - if (point) { - const gchar *url; - const gchar *src; - - url = html_object_get_url (point->object); - src = html_object_get_src (point->object); - - if (url && !g_strncasecmp (url, "mailto:", 7)) { - PopupInfo *pop; - gchar *url_decoded = g_strdup (url); - camel_url_decode (url_decoded); - - popup_thing = bonobo_widget_new_control ("OAFIID:GNOME_Evolution_Addressbook_AddressPopup", - CORBA_OBJECT_NIL); - - bonobo_widget_set_property (BONOBO_WIDGET (popup_thing), - "email", url_decoded+7, - NULL); - g_free (url_decoded); - - pop = make_popup_window (popup_thing); - - pop->listener_id = - bonobo_event_source_client_add_listener (bonobo_widget_get_objref (BONOBO_WIDGET (popup_thing)), - listener_cb, NULL, NULL, pop); - - } else if (url || src) { - gint hide_mask = 0; - - if (!url) - hide_mask |= MASK_URL; - - if (!src) - hide_mask |= MASK_SRC; - - g_free (gtk_object_get_data (GTK_OBJECT (mail_display), "current_src_uri")); - gtk_object_set_data (GTK_OBJECT (mail_display), "current_src_uri", g_strdup (src)); - - e_popup_menu_run (link_menu, (GdkEvent *) event, 0, hide_mask, mail_display); - - } - - html_point_destroy (point); - } - - return TRUE; - } - } - - return FALSE; -} - -static inline void -set_underline (HTMLEngine *e, HTMLObject *o, gboolean underline) -{ - HTMLText *text = HTML_TEXT (o); - - html_text_set_font_style (text, e, underline - ? html_text_get_font_style (text) | GTK_HTML_FONT_STYLE_UNDERLINE - : html_text_get_font_style (text) & ~GTK_HTML_FONT_STYLE_UNDERLINE); - html_engine_queue_draw (e, o); -} - -static void -update_active (GtkWidget *widget, gint x, gint y, MailDisplay *mail_display) -{ - HTMLEngine *e; - HTMLPoint *point; - const gchar *email; - - e = GTK_HTML (widget)->engine; - - point = html_engine_get_point_at (e, x + e->x_offset, y + e->y_offset, FALSE); - if (mail_display->last_active && (!point || mail_display->last_active != point->object)) { - set_underline (e, HTML_OBJECT (mail_display->last_active), FALSE); - mail_display->last_active = NULL; - } - if (point) { - email = (const gchar *) html_object_get_data (point->object, "email"); - if (email && html_object_is_text (point->object)) { - set_underline (e, point->object, TRUE); - mail_display->last_active = point->object; - } - html_point_destroy (point); - } -} - -static gint -html_enter_notify_event (GtkWidget *widget, GdkEventCrossing *event, MailDisplay *mail_display) -{ - update_active (widget, event->x, event->y, mail_display); - - return TRUE; -} - -static gint -html_motion_notify_event (GtkWidget *widget, GdkEventMotion *event, MailDisplay *mail_display) -{ - gint x, y; - - g_return_val_if_fail (widget != NULL, 0); - g_return_val_if_fail (GTK_IS_HTML (widget), 0); - g_return_val_if_fail (event != NULL, 0); - - if (event->is_hint) - gdk_window_get_pointer (GTK_LAYOUT (widget)->bin_window, &x, &y, NULL); - else { - x = event->x; - y = event->y; - } - - update_active (widget, x, y, mail_display); - - return TRUE; -} - -static void -html_iframe_created (GtkWidget *w, GtkHTML *iframe, MailDisplay *mail_display) -{ - gtk_signal_connect (GTK_OBJECT (iframe), "button_press_event", - GTK_SIGNAL_FUNC (html_button_press_event), mail_display); - gtk_signal_connect (GTK_OBJECT (iframe), "motion_notify_event", - GTK_SIGNAL_FUNC (html_motion_notify_event), mail_display); - gtk_signal_connect (GTK_OBJECT (iframe), "enter_notify_event", - GTK_SIGNAL_FUNC (html_enter_notify_event), mail_display); -} - -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_status_message (const char *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 (message != NULL) - GNOME_Evolution_ShellView_setMessage (shell_view_interface, - message[0] ? 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)); -} - -/* For now show every url but possibly limit it to showing only http: - or ftp: urls */ -static void -html_on_url (GtkHTML *html, - const char *url, - MailDisplay *mail_display) -{ - static char *previous_url = NULL; - - /* This all looks silly but yes, this is the proper way to mix - GtkHTML's on_url with BonoboUIComponent statusbar */ - if (!url || (previous_url && (strcmp (url, previous_url) != 0))) - set_status_message ("", FALSE); - if (url) { - set_status_message (url, FALSE); - g_free (previous_url); - previous_url = g_strdup (url); - } -} - -GtkWidget * -mail_display_new (void) -{ - MailDisplay *mail_display = gtk_type_new (mail_display_get_type ()); - GtkWidget *scroll, *html; - GdkAtom clipboard_atom; - HTMLTokenizer *tok; - - gtk_box_set_homogeneous (GTK_BOX (mail_display), FALSE); - gtk_widget_show (GTK_WIDGET (mail_display)); - - scroll = e_scroll_frame_new (NULL, NULL); - e_scroll_frame_set_policy (E_SCROLL_FRAME (scroll), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - e_scroll_frame_set_shadow_type (E_SCROLL_FRAME (scroll), GTK_SHADOW_IN); - gtk_box_pack_start_defaults (GTK_BOX (mail_display), GTK_WIDGET (scroll)); - gtk_widget_show (GTK_WIDGET (scroll)); - - html = gtk_html_new (); - tok = e_searching_tokenizer_new (); - html_engine_set_tokenizer (GTK_HTML (html)->engine, tok); - gtk_object_unref (GTK_OBJECT (tok)); - - gtk_html_set_default_content_type (GTK_HTML (html), - "text/html; charset=utf-8"); - - gtk_html_set_editable (GTK_HTML (html), FALSE); - gtk_signal_connect (GTK_OBJECT (html), "url_requested", - GTK_SIGNAL_FUNC (on_url_requested), - mail_display); - gtk_signal_connect (GTK_OBJECT (html), "object_requested", - GTK_SIGNAL_FUNC (on_object_requested), - mail_display); - gtk_signal_connect (GTK_OBJECT (html), "link_clicked", - GTK_SIGNAL_FUNC (on_link_clicked), - mail_display); - gtk_signal_connect (GTK_OBJECT (html), "button_press_event", - GTK_SIGNAL_FUNC (html_button_press_event), mail_display); - gtk_signal_connect (GTK_OBJECT (html), "motion_notify_event", - GTK_SIGNAL_FUNC (html_motion_notify_event), mail_display); - gtk_signal_connect (GTK_OBJECT (html), "enter_notify_event", - GTK_SIGNAL_FUNC (html_enter_notify_event), mail_display); - gtk_signal_connect (GTK_OBJECT (html), "iframe_created", - GTK_SIGNAL_FUNC (html_iframe_created), mail_display); - gtk_signal_connect (GTK_OBJECT (html), "on_url", - GTK_SIGNAL_FUNC (html_on_url), mail_display); - - gtk_container_add (GTK_CONTAINER (scroll), html); - gtk_widget_show (GTK_WIDGET (html)); - - gtk_signal_connect (GTK_OBJECT (mail_display->invisible), "selection_get", - GTK_SIGNAL_FUNC (invisible_selection_get_callback), mail_display); - gtk_signal_connect (GTK_OBJECT (mail_display->invisible), "selection_clear_event", - GTK_SIGNAL_FUNC (invisible_selection_clear_event_callback), mail_display); - - gtk_selection_add_target (mail_display->invisible, - GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 1); - - clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE); - if (clipboard_atom != GDK_NONE) - gtk_selection_add_target (mail_display->invisible, - clipboard_atom, GDK_SELECTION_TYPE_STRING, 1); - - mail_display->scroll = E_SCROLL_FRAME (scroll); - mail_display->html = GTK_HTML (html); - mail_display->stream = NULL; - mail_display->last_active = NULL; - mail_display->data = g_new0 (GData *, 1); - g_datalist_init (mail_display->data); - - return GTK_WIDGET (mail_display); -} - -E_MAKE_TYPE (mail_display, "MailDisplay", MailDisplay, mail_display_class_init, mail_display_init, PARENT_TYPE); diff --git a/mail/mail-display.h b/mail/mail-display.h deleted file mode 100644 index 3602fe230b..0000000000 --- a/mail/mail-display.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -#ifndef _MAIL_DISPLAY_H_ -#define _MAIL_DISPLAY_H_ - -#include <gtk/gtkvbox.h> -#include <gtkhtml/gtkhtml.h> -#include <gtkhtml/gtkhtml-stream.h> - -#include <gal/widgets/e-scroll-frame.h> - -#include <camel/camel-stream.h> -#include <camel/camel-mime-message.h> -#include <camel/camel-medium.h> - -#include "mail-types.h" -#include "mail-config.h" /*display_style*/ - -#define MAIL_DISPLAY_TYPE (mail_display_get_type ()) -#define MAIL_DISPLAY(o) (GTK_CHECK_CAST ((o), MAIL_DISPLAY_TYPE, MailDisplay)) -#define MAIL_DISPLAY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), MAIL_DISPLAY_TYPE, MailDisplayClass)) -#define IS_MAIL_DISPLAY(o) (GTK_CHECK_TYPE ((o), MAIL_DISPLAY_TYPE)) -#define IS_MAIL_DISPLAY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MAIL_DISPLAY_TYPE)) - -struct _MailDisplay { - GtkVBox parent; - - EScrollFrame *scroll; - GtkHTML *html; - GtkHTMLStream *stream; - gint redisplay_counter; - gpointer last_active; - guint idle_id; - - char *charset; - - char *selection; - - CamelMimeMessage *current_message; - GData **data; - - /* Sigh. This shouldn't be needed. I haven't figured out why it is - though. */ - GtkWidget *invisible; - - MailConfigDisplayStyle display_style; -}; - -typedef struct { - GtkVBoxClass parent_class; -} MailDisplayClass; - -GtkType mail_display_get_type (void); -GtkWidget * mail_display_new (void); - -void mail_display_queue_redisplay (MailDisplay *mail_display); -void mail_display_redisplay (MailDisplay *mail_display, gboolean unscroll); -void mail_display_redisplay_when_loaded (MailDisplay *md, - gconstpointer key, - void (*callback)(MailDisplay *, gpointer), - gpointer data); -void mail_display_stream_write_when_loaded (MailDisplay *md, - gconstpointer key, - const gchar *url, - void (*callback)(MailDisplay *, gpointer), - GtkHTMLStream *handle, - gpointer data); - -void mail_display_set_message (MailDisplay *mail_display, - CamelMedium *medium); - -void mail_display_set_charset (MailDisplay *mail_display, - const char *charset); - -void mail_display_load_images (MailDisplay *mail_display); - - -#define mail_html_write(html, stream, string) gtk_html_write (html, stream, string, strlen (string)) - -void mail_text_write (GtkHTML *html, - GtkHTMLStream *stream, - const char *text); -void mail_error_printf (GtkHTML *html, - GtkHTMLStream *stream, - const char *format, ...); - -#endif /* _MAIL_DISPLAY_H_ */ diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c deleted file mode 100644 index 7cf21ca1da..0000000000 --- a/mail/mail-folder-cache.c +++ /dev/null @@ -1,815 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Authors: Peter Williams <peterw@ximian.com> - * Michael Zucchi <notzed@ximian.com> - * - * Copyright 2000,2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 "config.h" -#endif - -#ifdef G_LOG_DOMAIN -#undef G_LOG_DOMAIN -#endif -#define G_LOG_DOMAIN "folder tree" - -#include <pthread.h> - -#include <bonobo/bonobo-exception.h> -#include <camel/camel-store.h> -#include <camel/camel-folder.h> -#include <camel/camel-vtrash-folder.h> -#include <camel/camel-vee-store.h> -#include <gal/util/e-unicode-i18n.h> - -#include "mail-mt.h" -#include "mail-folder-cache.h" -#include "mail-ops.h" - -/* For notifications of changes */ -#include "mail-vfolder.h" -#include "mail-autofilter.h" - -#define w(x) -#define d(x) - -/* note that many things are effectively serialised by having them run in - the main loop thread which they need to do because of corba/gtk calls */ -#define LOCK(x) pthread_mutex_lock(&x) -#define UNLOCK(x) pthread_mutex_unlock(&x) - -static pthread_mutex_t info_lock = PTHREAD_MUTEX_INITIALIZER; - -struct _folder_info { - struct _store_info *store_info; /* 'parent' link */ - - char *path; /* shell path */ - char *full_name; /* full name of folder/folderinfo */ - char *uri; /* uri of folder */ - - CamelFolder *folder; /* if known */ -}; - -/* pending list of updates */ -struct _folder_update { - struct _folder_update *next; - struct _folder_update *prev; - - unsigned int remove:1; /* removing from vfolders */ - unsigned int delete:1; /* deleting as well? */ - unsigned int add:1; /* add to vfolder */ - - char *path; - char *name; - char *uri; - char *oldpath; - char *olduri; - - int unread; - CamelStore *store; -}; - -struct _store_info { - GHashTable *folders; /* by full_name */ - GHashTable *folders_uri; /* by uri */ - - CamelStore *store; /* the store for these folders */ - - /* only 1 should be set */ - EvolutionStorage *storage; - GNOME_Evolution_Storage corba_storage; - - /* Outstanding folderinfo requests */ - EDList folderinfo_updates; -}; - -static void folder_changed(CamelObject *o, gpointer event_data, gpointer user_data); -static void folder_deleted(CamelObject *o, gpointer event_data, gpointer user_data); -static void folder_renamed(CamelObject *o, gpointer event_data, gpointer user_data); -static void folder_finalised(CamelObject *o, gpointer event_data, gpointer user_data); - -/* Store to storeinfo table, active stores */ -static GHashTable *stores; - -/* List of folder changes to be executed in gui thread */ -static EDList updates = E_DLIST_INITIALISER(updates); -static int update_id = -1; - -/* hack for people who LIKE to have unsent count */ -static int count_sent = FALSE; -static int count_trash = FALSE; - -static void -free_update(struct _folder_update *up) -{ - g_free(up->path); - g_free(up->name); - g_free(up->uri); - if (up->store) - camel_object_unref((CamelObject *)up->store); - g_free(up->oldpath); - g_free(up->olduri); - g_free(up); -} - -static void -real_flush_updates(void *o, void *event_data, void *data) -{ - struct _folder_update *up; - struct _store_info *si; - EvolutionStorage *storage; - GNOME_Evolution_Storage corba_storage; - CORBA_Environment ev; - - LOCK(info_lock); - while ((up = (struct _folder_update *)e_dlist_remhead(&updates))) { - - si = g_hash_table_lookup(stores, up->store); - if (si) { - storage = si->storage; - if (storage) - bonobo_object_ref((BonoboObject *)storage); - corba_storage = si->corba_storage; - } else { - storage = NULL; - corba_storage = CORBA_OBJECT_NIL; - } - - UNLOCK(info_lock); - - if (up->remove) { - if (up->delete) { - mail_vfolder_delete_uri(up->store, up->uri); - mail_filter_delete_uri(up->store, up->uri); - } else - mail_vfolder_add_uri(up->store, up->uri, TRUE); - } else { - /* Its really a rename, but we have no way of telling the shell that, so remove it */ - if (up->oldpath) { - if (storage != NULL) { - d(printf("Removing old folder (rename?) '%s'\n", up->oldpath)); - evolution_storage_removed_folder(storage, up->oldpath); - } - /* ELSE? Shell supposed to handle the local snot case */ - } - - /* We can tell the vfolder code though */ - if (up->olduri && up->add) { - d(printf("renaming folder '%s' to '%s'\n", up->olduri, up->uri)); - mail_vfolder_rename_uri(up->store, up->olduri, up->uri); - mail_filter_rename_uri(up->store, up->olduri, up->uri); - } - - if (up->name == NULL) { - if (storage != NULL) { - d(printf("Updating existing folder: %s (%d unread)\n", up->path, up->unread)); - evolution_storage_update_folder(storage, up->path, up->unread); - } else if (corba_storage != CORBA_OBJECT_NIL) { - d(printf("Updating existing (local) folder: %s (%d unread)\n", up->path, up->unread)); - CORBA_exception_init(&ev); - GNOME_Evolution_Storage_updateFolder(corba_storage, up->path, up->unread, &ev); - CORBA_exception_free(&ev); - } - } else if (storage != NULL) { - char *type = (strncmp(up->uri, "vtrash:", 7)==0)?"vtrash":"mail"; - - d(printf("Adding new folder: %s\n", up->path)); - evolution_storage_new_folder(storage, up->path, up->name, type, up->uri, up->name, up->unread); - } - - if (!up->olduri && up->add) - mail_vfolder_add_uri(up->store, up->uri, FALSE); - } - - free_update(up); - - if (storage) - bonobo_object_unref((BonoboObject *)storage); - - LOCK(info_lock); - } - update_id = -1; - UNLOCK(info_lock); -} - -static void -flush_updates(void) -{ - if (update_id == -1 && !e_dlist_empty(&updates)) - update_id = mail_async_event_emit(mail_async_event, MAIL_ASYNC_GUI, (MailAsyncFunc)real_flush_updates, 0, 0, 0); -} - -static void -unset_folder_info(struct _folder_info *mfi, int delete) -{ - struct _folder_update *up; - - if (mfi->folder) { - CamelFolder *folder = mfi->folder; - - camel_object_unhook_event((CamelObject *)folder, "folder_changed", folder_changed, mfi); - camel_object_unhook_event((CamelObject *)folder, "message_changed", folder_changed, mfi); - camel_object_unhook_event((CamelObject *)folder, "deleted", folder_deleted, mfi); - camel_object_unhook_event((CamelObject *)folder, "renamed", folder_renamed, mfi); - camel_object_unhook_event((CamelObject *)folder, "finalize", folder_finalised, mfi); - } - - if (strstr(mfi->uri, ";noselect") == NULL) { - up = g_malloc0(sizeof(*up)); - - up->remove = TRUE; - up->delete = delete; - up->store = mfi->store_info->store; - camel_object_ref((CamelObject *)up->store); - up->uri = g_strdup(mfi->uri); - - e_dlist_addtail(&updates, (EDListNode *)up); - flush_updates(); - } -} - -static void -free_folder_info(struct _folder_info *mfi) -{ - g_free(mfi->path); - g_free(mfi->full_name); - g_free(mfi->uri); - g_free(mfi); -} - -/* This is how unread counts work (and don't work): - * - * camel_folder_unread_message_count() only gives a correct answer if - * the store is paying attention to the folder. (Some stores always - * pay attention to all folders, but IMAP can only pay attention to - * one folder at a time.) But it doesn't have any way to know when - * it's lying, so it's only safe to call it when you know for sure - * that the store is paying attention to the folder, such as when it's - * just been created, or you get a folder_changed or message_changed - * signal on it. - * - * camel_store_get_folder_info() always gives correct answers for the - * folders it checks, but it can also return -1 for a folder, meaning - * it didn't check, and so you should stick with your previous answer. - * - * update_1folder is called from three places: with info != NULL when - * the folder is created (or get_folder_info), with info == NULL when - * a folder changed event is emitted. - * - * So if info is NULL, camel_folder_unread_message_count is correct, - * and if it's not NULL and its unread_message_count isn't -1, then - * it's correct. */ - -static void -update_1folder(struct _folder_info *mfi, CamelFolderInfo *info) -{ - struct _store_info *si; - struct _folder_update *up; - CamelFolder *folder; - int unread = -1; - extern CamelFolder *outbox_folder, *sent_folder; - - si = mfi->store_info; - - folder = mfi->folder; - if (folder) { - if ((count_trash && CAMEL_IS_VTRASH_FOLDER (folder)) - || folder == outbox_folder - || (count_sent && folder == sent_folder)) { - unread = camel_folder_get_message_count(folder); - } else { - if (info) - unread = info->unread_message_count; - else - unread = camel_folder_get_unread_message_count (folder); - } - } else if (info) - unread = info->unread_message_count; - - if (unread == -1) - return; - - up = g_malloc0(sizeof(*up)); - up->path = g_strdup(mfi->path); - up->unread = unread; - up->store = mfi->store_info->store; - camel_object_ref((CamelObject *)up->store); - e_dlist_addtail(&updates, (EDListNode *)up); - flush_updates(); -} - -static void -setup_folder(CamelFolderInfo *fi, struct _store_info *si) -{ - struct _folder_info *mfi; - struct _folder_update *up; - - mfi = g_hash_table_lookup(si->folders, fi->full_name); - if (mfi) { - update_1folder(mfi, fi); - } else { - /* always 'add it', but only 'add it' to non-local stores */ - /*d(printf("Adding new folder: %s (%s) %d unread\n", fi->path, fi->url, fi->unread_message_count));*/ - mfi = g_malloc0(sizeof(*mfi)); - mfi->path = g_strdup(fi->path); - mfi->full_name = g_strdup(fi->full_name); - mfi->uri = g_strdup(fi->url); - mfi->store_info = si; - g_hash_table_insert(si->folders, mfi->full_name, mfi); - g_hash_table_insert(si->folders_uri, mfi->uri, mfi); - - up = g_malloc0(sizeof(*up)); - up->path = g_strdup(mfi->path); - if (si->storage != NULL) { - up->name = g_strdup(fi->name); - } - up->uri = g_strdup(fi->url); - up->unread = (fi->unread_message_count==-1)?0:fi->unread_message_count; - up->store = si->store; - camel_object_ref((CamelObject *)up->store); - if (strstr(fi->url, ";noselect") == NULL) - up->add = TRUE; - - e_dlist_addtail(&updates, (EDListNode *)up); - flush_updates(); - } -} - -static void -create_folders(CamelFolderInfo *fi, struct _store_info *si) -{ - d(printf("Setup new folder: %s\n", fi->url)); - - setup_folder(fi, si); - - if (fi->child) - create_folders(fi->child, si); - if (fi->sibling) - create_folders(fi->sibling, si); -} - -static void -folder_changed(CamelObject *o, gpointer event_data, gpointer user_data) -{ - struct _folder_info *mfi = user_data; - - if (mfi->folder != CAMEL_FOLDER(o)) - return; - - LOCK(info_lock); - update_1folder(mfi, NULL); - UNLOCK(info_lock); -} - -static void -folder_finalised(CamelObject *o, gpointer event_data, gpointer user_data) -{ - struct _folder_info *mfi = user_data; - - d(printf("Folder finalised '%s'!\n", ((CamelFolder *)o)->full_name)); - LOCK(info_lock); - mfi->folder = NULL; - UNLOCK(info_lock); -} - -static void -folder_deleted(CamelObject *o, gpointer event_data, gpointer user_data) -{ - struct _folder_info *mfi = user_data; - - d(printf("Folder deleted '%s'!\n", ((CamelFolder *)o)->full_name)); - LOCK(info_lock); - mfi->folder = NULL; - UNLOCK(info_lock); -} - -static void -folder_renamed(CamelObject *o, gpointer event_data, gpointer user_data) -{ - struct _folder_info *mfi = user_data; - CamelFolder *folder = (CamelFolder *)o; - char *old = event_data; - - d(printf("Folder renamed from '%s' to '%s'\n", old, folder->full_name)); - - mfi = mfi; - old = old; - folder = folder; - /* Dont do anything, do it from the store rename event? */ -} - -void mail_note_folder(CamelFolder *folder) -{ - CamelStore *store = folder->parent_store; - struct _store_info *si; - struct _folder_info *mfi; - - if (stores == NULL) { - g_warning("Adding a folder `%s' to a store which hasn't been added yet?\n", folder->full_name); - return; - } - - LOCK(info_lock); - si = g_hash_table_lookup(stores, store); - if (si == NULL) { - /*g_warning("Adding a folder `%s' to a store %p which hasn't been added yet?", folder->full_name, store);*/ - UNLOCK(info_lock); - return; - } - - mfi = g_hash_table_lookup(si->folders, folder->full_name); - if (mfi == NULL) { - w(g_warning("Adding a folder `%s' that I dont know about yet?", folder->full_name)); - UNLOCK(info_lock); - return; - } - - /* dont do anything if we already have this */ - if (mfi->folder == folder) { - UNLOCK(info_lock); - return; - } - - mfi->folder = folder; - - camel_object_hook_event((CamelObject *)folder, "folder_changed", folder_changed, mfi); - camel_object_hook_event((CamelObject *)folder, "message_changed", folder_changed, mfi); - camel_object_hook_event((CamelObject *)folder, "deleted", folder_deleted, mfi); - camel_object_hook_event((CamelObject *)folder, "renamed", folder_renamed, mfi); - camel_object_hook_event((CamelObject *)folder, "finalize", folder_finalised, mfi); - - update_1folder(mfi, NULL); - - UNLOCK(info_lock); -} - -static void -store_folder_subscribed(CamelObject *o, void *event_data, void *data) -{ - struct _store_info *si; - CamelFolderInfo *fi = event_data; - - d(printf("Store folder subscribed '%s' store '%s' \n", fi->full_name, camel_url_to_string(((CamelService *)o)->url, 0))); - - LOCK(info_lock); - si = g_hash_table_lookup(stores, o); - if (si) - setup_folder(fi, si); - UNLOCK(info_lock); -} - -static void -store_folder_created(CamelObject *o, void *event_data, void *data) -{ - /* we only want created events to do more work if we dont support subscriptions */ - if (!camel_store_supports_subscriptions(CAMEL_STORE(o))) - store_folder_subscribed(o, event_data, data); -} - -static void -store_folder_unsubscribed(CamelObject *o, void *event_data, void *data) -{ - struct _store_info *si; - CamelFolderInfo *fi = event_data; - struct _folder_info *mfi; - CamelStore *store = (CamelStore *)o; - - d(printf("Folder deleted: %s\n", fi->full_name)); - - LOCK(info_lock); - si = g_hash_table_lookup(stores, store); - if (si) { - mfi = g_hash_table_lookup(si->folders, fi->full_name); - if (mfi) { - g_hash_table_remove(si->folders, mfi->full_name); - g_hash_table_remove(si->folders_uri, mfi->uri); - unset_folder_info(mfi, TRUE); - free_folder_info(mfi); - } - } - UNLOCK(info_lock); -} - -static void -store_folder_deleted(CamelObject *o, void *event_data, void *data) -{ - /* we only want deleted events to do more work if we dont support subscriptions */ - if (!camel_store_supports_subscriptions(CAMEL_STORE(o))) - store_folder_unsubscribed(o, event_data, data); -} - -static void -rename_folders(struct _store_info *si, const char *oldbase, const char *newbase, CamelFolderInfo *fi) -{ - char *old; - struct _folder_info *mfi; - struct _folder_update *up; - - up = g_malloc0(sizeof(*up)); - - d(printf("oldbase '%s' newbase '%s' new '%s'\n", oldbase, newbase, fi->full_name)); - - /* Form what was the old name, and try and look it up */ - old = g_strdup_printf("%s%s", oldbase, fi->full_name + strlen(newbase)); - mfi = g_hash_table_lookup(si->folders, old); - if (mfi) { - d(printf("Found old folder '%s' renaming to '%s'\n", mfi->full_name, fi->full_name)); - - up->oldpath = mfi->path; - up->olduri = mfi->uri; - - /* Its a rename op */ - g_hash_table_remove(si->folders, mfi->full_name); - g_hash_table_remove(si->folders, mfi->uri); - g_free(mfi->full_name); - mfi->path = g_strdup(fi->path); - mfi->full_name = g_strdup(fi->full_name); - mfi->uri = g_strdup(fi->url); - g_hash_table_insert(si->folders, mfi->full_name, mfi); - g_hash_table_insert(si->folders_uri, mfi->uri, mfi); - } else { - d(printf("Rename found a new folder? old '%s' new '%s'\n", old, fi->full_name)); - /* Its a new op */ - mfi = g_malloc0(sizeof(*mfi)); - mfi->path = g_strdup(fi->path); - mfi->full_name = g_strdup(fi->full_name); - mfi->uri = g_strdup(fi->url); - mfi->store_info = si; - g_hash_table_insert(si->folders, mfi->full_name, mfi); - g_hash_table_insert(si->folders_uri, mfi->uri, mfi); - } - - g_free(old); - - up->path = g_strdup(mfi->path); - if (si->storage) - up->name = g_strdup(fi->name); - up->uri = g_strdup(mfi->uri); - up->unread = fi->unread_message_count==-1?0:fi->unread_message_count; - up->store = si->store; - camel_object_ref((CamelObject *)up->store); - if (strstr(fi->url, ";noselect") == NULL) - up->add = TRUE; - - e_dlist_addtail(&updates, (EDListNode *)up); - flush_updates(); -#if 0 - if (fi->sibling) - rename_folders(si, oldbase, newbase, fi->sibling, folders); - if (fi->child) - rename_folders(si, oldbase, newbase, fi->child, folders); -#endif -} - -static void -get_folders(CamelFolderInfo *fi, GPtrArray *folders) -{ - g_ptr_array_add(folders, fi); - - if (fi->child) - get_folders(fi->child, folders); - if (fi->sibling) - get_folders(fi->sibling, folders); -} - -static int -folder_cmp(const void *ap, const void *bp) -{ - const CamelFolderInfo *a = ((CamelFolderInfo **)ap)[0]; - const CamelFolderInfo *b = ((CamelFolderInfo **)bp)[0]; - - return strcmp(a->path, b->path); -} - -static void -store_folder_renamed(CamelObject *o, void *event_data, void *data) -{ - CamelStore *store = (CamelStore *)o; - CamelRenameInfo *info = event_data; - struct _store_info *si; - - d(printf("Folder renamed: oldbase = '%s' new->full = '%s'\n", info->old_base, info->new->full_name)); - - LOCK(info_lock); - si = g_hash_table_lookup(stores, store); - if (si) { - GPtrArray *folders = g_ptr_array_new(); - CamelFolderInfo *top; - int i; - - /* Ok, so for some reason the folderinfo we have comes in all messed up from - imap, should find out why ... this makes it workable */ - get_folders(info->new, folders); - qsort(folders->pdata, folders->len, sizeof(folders->pdata[0]), folder_cmp); - - top = folders->pdata[0]; - for (i=0;i<folders->len;i++) { - rename_folders(si, info->old_base, top->full_name, folders->pdata[i]); - } - - g_ptr_array_free(folders, TRUE); - - } - UNLOCK(info_lock); -} - -struct _update_data { - struct _update_data *next; - struct _update_data *prev; - - int id; /* id for cancellation */ - - void (*done)(CamelStore *store, CamelFolderInfo *info, void *data); - void *data; -}; - -static void -unset_folder_info_hash(char *path, struct _folder_info *mfi, void *data) -{ - unset_folder_info(mfi, FALSE); -} - -static void -free_folder_info_hash(char *path, struct _folder_info *mfi, void *data) -{ - free_folder_info(mfi); -} - -void -mail_note_store_remove(CamelStore *store) -{ - struct _update_data *ud; - struct _store_info *si; - - g_assert(CAMEL_IS_STORE(store)); - - if (stores == NULL) - return; - - d(printf("store removed!!\n")); - LOCK(info_lock); - si = g_hash_table_lookup(stores, store); - if (si) { - g_hash_table_remove(stores, store); - - camel_object_unhook_event((CamelObject *)store, "folder_created", store_folder_created, NULL); - camel_object_unhook_event((CamelObject *)store, "folder_deleted", store_folder_deleted, NULL); - camel_object_unhook_event((CamelObject *)store, "folder_renamed", store_folder_renamed, NULL); - camel_object_unhook_event((CamelObject *)store, "folder_subscribed", store_folder_subscribed, NULL); - camel_object_unhook_event((CamelObject *)store, "folder_unsubscribed", store_folder_unsubscribed, NULL); - g_hash_table_foreach(si->folders, (GHFunc)unset_folder_info_hash, NULL); - - ud = (struct _update_data *)si->folderinfo_updates.head; - while (ud->next) { - d(printf("Cancelling outstanding folderinfo update %d\n", ud->id)); - mail_msg_cancel(ud->id); - ud = ud->next; - } - - /* This is the only gtk object we need to unref */ - mail_async_event_emit(mail_async_event, MAIL_ASYNC_GUI, (MailAsyncFunc)bonobo_object_unref, si->storage, 0, 0); - - camel_object_unref((CamelObject *)si->store); - g_hash_table_foreach(si->folders, (GHFunc)free_folder_info_hash, NULL); - g_hash_table_destroy(si->folders); - g_hash_table_destroy(si->folders_uri); - g_free(si); - } - UNLOCK(info_lock); -} - -static void -update_folders(CamelStore *store, CamelFolderInfo *fi, void *data) -{ - struct _update_data *ud = data; - struct _store_info *si; - - d(printf("Got folderinfo for store\n")); - - LOCK(info_lock); - si = g_hash_table_lookup(stores, store); - if (si) { - /* the 'si' is still there, so we can remove ourselves from its list */ - /* otherwise its not, and we're on our own and free anyway */ - e_dlist_remove((EDListNode *)ud); - - if (fi) { - if (si->storage) - gtk_object_set_data (GTK_OBJECT (si->storage), "connected", GINT_TO_POINTER (TRUE)); - create_folders(fi, si); - } - } - UNLOCK(info_lock); - - if (ud->done) - ud->done(store, fi, ud->data); - g_free(ud); -} - -void -mail_note_store(CamelStore *store, EvolutionStorage *storage, GNOME_Evolution_Storage corba_storage, - void (*done)(CamelStore *store, CamelFolderInfo *info, void *data), void *data) -{ - struct _store_info *si; - struct _update_data *ud; - - g_assert(CAMEL_IS_STORE(store)); - g_assert(pthread_self() == mail_gui_thread); - g_assert(storage != NULL || corba_storage != CORBA_OBJECT_NIL); - - LOCK(info_lock); - - if (stores == NULL) { - stores = g_hash_table_new(NULL, NULL); - count_sent = getenv("EVOLUTION_COUNT_SENT") != NULL; - count_trash = getenv("EVOLUTION_COUNT_TRASH") != NULL; - } - - si = g_hash_table_lookup(stores, store); - if (si == NULL) { - - d(printf("Noting a new store: %p: %s\n", store, camel_url_to_string(((CamelService *)store)->url, 0))); - - /* FIXME: Need to ref the storages & store or something?? */ - - si = g_malloc0(sizeof(*si)); - si->folders = g_hash_table_new(g_str_hash, g_str_equal); - si->folders_uri = g_hash_table_new(CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->hash_folder_name, - CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->compare_folder_name); - si->storage = storage; - if (storage != NULL) - bonobo_object_ref((BonoboObject *)storage); - si->corba_storage = corba_storage; - si->store = store; - camel_object_ref((CamelObject *)store); - g_hash_table_insert(stores, store, si); - e_dlist_init(&si->folderinfo_updates); - - camel_object_hook_event((CamelObject *)store, "folder_created", store_folder_created, NULL); - camel_object_hook_event((CamelObject *)store, "folder_deleted", store_folder_deleted, NULL); - camel_object_hook_event((CamelObject *)store, "folder_renamed", store_folder_renamed, NULL); - camel_object_hook_event((CamelObject *)store, "folder_subscribed", store_folder_subscribed, NULL); - camel_object_hook_event((CamelObject *)store, "folder_unsubscribed", store_folder_unsubscribed, NULL); - } - - ud = g_malloc(sizeof(*ud)); - ud->done = done; - ud->data = data; - ud->id = mail_get_folderinfo(store, update_folders, ud); - - e_dlist_addtail(&si->folderinfo_updates, (EDListNode *)ud); - - UNLOCK(info_lock); -} - -struct _find_info { - const char *uri; - struct _folder_info *fi; -}; - -/* look up on each storeinfo using proper hash function for that stores uri's */ -static void storeinfo_find_folder_info(CamelStore *store, struct _store_info *si, struct _find_info *fi) -{ - if (fi->fi == NULL) - fi->fi = g_hash_table_lookup(si->folders_uri, fi->uri); -} - -/* returns TRUE if the uri is available, folderp is set to a - reffed folder if the folder has also already been opened */ -int mail_note_get_folder_from_uri(const char *uri, CamelFolder **folderp) -{ - struct _find_info fi = { uri, NULL }; - - if (stores == NULL) - return FALSE; - - LOCK(info_lock); - g_hash_table_foreach(stores, (GHFunc)storeinfo_find_folder_info, &fi); - if (folderp) { - if (fi.fi && fi.fi->folder) { - *folderp = fi.fi->folder; - camel_object_ref((CamelObject *)*folderp); - } else { - *folderp = NULL; - } - } - UNLOCK(info_lock); - - return fi.fi != NULL; -} diff --git a/mail/mail-folder-cache.h b/mail/mail-folder-cache.h deleted file mode 100644 index 8f3309e74f..0000000000 --- a/mail/mail-folder-cache.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* mail-folder-cache.h: Stores information about open folders */ - -/* - * Authors: Peter Williams <peterw@ximian.com> - * Michael Zucchi <notzed@ximian.com> - * - * Copyright 2000,2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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_FOLDER_CACHE_H -#define _MAIL_FOLDER_CACHE_H - -#include <shell/evolution-storage.h> - -/* Add a store whose folders should appear in the shell - The folders are scanned from the store, and/or added at - runtime via the folder_created event */ -void -mail_note_store(CamelStore *store, EvolutionStorage *storage, GNOME_Evolution_Storage corba_storage, - void (*done)(CamelStore *store, CamelFolderInfo *info, void *data), void *data); - -/* de-note a store */ -void mail_note_store_remove(CamelStore *store); - -/* When a folder has been opened, notify it for watching. - The folder must have already been created on the store (which has already been noted) - before the folder can be opened - */ -void mail_note_folder(struct _CamelFolder *folder); - -/* Returns true if a folder is available (yet), and also sets *folderp (if supplied) - to a (referenced) copy of the folder if it has already been opened */ -int mail_note_get_folder_from_uri(const char *uri, CamelFolder **folderp); - -#endif diff --git a/mail/mail-format.c b/mail/mail-format.c deleted file mode 100644 index 051eda7b3f..0000000000 --- a/mail/mail-format.c +++ /dev/null @@ -1,2350 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Authors: - * Dan Winship <danw@ximian.com> - * - * Copyright 2000, 2001 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include <ctype.h> /* for isprint */ -#include <string.h> /* for strstr */ -#include <fcntl.h> - -#include <liboaf/liboaf.h> -#include <libgnome/libgnome.h> -#include <libgnomevfs/gnome-vfs-mime-info.h> -#include <libgnomevfs/gnome-vfs-mime-handlers.h> -#include <gal/widgets/e-unicode.h> -#include <gal/util/e-iconv.h> - -#include <camel/camel-mime-utils.h> -#include <camel/camel-pgp-mime.h> -#include <camel/camel-stream-null.h> -#include <shell/e-setup.h> -#include <e-util/e-html-utils.h> -#include <gal/util/e-unicode-i18n.h> - -#include "mail.h" -#include "mail-tools.h" -#include "mail-display.h" -#include "mail-mt.h" -#include "mail-crypto.h" - -static char *try_inline_pgp (char *start, CamelMimePart *part, - guint offset, MailDisplay *md); -static char *try_inline_pgp_sig (char *start, CamelMimePart *part, - guint offset, MailDisplay *md); -static char *try_uudecoding (char *start, CamelMimePart *part, - guint offset, MailDisplay *md); -static char *try_inline_binhex (char *start, CamelMimePart *part, - guint offset, MailDisplay *md); - -static gboolean handle_text_plain (CamelMimePart *part, - const char *mime_type, - MailDisplay *md); -static gboolean handle_text_plain_flowed (char *text, - MailDisplay *md); -static gboolean handle_text_enriched (CamelMimePart *part, - const char *mime_type, - MailDisplay *md); -static gboolean handle_text_html (CamelMimePart *part, - const char *mime_type, - MailDisplay *md); -static gboolean handle_image (CamelMimePart *part, - const char *mime_type, - MailDisplay *md); -static gboolean handle_multipart_mixed (CamelMimePart *part, - const char *mime_type, - MailDisplay *md); -static gboolean handle_multipart_related (CamelMimePart *part, - const char *mime_type, - MailDisplay *md); -static gboolean handle_multipart_alternative (CamelMimePart *part, - const char *mime_type, - MailDisplay *md); -static gboolean handle_multipart_appledouble (CamelMimePart *part, - const char *mime_type, - MailDisplay *md); -static gboolean handle_multipart_encrypted (CamelMimePart *part, - const char *mime_type, - MailDisplay *md); -static gboolean handle_multipart_signed (CamelMimePart *part, - const char *mime_type, - MailDisplay *md); -static gboolean handle_message_rfc822 (CamelMimePart *part, - const char *mime_type, - MailDisplay *md); -static gboolean handle_message_external_body (CamelMimePart *part, - const char *mime_type, - MailDisplay *md); - -static gboolean handle_via_bonobo (CamelMimePart *part, - const char *mime_type, - MailDisplay *md); - -/* writes the header info for a mime message into an html stream */ -static void write_headers (CamelMimeMessage *message, MailDisplay *md); - -/* dispatch html printing via mimetype */ -static gboolean format_mime_part (CamelMimePart *part, MailDisplay *md); - -static void -free_url (gpointer key, gpointer value, gpointer data) -{ - g_free (key); - if (data) - g_byte_array_free (value, TRUE); -} - -static void -free_part_urls (gpointer urls) -{ - g_hash_table_foreach (urls, free_url, NULL); - g_hash_table_destroy (urls); -} - -static void -free_data_urls (gpointer urls) -{ - g_hash_table_foreach (urls, free_url, GINT_TO_POINTER (1)); - g_hash_table_destroy (urls); -} - -static char * -add_url (const char *kind, char *url, gpointer data, MailDisplay *md) -{ - GHashTable *urls; - gpointer old_key, old_value; - - urls = g_datalist_get_data (md->data, kind); - g_return_val_if_fail (urls != NULL, NULL); - if (g_hash_table_lookup_extended (urls, url, &old_key, &old_value)) { - g_free (url); - url = old_key; - } - g_hash_table_insert (urls, url, data); - return url; -} - -/** - * mail_format_mime_message: - * @mime_message: the input mime message - * @md: the MailDisplay to render into - * - * Writes a CamelMimeMessage out into a MailDisplay - **/ -void -mail_format_mime_message (CamelMimeMessage *mime_message, MailDisplay *md) -{ - GHashTable *hash; - - g_return_if_fail (CAMEL_IS_MIME_MESSAGE (mime_message)); - - hash = g_datalist_get_data (md->data, "part_urls"); - if (!hash) { - hash = g_hash_table_new (g_str_hash, g_str_equal); - g_datalist_set_data_full (md->data, "part_urls", hash, - free_part_urls); - } - hash = g_datalist_get_data (md->data, "data_urls"); - if (!hash) { - hash = g_hash_table_new (g_str_hash, g_str_equal); - g_datalist_set_data_full (md->data, "data_urls", hash, - free_data_urls); - } - - hash = g_datalist_get_data (md->data, "attachment_states"); - if (!hash) { - hash = g_hash_table_new (NULL, NULL); - g_datalist_set_data_full (md->data, "attachment_states", hash, - (GDestroyNotify) g_hash_table_destroy); - } - hash = g_datalist_get_data (md->data, "fake_parts"); - if (!hash) { - hash = g_hash_table_new (NULL, NULL); - g_datalist_set_data_full (md->data, "fake_parts", hash, - (GDestroyNotify) g_hash_table_destroy); - } - - write_headers (mime_message, md); - format_mime_part (CAMEL_MIME_PART (mime_message), md); -} - - -/** - * mail_format_raw_message: - * @mime_message: the input mime message - * @md: the MailDisplay to render into - * - * Writes a CamelMimeMessage source out into a MailDisplay - **/ -void -mail_format_raw_message (CamelMimeMessage *mime_message, MailDisplay *md) -{ - GByteArray *bytes; - char *html; - - g_return_if_fail (CAMEL_IS_MIME_MESSAGE (mime_message)); - - if (!mail_content_loaded (CAMEL_DATA_WRAPPER (mime_message), md, - TRUE, NULL, NULL)) - return; - - mail_html_write (md->html, md->stream, - "<table cellspacing=0 cellpadding=10 width=\"100%\"><tr><td><tt>\n"); - - bytes = mail_format_get_data_wrapper_text (CAMEL_DATA_WRAPPER (mime_message), md); - if (bytes) { - g_byte_array_append (bytes, "", 1); - html = e_text_to_html (bytes->data, E_TEXT_TO_HTML_CONVERT_NL | - E_TEXT_TO_HTML_CONVERT_SPACES | E_TEXT_TO_HTML_ESCAPE_8BIT); - g_byte_array_free (bytes, TRUE); - - mail_html_write (md->html, md->stream, html); - g_free (html); - } - - mail_html_write (md->html, md->stream, "</tt></td></tr></table>"); -} - -static const char * -get_cid (CamelMimePart *part, MailDisplay *md) -{ - char *cid; - static int fake_cid_counter = 0; - - /* If we have a real Content-ID, use it. If we don't, - * make a (syntactically invalid, unique) fake one. - */ - if (camel_mime_part_get_content_id (part)) { - cid = g_strdup_printf ("cid:%s", - camel_mime_part_get_content_id (part)); - } else - cid = g_strdup_printf ("cid:@@@%d", fake_cid_counter++); - - return add_url ("part_urls", cid, part, md); -} - -static const char * -get_location (CamelMimePart *part, MailDisplay *md) -{ - const char *loc; - - /* FIXME: relative URLs */ - loc = camel_mime_part_get_content_location (part); - if (!loc) - return NULL; - - return add_url ("part_urls", g_strdup (loc), part, md); -} - -static const char * -get_url_for_icon (const char *icon_name, MailDisplay *md) -{ - char *icon_path, buf[1024], *url; - int fd, nread; - GByteArray *ba; - - /* FIXME: cache */ - - if (*icon_name == '/') - icon_path = g_strdup (icon_name); - else { - icon_path = gnome_pixmap_file (icon_name); - if (!icon_path) - return "file:///dev/null"; - } - - fd = open (icon_path, O_RDONLY); - g_free (icon_path); - if (fd == -1) - return "file:///dev/null"; - - ba = g_byte_array_new (); - while (1) { - nread = read (fd, buf, sizeof (buf)); - if (nread < 1) - break; - g_byte_array_append (ba, buf, nread); - } - close (fd); - - url = g_strdup_printf ("x-evolution-data:%p", ba); - return add_url ("data_urls", url, ba, md); -} - - -static GHashTable *mime_handler_table, *mime_function_table; - -static void -setup_mime_tables (void) -{ - mime_handler_table = g_hash_table_new (g_str_hash, g_str_equal); - mime_function_table = g_hash_table_new (g_str_hash, g_str_equal); - - g_hash_table_insert (mime_function_table, "text/plain", - handle_text_plain); - g_hash_table_insert (mime_function_table, "text/richtext", - handle_text_enriched); - g_hash_table_insert (mime_function_table, "text/enriched", - handle_text_enriched); - g_hash_table_insert (mime_function_table, "text/html", - handle_text_html); - - g_hash_table_insert (mime_function_table, "image/gif", - handle_image); - g_hash_table_insert (mime_function_table, "image/jpeg", - handle_image); - g_hash_table_insert (mime_function_table, "image/png", - handle_image); - g_hash_table_insert (mime_function_table, "image/x-png", - handle_image); - g_hash_table_insert (mime_function_table, "image/tiff", - handle_image); - g_hash_table_insert (mime_function_table, "image/x-bmp", - handle_image); - g_hash_table_insert (mime_function_table, "image/bmp", - handle_image); - g_hash_table_insert (mime_function_table, "image/x-cmu-raster", - handle_image); - g_hash_table_insert (mime_function_table, "image/x-ico", - handle_image); - g_hash_table_insert (mime_function_table, "image/x-portable-anymap", - handle_image); - g_hash_table_insert (mime_function_table, "image/x-portable-bitmap", - handle_image); - g_hash_table_insert (mime_function_table, "image/x-portable-graymap", - handle_image); - g_hash_table_insert (mime_function_table, "image/x-portable-pixmap", - handle_image); - g_hash_table_insert (mime_function_table, "image/x-xpixmap", - handle_image); - - g_hash_table_insert (mime_function_table, "message/rfc822", - handle_message_rfc822); - g_hash_table_insert (mime_function_table, "message/news", - handle_message_rfc822); - g_hash_table_insert (mime_function_table, "message/external-body", - handle_message_external_body); - - g_hash_table_insert (mime_function_table, "multipart/alternative", - handle_multipart_alternative); - g_hash_table_insert (mime_function_table, "multipart/related", - handle_multipart_related); - g_hash_table_insert (mime_function_table, "multipart/mixed", - handle_multipart_mixed); - g_hash_table_insert (mime_function_table, "multipart/appledouble", - handle_multipart_appledouble); - g_hash_table_insert (mime_function_table, "multipart/encrypted", - handle_multipart_encrypted); - g_hash_table_insert (mime_function_table, "multipart/signed", - handle_multipart_signed); - - /* RFC 2046 says unrecognized text subtypes can be treated - * as text/plain (as long as you recognize the character set), - * and unrecognized multipart subtypes as multipart/mixed. */ - g_hash_table_insert (mime_function_table, "text/*", - handle_text_plain); - g_hash_table_insert (mime_function_table, "multipart/*", - handle_multipart_mixed); -} - -static gboolean -component_supports (OAF_ServerInfo *component, const char *mime_type) -{ - OAF_Property *prop; - CORBA_sequence_CORBA_string stringv; - int i; - - prop = oaf_server_info_prop_find (component, - "bonobo:supported_mime_types"); - if (!prop || prop->v._d != OAF_P_STRINGV) - return FALSE; - - stringv = prop->v._u.value_stringv; - for (i = 0; i < stringv._length; i++) { - if (!g_strcasecmp (mime_type, stringv._buffer[i])) - return TRUE; - } - return FALSE; -} - -/** - * mail_lookup_handler: - * @mime_type: a MIME type - * - * Looks up the MIME type in its own tables and GNOME-VFS's and returns - * a MailMimeHandler structure detailing the component, application, - * and built-in handlers (if any) for that MIME type. (If the component - * is non-%NULL, the built-in handler will always be handle_via_bonobo().) - * The MailMimeHandler's @generic field is set if the match was for the - * MIME supertype rather than the exact type. - * - * Return value: a MailMimeHandler (which should not be freed), or %NULL - * if no handlers are available. - **/ -MailMimeHandler * -mail_lookup_handler (const char *mime_type) -{ - MailMimeHandler *handler; - char *mime_type_main; - const char *p; - - if (mime_handler_table == NULL) - setup_mime_tables (); - - /* See if we've already found it. */ - handler = g_hash_table_lookup (mime_handler_table, mime_type); - if (handler) - return handler; - - /* No. Create a new one and look up application and full type - * handler. If we find a builtin, create the handler and - * register it. - */ - handler = g_new0 (MailMimeHandler, 1); - handler->applications = - gnome_vfs_mime_get_short_list_applications (mime_type); - handler->builtin = - g_hash_table_lookup (mime_function_table, mime_type); - - if (handler->builtin) { - handler->generic = FALSE; - goto reg; - } - - /* Try for a exact component match. */ - handler->component = gnome_vfs_mime_get_default_component (mime_type); - if (handler->component && - component_supports (handler->component, mime_type)) { - handler->generic = FALSE; - handler->builtin = handle_via_bonobo; - goto reg; - } - - /* Try for a generic builtin match. */ - p = strchr (mime_type, '/'); - if (p == NULL) - p = mime_type + strlen (mime_type); - mime_type_main = alloca ((p - mime_type) + 3); - memcpy (mime_type_main, mime_type, p - mime_type); - memcpy (mime_type_main + (p - mime_type), "/*", 3); - - handler->builtin = g_hash_table_lookup (mime_function_table, - mime_type_main); - - if (handler->builtin) { - handler->generic = TRUE; - if (handler->component) { - CORBA_free (handler->component); - handler->component = NULL; - } - goto reg; - } - - /* Try for a generic component match. */ - if (handler->component) { - handler->generic = TRUE; - handler->builtin = handle_via_bonobo; - goto reg; - } - - /* If we at least got an application, use that. */ - if (handler->applications) { - handler->generic = TRUE; - goto reg; - } - - /* Nada. */ - g_free (handler); - return NULL; - - reg: - g_hash_table_insert (mime_handler_table, g_strdup (mime_type), - handler); - return handler; -} - -/* An "anonymous" MIME part is one that we shouldn't call attention - * to the existence of, but simply display. - */ -static gboolean -is_anonymous (CamelMimePart *part, const char *mime_type) -{ - if (!g_strncasecmp (mime_type, "multipart/", 10) || - !g_strncasecmp (mime_type, "message/", 8)) - return TRUE; - - if (!g_strncasecmp (mime_type, "text/", 5) && - !camel_mime_part_get_filename (part)) - return TRUE; - - return FALSE; -} - -/** - * mail_part_is_inline: - * @part: a CamelMimePart - * - * Return value: whether or not the part should/will be displayed inline. - **/ -gboolean -mail_part_is_inline (CamelMimePart *part) -{ - const char *disposition; - CamelContentType *content_type; - char *type; - gboolean anon; - - /* If it has an explicit disposition, return that. */ - disposition = camel_mime_part_get_disposition (part); - if (disposition) - return g_strcasecmp (disposition, "inline") == 0; - - /* Certain types should default to inline. FIXME: this should - * be customizable. - */ - content_type = camel_mime_part_get_content_type (part); - if (!header_content_type_is (content_type, "message", "*")) - return TRUE; - - /* Otherwise, display it inline if it's "anonymous", and - * as an attachment otherwise. - */ - type = header_content_type_simple (content_type); - anon = is_anonymous (part, type); - g_free (type); - - return anon; -} - -enum inline_states { - I_VALID = (1 << 0), - I_ACTUALLY = (1 << 1), - I_DISPLAYED = (1 << 2) -}; - -static gint -get_inline_flags (CamelMimePart *part, MailDisplay *md) -{ - GHashTable *asht; - gint val; - - /* check if we already know. */ - - asht = g_datalist_get_data (md->data, "attachment_states"); - val = GPOINTER_TO_INT (g_hash_table_lookup (asht, part)); - if (val) - return val; - - /* ok, we don't know. Figure it out. */ - - if (mail_part_is_inline (part)) - val = (I_VALID | I_ACTUALLY | I_DISPLAYED); - else - val = (I_VALID); - - g_hash_table_insert (asht, part, GINT_TO_POINTER (val)); - - return val; -} - -gboolean -mail_part_is_displayed_inline (CamelMimePart *part, MailDisplay *md) -{ - return (gboolean) (get_inline_flags (part, md) & I_DISPLAYED); -} - -void -mail_part_toggle_displayed (CamelMimePart *part, MailDisplay *md) -{ - GHashTable *asht = g_datalist_get_data (md->data, "attachment_states"); - gpointer ostate, opart; - gint state; - - if (g_hash_table_lookup_extended (asht, part, &opart, &ostate)) { - g_hash_table_remove (asht, part); - - state = GPOINTER_TO_INT (ostate); - - if (state & I_DISPLAYED) - state &= ~I_DISPLAYED; - else - state |= I_DISPLAYED; - } else { - state = I_VALID | I_DISPLAYED; - } - - g_hash_table_insert (asht, part, GINT_TO_POINTER (state)); -} - -static void -mail_part_set_default_displayed_inline (CamelMimePart *part, MailDisplay *md, - gboolean displayed) -{ - GHashTable *asht = g_datalist_get_data (md->data, "attachment_states"); - gint state; - - if (g_hash_table_lookup (asht, part)) - return; - - state = I_VALID | (displayed ? I_DISPLAYED : 0); - g_hash_table_insert (asht, part, GINT_TO_POINTER (state)); -} - -static void -attachment_header (CamelMimePart *part, const char *mime_type, MailDisplay *md) -{ - char *htmlinfo, *html, *fmt; - const char *info; - - /* Start the table, create the pop-up object. */ - gtk_html_stream_printf (md->stream, - "<table cellspacing=0 cellpadding=0>" - "<tr><td><table width=10 cellspacing=0 cellpadding=0><tr><td></td></tr></table></td>" - "<td><object classid=\"popup:%s\" type=\"%s\"></object></td>" - "<td><table width=3 cellspacing=0 cellpadding=0><tr><td></td></tr></table></td>" - "<td><font size=-1>", - get_cid (part, md), mime_type); - - /* Write the MIME type */ - info = gnome_vfs_mime_get_value (mime_type, "description"); - html = e_text_to_html (info ? info : mime_type, 0); - htmlinfo = e_utf8_from_locale_string (html); - g_free (html); - fmt = e_utf8_from_locale_string (_("%s attachment")); - gtk_html_stream_printf (md->stream, fmt, htmlinfo); - g_free (htmlinfo); - g_free (fmt); - - /* Write the name, if we have it. */ - info = camel_mime_part_get_filename (part); - if (info) { - htmlinfo = e_text_to_html (info, 0); - gtk_html_stream_printf (md->stream, " (%s)", htmlinfo); - g_free (htmlinfo); - } - - /* Write a description, if we have one. */ - info = camel_mime_part_get_description (part); - if (info) { - htmlinfo = e_text_to_html (info, E_TEXT_TO_HTML_CONVERT_URLS); - gtk_html_stream_printf (md->stream, ", \"%s\"", htmlinfo); - g_free (htmlinfo); - } - - mail_html_write (md->html, md->stream, "</font></td></tr><tr>" - "<td height=10><table height=10 cellspacing=0 cellpadding=0>" - "<tr><td></td></tr></table></td></tr></table>\n"); -} - -static gboolean -format_mime_part (CamelMimePart *part, MailDisplay *md) -{ - CamelDataWrapper *wrapper; - char *mime_type; - MailMimeHandler *handler; - gboolean output; - int inline_flags; - - /* Record URLs associated with this part */ - get_cid (part, md); - get_location (part, md); - - wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part)); - - if (CAMEL_IS_MULTIPART (wrapper) && - camel_multipart_get_number (CAMEL_MULTIPART (wrapper)) == 0) { - char *mesg; - - mesg = e_utf8_from_locale_string (_("Could not parse MIME message. Displaying as source.")); - mail_error_printf (md->html, md->stream, "\n%s\n", mesg); - g_free (mesg); - if (mail_content_loaded (wrapper, md, TRUE, NULL, NULL)) - handle_text_plain (part, "text/plain", md); - return TRUE; - } - - mime_type = camel_data_wrapper_get_mime_type (wrapper); - g_strdown (mime_type); - - handler = mail_lookup_handler (mime_type); - if (!handler) { - char *id_type; - - /* Special case MIME types that we know that we can't - * display but are some kind of plain text to prevent - * evil infinite recursion. - */ - - if (!strcmp (mime_type, "application/mac-binhex40")) { - handler = NULL; - } else { - id_type = mail_identify_mime_part (part, md); - if (id_type) { - g_free (mime_type); - mime_type = id_type; - handler = mail_lookup_handler (id_type); - } - } - } - - inline_flags = get_inline_flags (part, md); - - /* No header for anonymous inline parts. */ - if (!((inline_flags & I_ACTUALLY) && is_anonymous (part, mime_type))) - attachment_header (part, mime_type, md); - - if (handler && handler->builtin && inline_flags & I_DISPLAYED && - mail_content_loaded (wrapper, md, TRUE, NULL, NULL)) - output = (*handler->builtin) (part, mime_type, md); - else - output = TRUE; - - g_free (mime_type); - return output; -} - -/* flags for write_field_to_stream */ -enum { - WRITE_BOLD=1, - WRITE_NOCOLUMNS=2, -}; - -static void -write_field_row_begin (const char *name, gint flags, GtkHTML *html, GtkHTMLStream *stream) -{ - char *encoded_name; - gboolean bold = (flags & WRITE_BOLD); - gboolean nocolumns = (flags & WRITE_NOCOLUMNS); - - encoded_name = e_utf8_from_gtk_string (GTK_WIDGET (html), name); - - if (nocolumns) { - gtk_html_stream_printf (stream, "<tr><td>%s%s:%s ", - bold ? "<b>" : "", encoded_name, - bold ? "</b>" : ""); - } else { - gtk_html_stream_printf (stream, "<tr><%s align=\"right\" valign=\"top\">%s:" - "<b> </%s><td>", bold ? "th" : "td", - encoded_name, bold ? "th" : "td"); - } - - g_free (encoded_name); -} - -static void -write_date (CamelMimeMessage *message, int flags, GtkHTML *html, GtkHTMLStream *stream) -{ - char *datestr; - time_t date; - int offset; - - write_field_row_begin (_("Date"), flags, html, stream); - - date = camel_mime_message_get_date (message, &offset); - datestr = header_format_date (date, offset); - - gtk_html_stream_printf (stream, "%s</td> </tr>", datestr); - - g_free (datestr); -} - -static void -write_text_header (const char *name, const char *value, int flags, GtkHTML *html, GtkHTMLStream *stream) -{ - char *encoded; - - if (value && *value) - encoded = e_text_to_html (value, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS); - else - encoded = ""; - - write_field_row_begin (name, flags, html, stream); - - gtk_html_stream_printf (stream, "%s</td> </tr>", encoded); - - if (value && *value) - g_free (encoded); -} - -static void -write_address (MailDisplay *md, const CamelInternetAddress *addr, const char *field_name, int flags) -{ - const char *name, *email; - gint i; - - if (addr == NULL || !camel_internet_address_get (addr, 0, NULL, NULL)) - return; - - write_field_row_begin (field_name, flags, md->html, md->stream); - - i = 0; - while (camel_internet_address_get (addr, i, &name, &email)) { - CamelInternetAddress *subaddr; - gchar *addr_txt, *addr_url; - gboolean have_name = name && *name; - gboolean have_email = email && *email; - gchar *name_disp = NULL; - gchar *email_disp = NULL; - - subaddr = camel_internet_address_new (); - camel_internet_address_add (subaddr, name, email); - addr_txt = camel_address_format (CAMEL_ADDRESS (subaddr)); - addr_url = camel_url_encode (addr_txt, TRUE, NULL); - camel_object_unref (CAMEL_OBJECT (subaddr)); - - if (have_name) { - name_disp = e_text_to_html (name, 0); - } - - if (have_email) { - email_disp = e_text_to_html (email, 0); - } - - if (i) - mail_html_write (md->html, md->stream, ", "); - - if (have_email || have_name) { - if (!have_email) { - email_disp = g_strdup ("???"); - } - - if (have_name) { - gtk_html_stream_printf (md->stream, - "%s <<a href=\"mailto:%s\">%s</a>>", - name_disp, addr_url, email_disp); - } else { - gtk_html_stream_printf (md->stream, - "<a href=\"mailto:%s\">%s</a>", - addr_url, email_disp); - } - - } else { - char *str; - - str = e_utf8_from_locale_string (_("Bad Address")); - gtk_html_stream_printf (md->stream, "<i>%s</i>", str); - g_free (str); - } - - g_free (name_disp); - g_free (email_disp); - g_free (addr_txt); - g_free (addr_url); - - i++; - } - - mail_html_write (md->html, md->stream, "</td></tr>"); -} - -/* order of these must match write_header code */ -static char *default_headers[] = { - "From", "Reply-To", "To", "Cc", "Bcc", "Subject", "Date", -}; - -/* return index of header in default_headers array */ -static int -default_header_index(const char *name) -{ - int i; - - for (i=0;i<sizeof(default_headers)/sizeof(default_headers[0]);i++) - if (!g_strcasecmp(name, default_headers[i])) - return i; - - return -1; -} - -/* index is index of header in default_headers array */ -static void -write_default_header(CamelMimeMessage *message, MailDisplay *md, int index, int flags) -{ - switch(index) { - case 0: - write_address (md, camel_mime_message_get_from (message), _("From"), flags | WRITE_BOLD); - break; - case 1: - write_address (md, camel_mime_message_get_reply_to (message), _("Reply-To"), flags | WRITE_BOLD); - break; - case 2: - write_address(md, camel_mime_message_get_recipients(message, CAMEL_RECIPIENT_TYPE_TO), - _("To"), flags | WRITE_BOLD); - break; - case 3: - write_address (md, camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC), - _("Cc"), flags | WRITE_BOLD); - break; - case 4: - write_address (md, camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_BCC), - _("Bcc"), flags | WRITE_BOLD); - break; - case 5: - write_text_header (_("Subject"), camel_mime_message_get_subject (message), - flags | WRITE_BOLD, md->html, md->stream); - break; - case 6: - write_date (message, flags | WRITE_BOLD, md->html, md->stream); - break; - default: - g_assert_not_reached(); - } -} - -#define COLOR_IS_LIGHT(r, g, b) ((r + g + b) > (128 * 3)) - -static void -write_headers (CamelMimeMessage *message, MailDisplay *md) -{ - gboolean full = (md->display_style == MAIL_CONFIG_DISPLAY_FULL_HEADERS); - char bgcolor[7], fontcolor[7]; - GtkStyle *style = NULL; - int i; - - /* My favorite thing to do...much around with colors so we respect people's stupid themes */ - style = gtk_widget_get_style (GTK_WIDGET (md->html)); - if (style) { - int state = GTK_WIDGET_STATE (GTK_WIDGET (md->html)); - gushort r, g, b; - - r = style->base[state].red / 256; - g = style->base[state].green / 256; - b = style->base[state].blue / 256; - - if (COLOR_IS_LIGHT (r, g, b)) { - r *= 0.92; - g *= 0.92; - b *= 0.92; - } else { - r = 255 - (0.92 * (255 - r)); - g = 255 - (0.92 * (255 - g)); - b = 255 - (0.92 * (255 - b)); - } - - sprintf (bgcolor, "%.2X%.2X%.2X", r, g, b); - - r = style->text[state].red; - g = style->text[state].green / 256; - b = style->text[state].blue / 256; - - sprintf (fontcolor, "%.2X%.2X%.2X", r, g, b); - } else { - strcpy (bgcolor, "EEEEEE"); - strcpy (fontcolor, "000000"); - } - - gtk_html_stream_printf (md->stream, - "<table width=\"100%%\" cellpadding=0 cellspacing=0>" - "<tr><td colspan=3 height=10><table height=10 cellpadding=0 cellspacing=0>" - "<tr><td></td></tr></table></td></tr>" - "<tr><td><table width=10 cellpadding=0 cellspacing=0><tr><td></td></tr></table></td>" - "<td width=\"100%%\"><font color=\"#%s\">" - "<table bgcolor=\"#000000\" width=\"100%%\" " - "cellspacing=0 cellpadding=1><tr><td>" - "<table bgcolor=\"#%s\" width=\"100%%\" cellpadding=0 cellspacing=0>" - "<tr><td><table>\n", fontcolor, bgcolor); - - if (full) { - struct _header_raw *header; - const char *charset; - CamelContentType *ct; - char *value; - - ct = camel_mime_part_get_content_type(CAMEL_MIME_PART(message)); - charset = header_content_type_param(ct, "charset"); - charset = e_iconv_charset_name(charset); - - header = CAMEL_MIME_PART(message)->headers; - while (header) { - i = default_header_index(header->name); - if (i == -1) { - value = header_decode_string(header->value, charset); - write_text_header(header->name, value, WRITE_NOCOLUMNS, md->html, md->stream); - g_free(value); - } else - write_default_header(message, md, i, WRITE_NOCOLUMNS); - header = header->next; - } - } else { - for (i=0;i<sizeof(default_headers)/sizeof(default_headers[0]);i++) - write_default_header(message, md, i, 0); - } - - mail_html_write (md->html, md->stream, - "</table></td></tr></table></td></tr></table></font></td>" - "<td><table width=10 cellpadding=0 cellspacing=0><tr><td>" - "</td></tr></table></td></tr></table>\n"); -} - -static void -load_offline_content (MailDisplay *md, gpointer data) -{ - CamelDataWrapper *wrapper = data; - CamelStream *stream; - - stream = camel_stream_null_new (); - camel_data_wrapper_write_to_stream (wrapper, stream); - camel_object_unref (CAMEL_OBJECT (stream)); - camel_object_unref (CAMEL_OBJECT (wrapper)); -} - -gboolean -mail_content_loaded (CamelDataWrapper *wrapper, MailDisplay *md, gboolean redisplay, const gchar *url, GtkHTMLStream *handle) -{ - if (!camel_data_wrapper_is_offline (wrapper)) - return TRUE; - - camel_object_ref (CAMEL_OBJECT (wrapper)); - if (redisplay) - mail_display_redisplay_when_loaded (md, wrapper, load_offline_content, wrapper); - else - mail_display_stream_write_when_loaded (md, wrapper, url, load_offline_content, handle, wrapper); - - return FALSE; -} - -/* Return the contents of a data wrapper, or %NULL if it contains only - * whitespace. - */ -GByteArray * -mail_format_get_data_wrapper_text (CamelDataWrapper *wrapper, MailDisplay *mail_display) -{ - CamelStream *memstream; - CamelStreamFilter *filtered_stream; - GByteArray *ba; - char *text, *end; - - memstream = camel_stream_mem_new (); - ba = g_byte_array_new (); - camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (memstream), ba); - - filtered_stream = camel_stream_filter_new_with_stream (memstream); - camel_object_unref (CAMEL_OBJECT (memstream)); - - if (wrapper->rawtext || (mail_display && mail_display->charset)) { - CamelMimeFilterCharset *filter; - const char *charset; - - if (!wrapper->rawtext) { - /* data wrapper had been successfully converted to UTF-8 using the mime - part's charset, but the user thinks he knows best so we'll let him - shoot himself in the foot here... */ - CamelContentType *content_type; - - /* get the original charset of the mime part */ - content_type = camel_data_wrapper_get_mime_type_field (wrapper); - charset = content_type ? header_content_type_param (content_type, "charset") : NULL; - if (!charset) - charset = mail_config_get_default_charset (); - - /* since the content is already in UTF-8, we need to decode into the - original charset before we can convert back to UTF-8 using the charset - the user is overriding with... */ - filter = camel_mime_filter_charset_new_convert ("utf-8", charset); - if (filter) { - camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (filter)); - camel_object_unref (CAMEL_OBJECT (filter)); - } - } - - /* find out the charset the user wants to override to */ - if (mail_display && mail_display->charset) - charset = mail_display->charset; - else - charset = mail_config_get_default_charset (); - - filter = camel_mime_filter_charset_new_convert (charset, "utf-8"); - if (filter) { - camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (filter)); - camel_object_unref (CAMEL_OBJECT (filter)); - } - } - - camel_data_wrapper_write_to_stream (wrapper, CAMEL_STREAM (filtered_stream)); - camel_stream_flush (CAMEL_STREAM (filtered_stream)); - camel_object_unref (CAMEL_OBJECT (filtered_stream)); - - for (text = ba->data, end = text + ba->len; text < end; text++) { - if (!isspace ((unsigned char)*text)) - break; - } - - if (text >= end) { - g_byte_array_free (ba, TRUE); - return NULL; - } - - return ba; -} - -static void -write_hr (MailDisplay *md) -{ - mail_html_write (md->html, md->stream, - "<table cellspacing=0 cellpadding=10 width=\"100%\"><tr><td width=\"100%\">" - "<hr noshadow size=1></td></tr></table>\n"); -} - -/*----------------------------------------------------------------------* - * Mime handling functions - *----------------------------------------------------------------------*/ - -struct { - char *start; - char * (*handler) (char *start, CamelMimePart *part, - guint offset, MailDisplay *md); -} text_specials[] = { - { "-----BEGIN PGP MESSAGE-----\n", try_inline_pgp }, - { "-----BEGIN PGP SIGNED MESSAGE-----\n", try_inline_pgp_sig }, - { "begin ", try_uudecoding }, - { "(This file must be converted with BinHex 4.0)\n", try_inline_binhex } -}; -#define NSPECIALS (sizeof (text_specials) / sizeof (*text_specials)) - -static void -write_one_text_plain_chunk (const char *text, int len, MailDisplay *md) -{ - char *buf; - - mail_html_write (md->html, md->stream, - "<table cellspacing=0 cellpadding=10 width=\"100%\"><tr><td>\n"); - - buf = g_strndup (text, len); - mail_text_write (md->html, md->stream, buf); - g_free (buf); - - mail_html_write (md->html, md->stream, "</td></tr></table>\n"); -} - -static gboolean -handle_text_plain (CamelMimePart *part, const char *mime_type, - MailDisplay *md) -{ - CamelDataWrapper *wrapper = - camel_medium_get_content_object (CAMEL_MEDIUM (part)); - CamelContentType *type; - gboolean check_specials; - char *p, *start, *text; - const char *format; - GByteArray *bytes; - int i; - - bytes = mail_format_get_data_wrapper_text (wrapper, md); - if (!bytes) - return FALSE; - - g_byte_array_append (bytes, "", 1); - text = bytes->data; - g_byte_array_free (bytes, FALSE); - - /* Check for RFC 2646 flowed text. */ - type = camel_mime_part_get_content_type (part); - format = header_content_type_param (type, "format"); - if (format && !g_strcasecmp (format, "flowed")) - return handle_text_plain_flowed (text, md); - - /* Only look for binhex and stuff if this is real text/plain. - * (and not, say, application/mac-binhex40 that mail-identify - * has decided to call text/plain because it starts with English - * text...) - */ - check_specials = !g_strcasecmp (mime_type, "text/plain"); - - p = text; - while (p && check_specials) { - /* Look for special cases. */ - for (i = 0; i < NSPECIALS; i++) { - start = strstr (p, text_specials[i].start); - if (start && (start == p || start[-1] == '\n')) - break; - } - if (!start) - break; - - /* Deal with special case */ - if (start != p) - write_one_text_plain_chunk (p, start - p, md); - - p = text_specials[i].handler (start, part, start - text, md); - if (p == start) { - /* Oops. That failed. Output this line normally and - * skip over it. - */ - p = strchr (start, '\n'); - /* Last line, drop out, and dump */ - if (p == NULL) { - p = start; - break; - } - p++; - write_one_text_plain_chunk (start, p - start, md); - } else if (p) - write_hr (md); - } - /* Finish up (or do the whole thing if there were no specials). */ - if (p) - write_one_text_plain_chunk (p, strlen (p), md); - - g_free (text); - - return TRUE; -} - -static gboolean -handle_text_plain_flowed (char *buf, MailDisplay *md) -{ - char *text, *line, *eol, *p; - int prevquoting = 0, quoting, len, br_pending = 0; - guint32 citation_color = mail_config_get_citation_color (); - - mail_html_write (md->html, md->stream, - "\n<!-- text/plain, flowed -->\n" - "<table cellspacing=0 cellpadding=10 width=\"100%\"><tr><td>\n<tt>\n"); - - for (line = buf; *line; line = eol + 1) { - /* Process next line */ - eol = strchr (line, '\n'); - if (eol) - *eol = '\0'; - - quoting = 0; - for (p = line; *p == '>'; p++) - quoting++; - if (quoting != prevquoting) { - if (prevquoting == 0) { - gtk_html_stream_printf (md->stream, "<font color=\"#%06x\">", citation_color); - if (br_pending) - br_pending--; - } - while (quoting > prevquoting) { - mail_html_write (md->html, md->stream, "<blockquote>"); - prevquoting++; - } - while (quoting < prevquoting) { - mail_html_write (md->html, md->stream, "</blockquote>"); - prevquoting--; - } - if (quoting == 0) { - mail_html_write (md->html, md->stream, "</font>\n"); - if (br_pending) - br_pending--; - } - } - - if (*p == ' ') - p++; - len = strlen (p); - if (len == 0) { - br_pending++; - continue; - } - - while (br_pending) { - mail_html_write (md->html, md->stream, "<br>\n"); - br_pending--; - } - - /* replace '<' with '<', etc. */ - text = e_text_to_html (p, E_TEXT_TO_HTML_CONVERT_SPACES | - E_TEXT_TO_HTML_CONVERT_URLS); - if (text && *text) - mail_html_write (md->html, md->stream, text); - g_free (text); - - if (p[len - 1] != ' ' || !strcmp (p, "-- ")) - br_pending++; - - if (!eol) - break; - } - g_free (buf); - - mail_html_write (md->html, md->stream, "</tt>\n</td></tr></table>\n"); - - return TRUE; -} - -static CamelMimePart * -fake_mime_part_from_data (const char *data, int len, const char *type, - guint offset, MailDisplay *md) -{ - GHashTable *fake_parts = g_datalist_get_data (md->data, "fake_parts"); - CamelStream *memstream; - CamelDataWrapper *wrapper; - CamelMimePart *part; - - part = g_hash_table_lookup (fake_parts, GUINT_TO_POINTER (offset)); - if (part) - return part; - - memstream = camel_stream_mem_new_with_buffer (data, len); - wrapper = camel_data_wrapper_new (); - camel_data_wrapper_construct_from_stream (wrapper, memstream); - camel_data_wrapper_set_mime_type (wrapper, type); - camel_object_unref (CAMEL_OBJECT (memstream)); - part = camel_mime_part_new (); - camel_medium_set_content_object (CAMEL_MEDIUM (part), wrapper); - camel_object_unref (CAMEL_OBJECT (wrapper)); - camel_mime_part_set_disposition (part, "inline"); - - g_hash_table_insert (fake_parts, GUINT_TO_POINTER (offset), part); - return part; -} - -static void -destroy_part (CamelObject *root, gpointer event_data, gpointer user_data) -{ - camel_object_unref (user_data); -} - -static char * -try_inline_pgp (char *start, CamelMimePart *mime_part, - guint offset, MailDisplay *md) -{ - CamelMimePart *part; - CamelMultipart *multipart; - char *end; - - end = strstr (start, "\n-----END PGP MESSAGE-----\n"); - if (!end) - return start; - - end += sizeof ("\n-----END PGP MESSAGE-----\n") - 1; - - multipart = camel_multipart_new (); - camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (multipart), - "multipart/encrypted; " - "protocol=\"application/pgp-encrypted\"; " - "x-inline-pgp-hack=true"); - - part = fake_mime_part_from_data ("Version: 1\n", - sizeof ("Version: 1\n") - 1, - "application/pgp-encrypted", - offset + 1, md); - camel_multipart_add_part (multipart, part); - camel_object_unref (CAMEL_OBJECT (part)); - - part = fake_mime_part_from_data (start, end - start + 1, - "application/octet-stream", - offset, md); - camel_multipart_add_part (multipart, part); - camel_object_unref (CAMEL_OBJECT (part)); - - part = camel_mime_part_new (); - camel_medium_set_content_object (CAMEL_MEDIUM (part), - CAMEL_DATA_WRAPPER (multipart)); - - camel_object_hook_event (CAMEL_OBJECT (md->current_message), - "finalize", destroy_part, part); - - write_hr (md); - format_mime_part (part, md); - - return end; -} - -static char * -try_inline_pgp_sig (char *start, CamelMimePart *mime_part, - guint offset, MailDisplay *md) -{ - CamelMimePart *part; - CamelMultipart *multipart; - char *msg_start, *msg_end, *sig_start, *sig_end; - CamelContentType *type; - char *type_str; - - /* We know start points to "-----BEGIN PGP SIGNED MESSAGE-----\n" */ - msg_start = start + sizeof ("-----BEGIN PGP SIGNED MESSAGE-----\n") - 1; - /* Skip 'One or more "Hash" Armor Headers' followed by - * 'Exactly one empty line'. - */ - msg_start = strstr (msg_start, "\n\n"); - if (!msg_start) - return start; - msg_start += 2; - msg_end = strstr (msg_start, "\n-----BEGIN PGP SIGNATURE-----\n"); - if (!msg_end) - return start; - - sig_start = msg_end; - sig_end = strstr (sig_start, "\n-----END PGP SIGNATURE-----\n"); - if (!sig_end) - return start; - sig_end += sizeof ("\n-----END PGP SIGNATURE-----\n") - 1; - - multipart = camel_multipart_new (); - camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (multipart), - "multipart/signed; micalg=pgp-sha1;" - "x-inline-pgp-hack=true"); - - type = camel_mime_part_get_content_type (mime_part); - type_str = header_content_type_format (type); - part = fake_mime_part_from_data (msg_start, msg_end - msg_start, - type_str, offset, md); - g_free (type_str); - camel_multipart_add_part (multipart, part); - camel_object_unref (CAMEL_OBJECT (part)); - - part = fake_mime_part_from_data (sig_start, sig_end - sig_start, - "application/pgp-signature", - offset + 1, md); - camel_multipart_add_part (multipart, part); - camel_object_unref (CAMEL_OBJECT (part)); - - part = camel_mime_part_new (); - camel_medium_set_content_object (CAMEL_MEDIUM (part), - CAMEL_DATA_WRAPPER (multipart)); - - camel_object_hook_event (CAMEL_OBJECT (md->current_message), - "finalize", destroy_part, part); - - write_hr (md); - format_mime_part (part, md); - - return sig_end; -} - -static char * -try_uudecoding (char *start, CamelMimePart *mime_part, - guint offset, MailDisplay *md) -{ - int mode, len, state = 0; - char *filename, *estart, *p, *out, uulen = 0; - guint32 save = 0; - CamelMimePart *part; - - /* Make sure it's a real uudecode begin line: - * begin [0-7]+ .* - */ - mode = strtoul (start + 6, &p, 8); - if (p == start + 6 || *p != ' ') - return start; - estart = strchr (start, '\n'); - if (!estart) - return start; - - while (isspace ((unsigned char)*p)) - p++; - filename = g_strndup (p, estart++ - p); - - /* Make sure there's an end line. */ - p = strstr (p, "\nend\n"); - if (!p) { - g_free (filename); - return start; - } - - out = g_malloc (p - estart); - len = uudecode_step (estart, p - estart, out, &state, &save, &uulen); - - part = fake_mime_part_from_data (out, len, "application/octet-stream", - offset, md); - g_free (out); - camel_mime_part_set_filename (part, filename); - g_free (filename); - camel_object_hook_event (CAMEL_OBJECT (md->current_message), - "finalize", destroy_part, part); - - write_hr (md); - format_mime_part (part, md); - - return p + 4; -} - -static char * -try_inline_binhex (char *start, CamelMimePart *mime_part, - guint offset, MailDisplay *md) -{ - char *p; - CamelMimePart *part; - - /* Find data start. */ - p = strstr (start, "\n:"); - if (!p) - return start; - - /* And data end. */ - p = strchr (p + 2, ':'); - if (!p || (*(p + 1) != '\n' && *(p + 1) != '\0')) - return start; - p += 2; - - part = fake_mime_part_from_data (start, p - start, - "application/mac-binhex40", - offset, md); - camel_object_hook_event (CAMEL_OBJECT (md->current_message), - "finalize", destroy_part, part); - - write_hr (md); - format_mime_part (part, md); - - return p; -} - -static void -g_string_append_len (GString *string, const char *str, int len) -{ - char *tmp; - - tmp = g_malloc (len + 1); - tmp[len] = 0; - memcpy (tmp, str, len); - g_string_append (string, tmp); - g_free (tmp); -} - -/* text/enriched (RFC 1896) or text/richtext (included in RFC 1341) */ -static gboolean -handle_text_enriched (CamelMimePart *part, const char *mime_type, - MailDisplay *md) -{ - static GHashTable *translations = NULL; - CamelDataWrapper *wrapper = - camel_medium_get_content_object (CAMEL_MEDIUM (part)); - GByteArray *ba, *bytes; - char *text, *p, *xed; - int len, nofill = 0; - gboolean enriched; - GString *string; - - if (!translations) { - translations = g_hash_table_new (g_strcase_hash, - g_strcase_equal); - g_hash_table_insert (translations, "bold", "<b>"); - g_hash_table_insert (translations, "/bold", "</b>"); - g_hash_table_insert (translations, "italic", "<i>"); - g_hash_table_insert (translations, "/italic", "</i>"); - g_hash_table_insert (translations, "fixed", "<tt>"); - g_hash_table_insert (translations, "/fixed", "</tt>"); - g_hash_table_insert (translations, "smaller", "<font size=-1>"); - g_hash_table_insert (translations, "/smaller", "</font>"); - g_hash_table_insert (translations, "bigger", "<font size=+1>"); - g_hash_table_insert (translations, "/bigger", "</font>"); - g_hash_table_insert (translations, "underline", "<u>"); - g_hash_table_insert (translations, "/underline", "</u>"); - g_hash_table_insert (translations, "center", "<p align=center>"); - g_hash_table_insert (translations, "/center", "</p>"); - g_hash_table_insert (translations, "flushleft", "<p align=left>"); - g_hash_table_insert (translations, "/flushleft", "</p>"); - g_hash_table_insert (translations, "flushright", "<p align=right>"); - g_hash_table_insert (translations, "/flushright", "</p>"); - g_hash_table_insert (translations, "excerpt", "<blockquote>"); - g_hash_table_insert (translations, "/excerpt", "</blockquote>"); - g_hash_table_insert (translations, "paragraph", "<p>"); - g_hash_table_insert (translations, "signature", "<address>"); - g_hash_table_insert (translations, "/signature", "</address>"); - g_hash_table_insert (translations, "comment", "<!-- "); - g_hash_table_insert (translations, "/comment", " -->"); - g_hash_table_insert (translations, "param", "<!-- "); - g_hash_table_insert (translations, "/param", " -->"); - g_hash_table_insert (translations, "np", "<hr>"); - } - - bytes = mail_format_get_data_wrapper_text (wrapper, md); - if (!bytes) - return FALSE; - - if (!g_strcasecmp (mime_type, "text/richtext")) { - enriched = FALSE; - mail_html_write (md->html, md->stream, - "\n<!-- text/richtext -->\n"); - } else { - enriched = TRUE; - mail_html_write (md->html, md->stream, - "\n<!-- text/enriched -->\n"); - } - - /* This is not great code, but I don't feel like fixing it right - * now. I mean, it's just text/enriched... - */ - string = g_string_sized_new (2 * bytes->len); - g_byte_array_append (bytes, "", 1); - p = text = bytes->data; - g_byte_array_free (bytes, FALSE); - - while (p) { - len = strcspn (p, " <>&\n"); - if (len) - g_string_append_len (string, p, len); - - p += len; - if (!*p) - break; - - switch (*p++) { - case ' ': - while (*p == ' ') { - g_string_append (string, " "); - p++; - } - g_string_append (string, " "); - break; - case '\n': - g_string_append (string, " "); - if (enriched && nofill <= 0) { - while (*p == '\n') { - g_string_append (string, "<br>"); - p++; - } - } - break; - case '>': - g_string_append (string, ">"); - break; - case '&': - g_string_append (string, "&"); - break; - case '<': - if (enriched) { - if (*p == '<') { - g_string_append (string, "<"); - p++; - break; - } - } else { - if (strncmp (p, "lt>", 3) == 0) { - g_string_append (string, "<"); - p += 3; - break; - } else if (strncmp (p, "nl>", 3) == 0) { - g_string_append (string, "<br>"); - p += 3; - break; - } - } - - if (strncmp (p, "nofill>", 7) == 0) { - nofill++; - g_string_append (string, "<pre>"); - } else if (strncmp (p, "/nofill>", 8) == 0) { - nofill--; - g_string_append (string, "</pre>"); - } else { - char *copy, *match; - - len = strcspn (p, ">"); - copy = g_strndup (p, len); - match = g_hash_table_lookup (translations, - copy); - g_free (copy); - if (match) - g_string_append (string, match); - } - - p = strchr (p, '>'); - if (p) - p++; - } - } - g_free (text); - - ba = g_byte_array_new (); - g_byte_array_append (ba, (const guint8 *)string->str, - string->len); - g_string_free (string, TRUE); - - xed = g_strdup_printf ("x-evolution-data:%p", part); - gtk_html_stream_printf (md->stream, "<iframe src=\"%s\" frameborder=0 scrolling=no></iframe>", xed); - add_url ("data_urls", xed, ba, md); - - return TRUE; -} - -static gboolean -handle_text_html (CamelMimePart *part, const char *mime_type, - MailDisplay *md) -{ - const char *location; - - mail_html_write (md->html, md->stream, "\n<!-- text/html -->\n"); - - /* FIXME: deal with relative URLs */ - location = get_location (part, md); - if (!location) - location = get_cid (part, md); - gtk_html_stream_printf (md->stream, "<iframe src=\"%s\" frameborder=0 scrolling=no></iframe>", location); - return TRUE; -} - -static gboolean -handle_image (CamelMimePart *part, const char *mime_type, MailDisplay *md) -{ - gtk_html_stream_printf (md->stream, "<img hspace=10 vspace=10 src=\"%s\">", - 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) - write_hr (md); - - part = camel_multipart_get_part (mp, i); - - output = format_mime_part (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 (!camel_pgp_mime_is_rfc2015_encrypted (part)) - return handle_multipart_mixed (part, mime_type, md); - - camel_exception_init (&ex); - mime_part = mail_crypto_pgp_mime_part_decrypt (part, &ex); - - if (camel_exception_is_set (&ex)) { - char *error; - - error = e_utf8_from_locale_string (camel_exception_get_description (&ex)); - - mail_error_printf (md->html, md->stream, "\n%s\n", error); - g_free (error); - - camel_exception_clear (&ex); - return TRUE; - } else { - /* replace the encrypted part with the decrypted part */ - camel_medium_set_content_object (CAMEL_MEDIUM (part), - camel_medium_get_content_object (CAMEL_MEDIUM (mime_part))); - camel_object_unref (CAMEL_OBJECT (mime_part)); - - /* and continue on our merry way... */ - return format_mime_part (part, md); - } -} - -static gboolean -handle_multipart_signed (CamelMimePart *part, const char *mime_type, - MailDisplay *md) -{ - CamelMimePart *subpart; - CamelDataWrapper *wrapper; - CamelMultipart *mp; - gboolean output = FALSE; - int nparts, i; - - wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part)); - - g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); - - /* Display all the subparts (there should be only 1) - * except the signature (last part). - */ - mp = CAMEL_MULTIPART (wrapper); - - nparts = camel_multipart_get_number (mp); - for (i = 0; i < nparts - 1; i++) { - if (i != 0 && output) - write_hr (md); - - subpart = camel_multipart_get_part (mp, i); - - output = format_mime_part (subpart, md); - } - - subpart = camel_multipart_get_part (mp, i); - mail_part_set_default_displayed_inline (subpart, md, FALSE); - - if (!mail_part_is_displayed_inline (subpart, md)) { - char *url; - - /* Write out the click-for-info object */ - url = g_strdup_printf ("signature:%p/%lu", subpart, - (unsigned long)time (NULL)); - gtk_html_stream_printf (md->stream, - "<br><table cellspacing=0 cellpadding=0>" - "<tr><td><table width=10 cellspacing=0 cellpadding=0>" - "<tr><td></td></tr></table></td>" - "<td><object classid=\"%s\"></object></td>" - "<td><table width=3 cellspacing=0 cellpadding=0>" - "<tr><td></td></tr></table></td>" - "<td><font size=-1>", url); - add_url ("part_urls", url, subpart, md); - - mail_html_write (md->html, md->stream, - U_("This message is digitally signed. " - "Click the lock icon for more information.")); - - mail_html_write (md->html, md->stream, - "</font></td></tr><tr><td height=10><table height=10 cellspacing=0 cellpadding=0>" - "<tr><td></td></tr></table></td></tr></table>\n"); - } else { - CamelCipherValidity *valid = NULL; - CamelException ex; - const char *message = NULL; - gboolean good = FALSE; - - /* Write out the verification results */ - camel_exception_init (&ex); - if (camel_pgp_mime_is_rfc2015_signed (part)) { - valid = mail_crypto_pgp_mime_part_verify (part, &ex); - if (!valid) { - message = camel_exception_get_description (&ex); - } else { - good = camel_cipher_validity_get_valid (valid); - message = camel_cipher_validity_get_description (valid); - } - } else - message = U_("Evolution does not recognize this type of signed message."); - - if (good) { - gtk_html_stream_printf (md->stream, - "<table><tr valign=top>" - "<td><img src=\"%s\"></td>" - "<td>%s<br><br>", - get_url_for_icon (EVOLUTION_ICONSDIR "/pgp-signature-ok.png", md), - U_("This message is digitally signed and " - "has been found to be authentic.")); - } else { - gtk_html_stream_printf (md->stream, - "<table><tr valign=top>" - "<td><img src=\"%s\"></td>" - "<td>%s<br><br>", - get_url_for_icon (EVOLUTION_ICONSDIR "/pgp-signature-bad.png", md), - U_("This message is digitally signed but can " - "not be proven to be authentic.")); - } - - if (message) { - gtk_html_stream_printf (md->stream, "<font size=-1 %s>", - good ? "" : "color=red"); - mail_text_write (md->html, md->stream, message); - mail_html_write (md->html, md->stream, "</font>"); - } - - mail_html_write (md->html, md->stream, "</td></tr></table>"); - camel_exception_clear (&ex); - camel_cipher_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; - } - } - } else { - /* No start parameter, so it defaults to the first part. */ - display_part = camel_multipart_get_part (mp, 0); - } - - if (!display_part) { - /* Oops. Hrmph. */ - return handle_multipart_mixed (part, mime_type, md); - } - - /* Record the Content-ID/Content-Location 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); - get_location (body_part, md); - } - - /* Now, display the displayed part. */ - return format_mime_part (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 format_mime_part (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 format_mime_part (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, "<blockquote>"); - mail_format_mime_message (CAMEL_MIME_MESSAGE (wrapper), md); - mail_html_write (md->html, md->stream, "</blockquote>"); - - 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; - char *fmt; - - 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); - fmt = e_utf8_from_locale_string (_("Pointer to FTP site (%s)")); - desc = g_strdup_printf (fmt, url); - g_free (fmt); - } 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) { - fmt = e_utf8_from_locale_string (_("Pointer to local file (%s) " - "valid at site \"%s\"")); - desc = g_strdup_printf (fmt, name, site); - g_free (fmt); - } else { - fmt = e_utf8_from_locale_string (_("Pointer to local file (%s)")); - desc = g_strdup_printf (fmt, name); - g_free (fmt); - } - } 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; - - fmt = e_utf8_from_locale_string (_("Pointer to remote data (%s)")); - desc = g_strdup_printf (fmt, url); - g_free (fmt); - } - - fallback: - if (!desc) { - if (access_type) { - fmt = e_utf8_from_locale_string (_("Pointer to unknown external data " - "(\"%s\" type)")); - desc = g_strdup_printf (fmt, access_type); - g_free (fmt); - } else - desc = e_utf8_from_locale_string (_("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) -{ - gtk_html_stream_printf (md->stream, - "<object classid=\"%s\" type=\"%s\"></object>", - get_cid (part, md), mime_type); - return TRUE; -} - -/** - * mail_get_message_rfc822: - * @message: the message - * @want_plain: whether the caller prefers plain to html - * @cite: whether or not to cite the message text - * - * See mail_get_message_body() below for more details. - * - * Return value: an HTML string representing the text parts of @message. - **/ -static char * -mail_get_message_rfc822 (CamelMimeMessage *message, gboolean want_plain, gboolean cite) -{ - CamelDataWrapper *contents; - GString *retval; - const CamelInternetAddress *cia; - char *text, *citation, *buf, *html; - time_t date_val; - int offset; - - contents = camel_medium_get_content_object (CAMEL_MEDIUM (message)); - text = mail_get_message_body (contents, want_plain, cite); - if (!text) - text = g_strdup (""); - citation = cite ? "> " : ""; - retval = g_string_new (NULL); - - /* Kludge: if text starts with "<PRE>", wrap it around the - * headers too so we won't get a blank line between them for the - * <P> to <PRE> switch. - */ - if (!g_strncasecmp (text, "<pre>", 5)) - g_string_sprintfa (retval, "<PRE>"); - - /* create credits */ - cia = camel_mime_message_get_from (message); - buf = camel_address_format (CAMEL_ADDRESS (cia)); - if (buf) { - html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS); - g_string_sprintfa (retval, "%s<b>From:</b> %s<br>", - citation, html); - g_free (html); - g_free (buf); - } - - cia = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO); - buf = camel_address_format (CAMEL_ADDRESS (cia)); - if (buf) { - html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS); - g_string_sprintfa (retval, "%s<b>To:</b> %s<br>", - citation, html); - g_free (html); - g_free (buf); - } - - cia = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC); - buf = camel_address_format (CAMEL_ADDRESS (cia)); - if (buf) { - html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS); - g_string_sprintfa (retval, "%s<b>Cc:</b> %s<br>", - citation, html); - g_free (html); - g_free (buf); - } - - buf = (char *) camel_mime_message_get_subject (message); - if (buf) { - html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS); - g_string_sprintfa (retval, "%s<b>Subject:</b> %s<br>", - citation, html); - g_free (html); - } - - date_val = camel_mime_message_get_date (message, &offset); - buf = header_format_date (date_val, offset); - html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS); - g_string_sprintfa (retval, "%s<b>Date:</b> %s<br>", citation, html); - g_free (html); - - if (!g_strncasecmp (text, "<pre>", 5)) - g_string_sprintfa (retval, "%s<br>%s", citation, text + 5); - else - g_string_sprintfa (retval, "%s<br>%s", citation, text); - g_free (text); - - buf = retval->str; - g_string_free (retval, FALSE); - return buf; -} - -/** - * mail_get_message_body: - * @data: the message or mime part content - * @want_plain: whether the caller prefers plain to html - * @cite: whether or not to cite the message text - * - * This creates an HTML string representing @data. If @want_plain is %TRUE, - * it will be an HTML string that looks like a text/plain representation - * of @data (but it will still be HTML). - * - * If @cite is %TRUE, the message will be cited as a reply, using "> "s. - * - * Return value: the HTML string, which the caller must free, or - * %NULL if @data doesn't include any data which should be forwarded or - * replied to. - **/ -char * -mail_get_message_body (CamelDataWrapper *data, gboolean want_plain, gboolean cite) -{ - CamelContentType *mime_type; - char *subtext, *old, *div, *text = NULL; - GByteArray *bytes = NULL; - CamelMimePart *subpart; - CamelMultipart *mp; - int i, nparts; - - mime_type = camel_data_wrapper_get_mime_type_field (data); - - /* If it is message/rfc822 or message/news, extract the - * important headers and recursively process the body. - */ - if (header_content_type_is (mime_type, "message", "rfc822") || - header_content_type_is (mime_type, "message", "news")) - return mail_get_message_rfc822 (CAMEL_MIME_MESSAGE (data), want_plain, cite); - - /* If it's a vcard or icalendar, ignore it. */ - if (header_content_type_is (mime_type, "text", "x-vcard") || - header_content_type_is (mime_type, "text", "calendar")) - return NULL; - - /* Get the body data for other text/ or message/ types */ - if (header_content_type_is (mime_type, "text", "*") || - header_content_type_is (mime_type, "message", "*")) { - bytes = mail_format_get_data_wrapper_text (data, NULL); - - if (bytes) { - g_byte_array_append (bytes, "", 1); - text = bytes->data; - g_byte_array_free (bytes, FALSE); - } - - if (text && !header_content_type_is (mime_type, "text", "html")) { - char *html; - - html = e_text_to_html (text, E_TEXT_TO_HTML_PRE | (cite ? E_TEXT_TO_HTML_CITE : 0)); - g_free (text); - text = html; - } - return text; - } - - /* 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, cite); - } - - /* Otherwise, concatenate all the parts that we can. */ - if (want_plain) { - if (cite) - div = "<br>\n> ----<br>\n> <br>\n"; - else - div = "<br>\n----<br>\n<br>\n"; - } else - div = "<br><hr><br>"; - - nparts = camel_multipart_get_number (mp); - for (i = 0; i < nparts; i++) { - subpart = camel_multipart_get_part (mp, i); - - data = camel_medium_get_content_object (CAMEL_MEDIUM (subpart)); - subtext = mail_get_message_body (data, want_plain, cite); - if (!subtext) - continue; - - if (text) { - old = text; - text = g_strdup_printf ("%s%s%s", old, div, 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 18d25188ff..0000000000 --- a/mail/mail-identify.c +++ /dev/null @@ -1,131 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Dan Winship <danw@ximian.com> - * - * Copyright 2000, Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include <stdlib.h> -#include <string.h> - -#include <glib.h> -#include <libgnomevfs/gnome-vfs-mime.h> -#include <libgnomevfs/gnome-vfs-mime-sniff-buffer.h> -#include "mail.h" - -static const char *identify_by_magic (CamelDataWrapper *data, MailDisplay *md); - -/** - * 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). - * - * Return value: the MIME type, which the caller must free, or %NULL - * if it could not be identified. - **/ -char * -mail_identify_mime_part (CamelMimePart *part, MailDisplay *md) -{ - const char *filename, *name_type = NULL, *magic_type = NULL; - CamelDataWrapper *data; - - filename = camel_mime_part_get_filename (part); - if (filename) { - /* GNOME-VFS will misidentify TNEF attachments as MPEG */ - if (!strcmp (filename, "winmail.dat")) - return g_strdup ("application/vnd.ms-tnef"); - - name_type = gnome_vfs_mime_type_from_name_or_default (filename, NULL); - } - - data = camel_medium_get_content_object (CAMEL_MEDIUM (part)); - if (!camel_data_wrapper_is_offline (data)) - magic_type = identify_by_magic (data, md); - - if (magic_type && name_type) { - /* If GNOME-VFS doesn't recognize the data by magic, but it - * contains English words, it will call it text/plain. If the - * filename-based check came up with something different, use - * that instead. - */ - if (!strcmp (magic_type, "text/plain")) - return g_strdup (name_type); - - /* If if returns "application/octet-stream" try to - * do better with the filename check. - */ - if (!strcmp (magic_type, "application/octet-stream")) - return g_strdup (name_type); - } - - /* If the MIME part data was online, and the magic check - * returned something, use that, since it's more reliable. - */ - if (magic_type) - return g_strdup (magic_type); - - /* Otherwise try guessing based on the filename */ - if (name_type) - return g_strdup (name_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. - */ - - /* If the data part is offline, then we didn't try magic - * before, so force it to be loaded so we can try again later. - * FIXME: In a perfect world, we would not load the content - * just to identify the MIME type. - */ - if (camel_data_wrapper_is_offline (data)) - mail_content_loaded (data, md, TRUE, NULL, NULL); - - return NULL; -} - -static const char * -identify_by_magic (CamelDataWrapper *data, MailDisplay *md) -{ - GnomeVFSMimeSniffBuffer *sniffer; - CamelStream *memstream; - const char *type; - GByteArray *ba; - - 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)); - - return type; -} diff --git a/mail/mail-importer.c b/mail/mail-importer.c deleted file mode 100644 index 365baaefb7..0000000000 --- a/mail/mail-importer.c +++ /dev/null @@ -1,261 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* mail-importer.c - * - * Authors: Iain Holmes <iain@ximian.com> - * - * Copyright (C) 2001 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include <dirent.h> -#include <gmodule.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-util.h> -#include <evolution-storage.h> -#include <camel/camel-folder.h> -#include <camel/camel-mime-message.h> -#include <camel/camel-stream-mem.h> -#include <camel/camel-exception.h> - -#include "mail-importer.h" -#include "mail-local.h" -#include "mail.h" - - -static GList *importer_modules = NULL; - -extern char *evolution_dir; - -static GNOME_Evolution_Storage local_storage = NULL; - -/* Prototype */ - -void mail_importer_uninit (void); - -/** - * mail_importer_create_folder: - * parent_path: The path of the parent folder. - * name: The name of the folder to be created. - * description: A description of the folder. - * listener: A BonoboListener for notification. - * - * Attempts to create the folder @parent_path/@name. When the folder has been - * created, or there is an error, the "evolution-shell:folder-created" event is - * emitted on @listener. The BonoboArg that is sent to @listener is a - * GNOME_Evolution_Storage_FolderResult which has two elements: result and path. - * Result contains the error code, or success, and path contains the complete - * physical path to the newly created folder. - */ -void -mail_importer_create_folder (const char *parent_path, - const char *name, - const char *description, - const BonoboListener *listener) -{ - Bonobo_Listener corba_listener; - CORBA_Environment ev; - char *path, *physical; - char *real_description; - - g_return_if_fail (local_storage != NULL); - g_return_if_fail (listener != NULL); - g_return_if_fail (BONOBO_IS_LISTENER (listener)); - - path = g_concat_dir_and_file (parent_path, name); - physical = g_strdup_printf ("file://%s/local/%s", evolution_dir, - parent_path); - - corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (listener)); - - /* Darn CORBA wanting non-NULL values for strings */ - real_description = CORBA_string_dup (description ? description : ""); - - - CORBA_exception_init (&ev); - GNOME_Evolution_Storage_asyncCreateFolder (local_storage, - path, "mail", - real_description, 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); -} - -/* module management */ -static GList * -get_importer_list (void) -{ - DIR *dir; - struct dirent *d; - GList *importers_ret = NULL; - - dir = opendir (MAIL_IMPORTERSDIR); - if (!dir) { - g_warning ("No importers dir: %s", MAIL_IMPORTERSDIR); - return NULL; - } - - while ((d = readdir (dir))) { - char *path, *ext; - - ext = strchr (d->d_name, '.'); - if (!ext || strcmp (ext, ".so") != 0) - continue; - - path = g_concat_dir_and_file (MAIL_IMPORTERSDIR, d->d_name); - importers_ret = g_list_prepend (importers_ret, path); - } - - closedir (dir); - return importers_ret; -} - -static void -free_importer_list (GList *list) -{ - for (; list; list = list->next) { - g_free (list->data); - } - - g_list_free (list); -} - -/** - * mail_importer_init: - * - * Initialises all the importers - */ -void -mail_importer_init (EvolutionShellClient *client) -{ - GList *importers, *l; - - if (importer_modules != NULL) { - return; - } - - local_storage = evolution_shell_client_get_local_storage (client); - - if (!g_module_supported ()) { - g_warning ("Could not initialise the importers as module loading" - " is not supported on this system"); - return; - } - - importers = get_importer_list (); - if (importers == NULL) - return; - - for (l = importers; l; l = l->next) { - GModule *module; - - module = g_module_open (l->data, 0); - if (!module) { - g_warning ("Could not load: %s: %s", (char *) l->data, - g_module_error ()); - } else { - void *(*mail_importer_module_init) (); - - if (!g_module_symbol (module, "mail_importer_module_init", - (gpointer *)&mail_importer_module_init)) { - g_warning ("Could not load %s: No initialisation", - (char *) l->data); - g_module_close (module); - } - - mail_importer_module_init (); - importer_modules = g_list_prepend (importer_modules, module); - } - } - - free_importer_list (importers); -} - -/** - * mail_importer_uninit: - * - * Unloads all the modules. - */ -void -mail_importer_uninit (void) -{ - CORBA_Environment ev; - GList *l; - - for (l = importer_modules; l; l = l->next) { - g_module_close (l->data); - } - - g_list_free (importer_modules); - importer_modules = NULL; - - CORBA_exception_init (&ev); - bonobo_object_release_unref (local_storage, &ev); - local_storage = NULL; - CORBA_exception_free (&ev); -} - diff --git a/mail/mail-importer.h b/mail/mail-importer.h deleted file mode 100644 index 41e7e0471c..0000000000 --- a/mail/mail-importer.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* mail-importer.h - * - * Authors: Iain Holmes <iain@ximian.com> - * - * Copyright (C) 2001 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <bonobo/bonobo-listener.h> -#include <camel/camel-folder.h> -#include <camel/camel-stream-mem.h> -#include <evolution-shell-client.h> - -typedef struct _MailImporter MailImporter; -struct _MailImporter { - CamelFolder *folder; - CamelStreamMem *mstream; - - gboolean frozen; /* Is folder frozen? */ -}; - -void mail_importer_init (EvolutionShellClient *client); -void mail_importer_uninit (void); - -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 *description, - const BonoboListener *listener); -#endif diff --git a/mail/mail-local.c b/mail/mail-local.c deleted file mode 100644 index b072f90795..0000000000 --- a/mail/mail-local.c +++ /dev/null @@ -1,1471 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* mail-local.c: Local mailbox support. */ - -/* - * Authors: - * Michael Zucchi <NotZed@ximian.com> - * Peter Williams <peterw@ximian.com> - * Ettore Perazzoli <ettore@ximian.com> - * Dan Winship <danw@ximian.com> - * - * Copyright 2000 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include <unistd.h> -#include <errno.h> - -#include <gnome-xml/xmlmemory.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-dialog-util.h> -#include <glade/glade.h> - -#include "gal/widgets/e-gui-utils.h" -#include "e-util/e-path.h" -#include "gal/util/e-unicode-i18n.h" - -#include "Evolution.h" -#include "evolution-storage.h" -#include "evolution-shell-component.h" -#include "evolution-storage-listener.h" - -#include "camel/camel.h" -#include "camel/camel-vtrash-folder.h" - -#include "mail.h" -#include "mail-local.h" -#include "mail-tools.h" -#include "folder-browser.h" -#include "mail-mt.h" -#include "mail-folder-cache.h" -#include "mail-vfolder.h" -#include "mail-ops.h" - -#define d(x) - -/* sigh, required for passing around to some functions */ -static GNOME_Evolution_Storage local_corba_storage = CORBA_OBJECT_NIL; - -/* ** MailLocalStore ** (protos) ************************************************** */ - -#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; - - /* stores CamelFolderInfo's of the folders we're supposed to know about, by uri */ - GHashTable *folder_infos; - GMutex *folder_info_lock; - -} MailLocalStore; - -typedef struct { - CamelStoreClass parent_class; -} MailLocalStoreClass; - -static CamelType mail_local_store_get_type (void); - -static MailLocalStore *global_local_store; - -/* ** MailLocalFolder ** (protos) ************************************************* */ - -#define MAIL_LOCAL_FOLDER_TYPE (mail_local_folder_get_type ()) -#define MAIL_LOCAL_FOLDER(obj) (CAMEL_CHECK_CAST((obj), MAIL_LOCAL_FOLDER_TYPE, MailLocalFolder)) -#define MAIL_LOCAL_FOLDER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), MAIL_LOCAL_FOLDER_TYPE, MailLocalFolderClass)) -#define MAIL_IS_LOCAL_FOLDER(o) (CAMEL_CHECK_TYPE((o), MAIL_LOCAL_FOLDER_TYPE)) - -#define LOCAL_STORE_LOCK(folder) (g_mutex_lock (((MailLocalStore *)folder)->folder_info_lock)) -#define LOCAL_STORE_UNLOCK(folder) (g_mutex_unlock (((MailLocalStore *)folder)->folder_info_lock)) - -struct _local_meta { - char *path; /* path of metainfo */ - - char *format; /* format of mailbox */ - char *name; /* name of actual mbox */ - int indexed; /* is body indexed? */ -}; - -typedef struct { - CamelFolder parent_object; - - CamelFolder *real_folder; - CamelStore *real_store; - - char *real_path; - - struct _local_meta *meta; - - GMutex *real_folder_lock; /* no way to use the CamelFolder's lock, so... */ -} MailLocalFolder; - -typedef struct { - CamelFolderClass parent_class; -} MailLocalFolderClass; - -static CamelType mail_local_folder_get_type (void); - -#ifdef ENABLE_THREADS -#define LOCAL_FOLDER_LOCK(folder) (g_mutex_lock (((MailLocalFolder *)folder)->real_folder_lock)) -#define LOCAL_FOLDER_UNLOCK(folder) (g_mutex_unlock (((MailLocalFolder *)folder)->real_folder_lock)) -#else -#define LOCAL_FOLDER_LOCK(folder) -#define LOCAL_FOLDER_UNLOCK(folder) -#endif - -/* ** MailLocalFolder ************************************************************* */ - -static struct _local_meta * -load_metainfo(const char *path) -{ - xmlDocPtr doc; - xmlNodePtr node; - struct _local_meta *meta; - - d(printf("Loading folder metainfo from : %s\n", path)); - - meta = g_malloc0(sizeof(*meta)); - meta->path = g_strdup(path); - - doc = xmlParseFile(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; - 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 gboolean -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; -} - -static CamelFolderClass *mlf_parent_class = NULL; - -/* forward a bunch of functions to the real folder. This pretty - * much sucks but I haven't found a better way of doing it. - */ - -/* We need to do it without having locked our folder, otherwise - we can get sync hangs with vfolders/trash */ -static void -mlf_refresh_info(CamelFolder *folder, CamelException *ex) -{ - MailLocalFolder *mlf = MAIL_LOCAL_FOLDER(folder); - CamelFolder *f; - - LOCAL_FOLDER_LOCK(mlf); - f = mlf->real_folder; - camel_object_ref((CamelObject *)f); - LOCAL_FOLDER_UNLOCK(mlf); - - camel_folder_refresh_info(f, ex); - camel_object_unref((CamelObject *)f); -} - -static void -mlf_sync(CamelFolder *folder, gboolean expunge, CamelException *ex) -{ - MailLocalFolder *mlf = MAIL_LOCAL_FOLDER(folder); - CamelFolder *f; - - LOCAL_FOLDER_LOCK(mlf); - f = mlf->real_folder; - camel_object_ref((CamelObject *)f); - LOCAL_FOLDER_UNLOCK(mlf); - - camel_folder_sync(f, expunge, ex); - camel_object_unref((CamelObject *)f); -} - -static void -mlf_expunge(CamelFolder *folder, CamelException *ex) -{ - MailLocalFolder *mlf = MAIL_LOCAL_FOLDER(folder); - CamelFolder *f; - - LOCAL_FOLDER_LOCK(mlf); - f = mlf->real_folder; - camel_object_ref((CamelObject *)f); - LOCAL_FOLDER_UNLOCK(mlf); - - camel_folder_expunge(f, ex); - camel_object_unref((CamelObject *)f); -} - -static void -mlf_append_message(CamelFolder *folder, CamelMimeMessage *message, const CamelMessageInfo *info, CamelException *ex) -{ - MailLocalFolder *mlf = MAIL_LOCAL_FOLDER(folder); - CamelFolder *f; - - LOCAL_FOLDER_LOCK(mlf); - f = mlf->real_folder; - camel_object_ref((CamelObject *)f); - LOCAL_FOLDER_UNLOCK(mlf); - - camel_folder_append_message(f, message, info, ex); - camel_object_unref((CamelObject *)f); -} - -static CamelMimeMessage * -mlf_get_message(CamelFolder *folder, const char *uid, CamelException *ex) -{ - MailLocalFolder *mlf = MAIL_LOCAL_FOLDER(folder); - CamelMimeMessage *ret; - CamelFolder *f; - - LOCAL_FOLDER_LOCK(mlf); - f = mlf->real_folder; - camel_object_ref((CamelObject *)f); - LOCAL_FOLDER_UNLOCK(mlf); - - ret = camel_folder_get_message(f, uid, ex); - camel_object_unref((CamelObject *)f); - - return ret; -} - -static GPtrArray * -mlf_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex) -{ - MailLocalFolder *mlf = MAIL_LOCAL_FOLDER (folder); - GPtrArray *ret; - CamelFolder *f; - - LOCAL_FOLDER_LOCK(mlf); - f = mlf->real_folder; - camel_object_ref((CamelObject *)f); - LOCAL_FOLDER_UNLOCK(mlf); - - ret = camel_folder_search_by_expression(f, expression, ex); - camel_object_unref((CamelObject *)f); - - return ret; -} - -static GPtrArray * -mlf_search_by_uids(CamelFolder *folder, const char *expression, GPtrArray *uids, CamelException *ex) -{ - MailLocalFolder *mlf = MAIL_LOCAL_FOLDER (folder); - GPtrArray *ret; - CamelFolder *f; - - LOCAL_FOLDER_LOCK(mlf); - f = mlf->real_folder; - camel_object_ref((CamelObject *)f); - LOCAL_FOLDER_UNLOCK(mlf); - - ret = camel_folder_search_by_uids(f, expression, uids, ex); - camel_object_unref((CamelObject *)f); - - return ret; -} - -static void -mlf_search_free(CamelFolder *folder, GPtrArray *result) -{ - MailLocalFolder *mlf = MAIL_LOCAL_FOLDER(folder); - CamelFolder *f; - - LOCAL_FOLDER_LOCK(mlf); - f = mlf->real_folder; - camel_object_ref((CamelObject *)f); - LOCAL_FOLDER_UNLOCK(mlf); - - camel_folder_search_free(f, result); - camel_object_unref((CamelObject *)f); -} - -static void -mlf_set_message_flags(CamelFolder *folder, const char *uid, guint32 flags, guint32 set) -{ - MailLocalFolder *mlf = MAIL_LOCAL_FOLDER(folder); - CamelFolder *f; - - LOCAL_FOLDER_LOCK(mlf); - f = mlf->real_folder; - camel_object_ref((CamelObject *)f); - LOCAL_FOLDER_UNLOCK(mlf); - - camel_folder_set_message_flags(mlf->real_folder, uid, flags, set); - camel_object_unref((CamelObject *)f); -} - -static void -mlf_set_message_user_flag(CamelFolder *folder, const char *uid, const char *name, gboolean value) -{ - MailLocalFolder *mlf = MAIL_LOCAL_FOLDER(folder); - CamelFolder *f; - - LOCAL_FOLDER_LOCK(mlf); - f = mlf->real_folder; - camel_object_ref((CamelObject *)f); - LOCAL_FOLDER_UNLOCK(mlf); - - camel_folder_set_message_user_flag(mlf->real_folder, uid, name, value); - camel_object_unref((CamelObject *)f); -} - -static void -mlf_set_message_user_tag(CamelFolder *folder, const char *uid, const char *name, const char *value) -{ - MailLocalFolder *mlf = MAIL_LOCAL_FOLDER(folder); - CamelFolder *f; - - LOCAL_FOLDER_LOCK(mlf); - f = mlf->real_folder; - camel_object_ref((CamelObject *)f); - LOCAL_FOLDER_UNLOCK(mlf); - - camel_folder_set_message_user_tag(mlf->real_folder, uid, name, value); - camel_object_unref((CamelObject *)f); -} - -/* Internal store-rename call, update our strings */ -static void -mlf_rename(CamelFolder *folder, const char *new) -{ - MailLocalFolder *mlf = (MailLocalFolder *)folder; - - /* first, proxy it down */ - if (mlf->real_folder) { - char *mbox = g_strdup_printf("%s/%s", new, mlf->meta->name); - - d(printf("renaming real folder to %s\n", mbox)); - - camel_folder_rename(mlf->real_folder, mbox); - g_free(mbox); - } - - /* Then do our stuff */ - g_free(mlf->real_path); - mlf->real_path = g_strdup(new); - - g_free(mlf->meta->path); - mlf->meta->path = g_strdup_printf("%s/%s/local-metadata.xml", ((CamelService *)folder->parent_store)->url->path, new); - - /* Then pass it up */ - ((CamelFolderClass *)mlf_parent_class)->rename(folder, new); -} - -/* and, conversely, forward the real folder's signals. */ - -static void -mlf_proxy_message_changed(CamelObject *real_folder, gpointer event_data, gpointer user_data) -{ - camel_object_trigger_event((CamelObject *)user_data, "message_changed", event_data); -} - -static void -mlf_proxy_folder_changed(CamelObject *real_folder, gpointer event_data, gpointer user_data) -{ - camel_object_trigger_event((CamelObject *)user_data, "folder_changed", event_data); -} - -static void -mlf_unset_folder (MailLocalFolder *mlf) -{ - CamelFolder *folder = (CamelFolder *)mlf; - - g_assert(mlf->real_folder); - - camel_object_unhook_event(CAMEL_OBJECT(mlf->real_folder), - "message_changed", - mlf_proxy_message_changed, - mlf); - camel_object_unhook_event(CAMEL_OBJECT(mlf->real_folder), - "folder_changed", - mlf_proxy_folder_changed, - mlf); - - camel_object_unref((CamelObject *)folder->summary); - folder->summary = NULL; - camel_object_unref((CamelObject *)mlf->real_folder); - mlf->real_folder = NULL; - camel_object_unref((CamelObject *)mlf->real_store); - mlf->real_store = NULL; - - folder->permanent_flags = 0; - folder->folder_flags = 0; -} - -static gboolean -mlf_set_folder(MailLocalFolder *mlf, guint32 flags, CamelException *ex) -{ - CamelFolder *folder = (CamelFolder *)mlf; - char *uri, *mbox; - - g_assert(mlf->real_folder == NULL); - - uri = g_strdup_printf("%s:%s", mlf->meta->format, ((CamelService *)folder->parent_store)->url->path); - - d(printf("opening real store: %s\n", uri)); - mlf->real_store = camel_session_get_store(session, uri, ex); - g_free(uri); - if (mlf->real_store == NULL) - return FALSE; - - if (mlf->meta->indexed) - flags |= CAMEL_STORE_FOLDER_BODY_INDEX; - - /* mlf->real_folder = camel_store_get_folder(mlf->real_store, mlf->meta->name, flags, ex); */ - mbox = g_strdup_printf("%s/%s", mlf->real_path, mlf->meta->name); - d(printf("Opening mbox on real path: %s\n", mbox)); - mlf->real_folder = camel_store_get_folder(mlf->real_store, mbox, flags, ex); - g_free(mbox); - if (mlf->real_folder == NULL) - return FALSE; - - if (mlf->real_folder->folder_flags & CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY) { - folder->summary = mlf->real_folder->summary; - camel_object_ref((CamelObject *)mlf->real_folder->summary); - } - - folder->permanent_flags = mlf->real_folder->permanent_flags; - folder->folder_flags = mlf->real_folder->folder_flags; - - camel_object_hook_event((CamelObject *)mlf->real_folder, "message_changed", mlf_proxy_message_changed, mlf); - camel_object_hook_event((CamelObject *)mlf->real_folder, "folder_changed", mlf_proxy_folder_changed, mlf); - - return TRUE; -} - -static void -mlf_class_init (CamelObjectClass *camel_object_class) -{ - CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS (camel_object_class); - - /* override all the functions subclassed in providers/local/ */ - - camel_folder_class->refresh_info = mlf_refresh_info; - camel_folder_class->sync = mlf_sync; - camel_folder_class->expunge = mlf_expunge; - camel_folder_class->append_message = mlf_append_message; - camel_folder_class->get_message = mlf_get_message; - camel_folder_class->search_free = mlf_search_free; - - camel_folder_class->search_by_expression = mlf_search_by_expression; - camel_folder_class->search_by_uids = mlf_search_by_uids; - camel_folder_class->set_message_flags = mlf_set_message_flags; - camel_folder_class->set_message_user_flag = mlf_set_message_user_flag; - camel_folder_class->set_message_user_tag = mlf_set_message_user_tag; - - camel_folder_class->rename = mlf_rename; -} - -static void -mlf_init (CamelObject *obj) -{ - MailLocalFolder *mlf = MAIL_LOCAL_FOLDER (obj); - -#ifdef ENABLE_THREADS - mlf->real_folder_lock = g_mutex_new(); -#endif -} - -static void -mlf_finalize (CamelObject *obj) -{ - MailLocalFolder *mlf = MAIL_LOCAL_FOLDER (obj); - - if (mlf->real_folder) - mlf_unset_folder(mlf); - - free_metainfo(mlf->meta); - -#ifdef ENABLE_THREADS - g_mutex_free (mlf->real_folder_lock); -#endif -} - -static CamelType -mail_local_folder_get_type (void) -{ - static CamelType mail_local_folder_type = CAMEL_INVALID_TYPE; - - if (mail_local_folder_type == CAMEL_INVALID_TYPE) { - mail_local_folder_type = camel_type_register(CAMEL_FOLDER_TYPE, - "MailLocalFolder", - sizeof (MailLocalFolder), - sizeof (MailLocalFolderClass), - mlf_class_init, - NULL, - mlf_init, - mlf_finalize); - mlf_parent_class = (CamelFolderClass *)camel_type_get_global_classfuncs (CAMEL_FOLDER_TYPE); - } - - return mail_local_folder_type; -} - -static MailLocalFolder * -mail_local_folder_construct(MailLocalFolder *mlf, MailLocalStore *parent_store, const char *full_name, CamelException *ex) -{ - const char *name; - char *metapath; - - name = strrchr(full_name, '/'); - if (name == NULL) - name = full_name; - name = name + 1; - - d(printf("constructing local folder: full = %s, name = %s\n", full_name, name)); - - camel_folder_construct(CAMEL_FOLDER (mlf), CAMEL_STORE(parent_store), full_name, name); - - mlf->real_path = g_strdup(((CamelFolder *)mlf)->full_name); - - metapath = g_strdup_printf("%s/%s/local-metadata.xml", ((CamelService *)parent_store)->url->path, full_name); - mlf->meta = load_metainfo(metapath); - g_free(metapath); - - return mlf; -} - -static gboolean -mail_local_folder_reconfigure (MailLocalFolder *mlf, const char *new_format, int index_body, CamelException *ex) -{ - CamelStore *fromstore = NULL; - CamelFolder *fromfolder = NULL; - char *oldformat = NULL; - char *store_uri; - GPtrArray *uids; - int real_folder_frozen = FALSE; - int format_change, index_changed; - char *tmpname = NULL; - char *mbox = NULL; - - format_change = strcmp(mlf->meta->format, new_format) != 0; - index_changed = mlf->meta->indexed != index_body; - - if (format_change == FALSE && index_changed == FALSE) - return TRUE; - - camel_operation_start(NULL, _("Reconfiguring folder")); - - /* first things first */ - g_assert (ex); - LOCAL_FOLDER_LOCK (mlf); - - /* first, 'close' the old folder */ - if (mlf->real_folder) { - camel_folder_sync(mlf->real_folder, FALSE, ex); - if (camel_exception_is_set (ex)) - goto cleanup; - mlf_unset_folder(mlf); - } - - /* only indexed change, just re-open with new flags */ - if (!format_change) { - mlf->meta->indexed = index_body; - mlf_set_folder(mlf, CAMEL_STORE_FOLDER_CREATE, ex); - save_metainfo(mlf->meta); - goto cleanup; - } - - store_uri = g_strdup_printf("%s:%s", mlf->meta->format, ((CamelService *)((CamelFolder *)mlf)->parent_store)->url->path); - fromstore = camel_session_get_store(session, store_uri, ex); - g_free(store_uri); - if (fromstore == NULL) - goto cleanup; - - oldformat = mlf->meta->format; - mlf->meta->format = g_strdup(new_format); - - /* rename the old mbox and open it again, without indexing */ - tmpname = g_strdup_printf ("%s/%s_reconfig", mlf->real_path, mlf->meta->name); - mbox = g_strdup_printf("%s/%s", mlf->real_path, mlf->meta->name); - d(printf("renaming %s to %s, and opening it\n", mbox, tmpname)); - - camel_store_rename_folder(fromstore, mbox, tmpname, ex); - if (camel_exception_is_set(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, ex); - if (fromfolder == NULL || camel_exception_is_set(ex)) { - /* try and recover ... */ - camel_exception_clear(ex); - camel_store_rename_folder(fromstore, tmpname, mbox, ex); - goto cleanup; - } - - /* create a new mbox */ - d(printf("Creating the destination mbox\n")); - - if (!mlf_set_folder(mlf, CAMEL_STORE_FOLDER_CREATE, ex)) { - d(printf("cannot open destination folder\n")); - /* try and recover ... */ - camel_exception_clear(ex); - camel_store_rename_folder(fromstore, tmpname, mbox, ex); - goto cleanup; - } - - real_folder_frozen = TRUE; - camel_folder_freeze(mlf->real_folder); - - uids = camel_folder_get_uids(fromfolder); - camel_folder_move_messages_to(fromfolder, uids, mlf->real_folder, ex); - camel_folder_free_uids(fromfolder, uids); - if (camel_exception_is_set(ex)) - goto cleanup; - - camel_folder_expunge(fromfolder, ex); - - d(printf("delete old mbox ...\n")); - camel_object_unref(CAMEL_OBJECT(fromfolder)); - fromfolder = NULL; - camel_store_delete_folder(fromstore, tmpname, ex); - - /* switch format */ - g_free(oldformat); - oldformat = NULL; - if (save_metainfo(mlf->meta) == FALSE) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Cannot save folder metainfo; " - "you'll probably find you can't\n" - "open this folder anymore: %s: %s"), - mlf->meta->path, strerror(errno)); - } - - cleanup: - if (oldformat) { - g_free(mlf->meta->format); - mlf->meta->format = oldformat; - } - if (mlf->real_folder == NULL) - mlf_set_folder (mlf, CAMEL_STORE_FOLDER_CREATE, ex); - if (fromfolder) - camel_object_unref((CamelObject *)fromfolder); - if (fromstore) - camel_object_unref((CamelObject *)fromstore); - - g_free(tmpname); - g_free(mbox); - - LOCAL_FOLDER_UNLOCK (mlf); - - if (real_folder_frozen) - camel_folder_thaw(mlf->real_folder); - - camel_operation_end(NULL); - - return !camel_exception_is_set(ex); -} - -/* ******************************************************************************** */ - -static CamelObjectClass *local_store_parent_class = NULL; - -static CamelFolder * -mls_get_folder(CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex) -{ - MailLocalStore *local_store = MAIL_LOCAL_STORE (store); - MailLocalFolder *folder; - - d(printf("--LOCAL-- get_folder: %s\n", folder_name)); - - folder = (MailLocalFolder *)camel_object_new(MAIL_LOCAL_FOLDER_TYPE); - folder = mail_local_folder_construct(folder, local_store, folder_name, ex); - if (folder == NULL) - return NULL; - - if (!mlf_set_folder(folder, flags, ex)) { - camel_object_unref(CAMEL_OBJECT(folder)); - return NULL; - } - - if (flags & CAMEL_STORE_FOLDER_CREATE) { - if (save_metainfo(folder->meta) == -1) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Cannot save folder metainfo to %s: %s"), - folder->meta->path, strerror(errno)); - camel_object_unref(CAMEL_OBJECT (folder)); - return NULL; - } - } - - return (CamelFolder *)folder; -} - -static void -mls_delete_folder(CamelStore *store, const char *folder_name, CamelException *ex) -{ - CamelStore *real_store; - char *metapath, *uri, *mbox; - CamelException local_ex; - struct _local_meta *meta; - - d(printf("Deleting folder: %s %s\n", ((CamelService *)store)->url->path, folder_name)); - - camel_exception_init(&local_ex); - - /* find the real store for this folder, and proxy the call */ - metapath = g_strdup_printf("%s%s/local-metadata.xml", ((CamelService *)store)->url->path, folder_name); - meta = load_metainfo(metapath); - uri = g_strdup_printf("%s:%s", meta->format, ((CamelService *)store)->url->path); - real_store = (CamelStore *)camel_session_get_service(session, uri, CAMEL_PROVIDER_STORE, ex); - g_free(uri); - if (real_store == NULL) { - g_free(metapath); - free_metainfo(meta); - camel_object_unref((CamelObject *)real_store); - return; - } - - mbox = g_strdup_printf("%s/%s", folder_name, meta->name); - camel_store_delete_folder(real_store, mbox, &local_ex); - g_free(mbox); - if (camel_exception_is_set(&local_ex)) { - camel_exception_xfer(ex, &local_ex); - g_free(metapath); - free_metainfo(meta); - camel_object_unref((CamelObject *)real_store); - return; - } - - camel_object_unref((CamelObject *)real_store); - - free_metainfo(meta); - - if (unlink(metapath) == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Cannot delete folder metadata %s: %s"), - metapath, strerror(errno)); - } - - g_free(metapath); -} - -static void -mls_rename_folder(CamelStore *store, const char *old_name, const char *new_name, CamelException *ex) -{ - CamelStore *real_store; - /*MailLocalStore *mls = (MailLocalStore *)store;*/ - char *uri; - /*CamelException local_ex;*/ - struct _local_meta *meta; - char *oldname, *newname; - char *oldmeta, *newmeta; - struct stat st; - - /* folder:rename() updates all our in-memory data to match */ - - /* FIXME: Need to lock the subfolder that matches this if its open - Then rename it and unlock it when done */ - - d(printf("Renaming folder from '%s' to '%s'\n", old_name, new_name)); - - oldmeta = g_strdup_printf("%s%s/local-metadata.xml", ((CamelService *)store)->url->path, old_name); - newmeta = g_strdup_printf("%s%s/local-metadata.xml", ((CamelService *)store)->url->path, new_name); - - meta = load_metainfo(oldmeta); - uri = g_strdup_printf("%s:%s", meta->format, ((CamelService *)store)->url->path); - real_store = (CamelStore *)camel_session_get_service(session, uri, CAMEL_PROVIDER_STORE, ex); - g_free(uri); - if (real_store == NULL) { - g_free(newmeta); - g_free(oldmeta); - free_metainfo(meta); - return; - } - - oldname = g_strdup_printf("%s/%s", old_name, meta->name); - newname = g_strdup_printf("%s/%s", new_name, meta->name); - - camel_store_rename_folder(real_store, oldname, newname, ex); - if (!camel_exception_is_set(ex)) { - /* If this fails? Well, doesn't really matter but 'fail' anyway */ - if (stat(oldmeta, &st) == 0 - && rename(oldmeta, newmeta) == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not rename folder %s to %s: %s"), - old_name, new_name, strerror(errno)); - } else { - /* So .. .the shell does a remove/add now the rename worked, so we dont - have to do this. However totally broken that idea might be */ -#if 0 - CamelFolderInfo *info; - const char *tmp; - char *olduri, *newuri; - - olduri = g_strdup_printf("%s:%s%s", ((CamelService *)store)->url->protocol, ((CamelService *)store)->url->path, old_name); - newuri = g_strdup_printf("%s:%s%s", ((CamelService *)store)->url->protocol, ((CamelService *)store)->url->path, new_name); - info = g_hash_table_lookup(mls->folder_infos, olduri); - if (info) { - CamelRenameInfo reninfo; - - g_free(info->url); - g_free(info->full_name); - g_free(info->name); - g_free(info->path); - info->url = newuri; - info->full_name = g_strdup(new_name); - info->path = g_strdup_printf("/%s", new_name); - tmp = strchr(new_name, '/'); - if (tmp == NULL) - tmp = new_name; - info->name = g_strdup(tmp); - g_hash_table_insert(mls->folder_infos, info->url, info); - - reninfo.new = info; - reninfo.old_base = (char *)old_name; - - camel_object_trigger_event((CamelObject *)store, "folder_renamed", &reninfo); - } else { - g_free(newuri); - g_warning("Cannot find existing folder '%s' in table?\n", olduri); - } - - g_free(olduri); -#endif - } - } - - g_free(newname); - g_free(oldname); - - camel_object_unref((CamelObject *)real_store); - - free_metainfo(meta); - - g_free(newmeta); - g_free(oldmeta); -} - -static char * -mls_get_name (CamelService *service, gboolean brief) -{ - if (brief) - return g_strdup("local"); - - return g_strdup("Local mail folders"); -} - -static void -mls_init (MailLocalStore *mls, MailLocalStoreClass *mlsclass) -{ - mls->folder_infos = g_hash_table_new(g_str_hash, g_str_equal); - mls->folder_info_lock = g_mutex_new(); -} - -static void -free_info(void *key, void *value, void *data) -{ - CamelFolderInfo *info = value; - - camel_folder_info_free (info); -} - -static void -mls_finalise(MailLocalStore *mls) -{ - g_hash_table_foreach(mls->folder_infos, (GHFunc)free_info, NULL); - g_hash_table_destroy(mls->folder_infos); - g_mutex_free(mls->folder_info_lock); -} - -static void -mls_class_init (CamelObjectClass *camel_object_class) -{ - CamelStoreClass *camel_store_class = CAMEL_STORE_CLASS(camel_object_class); - CamelServiceClass *camel_service_class = CAMEL_SERVICE_CLASS(camel_object_class); - - /* virtual method overload -- the bare minimum */ - camel_service_class->get_name = mls_get_name; - camel_store_class->get_folder = mls_get_folder; - camel_store_class->delete_folder = mls_delete_folder; - camel_store_class->rename_folder = mls_rename_folder; - - local_store_parent_class = camel_type_get_global_classfuncs (CAMEL_STORE_TYPE); -} - -static 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) mls_class_init, - NULL, - (CamelObjectInitFunc) mls_init, - (CamelObjectFinalizeFunc) mls_finalise); - } - - return mail_local_store_type; -} - -static void mail_local_store_add_folder(MailLocalStore *mls, const char *uri, const char *path, const char *name) -{ - CamelFolderInfo *info = NULL; - CamelURL *url; - - d(printf("Shell adding folder: '%s' path = '%s'\n", uri, path)); - - url = camel_url_new(uri, NULL); - if (url == NULL) { - g_warning("Shell trying to add invalid folder url: %s", uri); - return; - } - if (url->path == NULL || url->path[0] == 0) { - g_warning("Shell trying to add invalid folder url: %s", uri); - camel_url_free(url); - return; - } - - LOCAL_STORE_LOCK(mls); - - if (g_hash_table_lookup(mls->folder_infos, uri)) { - g_warning("Shell trying to add a folder I already have!"); - } else { - info = g_malloc0(sizeof(*info)); - info->url = g_strdup(uri); - info->full_name = g_strdup(url->path+1); - info->name = g_strdup(name); - info->unread_message_count = -1; - info->path = g_strdup (path); - g_hash_table_insert(mls->folder_infos, info->url, info); - } - - LOCAL_STORE_UNLOCK(mls); - - camel_url_free(url); - - if (info) { - /* FIXME: should copy info, so we dont get a removed while we're using it? */ - camel_object_trigger_event((CamelObject *)mls, "folder_created", info); - - /* this is just so the folder is opened at least once to setup the folder - counts etc in the display. Joy eh? The result is discarded. */ - mail_get_folder (uri, CAMEL_STORE_FOLDER_CREATE, NULL, NULL, mail_thread_queued_slow); - } -} - -struct _search_info { - const char *path; - CamelFolderInfo *info; -}; - -static void -remove_find_path(char *uri, CamelFolderInfo *info, struct _search_info *data) -{ - if (!strcmp(info->path, data->path)) - data->info = info; -} - -static void mail_local_store_remove_folder(MailLocalStore *mls, const char *path) -{ - struct _search_info data = { path, NULL }; - - d(printf("shell removing folder? '%s'\n", path)); - - /* we're keyed on uri, not path, so have to search for it manually */ - - LOCAL_STORE_LOCK(mls); - g_hash_table_foreach(mls->folder_infos, (GHFunc)remove_find_path, &data); - if (data.info) - g_hash_table_remove(mls->folder_infos, data.info->url); - LOCAL_STORE_UNLOCK(mls); - - if (data.info) { - camel_object_trigger_event((CamelObject *)mls, "folder_deleted", data.info); - - g_free(data.info->url); - g_free(data.info->full_name); - g_free(data.info->name); - g_free(data.info); - } -} - -/* ** Local Provider ************************************************************** */ - -static CamelProvider local_provider = { - "file", "Local mail", NULL, "mail", - CAMEL_PROVIDER_IS_STORAGE | CAMEL_PROVIDER_IS_EXTERNAL, - CAMEL_URL_NEED_PATH, - /* ... */ -}; - -/* There's only one "file:" store. */ -static guint -non_hash (gconstpointer key) -{ - return 0; -} - -static gint -non_equal (gconstpointer a, gconstpointer b) -{ - return TRUE; -} - -static void -mail_local_provider_init (void) -{ - /* Register with Camel to handle file: URLs */ - local_provider.object_types[CAMEL_PROVIDER_STORE] = MAIL_LOCAL_STORE_TYPE; - - local_provider.service_cache = g_hash_table_new (non_hash, non_equal); - local_provider.url_hash = non_hash; - local_provider.url_equal = non_equal; - camel_session_register_provider (session, &local_provider); -} - -/* ** Local Storage Listener ****************************************************** */ - -static void -local_storage_destroyed_cb (EvolutionStorageListener *storage_listener, - void *data) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - bonobo_object_release_unref (data, &ev); - CORBA_exception_free (&ev); -} - - -static void -local_storage_new_folder_cb (EvolutionStorageListener *storage_listener, - const char *path, - const GNOME_Evolution_Folder *folder, - void *data) -{ - d(printf("Local folder new:\n")); - d(printf(" path = '%s'\n uri = '%s'\n display = '%s'\n", - path, folder->physicalUri, folder->displayName)); - - /* We dont actually add the trash to our local folders list, get_trash is handled - outside our internal folder list */ - - if (strcmp(folder->type, "mail") == 0) { - mail_local_store_add_folder(global_local_store, folder->physicalUri, path, folder->displayName); - } else if (strcmp(folder->type, "vtrash") == 0) { - CamelFolderInfo info; - CamelURL *url; - - url = camel_url_new(folder->physicalUri, NULL); - if (url == NULL) { - g_warning("Shell trying to add invalid folder url: %s", folder->physicalUri); - return; - } - if (url->path == NULL || url->path[0] == 0) { - g_warning("Shell trying to add invalid folder url: %s", folder->physicalUri); - camel_url_free(url); - return; - } - - memset(&info, 0, sizeof(info)); - info.full_name = CAMEL_VTRASH_NAME; - info.name = folder->displayName; - info.url = g_strdup_printf("vtrash:%s", folder->physicalUri); - info.unread_message_count = 0; - info.path = (char *)path; - - camel_object_trigger_event((CamelObject *)global_local_store, "folder_created", &info); - g_free(info.url); - camel_url_free(url); - } -} - - -static void -local_storage_removed_folder_cb (EvolutionStorageListener *storage_listener, - const char *path, - void *data) -{ - d(printf("Local folder remove:\n")); - d(printf(" path = '%s'\n", path)); - - mail_local_store_remove_folder(global_local_store, path); -} - -static void -storage_listener_startup (EvolutionShellClient *shellclient) -{ - EvolutionStorageListener *local_storage_listener; - GNOME_Evolution_StorageListener corba_local_storage_listener; - GNOME_Evolution_Storage corba_storage; - CORBA_Environment ev; - - d(printf("---- CALLING STORAGE LISTENER STARTUP ---\n")); - - local_corba_storage = corba_storage = evolution_shell_client_get_local_storage (shellclient); - if (corba_storage == CORBA_OBJECT_NIL) { - g_warning ("No local storage available from shell client!"); - return; - } - - /* setup to record this store's changes */ - mail_note_store((CamelStore *)global_local_store, NULL, local_corba_storage, NULL, NULL); - - local_storage_listener = evolution_storage_listener_new (); - corba_local_storage_listener = evolution_storage_listener_corba_objref ( - local_storage_listener); - - gtk_signal_connect (GTK_OBJECT (local_storage_listener), - "destroyed", - GTK_SIGNAL_FUNC (local_storage_destroyed_cb), - corba_storage); - gtk_signal_connect (GTK_OBJECT (local_storage_listener), - "new_folder", - GTK_SIGNAL_FUNC (local_storage_new_folder_cb), - corba_storage); - gtk_signal_connect (GTK_OBJECT (local_storage_listener), - "removed_folder", - GTK_SIGNAL_FUNC (local_storage_removed_folder_cb), - corba_storage); - - CORBA_exception_init (&ev); - GNOME_Evolution_Storage_addListener (corba_storage, - corba_local_storage_listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Cannot add a listener to the Local Storage."); - CORBA_exception_free (&ev); - return; - } - CORBA_exception_free (&ev); -} - -/* ** The rest ******************************************************************** */ - -void -mail_local_storage_startup (EvolutionShellClient *shellclient, const char *evolution_path) -{ - mail_local_provider_init (); - - global_local_store = MAIL_LOCAL_STORE(camel_session_get_service (session, "file:/", CAMEL_PROVIDER_STORE, NULL)); - - if (!global_local_store) { - g_warning ("No local store!"); - return; - } - - storage_listener_startup (shellclient); -} - - -/*---------------------------------------------------------------------- - * 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 - -*/ - -/* we should have our own progress bar for this */ - -struct _reconfigure_msg { - struct _mail_msg msg; - - FolderBrowser *fb; - char *newtype; - unsigned int index_body:1; - GtkWidget *frame; - GtkWidget *apply; - GtkWidget *cancel; - GtkWidget *check_index_body; - GtkOptionMenu *optionlist; - CamelFolder *folder_out; -}; - -/* hash table of folders that the user has a reconfig-folder dialog for */ -static GHashTable *reconfigure_folder_hash = NULL; - -static char * -reconfigure_folder_describe (struct _mail_msg *mm, int done) -{ - struct _reconfigure_msg *m = (struct _reconfigure_msg *)mm; - - return g_strdup_printf (_("Changing folder \"%s\" to \"%s\" format"), - m->fb->uri, - m->newtype); -} - -static void -reconfigure_folder_reconfigure (struct _mail_msg *mm) -{ - struct _reconfigure_msg *m = (struct _reconfigure_msg *)mm; - CamelFolder *local_folder = NULL; - - d(printf("reconfiguring folder: %s to type %s\n", m->fb->uri, m->newtype)); - - if (strncmp (m->fb->uri, "file:", 5)) { - camel_exception_setv (&mm->ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, - _("%s may not be reconfigured because it is not a local folder"), - m->fb->uri); - return; - } - - local_folder = mail_tool_uri_to_folder (m->fb->uri, 0, &mm->ex); - if (camel_exception_is_set (&mm->ex)) { - g_warning ("Can't resolve URI \"%s\" for reconfiguration!", m->fb->uri); - return; - } - - mail_local_folder_reconfigure (MAIL_LOCAL_FOLDER (local_folder), m->newtype, m->index_body, &mm->ex); - m->folder_out = local_folder; -} - -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.")); - } - - message_list_set_folder (m->fb->message_list, m->folder_out, FALSE); -} - -static void -reconfigure_folder_free (struct _mail_msg *mm) -{ - struct _reconfigure_msg *m = (struct _reconfigure_msg *)mm; - - /* remove this folder from our hash since we are done with it */ - g_hash_table_remove (reconfigure_folder_hash, m->fb->folder); - if (g_hash_table_size (reconfigure_folder_hash) == 0) { - /* additional cleanup */ - g_hash_table_destroy (reconfigure_folder_hash); - reconfigure_folder_hash = NULL; - } - - if (m->folder_out) - camel_object_unref (CAMEL_OBJECT (m->folder_out)); - gtk_object_unref (GTK_OBJECT (m->fb)); - g_free (m->newtype); -} - -static struct _mail_msg_op reconfigure_folder_op = { - reconfigure_folder_describe, - reconfigure_folder_reconfigure, - reconfigure_folder_reconfigured, - reconfigure_folder_free, -}; - -static void -reconfigure_clicked (GnomeDialog *dialog, int button, struct _reconfigure_msg *m) -{ - if (button == 0) { - GtkWidget *menu, *item; - - /* hack to clear the message list during update */ - /* we need to do this because the message list caches - * CamelMessageInfos from the old folder. */ - message_list_set_folder(m->fb->message_list, NULL, FALSE); - - menu = gtk_option_menu_get_menu(m->optionlist); - item = gtk_menu_get_active(GTK_MENU(menu)); - m->newtype = g_strdup(gtk_object_get_data((GtkObject *)item, "type")); - m->index_body = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m->check_index_body)); - - gtk_widget_set_sensitive (m->frame, FALSE); - gtk_widget_set_sensitive (m->apply, FALSE); - gtk_widget_set_sensitive (m->cancel, FALSE); - - e_thread_put (mail_thread_queued, (EMsg *)m); - } else - mail_msg_free ((struct _mail_msg *)m); - - if (button != -1) - gnome_dialog_close (dialog); -} - -void -mail_local_reconfigure_folder (FolderBrowser *fb) -{ - GladeXML *gui; - GnomeDialog *gd; - struct _reconfigure_msg *m; - char *title; - GList *p; - GtkWidget *menu; - char *currentformat; - int index=0, history=0; - - if (fb->folder == NULL) { - g_warning ("Trying to reconfigure nonexistant folder"); - return; - } - - if (!reconfigure_folder_hash) - reconfigure_folder_hash = g_hash_table_new (NULL, NULL); - - if ((gd = g_hash_table_lookup (reconfigure_folder_hash, fb->folder))) { - gdk_window_raise (GTK_WIDGET (gd)->window); - return; - } - - /* check if we can work on this folder */ - if (!MAIL_IS_LOCAL_FOLDER (fb->folder)) { - e_notice (NULL, GNOME_MESSAGE_BOX_WARNING, - _("You cannot change the format of a non-local folder.")); - return; - } - - m = mail_msg_new (&reconfigure_folder_op, NULL, sizeof (*m)); - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/local-config.glade", "dialog_format"); - gd = (GnomeDialog *)glade_xml_get_widget (gui, "dialog_format"); - - title = g_strdup_printf (_("Reconfigure /%s"), - camel_folder_get_full_name (fb->folder)); - gtk_window_set_title (GTK_WINDOW (gd), title); - g_free (title); - - 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->check_index_body = glade_xml_get_widget (gui, "check_index_body"); - m->newtype = NULL; - m->fb = fb; - m->folder_out = NULL; - gtk_object_ref (GTK_OBJECT (fb)); - - /* dynamically create the folder type list from camel */ - /* we assume the list is static and never freed */ - currentformat = MAIL_LOCAL_FOLDER (fb->folder)->meta->format; - p = camel_session_list_providers(session, TRUE); - menu = gtk_menu_new(); - while (p) { - CamelProvider *cp = p->data; - - /* we only want local providers */ - if (cp->flags & CAMEL_PROVIDER_IS_LOCAL) { - GtkWidget *item; - char *label; - - if (strcmp(cp->protocol, currentformat) == 0) - history = index; - - label = g_strdup_printf("%s (%s)", cp->protocol, _(cp->name)); - item = gtk_menu_item_new_with_label(label); - g_free(label); - gtk_object_set_data((GtkObject *)item, "type", cp->protocol); - gtk_widget_show(item); - gtk_menu_append(GTK_MENU(menu), item); - index++; - } - p = p->next; - } - gtk_option_menu_remove_menu (GTK_OPTION_MENU(m->optionlist)); - gtk_option_menu_set_menu (GTK_OPTION_MENU(m->optionlist), menu); - gtk_option_menu_set_history(GTK_OPTION_MENU(m->optionlist), history); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m->check_index_body), MAIL_LOCAL_FOLDER (fb->folder)->meta->indexed); - - gtk_label_set_text ((GtkLabel *)glade_xml_get_widget (gui, "label_format"), - MAIL_LOCAL_FOLDER (fb->folder)->meta->format); - - gtk_signal_connect (GTK_OBJECT (gd), "clicked", reconfigure_clicked, m); - gtk_object_unref (GTK_OBJECT (gui)); - - g_hash_table_insert (reconfigure_folder_hash, (gpointer) fb->folder, (gpointer) gd); - - gnome_dialog_run (GNOME_DIALOG (gd)); -} diff --git a/mail/mail-local.h b/mail/mail-local.h deleted file mode 100644 index d1e4f3791d..0000000000 --- a/mail/mail-local.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* mail-local.h: Local mailbox support. */ - -/* - * Authors: - * Michael Zucchi <NotZed@ximian.com> - * Dan Winship <danw@ximian.com> - * - * Copyright 2000 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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-mt.c b/mail/mail-mt.c deleted file mode 100644 index c047d49c0a..0000000000 --- a/mail/mail-mt.c +++ /dev/null @@ -1,1011 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> -#include <unistd.h> -#include <pthread.h> -#include <errno.h> - -#include <glib.h> - -#include <gtk/gtkentry.h> -#include <gtk/gtkmain.h> -#include <gtk/gtkwidget.h> -#include <gtk/gtkcheckbutton.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-dialog-util.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-stock.h> -#include <gal/widgets/e-gui-utils.h> -#include <gal/widgets/e-unicode.h> - -#include "folder-browser-factory.h" -#include "e-util/e-msgport.h" -#include "camel/camel-operation.h" - -#include "evolution-activity-client.h" - -#include "mail-config.h" -#include "camel/camel-url.h" -#include "mail-mt.h" - -#include "component-factory.h" - -/*#define MALLOC_CHECK*/ -#define LOG_OPS -#define LOG_LOCKS -#define d(x) - -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); - -#ifdef LOG_LOCKS -#define MAIL_MT_LOCK(x) (log_locks?fprintf(log, "%ld: lock " # x "\n", pthread_self()):0, pthread_mutex_lock(&x)) -#define MAIL_MT_UNLOCK(x) (log_locks?fprintf(log, "%ld: unlock " # x "\n", pthread_self()): 0, pthread_mutex_unlock(&x)) -#else -#define MAIL_MT_LOCK(x) pthread_mutex_lock(&x) -#define MAIL_MT_UNLOCK(x) pthread_mutex_unlock(&x) -#endif -extern EvolutionShellClient *global_shell_client; - -/* background operation status stuff */ -struct _mail_msg_priv { - int activity_state; /* sigh sigh sigh, we need to keep track of the state external to the - pointer itself for locking/race conditions */ - EvolutionActivityClient *activity; -}; - -/* This is used for the mail status bar, cheap and easy */ -#include "art/mail-new.xpm" - -static GdkPixbuf *progress_icon[2] = { NULL, NULL }; - -/* mail_msg stuff */ -#ifdef LOG_OPS -static FILE *log; -static int log_ops, log_locks, log_init; -#endif - -static unsigned int mail_msg_seq; /* sequence number of each message */ -static GHashTable *mail_msg_active_table; /* 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; - -MailAsyncEvent *mail_async_event; - -static void mail_msg_destroy(EThread *e, EMsg *msg, void *data); - -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); - -#if defined(LOG_OPS) || defined(LOG_LOCKS) - if (!log_init) { - time_t now = time(0); - - log_init = TRUE; - log_ops = getenv("EVOLUTION_MAIL_LOG_OPS") != NULL; - log_locks = getenv("EVOLUTION_MAIL_LOG_LOCKS") != NULL; - if (log_ops || log_locks) { - log = fopen("evolution-mail-ops.log", "w+"); - if (log) { - setvbuf(log, NULL, _IOLBF, 0); - fprintf(log, "Started evolution-mail: %s\n", ctime(&now)); - g_warning("Logging mail operations to evolution-mail-ops.log"); - - if (log_ops) - fprintf(log, "Logging async operations\n"); - - if (log_locks) { - fprintf(log, "Logging lock operations, mail_gui_thread = %ld\n\n", mail_gui_thread); - fprintf(log, "%ld: lock mail_msg_lock\n", pthread_self()); - } - } else { - g_warning ("Could not open log file: %s", strerror(errno)); - log_ops = log_locks = FALSE; - } - } - } -#endif - 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_table, (void *)msg->seq, msg); - - d(printf("New message %p\n", msg)); - -#ifdef LOG_OPS - if (log_ops) - fprintf(log, "%p: New\n", msg); -#endif - MAIL_MT_UNLOCK(mail_msg_lock); - - return msg; -} - -/* either destroy the progress (in event_data), or the whole dialogue (in data) */ -static void destroy_objects(CamelObject *o, void *event_data, void *data) -{ - if (event_data) - gtk_object_unref(event_data); -} - -#ifdef MALLOC_CHECK -#include <mcheck.h> - -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; - void *activity = NULL; - -#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); - -#ifdef LOG_OPS - if (log_ops) - fprintf(log, "%p: Free (exception `%s')\n", msg, - camel_exception_get_description(&m->ex)?camel_exception_get_description(&m->ex):"None"); -#endif - g_hash_table_remove(mail_msg_active_table, (void *)m->seq); - pthread_cond_broadcast(&mail_msg_cond); - - /* We need to make sure we dont lose a reference here YUCK YUCK */ - /* This is tightly integrated with the code in do_op_status, - as it closely relates to the CamelOperation setup in msg_new() above */ - if (m->priv->activity_state == 1) { - m->priv->activity_state = 3; /* tell the other thread - * to free it itself (yuck yuck) */ - MAIL_MT_UNLOCK(mail_msg_lock); - return; - } else { - activity = m->priv->activity; - } - - MAIL_MT_UNLOCK(mail_msg_lock); - - if (m->cancel) - camel_operation_unref(m->cancel); - - camel_exception_clear(&m->ex); - /*g_free(m->priv->what);*/ - g_free(m->priv); - g_free(m); - - if (activity) - mail_async_event_emit(mail_async_event, MAIL_ASYNC_GUI, (MailAsyncFunc)destroy_objects, NULL, activity, NULL); -} - -/* hash table of ops->dialogue of active errors */ -static GHashTable *active_errors = NULL; - -static void error_gone(GtkObject *o, void *data) -{ - g_hash_table_remove(active_errors, data); -} - -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 (active_errors == NULL) - active_errors = g_hash_table_new(NULL, NULL); - - 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)); - g_free (what); - } else - text = g_strdup_printf(_("Error while performing operation:\n%s"), camel_exception_get_description(&m->ex)); - - /* check to see if we have dialogue already running for this operation */ - /* we key on the operation pointer, which is at least accurate enough - for the operation type, although it could be on a different object. */ - if (g_hash_table_lookup(active_errors, m->ops)) { - g_warning("Error occured while existing dialogue active:\n%s", text); - g_free(text); - return; - } - - gd = (GnomeDialog *)gnome_error_dialog(text); - g_hash_table_insert(active_errors, m->ops, gd); - g_free(text); - gtk_signal_connect((GtkObject *)gd, "destroy", error_gone, m->ops); - gnome_dialog_set_close(gd, TRUE); - gtk_widget_show((GtkWidget *)gd); -} - -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_table, (void *)msgid); - - if (m && m->cancel) - 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_table, (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_table, (void *)msgid); - } - MAIL_MT_UNLOCK(mail_msg_lock); - } else { - MAIL_MT_LOCK(mail_msg_lock); - m = g_hash_table_lookup(mail_msg_active_table, (void *)msgid); - while (m) { - pthread_cond_wait(&mail_msg_cond, &mail_msg_lock); - m = g_hash_table_lookup(mail_msg_active_table, (void *)msgid); - } - MAIL_MT_UNLOCK(mail_msg_lock); - } -} - -int mail_msg_active(unsigned int msgid) -{ - int active; - - MAIL_MT_LOCK(mail_msg_lock); - if (msgid == (unsigned int)-1) - active = g_hash_table_size(mail_msg_active_table) > 0; - else - active = g_hash_table_lookup(mail_msg_active_table, (void *)msgid) != NULL; - MAIL_MT_UNLOCK(mail_msg_lock); - - return active; -} - -void mail_msg_wait_all(void) -{ - int ismain = pthread_self() == mail_gui_thread; - - if (ismain) { - MAIL_MT_LOCK(mail_msg_lock); - while (g_hash_table_size(mail_msg_active_table) > 0) { - MAIL_MT_UNLOCK(mail_msg_lock); - gtk_main_iteration(); - MAIL_MT_LOCK(mail_msg_lock); - } - MAIL_MT_UNLOCK(mail_msg_lock); - } else { - MAIL_MT_LOCK(mail_msg_lock); - while (g_hash_table_size(mail_msg_active_table) > 0) { - pthread_cond_wait(&mail_msg_cond, &mail_msg_lock); - } - MAIL_MT_UNLOCK(mail_msg_lock); - } -} - -EMsgPort *mail_gui_port; -static GIOChannel *mail_gui_channel; -static guint mail_gui_watch; - -/* TODO: Merge these, gui_port2 doesn't do any mail_msg processing on the request (replies, forwards, frees) */ -EMsgPort *mail_gui_port2; -static GIOChannel *mail_gui_channel2; -static guint mail_gui_watch2; - -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_queued_slow; /* for operations that can (or should) be queued, but take a long time */ -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 - -#ifdef LOG_OPS - if (log_ops) - fprintf(log, "%p: Replied to GUI thread (exception `%s'\n", m, - camel_exception_get_description(&m->ex)?camel_exception_get_description(&m->ex):"None"); -#endif - - if (m->ops->reply_msg) - m->ops->reply_msg(m); - mail_msg_check_error(m); - 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 - -#ifdef LOG_OPS - if (log_ops) - fprintf(log, "%p: Received at GUI thread\n", m); -#endif - - 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); - mail_msg_free(m); - } - } - - return TRUE; -} - -/* Test code, lighterwight, more configurable calls */ -static gboolean -mail_msgport_received2(GIOChannel *source, GIOCondition cond, void *d) -{ - EMsgPort *port = (EMsgPort *)d; - mail_msg_t *m; - - while (( m = (mail_msg_t *)e_msgport_get(port))) { -#ifdef LOG_OPS - if (log_ops) - fprintf(log, "%p: Received at GUI2 thread\n", m); -#endif - - if (m->ops->receive_msg) - m->ops->receive_msg(m); - else - 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 - - 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); - -#ifdef LOG_OPS - if (log_ops) - fprintf(log, "%p: Received at thread %ld: '%s'\n", m, pthread_self(), text); -#endif - - d(printf("message received at thread\n")); - camel_operation_register(m->cancel); - camel_operation_start(m->cancel, "%s", text); - g_free(text); - } -#ifdef LOG_OPS - else - if (log_ops) - fprintf(log, "%p: Received at thread %ld\n", m, pthread_self()); -#endif - - if (m->ops->receive_msg) { - mail_enable_stop(); - m->ops->receive_msg(m); - mail_disable_stop(); - } - - if (m->ops->describe_msg) { - camel_operation_end(m->cancel); - camel_operation_unregister(m->cancel); - MAIL_MT_LOCK(mail_msg_lock); - camel_operation_unref(m->cancel); - m->cancel = NULL; - MAIL_MT_UNLOCK(mail_msg_lock); - } -} - -void mail_msg_cleanup(void) -{ - mail_msg_wait_all(); - - e_thread_destroy(mail_thread_queued_slow); - e_thread_destroy(mail_thread_queued); - e_thread_destroy(mail_thread_new); - - g_io_channel_unref(mail_gui_channel); - g_io_channel_unref(mail_gui_reply_channel); - - e_msgport_destroy(mail_gui_port); - e_msgport_destroy(mail_gui_reply_port); -} - -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)); - mail_gui_watch = g_io_add_watch(mail_gui_channel, G_IO_IN, mail_msgport_received, mail_gui_port); - - /* experimental temporary */ - mail_gui_port2 = e_msgport_new(); - mail_gui_channel2 = g_io_channel_unix_new(e_msgport_fd(mail_gui_port2)); - mail_gui_watch2 = g_io_add_watch(mail_gui_channel2, G_IO_IN, mail_msgport_received2, mail_gui_port2); - - - 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_queued_slow = e_thread_new(E_THREAD_QUEUE); - e_thread_set_msg_destroy(mail_thread_queued_slow, mail_msg_destroy, 0); - e_thread_set_msg_received(mail_thread_queued_slow, mail_msg_received, 0); - e_thread_set_reply_port(mail_thread_queued_slow, 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); - e_thread_set_queue_limit(mail_thread_new, 10); - - mail_msg_active_table = g_hash_table_new(NULL, NULL); - mail_gui_thread = pthread_self(); - - mail_async_event = mail_async_event_new(); -} - -/* ********************************************************************** */ - -/* locks */ -static pthread_mutex_t status_lock = PTHREAD_MUTEX_INITIALIZER; - -/* ********************************************************************** */ - -struct _proxy_msg { - struct _mail_msg msg; - MailAsyncEvent *ea; - mail_async_event_t type; - - pthread_t thread; - - MailAsyncFunc func; - void *o; - void *event_data; - void *data; -}; - -static void -do_async_event(struct _mail_msg *mm) -{ - struct _proxy_msg *m = (struct _proxy_msg *)mm; - - m->thread = pthread_self(); - m->func(m->o, m->event_data, m->data); - m->thread = ~0; - - g_mutex_lock(m->ea->lock); - m->ea->tasks = g_slist_remove(m->ea->tasks, m); - g_mutex_unlock(m->ea->lock); -} - -static int -idle_async_event(void *mm) -{ - do_async_event(mm); - mail_msg_free(mm); - - return FALSE; -} - -struct _mail_msg_op async_event_op = { - NULL, - do_async_event, - NULL, - NULL, -}; - -MailAsyncEvent *mail_async_event_new(void) -{ - MailAsyncEvent *ea; - - ea = g_malloc0(sizeof(*ea)); - ea->lock = g_mutex_new(); - - return ea; -} - -int mail_async_event_emit(MailAsyncEvent *ea, mail_async_event_t type, MailAsyncFunc func, void *o, void *event_data, void *data) -{ - struct _proxy_msg *m; - int id; - int ismain = pthread_self() == mail_gui_thread; - - /* we dont have a reply port for this, we dont care when/if it gets executed, just queue it */ - m = mail_msg_new(&async_event_op, NULL, sizeof(*m)); - m->func = func; - m->o = o; - m->event_data = event_data; - m->data = data; - m->ea = ea; - m->type = type; - m->thread = ~0; - - id = m->msg.seq; - g_mutex_lock(ea->lock); - ea->tasks = g_slist_prepend(ea->tasks, m); - g_mutex_unlock(ea->lock); - - /* We use an idle function instead of our own message port only because the - gui message ports's notification buffer might overflow and deadlock us */ - if (type == MAIL_ASYNC_GUI) { - if (ismain) - g_idle_add(idle_async_event, m); - else - e_msgport_put(mail_gui_port, (EMsg *)m); - } else - e_thread_put(mail_thread_queued, (EMsg *)m); - - return id; -} - -int mail_async_event_destroy(MailAsyncEvent *ea) -{ - int id; - pthread_t thread = pthread_self(); - struct _proxy_msg *m; - - g_mutex_lock(ea->lock); - while (ea->tasks) { - m = ea->tasks->data; - id = m->msg.seq; - if (m->thread == thread) { - g_warning("Destroying async event from inside an event, returning EDEADLK"); - g_mutex_unlock(ea->lock); - errno = EDEADLK; - return -1; - } - g_mutex_unlock(ea->lock); - mail_msg_wait(id); - g_mutex_lock(ea->lock); - } - g_mutex_unlock(ea->lock); - - g_mutex_free(ea->lock); - g_free(ea); - - return 0; -} - -/* ********************************************************************** */ - -struct _call_msg { - struct _mail_msg msg; - mail_call_t type; - MailMainFunc func; - void *ret; - va_list ap; -}; - -static void -do_call(struct _mail_msg *mm) -{ - struct _call_msg *m = (struct _call_msg *)mm; - void *p1, *p2, *p3, *p4, *p5; - int i1; - va_list ap; - - G_VA_COPY(ap, m->ap); - - switch(m->type) { - case MAIL_CALL_p_p: - p1 = va_arg(ap, void *); - m->ret = m->func(p1); - break; - case MAIL_CALL_p_pp: - p1 = va_arg(ap, void *); - p2 = va_arg(ap, void *); - m->ret = m->func(p1, p2); - break; - case MAIL_CALL_p_ppp: - p1 = va_arg(ap, void *); - p2 = va_arg(ap, void *); - p3 = va_arg(ap, void *); - m->ret = m->func(p1, p2, p3); - break; - case MAIL_CALL_p_pppp: - p1 = va_arg(ap, void *); - p2 = va_arg(ap, void *); - p3 = va_arg(ap, void *); - p4 = va_arg(ap, void *); - m->ret = m->func(p1, p2, p3, p4); - break; - case MAIL_CALL_p_ppippp: - p1 = va_arg(ap, void *); - p2 = va_arg(ap, void *); - i1 = va_arg(ap, int); - p3 = va_arg(ap, void *); - p4 = va_arg(ap, void *); - p5 = va_arg(ap, void *); - m->ret = m->func(p1, p2, i1, p3, p4, p5); - break; - } -} - -struct _mail_msg_op mail_call_op = { - NULL, - do_call, - NULL, - NULL, -}; - -void *mail_call_main(mail_call_t type, MailMainFunc func, ...) -{ - struct _call_msg *m; - void *ret; - va_list ap; - EMsgPort *reply = NULL; - int ismain = pthread_self() == mail_gui_thread; - - va_start(ap, func); - - if (!ismain) - reply = e_msgport_new(); - - m = mail_msg_new(&mail_call_op, reply, sizeof(*m)); - m->type = type; - m->func = func; - G_VA_COPY(m->ap, ap); - - if (!ismain) { - e_msgport_put(mail_gui_port, (EMsg *)m); - e_msgport_wait(reply); - e_msgport_destroy(reply); - } else { - do_call(&m->msg); - } - - va_end(ap); - - ret = m->ret; - mail_msg_free(m); - - return ret; -} - -/* ********************************************************************** */ -/* locked via status_lock */ -static int busy_state; - -static void do_set_busy(struct _mail_msg *mm) -{ - if (global_shell_client) - 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 && global_shell_client) { - 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 && global_shell_client) { - 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; -}; - -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; - int pc; - EvolutionActivityClient *activity; - - g_assert (mail_gui_thread == pthread_self ()); - - MAIL_MT_LOCK (mail_msg_lock); - - msg = g_hash_table_lookup (mail_msg_active_table, m->data); - - /* shortcut processing, i.e. if we have no global_shell_client and no activity, we can't create one */ - if (msg == NULL || (msg->priv->activity == NULL && global_shell_client == 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; - - pc = m->pc; - - /* so whats all this crap about: - * When we call activity_client, we have a chance of coming - * back to code that will call mail_msg_new or one of many - * calls which may deadlock us. So we need to call corba - * outside of the lock. The activity_state thing is so we can - * properly lock data->activity without having to hold a lock - * ... of course we have to be careful in the free function to - * keep track of it too. - */ - if (data->activity == NULL && global_shell_client) { - char *what; - int display; - - /* its being created/removed? well leave it be */ - if (data->activity_state == 1 || data->activity_state == 3) { - MAIL_MT_UNLOCK (mail_msg_lock); - return; - } else { - data->activity_state = 1; - - if (progress_icon[0] == NULL) - progress_icon[0] = gdk_pixbuf_new_from_xpm_data ((const char **)mail_new_xpm); - - MAIL_MT_UNLOCK (mail_msg_lock); - if (msg->ops->describe_msg) - what = msg->ops->describe_msg (msg, FALSE); - else - what = _("Working"); - - if (global_shell_client) { - activity = evolution_activity_client_new (global_shell_client, - COMPONENT_ID, - progress_icon, what, TRUE, - &display); - } else { - activity = NULL; - } - - if (msg->ops->describe_msg) - g_free (what); - - MAIL_MT_LOCK (mail_msg_lock); - if (data->activity_state == 3) { - MAIL_MT_UNLOCK (mail_msg_lock); - if (activity) - gtk_object_unref (GTK_OBJECT (activity)); - if (msg->cancel) - camel_operation_unref (msg->cancel); - camel_exception_clear (&msg->ex); - g_free (msg->priv); - g_free (msg); - } else { - data->activity_state = 2; - data->activity = activity; - MAIL_MT_UNLOCK (mail_msg_lock); - } - return; - } - } else if (data->activity) { - activity = data->activity; - gtk_object_ref (GTK_OBJECT (activity)); - MAIL_MT_UNLOCK (mail_msg_lock); - - evolution_activity_client_update (activity, out, (double)(pc/100.0)); - gtk_object_unref (GTK_OBJECT (activity)); - } else { - 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)); - - if (global_shell_client == NULL) - return; - - 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); -} - -/* ******************** */ - -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 cb1adc6a7a..0000000000 --- a/mail/mail-mt.h +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Authors: Michael Zucchi <notzed@ximian.com> - * - * Copyright 2000, Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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_MT -#define _MAIL_MT - -#include <pthread.h> -#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); -void mail_msg_cleanup (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); -void mail_msg_wait_all(void); -int mail_msg_active(unsigned int msgid); - -/* request a string/password */ -char *mail_get_password (CamelService *service, const char *prompt, - gboolean secret, gboolean *cache); - -/* present information and get an ok (or possibly cancel) - * "type" is as for gnome_message_box_new(); - */ -gboolean mail_user_message (const char *type, const char *prompt, gboolean allow_cancel); - -/* asynchronous event proxies */ -typedef struct _MailAsyncEvent { - GMutex *lock; - GSList *tasks; -} MailAsyncEvent; - -typedef enum _mail_async_event_t { - MAIL_ASYNC_GUI, - MAIL_ASYNC_THREAD, -} mail_async_event_t; - -typedef void (*MailAsyncFunc)(void *, void *, void *); - -/* create a new async event handler */ -MailAsyncEvent *mail_async_event_new(void); -/* forward a camel event (or other call) to the gui thread */ -int mail_async_event_emit(MailAsyncEvent *ea, mail_async_event_t type, MailAsyncFunc func, void *, void *, void *); -/* wait for all outstanding async events to complete */ -int mail_async_event_destroy(MailAsyncEvent *ea); - -/* Call a function in the gui thread, wait for it to return, type is the marshaller to use */ -typedef enum { - MAIL_CALL_p_p, - MAIL_CALL_p_pp, - MAIL_CALL_p_ppp, - MAIL_CALL_p_pppp, - MAIL_CALL_p_ppippp, -} mail_call_t; - -typedef void *(*MailMainFunc)(); - -void *mail_call_main(mail_call_t type, MailMainFunc func, ...); - -/* 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 */ -extern EThread *mail_thread_queued_slow; /* for operations that can (or should) be queued, but take a long time */ - -/* The main thread. */ -extern pthread_t mail_gui_thread; - -/* A generic proxy event for anything that can be proxied during the life of the mailer (almost nothing) */ -/* Note that almost all objects care about the lifecycle of their events, so this cannot be used */ -extern MailAsyncEvent *mail_async_event; - -#endif /* ! _MAIL_MT */ diff --git a/mail/mail-offline-handler.c b/mail/mail-offline-handler.c deleted file mode 100644 index 5217420570..0000000000 --- a/mail/mail-offline-handler.c +++ /dev/null @@ -1,255 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* mail-offline-handler.c - * - * Copyright (C) 2001 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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. - * - * Authors: - * Ettore Perazzoli <ettore@ximian.com> - * Dan Winship <danw@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "mail-offline-handler.h" -#include "mail.h" -#include "mail-ops.h" - -#include <gtk/gtkmain.h> - -#include <gal/util/e-util.h> - -#define PARENT_TYPE bonobo_x_object_get_type () -static BonoboXObjectClass *parent_class = NULL; - -struct _MailOfflineHandlerPrivate { - GNOME_Evolution_OfflineProgressListener listener_interface; -}; - -static gboolean -service_is_relevant (CamelService *service, gboolean going_offline) -{ - if (!(service->provider->flags & CAMEL_PROVIDER_IS_REMOTE) || - (service->provider->flags & CAMEL_PROVIDER_IS_EXTERNAL)) - return FALSE; - - if (CAMEL_IS_DISCO_STORE (service) && going_offline && - camel_disco_store_status (CAMEL_DISCO_STORE (service)) == CAMEL_DISCO_STORE_OFFLINE) - return FALSE; - - return service->status != CAMEL_SERVICE_DISCONNECTED; -} - -static void -add_connection (gpointer key, gpointer data, gpointer user_data) -{ - CamelService *service = key; - GNOME_Evolution_ConnectionList *list = user_data; - - if (!service_is_relevant (service, TRUE)) - return; - - list->_buffer[list->_length].hostName = CORBA_string_dup (service->url->host); - list->_buffer[list->_length].type = CORBA_string_dup (service->provider->name); - list->_length++; -} - -static GNOME_Evolution_ConnectionList * -create_connection_list (void) -{ - GNOME_Evolution_ConnectionList *list; - - list = GNOME_Evolution_ConnectionList__alloc (); - list->_length = 0; - list->_maximum = mail_storages_count (); - list->_buffer = CORBA_sequence_GNOME_Evolution_Connection_allocbuf (list->_maximum); - - mail_storages_foreach (add_connection, list); - - return list; -} - -/* GNOME::Evolution::Offline methods. */ - -static CORBA_boolean -impl__get_isOffline (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - return !camel_session_is_online (session); -} - -static void -impl_prepareForOffline (PortableServer_Servant servant, - GNOME_Evolution_ConnectionList **active_connection_list, - CORBA_Environment *ev) -{ - MailOfflineHandler *offline_handler; - MailOfflineHandlerPrivate *priv; - - offline_handler = MAIL_OFFLINE_HANDLER (bonobo_object_from_servant (servant)); - priv = offline_handler->priv; - - *active_connection_list = create_connection_list (); -} - -static void -went_offline (CamelStore *store, void *data) -{ - MailOfflineHandler *offline_handler = data; - MailOfflineHandlerPrivate *priv; - CORBA_Environment ev; - GNOME_Evolution_ConnectionList *connection_list; - - priv = offline_handler->priv; - - connection_list = create_connection_list (); - - CORBA_exception_init (&ev); - - GNOME_Evolution_OfflineProgressListener_updateProgress (priv->listener_interface, connection_list, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_warning ("Error updating offline progress"); - - CORBA_exception_free (&ev); - - /* CORBA_free (connection_list); */ -} - -static void -storage_go_offline (gpointer key, gpointer value, gpointer data) -{ - CamelStore *store = key; - MailOfflineHandler *offline_handler = data; - - if (service_is_relevant (CAMEL_SERVICE (store), TRUE)) - mail_store_set_offline (store, TRUE, went_offline, offline_handler); -} - -static void -impl_goOffline (PortableServer_Servant servant, - const GNOME_Evolution_OfflineProgressListener progress_listener, - CORBA_Environment *ev) -{ - MailOfflineHandler *offline_handler; - MailOfflineHandlerPrivate *priv; - - offline_handler = MAIL_OFFLINE_HANDLER (bonobo_object_from_servant (servant)); - priv = offline_handler->priv; - - priv->listener_interface = CORBA_Object_duplicate (progress_listener, ev); - - /* This will disable further auto-mail-check action. */ - camel_session_set_online (session, FALSE); - - /* FIXME: If send/receive active, wait for it to finish */ - - mail_storages_foreach (storage_go_offline, offline_handler); -} - -static void -storage_go_online (gpointer key, gpointer value, gpointer data) -{ - CamelStore *store = key; - - if (service_is_relevant (CAMEL_SERVICE (store), FALSE)) - mail_store_set_offline (store, FALSE, NULL, NULL); -} - -static void -impl_goOnline (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - MailOfflineHandler *offline_handler; - MailOfflineHandlerPrivate *priv; - - offline_handler = MAIL_OFFLINE_HANDLER (bonobo_object_from_servant (servant)); - priv = offline_handler->priv; - - /* Enable auto-mail-checking */ - camel_session_set_online (session, TRUE); - - mail_storages_foreach (storage_go_online, NULL); -} - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - MailOfflineHandler *offline_handler; - MailOfflineHandlerPrivate *priv; - - offline_handler = MAIL_OFFLINE_HANDLER (object); - priv = offline_handler->priv; - - if (priv->listener_interface != CORBA_OBJECT_NIL) { - CORBA_Environment ev; - - CORBA_exception_init (&ev); - CORBA_Object_release (priv->listener_interface, &ev); - CORBA_exception_free (&ev); - } - - g_free (priv); - - if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -/* GTK+ type initialization. */ - -static void -mail_offline_handler_class_init (MailOfflineHandlerClass *klass) -{ - GtkObjectClass *object_class; - POA_GNOME_Evolution_Offline__epv *epv; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = impl_destroy; - - epv = & klass->epv; - epv->_get_isOffline = impl__get_isOffline; - epv->prepareForOffline = impl_prepareForOffline; - epv->goOffline = impl_goOffline; - epv->goOnline = impl_goOnline; - - parent_class = gtk_type_class (PARENT_TYPE); -} - -static void -mail_offline_handler_init (MailOfflineHandler *offline_handler) -{ - MailOfflineHandlerPrivate *priv; - - priv = g_new (MailOfflineHandlerPrivate, 1); - priv->listener_interface = CORBA_OBJECT_NIL; - - offline_handler->priv = priv; -} - -MailOfflineHandler * -mail_offline_handler_new (void) -{ - MailOfflineHandler *new; - - new = gtk_type_new (mail_offline_handler_get_type ()); - - return new; -} - -BONOBO_X_TYPE_FUNC_FULL (MailOfflineHandler, GNOME_Evolution_Offline, PARENT_TYPE, mail_offline_handler); diff --git a/mail/mail-offline-handler.h b/mail/mail-offline-handler.h deleted file mode 100644 index b053b715e7..0000000000 --- a/mail/mail-offline-handler.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* mail-offline-handler.h - * - * Copyright (C) 2001 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <ettore@ximian.com> - */ - -#ifndef _MAIL_OFFLINE_HANDLER_H_ -#define _MAIL_OFFLINE_HANDLER_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo/bonobo-xobject.h> -#include "Evolution.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define MAIL_TYPE_OFFLINE_HANDLER (mail_offline_handler_get_type ()) -#define MAIL_OFFLINE_HANDLER(obj) (GTK_CHECK_CAST ((obj), MAIL_TYPE_OFFLINE_HANDLER, MailOfflineHandler)) -#define MAIL_OFFLINE_HANDLER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), MAIL_TYPE_OFFLINE_HANDLER, MailOfflineHandlerClass)) -#define MAIL_IS_OFFLINE_HANDLER(obj) (GTK_CHECK_TYPE ((obj), MAIL_TYPE_OFFLINE_HANDLER)) -#define MAIL_IS_OFFLINE_HANDLER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), MAIL_TYPE_OFFLINE_HANDLER)) - - -typedef struct _MailOfflineHandler MailOfflineHandler; -typedef struct _MailOfflineHandlerPrivate MailOfflineHandlerPrivate; -typedef struct _MailOfflineHandlerClass MailOfflineHandlerClass; - -struct _MailOfflineHandler { - BonoboXObject parent; - - MailOfflineHandlerPrivate *priv; -}; - -struct _MailOfflineHandlerClass { - BonoboXObjectClass parent_class; - - POA_GNOME_Evolution_Offline__epv epv; -}; - - -GtkType mail_offline_handler_get_type (void); -MailOfflineHandler *mail_offline_handler_new (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _MAIL_OFFLINE_HANDLER_H_ */ diff --git a/mail/mail-ops.c b/mail/mail-ops.c deleted file mode 100644 index 54bc2dbbf8..0000000000 --- a/mail/mail-ops.c +++ /dev/null @@ -1,2175 +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 <danw@ximian.com> - * Jeffrey Stedfast <fejj@ximian.com> - * Peter Williams <peterw@ximian.com> - * Michael Zucchi <notzed@ximian.com> - * - * Copyright 2000,2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -/* #include <ctype.h> */ -#include <errno.h> -#include <gal/util/e-util.h> -#include <gal/widgets/e-unicode.h> -#include <gal/util/e-unicode-i18n.h> -#include <camel/camel-mime-filter-from.h> -#include <camel/camel-operation.h> -#include <camel/camel-vtrash-folder.h> -#include <camel/camel-vee-store.h> -#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" -#include "mail-folder-cache.h" - -#define w(x) -#define d(x) - -/* 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 */ - CamelUIDCache *cache; /* UID cache if we are to cache the uids, NULL otherwise */ - 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; -}; - -static char * -filter_folder_describe (struct _mail_msg *mm, int complete) -{ - return g_strdup (_("Filtering Folder")); -} - -/* 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, m->cache, uids, m->delete, &mm->ex); - - if (folder_uids) - camel_folder_free_uids (folder, folder_uids); - - /* sync and expunge */ - if (!m->cache) - camel_folder_sync (folder, TRUE, camel_exception_is_set (&mm->ex) ? NULL : &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 (CAMEL_OBJECT (m->source_folder)); - - if (m->source_uids) { - for (i = 0; i < m->source_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 (CAMEL_OBJECT (m->destination)); - - if (m->driver) - camel_object_unref (CAMEL_OBJECT (m->driver)); -} - -static struct _mail_msg_op filter_folder_op = { - filter_folder_describe, /* we do our own progress reporting? */ - filter_folder_filter, - filter_folder_filtered, - filter_folder_free, -}; - -void -mail_filter_folder (CamelFolder *source_folder, GPtrArray *uids, - 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 (CAMEL_OBJECT (source_folder)); - m->source_uids = uids; - m->cache = NULL; - m->delete = FALSE; - if (cancel) { - m->cancel = cancel; - camel_operation_ref (cancel); - } - - m->driver = camel_session_get_filter_driver (session, type, NULL); - - e_thread_put (mail_thread_new, (EMsg *)m); -} - -/* convenience function for it */ -void -mail_filter_on_demand (CamelFolder *folder, GPtrArray *uids) -{ - mail_filter_folder (folder, uids, FILTER_SOURCE_INCOMING, NULL); -} - -/* ********************************************************************** */ - -/* Temporary workaround for various issues. Gone before 0.11 */ -static char * -uid_cachename_hack (CamelStore *store) -{ - CamelURL *url = CAMEL_SERVICE (store)->url; - char *encoded_url, *filename, *old_location; - struct stat st; - - encoded_url = g_strdup_printf ("pop://%s%s%s@%s/", url->user, - url->authmech ? ";auth=" : "", - url->authmech ? url->authmech : "", - url->host); - e_filename_make_safe (encoded_url); - - filename = g_strdup_printf ("%s/mail/pop3/cache-%s", evolution_dir, encoded_url); - - /* lame hack, but we can't expect user's to actually migrate - their cache files - brain power requirements are too - high. */ - if (stat (filename, &st) == -1) { - /* This is either the first time the user has checked - mail with this POP provider or else their cache - file is in the old location... */ - old_location = g_strdup_printf ("%s/config/cache-%s", evolution_dir, encoded_url); - if (stat (old_location, &st) == -1) { - /* old location doesn't exist either so use the new location */ - g_free (old_location); - } else { - /* old location exists, so I guess we use the old cache file location */ - g_free (filename); - filename = old_location; - } - } - - g_free (encoded_url); - - return filename; -} - -static char * -fetch_mail_describe (struct _mail_msg *mm, int complete) -{ - return g_strdup (_("Fetching Mail")); -} - -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, m->source_uri, &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 = uid_cachename_hack (folder->parent_store); - 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); - - fm->cache = cache; - filter_folder_filter (mm); - - /* if we are not to delete the messages or there was an - * exception, save the UID cache */ - if (!fm->delete || camel_exception_is_set (&mm->ex)) - camel_uid_cache_save (cache); - - /* if we are deleting off the server and no exception occured - * then iterate through the folder uids and mark them all - * for deletion. */ - if (fm->delete && !camel_exception_is_set (&mm->ex)) { - camel_folder_freeze (folder); - - for (i = 0; i < folder_uids->len; i++) - camel_folder_delete_message (folder, folder_uids->pdata[i]); - - /* sync and expunge */ - camel_folder_sync (folder, TRUE, &mm->ex); - - camel_folder_thaw (folder); - } - } - camel_uid_cache_destroy (cache); - camel_folder_free_uids (folder, folder_uids); - } else { - filter_folder_filter (mm); - } - - /* we unref the source folder here since we - may now block in finalize (we try to - disconnect cleanly) */ - camel_object_unref (CAMEL_OBJECT (fm->source_folder)); - fm->source_folder = NULL; - } - } - - 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 (CAMEL_OBJECT (fm->driver)); - fm->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 = { - fetch_mail_describe, /* 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, 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; - fm->cache = NULL; - if (cancel) { - m->cancel = cancel; - camel_operation_ref (cancel); - } - m->done = done; - m->data = data; - - fm->driver = camel_session_get_filter_driver (session, type, NULL); - camel_filter_driver_set_folder_func (fm->driver, get_folder, get_data); - if (status) - camel_filter_driver_set_status_func (fm->driver, status, status_data); - - e_thread_put (mail_thread_new, (EMsg *)m); -} - -/* ********************************************************************** */ -/* sending stuff */ -/* ** SEND MAIL *********************************************************** */ - -extern CamelFolder *sent_folder; - -/* send 1 message to a specific transport */ -static void -mail_send_message (CamelMimeMessage *message, const char *destination, - CamelFilterDriver *driver, CamelException *ex) -{ - CamelMessageInfo *info; - CamelTransport *xport = NULL; - char *transport_url = NULL; - char *sent_folder_uri = NULL; - CamelFolder *folder; - const char *version; - XEvolution *xev; - - 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); - - xev = mail_tool_remove_xevolution_headers (message); - - if (xev->transport) { - transport_url = g_strstrip (g_strdup (xev->transport)); - } else if (xev->account) { - const MailConfigAccount *account; - char *name; - - name = g_strstrip (g_strdup (xev->account)); - account = mail_config_get_account_by_name (name); - g_free (name); - - if (account && account->transport && account->transport->url) - transport_url = g_strdup (account->transport->url); - } - - if (xev->fcc) - sent_folder_uri = g_strstrip (g_strdup (xev->fcc)); - - xport = camel_session_get_transport (session, transport_url ? transport_url : destination, ex); - g_free (transport_url); - if (!xport) { - mail_tool_restore_xevolution_headers (message, xev); - mail_tool_destroy_xevolution (xev); - g_free (sent_folder_uri); - return; - } - - camel_transport_send (xport, CAMEL_MEDIUM (message), ex); - - mail_tool_restore_xevolution_headers (message, xev); - mail_tool_destroy_xevolution (xev); - - camel_object_unref (CAMEL_OBJECT (xport)); - if (camel_exception_is_set (ex)) { - g_free (sent_folder_uri); - 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, NULL, "", ex); - - if (camel_exception_is_set (ex)) { - ExceptionId id; - - id = camel_exception_get_id (ex); - camel_exception_setv (ex, id, "%s\n%s", camel_exception_get_description (ex), - _("However, the message was successfully sent.")); - - camel_message_info_free (info); - g_free (sent_folder_uri); - - return; - } - } - - if (sent_folder_uri) { - folder = mail_tool_uri_to_folder (sent_folder_uri, 0, NULL); - g_free (sent_folder_uri); - if (!folder) { - /* FIXME */ - camel_object_ref (CAMEL_OBJECT (sent_folder)); - folder = sent_folder; - } - } else { - camel_object_ref (CAMEL_OBJECT (sent_folder)); - folder = sent_folder; - } - - if (folder) { - camel_folder_append_message (folder, message, info, ex); - if (camel_exception_is_set (ex)) { - ExceptionId id; - - id = camel_exception_get_id (ex); - camel_exception_setv (ex, id, "%s\n%s", camel_exception_get_description (ex), - _("However, the message was successfully sent.")); - } - - camel_folder_sync (folder, FALSE, NULL); - camel_object_unref (CAMEL_OBJECT (folder)); - } - - 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; - char *subject; - const char *subject_utf8; - - subject_utf8 = camel_mime_message_get_subject (m->message); - - if (subject_utf8) { - char *desc; - - subject = e_utf8_to_locale_string (subject_utf8); - desc = g_strdup_printf (_("Sending \"%s\""), subject); - g_free (subject); - return desc; - } 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; - - mail_send_message (m->message, m->destination, m->driver, &mm->ex); -} - -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 (CAMEL_OBJECT (m->driver)); - camel_object_unref (CAMEL_OBJECT (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; - - m = mail_msg_new (&send_mail_op, NULL, sizeof (*m)); - m->destination = g_strdup (uri); - m->message = message; - camel_object_ref (CAMEL_OBJECT (message)); - m->data = data; - m->done = done; - - id = m->msg.seq; - - m->driver = camel_session_get_filter_driver (session, FILTER_SOURCE_OUTGOING, NULL); - - 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); - va_end (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; - extern CamelFolder *sent_folder; /* FIXME */ - GPtrArray *uids; - int i; - - d(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; i < uids->len; i++) { - CamelMimeMessage *message; - CamelMessageInfo *info; - int pc = (100 * i) / uids->len; - - report_status (m, CAMEL_FILTER_STATUS_START, pc, _("Sending message %d of %d"), i+1, uids->len); - - info = camel_folder_get_message_info (m->queue, uids->pdata[i]); - if (info && info->flags & CAMEL_MESSAGE_DELETED) - continue; - - message = camel_folder_get_message (m->queue, uids->pdata[i], &mm->ex); - if (camel_exception_is_set (&mm->ex)) - break; - - 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.")); - - if (m->driver) { - camel_object_unref((CamelObject *)m->driver); - m->driver = NULL; - } - - 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, NULL); - - 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; - - if (m->driver) - camel_object_unref((CamelObject *)m->driver); - 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, - 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_session_get_filter_driver (session, type, NULL); - camel_filter_driver_set_folder_func (m->driver, get_folder, get_data); - - 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_assert(CAMEL_IS_FOLDER (folder)); - g_assert(CAMEL_IS_MIME_MESSAGE (message)); - - m = mail_msg_new (&append_mail_op, NULL, sizeof (*m)); - m->folder = folder; - camel_object_ref (CAMEL_OBJECT (folder)); - m->message = message; - camel_object_ref (CAMEL_OBJECT (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; - guint32 dest_flags; - - void (*done)(gboolean ok, void *data); - void *data; -}; - -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; - char *desc; - void (*func) (CamelFolder *, GPtrArray *, - CamelFolder *, - CamelException *); - - dest = mail_tool_uri_to_folder (m->dest_uri, m->dest_flags, &mm->ex); - if (camel_exception_is_set (&mm->ex)) - return; - - if (dest == m->source) { - camel_object_unref((CamelObject *)dest); - /* no-op */ - return; - } - - if (m->delete) { - func = camel_folder_move_messages_to; - desc = _("Moving"); - } else { - func = camel_folder_copy_messages_to; - desc = _("Copying"); - } - - camel_folder_freeze (m->source); - camel_folder_freeze (dest); - - if (CAMEL_IS_VTRASH_FOLDER (dest)) { - if (m->delete) { - int i; - - /* Just mark all the messages as deleted */ - for (i = 0; i < m->uids->len; i++) - camel_folder_delete_message (m->source, m->uids->pdata[i]); - } else { - /* no-op - can't copy messages to*/ - } - } else { - if (dest == m->source) { - int i; - - /* Undelete the messages if they are marked as deleted */ - for (i = 0; i < m->uids->len; i++) - camel_folder_set_message_flags (m->source, m->uids->pdata[i], - CAMEL_MESSAGE_DELETED, 0); - } else { - (func) (m->source, m->uids, dest, &mm->ex); - } - } - - camel_folder_thaw (m->source); - camel_folder_thaw (dest); - camel_folder_sync (dest, FALSE, NULL); - camel_object_unref (CAMEL_OBJECT (dest)); -} - -static void -transfer_messages_transferred (struct _mail_msg *mm) -{ - struct _transfer_msg *m = (struct _transfer_msg *)mm; - - if (m->done) - m->done (!camel_exception_is_set (&mm->ex), m->data); -} - -static void -transfer_messages_free (struct _mail_msg *mm) -{ - struct _transfer_msg *m = (struct _transfer_msg *)mm; - int i; - - camel_object_unref (CAMEL_OBJECT (m->source)); - g_free (m->dest_uri); - for (i = 0; i < m->uids->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, - transfer_messages_transferred, - transfer_messages_free, -}; - -void -mail_transfer_messages (CamelFolder *source, GPtrArray *uids, - gboolean delete_from_source, - const char *dest_uri, - guint32 dest_flags, - void (*done) (gboolean ok, void *data), - void *data) -{ - struct _transfer_msg *m; - - g_assert(CAMEL_IS_FOLDER (source)); - g_assert(uids != NULL); - g_assert(dest_uri != NULL); - - m = mail_msg_new(&transfer_messages_op, NULL, sizeof(*m)); - m->source = source; - camel_object_ref (CAMEL_OBJECT (source)); - m->uids = uids; - m->delete = delete_from_source; - m->dest_uri = g_strdup (dest_uri); - m->dest_flags = dest_flags; - m->done = done; - m->data = data; - - 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 (CamelStore *store, CamelFolderInfo *info) -{ - CamelFolderInfo *fi, *vtrash, *parent; - char *uri, *path; - CamelURL *url; - - g_return_if_fail (info != NULL); - - parent = NULL; - for (fi = info; fi; fi = fi->sibling) { - if (!strcmp (fi->name, CAMEL_VTRASH_NAME)) - break; - parent = fi; - } - - /* create our vTrash URL */ - url = camel_url_new (info->url, NULL); - path = g_strdup_printf ("/%s", CAMEL_VTRASH_NAME); - if (url->fragment) - camel_url_set_fragment (url, path); - else - camel_url_set_path (url, path); - g_free (path); - uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); - camel_url_free (url); - - if (fi) { - /* We're going to replace the physical Trash folder with our vTrash folder */ - vtrash = fi; - g_free (vtrash->full_name); - g_free (vtrash->name); - g_free (vtrash->url); - } else { - /* There wasn't a Trash folder so create a new folder entry */ - vtrash = g_new0 (CamelFolderInfo, 1); - - g_assert(parent != NULL); - - /* link it into the right spot */ - vtrash->sibling = parent->sibling; - parent->sibling = vtrash; - } - - /* Fill in the new fields */ - vtrash->full_name = g_strdup (U_("Trash")); - vtrash->name = g_strdup(vtrash->full_name); - vtrash->url = g_strdup_printf ("vtrash:%s", uri); - vtrash->unread_message_count = -1; - vtrash->path = g_strdup_printf("/%s", vtrash->name); - g_free (uri); -} - -static void -add_unmatched_info(CamelFolderInfo *fi) -{ - for (; fi; fi = fi->sibling) { - if (!strcmp(fi->full_name, CAMEL_UNMATCHED_NAME)) { - g_free(fi->name); - fi->name = g_strdup(U_("Unmatched")); - g_free(fi->path); - fi->path = g_strdup_printf("/%s", fi->name); - break; - } - } -} - -static void -get_folderinfo_get (struct _mail_msg *mm) -{ - struct _get_folderinfo_msg *m = (struct _get_folderinfo_msg *)mm; - guint32 flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE; - - if (camel_store_supports_subscriptions (m->store)) - flags |= CAMEL_STORE_FOLDER_INFO_SUBSCRIBED; - - m->info = camel_store_get_folder_info (m->store, NULL, flags, &mm->ex); - if (m->info) { - if (m->info->url && (m->store->flags & CAMEL_STORE_VTRASH)) - add_vtrash_info(m->store, m->info); - if (CAMEL_IS_VEE_STORE(m->store)) - add_unmatched_info(m->info); - } -} - -static void -get_folderinfo_got (struct _mail_msg *mm) -{ - struct _get_folderinfo_msg *m = (struct _get_folderinfo_msg *)mm; - - if (camel_exception_is_set (&mm->ex)) { - char *url; - - url = camel_service_get_url (CAMEL_SERVICE (m->store)); - w(g_warning ("Error getting folder info from store at %s: %s", - url, camel_exception_get_description (&mm->ex))); - g_free (url); - } - - /* 'done' is probably guaranteed to fail, but... */ - - 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_queued, (EMsg *)m); - - return 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;i<messages->len;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; - guint32 flags; - 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; - - m->folder = mail_tool_uri_to_folder (m->uri, m->flags, &mm->ex); -} - -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 (CAMEL_OBJECT (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, guint32 flags, - void (*done)(char *uri, CamelFolder *folder, void *data), - void *data, EThread *thread) -{ - struct _get_folder_msg *m; - int id; - - m = mail_msg_new(&get_folder_op, NULL, sizeof(*m)); - m->uri = g_strdup (uri); - m->flags = flags; - m->data = data; - m->done = done; - - id = m->msg.seq; - e_thread_put(thread, (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; - - m->store = camel_session_get_store (session, m->uri, &mm->ex); -} - -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 (CAMEL_OBJECT (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; -} - -/* ** REMOVE FOLDER ******************************************************* */ - -struct _remove_folder_msg { - struct _mail_msg msg; - - char *uri; - gboolean removed; - void (*done) (char *uri, gboolean removed, void *data); - void *data; -}; - -static char * -remove_folder_desc (struct _mail_msg *mm, int done) -{ - struct _remove_folder_msg *m = (struct _remove_folder_msg *)mm; - - return g_strdup_printf (_("Removing folder %s"), m->uri); -} - -static void -remove_folder_get (struct _mail_msg *mm) -{ - struct _remove_folder_msg *m = (struct _remove_folder_msg *)mm; - CamelStore *store; - CamelFolder *folder; - GPtrArray *uids; - int i; - - m->removed = FALSE; - - folder = mail_tool_uri_to_folder (m->uri, 0, &mm->ex); - if (!folder) - return; - - store = folder->parent_store; - - /* Delete every message in this folder, then expunge it */ - uids = camel_folder_get_uids (folder); - camel_folder_freeze(folder); - for (i = 0; i < uids->len; i++) - camel_folder_delete_message (folder, uids->pdata[i]); - camel_folder_sync (folder, TRUE, NULL); - camel_folder_thaw(folder); - camel_folder_free_uids (folder, uids); - - /* if the store supports subscriptions, unsubscribe from this folder... */ - if (camel_store_supports_subscriptions (store)) - camel_store_unsubscribe_folder (store, folder->full_name, NULL); - - /* Then delete the folder from the store */ - camel_store_delete_folder (store, folder->full_name, &mm->ex); - m->removed = !camel_exception_is_set (&mm->ex); - camel_object_unref (CAMEL_OBJECT (folder)); -} - -static void -remove_folder_got (struct _mail_msg *mm) -{ - struct _remove_folder_msg *m = (struct _remove_folder_msg *)mm; - - if (m->removed) { - /* FIXME: Remove this folder from the folder cache ??? */ - } - - if (m->done) - m->done (m->uri, m->removed, m->data); -} - -static void -remove_folder_free (struct _mail_msg *mm) -{ - struct _remove_folder_msg *m = (struct _remove_folder_msg *)mm; - - g_free (m->uri); -} - -static struct _mail_msg_op remove_folder_op = { - remove_folder_desc, - remove_folder_get, - remove_folder_got, - remove_folder_free, -}; - -void -mail_remove_folder (const char *uri, void (*done) (char *uri, gboolean removed, void *data), void *data) -{ - struct _remove_folder_msg *m; - - m = mail_msg_new (&remove_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) -{ - struct _sync_folder_msg *m = (struct _sync_folder_msg *)mm; - - return g_strdup_printf (_("Storing folder \'%s\'"), - camel_folder_get_full_name (m->folder)); -} - -static void sync_folder_sync(struct _mail_msg *mm) -{ - struct _sync_folder_msg *m = (struct _sync_folder_msg *)mm; - - camel_folder_sync(m->folder, FALSE, &mm->ex); -} - -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_queued, (EMsg *)m); -} - -/* ******************************************************************************** */ - -static char *refresh_folder_desc(struct _mail_msg *mm, int done) -{ - return g_strdup(_("Refreshing folder")); -} - -static void refresh_folder_refresh(struct _mail_msg *mm) -{ - struct _sync_folder_msg *m = (struct _sync_folder_msg *)mm; - - camel_folder_refresh_info(m->folder, &mm->ex); -} - -/* we just use the sync stuff where we can, since it would be the same */ -static struct _mail_msg_op refresh_folder_op = { - refresh_folder_desc, - refresh_folder_refresh, - sync_folder_synced, - sync_folder_free, -}; - -void -mail_refresh_folder(CamelFolder *folder, void (*done) (CamelFolder *folder, void *data), void *data) -{ - struct _sync_folder_msg *m; - - m = mail_msg_new(&refresh_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_queued, (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; - - m->message = camel_folder_get_message(m->folder, m->uid, &mm->ex); -} - -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) -{ - struct _get_messages_msg *m = (struct _get_messages_msg *)mm; - - return g_strdup_printf(_("Retrieving %d message(s)"), m->uids->len); -} - -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; i<m->uids->len; i++) { - int pc = ((i+1) * 100) / m->uids->len; - - message = camel_folder_get_message(m->folder, m->uids->pdata[i], &mm->ex); - camel_operation_progress(mm->cancel, pc); - 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;i<m->uids->len;i++) - g_free(m->uids->pdata[i]); - g_ptr_array_free(m->uids, TRUE); - for (i=0;i<m->messages->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) -{ - struct _save_messages_msg *m = (struct _save_messages_msg *)mm; - - return g_strdup_printf(_("Saving %d messsage(s)"), m->uids->len); -} - -/* 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_prepare_part (CamelMimePart *mime_part) -{ - CamelDataWrapper *wrapper; - int parts, i; - - wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part)); - if (!wrapper) - return; - - if (CAMEL_IS_MULTIPART (wrapper)) { - parts = camel_multipart_get_number (CAMEL_MULTIPART (wrapper)); - for (i = 0; i < parts; i++) { - CamelMimePart *part = camel_multipart_get_part (CAMEL_MULTIPART (wrapper), i); - - save_prepare_part (part); - } - } else { - if (CAMEL_IS_MIME_MESSAGE (wrapper)) { - /* prepare the message parts' subparts */ - save_prepare_part (CAMEL_MIME_PART (wrapper)); - } else { - CamelContentType *type; - - /* We want to save textual parts as 8bit instead of encoded */ - type = camel_data_wrapper_get_mime_type_field (wrapper); - if (header_content_type_is (type, "text", "*")) - camel_mime_part_set_encoding (mime_part, CAMEL_MIME_PART_ENCODING_8BIT); - } - } -} - -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; i<m->uids->len; i++) { - CamelMimeMessage *message; - int pc = ((i+1) * 100) / m->uids->len; - - message = camel_folder_get_message(m->folder, m->uids->pdata[i], &mm->ex); - camel_operation_progress(mm->cancel, pc); - if (message == NULL) - break; - - save_prepare_part (CAMEL_MIME_PART (message)); - - /* 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;i<m->uids->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 | O_TRUNC, 0600); - if (stream_fs == NULL) { - camel_exception_setv (&mm->ex, 1, _("Cannot create output file: %s:\n %s"), m->path, - g_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 (CAMEL_MEDIUM (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")) - && g_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); - if (charsetfilter) { - 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"), g_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 (CAMEL_OBJECT (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 (CAMEL_OBJECT (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; -} - - -/* ** GO OFFLINE ***************************************************** */ - -struct _set_offline_msg { - struct _mail_msg msg; - - CamelStore *store; - gboolean offline; - void (*done)(CamelStore *store, void *data); - void *data; -}; - -static char *set_offline_desc(struct _mail_msg *mm, int done) -{ - struct _set_offline_msg *m = (struct _set_offline_msg *)mm; - char *service_name = camel_service_get_name (CAMEL_SERVICE (m->store), TRUE); - char *msg; - - msg = g_strdup_printf (m->offline ? _("Disconnecting from %s") : - _("Reconnecting to %s"), service_name); - g_free (service_name); - return msg; -} - -static void set_offline_do(struct _mail_msg *mm) -{ - struct _set_offline_msg *m = (struct _set_offline_msg *)mm; - - if (!CAMEL_IS_DISCO_STORE (m->store) || - !camel_disco_store_can_work_offline (CAMEL_DISCO_STORE (m->store))) { - if (m->offline) { - camel_service_disconnect (CAMEL_SERVICE (m->store), - TRUE, &mm->ex); - } - return; - } - - if (m->offline && camel_disco_store_status (CAMEL_DISCO_STORE (m->store)) == CAMEL_DISCO_STORE_ONLINE) { - CamelFolder *inbox; - - /* FIXME. Something more generic here... (bug 10755) */ - inbox = camel_store_get_inbox (m->store, NULL); - if (inbox) { - camel_disco_folder_prepare_for_offline ( - CAMEL_DISCO_FOLDER (inbox), - "(match-all (not (system-flag \"Seen\")))", - &mm->ex); - camel_folder_sync (inbox, FALSE, NULL); - camel_object_unref (CAMEL_OBJECT (inbox)); - if (camel_exception_is_set (&mm->ex)) - return; - } - } - - camel_disco_store_set_status (CAMEL_DISCO_STORE (m->store), - m->offline ? CAMEL_DISCO_STORE_OFFLINE : - CAMEL_DISCO_STORE_ONLINE, &mm->ex); -} - -static void set_offline_done(struct _mail_msg *mm) -{ - struct _set_offline_msg *m = (struct _set_offline_msg *)mm; - - if (m->done) - m->done(m->store, m->data); -} - -static void set_offline_free(struct _mail_msg *mm) -{ - struct _set_offline_msg *m = (struct _set_offline_msg *)mm; - - camel_object_unref((CamelObject *)m->store); -} - -static struct _mail_msg_op set_offline_op = { - set_offline_desc, - set_offline_do, - set_offline_done, - set_offline_free, -}; - -void -mail_store_set_offline (CamelStore *store, gboolean offline, - void (*done)(CamelStore *, void *data), - void *data) -{ - struct _set_offline_msg *m; - - /* Cancel any pending connect first so the set_offline_op - * thread won't get queued behind a hung connect op. - */ - if (offline) - camel_service_cancel_connect (CAMEL_SERVICE (store)); - - m = mail_msg_new(&set_offline_op, NULL, sizeof(*m)); - m->store = store; - camel_object_ref((CamelObject *)store); - m->offline = offline; - m->data = data; - m->done = done; - - e_thread_put(mail_thread_queued, (EMsg *)m); -} diff --git a/mail/mail-ops.h b/mail/mail-ops.h deleted file mode 100644 index b71ff4e09b..0000000000 --- a/mail/mail-ops.h +++ /dev/null @@ -1,157 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Authors: - * Peter Williams <peterw@ximian.com> - * Michael Zucchi <notzed@ximian.com> - * - * Copyright 2000, 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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_OPS_H -#define MAIL_OPS_H - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#include "camel/camel-folder.h" -#include "camel/camel-filter-driver.h" -#include "camel/camel-mime-message.h" -#include "camel/camel-operation.h" - -#include "evolution-storage.h" /*EvolutionStorage */ -#include "e-util/e-msgport.h" - -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_transfer_messages (CamelFolder *source, GPtrArray *uids, - gboolean delete_from_source, - const char *dest_uri, - guint32 dest_flags, - void (*done) (gboolean ok, void *data), - void *data); - -/* 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, guint32 flags, - void (*done) (char *uri, CamelFolder *folder, void *data), void *data, - EThread *thread); - -/* 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_refresh_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); - -/* remove an existing folder */ -void mail_remove_folder (const char *uri, - void (*done) (char *uri, gboolean removed, void *data), - void *data); - -/* transfer (copy/move) a folder */ -void mail_xfer_folder (const char *src_uri, const char *dest_uri, gboolean remove_source, - void (*done) (char *src_uri, char *dest_uri, gboolean remove_source, - 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, - 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, - 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, - const char *type, CamelOperation *cancel); - -/* convenience function for above */ -void mail_filter_on_demand (CamelFolder *folder, GPtrArray *uids); - -/* Work Offline */ -void mail_store_set_offline (CamelStore *store, gboolean offline, - void (*done)(CamelStore *, void *data), - void *data); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* MAIL_OPS_H */ diff --git a/mail/mail-search-dialogue.c b/mail/mail-search-dialogue.c deleted file mode 100644 index 352f4f08a1..0000000000 --- a/mail/mail-search-dialogue.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (C) 2000, 2001 Ximian, Inc. - * - * Authors: Not Zed <notzed@lostzed.mmc.com.au> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include <glib.h> -#include <gtk/gtkentry.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-stock.h> - -#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 1f18542671..0000000000 --- a/mail/mail-search-dialogue.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2000 Ximian Inc. - * - * Authors: Not Zed <notzed@lostzed.mmc.com.au> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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_SEARCH_DIALOGUE_H -#define _MAIL_SEARCH_DIALOGUE_H - -#include <gtk/gtkwidget.h> -#include <libgnomeui/gnome-dialog.h> - -#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-search.c b/mail/mail-search.c deleted file mode 100644 index 4611ece6d2..0000000000 --- a/mail/mail-search.c +++ /dev/null @@ -1,421 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * mail-search.c - * - * Copyright (C) 2001 Ximian, Inc. - * - * Developed by Jon Trowbridge <trow@ximian.com> - */ - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include "mail-search.h" -#include "e-searching-tokenizer.h" -#include <gal/widgets/e-unicode.h> -#include <gtkhtml/gtkhtml-search.h> -#include <gtkhtml/htmlengine.h> -#include <libgnomeui/gnome-window-icon.h> - -static GtkObjectClass *parent_class; - -static void -mail_search_destroy (GtkObject *obj) -{ - MailSearch *ms = MAIL_SEARCH (obj); - - gtk_signal_disconnect (GTK_OBJECT (ms->mail->html->engine->ht), - ms->match_handler); - gtk_signal_disconnect (GTK_OBJECT (ms->mail->html->engine->ht), - ms->begin_handler); - - g_free (ms->last_search); - gtk_object_unref (GTK_OBJECT (ms->mail)); -} - -static void -mail_search_class_init (MailSearchClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - parent_class = GTK_OBJECT_CLASS (gtk_type_class (gnome_dialog_get_type ())); - - object_class->destroy = mail_search_destroy; -} - -static void -mail_search_init (MailSearch *ms) -{ - -} - -GtkType -mail_search_get_type (void) -{ - static GtkType mail_search_type = 0; - - if (! mail_search_type) { - GtkTypeInfo mail_search_info = { - "MailSearch", - sizeof (MailSearch), - sizeof (MailSearchClass), - (GtkClassInitFunc) mail_search_class_init, - (GtkObjectInitFunc) mail_search_init, - NULL, NULL, /* mysteriously reserved */ - (GtkClassInitFunc) NULL - }; - - mail_search_type = gtk_type_unique (gnome_dialog_get_type (), &mail_search_info); - } - - return mail_search_type; -} - -/* - * Convenience - */ - -static ESearchingTokenizer * -mail_search_tokenizer (MailSearch *ms) -{ - return E_SEARCHING_TOKENIZER (ms->mail->html->engine->ht); -} - -static void -mail_search_redisplay_message (MailSearch *ms) -{ - mail_display_redisplay (ms->mail, FALSE); -} - -static void -mail_search_set_subject (MailSearch *ms, const gchar *subject) -{ - gchar *utf8_subject = NULL; - gchar *gtk_subject = NULL; - - if (subject && *subject) { - - utf8_subject = g_strdup (subject); - - if (g_utf8_validate (utf8_subject, -1, NULL)) { - - const gint ARBITRARY_CUTOFF = 40; - - if (g_utf8_strlen (utf8_subject, -1) > ARBITRARY_CUTOFF) { - gchar *p = g_utf8_offset_to_pointer (utf8_subject, ARBITRARY_CUTOFF); - strcpy (p, "..."); - } - - } else { - /* If the subject contains bad utf8, don't show anything in the frame label. */ - g_free (utf8_subject); - utf8_subject = NULL; - } - - if (utf8_subject) - gtk_subject = e_utf8_to_gtk_string (GTK_WIDGET (ms->msg_frame), utf8_subject); - - } else { - - gtk_subject = g_strdup (_("(Untitled Message)")); - - } - - gtk_frame_set_label (GTK_FRAME (ms->msg_frame), gtk_subject); - - g_free (gtk_subject); - g_free (utf8_subject); -} - -/* - * Construct Objects - */ - -static void -toggled_case_cb (GtkToggleButton *b, MailSearch *ms) -{ - ms->case_sensitive = gtk_toggle_button_get_active (b); - - e_searching_tokenizer_set_primary_case_sensitivity (mail_search_tokenizer (ms), - ms->case_sensitive); - mail_search_redisplay_message (ms); - -} - -#if 0 -static void -toggled_fwd_cb (GtkToggleButton *b, MailSearch *ms) -{ - ms->search_forward = gtk_toggle_button_get_active (b); - gtk_html_engine_search_set_forward (ms->mail->html, ms->search_forward); -} -#endif - -static void -dialog_destroy_cb (GtkWidget *w, MailSearch *ms) -{ - ESearchingTokenizer *st = mail_search_tokenizer (ms); - - e_searching_tokenizer_set_primary_search_string (st, NULL); - mail_search_redisplay_message (ms); -} - -static void -dialog_clicked_cb (GtkWidget *w, gint button_number, MailSearch *ms) -{ - ESearchingTokenizer *st = mail_search_tokenizer (ms); - - if (button_number == 0) { /* "Search" */ - - char *search_text, *tmp; - - tmp = gtk_editable_get_chars (GTK_EDITABLE (ms->entry), 0, -1); - - g_strstrip (tmp); - search_text = e_utf8_from_gtk_string ((GtkWidget *) ms->entry, tmp); - g_free (tmp); - - if (search_text && *search_text) { - - if (ms->last_search && !strcmp (ms->last_search, search_text)) { - - if (! gtk_html_engine_search_next (ms->mail->html)) { - g_free (ms->last_search); - ms->last_search = NULL; - } - - } else { - - g_free (ms->last_search); - ms->last_search = NULL; - - e_searching_tokenizer_set_primary_search_string (st, search_text); - e_searching_tokenizer_set_primary_case_sensitivity (st, ms->case_sensitive); - - mail_search_redisplay_message (ms); - - if (gtk_html_engine_search (ms->mail->html, search_text, - ms->case_sensitive, ms->search_forward, - FALSE)) { - ms->last_search = g_strdup (search_text); - } - } - } - - - g_free (search_text); - - } else if (button_number == 1) { /* "Close" */ - gtk_widget_destroy (w); - } -} - -static void -begin_cb (ESearchingTokenizer *st, gchar *foo, MailSearch *ms) -{ - const gchar *subject; - - if (ms && ms->mail && ms->mail->current_message) { - - subject = ms->mail->current_message->subject; - - if (subject == NULL) - subject = _("Untitled Message"); - - } else { - - subject = _("Empty Message"); - - } - - gtk_label_set_text (GTK_LABEL (ms->count_label), "0"); - mail_search_set_subject (ms, subject); -} - -static void -match_cb (ESearchingTokenizer *st, MailSearch *ms) -{ - gchar buf[16]; - g_snprintf (buf, 16, "%d", e_searching_tokenizer_match_count (st)); - gtk_label_set_text (GTK_LABEL (ms->count_label), buf); -} - -void -mail_search_construct (MailSearch *ms, MailDisplay *mail) -{ - const gchar *buttons[] = { _("Search"), - GNOME_STOCK_BUTTON_CLOSE, - NULL }; - gchar *title = NULL; - - GtkWidget *find_hbox; - GtkWidget *matches_hbox; - GtkWidget *toggles_hbox; - GtkWidget *frame_vbox; - - GtkWidget *entry; - GtkWidget *count_label; - GtkWidget *case_check; -#if 0 - GtkWidget *fwd_check; -#endif - - GtkWidget *msg_hbox; - GtkWidget *msg_frame; - - g_return_if_fail (ms != NULL && IS_MAIL_SEARCH (ms)); - g_return_if_fail (mail != NULL && IS_MAIL_DISPLAY (mail)); - - /* Basic set-up */ - - ms->mail = mail; - gtk_object_ref (GTK_OBJECT (mail)); - - title = g_strdup (_("Find in Message")); - - gnome_dialog_constructv (GNOME_DIALOG (ms), title, buttons); - g_free (title); - - ms->search_forward = TRUE; - ms->case_sensitive = FALSE; - - ms->begin_handler = gtk_signal_connect (GTK_OBJECT (ms->mail->html->engine->ht), - "begin", - GTK_SIGNAL_FUNC (begin_cb), - ms); - ms->match_handler = gtk_signal_connect (GTK_OBJECT (ms->mail->html->engine->ht), - "match", - GTK_SIGNAL_FUNC (match_cb), - ms); - - /* Construct the dialog contents. */ - - msg_hbox = gtk_hbox_new (FALSE, 0); - find_hbox = gtk_hbox_new (FALSE, 0); - matches_hbox = gtk_hbox_new (FALSE, 0); - toggles_hbox = gtk_hbox_new (FALSE, 0); - frame_vbox = gtk_vbox_new (FALSE, 0); - - entry = gtk_entry_new (); - count_label = gtk_label_new ("0"); - - msg_frame = gtk_frame_new (NULL); - - case_check = gtk_check_button_new_with_label (_("Case Sensitive")); -#if 0 - fwd_check = gtk_check_button_new_with_label (_("Search Forward")); -#endif - - ms->entry = entry; - ms->count_label = count_label; - - ms->msg_frame = msg_frame; - - if (mail->current_message->subject && *mail->current_message->subject) - mail_search_set_subject (ms, mail->current_message->subject); - else - mail_search_set_subject (ms, NULL); - -#if 0 - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fwd_check), ms->search_forward); -#endif - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (case_check), ms->case_sensitive); - - gtk_box_pack_start (GTK_BOX (msg_hbox), GTK_WIDGET (msg_frame), FALSE, FALSE, 3); - - gtk_box_pack_start (GTK_BOX (find_hbox), gtk_label_new (_("Find:")), FALSE, FALSE, 3); - gtk_box_pack_start (GTK_BOX (find_hbox), entry, TRUE, TRUE, 3); - gtk_box_pack_start (GTK_BOX (matches_hbox), gtk_hbox_new (FALSE, 0), TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (matches_hbox), gtk_label_new (_("Matches:")), FALSE, FALSE, 3); - gtk_box_pack_start (GTK_BOX (matches_hbox), count_label, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (matches_hbox), gtk_hbox_new (FALSE, 0), TRUE, TRUE, 0); - - gtk_box_pack_start (GTK_BOX (toggles_hbox), case_check, FALSE, FALSE, 4); - - /* - * Disabling the forward/backward search button because there are problems with it - * (related to how gtkhtml handles searches), the GUI freeze is upon us, and I - * don't know if they'll get resolved for 1.0. Hopefully getting this fixed can - * be a 1.1 item. - */ - -#if 0 - gtk_box_pack_start (GTK_BOX (toggles_hbox), fwd_check, FALSE, FALSE, 4); -#endif - - gtk_box_pack_start (GTK_BOX (frame_vbox), find_hbox, TRUE, TRUE, 8); - gtk_box_pack_start (GTK_BOX (frame_vbox), matches_hbox, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (frame_vbox), toggles_hbox, TRUE, TRUE, 0); - - gtk_container_add (GTK_CONTAINER (msg_frame), GTK_WIDGET (frame_vbox)); - - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (ms)->vbox), msg_hbox, TRUE, TRUE, 0); - - gtk_widget_grab_focus (entry); /* Give focus to entry by default */ - gnome_dialog_set_default (GNOME_DIALOG (ms), 0); - gnome_dialog_editable_enters (GNOME_DIALOG (ms), GTK_EDITABLE(entry)); /* Make <enter> run the search */ - gnome_window_icon_set_from_file (GTK_WINDOW (ms), EVOLUTION_ICONSDIR "/find-message.xpm"); - - gtk_widget_show_all (msg_hbox); - gtk_widget_show_all (find_hbox); - gtk_widget_show_all (matches_hbox); - gtk_widget_show_all (toggles_hbox); - - /* Hook up signals */ - - gtk_signal_connect (GTK_OBJECT (case_check), - "toggled", - GTK_SIGNAL_FUNC (toggled_case_cb), - ms); -#if 0 - gtk_signal_connect (GTK_OBJECT (fwd_check), - "toggled", - GTK_SIGNAL_FUNC (toggled_fwd_cb), - ms); -#endif - gtk_signal_connect (GTK_OBJECT (ms), - "clicked", - GTK_SIGNAL_FUNC (dialog_clicked_cb), - ms); - - gtk_signal_connect_object (GTK_OBJECT (ms), - "destroy", - GTK_SIGNAL_FUNC (dialog_destroy_cb), - GTK_OBJECT (ms)); - - gtk_signal_connect_object (GTK_OBJECT (ms->mail), - "destroy", - GTK_SIGNAL_FUNC (gtk_widget_destroy), - GTK_OBJECT (ms)); -} - -GtkWidget * -mail_search_new (MailDisplay *mail) -{ - gpointer ptr; - - g_return_val_if_fail (mail && IS_MAIL_DISPLAY (mail), NULL); - - ptr = gtk_type_new (mail_search_get_type ()); - mail_search_construct (MAIL_SEARCH (ptr), mail); - - return GTK_WIDGET (ptr); -} - diff --git a/mail/mail-search.h b/mail/mail-search.h deleted file mode 100644 index 4b84498a73..0000000000 --- a/mail/mail-search.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * mail-search.h - * - * Copyright (C) 2001 Ximian, Inc. - * - * Developed by Jon Trowbridge <trow@ximian.com> - */ - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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_SEARCH_H_ -#define _MAIL_SEARCH_H_ - -#ifdef _cplusplus -extern "C" { -#pragma } -#endif /* _cplusplus */ - -#include <gnome.h> -#include "mail-display.h" - -#define MAIL_SEARCH_TYPE (mail_search_get_type ()) -#define MAIL_SEARCH(o) (GTK_CHECK_CAST ((o), MAIL_SEARCH_TYPE, MailSearch)) -#define MAIL_SEARCH_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), MAIL_SEARCH_TYPE, MailSearch)) -#define IS_MAIL_SEARCH(o) (GTK_CHECK_TYPE ((o), MAIL_SEARCH_TYPE)) -#define IS_MAIL_SEARCH_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MAIL_SEARCH_TYPE)) - -typedef struct _MailSearch MailSearch; -typedef struct _MailSearchClass MailSearchClass; - -struct _MailSearch { - GnomeDialog parent; - - MailDisplay *mail; - - GtkWidget *entry; - GtkWidget *msg_frame; - GtkWidget *count_label; - - gboolean search_forward, case_sensitive; - gchar *last_search; - - guint begin_handler; - guint match_handler; -}; - -struct _MailSearchClass { - GnomeDialogClass parent_class; - -}; - -GtkType mail_search_get_type (void); - -void mail_search_construct (MailSearch *, MailDisplay *); -GtkWidget *mail_search_new (MailDisplay *); - - -#ifdef _cplusplus -} -#endif /* _cplusplus */ - -#endif /* _MAIL_SEARCH_H_ */ - diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c deleted file mode 100644 index be5b13f248..0000000000 --- a/mail/mail-send-recv.c +++ /dev/null @@ -1,845 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Michael Zucchi <NotZed@ximian.com> - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include <stdio.h> -#include <string.h> - -/* for the dialogue stuff */ -#include <glib.h> -#include <gtk/gtkmain.h> -#include <libgnomeui/gnome-stock.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-window-icon.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" -#include "mail-send-recv.h" -#include "mail-folder-cache.h" - -#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_INVALID -} 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; - GtkLabel *status; - - int timeout_id; - char *what; - int pc; - - /*time_t update;*/ - struct _send_data *data; -}; - -static struct _send_data *send_data = NULL; -static GtkWidget *send_recv_dialogue = 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->status) - gtk_label_set_text(info->status, _("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); */ - mail_sync_folder(info->folder, NULL, NULL); - 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->what); - g_free(info); -} - -static void -free_send_data(void) -{ - struct _send_data *data = send_data; - - g_assert(g_hash_table_size(data->active) == 0); - - if (data->inbox) { - mail_sync_folder(data->inbox, NULL, NULL); - /*camel_folder_thaw (data->inbox); */ - camel_object_unref((CamelObject *)data->inbox); - } - 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); - 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; - info->status = NULL; - - if (info->timeout_id != 0) { - gtk_timeout_remove (info->timeout_id); - info->timeout_id = 0; - } -} - -static void -dialog_destroy (GtkProgressBar *bar, struct _send_data *data) -{ - g_hash_table_foreach (data->active, (GHFunc) hide_send_info, NULL); - data->gd = 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); - data->gd = NULL; - break; - } -} - -static void operation_status(CamelOperation *op, const char *what, int pc, void *data); -static int operation_status_timeout(void *data); - -static char * -format_url(const char *internal_url) -{ - CamelURL *url; - char *pretty_url; - - url = camel_url_new(internal_url, NULL); - if (url->host) - pretty_url = g_strdup_printf(_("Server: %s, Type: %s"), url->host, url->protocol); - else if (url->path) - pretty_url = g_strdup_printf(_("Path: %s, Type: %s"), url->path, url->protocol); - else - pretty_url = g_strdup_printf(_("Type: %s"), url->protocol); - - camel_url_free(url); - - return pretty_url; -} - -static send_info_t get_receive_type(const char *url) -{ - CamelProvider *provider; - - provider = camel_session_get_provider (session, url, NULL); - if (!provider) - return SEND_INVALID; - - if (provider->flags & CAMEL_PROVIDER_IS_STORAGE) - return SEND_UPDATE; - else - return SEND_RECEIVE; -} - -static struct _send_data * -build_dialogue (GSList *sources, CamelFolder *outbox, const char *destination) -{ - GnomeDialog *gd; - GtkTable *table; - int row; - GList *list = NULL; - struct _send_data *data; - GtkWidget *send_icon, *recv_icon; - GtkLabel *label, *status_label; - GtkProgressBar *bar; - GtkButton *stop; - GtkHSeparator *line; - struct _send_info *info; - char *pretty_url; - - gd = (GnomeDialog *)send_recv_dialogue = gnome_dialog_new (_("Send & Receive Mail"), NULL); - gtk_signal_connect((GtkObject *)gd, "destroy", gtk_widget_destroyed, &send_recv_dialogue); - gnome_dialog_append_button_with_pixmap (gd, _("Cancel All"), GNOME_STOCK_BUTTON_CANCEL); - - gtk_window_set_policy (GTK_WINDOW (gd), FALSE, FALSE, FALSE); - gnome_window_icon_set_from_file (GTK_WINDOW (gd), EVOLUTION_ICONSDIR "/send-receive.xpm"); - - table = (GtkTable *)gtk_table_new (g_slist_length (sources), 4, FALSE); - gtk_box_pack_start (GTK_BOX (gd->vbox), GTK_WIDGET (table), TRUE, TRUE, 0); - - /* must bet setup after send_recv_dialogue as it may re-trigger send-recv button */ - data = setup_send_data (); - - 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) { - send_info_t type; - - type = get_receive_type (source->url); - if (type == SEND_INVALID) { - sources = sources->next; - continue; - } - - info = g_malloc0 (sizeof (*info)); - info->type = type; - 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); - - recv_icon = gnome_pixmap_new_from_file (EVOLUTION_BUTTONSDIR "/receive-24.png"); - - pretty_url = format_url (source->url); - label = (GtkLabel *)gtk_label_new (pretty_url); - g_free (pretty_url); - - bar = (GtkProgressBar *)gtk_progress_bar_new (); - gtk_progress_set_show_text (GTK_PROGRESS (bar), FALSE); - - stop = (GtkButton *)gnome_stock_button (GNOME_STOCK_BUTTON_CANCEL); - status_label = (GtkLabel *)gtk_label_new ((info->type == SEND_UPDATE) ? _("Updating...") : - _("Waiting...")); - - /* gtk_object_set (data->label, "bold", TRUE, NULL); */ - gtk_misc_set_alignment (GTK_MISC (label), 0, .5); - gtk_misc_set_alignment (GTK_MISC (status_label), 0, .5); - - gtk_table_attach (table, (GtkWidget *)recv_icon, 0, 1, row, row+2, GTK_EXPAND | GTK_FILL, 0, 3, 1); - gtk_table_attach (table, (GtkWidget *)label, 1, 2, row, row+1, GTK_EXPAND | GTK_FILL, 0, 3, 1); - gtk_table_attach (table, (GtkWidget *)bar, 2, 3, row, row+2, GTK_EXPAND | GTK_FILL, 0, 3, 1); - gtk_table_attach (table, (GtkWidget *)stop, 3, 4, row, row+2, GTK_EXPAND | GTK_FILL, 0, 3, 1); - gtk_table_attach (table, (GtkWidget *)status_label, 1, 2, row+1, row+2, GTK_EXPAND | GTK_FILL, 0, 3, 1); - - info->bar = bar; - info->status = status_label; - info->stop = stop; - info->data = data; - - gtk_signal_connect (GTK_OBJECT (stop), "clicked", receive_cancel, info); - sources = sources->next; - row = row + 2; - } - - line = (GtkHSeparator *)gtk_hseparator_new (); - gtk_table_attach (table, GTK_WIDGET (line), 0, 4, row, row+1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 3, 3); - row++; - gtk_widget_show_all (GTK_WIDGET (table)); - - if (outbox && destination) { - 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); - - send_icon = gnome_pixmap_new_from_file (EVOLUTION_BUTTONSDIR "/send-24.png"); - - pretty_url = format_url (destination); - label = (GtkLabel *)gtk_label_new (pretty_url); - g_free (pretty_url); - - bar = (GtkProgressBar *)gtk_progress_bar_new (); - stop = (GtkButton *)gnome_stock_button (GNOME_STOCK_BUTTON_CANCEL); - status_label = (GtkLabel *)gtk_label_new (_("Waiting...")); - - gtk_misc_set_alignment (GTK_MISC (label), 0, .5); - gtk_misc_set_alignment (GTK_MISC (status_label), 0, .5); - gtk_progress_set_show_text (GTK_PROGRESS (bar), FALSE); - - gtk_table_attach (table, GTK_WIDGET (send_icon), 0, 1, row, row+2, GTK_EXPAND | GTK_FILL, 0, 3, 1); - gtk_table_attach (table, GTK_WIDGET (label), 1, 2, row, row+1, GTK_EXPAND | GTK_FILL, 0, 3, 1); - gtk_table_attach (table, GTK_WIDGET (bar), 2, 3, row, row+2, GTK_EXPAND | GTK_FILL, 0, 3, 1); - gtk_table_attach (table, GTK_WIDGET (stop), 3, 4, row, row+2, GTK_EXPAND | GTK_FILL, 0, 3, 1); - gtk_table_attach (table, GTK_WIDGET (status_label), 1, 2, row+1, row+2, GTK_EXPAND | GTK_FILL, 0, 3, 1); - - info->bar = bar; - info->stop = stop; - info->data = data; - info->status = status_label; - - gtk_signal_connect (GTK_OBJECT (stop), "clicked", receive_cancel, info); - gtk_widget_show_all (GTK_WIDGET (table)); - } - - gtk_widget_show (GTK_WIDGET (gd)); - - gtk_signal_connect (GTK_OBJECT (gd), "clicked", dialogue_clicked, data); - gtk_signal_connect (GTK_OBJECT (gd), "destroy", dialog_destroy, 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) -{ - /* FIXME: LOCK */ - g_free(info->what); - info->what = g_strdup(desc); - 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 = time(0); - - /* 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_label_set_text(info->status, 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_label_set_text(info->status, _("Cancelled.")); - break; - default: - info->state = SEND_COMPLETE; - gtk_label_set_text(info->status, _("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); - - if (g_hash_table_size(info->data->active) == 0) { - if (info->data->gd) - gnome_dialog_close(info->data->gd); - free_send_data(); - } - - free_send_info(NULL, info, NULL); -} - -/* same for updating */ -static void -receive_update_done(CamelStore *store, CamelFolderInfo *info, 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); - oldinfo = g_hash_table_lookup(info->data->folders, uri); - g_mutex_unlock(info->data->lock); - if (oldinfo) { - camel_object_ref((CamelObject *)oldinfo->folder); - return oldinfo->folder; - } - folder = mail_tool_uri_to_folder (uri, 0, 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_note_store(store, storage, CORBA_OBJECT_NIL, receive_update_done, info); - /*bonobo_object_unref (BONOBO_OBJECT (storage));*/ - } else { - receive_done ("", info); - } - } else { - receive_done ("", info); - } -} - -void mail_send_receive (void) -{ - GSList *sources; - GList *scan; - struct _send_data *data; - extern CamelFolder *outbox_folder; - const MailConfigAccount *account; - - if (send_recv_dialogue != NULL) { - if (GTK_WIDGET_REALIZED(send_recv_dialogue)) { - gdk_window_show(send_recv_dialogue->window); - gdk_window_raise(send_recv_dialogue->window); - } - return; - } - - sources = mail_config_get_sources(); - if (!sources) - return; - account = mail_config_get_default_account(); - if (!account || !account->transport) - return; - - /* 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; - while (scan) { - struct _send_info *info = scan->data; - - switch(info->type) { - case SEND_RECEIVE: - mail_fetch_mail(info->uri, info->keep, - 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, - 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; - default: - g_assert_not_reached (); - } - scan = scan->next; - } -} - -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; - - if (camel_session_is_online(session)) - 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) -{ - GHashTable *set_hash; - GSList *sources; - - 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) -{ - struct _send_info *info; - struct _send_data *data; - extern CamelFolder *outbox_folder; - send_info_t type; - - 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)); - - type = get_receive_type (uri); - if (type == SEND_INVALID) { - d(printf ("unsupported provider: '%s'\n", uri)); - return; - } - - info = g_malloc0 (sizeof (*info)); - info->type = type; - info->bar = NULL; - info->status = 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); - - switch (info->type) { - case SEND_RECEIVE: - mail_fetch_mail (info->uri, info->keep, - 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, - 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; - default: - g_assert_not_reached (); - } -} diff --git a/mail/mail-send-recv.h b/mail/mail-send-recv.h deleted file mode 100644 index 7d43d610fb..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 <NotZed@ximian.com> - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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_SEND_RECV_H -#define MAIL_SEND_RECV_H - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus }*/ - -#include "mail-config.h" - -/* 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.c b/mail/mail-session.c deleted file mode 100644 index f8265a12ea..0000000000 --- a/mail/mail-session.c +++ /dev/null @@ -1,981 +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 */ -/* - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include <stdlib.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-config.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-dialog-util.h> -#include <libgnomeui/gnome-messagebox.h> -#include <libgnomeui/gnome-stock.h> - -#include <gal/widgets/e-unicode.h> - -#include "camel/camel-filter-driver.h" -#include "filter/filter-context.h" -#include "filter/filter-filter.h" -#include "mail.h" -#include "mail-session.h" -#include "mail-tools.h" -#include "mail-mt.h" -#include "e-util/e-passwords.h" -#include "e-util/e-msgport.h" - -#define d(x) - -CamelSession *session; - - -#define MAIL_SESSION_TYPE (mail_session_get_type ()) -#define MAIL_SESSION(obj) (CAMEL_CHECK_CAST((obj), MAIL_SESSION_TYPE, MailSession)) -#define MAIL_SESSION_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), MAIL_SESSION_TYPE, MailSessionClass)) -#define MAIL_IS_SESSION(o) (CAMEL_CHECK_TYPE((o), MAIL_SESSION_TYPE)) - -#define MAIL_SESSION_LOCK(s, l) (e_mutex_lock(((MailSession *)s)->l)) -#define MAIL_SESSION_UNLOCK(s, l) (e_mutex_unlock(((MailSession *)s)->l)) - -typedef struct _MailSession { - CamelSession parent_object; - - gboolean interaction_enabled; - FILE *filter_logfile; - - EMutex *lock; - - MailAsyncEvent *async; - - /* must all be accessed with lock held ! */ - unsigned int timeout_id;/* next camel timneout id */ - EDList timeouts; /* list of struct _timeout_data's of current or pending removed timeouts */ -} MailSession; - -typedef struct _MailSessionClass { - CamelSessionClass parent_class; - -} MailSessionClass; - -static char *get_password(CamelSession *session, const char *prompt, gboolean secret, CamelService *service, const char *item, CamelException *ex); -static void forget_password(CamelSession *session, CamelService *service, const char *item, CamelException *ex); -static gboolean alert_user(CamelSession *session, CamelSessionAlertType type, const char *prompt, gboolean cancel); -static guint register_timeout(CamelSession *session, guint32 interval, CamelTimeoutCallback cb, gpointer camel_data); -static gboolean remove_timeout(CamelSession *session, guint handle); -static CamelFilterDriver *get_filter_driver(CamelSession *session, const char *type, CamelException *ex); - -static void -init (MailSession *session) -{ - session->lock = e_mutex_new(E_MUTEX_REC); - session->timeout_id = 1; /* first timeout id */ - session->async = mail_async_event_new(); - e_dlist_init(&session->timeouts); -} - -static void -finalise (MailSession *session) -{ - mail_async_event_destroy(session->async); - e_mutex_destroy(session->lock); -} - -static void -class_init (MailSessionClass *mail_session_class) -{ - CamelSessionClass *camel_session_class = CAMEL_SESSION_CLASS (mail_session_class); - - /* virtual method override */ - camel_session_class->get_password = get_password; - camel_session_class->forget_password = forget_password; - camel_session_class->alert_user = alert_user; - camel_session_class->register_timeout = register_timeout; - camel_session_class->remove_timeout = remove_timeout; - camel_session_class->get_filter_driver = get_filter_driver; -} - -static CamelType -mail_session_get_type (void) -{ - static CamelType mail_session_type = CAMEL_INVALID_TYPE; - - if (mail_session_type == CAMEL_INVALID_TYPE) { - mail_session_type = camel_type_register ( - camel_session_get_type (), - "MailSession", - sizeof (MailSession), - sizeof (MailSessionClass), - (CamelObjectClassInitFunc) class_init, - NULL, - (CamelObjectInitFunc) init, - (CamelObjectFinalizeFunc) finalise); - } - - return mail_session_type; -} - - -static char * -make_key (CamelService *service, const char *item) -{ - char *key; - - if (service) - key = camel_url_to_string (service->url, CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS); - else - key = g_strdup (item); - - return key; -} - -/* ********************************************************************** */ - -static GnomeDialog *password_dialogue = NULL; -static EDList password_list = E_DLIST_INITIALISER(password_list); -static int password_destroy_id; - -struct _pass_msg { - struct _mail_msg msg; - - CamelSession *session; - const char *prompt; - gboolean secret; - CamelService *service; - const char *item; - CamelException *ex; - - char *service_url; - char *key; - - GtkWidget *check; - char *result; - int ismain; -}; - -static void do_get_pass(struct _mail_msg *mm); - -static void -pass_got (char *string, void *data) -{ - struct _pass_msg *m = data; - - if (string) { - MailConfigService *service = NULL; - const MailConfigAccount *mca; - gboolean cache, remember; - - m->result = g_strdup (string); - remember = cache = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (m->check)); - if (m->service_url) { - mca = mail_config_get_account_by_source_url (m->service_url); - if (mca) { - service = mca->source; - } else { - mca = mail_config_get_account_by_transport_url (m->service_url); - if (mca) - service = mca->transport; - } - - if (service) { - mail_config_service_set_save_passwd (service, cache); - - /* set `cache' to TRUE because people don't want to have to - re-enter their passwords for this session even if they told - us not to cache their passwords in the dialog...*sigh* */ - cache = TRUE; - } - } else { - /* we can't remember the password if it isn't for an account (pgp?) */ - remember = FALSE; - } - - if (cache) { - /* cache the password for the session */ - e_passwords_add_password (m->key, m->result); - - /* should we remember it between sessions? */ - if (remember) - e_passwords_remember_password (m->key); - } - } else { - camel_exception_set(m->ex, CAMEL_EXCEPTION_USER_CANCEL, _("User canceled operation.")); - } - - if (password_destroy_id) { - gtk_signal_disconnect((GtkObject *)password_dialogue, password_destroy_id); - password_destroy_id = 0; - } - - password_dialogue = NULL; - e_msgport_reply((EMsg *)m); - - if ((m = (struct _pass_msg *)e_dlist_remhead(&password_list))) - do_get_pass((struct _mail_msg *)m); -} - -static void -request_password_deleted(GtkWidget *w, struct _pass_msg *m) -{ - password_destroy_id = 0; - pass_got(NULL, m); -} - -static void -request_password(struct _pass_msg *m) -{ - const MailConfigAccount *mca = NULL; - GtkWidget *dialogue; - GtkWidget *check, *entry; - GList *children, *iter; - gboolean show; - char *title; - - /* If we already have a password_dialogue up, save this request till later */ - if (!m->ismain && password_dialogue) { - e_dlist_addtail(&password_list, (EDListNode *)m); - return; - } - - /* FIXME: Remove this total snot */ - - /* this api is just awful ... hence the major hacks */ - password_dialogue = (GnomeDialog *)dialogue = gnome_request_dialog (m->secret, m->prompt, NULL, 0, pass_got, m, NULL); - - /* cant bleieve how @!@#!@# 5this api is, it doesn't handle this for you, BLAH! */ - password_destroy_id = gtk_signal_connect((GtkObject *)dialogue, "destroy", request_password_deleted, m); - - /* Remember the password? */ - check = gtk_check_button_new_with_label (m->service_url ? _("Remember this password") : - _("Remember this password for the remainder of this session")); - show = TRUE; - - if (m->service_url) { - mca = mail_config_get_account_by_source_url(m->service_url); - if (mca) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), mca->source->save_passwd); - else { - mca = mail_config_get_account_by_transport_url (m->service_url); - if (mca) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), mca->transport->save_passwd); - else { - d(printf ("Cannot figure out which account owns URL \"%s\"\n", m->service_url)); - show = FALSE; - } - } - } - - if (show) - gtk_widget_show (check); - - /* do some dirty stuff to put the checkbutton after the entry */ - entry = NULL; - children = gtk_container_children (GTK_CONTAINER (GNOME_DIALOG (dialogue)->vbox)); - for (iter = children; iter; iter = iter->next) { - if (GTK_IS_ENTRY (iter->data)) { - entry = GTK_WIDGET (iter->data); - break; - } - } - g_list_free (children); - - if (entry) { - gtk_object_ref (GTK_OBJECT (entry)); - gtk_container_remove (GTK_CONTAINER (GNOME_DIALOG (dialogue)->vbox), entry); - } - - gtk_box_pack_end (GTK_BOX (GNOME_DIALOG (dialogue)->vbox), check, TRUE, FALSE, 0); - - if (entry) { - gtk_box_pack_end (GTK_BOX (GNOME_DIALOG (dialogue)->vbox), entry, TRUE, FALSE, 0); - gtk_widget_grab_focus (entry); - gtk_object_unref (GTK_OBJECT (entry)); - } - - m->check = check; - - if (mca) { - char *name; - - name = e_utf8_to_gtk_string (GTK_WIDGET (dialogue), mca->name); - title = g_strdup_printf (_("Enter Password for %s"), name); - g_free (name); - } else - title = g_strdup (_("Enter Password")); - - gtk_window_set_title (GTK_WINDOW (dialogue), title); - g_free (title); - - if (m->ismain) - gnome_dialog_run_and_close ((GnomeDialog *)dialogue); - else - gtk_widget_show(dialogue); -} - -static void -do_get_pass(struct _mail_msg *mm) -{ - struct _pass_msg *m = (struct _pass_msg *)mm; - MailSession *mail_session = MAIL_SESSION (m->session); - - if (!strcmp (m->item, "popb4smtp_uri")) { - char *url = camel_url_to_string(m->service->url, 0); - const MailConfigAccount *account = mail_config_get_account_by_transport_url(url); - - g_free(url); - if (account) - m->result = g_strdup(account->source->url); - } else if (m->key) { - m->result = e_passwords_get_password(m->key); - if (m->result == NULL) { - if (mail_session->interaction_enabled) { - request_password(m); - return; - } - } - } - - e_msgport_reply((EMsg *)mm); -} - -static void -do_free_pass(struct _mail_msg *mm) -{ - struct _pass_msg *m = (struct _pass_msg *)mm; - - g_free(m->service_url); - g_free(m->key); -} - -static struct _mail_msg_op get_pass_op = { - NULL, - do_get_pass, - NULL, - do_free_pass, -}; - -static char * -get_password (CamelSession *session, const char *prompt, gboolean secret, CamelService *service, const char *item, CamelException *ex) -{ - struct _pass_msg *m, *r; - EMsgPort *pass_reply; - char *ret; - - /* We setup an async request and send it off, and wait for it to return */ - /* If we're really in main, we dont of course ... - ... but this shouldn't be allowed because of locking issues */ - pass_reply = e_msgport_new (); - m = mail_msg_new(&get_pass_op, pass_reply, sizeof(struct _pass_msg)); - m->ismain = pthread_self() == mail_gui_thread; - m->session = session; - m->prompt = prompt; - m->secret = secret; - m->service = service; - m->item = item; - m->ex = ex; - if (service) - m->service_url = camel_url_to_string (service->url, CAMEL_URL_HIDE_ALL); - m->key = make_key(service, item); - - if (m->ismain) - do_get_pass((struct _mail_msg *)m); - else { - extern EMsgPort *mail_gui_port2; - - e_msgport_put(mail_gui_port2, (EMsg *)m); - } - - e_msgport_wait(pass_reply); - r = (struct _pass_msg *)e_msgport_get(pass_reply); - g_assert(m == r); - - ret = m->result; - mail_msg_free(m); - e_msgport_destroy(pass_reply); - - return ret; -} - -static void -main_forget_password (CamelSession *session, CamelService *service, const char *item, CamelException *ex) -{ - char *key = make_key (service, item); - - e_passwords_forget_password (key); - - g_free (key); -} - -static void -forget_password (CamelSession *session, CamelService *service, const char *item, CamelException *ex) -{ - mail_call_main(MAIL_CALL_p_pppp, (MailMainFunc)main_forget_password, - session, service, item, ex); -} - -/* ********************************************************************** */ - -static GnomeDialog *message_dialogue; -static EDList message_list = E_DLIST_INITIALISER(password_list); -static guint message_destroy_id; - -struct _user_message_msg { - struct _mail_msg msg; - - CamelSessionAlertType type; - const char *prompt; - - unsigned int allow_cancel:1; - unsigned int result:1; - unsigned int ismain:1; -}; - -static void do_user_message (struct _mail_msg *mm); - -/* if we dont have to wait for reply, we just check to see if any newly waiting prompts are there */ -static void -user_message_destroy_noreply(GnomeDialog *gd, void *data) -{ - struct _user_message_msg *m; - - message_dialogue = NULL; - if ((m = (struct _user_message_msg *)e_dlist_remhead(&message_list))) - do_user_message((struct _mail_msg *)m); -} - -/* clicked, send back the reply */ -static void -user_message_clicked(GnomeDialog *gd, int button, struct _user_message_msg *m) -{ - message_dialogue = NULL; - - if (message_destroy_id) { - gtk_signal_disconnect((GtkObject *)gd, message_destroy_id); - message_destroy_id = 0; - } - - m->result = button == 0; - e_msgport_reply((EMsg *)m); - - /* check for pendings */ - if ((m = (struct _user_message_msg *)e_dlist_remhead(&message_list))) - do_user_message((struct _mail_msg *)m); -} - -static void -user_message_destroy(GnomeDialog *gd, struct _user_message_msg *m) -{ - message_destroy_id = 0; - user_message_clicked(gd, -1, m); -} - -static void -do_user_message (struct _mail_msg *mm) -{ - struct _user_message_msg *m = (struct _user_message_msg *)mm; - const char *msg_type; - - if (!m->ismain && message_dialogue != NULL) { - e_dlist_addtail(&message_list, (EDListNode *)m); - return; - } - - switch (m->type) { - case CAMEL_SESSION_ALERT_INFO: - msg_type = GNOME_MESSAGE_BOX_INFO; - break; - case CAMEL_SESSION_ALERT_WARNING: - msg_type = GNOME_MESSAGE_BOX_WARNING; - break; - case CAMEL_SESSION_ALERT_ERROR: - msg_type = GNOME_MESSAGE_BOX_ERROR; - break; - default: - msg_type = NULL; - } - - message_dialogue = (GnomeDialog *)gnome_message_box_new(m->prompt, msg_type, GNOME_STOCK_BUTTON_OK, - m->allow_cancel ? GNOME_STOCK_BUTTON_CANCEL : NULL, - NULL); - gnome_dialog_set_default(message_dialogue, 1); - gnome_dialog_set_close(message_dialogue, TRUE); - gtk_window_set_policy (GTK_WINDOW (message_dialogue), TRUE, TRUE, TRUE); - - /* We only need to wait for the result if we allow cancel otherwise show but send result back instantly */ - if (m->allow_cancel) { - gtk_signal_connect((GtkObject*)message_dialogue, "clicked", user_message_clicked, m); - message_destroy_id = gtk_signal_connect((GtkObject*)message_dialogue, "destroy", user_message_destroy, m); - if (m->ismain) - gnome_dialog_run_and_close ((GnomeDialog *)message_dialogue); - else - gtk_widget_show((GtkWidget *)message_dialogue); - } else { - gtk_signal_connect((GtkObject *)message_dialogue, "destroy", user_message_destroy_noreply, NULL); - gtk_widget_show((GtkWidget *)message_dialogue); - m->result = TRUE; - e_msgport_reply((EMsg *)m); - } -} - -static struct _mail_msg_op user_message_op = { NULL, do_user_message, NULL, NULL }; - -static gboolean -alert_user(CamelSession *session, CamelSessionAlertType type, const char *prompt, gboolean cancel) -{ - MailSession *mail_session = MAIL_SESSION (session); - struct _user_message_msg *m, *r; - EMsgPort *user_message_reply; - gboolean ret; - - if (!mail_session->interaction_enabled) - return FALSE; - - user_message_reply = e_msgport_new (); - m = mail_msg_new (&user_message_op, user_message_reply, sizeof (*m)); - m->ismain = pthread_self() == mail_gui_thread; - m->type = type; - m->prompt = prompt; - m->allow_cancel = cancel; - - if (m->ismain) - do_user_message((struct _mail_msg *)m); - else { - extern EMsgPort *mail_gui_port2; - - e_msgport_put(mail_gui_port2, (EMsg *)m); - } - - e_msgport_wait(user_message_reply); - r = (struct _user_message_msg *)e_msgport_get(user_message_reply); - g_assert(m == r); - - ret = m->result; - mail_msg_free(m); - e_msgport_destroy(user_message_reply); - - return ret; -} - -/* ******************** */ - -struct _timeout_data { - struct _timeout_data *next; - struct _timeout_data *prev; - - CamelSession *session; - - guint32 interval; - - CamelTimeoutCallback cb; - void *camel_data; - - guint id; /* the camel 'id' */ - guint timeout_id; /* the gtk 'id' */ - - unsigned int busy:1; /* on if its currently running */ - unsigned int removed:1; /* if its been removed since */ -}; - -struct _timeout_msg { - struct _mail_msg msg; - - CamelSession *session; - unsigned int id; - int result; -}; - -static struct _timeout_data * -find_timeout(EDList *list, unsigned int id) -{ - struct _timeout_data *td, *tn; - - td = (struct _timeout_data *)list->head; - tn = td->next; - while (tn) { - if (td->id == id) - return td; - td = tn; - tn = tn->next; - } - - return NULL; -} - -static void -timeout_timeout (struct _mail_msg *mm) -{ - struct _timeout_msg *m = (struct _timeout_msg *)mm; - MailSession *ms = (MailSession *)m->session; - struct _timeout_data *td; - - MAIL_SESSION_LOCK(ms, lock); - td = find_timeout(&ms->timeouts, m->id); - if (td && !td->removed) { - if (td->busy) { - g_warning("Timeout event dropped, still busy with last one"); - } else { - td->busy = TRUE; - m->result = td->cb(td->camel_data); - td->busy = FALSE; - td->removed = !m->result; - } - } - MAIL_SESSION_UNLOCK(ms, lock); -} - -static void -timeout_done(struct _mail_msg *mm) -{ - struct _timeout_msg *m = (struct _timeout_msg *)mm; - MailSession *ms = (MailSession *)m->session; - struct _timeout_data *td; - - if (!m->result) { - MAIL_SESSION_LOCK(ms, lock); - td = find_timeout(&ms->timeouts, m->id); - if (td) { - e_dlist_remove((EDListNode *)td); - if (td->timeout_id) - gtk_timeout_remove(td->timeout_id); - g_free(td); - } - MAIL_SESSION_UNLOCK(ms, lock); - } -} - -static void -timeout_free(struct _mail_msg *mm) -{ - struct _timeout_msg *m = (struct _timeout_msg *)mm; - - camel_object_unref((CamelObject *)m->session); -} - -static struct _mail_msg_op timeout_op = { - NULL, - timeout_timeout, - timeout_done, - timeout_free, -}; - -static gboolean -camel_timeout (gpointer data) -{ - struct _timeout_data *td = data; - struct _timeout_msg *m; - - /* stop if we are removed pending */ - if (td->removed) - return FALSE; - - m = mail_msg_new(&timeout_op, NULL, sizeof (*m)); - - m->session = td->session; - camel_object_ref((CamelObject *)td->session); - m->id = td->id; - - e_thread_put(mail_thread_queued, (EMsg *)m); - - return TRUE; -} - -static void -main_register_timeout(CamelSession *session, void *event_data, void *data) -{ - MailSession *ms = (MailSession *)session; - unsigned int handle = (unsigned int)event_data; - struct _timeout_data *td; - - MAIL_SESSION_LOCK(session, lock); - td = find_timeout(&ms->timeouts, handle); - if (td) { - if (td->removed) { - e_dlist_remove((EDListNode *)td); - if (td->timeout_id) - gtk_timeout_remove(td->timeout_id); - g_free(td); - } else { - td->timeout_id = gtk_timeout_add(td->interval, camel_timeout, td); - } - } - MAIL_SESSION_UNLOCK(session, lock); - - camel_object_unref((CamelObject *)ms); -} - -static guint -register_timeout (CamelSession *session, guint32 interval, CamelTimeoutCallback cb, gpointer camel_data) -{ - struct _timeout_data *td; - MailSession *ms = (MailSession *)session; - guint ret; - - MAIL_SESSION_LOCK(session, lock); - - ret = ms->timeout_id; - ms->timeout_id ++; - - /* just debugging, the timeout code now ignores excessive events anyway */ - if (interval < 100) - g_warning("Timeout requested %d is small, may cause performance problems", interval); - - td = g_malloc(sizeof(*td)); - td->cb = cb; - td->camel_data = camel_data; - td->interval = interval; - td->id = ret; - td->session = session; - td->removed = FALSE; - td->busy = FALSE; - e_dlist_addhead(&ms->timeouts, (EDListNode *)td); - - MAIL_SESSION_UNLOCK(session, lock); - - camel_object_ref((CamelObject *)ms); - mail_async_event_emit(ms->async, MAIL_ASYNC_GUI, (MailAsyncFunc)main_register_timeout, (CamelObject *)session, (void *)ret, NULL); - - return ret; -} - -static void -main_remove_timeout(CamelSession *session, void *event_data, void *data) -{ - MailSession *ms = (MailSession *)session; - unsigned int handle = (unsigned int)event_data; - struct _timeout_data *td; - - MAIL_SESSION_LOCK(session, lock); - td = find_timeout(&ms->timeouts, handle); - if (td) { - e_dlist_remove((EDListNode *)td); - if (td->timeout_id) - gtk_timeout_remove(td->timeout_id); - g_free(td); - } - MAIL_SESSION_UNLOCK(session, lock); - - camel_object_unref((CamelObject *)ms); -} - -static gboolean -remove_timeout (CamelSession *session, guint handle) -{ - MailSession *ms = (MailSession *)session; - struct _timeout_data *td; - int remove = FALSE; - - MAIL_SESSION_LOCK(session, lock); - td = find_timeout(&ms->timeouts, handle); - if (td && !td->removed) { - td->removed = TRUE; - remove = TRUE; - } - MAIL_SESSION_UNLOCK(session, lock); - - if (remove) { - camel_object_ref((CamelObject *)ms); - mail_async_event_emit(ms->async, MAIL_ASYNC_GUI, - (MailAsyncFunc)main_remove_timeout, (CamelObject *)session, (void *)handle, NULL); - } else - g_warning("Removing a timeout i dont know about (or twice): %d", handle); - - return TRUE; -} - -static CamelFolder * -get_folder (CamelFilterDriver *d, const char *uri, void *data, CamelException *ex) -{ - return mail_tool_uri_to_folder (uri, 0, ex); -} - -static CamelFilterDriver * -main_get_filter_driver (CamelSession *session, const char *type, CamelException *ex) -{ - CamelFilterDriver *driver; - RuleContext *fc; - GString *fsearch, *faction; - FilterRule *rule = NULL; - char *user, *system; - - user = g_strdup_printf ("%s/filters.xml", evolution_dir); - system = EVOLUTION_DATADIR "/evolution/filtertypes.xml"; - fc = (RuleContext *)filter_context_new (); - rule_context_load (fc, system, user); - g_free (user); - - driver = camel_filter_driver_new (); - camel_filter_driver_set_folder_func (driver, get_folder, NULL); - - if (mail_config_get_filter_log ()) { - MailSession *ms = (MailSession *)session; - - if (ms->filter_logfile == NULL) { - const char *filename; - - filename = mail_config_get_filter_log_path (); - if (filename) - ms->filter_logfile = fopen (filename, "a+"); - } - if (ms->filter_logfile) - camel_filter_driver_set_logfile (driver, ms->filter_logfile); - } - - fsearch = g_string_new (""); - faction = g_string_new (""); - - while ((rule = rule_context_next_rule (fc, rule, type))) { - g_string_truncate (fsearch, 0); - g_string_truncate (faction, 0); - - filter_rule_build_code (rule, fsearch); - filter_filter_build_action ((FilterFilter *)rule, faction); - - camel_filter_driver_add_rule (driver, rule->name, - fsearch->str, faction->str); - } - - g_string_free (fsearch, TRUE); - g_string_free (faction, TRUE); - - gtk_object_unref (GTK_OBJECT (fc)); - return driver; -} - -static CamelFilterDriver * -get_filter_driver (CamelSession *session, const char *type, CamelException *ex) -{ - return (CamelFilterDriver *)mail_call_main(MAIL_CALL_p_ppp, (MailMainFunc)main_get_filter_driver, - session, type, ex); -} - -char * -mail_session_get_password (const char *url_string) -{ - CamelURL *url; - char *simple_url; - char *passwd; - - url = camel_url_new (url_string, NULL); - simple_url = camel_url_to_string (url, CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS); - camel_url_free (url); - - passwd = e_passwords_get_password (simple_url); - - g_free (simple_url); - - return passwd; -} - -void -mail_session_add_password (const char *url_string, - const char *passwd) -{ - CamelURL *url; - char *simple_url; - - url = camel_url_new (url_string, NULL); - simple_url = camel_url_to_string (url, CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS); - camel_url_free (url); - - e_passwords_add_password (simple_url, passwd); - - g_free (simple_url); -} - -void -mail_session_remember_password (const char *url_string) -{ - CamelURL *url; - char *simple_url; - - url = camel_url_new (url_string, NULL); - simple_url = camel_url_to_string (url, CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS); - camel_url_free (url); - - e_passwords_remember_password (simple_url); - - g_free (simple_url); -} - -void -mail_session_forget_password (const char *key) -{ - e_passwords_forget_password (key); -} - -void -mail_session_init (void) -{ - char *camel_dir; - - if (camel_init (evolution_dir, TRUE) != 0) - exit (0); - - session = CAMEL_SESSION (camel_object_new (MAIL_SESSION_TYPE)); - - camel_dir = g_strdup_printf ("%s/mail", evolution_dir); - camel_session_construct (session, camel_dir); - g_free (camel_dir); -} - -void -mail_session_enable_interaction (gboolean enable) -{ - MAIL_SESSION (session)->interaction_enabled = enable; - - if (!enable) { - struct _pass_msg *pm; - struct _user_message_msg *um; - - d(printf("Gone non-interactive, checking for outstanding interactive tasks\n")); - - /* clear out pending password requests */ - while ((pm = (struct _pass_msg *)e_dlist_remhead(&password_list))) { - d(printf("Flushing password request : %s\n", pm->prompt)); - e_msgport_reply((EMsg *)pm); - } - - /* destroy the current */ - if (password_dialogue) { - d(printf("Destroying password dialogue\n")); - gtk_object_destroy((GtkObject *)password_dialogue); - } - - /* same for pending user messages */ - while ((um = (struct _user_message_msg *)e_dlist_remhead(&message_list))) { - d(printf("Flusing message request: %s\n", um->prompt)); - e_msgport_reply((EMsg *)um); - } - - /* and the current */ - if (message_dialogue) { - d(printf("Destroying message dialogue\n")); - gtk_object_destroy((GtkObject *)message_dialogue); - } - } -} - -void -mail_session_forget_passwords (BonoboUIComponent *uih, void *user_data, - const char *path) -{ - e_passwords_forget_passwords (); -} diff --git a/mail/mail-session.h b/mail/mail-session.h deleted file mode 100644 index 40ff736c87..0000000000 --- a/mail/mail-session.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright 2000 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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_SESSION_H -#define MAIL_SESSION_H - -#include <glib.h> -#include <bonobo/bonobo-ui-component.h> -#include <camel/camel-session.h> - -#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); -gboolean mail_session_accept_dialog (const char *prompt, const char *key, - gboolean async); -char *mail_session_get_password (const char *url); -void mail_session_add_password (const char *url, const char *passwd); -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); - -extern CamelSession *session; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ! MAIL_SESSION_H */ diff --git a/mail/mail-stream-gtkhtml.c b/mail/mail-stream-gtkhtml.c deleted file mode 100644 index 9a7a39ac55..0000000000 --- a/mail/mail-stream-gtkhtml.c +++ /dev/null @@ -1,99 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright 2001 Ximain, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include "mail-stream-gtkhtml.h" - -static CamelStreamClass *parent_class = NULL; - -static ssize_t stream_write (CamelStream *stream, const char *buffer, size_t n); - -static void -mail_stream_gtkhtml_class_init (MailStreamGtkHTMLClass *mail_stream_gtkhtml_class) -{ - CamelStreamClass *camel_stream_class = - CAMEL_STREAM_CLASS (mail_stream_gtkhtml_class); - - parent_class = CAMEL_STREAM_CLASS (camel_type_get_global_classfuncs (CAMEL_STREAM_TYPE)); - - /* virtual method overload */ - camel_stream_class->write = stream_write; -} - -static void -mail_stream_gtkhtml_init (CamelObject *object) -{ - ; -} - -static void -mail_stream_gtkhtml_finalize (CamelObject *object) -{ - ; -} - -CamelType -mail_stream_gtkhtml_get_type (void) -{ - static CamelType type = CAMEL_INVALID_TYPE; - - if (type == CAMEL_INVALID_TYPE) { - type = camel_type_register (CAMEL_STREAM_TYPE, - "MailStreamGtkHTML", - sizeof (MailStreamGtkHTML), - sizeof (MailStreamGtkHTMLClass), - (CamelObjectClassInitFunc) mail_stream_gtkhtml_class_init, - NULL, - (CamelObjectInitFunc) mail_stream_gtkhtml_init, - (CamelObjectFinalizeFunc) mail_stream_gtkhtml_finalize); - } - - return type; -} - - -CamelStream * -mail_stream_gtkhtml_new (GtkHTML *html, GtkHTMLStream *html_stream) -{ - MailStreamGtkHTML *stream_gtkhtml; - - stream_gtkhtml = MAIL_STREAM_GTKHTML (camel_object_new (MAIL_STREAM_GTKHTML_TYPE)); - stream_gtkhtml->html = html; - stream_gtkhtml->html_stream = html_stream; - - return CAMEL_STREAM (stream_gtkhtml); -} - -static ssize_t -stream_write (CamelStream *stream, const char *buffer, size_t n) -{ - MailStreamGtkHTML *stream_gtkhtml = MAIL_STREAM_GTKHTML (stream); - - gtk_html_write (stream_gtkhtml->html, stream_gtkhtml->html_stream, - buffer, n); - - return n; -} diff --git a/mail/mail-stream-gtkhtml.h b/mail/mail-stream-gtkhtml.h deleted file mode 100644 index ede19e213d..0000000000 --- a/mail/mail-stream-gtkhtml.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright 2001 Ximain, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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_STREAM_GTKHTML_H -#define MAIL_STREAM_GTKHTML_H - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus } */ - -#include <camel/camel-stream.h> -#include <gtkhtml/gtkhtml.h> - -#define MAIL_STREAM_GTKHTML_TYPE (mail_stream_gtkhtml_get_type ()) -#define MAIL_STREAM_GTKHTML(obj) (CAMEL_CHECK_CAST((obj), MAIL_STREAM_GTKHTML_TYPE, MailStreamGtkHTML)) -#define MAIL_STREAM_GTKHTML_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), MAIL_STREAM_GTKHTML_TYPE, MailStreamGtkhTMLClass)) -#define MAIL_IS_STREAM_GTKHTML(o) (CAMEL_CHECK_TYPE((o), MAIL_STREAM_GTKHTML_TYPE)) - -typedef struct _MailStreamGtkHTML { - CamelStream parent_stream; - - GtkHTML *html; - GtkHTMLStream *html_stream; -} MailStreamGtkHTML; - -typedef struct { - CamelStreamClass parent_class; - -} MailStreamGtkHTMLClass; - - -CamelType mail_stream_gtkhtml_get_type (void); - -/* Note: stream does not ref these objects! */ -CamelStream *mail_stream_gtkhtml_new (GtkHTML *html, GtkHTMLStream *html_stream); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* MAIL_STREAM_GTKHTML_H */ diff --git a/mail/mail-summary.c b/mail/mail-summary.c deleted file mode 100644 index 7a6615f19d..0000000000 --- a/mail/mail-summary.c +++ /dev/null @@ -1,522 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* mail-summary.c - * - * Authors: Iain Holmes <iain@ximian.com> - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include <bonobo/bonobo-property-bag.h> - -#include "camel.h" -#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 <evolution-services/executive-summary-component.h> -#include <evolution-services/executive-summary-html-view.h> -#include <gal/widgets/e-unicode.h> - -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 ("<table><tr><td><b><a href=\"view://evolution:/local/Inbox\">%s</a>:</b>" - "<td align=\"right\">%d/%d</td></tr>", - 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 ("<tr><td><a href=\"view://%s\">%s</a>:</td>" - "<td align=\"right\">%d/%d</td></tr>", - 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, "</table>", 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 = EVOLUTION_DATADIR "/evolution/vfoldertypes.xml"; - - context = vfolder_context_new (); - rule_context_load ((RuleContext *)context, system, user); - g_free (user); - - 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 = e_utf8_from_locale_string (_("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 462e440a1a..0000000000 --- a/mail/mail-summary.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* mail-summary.h - * - * Authors: Iain Holmes <iain@ximian.com> - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <evolution-services/executive-summary-component.h> - -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 9d94fb1e78..0000000000 --- a/mail/mail-tools.c +++ /dev/null @@ -1,440 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Dan Winship <danw@ximian.com> - * Peter Williams <peterw@ximian.com> - * Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright 2000 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include <unistd.h> -#include <pthread.h> -#include <ctype.h> -#include <errno.h> -#include <gal/widgets/e-unicode.h> -#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 "mail-mt.h" -#include "mail-folder-cache.h" -#include "e-util/e-html-utils.h" - -/* **************************************** */ - -gchar * -mail_tool_get_local_movemail_path (void) -{ - static gint count = 0; - static pthread_mutex_t movemail_path_lock = PTHREAD_MUTEX_INITIALIZER; - gint my_count; - - /* Ah, the joys of being multi-threaded... */ - pthread_mutex_lock (&movemail_path_lock); - my_count = count; - ++count; - pthread_mutex_unlock (&movemail_path_lock); - - return g_strdup_printf ("%s/local/Inbox/movemail.%d", evolution_dir, my_count); -} - -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, 0, 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; -} - -CamelFolder * -mail_tool_get_trash (const gchar *url, int connect, CamelException *ex) -{ - CamelStore *store; - CamelFolder *trash; - - if (connect) - store = camel_session_get_store (session, url, ex); - else - store = (CamelStore *)camel_session_get_service(session, url, CAMEL_PROVIDER_STORE, ex); - - if (!store) - return NULL; - - if (connect || ((CamelService *)store)->status == CAMEL_SERVICE_CONNECTED) - trash = camel_store_get_trash (store, ex); - else - trash = NULL; - - camel_object_unref (CAMEL_OBJECT (store)); - - return trash; -} - -/* 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; - - g_return_val_if_fail (strncmp (source_url, "mbox:", 5) == 0, NULL); - - /* Set up our destination. */ - dest_path = mail_tool_get_local_movemail_path(); - - /* 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) { - unlink (dest_path); /* Clean up the movemail.foo file. */ - g_free (dest_path); - return NULL; - } - - if (camel_exception_is_set (ex)) { - g_free (dest_path); - return NULL; - } - - return dest_path; -} - -char * -mail_tool_generate_forward_subject (CamelMimeMessage *msg) -{ - const char *subject; - char *fwd_subj; - const int max_subject_length = 1024; - - subject = camel_mime_message_get_subject(msg); - - if (subject && *subject) { - /* Truncate insanely long subjects */ - if (strlen (subject) < max_subject_length) { - fwd_subj = g_strdup_printf ("[Fwd: %s]", subject); - } else { - /* We can't use %.*s because it depends on the locale being C/POSIX - or UTF-8 to work correctly in glibc */ - /*fwd_subj = g_strdup_printf ("[Fwd: %.*s...]", max_subject_length, subject);*/ - fwd_subj = g_malloc (max_subject_length + 11); - memcpy (fwd_subj, "[Fwd: ", 6); - memcpy (fwd_subj + 6, subject, max_subject_length); - memcpy (fwd_subj + 6 + max_subject_length, "...]", 5); - } - } else { - const CamelInternetAddress *from; - char *fromstr; - - from = camel_mime_message_get_from (msg); - if (from) { - fromstr = camel_address_format (CAMEL_ADDRESS (from)); - fwd_subj = g_strdup_printf ("[Fwd: %s]", fromstr); - g_free (fromstr); - } else - fwd_subj = g_strdup ("[Fwd: No Subject]"); - } - - return fwd_subj; -} - -XEvolution * -mail_tool_remove_xevolution_headers (CamelMimeMessage *message) -{ - XEvolution *xev; - - xev = g_new (XEvolution, 1); - xev->flags = g_strdup (camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution")); - xev->source = g_strdup (camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Source")); - xev->transport = g_strdup (camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Transport")); - xev->account = g_strdup (camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Account")); - xev->fcc = g_strdup (camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc")); - xev->format = g_strdup (camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Format")); - - /* rip off the X-Evolution* headers */ - camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution"); - camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Source"); - camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Transport"); - camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Account"); - camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc"); - camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Format"); - - return xev; -} - -void -mail_tool_restore_xevolution_headers (CamelMimeMessage *message, XEvolution *xev) -{ - if (xev->flags) - camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution", xev->flags); - if (xev->source) - camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Source", xev->source); - if (xev->transport) - camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Transport", xev->transport); - if (xev->account) - camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Account", xev->account); - if (xev->fcc) - camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc", xev->fcc); - if (xev->format) - camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Format", xev->format); -} - -void -mail_tool_destroy_xevolution (XEvolution *xev) -{ - g_free (xev->flags); - g_free (xev->source); - g_free (xev->transport); - g_free (xev->account); - g_free (xev->fcc); - g_free (xev); -} - -CamelMimePart * -mail_tool_make_message_attachment (CamelMimeMessage *message) -{ - CamelMimePart *part; - const char *subject; - XEvolution *xev; - char *desc; - - subject = camel_mime_message_get_subject (message); - if (subject) { - char *fmt; - - fmt = e_utf8_from_locale_string (_("Forwarded message - %s")); - desc = g_strdup_printf (fmt, subject); - g_free (fmt); - } else { - desc = e_utf8_from_locale_string (_("Forwarded message")); - } - - /* rip off the X-Evolution headers */ - xev = mail_tool_remove_xevolution_headers (message); - mail_tool_destroy_xevolution (xev); - - 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); - - return part; -} - -CamelFolder * -mail_tool_uri_to_folder (const char *uri, guint32 flags, CamelException *ex) -{ - CamelURL *url; - CamelStore *store = NULL; - CamelFolder *folder = NULL; - int offset = 0; - - g_return_val_if_fail (uri != NULL, NULL); - - /* This hack is still needed for file:/ since it's its own EvolutionStorage type */ - if (!strncmp (uri, "vtrash:", 7)) - offset = 7; - - url = camel_url_new (uri + offset, ex); - if (!url) { - return NULL; - } - - store = camel_session_get_store (session, uri + offset, ex); - if (store) { - const char *name; - - /* if we have a fragment, then the path is actually used by the store, - so the fragment is the path to the folder instead */ - if (url->fragment) { - name = url->fragment; - } else { - 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, flags, ex); - camel_object_unref (CAMEL_OBJECT (store)); - } - - if (folder) - mail_note_folder (folder); - - 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; - gchar *text; - - want_plain = !mail_config_get_send_html (); - contents = camel_medium_get_content_object (CAMEL_MEDIUM (message)); - /* We pass "want_plain" for "cite", since if it's HTML, we'll - * do the citing ourself below. - */ - text = mail_get_message_body (contents, want_plain, want_plain); - - /* 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); - } - - ret_text = g_strdup_printf ("%s<!--+GtkHTML:<DATA class=\"ClueFlow\" key=\"orig\" value=\"1\">-->" - "<font color=\"%06x\">\n%s%s%s</font>" - "<!--+GtkHTML:<DATA class=\"ClueFlow\" clear=\"orig\">-->", - credits ? credits : "", - mail_config_get_citation_color (), - want_plain ? "" : "<blockquote><i>", - text, - want_plain ? "" : "</i></blockquote>"); - g_free (text); - g_free (credits); - return ret_text; - } - - return NULL; -} - - -/** - * mail_tool_forward_message: - * @message: mime message to forward - * @quoted: whether to forwarded it quoted (%TRUE) or inline (%FALSE) - * - * Returns an allocated buffer containing the forwarded message. - */ -gchar * -mail_tool_forward_message (CamelMimeMessage *message, gboolean quoted) -{ - gchar *title, *body, *ret; - - body = mail_get_message_body (CAMEL_DATA_WRAPPER (message), - !mail_config_get_send_html (), - quoted); - title = e_utf8_from_locale_string (_("Forwarded Message")); - ret = g_strdup_printf ("-----%s-----<br>%s", title, body ? body : ""); - g_free (title); - g_free (body); - return ret; -} - - -/** - * mail_tools_x_evolution_message_parse: - * @in: GtkSelectionData->data - * @inlen: GtkSelectionData->length - * @uids: pointer to a gptrarray that will be filled with uids on success - * - * Parses the GtkSelectionData and returns a CamelFolder and a list of - * UIDs specified by the selection. - **/ -CamelFolder * -mail_tools_x_evolution_message_parse (char *in, unsigned int inlen, GPtrArray **uids) -{ - /* format: "uri\0uid1\0uid2\0uid3\0...\0uidn" */ - char *inptr, *inend; - CamelFolder *folder; - - if (in == NULL) - return NULL; - - folder = mail_tool_uri_to_folder (in, 0, NULL); - - if (!folder) - return NULL; - - /* split the uids */ - inend = in + inlen; - inptr = in + strlen (in) + 1; - *uids = g_ptr_array_new (); - while (inptr < inend) { - char *start = inptr; - - while (inptr < inend && *inptr) - inptr++; - - g_ptr_array_add (*uids, g_strndup (start, inptr - start)); - inptr++; - } - - return folder; -} diff --git a/mail/mail-tools.h b/mail/mail-tools.h deleted file mode 100644 index 1414eec99f..0000000000 --- a/mail/mail-tools.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Peter Williams <peterw@ximian.com> - * - * Copyright 2000 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <camel/camel.h> -#include <camel/camel-filter-driver.h> /*eek*/ - -typedef struct _xevolution { - char *flags; - char *source; - char *transport; - char *account; - char *fcc; - char *format; -} XEvolution; - -/* Get the filename for our movemail folder or storage */ -gchar *mail_tool_get_local_movemail_path (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); - -/* Get the "trash" for a url (uses global session) */ -CamelFolder *mail_tool_get_trash (const gchar *url, int connect, 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); - -XEvolution *mail_tool_remove_xevolution_headers (CamelMimeMessage *message); -void mail_tool_restore_xevolution_headers (CamelMimeMessage *message, XEvolution *xev); -void mail_tool_destroy_xevolution (XEvolution *xev); - -/* 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, guint32 flags, CamelException *ex); - -GHashTable * -mail_lookup_url_table (CamelMimeMessage *mime_message); - -gchar *mail_tool_quote_message (CamelMimeMessage *message, const char *fmt, ...); - -gchar *mail_tool_forward_message (CamelMimeMessage *message, gboolean quoted); - -CamelFolder *mail_tools_x_evolution_message_parse (char *in, unsigned int inlen, GPtrArray **uids); - -#endif diff --git a/mail/mail-types.h b/mail/mail-types.h deleted file mode 100644 index 1cb0bdad06..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 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 _MessageBrowser MessageBrowser; -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 c8788239a5..0000000000 --- a/mail/mail-vfolder.c +++ /dev/null @@ -1,958 +0,0 @@ -/* - Copyright 2000, 2001 Ximian Inc. - - Author: Michael Zucchi <notzed@ximian.com> - - code for managing vfolders - - NOTE: dont run this through fucking indent. -*/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-dialog-util.h> -#include <libgnomeui/gnome-stock.h> - -#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-folder-cache.h" -#include "mail.h" -#include "mail-ops.h" -#include "mail-mt.h" - -#include "gal/widgets/e-gui-utils.h" -#include "gal/util/e-unicode-i18n.h" - -#include "camel/camel.h" -#include "camel/camel-remote-store.h" -#include "camel/camel-vee-folder.h" -#include "camel/camel-vee-store.h" - -#include "filter/vfolder-context.h" -#include "filter/vfolder-editor.h" - -#define d(x) - -static VfolderContext *context; /* context remains open all time */ -static CamelStore *vfolder_store; /* the 1 static vfolder store */ - -/* lock for accessing shared resources (below) */ -static pthread_mutex_t vfolder_lock = PTHREAD_MUTEX_INITIALIZER; - -static GList *source_folders_remote; /* list of source folder uri's - remote ones */ -static GList *source_folders_local; /* list of source folder uri's - local ones */ -static GHashTable *vfolder_hash; - -extern EvolutionShellClient *global_shell_client; - -/* more globals ... */ -extern char *evolution_dir; -extern CamelSession *session; - -static void rule_changed(FilterRule *rule, CamelFolder *folder); - -#define LOCK() pthread_mutex_lock(&vfolder_lock); -#define UNLOCK() pthread_mutex_unlock(&vfolder_lock); - -/* ********************************************************************** */ - -struct _setup_msg { - struct _mail_msg msg; - - CamelFolder *folder; - char *query; - GList *sources_uri; - GList *sources_folder; -}; - -static char * -vfolder_setup_desc(struct _mail_msg *mm, int done) -{ - struct _setup_msg *m = (struct _setup_msg *)mm; - - return g_strdup_printf(_("Setting up vfolder: %s"), m->folder->full_name); -} - -static void -vfolder_setup_do(struct _mail_msg *mm) -{ - struct _setup_msg *m = (struct _setup_msg *)mm; - GList *l, *list = NULL; - CamelFolder *folder; - - d(printf("Setting up vfolder: %s\n", m->folder->full_name)); - - camel_vee_folder_set_expression((CamelVeeFolder *)m->folder, m->query); - - l = m->sources_uri; - while (l) { - d(printf(" Adding uri: %s\n", (char *)l->data)); - folder = mail_tool_uri_to_folder (l->data, 0, &mm->ex); - if (folder) { - list = g_list_append(list, folder); - } else { - g_warning("Could not open vfolder source: %s", (char *)l->data); - camel_exception_clear(&mm->ex); - } - l = l->next; - } - - l = m->sources_folder; - while (l) { - d(printf(" Adding folder: %s\n", ((CamelFolder *)l->data)->full_name)); - camel_object_ref((CamelObject *)l->data); - list = g_list_append(list, l->data); - l = l->next; - } - - camel_vee_folder_set_folders((CamelVeeFolder *)m->folder, list); - - l = list; - while (l) { - camel_object_unref((CamelObject *)l->data); - l = l->next; - } - g_list_free(list); -} - -static void -vfolder_setup_done(struct _mail_msg *mm) -{ - struct _setup_msg *m = (struct _setup_msg *)mm; - - m = m; -} - -static void -vfolder_setup_free (struct _mail_msg *mm) -{ - struct _setup_msg *m = (struct _setup_msg *)mm; - GList *l; - - camel_object_unref((CamelObject *)m->folder); - g_free(m->query); - - l = m->sources_uri; - while (l) { - g_free(l->data); - l = l->next; - } - g_list_free(m->sources_uri); - - l = m->sources_folder; - while (l) { - camel_object_unref(l->data); - l = l->next; - } - g_list_free(m->sources_folder); -} - -static struct _mail_msg_op vfolder_setup_op = { - vfolder_setup_desc, - vfolder_setup_do, - vfolder_setup_done, - vfolder_setup_free, -}; - -static int -vfolder_setup(CamelFolder *folder, const char *query, GList *sources_uri, GList *sources_folder) -{ - struct _setup_msg *m; - int id; - - m = mail_msg_new(&vfolder_setup_op, NULL, sizeof (*m)); - m->folder = folder; - camel_object_ref((CamelObject *)folder); - m->query = g_strdup(query); - m->sources_uri = sources_uri; - m->sources_folder = sources_folder; - - id = m->msg.seq; - e_thread_put(mail_thread_queued_slow, (EMsg *)m); - - return id; -} - -/* ********************************************************************** */ - -struct _adduri_msg { - struct _mail_msg msg; - - char *uri; - GList *folders; - int remove; -}; - -static char * -vfolder_adduri_desc(struct _mail_msg *mm, int done) -{ - struct _adduri_msg *m = (struct _adduri_msg *)mm; - - return g_strdup_printf(_("Updating vfolders for uri: %s"), m->uri); -} - -static void -vfolder_adduri_do(struct _mail_msg *mm) -{ - struct _adduri_msg *m = (struct _adduri_msg *)mm; - GList *l; - CamelFolder *folder = NULL; - extern CamelFolder *drafts_folder, *outbox_folder, *sent_folder; - - d(printf("%s uri to vfolder: %s\n", m->remove?"Removing":"Adding", m->uri)); - - /* we dont try lookup the cache if we are removing it, its no longer there */ - if (!m->remove && !mail_note_get_folder_from_uri(m->uri, &folder)) { - g_warning("Folder '%s' disappeared while I was adding/remove it to/from my vfolder", m->uri); - return; - } - - if (folder == NULL) - folder = mail_tool_uri_to_folder (m->uri, 0, &mm->ex); - - if (folder != NULL) { - if (folder != drafts_folder && folder != outbox_folder && folder != sent_folder) { - l = m->folders; - while (l) { - if (m->remove) - camel_vee_folder_remove_folder((CamelVeeFolder *)l->data, folder); - else - camel_vee_folder_add_folder((CamelVeeFolder *)l->data, folder); - l = l->next; - } - } - camel_object_unref((CamelObject *)folder); - } -} - -static void -vfolder_adduri_done(struct _mail_msg *mm) -{ - struct _adduri_msg *m = (struct _adduri_msg *)mm; - - m = m; -} - -static void -vfolder_adduri_free (struct _mail_msg *mm) -{ - struct _adduri_msg *m = (struct _adduri_msg *)mm; - - g_list_foreach(m->folders, (GFunc)camel_object_unref, NULL); - g_list_free(m->folders); - g_free(m->uri); -} - -static struct _mail_msg_op vfolder_adduri_op = { - vfolder_adduri_desc, - vfolder_adduri_do, - vfolder_adduri_done, - vfolder_adduri_free, -}; - -static int -vfolder_adduri(const char *uri, GList *folders, int remove) -{ - struct _adduri_msg *m; - int id; - - m = mail_msg_new(&vfolder_adduri_op, NULL, sizeof (*m)); - m->folders = folders; - m->uri = g_strdup(uri); - m->remove = remove; - - id = m->msg.seq; - e_thread_put(mail_thread_queued_slow, (EMsg *)m); - - return id; -} - -/* ********************************************************************** */ - -/* So, uh, apparently g_list_find_custom expect the compare func to return 0 to mean true? */ -static GList * -my_list_find(GList *l, const char *uri, GCompareFunc cmp) -{ - while (l) { - if (cmp(l->data, uri)) - break; - l = l->next; - } - return l; -} - -/* called when a new uri becomes (un)available */ -void -mail_vfolder_add_uri(CamelStore *store, const char *uri, int remove) -{ - FilterRule *rule; - const char *source; - CamelVeeFolder *vf; - GList *folders = NULL, *link; - int remote = (((CamelService *)store)->provider->flags & CAMEL_PROVIDER_IS_REMOTE) != 0; - GCompareFunc uri_cmp = CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->compare_folder_name; - - if (CAMEL_IS_VEE_STORE(store) || !strncmp(uri, "vtrash:", 7) || context == NULL) - return; - - g_assert(pthread_self() == mail_gui_thread); - - LOCK(); - - d(printf("%s uri to check: %s\n", remove?"Removing":"Adding", uri)); - - /* maintain the source folders lists for changed rules later on */ - if (remove) { - if (remote) { - if ((link = my_list_find(source_folders_remote, (void *)uri, uri_cmp)) != NULL) { - g_free(link->data); - source_folders_remote = g_list_remove_link(source_folders_remote, link); - } - } else { - if ((link = my_list_find(source_folders_local, (void *)uri, uri_cmp)) != NULL) { - g_free(link->data); - source_folders_local = g_list_remove_link(source_folders_local, link); - } - } - } else { - if (remote) { - if (my_list_find(source_folders_remote, (void *)uri, uri_cmp) == NULL) - source_folders_remote = g_list_prepend(source_folders_remote, g_strdup(uri)); - } else { - if (my_list_find(source_folders_local, (void *)uri, uri_cmp) == NULL) - source_folders_local = g_list_prepend(source_folders_local, g_strdup(uri)); - } - } - - rule = NULL; - while ((rule = rule_context_next_rule((RuleContext *)context, rule, NULL))) { - int found = FALSE; - - if (!rule->name) { - d(printf ("invalid rule (%p): rule->name is set to NULL\n")); - continue; - } - - if (rule->source - && ((!strcmp(rule->source, "local") && !remote) - || (!strcmp(rule->source, "remote_active") && remote) - || (!strcmp(rule->source, "local_remote_active")))) - found = TRUE; - - /* we check using the store uri_cmp since its more accurate */ - source = NULL; - while (!found && (source = vfolder_rule_next_source((VfolderRule *)rule, source))) - found = uri_cmp(uri, source); - - if (found) { - vf = g_hash_table_lookup(vfolder_hash, rule->name); - g_assert(vf); - camel_object_ref((CamelObject *)vf); - folders = g_list_prepend(folders, vf); - } - } - - UNLOCK(); - - if (folders != NULL) - vfolder_adduri(uri, folders, remove); -} - -/* called when a uri is deleted from a store */ -void -mail_vfolder_delete_uri(CamelStore *store, const char *uri) -{ - GCompareFunc uri_cmp = CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->compare_folder_name; - FilterRule *rule; - const char *source; - CamelVeeFolder *vf; - GString *changed; - - if (context == NULL || !strncmp(uri, "vtrash:", 7)) - return; - - d(printf("Deleting uri to check: %s\n", uri)); - - g_assert(pthread_self() == mail_gui_thread); - - changed = g_string_new(""); - - LOCK(); - - /* see if any rules directly reference this removed uri */ - rule = NULL; - while ( (rule = rule_context_next_rule((RuleContext *)context, rule, NULL)) ) { - source = NULL; - while ( (source = vfolder_rule_next_source((VfolderRule *)rule, source)) ) { - /* Remove all sources that match, ignore changed events though - because the adduri call above does the work async */ - if (uri_cmp(uri, source)) { - vf = g_hash_table_lookup(vfolder_hash, rule->name); - g_assert(vf); - gtk_signal_disconnect_by_func((GtkObject *)rule, rule_changed, vf); - vfolder_rule_remove_source((VfolderRule *)rule, source); - gtk_signal_connect((GtkObject *)rule, "changed", rule_changed, vf); - g_string_sprintfa(changed, " %s\n", rule->name); - source = NULL; - } - } - } - - UNLOCK(); - - if (changed->str[0]) { - GnomeDialog *gd; - char *text, *user; - - text = g_strdup_printf(_("The following vFolder(s):\n%s" - "Used the removed folder:\n '%s'\n" - "And have been updated."), - changed->str, uri); - - gd = (GnomeDialog *)gnome_warning_dialog(text); - g_free(text); - gnome_dialog_set_close(gd, TRUE); - gtk_widget_show((GtkWidget *)gd); - - user = g_strdup_printf("%s/vfolders.xml", evolution_dir); - rule_context_save((RuleContext *)context, user); - g_free(user); - } - - g_string_free(changed, TRUE); -} - -/* called when a uri is renamed in a store */ -void -mail_vfolder_rename_uri(CamelStore *store, const char *from, const char *to) -{ - GCompareFunc uri_cmp = CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->compare_folder_name; - FilterRule *rule; - const char *source; - CamelVeeFolder *vf; - int changed = 0; - - d(printf("vfolder rename uri: %s to %s\n", from, to)); - - if (context == NULL || !strncmp(from, "vtrash:", 7) || !strncmp(to, "vtrash:", 7)) - return; - - g_assert(pthread_self() == mail_gui_thread); - - LOCK(); - - /* see if any rules directly reference this removed uri */ - rule = NULL; - while ( (rule = rule_context_next_rule((RuleContext *)context, rule, NULL)) ) { - source = NULL; - while ( (source = vfolder_rule_next_source((VfolderRule *)rule, source)) ) { - /* Remove all sources that match, ignore changed events though - because the adduri call above does the work async */ - if (uri_cmp(from, source)) { - d(printf("Vfolder '%s' used '%s' ('%s') now uses '%s'\n", rule->name, source, from, to)); - vf = g_hash_table_lookup(vfolder_hash, rule->name); - g_assert(vf); - gtk_signal_disconnect_by_func((GtkObject *)rule, rule_changed, vf); - vfolder_rule_remove_source((VfolderRule *)rule, source); - vfolder_rule_add_source((VfolderRule *)rule, to); - gtk_signal_connect((GtkObject *)rule, "changed", rule_changed, vf); - changed++; - source = NULL; - } - } - } - - UNLOCK(); - - if (changed) { - char *user; - - d(printf("Vfolders updated from renamed folder\n")); - user = g_strdup_printf("%s/vfolders.xml", evolution_dir); - rule_context_save((RuleContext *)context, user); - g_free(user); - } -} - -/* ********************************************************************** */ - -static void context_rule_added(RuleContext *ctx, FilterRule *rule); - -static void -rule_changed(FilterRule *rule, CamelFolder *folder) -{ - const char *sourceuri; - GList *l; - GList *sources_uri = NULL, *sources_folder = NULL; - GString *query; - int i; - CamelFolder *newfolder; - - /* if the folder has changed name, then add it, then remove the old manually */ - if (strcmp(folder->full_name, rule->name) != 0) { - char *key, *oldname; - CamelFolder *old; - - LOCK(); - d(printf("Changing folder name in hash table to '%s'\n", rule->name)); - if (g_hash_table_lookup_extended(vfolder_hash, folder->full_name, (void **)&key, (void **)&old)) { - g_hash_table_remove(vfolder_hash, key); - g_free(key); - g_hash_table_insert(vfolder_hash, g_strdup(rule->name), folder); - UNLOCK(); - } else { - UNLOCK(); - g_warning("couldn't find a vfolder rule in our table? %s", folder->full_name); - } - - /* TODO: make the folder->full_name var thread accessible */ - oldname = g_strdup(folder->full_name); - camel_store_rename_folder(vfolder_store, oldname, rule->name, NULL); - g_free(oldname); - } - - d(printf("Filter rule changed? for folder '%s'!!\n", folder->name)); - - /* find any (currently available) folders, and add them to the ones to open */ - sourceuri = NULL; - while ( (sourceuri = vfolder_rule_next_source((VfolderRule *)rule, sourceuri)) ) { - if (mail_note_get_folder_from_uri(sourceuri, &newfolder)) { - if (newfolder) - sources_folder = g_list_append(sources_folder, newfolder); - else - sources_uri = g_list_append(sources_uri, g_strdup(sourceuri)); - } - } - - /* check the remote/local uri lists for any other uri's that should be looked at */ - if (rule->source) { - LOCK(); - for (i=0;i<2;i++) { - if (i==0 && (!strcmp(rule->source, "local") || !strcmp(rule->source, "local_remote_active"))) - l = source_folders_local; - else if (i==1 && (!strcmp(rule->source, "remote_active") || !strcmp(rule->source, "local_remote_active"))) - l = source_folders_remote; - else - l = NULL; - - while (l) { - if (mail_note_get_folder_from_uri(l->data, &newfolder)) { - if (newfolder) - sources_folder = g_list_append(sources_folder, newfolder); - else - sources_uri = g_list_append(sources_uri, g_strdup(l->data)); - } else { - d(printf(" -> No such folder?\n")); - } - l = l->next; - } - } - UNLOCK(); - } - - query = g_string_new(""); - filter_rule_build_code(rule, query); - - vfolder_setup(folder, query->str, sources_uri, sources_folder); - - g_string_free(query, TRUE); -} - -static void context_rule_added(RuleContext *ctx, FilterRule *rule) -{ - CamelFolder *folder; - - d(printf("rule added: %s\n", rule->name)); - - /* this always runs quickly */ - folder = camel_store_get_folder(vfolder_store, rule->name, 0, NULL); - if (folder) { - gtk_signal_connect((GtkObject *)rule, "changed", rule_changed, folder); - - LOCK(); - g_hash_table_insert(vfolder_hash, g_strdup(rule->name), folder); - UNLOCK(); - - mail_note_folder(folder); - rule_changed(rule, folder); - } -} - -static void context_rule_removed(RuleContext *ctx, FilterRule *rule) -{ - char *key, *path; - CamelFolder *folder; - - d(printf("rule removed; %s\n", rule->name)); - - /* TODO: remove from folder info cache? */ - - path = g_strdup_printf("/%s", rule->name); - evolution_storage_removed_folder(mail_lookup_storage(vfolder_store), path); - g_free(path); - - LOCK(); - if (g_hash_table_lookup_extended(vfolder_hash, rule->name, (void **)&key, (void **)&folder)) { - g_hash_table_remove(vfolder_hash, key); - g_free(key); - UNLOCK(); - camel_object_unref((CamelObject *)folder); - } else - UNLOCK(); - - camel_store_delete_folder(vfolder_store, rule->name, NULL); -} - -static void -store_folder_created(CamelObject *o, void *event_data, void *data) -{ - CamelStore *store = (CamelStore *)o; - CamelFolderInfo *info = event_data; - - store = store; - info = info; -} - -static void -store_folder_deleted(CamelObject *o, void *event_data, void *data) -{ - CamelStore *store = (CamelStore *)o; - CamelFolderInfo *info = event_data; - FilterRule *rule; - char *user; - - d(printf("Folder deleted: %s\n", info->name)); - store = store; - - /* Warning not thread safe, but might be enough */ - - LOCK(); - - /* delete it from our list */ - rule = rule_context_find_rule((RuleContext *)context, info->full_name, NULL); - if (rule) { - /* We need to stop listening to removed events, otherwise we'll try and remove it again */ - gtk_signal_disconnect_by_func((GtkObject *)context, context_rule_removed, context); - rule_context_remove_rule((RuleContext *)context, rule); - gtk_object_unref((GtkObject *)rule); - gtk_signal_connect((GtkObject *)context, "rule_removed", context_rule_removed, context); - - user = g_strdup_printf("%s/vfolders.xml", evolution_dir); - rule_context_save((RuleContext *)context, user); - g_free(user); - } else { - g_warning("Cannot find rule for deleted vfolder '%s'", info->name); - } - - UNLOCK(); -} - -static void -store_folder_renamed(CamelObject *o, void *event_data, void *data) -{ - CamelStore *store = (CamelStore *)o; - CamelRenameInfo *info = event_data; - FilterRule *rule; - char *user; - char *key; - CamelFolder *folder; - - store = store; - - /* This should be more-or-less thread-safe */ - - d(printf("Folder renamed to '%s' from '%s'\n", info->new->full_name, info->old_base)); - - /* Folder is already renamed? */ - LOCK(); - d(printf("Changing folder name in hash table to '%s'\n", info->new->full_name)); - if (g_hash_table_lookup_extended(vfolder_hash, info->old_base, (void **)&key, (void **)&folder)) { - g_hash_table_remove(vfolder_hash, key); - g_free(key); - g_hash_table_insert(vfolder_hash, g_strdup(info->new->full_name), folder); - - rule = rule_context_find_rule((RuleContext *)context, info->old_base, NULL); - g_assert(rule); - - gtk_signal_disconnect_by_func((GtkObject *)rule, rule_changed, folder); - filter_rule_set_name(rule, info->new->name); - gtk_signal_connect((GtkObject *)rule, "changed", rule_changed, folder); - - user = g_strdup_printf("%s/vfolders.xml", evolution_dir); - rule_context_save((RuleContext *)context, user); - g_free(user); - - UNLOCK(); - } else { - UNLOCK(); - g_warning("couldn't find a vfolder rule in our table? %s", info->new->full_name); - } -} - -void -vfolder_load_storage(GNOME_Evolution_Shell shell) -{ - char *user, *storeuri; - FilterRule *rule; - - vfolder_hash = g_hash_table_new(g_str_hash, g_str_equal); - - /* first, create the vfolder store, and set it up */ - storeuri = g_strdup_printf("vfolder:%s/vfolder", evolution_dir); - vfolder_store = camel_session_get_store(session, storeuri, NULL); - if (vfolder_store == NULL) { - g_warning("Cannot open vfolder store - no vfolders available"); - return; - } - - camel_object_hook_event((CamelObject *)vfolder_store, "folder_created", - (CamelObjectEventHookFunc)store_folder_created, NULL); - camel_object_hook_event((CamelObject *)vfolder_store, "folder_deleted", - (CamelObjectEventHookFunc)store_folder_deleted, NULL); - camel_object_hook_event((CamelObject *)vfolder_store, "folder_renamed", - (CamelObjectEventHookFunc)store_folder_renamed, NULL); - - d(printf("got store '%s' = %p\n", storeuri, vfolder_store)); - mail_load_storage_by_uri(shell, storeuri, U_("VFolders")); - - /* load our rules */ - user = g_strdup_printf ("%s/vfolders.xml", evolution_dir); - context = vfolder_context_new (); - if (rule_context_load ((RuleContext *)context, EVOLUTION_DATADIR "/evolution/vfoldertypes.xml", user) != 0) { - g_warning("cannot load vfolders: %s\n", ((RuleContext *)context)->error); - } - g_free (user); - - gtk_signal_connect((GtkObject *)context, "rule_added", context_rule_added, context); - gtk_signal_connect((GtkObject *)context, "rule_removed", context_rule_removed, context); - - /* and setup the rules we have */ - rule = NULL; - while ( (rule = rule_context_next_rule((RuleContext *)context, rule, NULL)) ) { - if (rule->name) - context_rule_added((RuleContext *)context, rule); - else - d(printf ("invalid rule (%p) encountered: rule->name is NULL\n")); - } - - g_free(storeuri); -} - -static GtkWidget *vfolder_editor = NULL; - -static void -vfolder_editor_destroy (GtkWidget *widget, gpointer user_data) -{ - vfolder_editor = NULL; -} - -static void -vfolder_editor_clicked (GtkWidget *dialog, 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); - } - if (button != -1) { - gnome_dialog_close (GNOME_DIALOG (dialog)); - } -} - -void -vfolder_edit (void) -{ - if (vfolder_editor) { - gdk_window_raise (GTK_WIDGET (vfolder_editor)->window); - return; - } - - vfolder_editor = GTK_WIDGET (vfolder_editor_new (context)); - gtk_signal_connect (GTK_OBJECT (vfolder_editor), "clicked", vfolder_editor_clicked, NULL); - gtk_signal_connect (GTK_OBJECT (vfolder_editor), "destroy", vfolder_editor_destroy, NULL); - gtk_widget_show (vfolder_editor); -} - -static void -edit_rule_clicked(GtkWidget *w, int button, void *data) -{ - if (button == 0) { - char *user; - FilterRule *rule = gtk_object_get_data((GtkObject *)w, "rule"); - FilterRule *orig = gtk_object_get_data((GtkObject *)w, "orig"); - - filter_rule_copy(orig, rule); - user = g_strdup_printf("%s/vfolders.xml", evolution_dir); - rule_context_save((RuleContext *)context, user); - g_free(user); - } - if (button != -1) { - gnome_dialog_close((GnomeDialog *)w); - } -} - -void -vfolder_edit_rule(const char *uri) -{ - GtkWidget *w; - GnomeDialog *gd; - FilterRule *rule, *newrule; - CamelURL *url; - - url = camel_url_new(uri, NULL); - if (url && url->fragment - && (rule = rule_context_find_rule((RuleContext *)context, url->fragment, NULL))) { - gtk_object_ref((GtkObject *)rule); - newrule = filter_rule_clone(rule); - - w = filter_rule_get_widget((FilterRule *)newrule, (RuleContext *)context); - - gd = (GnomeDialog *)gnome_dialog_new(_("Edit 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", newrule, (GtkDestroyNotify)gtk_object_unref); - gtk_object_set_data_full((GtkObject *)gd, "orig", rule, (GtkDestroyNotify)gtk_object_unref); - gtk_signal_connect((GtkObject *)gd, "clicked", edit_rule_clicked, NULL); - gtk_widget_show((GtkWidget *)gd); - } else { - e_notice (NULL, GNOME_MESSAGE_BOX_WARNING, - _("Trying to edit a vfolder '%s' which doesn't exist."), uri); - } - - if (url) - camel_url_free(url); -} - -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); - } - 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 = (FilterRule *)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); -} - -static void -vfolder_foreach_cb (gpointer key, gpointer data, gpointer user_data) -{ - CamelFolder *folder = CAMEL_FOLDER (data); - - if (folder) - camel_object_unref (CAMEL_OBJECT (folder)); - - g_free (key); -} - -void -mail_vfolder_shutdown (void) -{ - g_hash_table_foreach (vfolder_hash, vfolder_foreach_cb, NULL); - g_hash_table_destroy (vfolder_hash); - vfolder_hash = NULL; - - if (vfolder_store) { - camel_object_unref (CAMEL_OBJECT (vfolder_store)); - vfolder_store = NULL; - } - - if (context) { - gtk_object_unref (GTK_OBJECT (context)); - context = NULL; - } -} diff --git a/mail/mail-vfolder.h b/mail/mail-vfolder.h deleted file mode 100644 index 9561185c4a..0000000000 --- a/mail/mail-vfolder.h +++ /dev/null @@ -1,36 +0,0 @@ - -#ifndef _MAIL_VFOLDER_H -#define _MAIL_VFOLDER_H - -#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_load_storage(GNOME_Evolution_Shell shell); - -void vfolder_edit (void); -void vfolder_edit_rule(const char *name); -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); - -/* add a uri that is now (un)available to vfolders in a transient manner */ -void mail_vfolder_add_uri(CamelStore *store, const char *uri, int remove); - -/* note that a folder has changed name (uri) */ -void mail_vfolder_rename_uri(CamelStore *store, const char *from, const char *to); - -/* remove a uri that should be removed from vfolders permanently */ -void mail_vfolder_delete_uri(CamelStore *store, const char *uri); - -/* close up, clean up */ -void mail_vfolder_shutdown (void); - -#endif diff --git a/mail/mail.h b/mail/mail.h deleted file mode 100644 index 97713013c0..0000000000 --- a/mail/mail.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright 2000, Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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. - */ - -/* This file is a F*CKING MESS. Shame to us! */ - -#include <libgnomevfs/gnome-vfs-mime-handlers.h> -#include <gtkhtml/gtkhtml.h> -#include <camel/camel.h> -#include <composer/e-msg-composer.h> -#include <shell/evolution-storage.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" - -extern char *evolution_dir; - -/* mail-format */ -GByteArray *mail_format_get_data_wrapper_text (CamelDataWrapper *data, - MailDisplay *mail_display); - -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, - gboolean redisplay, - const gchar *url, - GtkHTMLStream *handle); - -typedef gboolean (*MailMimeHandlerFn) (CamelMimePart *part, - const char *mime_type, - MailDisplay *md); -typedef struct { - gboolean generic; - OAF_ServerInfo *component; - GList *applications; - MailMimeHandlerFn builtin; -} MailMimeHandler; -MailMimeHandler *mail_lookup_handler (const char *mime_type); - -gboolean mail_part_is_inline (CamelMimePart *part); -gboolean mail_part_is_displayed_inline (CamelMimePart *part, MailDisplay *md); -void mail_part_toggle_displayed (CamelMimePart *part, MailDisplay *md); - -char *mail_get_message_body (CamelDataWrapper *data, gboolean want_plain, gboolean cite); - -/* mail-identify */ -char *mail_identify_mime_part (CamelMimePart *part, MailDisplay *md); - -/* component factory for lack of a better place */ -void mail_load_storage_by_uri (GNOME_Evolution_Shell shell, const char *uri, const char *name); -/*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); -void mail_remove_storage_by_uri (const char *uri); -void mail_remove_storage (CamelStore *store); -void mail_storages_foreach (GHFunc func, gpointer data); -int mail_storages_count (void); - -gboolean evolution_folder_info_factory_init (void); - diff --git a/mail/main.c b/mail/main.c deleted file mode 100644 index ef3f7f0ab4..0000000000 --- a/mail/main.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * main.c: The core of the mail component - * - * Author: - * Miguel de Icaza (miguel@ximian.com) - * - * (C) 2000 Ximian, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <signal.h> - -#include <libgnome/gnome-defs.h> -#include <libgnomeui/gnome-init.h> -#include <bonobo/bonobo-main.h> -#include <bonobo/bonobo-object-directory.h> -#include <glade/glade.h> -#include <liboaf/liboaf.h> -#include <libgnomevfs/gnome-vfs.h> - -#ifdef GTKHTML_HAVE_GCONF -#include <gconf/gconf.h> -#endif - -#include <gal/widgets/e-gui-utils.h> -#include <gal/widgets/e-cursors.h> -#include <gal/widgets/e-unicode.h> - -#include "e-util/e-passwords.h" - -#include "component-factory.h" -#include "composer/evolution-composer.h" -#include "mail.h" -#include "mail-mt.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 GStaticMutex segv_mutex = G_STATIC_MUTEX_INIT; - -static void -segv_redirect (int sig) -{ - if (pthread_self () == mail_gui_thread) - gnome_segv_handler (sig); - else { - pthread_kill (mail_gui_thread, sig); - /* We can't return from the signal handler or the - * thread may SEGV again. But we can't pthread_exit, - * because then the thread may get cleaned up before - * bug-buddy can get a stack trace. So we block by - * trying to lock a mutex we know is already locked. - */ - g_static_mutex_lock (&segv_mutex); - } -} - -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); - - sigaction (SIGSEGV, NULL, &osa); - if (osa.sa_handler != SIG_DFL) { - sa.sa_flags = 0; - sigemptyset (&sa.sa_mask); - sa.sa_handler = segv_redirect; - sigaction (SIGSEGV, &sa, NULL); - sigaction (SIGBUS, &sa, NULL); - sigaction (SIGFPE, &sa, NULL); - gnome_segv_handler = osa.sa_handler; - g_static_mutex_lock (&segv_mutex); - } - - 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 (); - - e_passwords_init ("Mail"); - - mail_config_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 (); - - mail_msg_cleanup(); - - GDK_THREADS_LEAVE (); - - mail_config_write_on_exit (); - - e_passwords_shutdown (); - - return 0; -} diff --git a/mail/message-browser.c b/mail/message-browser.c deleted file mode 100644 index 10ec477e7e..0000000000 --- a/mail/message-browser.c +++ /dev/null @@ -1,359 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include <gal/util/e-util.h> -#include <gal/widgets/e-unicode.h> - -#include <bonobo/bonobo-exception.h> -#include <bonobo/bonobo-ui-component.h> -#include <bonobo/bonobo-ui-container.h> -#include <bonobo/bonobo-ui-util.h> - -#include "message-browser.h" - -#include "mail.h" -#include "mail-callbacks.h" -#include "mail-tools.h" -#include "message-list.h" -#include "mail-ops.h" -#include "mail-vfolder.h" -#include "mail-autofilter.h" -#include "mail-mt.h" - -#include "mail-local.h" -#include "mail-config.h" - -#include "folder-browser-ui.h" - -#define d(x) - -#define MINIMUM_WIDTH 600 -#define MINIMUM_HEIGHT 400 - -#define PARENT_TYPE BONOBO_TYPE_WINDOW - -/* Size of the window last time it was changed. */ -static GtkAllocation last_allocation = { 0, 0 }; - -static BonoboWindowClass *message_browser_parent_class; - -static void -message_browser_destroy (GtkObject *object) -{ - MessageBrowser *message_browser; - - message_browser = MESSAGE_BROWSER (object); - - gtk_object_unref (GTK_OBJECT (message_browser->fb)); - - if (GTK_OBJECT_CLASS (message_browser_parent_class)->destroy) - (GTK_OBJECT_CLASS (message_browser_parent_class)->destroy) (object); -} - -static void -message_browser_class_init (GtkObjectClass *object_class) -{ - object_class->destroy = message_browser_destroy; - - message_browser_parent_class = gtk_type_class (PARENT_TYPE); -} - -static void -message_browser_init (GtkObject *object) -{ - -} - -static void -transfer_msg_done (gboolean ok, void *data) -{ - MessageBrowser *mb = data; - int row; - - if (ok && !GTK_OBJECT_DESTROYED (mb)) { - row = e_tree_row_of_node (mb->fb->message_list->tree, - e_tree_get_cursor (mb->fb->message_list->tree)); - - /* If this is the last message and deleted messages - are hidden, select the previous */ - if ((row + 1 == e_tree_row_count (mb->fb->message_list->tree)) - && mail_config_get_hide_deleted ()) - message_list_select (mb->fb->message_list, row, MESSAGE_LIST_SELECT_PREVIOUS, - 0, CAMEL_MESSAGE_DELETED, FALSE); - else - message_list_select (mb->fb->message_list, row, MESSAGE_LIST_SELECT_NEXT, - 0, 0, FALSE); - } - - gtk_object_unref (GTK_OBJECT (mb)); -} - -static void -transfer_msg (MessageBrowser *mb, int del) -{ - const char *allowed_types[] = { "mail", "vtrash", NULL }; - extern EvolutionShellClient *global_shell_client; - char *uri, *physical, *path, *desc; - static char *last = NULL; - GPtrArray *uids; - - if (GTK_OBJECT_DESTROYED(mb)) - return; - - if (last == NULL) - last = g_strdup (""); - - if (del) - desc = _("Move message(s) to"); - else - desc = _("Copy message(s) to"); - - uri = NULL; - physical = NULL; - evolution_shell_client_user_select_folder (global_shell_client, - GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (mb))), - desc, last, - allowed_types, &uri, &physical); - if (!uri) - return; - - path = strchr (uri, '/'); - if (path && strcmp (last, path) != 0) { - g_free (last); - last = g_strdup_printf ("evolution:%s", path); - } - g_free (uri); - - uids = g_ptr_array_new (); - message_list_foreach (mb->fb->message_list, enumerate_msg, uids); - - if (del) { - gtk_object_ref (GTK_OBJECT (mb)); - mail_transfer_messages (mb->fb->folder, uids, del, - physical, 0, transfer_msg_done, mb); - } else { - mail_transfer_messages (mb->fb->folder, uids, del, - physical, 0, NULL, NULL); - } - g_free(physical); -} - - -/* UI callbacks */ - -static void -message_browser_close (BonoboUIComponent *uih, void *user_data, const char *path) -{ - gtk_widget_destroy (GTK_WIDGET (user_data)); -} - -static void -message_browser_move (BonoboUIComponent *uih, void *user_data, const char *path) -{ - transfer_msg(user_data, TRUE); -} - -static void -message_browser_copy (BonoboUIComponent *uih, void *user_data, const char *path) -{ - transfer_msg(user_data, FALSE); -} - -static BonoboUIVerb -browser_verbs [] = { - BONOBO_UI_UNSAFE_VERB ("MessageBrowserClose", message_browser_close), - BONOBO_UI_UNSAFE_VERB ("MessageMove", message_browser_move), - BONOBO_UI_UNSAFE_VERB ("MessageCopy", message_browser_copy), - BONOBO_UI_VERB_END -}; - -/* FB message loading hookups */ - -static void -message_browser_message_loaded (FolderBrowser *fb, const char *uid, MessageBrowser *mb) -{ - CamelMimeMessage *message; - char *subject = NULL; - char *title; - - folder_browser_ui_message_loaded(fb); - - message = fb->mail_display->current_message; - - if (message) - subject = (char *) camel_mime_message_get_subject (message); - - if (subject != NULL) - subject = e_utf8_to_gtk_string (GTK_WIDGET (mb), subject); - else - subject = g_strdup (_("(No subject)")); - - title = g_strdup_printf (_("%s - Message"), subject); - g_free (subject); - - gtk_window_set_title (GTK_WINDOW (mb), title); - - g_free (title); -} - -static void -message_browser_message_list_built (MessageList *ml, MessageBrowser *mb) -{ - const char *uid = gtk_object_get_data (GTK_OBJECT (mb), "uid"); - - gtk_signal_disconnect_by_func (GTK_OBJECT (ml), message_browser_message_list_built, mb); - - message_list_select_uid (ml, uid); -} - -static void -message_browser_folder_loaded (FolderBrowser *fb, const char *uri, MessageBrowser *mb) -{ - gtk_signal_connect (GTK_OBJECT (fb->message_list), "message_list_built", - message_browser_message_list_built, mb); -} - -static void -message_browser_size_allocate_cb (GtkWidget *widget, - GtkAllocation *allocation) -{ - last_allocation = *allocation; - -} - -/* Construction */ - -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); -} - -static void -set_bonobo_ui (GtkWidget *widget, FolderBrowser *fb) -{ - BonoboUIContainer *uicont; - BonoboUIComponent *uic; - CORBA_Environment ev; - - uicont = bonobo_ui_container_new (); - bonobo_ui_container_set_win (uicont, BONOBO_WINDOW (widget)); - - uic = bonobo_ui_component_new_default (); - bonobo_ui_component_set_container (uic, BONOBO_OBJREF (uicont)); - folder_browser_set_ui_component (fb, uic); - - /* Load our UI */ - - /*bonobo_ui_component_freeze (uic, NULL);*/ - bonobo_ui_util_set_ui (uic, EVOLUTION_DATADIR, "evolution-mail-messagedisplay.xml", "evolution-mail"); - - /* Load the appropriate UI stuff from the folder browser */ - - folder_browser_ui_add_message (fb); - - /* We just opened the message! We don't need to open it again. */ - - CORBA_exception_init (&ev); - bonobo_ui_component_rm (uic, "/menu/File/FileOps/MessageOpen", &ev); - if (BONOBO_EX (&ev)) - g_warning ("Couldn't remove message open item. Weird. Error: %s", - bonobo_exception_get_text (&ev)); - CORBA_exception_free (&ev); - - /* Hack around the move/copy commands api's */ - bonobo_ui_component_remove_listener (uic, "MessageCopy"); - bonobo_ui_component_remove_listener (uic, "MessageMove"); - - /* Add the Close & Move/Copy items */ - - bonobo_ui_component_add_verb_list_with_data (uic, browser_verbs, widget); - - /* Done */ - - /*bonobo_ui_component_thaw (uic, NULL);*/ - -} - -GtkWidget * -message_browser_new (const GNOME_Evolution_Shell shell, const char *uri, const char *uid) -{ - GtkWidget *vbox; - MessageBrowser *new; - FolderBrowser *fb; - - new = gtk_type_new (MESSAGE_BROWSER_TYPE); - new = (MessageBrowser *) bonobo_window_construct (BONOBO_WINDOW (new), "Ximian Evolution", ""); - if (!new) { - g_warning ("Failed to construct Bonobo window!"); - return NULL; - } - - gtk_object_set_data_full (GTK_OBJECT (new), "uid", g_strdup (uid), g_free); - - fb = FOLDER_BROWSER (folder_browser_new (shell, uri)); - new->fb = fb; - - set_bonobo_ui (GTK_WIDGET (new), fb); - - /* some evil hackery action... */ - vbox = gtk_vbox_new (TRUE, 0); - gtk_widget_ref (GTK_WIDGET (fb->mail_display)); - gtk_widget_reparent (GTK_WIDGET (fb->mail_display), vbox); - /* Note: normally we'd unref the fb->mail_display now, except - that if we do then our refcounts will not be in - harmony... both the fb *and* the message-browser need to - own a ref on the mail_display. */ - gtk_widget_show (GTK_WIDGET (fb->mail_display)); - gtk_widget_show (vbox); - - gtk_signal_connect (GTK_OBJECT (new), "size_allocate", - GTK_SIGNAL_FUNC (message_browser_size_allocate_cb), NULL); - - bonobo_window_set_contents (BONOBO_WINDOW (new), vbox); - gtk_widget_grab_focus (GTK_WIDGET (MAIL_DISPLAY (fb->mail_display)->html)); - - set_default_size (GTK_WIDGET (new)); - - /* more evil hackery... */ - gtk_signal_connect (GTK_OBJECT (fb), "folder_loaded", - message_browser_folder_loaded, new); - - gtk_signal_connect (GTK_OBJECT (fb), "message_loaded", - message_browser_message_loaded, new); - - return GTK_WIDGET (new); -} - -/* Fin */ - -E_MAKE_TYPE (message_browser, "MessageBrowser", MessageBrowser, message_browser_class_init, - message_browser_init, PARENT_TYPE); diff --git a/mail/message-browser.h b/mail/message-browser.h deleted file mode 100644 index d9a54b0900..0000000000 --- a/mail/message-browser.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright 2001 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 _MESSAGE_BROWSER_H_ -#define _MESSAGE_BROWSER_H_ - -#include <gnome.h> -#include <bonobo/bonobo-win.h> - -#include <camel/camel-folder.h> -#include "folder-browser.h" -#include "mail-display.h" -#include "mail-types.h" - -#define MESSAGE_BROWSER_TYPE (message_browser_get_type ()) -#define MESSAGE_BROWSER(o) (GTK_CHECK_CAST ((o), MESSAGE_BROWSER_TYPE, MessageBrowser)) -#define MESSAGE_BROWSER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), MESSAGE_BROWSER_TYPE, MessageBrowserClass)) -#define IS_MESSAGE_BROWSER(o) (GTK_CHECK_TYPE ((o), MESSAGE_BROWSER_TYPE)) -#define IS_MESSAGE_BROWSER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MESSAGE_BROWSER_TYPE)) - -struct _MessageBrowser { - BonoboWindow parent; - - /* - * The current URI being displayed by the MessageBrowser - */ - FolderBrowser *fb; -}; - - -typedef struct { - BonoboWindowClass parent_class; - -} MessageBrowserClass; - -GtkType message_browser_get_type (void); - -GtkWidget *message_browser_new (const GNOME_Evolution_Shell shell, - const char *uri, const char *uid); - -#endif /* _MESSAGE_BROWSER_H_ */ - diff --git a/mail/message-list.c b/mail/message-list.c deleted file mode 100644 index 61ff949ac5..0000000000 --- a/mail/message-list.c +++ /dev/null @@ -1,2543 +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@ximian.com) - * Bertrand Guiheneuf (bg@aful.org) - * And just about everyone else in evolution ... - * - * (C) 2000 Ximian, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <string.h> -#include <ctype.h> - -#include <gal/util/e-util.h> -#include <gal/widgets/e-gui-utils.h> -#include <gal/e-table/e-cell-text.h> -#include <gal/e-table/e-cell-toggle.h> -#include <gal/e-table/e-cell-checkbox.h> -#include <gal/e-table/e-cell-tree.h> -#include <gal/e-table/e-cell-date.h> -#include <gal/e-table/e-cell-size.h> -#include <gal/e-table/e-tree-memory.h> -#include <gal/e-table/e-tree-memory-callbacks.h> -#include <gal/unicode/gunicode.h> - -#include <camel/camel-exception.h> -#include <camel/camel-file-utils.h> -#include <camel/camel-folder.h> -#include <camel/camel-folder-thread.h> -#include <e-util/ename/e-name-western.h> -#include <e-util/e-memory.h> - -#include "mail-config.h" -#include "message-list.h" -#include "mail-mt.h" -#include "mail-tools.h" -#include "mail-ops.h" -#include "Mail.h" - -#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 <sys/time.h> -#include <unistd.h> -#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_tree_scrolled_get_type ()) - -/* #define SMART_ADDRESS_COMPARE */ - -#ifdef SMART_ADDRESS_COMPARE -struct _EMailAddress { - ENameWestern *wname; - gchar *address; -}; - -typedef struct _EMailAddress EMailAddress; -#endif /* SMART_ADDRESS_COMPARE */ - -static ETreeScrolledClass *message_list_parent_class; - -static void on_cursor_activated_cmd (ETree *tree, int row, ETreePath path, gpointer user_data); -static gint on_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, MessageList *list); -static char *filter_date (time_t date); -static char *filter_size (int size); - -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); - -static void clear_info(char *key, ETreePath *node, MessageList *ml); - -enum { - MESSAGE_SELECTED, - MESSAGE_LIST_BUILT, - 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 } -}; - -#ifdef SMART_ADDRESS_COMPARE -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); - - return g_strcasecmp (addr1->address, addr2->address); - } - - if (!addr1->wname) - return -1; - if (!addr2->wname) - return 1; - - 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); - - return g_strcasecmp (addr1->address, addr2->address); - } - - if (!addr1->wname->last) - return -1; - if (!addr2->wname->last) - return 1; - - retval = g_utf8_collate (addr1->wname->last, addr2->wname->last); - if (retval) - return retval; - - /* last names are identical - compare first names */ - - if (!addr1->wname->first && !addr2->wname->first) - return g_strcasecmp (addr1->address, addr2->address); - - if (!addr1->wname->first) - return -1; - if (!addr2->wname->first) - return 1; - - retval = g_utf8_collate (addr1->wname->first, addr2->wname->first); - if (retval) - return retval; - - return g_strcasecmp (addr1->address, addr2->address); -} -#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_utf8_collate ((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 */ - while (*sub1 && g_unichar_isspace (g_utf8_get_char (sub1))) - sub1 = g_utf8_next_char (sub1); - } - - /* trim off any "Re:"'s at the beginning of subject2 */ - sub2 = (char *) subject2; - while (!g_strncasecmp (sub2, "Re:", 3)) { - sub2 += 3; - while (*sub2 && g_unichar_isspace (g_utf8_get_char (sub2))) - sub2 = g_utf8_next_char (sub2); - } - - /* jump over any spaces */ - while (*sub1 && g_unichar_isspace (g_utf8_get_char (sub1))) - sub1 = g_utf8_next_char (sub1); - while (*sub2 && g_unichar_isspace (g_utf8_get_char (sub2))) - sub2 = g_utf8_next_char (sub2); - - return g_utf8_collate (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, ETreePath node) -{ - CamelMessageInfo *info; - - g_assert (node != NULL); - info = e_tree_memory_node_get_data (E_TREE_MEMORY (message_list->model), node); - /* correct me if I'm wrong, but this should never be NULL, should it? */ - g_assert (info != NULL); - - return camel_message_info_uid (info); -} - -/* Gets the CamelMessageInfo for the message displayed at the given - * view row. - */ -static CamelMessageInfo * -get_message_info (MessageList *message_list, ETreePath node) -{ - CamelMessageInfo *info; - - g_assert (node != NULL); - info = e_tree_memory_node_get_data (E_TREE_MEMORY (message_list->model), node); - g_assert (info != NULL); - - return info; -} - -/** - * 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 - * @wraparound: if %TRUE, go back to the beginning for - * the next match if necessary. - * - * 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. - **/ -void -message_list_select (MessageList *message_list, - int base_row, - MessageListSelectDirection direction, - guint32 flags, - guint32 mask, - gboolean wraparound) -{ - CamelMessageInfo *info; - int vrow, last; - - if (!GTK_WIDGET_HAS_FOCUS (message_list)) - gtk_widget_grab_focus (GTK_WIDGET (message_list)); - - switch (direction) { - case MESSAGE_LIST_SELECT_PREVIOUS: - last = -1; - break; - case MESSAGE_LIST_SELECT_NEXT: - last = e_tree_row_count (message_list->tree); - if (last <= base_row) - return; - break; - default: - g_warning("Invalid argument to message_list_select"); - return; - } - - /* If it's -1, we want the last view row, not the last model row. */ - /* model_to_view_row etc simply dont work for sorted views. Sigh. */ - if (base_row == -1) - vrow = e_tree_row_count (message_list->tree) - 1; - else - vrow = e_tree_model_to_view_row (message_list->tree, base_row); - - if (vrow <= -1) - return; - - /* 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) { - ETreePath node = e_tree_node_at_row (message_list->tree, vrow); - - info = get_message_info (message_list, node); - - if (info && (info->flags & mask) == flags) { - e_tree_set_cursor (message_list->tree, node); - - gtk_signal_emit (GTK_OBJECT (message_list), message_list_signals[MESSAGE_SELECTED], - camel_message_info_uid (info)); - return; - } - vrow += direction; - } - - if (wraparound) { - if (direction == MESSAGE_LIST_SELECT_PREVIOUS) - base_row = -1; - else - base_row = 0; - - message_list_select (message_list, base_row, direction, flags, mask, FALSE); - } -} - - -/** - * message_list_select_uid: - * @message_list: - * @uid: - * - * Selects the message with the given UID. - **/ -void -message_list_select_uid (MessageList *message_list, const char *uid) -{ - ETreePath node; - - node = g_hash_table_lookup (message_list->uid_nodemap, uid); - if (node) { - CamelMessageInfo *info; - - info = get_message_info (message_list, node); - e_tree_set_cursor (message_list->tree, node); - - g_free (message_list->cursor_uid); - message_list->cursor_uid = g_strdup (camel_message_info_uid (info)); - - gtk_signal_emit (GTK_OBJECT (message_list), message_list_signals[MESSAGE_SELECTED], - camel_message_info_uid (info)); - } else { - g_free (message_list->cursor_uid); - message_list->cursor_uid = NULL; - gtk_signal_emit (GTK_OBJECT (message_list), message_list_signals[MESSAGE_SELECTED], NULL); - } -} - -/* - * SimpleTableModel::col_count - */ -static int -ml_column_count (ETreeModel *etm, void *data) -{ - return COL_LAST; -} - -/* - * SimpleTableModel::has_save_id - */ -static gboolean -ml_has_save_id (ETreeModel *etm, void *data) -{ - return TRUE; -} - -/* - * SimpleTableModel::get_save_id - */ -static char * -ml_get_save_id (ETreeModel *etm, ETreePath path, void *data) -{ - CamelMessageInfo *info; - - info = e_tree_memory_node_get_data (E_TREE_MEMORY(etm), path); - if (info == NULL) - return g_strdup("root"); - return g_strdup (camel_message_info_uid(info)); -} - -/* - * SimpleTableModel::has_save_id - */ -static gboolean -ml_has_get_node_by_id (ETreeModel *etm, void *data) -{ - return TRUE; -} - -/* - * SimpleTableModel::get_save_id - */ -static ETreePath -ml_get_node_by_id (ETreeModel *etm, const char *save_id, void *data) -{ - MessageList *ml; - - ml = data; - - if (!strcmp (save_id, "root")) - return e_tree_model_get_root (etm); - - return g_hash_table_lookup(ml->uid_nodemap, save_id); -} - -static void * -ml_duplicate_value (ETreeModel *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 (ETreeModel *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 (ETreeModel *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 (ETreeModel *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 const char *status_map[] = { - N_("Unseen"), - N_("Seen"), - N_("Answered"), - N_("Multiple Unseen Messages"), - N_("Multiple Messages"), -}; - -static const char *score_map[] = { - N_("Lowest"), - N_("Lower"), - N_("Low"), - N_("Normal"), - N_("High"), - N_("Higher"), - N_("Highest"), -}; - -static char * -ml_value_to_string (ETreeModel *etm, int col, const void *value, void *data) -{ - unsigned int i; - - switch (col){ - case COL_MESSAGE_STATUS: - i = (unsigned int)value; - if (i > 4) - return g_strdup(""); - return g_strdup(_(status_map[i])); - - case COL_SCORE: - i = (unsigned int)value + 3; - if (i > 6) - i = 3; - return g_strdup(_(score_map[i])); - - 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; - ETreePath child; - - while (node) { - info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node); - g_assert(info); - - if (!(info->flags & CAMEL_MESSAGE_SEEN)) - return TRUE; - - if ((child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->model), node))) - if (subtree_unread(ml, child)) - return TRUE; - node = e_tree_model_node_get_next (ml->model, node); - } - return FALSE; -} - -static int -subtree_size(MessageList *ml, ETreePath node) -{ - CamelMessageInfo *info; - int size = 0; - ETreePath child; - - while (node) { - info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node); - g_assert(info); - - size += info->size; - if ((child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->model), node))) - size += subtree_size(ml, child); - - node = e_tree_model_node_get_next (ml->model, node); - } - return size; -} - -static time_t -subtree_earliest(MessageList *ml, ETreePath node, int sent) -{ - CamelMessageInfo *info; - time_t earliest = 0, date; - ETreePath *child; - - while (node) { - info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node); - g_assert(info); - - if (sent) - date = info->date_sent; - else - date = info->date_received; - - if (earliest == 0 || date < earliest) - earliest = date; - - if ((child = e_tree_model_node_get_first_child (ml->model, node))) { - date = subtree_earliest(ml, child, sent); - if (earliest == 0 || (date != 0 && date < earliest)) - earliest = date; - } - - node = e_tree_model_node_get_next (ml->model, node); - } - - return earliest; -} - -static void * -ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data) -{ - MessageList *message_list = model_data; - CamelMessageInfo *msg_info; - - /* retrieve the message information array */ - msg_info = e_tree_memory_node_get_data (E_TREE_MEMORY(etm), path); - g_assert(msg_info); - - 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_node_is_expanded(message_list->tree, path)) { - if (subtree_unread(message_list, child)) - return (void *)3; - else - return (void *)4; - } - - if (msg_info->flags & CAMEL_MESSAGE_ANSWERED) - return GINT_TO_POINTER (2); - else if (msg_info->flags & CAMEL_MESSAGE_SEEN) - return GINT_TO_POINTER (1); - else - return GINT_TO_POINTER (0); - break; - } - case COL_FLAGGED: - return GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_FLAGGED) != 0); - case COL_SCORE: { - const char *tag; - int score = 0; - - tag = camel_tag_get ((CamelTag **) &msg_info->user_tags, "score"); - if (tag) - score = atoi (tag); - - return GINT_TO_POINTER (score); - } - case COL_ATTACHMENT: - return GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_ATTACHMENTS) != 0); - case COL_FROM: - return (void *)camel_message_info_from(msg_info); - case COL_SUBJECT: - return (void *)camel_message_info_subject(msg_info); - case COL_SENT: - return GINT_TO_POINTER (msg_info->date_sent); - case COL_RECEIVED: - return GINT_TO_POINTER (msg_info->date_received); - case COL_TO: - return (void *)camel_message_info_to(msg_info); - case COL_SIZE: - return GINT_TO_POINTER (msg_info->size); - case COL_DELETED: - return GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_DELETED) != 0); - case COL_UNREAD: { - ETreePath child; - - child = e_tree_model_node_get_first_child(etm, path); - if (child && !e_tree_node_is_expanded(message_list->tree, path) - && (msg_info->flags & CAMEL_MESSAGE_SEEN)) { - return GINT_TO_POINTER (subtree_unread (message_list, child)); - } - - return GINT_TO_POINTER (!(msg_info->flags & CAMEL_MESSAGE_SEEN)); - } - case COL_COLOUR: { - const char *colour; - - colour = camel_tag_get ((CamelTag **) &msg_info->user_tags, "colour"); - if (colour == NULL && msg_info->flags & CAMEL_MESSAGE_FLAGGED) - /* FIXME: extract from the xpm somehow. */ - colour = "#A7453E"; - return (void *)colour; - } - } - - 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) { - e_strftime_fix_am_pm (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) { - e_strftime_fix_am_pm (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) { - e_strftime_fix_am_pm (buf, 26, _("%a %l:%M %p"), &then); - done = TRUE; - break; - } - } - } - if (!done) { - if (then.tm_year == now.tm_year) { - e_strftime_fix_am_pm (buf, 26, _("%b %d %l:%M %p"), &then); - } else { - e_strftime_fix_am_pm (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), - "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), - "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), - "bold_column", COL_UNREAD, - "color_column", COL_COLOUR, - NULL); - e_table_extras_add_cell(extras, "render_size", cell); - - return extras; -} - -static void -save_tree_state(MessageList *ml) -{ - char *filename; - - if (ml->folder == NULL || ml->tree == NULL) - return; - - filename = mail_config_folder_to_cachename(ml->folder, "et-header-"); - e_tree_save_state(ml->tree, filename); - g_free(filename); - - filename = mail_config_folder_to_cachename(ml->folder, "et-expanded-"); - e_tree_save_expanded_state(ml->tree, filename); - g_free(filename); -} - -static void -sort_info_changed (GtkWidget *widget, MessageList *ml) -{ - save_tree_state(ml); -} - -static void -message_list_setup_etree (MessageList *message_list, gboolean outgoing) -{ - ETableState *etstate; - - /* 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; - - gtk_object_set (GTK_OBJECT (message_list->tree), - "uniform_row_height", TRUE, - NULL); - - name = camel_service_get_name (CAMEL_SERVICE (message_list->folder->parent_store), TRUE); - d(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_tree_load_state (message_list->tree, path); - } else if (outgoing) { - /* Swap From/To for Drafts, Sent, Outbox */ - char *state = "<ETableState>" - "<column source=\"0\"/> <column source=\"1\"/> " - "<column source=\"8\"/> <column source=\"5\"/> " - "<column source=\"6\"/> <grouping> </grouping> </ETableState>"; - - e_tree_set_state (message_list->tree, state); - } - g_free (path); - - path = mail_config_folder_to_cachename (message_list->folder, "et-expanded-"); - if (path && stat (path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) { - /* build based on saved file */ - e_tree_load_expanded_state (message_list->tree, path); - } - g_free (path); - - g_free (name); - - etstate = e_tree_get_state_object (message_list->tree); - gtk_signal_connect (GTK_OBJECT (etstate->sort_info), - "sort_info_changed", - GTK_SIGNAL_FUNC (sort_info_changed), - message_list); - gtk_signal_connect (GTK_OBJECT (etstate->sort_info), - "group_info_changed", - GTK_SIGNAL_FUNC (sort_info_changed), - message_list); - - gtk_object_unref (GTK_OBJECT (etstate)); - } -} - -/* - * 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_NEVER, - GTK_POLICY_ALWAYS); - - 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->search = NULL; - - message_list->hide_lock = g_mutex_new(); - - message_list->uid_nodemap = g_hash_table_new (g_str_hash, g_str_equal); - message_list->async_event = mail_async_event_new(); -} - -static void -message_list_destroy (GtkObject *object) -{ - MessageList *message_list = MESSAGE_LIST (object); - - mail_async_event_destroy(message_list->async_event); - - if (message_list->folder) { - save_tree_state(message_list); - 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)); - } - - gtk_object_unref (GTK_OBJECT (message_list->extras)); - gtk_object_unref (GTK_OBJECT (message_list->model)); - - 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->hidden) { - g_hash_table_destroy(message_list->hidden); - e_mempool_destroy(message_list->hidden_pool); - message_list->hidden = NULL; - message_list->hidden_pool = NULL; - } - - if (message_list->uid_nodemap) { - g_hash_table_foreach(message_list->uid_nodemap, (GHFunc)clear_info, message_list); - g_hash_table_destroy (message_list->uid_nodemap); - } - - 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); - - message_list_signals[MESSAGE_LIST_BUILT] = - gtk_signal_new ("message_list_built", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (MessageListClass, message_list_built), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals(object_class, message_list_signals, LAST_SIGNAL); - - message_list_init_images (); -} - -static void -message_list_construct (MessageList *message_list) -{ - message_list->model = - e_tree_memory_callbacks_new (ml_tree_icon_at, - - ml_column_count, - - ml_has_save_id, - ml_get_save_id, - - ml_has_get_node_by_id, - ml_get_node_by_id, - - ml_tree_value_at, - ml_tree_set_value_at, - ml_tree_is_cell_editable, - - ml_duplicate_value, - ml_free_value, - ml_initialize_value, - ml_value_is_empty, - ml_value_to_string, - - message_list); - gtk_object_ref (GTK_OBJECT (message_list->model)); - gtk_object_sink (GTK_OBJECT (message_list->model)); - - e_tree_memory_set_expanded_default(E_TREE_MEMORY(message_list->model), TRUE); - - /* - * The etree - */ - message_list->extras = message_list_create_extras (); - e_tree_scrolled_construct_from_spec_file (E_TREE_SCROLLED (message_list), - message_list->model, - message_list->extras, - EVOLUTION_ETSPECDIR "/message-list.etspec", - NULL); - - message_list->tree = e_tree_scrolled_get_tree(E_TREE_SCROLLED (message_list)); - e_tree_root_node_set_visible (message_list->tree, FALSE); - - gtk_signal_connect (GTK_OBJECT (message_list->tree), "cursor_activated", - GTK_SIGNAL_FUNC (on_cursor_activated_cmd), - message_list); - - gtk_signal_connect (GTK_OBJECT (message_list->tree), "click", - GTK_SIGNAL_FUNC (on_click), 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_info(char *key, ETreePath *node, MessageList *ml) -{ - CamelMessageInfo *info; - - info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node); - camel_folder_free_message_info(ml->folder, info); -} - -static void -clear_tree (MessageList *ml) -{ - ETreeModel *etm = ml->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 */ - if (ml->folder) - g_hash_table_foreach (ml->uid_nodemap, (GHFunc)clear_info, ml); - g_hash_table_destroy (ml->uid_nodemap); - ml->uid_nodemap = g_hash_table_new (g_str_hash, g_str_equal); - - if (ml->tree_root) { - /* we should be frozen already */ - e_tree_memory_node_remove (E_TREE_MEMORY(etm), ml->tree_root); - } - - ml->tree_root = e_tree_memory_node_insert (E_TREE_MEMORY(etm), NULL, 0, NULL); - -#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 try and find something that isn't deleted in our tree - there is actually no assurance that we'll find somethign that will - still be there next time, but its probably going to work most of the time */ -static char * -find_next_undeleted (MessageList *ml) -{ - ETreePath node; - int last; - int vrow; - ETree *et = ml->tree; - CamelMessageInfo *info; - - node = g_hash_table_lookup (ml->uid_nodemap, ml->cursor_uid); - if (node == NULL) - return NULL; - - info = get_message_info (ml, node); - if (info && (info->flags & CAMEL_MESSAGE_DELETED) == 0) { - return NULL; - } - - last = e_tree_row_count (ml->tree); - - /* model_to_view_row etc simply dont work for sorted views. Sigh. */ - vrow = e_tree_row_of_node (et, node); - - /* We already checked this node. */ - vrow ++; - - while (vrow < last) { - CamelMessageInfo *info; - - node = e_tree_node_at_row (et, vrow); - info = get_message_info (ml, node); - if (info && (info->flags & CAMEL_MESSAGE_DELETED) == 0) { - return g_strdup (camel_message_info_uid (info)); - } - vrow ++; - } - - return NULL; -} - -/* only call if we have a tree model */ -/* builds the tree structure */ -static void build_subtree (MessageList *ml, ETreePath parent, CamelFolderThreadNode *c, int *row); - -static void build_subtree_diff (MessageList *ml, ETreePath parent, ETreePath path, CamelFolderThreadNode *c, int *row); - -static void -build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *changes) -{ - int row = 0; - ETreeModel *etm = ml->model; - ETreePath *top; - char *saveuid = NULL; - -#ifdef TIMEIT - struct timeval start, end; - unsigned long diff; - - printf("Building tree\n"); - gettimeofday(&start, NULL); -#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("Loading tree state took %ld.%03ld seconds\n", diff / 1000, diff % 1000); -#endif - - if (ml->tree_root == NULL) { - ml->tree_root = e_tree_memory_node_insert(E_TREE_MEMORY(etm), NULL, 0, NULL); - } - - if (ml->cursor_uid) { - if (ml->hidedeleted) { - saveuid = find_next_undeleted(ml); - } - } - -#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 - e_tree_memory_freeze(E_TREE_MEMORY(etm)); - clear_tree (ml); - - build_subtree(ml, ml->tree_root, thread->tree, &row); - - e_tree_memory_thaw(E_TREE_MEMORY(etm)); -#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); - top = e_tree_model_node_get_first_child(etm, ml->tree_root); - tree_equal(ml->model, top, thread->tree); - } -#endif - - if (saveuid) { - ETreePath *node = g_hash_table_lookup(ml->uid_nodemap, saveuid); - if (node == NULL) { - g_free(ml->cursor_uid); - ml->cursor_uid = NULL; - gtk_signal_emit((GtkObject *)ml, message_list_signals[MESSAGE_SELECTED], NULL); - } else { - e_tree_set_cursor(ml->tree, node); - } - g_free(saveuid); - } else if (ml->cursor_uid && !g_hash_table_lookup(ml->uid_nodemap, ml->cursor_uid)) { - g_free(ml->cursor_uid); - ml->cursor_uid = NULL; - gtk_signal_emit((GtkObject *)ml, message_list_signals[MESSAGE_SELECTED], NULL); - } - -#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 - -} - -/* 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) -{ - ETreeModel *tree = ml->model; - ETreePath node; - - while (c) { - /* phantom nodes no longer allowed */ - g_assert(c->message); - - node = e_tree_memory_node_insert(E_TREE_MEMORY(tree), parent, -1, (void *)c->message); - g_hash_table_insert(ml->uid_nodemap, (void *)camel_message_info_uid(c->message), node); - camel_folder_ref_message_info(ml->folder, (CamelMessageInfo *)c->message); - - if (c->child) { - build_subtree(ml, node, c->child, row); - } - 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) -{ - CamelMessageInfo *info; - - info = e_tree_memory_node_get_data(E_TREE_MEMORY(etm), ap); - - if (bp->message && strcmp(camel_message_info_uid(info), camel_message_info_uid(bp->message))==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) -{ - CamelMessageInfo *info; - - while (ap && bp) { - if (!node_equal(etm, ap, bp)) { - g_warning("Nodes in tree differ"); - info = e_tree_memory_node_get_data(E_TREE_MEMORY(etm), ap); - printf("table uid = %s\n", camel_message_info_uid(info)); - printf("camel uid = %s\n", camel_message_info_uid(bp->message)); - 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) { - info = e_tree_memory_node_get_data(E_TREE_MEMORY(etm), ap); - if (info) - printf("table uid = %s\n", camel_message_info_uid(info)); - else - printf("info is empty?\n"); - } - if (bp) { - printf("camel uid = %s\n", camel_message_info_uid(bp->message)); - 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) -{ - ETreeModel *etm = ml->model; - ETreePath node; - - g_assert(c->message); - - /* we just update the hashtable key, umm, does this leak the info on the message node? */ - g_hash_table_remove(ml->uid_nodemap, camel_message_info_uid(c->message)); - node = e_tree_memory_node_insert(E_TREE_MEMORY(etm), parent, myrow, (void *)c->message); - g_hash_table_insert(ml->uid_nodemap, (void *)camel_message_info_uid(c->message), node); - camel_folder_ref_message_info(ml->folder, (CamelMessageInfo *)c->message); - (*row)++; - - if (c->child) { - build_subtree_diff(ml, node, NULL, c->child, row); - } -} - -/* removes node, children recursively and all associated data */ -static void -remove_node_diff(MessageList *ml, ETreePath node, int depth) -{ - ETreeModel *etm = ml->model; - ETreePath cp, cn; - CamelMessageInfo *info; - - t(printf("Removing node: %s\n", (char *)e_tree_memory_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 */ - info = e_tree_memory_node_get_data(E_TREE_MEMORY (etm), node); - - /* and only at the toplevel, remove the node (etree should optimise this remove somewhat) */ - if (depth == 0) - e_tree_memory_node_remove(E_TREE_MEMORY(etm), node); - - g_assert(info); - g_hash_table_remove(ml->uid_nodemap, camel_message_info_uid(info)); - camel_folder_free_message_info(ml->folder, info); -} - -/* 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) -{ - ETreeModel *etm = ml->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); - 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 0 - 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();*/ - } - } -#endif - *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); - } - 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 (i<j) { - /* smaller run of new nodes - must be nodes to add */ - if (bi) { - bt = bp; - while (bt != bi) { - t(printf("adding new node 0\n")); - add_node_diff(ml, parent, NULL, bt, row, myrow); - myrow++; - bt = bt->next; - } - 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); - 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); - 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 *summary, CamelFolderChangeInfo *changes) -{ - ETreeModel *etm = ml->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 - - if (ml->cursor_uid) { - if (ml->hidedeleted) { - saveuid = find_next_undeleted(ml); - } - } - -#ifndef BROKEN_ETREE - if (changes) { - build_flat_diff(ml, changes); - } else { -#endif - e_tree_memory_freeze(E_TREE_MEMORY(etm)); - clear_tree (ml); - for (i = 0; i < summary->len; i++) { - CamelMessageInfo *info = summary->pdata[i]; - - node = e_tree_memory_node_insert(E_TREE_MEMORY(etm), ml->tree_root, -1, info); - g_hash_table_insert(ml->uid_nodemap, (void *)camel_message_info_uid(info), node); - camel_folder_ref_message_info(ml->folder, info); - } - e_tree_memory_thaw(E_TREE_MEMORY(etm)); - -#ifndef BROKEN_ETREE - } -#endif - - if (saveuid) { - ETreePath *node = g_hash_table_lookup(ml->uid_nodemap, saveuid); - if (node == NULL) { - g_free(ml->cursor_uid); - ml->cursor_uid = NULL; - gtk_signal_emit((GtkObject *)ml, message_list_signals[MESSAGE_SELECTED], NULL); - } else { - e_tree_set_cursor(ml->tree, node); - } - g_free(saveuid); - } - -#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 - -static void -build_flat_diff(MessageList *ml, CamelFolderChangeInfo *changes) -{ - int i; - ETreePath node; - CamelMessageInfo *info; - -#ifdef TIMEIT - struct timeval start, end; - unsigned long diff; - - gettimeofday(&start, NULL); -#endif - - d(printf("updating changes to display\n")); - - /* remove individual nodes? */ - d(printf("Removing messages from view:\n")); - for (i=0;i<changes->uid_removed->len;i++) { - node = g_hash_table_lookup(ml->uid_nodemap, changes->uid_removed->pdata[i]); - if (node) { - info = e_tree_memory_node_get_data(E_TREE_MEMORY(ml->model), node); - e_tree_memory_node_remove(E_TREE_MEMORY(ml->model), node); - camel_folder_free_message_info(ml->folder, info); - g_hash_table_remove(ml->uid_nodemap, changes->uid_removed->pdata[i]); - } - } - - /* add new nodes? - just append to the end */ - d(printf("Adding messages to view:\n")); - for (i=0;i<changes->uid_added->len;i++) { - info = camel_folder_get_message_info (ml->folder, changes->uid_added->pdata[i]); - if (info) { - d(printf(" %s\n", (char *)changes->uid_added->pdata[i])); - node = e_tree_memory_node_insert (E_TREE_MEMORY (ml->model), ml->tree_root, -1, info); - g_hash_table_insert (ml->uid_nodemap, (void *)camel_message_info_uid (info), node); - } - } - - /* and update changes too */ - d(printf("Changing messages to view:\n")); - for (i = 0; i < changes->uid_changed->len; i++) { - ETreePath *node = g_hash_table_lookup (ml->uid_nodemap, changes->uid_changed->pdata[i]); - if (node) { - e_tree_model_pre_change (ml->model); - e_tree_model_node_data_changed (ml->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, *newchanges; - CamelMessageInfo *info; - CamelFolder *folder = (CamelFolder *)o; - int i; - - d(printf("folder changed event, changes = %p\n", changes)); - if (changes) { - d(printf("changed = %d added = %d removed = %d\n", - changes->uid_changed->len, changes->uid_added->len, changes->uid_removed->len)); - - /* check if the hidden state has changed, if so modify accordingly, then regenerate */ - if (ml->hidedeleted) { - newchanges = camel_folder_change_info_new (); - - for (i = 0; i < changes->uid_changed->len; i++) { - ETreePath node = g_hash_table_lookup (ml->uid_nodemap, changes->uid_changed->pdata[i]); - - info = camel_folder_get_message_info (folder, changes->uid_changed->pdata[i]); - if (node != NULL && info != NULL && (info->flags & CAMEL_MESSAGE_DELETED) != 0) { - camel_folder_change_info_remove_uid (newchanges, changes->uid_changed->pdata[i]); - } else if (node == NULL && info != NULL && (info->flags & CAMEL_MESSAGE_DELETED) == 0) { - camel_folder_change_info_add_uid (newchanges, changes->uid_changed->pdata[i]); - } else { - camel_folder_change_info_change_uid (newchanges, changes->uid_changed->pdata[i]); - } - camel_folder_free_message_info (folder, info); - } - - if (newchanges->uid_added->len > 0 || newchanges->uid_removed->len > 0) { - for (i = 0; i < changes->uid_added->len; i++) - camel_folder_change_info_add_uid (newchanges, changes->uid_added->pdata[i]); - for (i = 0; i < changes->uid_removed->len; i++) - camel_folder_change_info_remove_uid (newchanges, changes->uid_removed->pdata[i]); - camel_folder_change_info_free (changes); - changes = newchanges; - } else { - camel_folder_change_info_free (newchanges); - } - } - - if (changes->uid_added->len == 0 && changes->uid_removed->len == 0 && changes->uid_changed->len < 100) { - for (i = 0; i < changes->uid_changed->len; i++) { - ETreePath node = g_hash_table_lookup (ml->uid_nodemap, changes->uid_changed->pdata[i]); - if (node) { - e_tree_model_pre_change (ml->model); - e_tree_model_node_data_changed (ml->model, node); - } - } - - 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) -{ - CamelFolderChangeInfo *changes; - MessageList *ml = MESSAGE_LIST (user_data); - - if (event_data) { - changes = camel_folder_change_info_new(); - camel_folder_change_info_cat(changes, (CamelFolderChangeInfo *)event_data); - } else { - changes = NULL; - } - - mail_async_event_emit(ml->async_event, MAIL_ASYNC_GUI, (MailAsyncFunc)main_folder_changed, o, changes, user_data); -} - -static void -message_changed (CamelObject *o, gpointer event_data, gpointer user_data) -{ - CamelFolderChangeInfo *changes; - MessageList *ml = MESSAGE_LIST (user_data); - - changes = camel_folder_change_info_new(); - camel_folder_change_info_change_uid(changes, (char *)event_data); - - mail_async_event_emit(ml->async_event, MAIL_ASYNC_GUI, (MailAsyncFunc)main_folder_changed, o, changes, user_data); -} - -void -message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder, gboolean outgoing) -{ - CamelException ex; - - g_return_if_fail (message_list != NULL); - g_return_if_fail (IS_MESSAGE_LIST (message_list)); - - if (message_list->folder == camel_folder) - return; - - camel_exception_init (&ex); - - clear_tree(message_list); - - 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; - - if (message_list->cursor_uid) { - g_free(message_list->cursor_uid); - message_list->cursor_uid = NULL; - gtk_signal_emit((GtkObject *)message_list, message_list_signals[MESSAGE_SELECTED], NULL); - } - - if (camel_folder) { - /* Setup the strikeout effect for non-trash folders */ - if (!(camel_folder->folder_flags & CAMEL_FOLDER_IS_TRASH)) { - ECell *cell; - - cell = e_table_extras_get_cell (message_list->extras, "render_date"); - gtk_object_set (GTK_OBJECT (cell), - "strikeout_column", COL_DELETED, - NULL); - - cell = e_table_extras_get_cell (message_list->extras, "render_text"); - gtk_object_set (GTK_OBJECT (cell), - "strikeout_column", COL_DELETED, - NULL); - - cell = e_table_extras_get_cell (message_list->extras, "render_size"); - gtk_object_set (GTK_OBJECT (cell), - "strikeout_column", COL_DELETED, - NULL); - } - - /* Build the etree suitable for this folder */ - message_list_setup_etree (message_list, outgoing); - - 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)); - - message_list->hidedeleted = mail_config_get_hide_deleted () && - !(camel_folder->folder_flags & CAMEL_FOLDER_IS_TRASH); - - hide_load_state (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; - ESelectionModel *esm = e_tree_get_selection_model (message_list->tree); - gint selected = e_selection_model_selected_count (esm); - - if (selected == 1 && message_list->cursor_uid) { - d(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); - } else { - gtk_signal_emit (GTK_OBJECT (message_list), - message_list_signals[MESSAGE_SELECTED], NULL); - } - - message_list->idle_id = 0; - return FALSE; -} - -static void -on_cursor_activated_cmd (ETree *tree, int row, ETreePath path, gpointer user_data) -{ - MessageList *message_list = MESSAGE_LIST (user_data); - const char *new_uid; - - if (path == NULL) - new_uid = NULL; - else - new_uid = get_message_uid (message_list, path); - - if (message_list->cursor_uid != NULL && new_uid != NULL && !strcmp (message_list->cursor_uid, new_uid)) - return; - - message_list->cursor_row = row; - g_free (message_list->cursor_uid); - message_list->cursor_uid = g_strdup (new_uid); - - 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 (ETree *tree, gint row, ETreePath path, 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, path); - if (info == NULL) { - return FALSE; - } - - /* If a message was marked as deleted and the user flags it as important, undelete it */ - if (col == COL_FLAGGED && (info->flags & CAMEL_MESSAGE_DELETED)) - flag |= CAMEL_MESSAGE_DELETED; - - camel_folder_set_message_flags (list->folder, camel_message_info_uid (info), flag, ~info->flags); - - 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 (ETreePath path, gpointer user_data) -{ - struct message_list_foreach_data *mlfe_data = user_data; - const char *uid; - - if (e_tree_model_node_is_root (mlfe_data->message_list->model, path)) - return; - - uid = get_message_uid (mlfe_data->message_list, - path); - if (uid) { - mlfe_data->callback (mlfe_data->message_list, uid, - mlfe_data->user_data); - } else { - /* FIXME: could this the cause of bug #6637 and friends? */ - g_warning ("I wonder if this could be the cause of bug #6637 and friends?"); - g_assert_not_reached (); - } -} - -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_tree_selected_path_foreach (message_list->tree, - 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_hidedeleted (MessageList *ml, gboolean hidedeleted) -{ - if (ml->hidedeleted != hidedeleted) { - ml->hidedeleted = hidedeleted; - - 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; -} - -/* returns number of hidden messages */ -unsigned int -message_list_hidden(MessageList *ml) -{ - unsigned int hidden = 0; - - MESSAGE_LIST_LOCK (ml, hide_lock); - if (ml->hidden) - hidden = g_hash_table_size (ml->hidden); - MESSAGE_LIST_UNLOCK (ml, hide_lock); - - return hidden; -} - - -/* 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; i < uids->len; i++) { - if (g_hash_table_lookup (ml->uid_nodemap, 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 ( ; i < uids->len; i++) { - if (g_hash_table_lookup (ml->uid_nodemap, 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_file_util_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_file_util_decode_fixed_int32 (in, &lower); - ml->hide_before = lower; - camel_file_util_decode_fixed_int32 (in, &upper); - ml->hide_after = upper; - while (!feof(in)) { - char *olduid, *uid; - - if (camel_file_util_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_file_util_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_file_util_encode_fixed_int32 (out, HIDE_STATE_VERSION); - camel_file_util_encode_fixed_int32 (out, ml->hide_before); - camel_file_util_encode_fixed_int32 (out, ml->hide_after); - if (ml->hidden) - g_hash_table_foreach(ml->hidden, (GHFunc)hide_save_1, out); - fclose(out); - } - g_free (filename); - - 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 */ - gboolean hidedel; /* we want to/dont want to show deleted messages */ - CamelFolderThread *tree; - - CamelFolder *folder; - GPtrArray *summary; -}; - -/* - maintain copy of summary - - any new messages added - any removed removed, etc. - - use vfolder to implement searches ??? - - */ - -static char * -regen_list_describe (struct _mail_msg *mm, gint complete) -{ - return g_strdup (_("Generating message list")); -} - -static void -regen_list_regen (struct _mail_msg *mm) -{ - struct _regen_list_msg *m = (struct _regen_list_msg *)mm; - GPtrArray *uids, *uidnew, *showuids; - CamelMessageInfo *info; - int i; - - if (m->search) - uids = camel_folder_search_by_expression (m->folder, m->search, &mm->ex); - else - uids = camel_folder_get_uids (m->folder); - - if (camel_exception_is_set (&mm->ex)) - return; - - /* perform hiding */ - 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; i < uidnew->len; 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 = 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 (); - - /* first, hide matches */ - if (m->ml->hidden) { - for (i = 0; i < uids->len; 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; i < end; i++) { - g_ptr_array_add (uid2, uidnew->pdata[i]); - } - - g_ptr_array_free (uidnew, TRUE); - uidnew = uid2; - } - showuids = uidnew; - } else { - uidnew = NULL; - showuids = uids; - } - - MESSAGE_LIST_UNLOCK(m->ml, hide_lock); - - m->summary = g_ptr_array_new (); - for (i = 0; i < showuids->len; i++) { - info = camel_folder_get_message_info (m->folder, showuids->pdata[i]); - if (info) { - /* FIXME: should this be taken account of in above processing? */ - if (m->hidedel && (info->flags & CAMEL_MESSAGE_DELETED) != 0) - camel_folder_free_message_info (m->folder, info); - else - g_ptr_array_add (m->summary, info); - } - } - - if (uidnew) - g_ptr_array_free (uidnew, TRUE); - - if (m->search) - camel_folder_search_free (m->folder, uids); - else - camel_folder_free_uids (m->folder, uids); - - if (m->dotree) - m->tree = camel_folder_thread_messages_new_summary (m->summary); - else - m->tree = NULL; -} - -static void -regen_list_regened (struct _mail_msg *mm) -{ - struct _regen_list_msg *m = (struct _regen_list_msg *)mm; - - if (GTK_OBJECT_DESTROYED(m->ml)) - return; - - if (m->summary == NULL) - return; - - if (m->dotree) - build_tree (m->ml, m->tree, m->changes); - else - build_flat (m->ml, m->summary, m->changes); - - gtk_signal_emit (GTK_OBJECT (m->ml), message_list_signals[MESSAGE_LIST_BUILT]); -} - -static void -regen_list_free (struct _mail_msg *mm) -{ - struct _regen_list_msg *m = (struct _regen_list_msg *)mm; - int i; - - if (m->summary) { - for (i = 0; i < m->summary->len; i++) - camel_folder_free_message_info (m->folder, m->summary->pdata[i]); - g_ptr_array_free (m->summary, TRUE); - } - - if (m->tree) - camel_folder_thread_messages_destroy (m->tree); - - if (m->ml->search && m->ml->search != m->search) - g_free (m->ml->search); - m->ml->search = m->search; - - g_free (m->hideexpr); - - camel_object_unref (CAMEL_OBJECT (m->folder)); - - if (m->changes) - camel_folder_change_info_free (m->changes); - - gtk_object_unref (GTK_OBJECT (m->ml)); -} - -static struct _mail_msg_op regen_list_op = { - regen_list_describe, - 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; - m->hidedel = ml->hidedeleted; - gtk_object_ref (GTK_OBJECT (ml)); - m->folder = ml->folder; - camel_object_ref (CAMEL_OBJECT (m->folder)); - - e_thread_put (mail_thread_new, (EMsg *)m); -} diff --git a/mail/message-list.etspec b/mail/message-list.etspec deleted file mode 100644 index a8bf34056a..0000000000 --- a/mail/message-list.etspec +++ /dev/null @@ -1,17 +0,0 @@ -<ETableSpecification cursor-mode="line" draw-grid="false" draw-focus="true" selection-mode="browse"> - <ETableColumn model_col= "0" _title="Status" pixbuf="status" expansion="0.0" minimum_width="18" resizable="false" cell="render_message_status" compare="integer" sortable="false"/> - <ETableColumn model_col= "1" _title="Flagged" pixbuf="flagged" expansion="0.0" minimum_width="18" resizable="false" cell="render_flagged" compare="integer"/> - <ETableColumn model_col= "2" _title="Score" pixbuf="score" expansion="0.0" minimum_width="18" disabled="true" resizable="false" cell="render_score" compare="integer"/> - <ETableColumn model_col= "3" _title="Attachment" pixbuf="attachment" expansion="0.0" minimum_width="18" resizable="false" cell="render_attachment" compare="integer" sortable="false"/> - <ETableColumn model_col= "4" _title="From" expansion="1.0" minimum_width="32" resizable="true" cell="render_text" compare="address_compare"/> - <ETableColumn model_col= "5" _title="Subject" expansion="1.6" minimum_width="32" resizable="true" cell="render_tree" compare="subject_compare"/> - <ETableColumn model_col= "6" _title="Sent" expansion="0.4" minimum_width="32" resizable="true" cell="render_date" compare="integer"/> - <ETableColumn model_col= "7" _title="Received" expansion="0.4" minimum_width="32" resizable="true" cell="render_date" compare="integer"/> - <ETableColumn model_col= "8" _title="To" expansion="1.0" minimum_width="32" resizable="true" cell="render_text" compare="address_compare"/> - <ETableColumn model_col= "9" _title="Size" expansion="0.2" minimum_width="32" resizable="true" cell="render_size" compare="integer"/> - <ETableState> - <column source="0"/> <column source="3"/> <column source="1"/> - <column source="4"/> <column source="5" expansion="1.60"/> <column source="6" expansion="0.40"/> - <grouping> </grouping> - </ETableState> -</ETableSpecification> diff --git a/mail/message-list.h b/mail/message-list.h deleted file mode 100644 index 2846c04ec4..0000000000 --- a/mail/message-list.h +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _MESSAGE_LIST_H_ -#define _MESSAGE_LIST_H_ - -#include <gtk/gtkobject.h> -#include <gtk/gtkwidget.h> - -#include <gal/e-table/e-table-simple.h> -#include <gal/e-table/e-tree-scrolled.h> -#include "mail-types.h" - -#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 { - ETreeScrolled parent; - - /* The table */ - ETreeModel *model; - ETree *tree; - ETreePath tree_root; - ETableExtras *extras; - - /* The folder */ - CamelFolder *folder; - - GHashTable *uid_nodemap; /* uid (from info) -> tree node mapping */ - - /* 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; - /* do we automatically hide deleted messages? */ - gboolean hidedeleted; - - /* Where the ETree 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 */ - - /* for message/folder chagned event handling */ - struct _MailAsyncEvent *async_event; -}; - -typedef struct { - ETreeScrolledClass parent_class; - - /* signals - select a message */ - void (*message_selected) (MessageList *ml, const char *uid); - void (*message_list_built) (MessageList *ml); -} 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, - gboolean outgoing); - -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, - gboolean wraparound); - -void message_list_select_uid (MessageList *message_list, - const char *uid); - -/* info */ -unsigned int message_list_length(MessageList *ml); -unsigned int message_list_hidden(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_hidedeleted(MessageList *ml, gboolean hidedeleted); -void message_list_set_search(MessageList *ml, const char *search); - -#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/subscribe-dialog.c b/mail/subscribe-dialog.c deleted file mode 100644 index 25d6290094..0000000000 --- a/mail/subscribe-dialog.c +++ /dev/null @@ -1,1644 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* subscribe-dialog.c: Subscribe dialog */ -/* - * Authors: Chris Toshok <toshok@ximian.com> - * Peter Williams <peterw@ximian.com> - * - * Copyright 2000 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 <config.h> -#endif - -#include <gal/util/e-util.h> -#include <gal/widgets/e-unicode.h> - -#include <gal/e-table/e-cell-toggle.h> -#include <gal/e-table/e-cell-text.h> -#include <gal/e-table/e-cell-tree.h> - -#include <gal/e-table/e-tree-scrolled.h> -#include <gal/e-table/e-tree-memory-callbacks.h> -#include <gal/e-table/e-tree.h> - -#include <pthread.h> - -#include "evolution-shell-component-utils.h" -#include "mail.h" -#include "mail-tools.h" -#include "mail-ops.h" -#include "mail-mt.h" -#include "mail-folder-cache.h" -#include "camel/camel-exception.h" -#include "camel/camel-store.h" -#include "camel/camel-session.h" -#include "subscribe-dialog.h" - -#include "art/empty.xpm" -#include "art/mark.xpm" - -#define d(x) - -/* Things to test. - * - Feature - * + How to check that it works. - * - * - Proper stores displayed - * + Skip stores that don't support subscriptions - * + Skip disabled stores - * - Changing subscription status - * + Select single folder, double-click row -> toggled - * + Select multiple folders, press subscribe -> all selected folders end up subscribed - * - (un)Subscribing from/to already (un)subscribed folder - * + Check that no IMAP command is sent - * - Switching views between stores - * + Proper tree shown - * - No crashes when buttons are pressed with "No store" screen - * + obvious - * - Restoring filter settings when view switched - * + Enter search, change view, change back -> filter checked and search entry set - * + Clear search, change view, change back -> "all" checked - * - Cancelling in middle of get_store - * + Enter invalid hostname, open dialog, click Close - * - Cancelling in middle if listing - * + Open large directory, click Close - * - Cancelling in middle of subscription op - * + How to test? - * - Test with both IMAP and NNTP - * + obvious - * - Verify that refresh view works - * + obvious - * - No unnecessary tree rebuilds - * + Show All folders, change filter with empty search -> no tree rebuild - * + Converse - * - No out of date tree - * + Show All Folders, change to filter with a search -> tree rebuild - * - Tree construction logic (mostly IMAP-specific terminology) - * + Tree is created progressively - * + No wasted LIST responses - * + No extraneous LIST commands - * + Specifying "folder names begin with" works - * + Always show folders below IMAP namespace (no escaping the namespace) - * + Don't allow subscription to NoSelect folders - * + IMAP accounts always show INBOX - * - Shell interactions - * + Folders are properly created / delete from folder tree when subscribed / unsubscribed - * + Folders with spaces in names / 8bit chars - * + Toplevel as well as subfolders - * + Mail Folder Cache doesn't complain - * - No ETable wackiness - * + Verify columns cannot be DnD'd - * + Alphabetical order always - * - UI cleanliness - * + Keybindings work - * + Some widget has focus by default - * + Escape / enter work - * + Close button works - */ - -/* FIXME: we should disable/enable the subscribe/unsubscribe buttons as - * appropriate when only a single message is selected. We need a - * mechanism to learn when the selected folder's subscription status - * changes, so when the user double-clicks it (eg) the buttons can - * (de)sensitize appropriately. See Ximian bug #7673. - */ - -/*#define NEED_TOGGLE_SELECTION*/ - -typedef struct _FolderETree FolderETree; -typedef struct _FolderETreeClass FolderETreeClass; - -struct _FolderETree { - ETreeMemory parent; - ETreePath root; - - GHashTable *scan_ops; - GHashTable *subscribe_ops; - - CamelStore *store; - EvolutionStorage *e_storage; - char *service_name; - char *search; -}; - -struct _FolderETreeClass { - ETreeMemoryClass parent; -}; - -static GtkObjectClass *folder_etree_parent_class = NULL; - -typedef struct _FolderETreeExtras FolderETreeExtras; -typedef struct _FolderETreeExtrasClass FolderETreeExtrasClass; - -enum { - FOLDER_COL_SUBSCRIBED, - FOLDER_COL_NAME, - FOLDER_COL_LAST -}; - -struct _FolderETreeExtras { - ETableExtras parent; - GdkPixbuf *toggles[2]; -}; - -struct _FolderETreeExtrasClass { - ETableExtrasClass parent; -}; - -static GtkObjectClass *ftree_extras_parent_class = NULL; - -/* util */ - -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); -} - -/* ** Get one level of folderinfo ****************************************** */ - -typedef void (*SubscribeShortFolderinfoFunc) (CamelStore *store, char *prefix, CamelFolderInfo *info, gpointer data); - -int subscribe_get_short_folderinfo (FolderETree *ftree, const char *prefix, - SubscribeShortFolderinfoFunc func, gpointer user_data); - -struct _get_short_folderinfo_msg { - struct _mail_msg msg; - - char *prefix; - - FolderETree *ftree; - CamelFolderInfo *info; - - SubscribeShortFolderinfoFunc func; - gpointer user_data; -}; - -static char * -get_short_folderinfo_desc (struct _mail_msg *mm, int done) -{ - struct _get_short_folderinfo_msg *m = (struct _get_short_folderinfo_msg *) mm; - char *ret, *name; - - name = camel_service_get_name (CAMEL_SERVICE (m->ftree->store), TRUE); - - if (m->prefix) - ret = g_strdup_printf (_("Scanning folders under %s on \"%s\""), m->prefix, name); - else - ret = g_strdup_printf (_("Scanning root-level folders on \"%s\""), name); - - g_free (name); - return ret; -} - -static void -get_short_folderinfo_get (struct _mail_msg *mm) -{ - struct _get_short_folderinfo_msg *m = (struct _get_short_folderinfo_msg *) mm; - - m->info = camel_store_get_folder_info (m->ftree->store, m->prefix, CAMEL_STORE_FOLDER_INFO_FAST, &mm->ex); -} - -static void -get_short_folderinfo_got (struct _mail_msg *mm) -{ - struct _get_short_folderinfo_msg *m = (struct _get_short_folderinfo_msg *) mm; - - if (camel_exception_is_set (&mm->ex)) - g_warning ("Error getting folder info from store at %s: %s", - camel_service_get_url (CAMEL_SERVICE (m->ftree->store)), - camel_exception_get_description (&mm->ex)); - - /* 'done' is probably guaranteed to fail, but... */ - - if (m->func) - m->func (m->ftree->store, m->prefix, m->info, m->user_data); -} - -static void -get_short_folderinfo_free (struct _mail_msg *mm) -{ - struct _get_short_folderinfo_msg *m = (struct _get_short_folderinfo_msg *) mm; - - camel_store_free_folder_info (m->ftree->store, m->info); - gtk_object_unref (GTK_OBJECT (m->ftree)); - - g_free (m->prefix); /* may be NULL but that's ok */ -} - -static struct _mail_msg_op get_short_folderinfo_op = { - get_short_folderinfo_desc, - get_short_folderinfo_get, - get_short_folderinfo_got, - get_short_folderinfo_free, -}; - -int -subscribe_get_short_folderinfo (FolderETree *ftree, - const char *prefix, - SubscribeShortFolderinfoFunc func, - gpointer user_data) -{ - struct _get_short_folderinfo_msg *m; - int id; - - m = mail_msg_new (&get_short_folderinfo_op, NULL, sizeof(*m)); - - m->ftree = ftree; - gtk_object_ref (GTK_OBJECT (ftree)); - - if (prefix) - m->prefix = g_strdup (prefix); - else - m->prefix = NULL; - - m->func = func; - m->user_data = user_data; - - id = m->msg.seq; - e_thread_put (mail_thread_queued, (EMsg *)m); - return id; -} - -/* ** Subscribe folder operation **************************************** */ - -typedef void (*SubscribeFolderCallback) (const char *, const char *, gboolean, gboolean, gpointer); - -struct _subscribe_msg { - struct _mail_msg msg; - - CamelStore *store; - gboolean subscribe; - char *full_name; - char *name; - - SubscribeFolderCallback cb; - gpointer cb_data; -}; - -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 -subscribe_folder_subscribed (struct _mail_msg *mm) -{ - struct _subscribe_msg *m = (struct _subscribe_msg *) mm; - - if (m->cb) - (m->cb) (m->full_name, m->name, m->subscribe, - !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->name); - g_free (m->full_name); - - camel_object_unref (CAMEL_OBJECT (m->store)); -} - -static struct _mail_msg_op subscribe_folder_op = { - subscribe_folder_desc, - subscribe_folder_subscribe, - subscribe_folder_subscribed, - subscribe_folder_free, -}; - -static int -subscribe_do_subscribe_folder (CamelStore *store, const char *full_name, const char *name, - gboolean subscribe, SubscribeFolderCallback cb, gpointer cb_data) -{ - struct _subscribe_msg *m; - int id; - - g_return_val_if_fail (CAMEL_IS_STORE (store), 0); - g_return_val_if_fail (full_name, 0); - - m = mail_msg_new (&subscribe_folder_op, NULL, sizeof(*m)); - m->store = store; - m->subscribe = subscribe; - m->name = g_strdup (name); - m->full_name = g_strdup (full_name); - m->cb = cb; - m->cb_data = cb_data; - - camel_object_ref (CAMEL_OBJECT (store)); - - id = m->msg.seq; - e_thread_put (mail_thread_queued, (EMsg *)m); - return id; -} - -/* ** FolderETree Extras *************************************************** */ - -static void -fete_destroy (GtkObject *object) -{ - FolderETreeExtras *extras = (FolderETreeExtras *) object; - - gdk_pixbuf_unref (extras->toggles[0]); - gdk_pixbuf_unref (extras->toggles[1]); - - ftree_extras_parent_class->destroy (object); -} - -static void -fete_class_init (GtkObjectClass *object_class) -{ - object_class->destroy = fete_destroy; - - ftree_extras_parent_class = gtk_type_class (E_TABLE_EXTRAS_TYPE); -} - -static void -fete_init (GtkObject *object) -{ - FolderETreeExtras *extras = (FolderETreeExtras *) object; - ECell *cell; - ECell *text_cell; - - /* text column */ - - cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); - text_cell = cell; - gtk_object_set (GTK_OBJECT (cell), - "bold_column", FOLDER_COL_SUBSCRIBED, - NULL); - e_table_extras_add_cell (E_TABLE_EXTRAS (extras), "cell_text", cell); - - /* toggle column */ - - extras->toggles[0] = gdk_pixbuf_new_from_xpm_data ((const char **)empty_xpm); - extras->toggles[1] = gdk_pixbuf_new_from_xpm_data ((const char **)mark_xpm); - cell = e_cell_toggle_new (0, 2, extras->toggles); - e_table_extras_add_cell (E_TABLE_EXTRAS (extras), "cell_toggle", cell); - - /* tree cell */ - - cell = e_cell_tree_new (NULL, NULL, TRUE, text_cell); - e_table_extras_add_cell (E_TABLE_EXTRAS (extras), "cell_tree", cell); - - /* misc */ - - e_table_extras_add_pixbuf (E_TABLE_EXTRAS (extras), "subscribed-image", extras->toggles[1]); -} - -/* naughty! */ -static -E_MAKE_TYPE (fete, "FolderETreeExtras", FolderETreeExtras, fete_class_init, fete_init, E_TABLE_EXTRAS_TYPE); - -/* ** Global Extras ******************************************************** */ - -static FolderETreeExtras *global_extras = NULL; - -static void -global_extras_destroyed (GtkObject *obj, gpointer user_data) -{ - global_extras = NULL; -} - -static ETableExtras * -subscribe_get_global_extras (void) -{ - if (global_extras == NULL) { - global_extras = gtk_type_new (fete_get_type()); - gtk_object_ref (GTK_OBJECT (global_extras)); - gtk_object_sink (GTK_OBJECT (global_extras)); - gtk_signal_connect (GTK_OBJECT (global_extras), "destroy", - global_extras_destroyed, NULL); - } - - gtk_object_ref (GTK_OBJECT (global_extras)); - return E_TABLE_EXTRAS (global_extras); -} - -/* ** Folder Tree Node ***************************************************** */ - -typedef struct _ftree_node ftree_node; - -struct _ftree_node { - guint8 flags; - char *cache; - int uri_offset; - int full_name_offset; - - /* format: {name}{\0}{uri}{\0}{full_name}{\0} - * (No braces). */ - char data[1]; -}; - -#define FTREE_NODE_GOT_CHILDREN (1 << 0) -#define FTREE_NODE_SUBSCRIBABLE (1 << 1) -#define FTREE_NODE_SUBSCRIBED (1 << 2) -#define FTREE_NODE_ROOT (1 << 3) - -static ftree_node * -ftree_node_new_root (const char *prefix) -{ - ftree_node *node; - size_t size; - - if (prefix == NULL) - prefix = ""; - - size = sizeof (ftree_node) + strlen (prefix) + 1; - - node = g_malloc (size); - node->flags = FTREE_NODE_ROOT; - node->uri_offset = 0; - node->full_name_offset = 1; - node->data[0] = '\0'; - strcpy (node->data + 1, prefix); - - return node; -} - -static ftree_node * -ftree_node_new (CamelStore *store, CamelFolderInfo *fi) -{ - ftree_node *node; - int uri_offset, full_name_offset; - size_t size; - CamelURL *url; - - uri_offset = strlen (fi->name) + 1; - full_name_offset = uri_offset + strlen (fi->url) + 1; - size = full_name_offset + strlen (fi->full_name); - - /* - 1 for sizeof(node.data) but +1 for terminating \0 */ - node = g_malloc (sizeof (*node) + size); - - node->cache = NULL; - - /* Noselect? */ - - url = camel_url_new (fi->url, NULL); - if (camel_url_get_param (url, "noselect")) - node->flags = 0; - else - node->flags = FTREE_NODE_SUBSCRIBABLE; - camel_url_free (url); - - /* subscribed? */ - - if (camel_store_folder_subscribed (store, fi->full_name)) - node->flags |= FTREE_NODE_SUBSCRIBED; - - /* Copy strings */ - - node->uri_offset = uri_offset; - node->full_name_offset = full_name_offset; - - strcpy (node->data, fi->name); - strcpy (node->data + uri_offset, fi->url); - strcpy (node->data + full_name_offset, fi->full_name); - - /* Done */ - - return node; -} - -#define ftree_node_subscribable(node) ( ((ftree_node *) (node))->flags & FTREE_NODE_SUBSCRIBABLE ) -#define ftree_node_subscribed(node) ( ((ftree_node *) (node))->flags & FTREE_NODE_SUBSCRIBED ) -#define ftree_node_get_name(node) ( ((ftree_node *) (node))->data ) -#define ftree_node_get_full_name(node) ( ((ftree_node *) (node))->data + ((ftree_node *) (node))->full_name_offset ) -#define ftree_node_get_uri(node) ( ((ftree_node *) (node))->data + ((ftree_node *) (node))->uri_offset ) - -/* ** Folder Tree Model **************************************************** */ - -/* A subscribe or scan operation */ - -typedef struct _ftree_op_data ftree_op_data; - -struct _ftree_op_data { - FolderETree *ftree; - ETreePath path; - ftree_node *data; - int handle; -}; - - -/* ETreeModel functions */ - -static int -fe_column_count (ETreeModel *etm) -{ - return FOLDER_COL_LAST; -} - -static void * -fe_duplicate_value (ETreeModel *etm, int col, const void *val) -{ - return g_strdup (val); -} - -static void -fe_free_value (ETreeModel *etm, int col, void *val) -{ - g_free (val); -} - -static void* -fe_init_value (ETreeModel *etm, int col) -{ - return g_strdup (""); -} - -static gboolean -fe_value_is_empty (ETreeModel *etm, int col, const void *val) -{ - return !(val && *(char *)val); -} - -static char * -fe_value_to_string (ETreeModel *etm, int col, const void *val) -{ - return g_strdup (val); -} - -static GdkPixbuf * -fe_icon_at (ETreeModel *etree, ETreePath path) -{ - return NULL; /* XXX no icons for now */ -} - -static gpointer -fe_root_value_at (FolderETree *ftree, int col) -{ - switch (col) { - case FOLDER_COL_NAME: - return ftree->service_name; - case FOLDER_COL_SUBSCRIBED: - return GINT_TO_POINTER (0); - default: - printf ("Oh no, unimplemented column %d in subscribe dialog\n", col); - } - - return NULL; -} - -static gpointer -fe_real_value_at (FolderETree *ftree, int col, gpointer data) -{ - switch (col) { - case FOLDER_COL_NAME: - return ftree_node_get_name (data); - case FOLDER_COL_SUBSCRIBED: - if (ftree_node_subscribed (data)) - return GINT_TO_POINTER (1); - return GINT_TO_POINTER (0); - default: - printf ("Oh no, unimplemented column %d in subscribe dialog\n", col); - } - - return NULL; -} - -static void * -fe_value_at (ETreeModel *etree, ETreePath path, int col) -{ - FolderETree *ftree = (FolderETree *) etree; - gpointer node_data; - - if (path == ftree->root) - return fe_root_value_at (ftree, col); - - node_data = e_tree_memory_node_get_data (E_TREE_MEMORY (etree), path); - return fe_real_value_at (ftree, col, node_data); -} - -static void -fe_set_value_at (ETreeModel *etree, ETreePath path, int col, const void *val) -{ - /* nothing */ -} - -static gboolean -fe_return_false (void) -{ - return FALSE; -} - -static gint -fe_sort_folder (ETreeMemory *etmm, ETreePath left, ETreePath right, gpointer user_data) -{ - ftree_node *n_left, *n_right; - - n_left = e_tree_memory_node_get_data (etmm, left); - n_right = e_tree_memory_node_get_data (etmm, right); - - return g_strcasecmp (ftree_node_get_name (n_left), ftree_node_get_name (n_right)); -} - -/* scanning */ - -static void -fe_got_children (CamelStore *store, char *prefix, CamelFolderInfo *info, gpointer data) -{ - ftree_op_data *closure = (ftree_op_data *) data; - - if (!info) /* cancelled */ - return; - - if (!prefix) - prefix = ""; - - for ( ; info; info = info->sibling) { - ETreePath child_path; - ftree_node *node; - - if (strcmp (info->full_name, prefix) == 0) - continue; - - node = ftree_node_new (store, info); - child_path = e_tree_memory_node_insert (E_TREE_MEMORY (closure->ftree), - closure->path, - 0, - node); - e_tree_memory_sort_node (E_TREE_MEMORY (closure->ftree), - closure->path, - fe_sort_folder, - NULL); - } - - if (closure->data) - closure->data->flags |= FTREE_NODE_GOT_CHILDREN; - - g_hash_table_remove (closure->ftree->scan_ops, closure->path); - g_free (closure); -} - -static void -fe_check_for_children (FolderETree *ftree, ETreePath path) -{ - ftree_op_data *closure; - ftree_node *node; - char *prefix; - - node = e_tree_memory_node_get_data (E_TREE_MEMORY (ftree), path); - - /* have we already gotten these children? */ - if (node->flags & FTREE_NODE_GOT_CHILDREN) - return; - - /* or we're loading them right now? */ - if (g_hash_table_lookup (ftree->scan_ops, path)) - return; - - /* figure out our search prefix */ - if (path == ftree->root) - prefix = ftree->search; - else - prefix = ftree_node_get_full_name (node); - - closure = g_new (ftree_op_data, 1); - closure->ftree = ftree; - closure->path = path; - closure->data = node; - closure->handle = -1; - - g_hash_table_insert (ftree->scan_ops, path, closure); - - /* FIXME. Tiny race possiblity I guess. */ - - closure->handle = subscribe_get_short_folderinfo (ftree, prefix, fe_got_children, closure); -} - -static void -fe_create_root_node (FolderETree *ftree) -{ - ftree_node *node; - - node = ftree_node_new_root (ftree->search); - ftree->root = e_tree_memory_node_insert (E_TREE_MEMORY(ftree), NULL, 0, node); - fe_check_for_children (ftree, ftree->root); -} - -static ETreePath -fe_get_first_child (ETreeModel *model, ETreePath path) -{ - ETreePath child_path; - - child_path = E_TREE_MODEL_CLASS (folder_etree_parent_class)->get_first_child (model, path); - if (child_path) - fe_check_for_children ((FolderETree *) model, child_path); - else - fe_check_for_children ((FolderETree *) model, path); - return child_path; -} - -/* subscribing */ - -static char * -fe_node_to_shell_path (ftree_node *node) -{ - char *path = NULL; - int name_len, full_name_len; - - name_len = strlen (ftree_node_get_name (node)); - full_name_len = strlen (ftree_node_get_full_name (node)); - - if (name_len != full_name_len) { - char *full_name; - char *iter; - char sep; - - /* so, we don't know the heirarchy separator. But - * full_name = blahXblahXname, where X = separator - * and name = .... name. So we can determine it. - * (imap_store->dir_sep isn't really private, I guess, - * so we could use that if we had the store. But also - * we don't "know" that it is an IMAP store anyway.) - */ - - full_name = ftree_node_get_full_name (node); - sep = full_name[full_name_len - (name_len + 1)]; - - if (sep != '/') { - path = g_malloc (full_name_len + 2); - path[0] = '/'; - strcpy (path + 1, full_name); - while ((iter = strchr (path, sep)) != NULL) - *iter = '/'; - } - } - - if (!path) - path = g_strdup_printf ("/%s", ftree_node_get_full_name (node)); - - return path; -} - -static void -fe_done_subscribing (const char *full_name, const char *name, gboolean subscribe, gboolean success, gpointer user_data) -{ - ftree_op_data *closure = (ftree_op_data *) user_data; - - if (success && closure->handle != -1) { - char *path; - - path = fe_node_to_shell_path (closure->data); - - if (subscribe) { - closure->data->flags |= FTREE_NODE_SUBSCRIBED; - recursive_add_folder (closure->ftree->e_storage, - path, name, - ftree_node_get_uri (closure->data)); - } else { - closure->data->flags &= ~FTREE_NODE_SUBSCRIBED; - - /* FIXME: recursively remove folder as well? Possible? */ - evolution_storage_removed_folder (closure->ftree->e_storage, path); - } - - g_free (path); - e_tree_model_node_data_changed (E_TREE_MODEL (closure->ftree), closure->path); - } - - if (closure->handle != -1) - g_hash_table_remove (closure->ftree->subscribe_ops, closure->path); - - g_free (closure); -} - -/* cleanup */ - -static gboolean -fe_cancel_op_foreach (gpointer key, gpointer value, gpointer user_data) -{ - /*FolderETree *ftree = (FolderETree *) user_data;*/ - ftree_op_data *closure = (ftree_op_data *) value; - - if (closure->handle != -1) - mail_msg_cancel (closure->handle); - - closure->handle = -1; - - return TRUE; -} - -static void -fe_kill_current_tree (FolderETree *ftree) -{ - g_hash_table_foreach_remove (ftree->scan_ops, fe_cancel_op_foreach, ftree); - g_assert (g_hash_table_size (ftree->scan_ops) == 0); -} - -static void -fe_destroy (GtkObject *obj) -{ - FolderETree *ftree = (FolderETree *) (obj); - - fe_kill_current_tree (ftree); - - g_hash_table_foreach_remove (ftree->subscribe_ops, fe_cancel_op_foreach, ftree); - - g_hash_table_destroy (ftree->scan_ops); - g_hash_table_destroy (ftree->subscribe_ops); - - camel_object_unref (CAMEL_OBJECT (ftree->store)); - bonobo_object_unref (BONOBO_OBJECT (ftree->e_storage)); - - g_free (ftree->search); - g_free (ftree->service_name); -} - -typedef gboolean (*bool_func_1) (ETreeModel *, ETreePath, int); -typedef gboolean (*bool_func_2) (ETreeModel *); - -static void -folder_etree_class_init (GtkObjectClass *klass) -{ - ETreeModelClass *etree_model_class = E_TREE_MODEL_CLASS (klass); - - folder_etree_parent_class = gtk_type_class (E_TREE_MEMORY_TYPE); - - klass->destroy = fe_destroy; - - etree_model_class->value_at = fe_value_at; - etree_model_class->set_value_at = fe_set_value_at; - etree_model_class->column_count = fe_column_count; - etree_model_class->duplicate_value = fe_duplicate_value; - etree_model_class->free_value = fe_free_value; - etree_model_class->initialize_value = fe_init_value; - etree_model_class->value_is_empty = fe_value_is_empty; - etree_model_class->value_to_string = fe_value_to_string; - etree_model_class->icon_at = fe_icon_at; - etree_model_class->is_editable = (bool_func_1) fe_return_false; - etree_model_class->has_save_id = (bool_func_2) fe_return_false; - etree_model_class->has_get_node_by_id = (bool_func_2) fe_return_false; - etree_model_class->get_first_child = fe_get_first_child; -} - -static void -folder_etree_init (GtkObject *object) -{ - FolderETree *ftree = (FolderETree *) object; - - e_tree_memory_set_node_destroy_func (E_TREE_MEMORY (ftree), (GFunc) g_free, ftree); - - ftree->scan_ops = g_hash_table_new (g_direct_hash, g_direct_equal); - ftree->subscribe_ops = g_hash_table_new (g_direct_hash, g_direct_equal); - - ftree->search = g_strdup (""); -} - -static FolderETree * -folder_etree_construct (FolderETree *ftree, - CamelStore *store) -{ - e_tree_memory_construct (E_TREE_MEMORY (ftree)); - - ftree->store = store; - camel_object_ref (CAMEL_OBJECT (store)); - - ftree->service_name = camel_service_get_name (CAMEL_SERVICE (store), FALSE); - - ftree->e_storage = mail_lookup_storage (store); /* this gives us a ref */ - - fe_create_root_node (ftree); - - return ftree; -} - -static -E_MAKE_TYPE (folder_etree, "FolderETree", FolderETree, folder_etree_class_init, folder_etree_init, E_TREE_MEMORY_TYPE); - -/* public */ - -static FolderETree * -folder_etree_new (CamelStore *store) -{ - FolderETree *ftree; - - ftree = gtk_type_new (folder_etree_get_type()); - ftree = folder_etree_construct (ftree, store); - return ftree; -} - -static void -folder_etree_clear_tree (FolderETree *ftree) -{ - e_tree_memory_freeze (E_TREE_MEMORY (ftree)); - e_tree_memory_node_remove (E_TREE_MEMORY (ftree), ftree->root); - fe_create_root_node (ftree); - e_tree_memory_thaw (E_TREE_MEMORY (ftree)); -} - -static void -folder_etree_set_search (FolderETree *ftree, const char *search) -{ - if (!strcmp (search, ftree->search)) - return; - - g_free (ftree->search); - ftree->search = g_strdup (search); - - folder_etree_clear_tree (ftree); -} - - -static int -folder_etree_path_set_subscription (FolderETree *ftree, ETreePath path, gboolean subscribe) -{ - ftree_op_data *closure; - ftree_node *node; - - /* already in progress? */ - - if (g_hash_table_lookup (ftree->subscribe_ops, path)) - return 0; - - /* noselect? */ - - node = e_tree_memory_node_get_data (E_TREE_MEMORY (ftree), path); - - if (!ftree_node_subscribable (node)) - return -1; - - /* noop? */ - - /* uh, this should be a not XOR or something */ - if ((ftree_node_subscribed (node) && subscribe) || - (!ftree_node_subscribed (node) && !subscribe)) - return 0; - - closure = g_new (ftree_op_data, 1); - closure->ftree = ftree; - closure->path = path; - closure->data = node; - closure->handle = -1; - - g_hash_table_insert (ftree->subscribe_ops, path, closure); - - closure->handle = subscribe_do_subscribe_folder (ftree->store, - ftree_node_get_full_name (node), - ftree_node_get_name (node), - subscribe, - fe_done_subscribing, - closure); - return 0; -} - -static int -folder_etree_path_toggle_subscription (FolderETree *ftree, ETreePath path) -{ - ftree_node *node = e_tree_memory_node_get_data (E_TREE_MEMORY (ftree), path); - - if (ftree_node_subscribed (node)) - return folder_etree_path_set_subscription (ftree, path, FALSE); - else - return folder_etree_path_set_subscription (ftree, path, TRUE); -} - -/* ** StoreData ************************************************************ */ - -typedef struct _StoreData StoreData; - -typedef void (*StoreDataStoreFunc) (StoreData *, CamelStore *, gpointer); - -struct _StoreData { - int refcount; - char *uri; - - FolderETree *ftree; - CamelStore *store; - - int request_id; - - GtkWidget *widget; - StoreDataStoreFunc store_func; - gpointer store_data; -}; - -static StoreData * -store_data_new (const char *uri) -{ - StoreData *sd; - - sd = g_new0 (StoreData, 1); - sd->refcount = 1; - sd->uri = g_strdup (uri); - - return sd; -} - -static void -store_data_free (StoreData *sd) -{ - if (sd->request_id) - mail_msg_cancel (sd->request_id); - - if (sd->widget) - gtk_object_unref (GTK_OBJECT (sd->widget)); - - if (sd->ftree) - gtk_object_unref (GTK_OBJECT (sd->ftree)); - - if (sd->store) - camel_object_unref (CAMEL_OBJECT (sd->store)); - - g_free (sd->uri); - g_free (sd); -} - -static void -store_data_ref (StoreData *sd) -{ - sd->refcount++; -} - -static void -store_data_unref (StoreData *sd) -{ - if (sd->refcount <= 1) { - store_data_free (sd); - } else { - sd->refcount--; - } -} - -static void -sd_got_store (char *uri, CamelStore *store, gpointer user_data) -{ - StoreData *sd = (StoreData *) user_data; - - sd->store = store; - - if (store) /* we can have exceptions getting the store... server is down, eg */ - camel_object_ref (CAMEL_OBJECT (sd->store)); - - /* uh, so we might have a problem if this operation is cancelled. Unsure. */ - sd->request_id = 0; - - if (sd->store_func) - (sd->store_func) (sd, sd->store, sd->store_data); - - store_data_unref (sd); -} - -static void -store_data_async_get_store (StoreData *sd, StoreDataStoreFunc func, gpointer user_data) -{ - if (sd->request_id) { - d(printf ("Already loading store, nooping\n")); - return; - } - - if (sd->store) { - /* um, is this the best behavior? */ - func (sd, sd->store, user_data); - return; - } - - sd->store_func = func; - sd->store_data = user_data; - store_data_ref (sd); - sd->request_id = mail_get_store (sd->uri, sd_got_store, sd); -} - -static void -store_data_cancel_get_store (StoreData *sd) -{ - g_return_if_fail (sd->request_id); - - mail_msg_cancel (sd->request_id); - sd->request_id = 0; -} - -static void -sd_toggle_cb (ETree *tree, int row, ETreePath path, int col, GdkEvent *event, gpointer user_data) -{ - StoreData *sd = (StoreData *) user_data; - - folder_etree_path_toggle_subscription (sd->ftree, path); -} - -static GtkWidget * -store_data_get_widget (StoreData *sd) -{ - GtkWidget *tree; - - if (!sd->store) { - d(printf ("store data can't get widget before getting store.\n")); - return NULL; - } - - if (sd->widget) - return sd->widget; - - sd->ftree = folder_etree_new (sd->store); - - /* You annoy me, etree! */ - tree = gtk_widget_new (E_TREE_SCROLLED_TYPE, - "hadjustment", NULL, - "vadjustment", NULL, - NULL); - - tree = (GtkWidget *) e_tree_scrolled_construct_from_spec_file (E_TREE_SCROLLED (tree), - E_TREE_MODEL (sd->ftree), - subscribe_get_global_extras (), - EVOLUTION_ETSPECDIR "/subscribe-dialog.etspec", - NULL); - e_tree_root_node_set_visible (e_tree_scrolled_get_tree(E_TREE_SCROLLED(tree)), TRUE); - gtk_signal_connect (GTK_OBJECT (e_tree_scrolled_get_tree(E_TREE_SCROLLED (tree))), - "double_click", GTK_SIGNAL_FUNC (sd_toggle_cb), sd); - - gtk_object_unref (GTK_OBJECT (global_extras)); - - sd->widget = tree; - gtk_object_ref (GTK_OBJECT (sd->widget)); - - return sd->widget; -} - -typedef struct _selection_closure { - StoreData *sd; - enum { SET, CLEAR, TOGGLE } mode; -} selection_closure; - -static void -sd_subscribe_folder_foreach (int model_row, gpointer closure) -{ - selection_closure *sc = (selection_closure *) closure; - StoreData *sd = sc->sd; - ETree *tree = e_tree_scrolled_get_tree(E_TREE_SCROLLED(sd->widget)); - ETreePath path = e_tree_node_at_row (tree, model_row); - - /* ignore results */ - switch (sc->mode) { - case SET: - folder_etree_path_set_subscription (sd->ftree, path, TRUE); - break; - case CLEAR: - folder_etree_path_set_subscription (sd->ftree, path, FALSE); - break; - case TOGGLE: - folder_etree_path_toggle_subscription (sd->ftree, path); - break; - } -} - -static void -store_data_selection_set_subscription (StoreData *sd, gboolean subscribe) -{ - selection_closure sc; - ETree *tree; - - sc.sd = sd; - if (subscribe) - sc.mode = SET; - else - sc.mode = CLEAR; - - tree = e_tree_scrolled_get_tree (E_TREE_SCROLLED (sd->widget)); - e_tree_selected_row_foreach (tree, sd_subscribe_folder_foreach, &sc); -} - -#ifdef NEED_TOGGLE_SELECTION -static void -store_data_selection_toggle_subscription (StoreData *sd) -{ - selection_closure sc; - ETree *tree; - - sc.sd = sd; - sc.mode = TOGGLE; - - tree = e_tree_scrolled_get_tree (E_TREE_SCROLLED (sd->widget)); - e_tree_selected_row_foreach (tree, sd_subscribe_folder_foreach, &sc); -} -#endif - -static gboolean -store_data_mid_request (StoreData *sd) -{ - return (gboolean) sd->request_id; -} - -/* ** yaay, SubscribeDialog ******************************************************* */ - -#define PARENT_TYPE (gtk_object_get_type ()) - -#ifdef JUST_FOR_TRANSLATORS -static char *str = N_("Folder"); -#endif - -#define STORE_DATA_KEY "store-data" - -struct _SubscribeDialogPrivate { - GladeXML *xml; - GList *store_list; - - StoreData *current_store; - GtkWidget *current_widget; - - GtkWidget *default_widget; - GtkWidget *none_item; - GtkWidget *search_entry; - GtkWidget *hbox; - GtkWidget *filter_radio, *all_radio; - GtkWidget *sub_button, *unsub_button, *refresh_button; -}; - -static GtkObjectClass *subscribe_dialog_parent_class; - -static void -sc_refresh_pressed (GtkWidget *widget, gpointer user_data) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (user_data); - - if (sc->priv->current_store) - folder_etree_clear_tree (sc->priv->current_store->ftree); -} - -static void -sc_search_activated (GtkWidget *widget, gpointer user_data) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (user_data); - StoreData *store = sc->priv->current_store; - char *search; - - if (!store) - return; - - search = e_utf8_gtk_entry_get_text (GTK_ENTRY (widget)); - folder_etree_set_search (store->ftree, search); -} - -static void -sc_subscribe_pressed (GtkWidget *widget, gpointer user_data) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (user_data); - StoreData *store = sc->priv->current_store; - - if (!store) - return; - - store_data_selection_set_subscription (store, TRUE); -} - -static void -sc_unsubscribe_pressed (GtkWidget *widget, gpointer user_data) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (user_data); - StoreData *store = sc->priv->current_store; - - if (!store) - return; - - store_data_selection_set_subscription (store, FALSE); -} - -static void -sc_all_toggled (GtkWidget *widget, gpointer user_data) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (user_data); - StoreData *store = sc->priv->current_store; - - if (!store) - return; - - if (GTK_TOGGLE_BUTTON (widget)->active) { - gtk_widget_set_sensitive (sc->priv->search_entry, FALSE); - folder_etree_set_search (store->ftree, ""); - } -} - -static void -sc_filter_toggled (GtkWidget *widget, gpointer user_data) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (user_data); - StoreData *store = sc->priv->current_store; - - if (!store) - return; - - if (GTK_TOGGLE_BUTTON (widget)->active) { - gtk_widget_set_sensitive (sc->priv->search_entry, TRUE); - sc_search_activated (sc->priv->search_entry, sc); - } -} - -static void -populate_store_foreach (MailConfigService *service, SubscribeDialog *sc) -{ - StoreData *sd; - - if (service->url == NULL || service->enabled == FALSE) - return; - - sd = store_data_new (service->url); - sc->priv->store_list = g_list_prepend (sc->priv->store_list, sd); -} - -static void -kill_default_view (SubscribeDialog *sc) -{ - gtk_widget_hide (sc->priv->none_item); - - /* the entry will be set sensitive when one of the - * radio buttons is activated, if necessary. */ - - gtk_widget_set_sensitive (sc->priv->all_radio, TRUE); - gtk_widget_set_sensitive (sc->priv->filter_radio, TRUE); - gtk_widget_set_sensitive (sc->priv->sub_button, TRUE); - gtk_widget_set_sensitive (sc->priv->unsub_button, TRUE); - gtk_widget_set_sensitive (sc->priv->refresh_button, TRUE); -} - -static void -sc_selection_changed (GtkObject *obj, gpointer user_data) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (user_data); - gboolean sensitive; - - if (e_selection_model_selected_count (E_SELECTION_MODEL (obj))) - sensitive = TRUE; - else - sensitive = FALSE; - - gtk_widget_set_sensitive (sc->priv->sub_button, sensitive); - gtk_widget_set_sensitive (sc->priv->unsub_button, sensitive); -} - -static void -menu_item_selected (GtkMenuItem *item, gpointer user_data) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (user_data); - StoreData *sd = gtk_object_get_data (GTK_OBJECT (item), STORE_DATA_KEY); - - g_return_if_fail (sd); - - if (sd->widget == NULL) { - GtkWidget *widget; - ESelectionModel *esm; - ETree *tree; - - widget = store_data_get_widget (sd); - gtk_box_pack_start (GTK_BOX (sc->priv->hbox), widget, TRUE, TRUE, 0); - - tree = e_tree_scrolled_get_tree (E_TREE_SCROLLED (widget)); - esm = e_tree_get_selection_model (tree); - gtk_signal_connect (GTK_OBJECT (esm), "selection_changed", sc_selection_changed, sc); - sc_selection_changed ((GtkObject *)esm, sc); - } - - if (sc->priv->current_widget == sc->priv->default_widget) - kill_default_view (sc); - - gtk_widget_hide (sc->priv->current_widget); - gtk_widget_show (sd->widget); - sc->priv->current_widget = sd->widget; - sc->priv->current_store = sd; - - if (*sd->ftree->search) { - e_utf8_gtk_entry_set_text (GTK_ENTRY (sc->priv->search_entry), sd->ftree->search); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sc->priv->filter_radio), TRUE); - } else { - e_utf8_gtk_entry_set_text (GTK_ENTRY (sc->priv->search_entry), ""); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sc->priv->all_radio), TRUE); - } -} - -static void -dummy_item_selected (GtkMenuItem *item, gpointer user_data) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (user_data); - - gtk_widget_hide (sc->priv->current_widget); - gtk_widget_show (sc->priv->default_widget); - sc->priv->current_widget = sc->priv->default_widget; - sc->priv->current_store = NULL; - - e_utf8_gtk_entry_set_text (GTK_ENTRY (sc->priv->search_entry), ""); -} - -/* wonderful */ - -static void -got_sd_store (StoreData *sd, CamelStore *store, gpointer data) -{ - if (store && camel_store_supports_subscriptions (store)) - gtk_widget_show (GTK_WIDGET (data)); -} - -/* FIXME: if there aren't any stores that are subscribable, the option - * menu will only have the "No server selected" item and the user will - * be confused. */ - -static void -populate_store_list (SubscribeDialog *sc) -{ - const GSList *news; - GSList *sources; - GList *iter; - GtkWidget *menu; - GtkWidget *omenu; - - 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); - - menu = gtk_menu_new (); - - for (iter = sc->priv->store_list; iter; iter = iter->next) { - GtkWidget *item; - CamelURL *url; - char *string; - - url = camel_url_new (((StoreData *) iter->data)->uri, NULL); - string = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); - camel_url_free (url); - item = gtk_menu_item_new_with_label (string); - store_data_async_get_store (iter->data, got_sd_store, item); - gtk_object_set_data (GTK_OBJECT (item), STORE_DATA_KEY, iter->data); - gtk_signal_connect (GTK_OBJECT (item), "activate", menu_item_selected, sc); - g_free (string); - - gtk_menu_prepend (GTK_MENU (menu), item); - } - - sc->priv->none_item = gtk_menu_item_new_with_label (_("No server has been selected")); - gtk_signal_connect (GTK_OBJECT (sc->priv->none_item), "activate", dummy_item_selected, sc); - gtk_widget_show (sc->priv->none_item); - gtk_menu_prepend (GTK_MENU (menu), sc->priv->none_item); - - gtk_widget_show (menu); - - omenu = glade_xml_get_widget (sc->priv->xml, "store_menu"); - gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu); -} - -static void -subscribe_dialog_destroy (GtkObject *object) -{ - SubscribeDialog *sc; - GList *iter; - - sc = SUBSCRIBE_DIALOG (object); - - for (iter = sc->priv->store_list; iter; iter = iter->next) { - StoreData *data = iter->data; - - if (store_data_mid_request (data)) - store_data_cancel_get_store (data); - - data->store_func = NULL; - - store_data_unref (data); - } - - g_list_free (sc->priv->store_list); - - gtk_object_unref (GTK_OBJECT (sc->priv->xml)); - - g_free (sc->priv); - - 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) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (object); - - sc->priv = g_new0 (SubscribeDialogPrivate, 1); -} - -static GtkWidget * -sc_create_default_widget (void) -{ - GtkWidget *label; - GtkWidget *viewport; - - label = gtk_label_new (_("Please select a server.")); - gtk_widget_show (label); - - viewport = gtk_viewport_new (NULL, NULL); - gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_IN); - gtk_container_add (GTK_CONTAINER (viewport), label); - - return viewport; -} - -static void -subscribe_dialog_construct (GtkObject *object) -{ - SubscribeDialog *sc = SUBSCRIBE_DIALOG (object); - - /* Load the XML */ - sc->priv->xml = glade_xml_new (EVOLUTION_GLADEDIR "/subscribe-dialog.glade", NULL); - - sc->app = glade_xml_get_widget (sc->priv->xml, "Manage Subscriptions"); - sc->priv->hbox = glade_xml_get_widget (sc->priv->xml, "tree_box"); - sc->priv->search_entry = glade_xml_get_widget (sc->priv->xml, "search_entry"); - sc->priv->filter_radio = glade_xml_get_widget (sc->priv->xml, "filter_radio"); - sc->priv->all_radio = glade_xml_get_widget (sc->priv->xml, "all_radio"); - sc->priv->sub_button = glade_xml_get_widget (sc->priv->xml, "subscribe_button"); - sc->priv->unsub_button = glade_xml_get_widget (sc->priv->xml, "unsubscribe_button"); - sc->priv->refresh_button = glade_xml_get_widget (sc->priv->xml, "refresh_button"); - - /* create default view */ - sc->priv->default_widget = sc_create_default_widget(); - sc->priv->current_widget = sc->priv->default_widget; - gtk_box_pack_start (GTK_BOX (sc->priv->hbox), sc->priv->default_widget, TRUE, TRUE, 0); - gtk_widget_show (sc->priv->default_widget); - - gtk_widget_set_sensitive (sc->priv->all_radio, FALSE); - gtk_widget_set_sensitive (sc->priv->filter_radio, FALSE); - gtk_widget_set_sensitive (sc->priv->search_entry, FALSE); - gtk_widget_set_sensitive (sc->priv->sub_button, FALSE); - gtk_widget_set_sensitive (sc->priv->unsub_button, FALSE); - gtk_widget_set_sensitive (sc->priv->refresh_button, FALSE); - - /* hook up some signals */ - gtk_signal_connect (GTK_OBJECT (sc->priv->search_entry), "activate", sc_search_activated, sc); - gtk_signal_connect (GTK_OBJECT (sc->priv->sub_button), "clicked", sc_subscribe_pressed, sc); - gtk_signal_connect (GTK_OBJECT (sc->priv->unsub_button), "clicked", sc_unsubscribe_pressed, sc); - gtk_signal_connect (GTK_OBJECT (sc->priv->refresh_button), "clicked", sc_refresh_pressed, sc); - gtk_signal_connect (GTK_OBJECT (sc->priv->all_radio), "toggled", sc_all_toggled, sc); - gtk_signal_connect (GTK_OBJECT (sc->priv->filter_radio), "toggled", sc_filter_toggled, sc); - - /* Get the list of stores */ - populate_store_list (sc); -} - -GtkObject * -subscribe_dialog_new (void) -{ - SubscribeDialog *subscribe_dialog; - - subscribe_dialog = gtk_type_new (SUBSCRIBE_DIALOG_TYPE); - subscribe_dialog_construct (GTK_OBJECT (subscribe_dialog)); - - return GTK_OBJECT (subscribe_dialog); -} - -E_MAKE_TYPE (subscribe_dialog, "SubscribeDialog", SubscribeDialog, subscribe_dialog_class_init, subscribe_dialog_init, PARENT_TYPE); diff --git a/mail/subscribe-dialog.etspec b/mail/subscribe-dialog.etspec deleted file mode 100644 index 1f5decbb36..0000000000 --- a/mail/subscribe-dialog.etspec +++ /dev/null @@ -1,9 +0,0 @@ -<ETableSpecification cursor-mode="line" no-headers="true"> - <ETableColumn model_col="0" pixbuf="subscribed-image" expansion="0.0" minimum_width="16" resizable="false" cell="cell_toggle" compare="integer"/> - <ETableColumn model_col="1" _title="Folder" expansion="1.0" minimum_width="20" resizable="true" cell="cell_tree" compare="string"/> - <ETableState> - <column source="0"/> - <column source="1"/> - <grouping></grouping> - </ETableState> -</ETableSpecification> diff --git a/mail/subscribe-dialog.glade b/mail/subscribe-dialog.glade deleted file mode 100644 index 472491b3e8..0000000000 --- a/mail/subscribe-dialog.glade +++ /dev/null @@ -1,326 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>Evolution</name> - <program_name>evolution</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> - <translatable_strings_file>subscribe-dialog.glade.h</translatable_strings_file> -</project> - -<widget> - <class>GnomeDialog</class> - <name>Manage Subscriptions</name> - <title>Manage Subscriptions</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <default_width>484</default_width> - <default_height>423</default_height> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - <auto_close>False</auto_close> - <hide_on_close>False</hide_on_close> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDialog:vbox</child_name> - <name>dialog-vbox2</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>dialog-action_area2</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>8</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - <pack>GTK_PACK_END</pack> - </child> - - <widget> - <class>GtkButton</class> - <name>button9</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CLOSE</stock_button> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox2</name> - <border_width>3</border_width> - <homogeneous>False</homogeneous> - <spacing>3</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHBox</class> - <name>hbox1</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label1</name> - <label>Show _folders from server: </label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <default_focus_target>store_menu</default_focus_target> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>store_menu</name> - <can_focus>True</can_focus> - <items></items> - <initial_choice>0</initial_choice> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>tree_box</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox3</name> - <border_width>3</border_width> - <homogeneous>False</homogeneous> - <spacing>3</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - <pack>GTK_PACK_END</pack> - </child> - - <widget> - <class>GtkLabel</class> - <name>label2</name> - <label> -</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkVButtonBox</class> - <name>vbuttonbox2</name> - <layout_style>GTK_BUTTONBOX_SPREAD</layout_style> - <spacing>0</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkButton</class> - <name>subscribe_button</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <label>_Subscribe</label> - <relief>GTK_RELIEF_NORMAL</relief> - </widget> - - <widget> - <class>GtkButton</class> - <name>unsubscribe_button</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <label>_Unsubscribe</label> - <relief>GTK_RELIEF_NORMAL</relief> - </widget> - </widget> - - <widget> - <class>GtkHSeparator</class> - <name>hseparator1</name> - <child> - <padding>14</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkVButtonBox</class> - <name>vbuttonbox3</name> - <layout_style>GTK_BUTTONBOX_START</layout_style> - <spacing>10</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkButton</class> - <name>refresh_button</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <label> _Refresh List </label> - <relief>GTK_RELIEF_NORMAL</relief> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frame1</name> - <label>Display options</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHBox</class> - <name>hbox3</name> - <border_width>3</border_width> - <homogeneous>False</homogeneous> - <spacing>3</spacing> - - <widget> - <class>GtkRadioButton</class> - <name>all_radio</name> - <can_focus>True</can_focus> - <label>All folders</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>view_type</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkRadioButton</class> - <name>filter_radio</name> - <can_focus>True</can_focus> - <label>Folders whose names begin with:</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>view_type</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>search_entry</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkHButtonBox</class> - <name>hbuttonbox1</name> - <layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style> - <spacing>30</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/mail/subscribe-dialog.h b/mail/subscribe-dialog.h deleted file mode 100644 index 2acd34221d..0000000000 --- a/mail/subscribe-dialog.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Chris Toshok <toshok@ximian.com> - * Peter Williams <peterw@ximian.com> - * - * Copyright 2000 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 _SUBSCRIBE_DIALOG_H_ -#define _SUBSCRIBE_DIALOG_H_ - -#include <gtk/gtktable.h> -#include <bonobo/bonobo-control.h> -#include <bonobo/bonobo-property-bag.h> -#include <gal/e-table/e-tree-model.h> -#include <gal/e-table/e-table-model.h> -#include "shell/evolution-storage.h" -#include "mail-types.h" -#include "camel/camel-store.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)) - -typedef struct _SubscribeDialogPrivate SubscribeDialogPrivate; - -struct _SubscribeDialog { - GtkObject parent; - - GtkWidget *app; - SubscribeDialogPrivate *priv; -}; - - -typedef struct { - GtkObjectClass parent_class; -} SubscribeDialogClass; - -GtkType subscribe_dialog_get_type (void); -GtkObject *subscribe_dialog_new (void); - -/* helper macro */ -#define subscribe_dialog_show(dialog) gtk_widget_show (SUBSCRIBE_DIALOG (dialog)->app) - -#endif /* _SUBSCRIBE_DIALOG_H_ */ |