sync with sylpheed 0.4.65cvs10
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Fri, 27 Apr 2001 20:27:24 +0000 (20:27 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Fri, 27 Apr 2001 20:27:24 +0000 (20:27 +0000)
56 files changed:
ChangeLog
ChangeLog.claws
ChangeLog.jp
acconfig.h
configure.in
src/Makefile.am
src/about.c
src/automaton.c
src/automaton.h
src/compose.c
src/esmtp.c
src/esmtp.h
src/export.c
src/filesel.c
src/folder.c
src/gtkstext.c
src/imap.c
src/imap.h
src/inc.c
src/main.c
src/main.h
src/mainwindow.c
src/mbox.c
src/md5.h
src/md5c.c
src/mh.c
src/mimeview.c
src/news.c
src/nntp.c
src/nntp.h
src/pop.c
src/pop.h
src/prefs.c
src/prefs_account.c
src/prefs_account.h
src/prefs_common.c
src/prefs_common.h
src/procheader.c
src/progressdialog.c
src/progressdialog.h
src/recv.c
src/recv.h
src/rfc2015.c
src/select-keys.c
src/send.c
src/session.h
src/sigstatus.c [new file with mode: 0644]
src/sigstatus.h [new file with mode: 0644]
src/simple-gettext.c [new file with mode: 0644]
src/smtp.c
src/smtp.h
src/socket.c
src/socket.h
src/summaryview.c
src/utils.c
src/utils.h

index ec782012b138a7e9b8926e3fa25f2d143d18cb9a..6b285e1794ea221c193cc1224f81ba7975d5959a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,190 @@
+2001-04-26
+
+       * src/mh.c: mh_is_maildir_one(): modified so that it uses
+         is_dir_exist().
+
+2001-04-25  Werner Koch  <wk@gnupg.org>
+
+       * src/mh.c (mh_is_maildir_one, mh_is_maildir): New.
+       (mh_scan_tree_recursive): Do not include Maildir style directories
+       in the scan.
+
+       Changed the use of integers to describe sockets by an more abstract
+       data structure.
+
+       * src/automaton.h (struct _Automaton): Add help_sock.
+       * src/automaton.c (automaton_input_cb): Changed source to be
+       SockInfo and use wrapper for gdk_input_add.
+
+       * src/send.c (SEND_EXIT_IF_ERROR): Adjusted tests and removed test
+       for invalid socket because this is now done in sock_close. Set
+       sock to NULL.
+       (SEND_EXIT_IF_NOTOK): Set closed sock to NULL.
+       (send_smtp_open): Use only SockInfo.
+
+       * src/news.c (news_session_new): Use SockInfo here.
+       (news_session_destroy): Ditto and set sock to NULL.
+
+       * src/nntp.c: Use SockInfo instead of integers
+       * src/smtp.c: Ditto.
+       * src/pop.c: Ditto.
+       * src/recv.c: Ditto.
+
+       * src/inc.c (inc_pop3_session_do): Removed sock_sockinfo_free. Put
+       gdk_input_add into a wrapper.
+
+       * src/esmtp.c: Changed socket descriptors to use SockInfo.
+       * src/esmtp.h: Ditto, included socket.h.
+       * src/session.h (struct _Session): Likewise.
+       * src/imap.c (imap_open): Return SockInfo ptr and not an integer.
+       Removed access to internal data of SockInfo.  Changed all callers
+       and functions to take SockInfo.
+       (imap_session_new): Use sock_close here.
+       (imap_session_destroy): Ditto.
+
+       * src/compose.c (compose_exec_ext_editor): Replaced sock_write by
+       fd_write.
+
+       * src/main.c (app_will_exit): Close lock socket using fd_close.
+       (prohibit_duplicate_launch): Use fd_xxx functions instead of sock_xxx.
+       (lock_socket_input_cb): Ditto.
+
+       * src/socket.h, src/socket.c: Prepared SockInfo structure to use
+       glib channels. Changed all sock_xxx to use SockInfo instead of an
+       integer.
+       (sock_connect_unix, sock_open_unix, sock_accept): Renamed to ..
+       (fd_connect_unix, fd_open_unix, fd_accept): .. this and changed all
+       callers.
+       (fd_read, fd_write, fd_close): New.
+       (sock_sockinfo_free): Removed.
+       * src/socket.c (sock_connect_nb): Use close instead sock_close here.
+       (sock_connect): Ditto.
+
+2001-04-26
+
+       * config.h.in: removed.
+       * ac/Makefile.am: added gnupg-check-typedef.m4 to MACROS.
+       * .cvsignore: added.
+       * src/inc.c
+         src/progressdialog.[ch]
+         src/pixmaps/complete.xpm
+         src/pixmaps/continue.xpm
+         src/pixmaps/error.xpm: applied the patch from Leandro Pereira
+         that displays the state of message incorporation (thanks!).
+       * src/inc.c: made the progress dialog change the text of status.
+
+2001-04-25
+
+       * removed po/*.gmo, configure, stamp-h.in, aclocal.m4, Makefile.in
+         from the cvs tree.
+       * COPYING: removed RSA copyright notice.
+       * removed po/sylpheed.pot, po/stamp-cat-id, po/cat-id-tbl.c.
+       * configure.in: added the check of sys/utsname.h.
+
+2001-04-24  Werner Koch  <wk@gnupg.org>
+
+       Merged most of the changes from the W32 branch in.
+
+       * configure.in: Require gpgme >= 0.2.1
+
+       * acconfig.h (HAVE_U32_TYPEDEF): New.
+       * ac/gnupg-check-typedef.m4: New.
+       * configure.in: Check for u32 type and the size of some types.
+       * src/utils.h: Define the u32 type and related constants.
+
+       * src/about.c (about_create): Removed the note about MD5.  We are
+       not any longer using the RSA Inc. implementation.
+       * src/md5ify.c, src/md5ify.h, src/md5global.h:  Removed.
+       * src/md5c.c, src/md5c.h: Replaced by an FSF implementation and
+       renamed the function to standard lowercase convention. Changed all
+       callers. 
+       (md5_hex_digest): New.
+       (md5_hmac): Add hmac function by Martin Schaaf with some 
+       modifications.
+       (md5_hex_hmac): New.
+       * src/esmtp.c, src/esmtp.h (md5_hex_hmac): Removed.
+       (hmac_md5): Removed.
+       * src/pop.c (pop3_getauth_apop_send): Replaced the md5_digest by
+       the new md5_hex_digest function.
+
+       * src/about.c: Include utsname.h only if available
+
+       * src/utils.c, src/utils.h (get_home_dir): New to better cope with
+       special Windoze requirements.  Changed all calls to
+       g_get_home_dir() to this function.
+
+       * simple-gettext.c: New.
+
+       * src/main.c (main): Issue a warning if GnuPG is not properly
+       installed.
+
+       * src/sigstatus.c, src/sigstatus.h: New.
+       * src/rfc2015.c (check_signature): Use the sigstatus window and
+       get the status texts from a utility function.
+
+       * src/select-keys.c: Removed the global select_keys var and
+       pass an allocated one along all functions.
+       (set_row): Display only keys capable of encryption.
+       (update_progress): Replaced the progressbar by
+       a windmill and a text showing for which key we are collecting
+       info.  Removed progressbar everywhere else and updated callers.
+
+       * src/prefs_common.c (prefs_privacy_create) [__MINGW32__]: Do not
+       display the grab button. 
+
+2001-04-24
+
+       * src/prefs_common.[ch]
+         src/procheader.c: applied the patch from Darko Koruga that
+         allows user to define their own format for displaying date in
+         summary view using strftime() (thanks!).
+       * src/prefs_common.c: prefs_quote_colors_dialog()
+         src/mainwindow.c: main_window_reflect_prefs_all(): made it
+         update message colors if the colors setting is changed.
+       * src/main.[ch]: made it remember the startup directory.
+       * src/export.c: export_mbox(): made it initially chdir to the
+         startup directory.
+       * src/filesel.c: filesel_select_file(): made it open the startup
+         directory at first.
+
+2001-04-23
+
+       * added option to warn about queued messages on exit [sergey]:
+
+         * src/compose.c: compose_queue(): call folder_item_scan()
+           and folderview_update_item() after queueing.
+         * src/folderview.c: folderview_update_node(): draw the queue
+           folder in bold font if there are queued messages.
+         * src/mainwindow.c: queued_messages(): new function.
+           app_exit_cb(): display warning if there are queued messages
+           if warn_queued_on_exit is set.
+         * prefs_common.[ch]: add warn_queued_on_exit option.
+
+       * src/mainwindow.c: moved queued_messages() to main.c, and renamed
+         it to get_queued_message_num().
+       * src/main.c: app_will_exit(): moved warning dialog code from
+         app_exit_cb(), and added manage_window_focus_in().
+
+       * enhanced GnuPG key selection support [sergey]:
+
+         * src/select-keys.c: updated to newer version from Win32
+           branch with support for selecting arbitrary keys.
+         * src/prefs_account.c: added the Privacy tab to the account
+           options window.
+           prefs_account_privacy_create(),
+           prefs_account_sign_key_set_data_from_radiobtn(),
+           prefs_account_sign_key_set_radiobtn(): new functions.
+         * src/prefs_account.h: new preferences sign_key_type, sign_key_id.
+         * src/rfc2015.c: set_signers(): new function.
+           pgp_sign(): add the account parameter, call set_signers().
+           rfc2015_sign(): add the account parameter, pass it to pgp_sign().
+         * src/rfc2015.h: rfc2015_sign(): updated prototype.
+         * src/compose.c: pass the current account to rfc2015_sign().
+
+2001-04-22
+
+       * src/mbox.c: export_to_mbox(): fixed a memory leak bug.
+
 2001-04-20
 
        * src/mbox.[ch]: renamed export_mbox() to export_to_mbox().
 2001-04-20
 
        * src/mbox.[ch]: renamed export_mbox() to export_to_mbox().
index 8c1aa6525838e622dffa1ed345f33e191478bdbb..497bf72523d51dba32dd02561889830f64e0bd0d 100644 (file)
@@ -1,3 +1,8 @@
+2001-04-27 [alfons]
+
+       * completed sync with 0.4.65cvs10
+       * minor debug things added to gtkstext.c
+
 2001-04-27 [darko]
 
        * configure.in: remove check for availability of
 2001-04-27 [darko]
 
        * configure.in: remove check for availability of
index 82b06581714ab44d1d17033f60311413e65ff616..d3de5e90d673273da3438b0fa8813344e6ec2f8d 100644 (file)
@@ -1,3 +1,194 @@
+2001-04-26
+
+       * src/mh.c: mh_is_maildir_one(): is_dir_exist() ¤ò»ÈÍѤ¹¤ë¤è¤¦¤Ë
+         ½¤Àµ¡£
+
+2001-04-25  Werner Koch  <wk@gnupg.org>
+
+       * src/mh.c (mh_is_maildir_one, mh_is_maildir): ¿·µ¬¡£
+       (mh_scan_tree_recursive): ¥¹¥­¥ã¥ó¤Ç Maildir ·¿¤Î¥Ç¥£¥ì¥¯¥È¥ê¤ò
+       ´Þ¤Þ¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£
+
+       À°¿ô·¿¤Ç socket ¤òɽ¤·¤Æ¤¤¤¿¤Î¤ò¡¢¤è¤êÃê¾ÝŪ¤Ê¥Ç¡¼¥¿¹½Â¤¤ËÊѹ¹¡£
+
+       * src/automaton.h (struct _Automaton): help_sock ¤òÄɲá£
+       * src/automaton.c (automaton_input_cb): source ¤ò SockInfo ¤ËÄɲÃ
+       ¤·¡¢ gdk_input_add ¤Î¥é¥Ã¥Ñ¡¼¤ò»ÈÍѤ¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+
+       * src/send.c (SEND_EXIT_IF_ERROR): ¥Æ¥¹¥È¤ò½¤Àµ¤·¡¢Ìµ¸ú¤Ê socket
+       ¤Î¥Æ¥¹¥È¤ò¼è¤ê½ü¤¤¤¿(sock_close ¤Ç¹Ô¤ï¤ì¤ë¤¿¤á)¡£ sock ¤ò NULL
+       ¤Ë¥»¥Ã¥È¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+       (SEND_EXIT_IF_NOTOK): ÊĤ¸¤é¤ì¤¿ sock ¤ò NULL ¤Ë¥»¥Ã¥È¤¹¤ë¤è¤¦¤Ë
+       ¤·¤¿¡£
+       (send_smtp_open): SockInfo ¤Î¤ß¤ò»ÈÍѤ¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+
+       * src/news.c (news_session_new): SockInfo ¤ò»ÈÍÑ¡£
+       (news_session_destroy): Æ±¾å¡¢ sock ¤ò NULL ¤Ë¥»¥Ã¥È¡£
+
+       * src/nntp.c: À°¿ô·¿¤ÎÂå¤ï¤ê¤Ë SockInfo ¤ò»ÈÍÑ¡£
+       * src/smtp.c: Æ±¾å¡£
+       * src/pop.c: Æ±¾å¡£
+       * src/recv.c: Æ±¾å¡£
+
+       * src/inc.c (inc_pop3_session_do): sock_sockinfo_free ¤òºï½ü¡£
+       gdk_input_add ¤ò¥é¥Ã¥Ñ¡¼¤ÇÊñ¤ó¤À¡£
+
+       * src/esmtp.c: socket »Ø¼¨»Ò¤ò SockInfo ¤ò»È¤¦¤è¤¦¤ËÊѹ¹¡£
+       * src/esmtp.h: Æ±¾å¡¢ socket.h ¤ò include ¤·¤¿¡£
+       * src/session.h (struct _Session): Æ±¤¸¤¯¡£
+       * src/imap.c (imap_open): À°¿ô·¿¤Ç¤Ê¤¯ SockInfo ¤òÊÖ¤¹¤è¤¦¤Ë¤·¤¿¡£
+       SockInfo ¤ÎÆâÉô¥Ç¡¼¥¿¤Ø¤Î¥¢¥¯¥»¥¹¤òºï½ü¡£Á´¤Æ¤Î¸Æ¤Ó½Ð¤·Â¦¤È´Ø¿ô
+       ¤¬ SockInfo ¤ò¤È¤ë¤è¤¦¤Ë¤·¤¿¡£
+       (imap_session_new): sock_close ¤ò»ÈÍѤ¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+       (imap_session_destroy): Æ±¾å¡£
+
+       * src/compose.c (compose_exec_ext_editor): sock_write ¤ò fd_write
+       ¤ÇÃÖ¤­´¹¤¨¤¿¡£
+
+       * src/main.c (app_will_exit): lock socket ¤ò fd_close ¤Ç close ¤¹¤ë
+       ¤è¤¦¤Ë¤·¤¿¡£
+       (prohibit_duplicate_launch): sock_xxx ¤ÎÂå¤ï¤ê¤Ë fd_xxx ¤ò»ÈÍÑ¡£
+       (lock_socket_input_cb): Æ±¾å¡£
+
+       * src/socket.h, src/socket.c: SockInfo ¹½Â¤ÂΤò glib ¥Á¥ã¥Í¥ë¤ò
+       »ÈÍѤ¹¤ë¤è¤¦¤Ë½àÈ÷¡£Á´¤Æ¤Î sock_xxx ¤ò¡¢À°¿ô·¿¤ÎÂå¤ï¤ê¤Ë SockInfo
+       ¤ò»ÈÍѤ¹¤ë¤è¤¦¤ËÊѹ¹¡£
+       (sock_connect_unix, sock_open_unix, sock_accept): Ì¾Á°¤ò ..
+       (fd_connect_unix, fd_open_unix, fd_accept): .. ¤³¤ì¤ËÊѹ¹¤·¡¢Á´¤Æ¤Î
+       ¸Æ¤Ó½Ð¤·Â¦¤âÊѹ¹¡£
+       (fd_read, fd_write, fd_close): ¿·µ¬¡£
+       (sock_sockinfo_free): ºï½ü¡£
+       * src/socket.c (sock_connect_nb): ¤³¤³¤Ç¤Ï sock_close ¤ÎÂå¤ï¤ê¤Ë
+       close ¤ò»ÈÍÑ¡£
+       (sock_connect): Æ±¾å¡£
+
+2001-04-26
+
+       * config.h.in: ºï½ü¡£
+       * ac/Makefile.am: gnupg-check-typedef.m4 ¤ò MACROS ¤ËÄɲá£
+       * .cvsignore: Äɲá£
+       * src/inc.c
+         src/progressdialog.[ch]
+         src/pixmaps/complete.xpm
+         src/pixmaps/continue.xpm
+         src/pixmaps/error.xpm: ¥á¥Ã¥»¡¼¥¸¤Î¼è¤ê¹þ¤ß¤Î¾õÂÖ¤òɽ¼¨¤¹¤ë
+         Leandro Pereira ¤µ¤ó¤Î¥Ñ¥Ã¥Á¤òŬÍÑ(thanks!)¡£
+       * src/inc.c: ¾õÂÖ¤Îʸ»úÎó¤òÀÚÂؤ¨¤ë¤è¤¦¤Ë¤·¤¿¡£
+
+2001-04-25
+
+       * cvs ¥Ä¥ê¡¼¤«¤é po/*.gmo, configure, stamp-h.in, aclocal.m4,
+         Makefile.in ¤òºï½ü¡£
+       * COPYING: RSA ¤ÎÃøºî¸¢É½¼¨¤òºï½ü¡£
+       * po/sylpheed.pot, po/stamp-cat-id, po/cat-id-tbl.c ¤òºï½ü¡£
+       * configure.in: sys/utsname.h ¤Î¥Á¥§¥Ã¥¯¤òÄɲá£
+
+2001-04-24  Werner Koch  <wk@gnupg.org>
+
+       W32 ¥Ö¥é¥ó¥Á¤ÎÂçÉôʬ¤ò¥Þ¡¼¥¸¡£
+
+       * configure.in: gpgme >= 0.2.1 ¤òÍ׵ᡣ
+
+       * acconfig.h (HAVE_U32_TYPEDEF): ¿·µ¬¡£
+       * ac/gnupg-check-typedef.m4: ¿·µ¬¡£
+       * configure.in: u32 ·¿¤È¤¤¤¯¤Ä¤«¤Î·¿¤Î¥µ¥¤¥º¤ò¥Á¥§¥Ã¥¯¡£
+       * src/utils.h: u32 ·¿¤È´Ø·¸¤¹¤ëÄê¿ô¤òÄêµÁ¡£
+
+       * src/about.c (about_create): MD5 ¤Ë´Ø¤¹¤ëɽ¼¨¤òºï½ü¡£RSA Inc ¤Î
+       ¼ÂÁõ¤Ï¤â¤¦»ÈÍѤµ¤ì¤Æ¤¤¤Þ¤»¤ó¡£
+       * src/md5ify.c, src/md5ify.h, src/md5global.h: ºï½ü¡£
+       * src/md5c.c, src/md5c.h: FSF ¤Î¼ÂÁõ¤ÇÃÖ´¹¤·¡¢´Ø¿ô̾¤òɸ½à¤Î¾®Ê¸»ú
+       ¤Î̿̾µ¬Â§¤Ë¤·¤¿¤¬¤Ã¤ÆÊѹ¹¡£Á´¤Æ¤Î¸Æ¤Ó½Ð¤·Â¦¤òÊѹ¹¡£
+       (md5_hex_digest): ¿·µ¬¡£
+       (md5_hmac): Martin Schaaf ¤µ¤ó¤Ë¤è¤ë hmac ´Ø¿ô¤ò¾¯¤·½¤Àµ¤·¤ÆÄɲá£
+       (md5_hex_hmac): ¿·µ¬¡£
+       * src/esmtp.c, src/esmtp.h (md5_hex_hmac): ºï½ü¡£
+       (hmac_md5): ºï½ü¡£
+       * src/pop.c (pop3_getauth_apop_send): md5_digest ¤ò¿·¤·¤¤´Ø¿ô
+       md5_hex_digest ¤ÇÃÖ´¹¡£
+
+       * src/about.c: ÍøÍѲÄǽ¤Ê¾ì¹ç¤Î¤ß utsname.h ¤ò include ¤¹¤ë¤è¤¦¤Ë
+       ¤·¤¿¡£
+
+       * src/utils.c, src/utils.h (get_home_dir): ÆÃÊ̤ʠWindoze ¤ÎÍ×µá
+       ¤Ë¤è¤ê¤è¤¯Âбþ¤¹¤ë¤¿¤á¤ËÄɲá£Á´¤Æ¤Î g_get_home_dir() ¤Î¸Æ¤Ó½Ð¤·
+       ¤ò¤³¤Î´Ø¿ô¤ËÊѹ¹¡£
+
+       * simple-gettext.c: ¿·µ¬¡£
+
+       * src/main.c (main): GnuPG ¤¬Àµ¤·¤¯¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð
+       ·Ù¹ð¤ò½Ð¤¹¤è¤¦¤Ë¤·¤¿¡£
+
+       * src/sigstatus.c, src/sigstatus.h: ¿·µ¬¡£
+       * src/rfc2015.c (check_signature): sigstatus ¥¦¥£¥ó¥É¥¦¤ò»ÈÍѤ·¡¢
+       ¥æ¡¼¥Æ¥£¥ê¥Æ¥£´Ø¿ô¤«¤é¥¹¥Æ¡¼¥¿¥¹¥Æ¥­¥¹¥È¤òÆÀ¤ë¤è¤¦¤Ë¤·¤¿¡£
+
+       * src/select-keys.c: ¥°¥í¡¼¥Ð¥ë¤Î select_keys ÊÑ¿ô¤òºï½ü¤·¡¢
+       ¥¢¥í¥±¡¼¥È¤·¤¿ÊÑ¿ô¤òÁ´¤Æ¤Î´Ø¿ô¤ÇÅϤ¹¤è¤¦¤Ë¤·¤¿¡£
+       (set_row): °Å¹æ²½¤Ç¤­¤ë¸°¤Î¤ß¤òɽ¼¨¡£
+       (update_progress): ¥×¥í¥°¥ì¥¹¥Ð¡¼¤ò¡¢É÷¼Ö¤È¤É¤Î¸°¤Î¾ðÊó¤ò¼ý½¸
+       ¤·¤Æ¤¤¤ë¤«¤ò¼¨¤¹¥Æ¥­¥¹¥È¤ÇÃÖ¤­´¹¤¨¤¿¡£Â¾¤ÎÁ´¤Æ¤Î¥×¥í¥°¥ì¥¹¥Ð¡¼
+       ¤òºï½ü¤·¡¢¸Æ¤Ó½Ð¤·Â¦¤ò¹¹¿·¡£
+
+       * src/prefs_common.c (prefs_privacy_create) [__MINGW32__]: Êáª
+       ¥Ü¥¿¥ó¤òɽ¼¨¤·¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£
+
+2001-04-24
+
+       * src/prefs_common.[ch]
+         src/procheader.c: strftime() ¤ò»È¤¤¡¢¥æ¡¼¥¶¤¬¥µ¥Þ¥ê¥Ó¥å¡¼¤Ç
+         ÆüÉÕ¤Îɽ¼¨¤Î½ñ¼°¤òÄêµÁ¤Ç¤­¤ë¤è¤¦¤Ë¤¹¤ë Darko Koruga ¤µ¤ó¤Î¥Ñ¥Ã¥Á
+         ¤òŬÍÑ(thanks!)¡£
+       * src/prefs_common.c: prefs_quote_colors_dialog()
+         src/mainwindow.c: main_window_reflect_prefs_all(): ¿§¤ÎÀßÄ꤬
+         Êѹ¹¤µ¤ì¤¿¤é¥á¥Ã¥»¡¼¥¸¤Î¿§¤ò¹¹¿·¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+       * src/main.[ch]: µ¯Æ°»þ¤Î¥Ç¥£¥ì¥¯¥È¥ê¤òµ­²±¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+       * src/export.c: export_mbox(): ºÇ½é¤Ëµ¯Æ°»þ¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë chdir
+         ¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+       * src/filesel.c: filesel_select_file(): ºÇ½é¤Ëµ¯Æ°»þ¤Î¥Ç¥£¥ì¥¯¥È¥ê
+         ¤ò³«¤¯¤è¤¦¤Ë¤·¤¿¡£
+
+2001-04-23
+
+       * ½ªÎ»»þ¤ËÁ÷¿®ÂÔ¤Á¤Î¥á¥Ã¥»¡¼¥¸¤¬¤¢¤ì¤Ð·Ù¹ð¤¹¤ë¥ª¥×¥·¥ç¥ó¤òÄɲÃ
+         [sergey]:
+
+         * src/compose.c: compose_queue(): Á÷¿®ÂÔµ¡¸å¤Ë folder_item_scan()
+           ¤È folderview_update_item() ¤ò¸Æ¤Ö¤è¤¦¤Ë¤·¤¿¡£
+         * src/folderview.c: folderview_update_node(): Á÷¿®ÂÔ¤Á¤Î¥á¥Ã¥»¡¼¥¸
+           ¤¬¤¢¤ì¤ÐÁ÷¿®ÂÔ¤Á¥Õ¥©¥ë¥À¤ò¥Ü¡¼¥ë¥É¥Õ¥©¥ó¥È¤ÇÉÁ²è¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+         * src/mainwindow.c: queued_messages(): ¿·¤·¤¤´Ø¿ô¡£
+           app_exit_cb(): warn_queued_on_exit ¤¬¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤Æ¡¢Á÷¿®ÂÔ¤Á
+           ¤Î¥á¥Ã¥»¡¼¥¸¤¬¤¢¤ì¤Ð·Ù¹ð¤òɽ¼¨¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+         * prefs_common.[ch]: warn_queued_on_exit ¥ª¥×¥·¥ç¥ó¤òÄɲá£
+
+       * src/mainwindow.c: queued_messages() ¤ò main.c ¤Ë°ÜÆ°¤·¡¢
+         get_queued_message_num() ¤Ë̾¾ÎÊѹ¹¡£
+       * src/main.c: app_will_exit(): app_exit_cb() ¤«¤é·Ù¹ð¥À¥¤¥¢¥í¥°¤Î
+         ¥³¡¼¥É¤ò°ÜÆ°¤·¡¢manage_window_focus_in() ¤òÄɲá£
+
+       * GnuPG ¸°ÁªÂòÂбþ¤ò³ÈÄ¥ [sergey]:
+
+         * src/select-keys.c: Win32 ¥Ö¥é¥ó¥Á¤ÎºÇ¿·ÈǤ˹¹¿·¤·¡¢Ç¤°Õ¤Î¸°¤Î
+           ÁªÂò¤ËÂбþ¡£
+         * src/prefs_account.c: ¥¢¥«¥¦¥ó¥È¥ª¥×¥·¥ç¥ó¥¦¥£¥ó¥É¥¦¤Ë¡Öµ¡Ì©¡×
+           ¥¿¥Ö¤òÄɲá£
+           prefs_account_privacy_create(),
+           prefs_account_sign_key_set_data_from_radiobtn(),
+           prefs_account_sign_key_set_radiobtn(): ¿·¤·¤¤´Ø¿ô¡£
+         * src/prefs_account.h: ¿·¤·¤¤ÀßÄê: sign_key_type, sign_key_id.
+         * src/rfc2015.c: set_signers(): ¿·¤·¤¤´Ø¿ô¡£
+           pgp_sign(): ¥¢¥«¥¦¥ó¥È¥Ñ¥é¥á¡¼¥¿¤È set_signer() ¤Î¸Æ½Ð¤·¤òÄɲá£
+           rfc2015_sign(): ¥¢¥«¥¦¥ó¥È¥Ñ¥é¥á¡¼¥¿¤òÄɲä·¡¢pgp_sign() ¤Ë
+           ÅϤ¹¤è¤¦¤Ë¤·¤¿¡£
+         * src/rfc2015.h: rfc2015_sign(): ¥×¥í¥È¥¿¥¤¥×¤ò¹¹¿·¡£
+         * src/compose.c: ¸½ºß¤Î¥¢¥«¥¦¥ó¥È¤ò rfc2015_sign() ¤ËÅϤ¹¤è¤¦¤Ë
+           ¤·¤¿¡£
+
+2001-04-22
+
+       * src/mbox.c: export_to_mbox(): ¥á¥â¥ê¥ê¡¼¥¯¤Î¥Ð¥°¤ò½¤Àµ¡£
+
 2001-04-20
 
        * src/mbox.[ch]: export_mbox() ¤ò export_to_mbox() ¤ËÊѹ¹¡£
 2001-04-20
 
        * src/mbox.[ch]: export_mbox() ¤ò export_to_mbox() ¤ËÊѹ¹¡£
index 1828b8148fe2698d0000c6b5be27c00bdff037d5..3261e7989fab19870fcc27e23f5e18f49aa021b6 100644 (file)
@@ -21,5 +21,8 @@
 /* Define to `unsigned int' if <stddef.h> or <wchar.h> doesn't define.  */
 #undef wint_t
 
 /* Define to `unsigned int' if <stddef.h> or <wchar.h> doesn't define.  */
 #undef wint_t
 
+/* Used to test for a u32 typedef */
+#undef HAVE_U32_TYPEDEF
+
 #undef PACKAGE
 #undef VERSION
 #undef PACKAGE
 #undef VERSION
index 7e81637b9c4d24289212c0951eda86d15508ab3e..7d4b581a481431a036825a494f6a73dfeb1f64c1 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=4
 MICRO_VERSION=65
 INTERFACE_AGE=65
 BINARY_AGE=65
 MICRO_VERSION=65
 INTERFACE_AGE=65
 BINARY_AGE=65
-EXTRA_VERSION=claws5
+EXTRA_VERSION=claws6
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index 83fb692f9a2edce7d13a4e97f7369365a5d973fe..02e37b041e61b9a4dfedce8e579e172ad0e6d752 100644 (file)
@@ -45,8 +45,7 @@ sylpheed_SOURCES = \
        unmime.c unmime.h \
        base64.c base64.h \
        uuencode.c uuencode.h \
        unmime.c unmime.h \
        base64.c base64.h \
        uuencode.c uuencode.h \
-       md5c.c md5.h md5global.h \
-       md5ify.c md5ify.h \
+       md5c.c md5.h \
        rfc822.c rfc822.h \
        socket.c socket.h \
        automaton.c automaton.h \
        rfc822.c rfc822.h \
        socket.c socket.h \
        automaton.c automaton.h \
@@ -60,6 +59,7 @@ sylpheed_SOURCES = \
        recv.c recv.h \
        inc.c inc.h \
        import.c import.h \
        recv.c recv.h \
        inc.c inc.h \
        import.c import.h \
+       export.c export.h \
        nntp.c nntp.h \
        news.c news.h \
        imap.c imap.h \
        nntp.c nntp.h \
        news.c news.h \
        imap.c imap.h \
@@ -69,9 +69,10 @@ sylpheed_SOURCES = \
        rfc2015.c rfc2015.h \
        passphrase.c passphrase.h \
        select-keys.c select-keys.h \
        rfc2015.c rfc2015.h \
        passphrase.c passphrase.h \
        select-keys.c select-keys.h \
+       sigstatus.c sigstatus.h \
+       simple-gettext.c \
        manual.c manual.h \
        addr_compl.c addr_compl.h \
        manual.c manual.h \
        addr_compl.c addr_compl.h \
-       export.c export.h \
        gtkstext.c gtkstext.h \
        grouplist_dialog.c grouplist_dialog.h \
        headers.c headers.h \
        gtkstext.c gtkstext.h \
        grouplist_dialog.c grouplist_dialog.h \
        headers.c headers.h \
index 5ca90f2a73dd00544888dd567573e8d2a1ec565c..60c3888459670e97e97e5720217615830b32535a 100644 (file)
@@ -36,7 +36,9 @@
 #include <gtk/gtkscrolledwindow.h>
 #include <gtk/gtktext.h>
 #include <gtk/gtkbutton.h>
 #include <gtk/gtkscrolledwindow.h>
 #include <gtk/gtktext.h>
 #include <gtk/gtkbutton.h>
-#include <sys/utsname.h>
+#if HAVE_SYS_UTSNAME_H
+#  include <sys/utsname.h>
+#endif
 
 #include "intl.h"
 #include "about.h"
 
 #include "intl.h"
 #include "about.h"
@@ -77,8 +79,10 @@ static void about_create(void)
        GdkColormap *cmap;
        GdkColor uri_color[2] = {{0, 0, 0, 0xffff}, {0, 0xffff, 0, 0}};
        gboolean success[2];
        GdkColormap *cmap;
        GdkColor uri_color[2] = {{0, 0, 0, 0xffff}, {0, 0xffff, 0, 0}};
        gboolean success[2];
-
+       
+#if HAVE_SYS_UTSNAME_H
        struct utsname utsbuf;
        struct utsname utsbuf;
+#endif 
        gchar buf[1024];
        gint i;
 
        gchar buf[1024];
        gint i;
 
@@ -87,7 +91,7 @@ static void about_create(void)
        gtk_container_set_border_width(GTK_CONTAINER(window), 8);
        gtk_widget_set_usize(window, 518, 358);
        gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
        gtk_container_set_border_width(GTK_CONTAINER(window), 8);
        gtk_widget_set_usize(window, 518, 358);
        gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
-       //gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE);
+       /* gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); */
        gtk_signal_connect(GTK_OBJECT(window), "delete_event",
                           GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete), NULL);
        gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
        gtk_signal_connect(GTK_OBJECT(window), "delete_event",
                           GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete), NULL);
        gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
@@ -103,13 +107,20 @@ static void about_create(void)
 
        label = gtk_label_new("version "VERSION);
        gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
 
        label = gtk_label_new("version "VERSION);
        gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
-
+       
+#if HAVE_SYS_UTSNAME_H
        uname(&utsbuf);
        g_snprintf(buf, sizeof(buf),
                   "GTK+ version %d.%d.%d\n"
                   "Operating System: %s %s (%s)",
                   gtk_major_version, gtk_minor_version, gtk_micro_version,
                   utsbuf.sysname, utsbuf.release, utsbuf.machine);
        uname(&utsbuf);
        g_snprintf(buf, sizeof(buf),
                   "GTK+ version %d.%d.%d\n"
                   "Operating System: %s %s (%s)",
                   gtk_major_version, gtk_minor_version, gtk_micro_version,
                   utsbuf.sysname, utsbuf.release, utsbuf.machine);
+#else
+       g_snprintf(buf, sizeof(buf),
+                  "GTK+ version %d.%d.%d\n"
+                  "Operating System: Windoze",
+                  gtk_major_version, gtk_minor_version, gtk_micro_version);
+#endif
 
        label = gtk_label_new(buf);
        gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
 
        label = gtk_label_new(buf);
        gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
@@ -191,10 +202,6 @@ static void about_create(void)
                  "1993 and 1995.  Copyright retained for the purpose of protecting free "
                  "redistribution of source.\n\n"), -1);
 
                  "1993 and 1995.  Copyright retained for the purpose of protecting free "
                  "redistribution of source.\n\n"), -1);
 
-       gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL,
-               _("The MD5 support is copyright by RSA Data Security, Inc.  See the "
-                 "header comment of the md5.c module for license terms.\n\n"), -1);
-
        gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL,
                _("Kcc is copyright by Yasuhiro Tonooka <tonooka@msi.co.jp>, "
                  "and libkcc is copyright by takeshi@SoftAgency.co.jp.\n\n"), -1);
        gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL,
                _("Kcc is copyright by Yasuhiro Tonooka <tonooka@msi.co.jp>, "
                  "and libkcc is copyright by takeshi@SoftAgency.co.jp.\n\n"), -1);
index 968fda12d4014b22ffa575f821006945d903eab1..58936212d6e2a91fa2c1e5a36ad0cc0117d4e893 100644 (file)
@@ -44,14 +44,22 @@ void automaton_destroy(Automaton *atm)
        g_free(atm);
 }
 
        g_free(atm);
 }
 
-void automaton_input_cb(gpointer data, gint source,
-                       GdkInputCondition condition)
+void automaton_input_cb(gpointer data, gint dummy_source,
+                               GdkInputCondition condition)
 {
        Automaton *atm = (Automaton *)data;
 {
        Automaton *atm = (Automaton *)data;
+       SockInfo *sock;
        gint next;
        gint next;
+       /* We get out sockinfo from the atm context and not from the
+        * passed file descriptor because we can't map that one back
+        * to the sockinfo */
+       sock = atm->help_sock;
+       g_assert (sock->sock == dummy_source);
 
 
-       //g_print("atm->num = %d\n", atm->num);
 
 
+       //g_print("atm->num = %d\n", atm->num);
        if (atm->timeout_tag > 0) {
                gtk_timeout_remove(atm->timeout_tag);
                atm->timeout_tag = 0;
        if (atm->timeout_tag > 0) {
                gtk_timeout_remove(atm->timeout_tag);
                atm->timeout_tag = 0;
@@ -59,19 +67,20 @@ void automaton_input_cb(gpointer data, gint source,
        }
        gdk_input_remove(atm->tag);
        atm->tag = 0;
        }
        gdk_input_remove(atm->tag);
        atm->tag = 0;
-
-       next = atm->state[atm->num].handler(source, atm->data);
-
+       next = atm->state[atm->num].handler(sock, atm->data);
        if (atm->terminated)
                return;
        if (atm->terminated)
                return;
-
        if (next >= 0 && next <= atm->max && next != atm->num) {
                atm->num = next;
        if (next >= 0 && next <= atm->max && next != atm->num) {
                atm->num = next;
-               atm->tag = gdk_input_add(source,
-                                        atm->state[atm->num].condition,
+               atm->tag = sock_gdk_input_add(sock,
+                                        atm->state[atm->num].condition,       
                                         automaton_input_cb,
                                         automaton_input_cb,
-                                        data);
+                                    data);
        } else {
        } else {
-               atm->terminate(source, data);
+               atm->terminate(sock, data);
        }
 }
        }
 }
+
index d954e0472a084f6e392b196e4195d3c5018e2aae..d8d3d8c4bd4499fad8da86c1454e5c1acf4d078a 100644 (file)
 
 #include <glib.h>
 
 
 #include <glib.h>
 
+#include "socket.h"
+
 typedef struct _AtmState       AtmState;
 typedef struct _Automaton      Automaton;
 
 typedef struct _AtmState       AtmState;
 typedef struct _Automaton      Automaton;
 
-typedef gint   (*AtmHandler)   (gint source, gpointer data);
+typedef gint   (*AtmHandler)   (SockInfo *source, gpointer data);
 
 struct _AtmState
 {
        GdkInputCondition condition;
 
 struct _AtmState
 {
        GdkInputCondition condition;
-       gint (*handler)(gint source, gpointer data);
+       gint (*handler)(SockInfo *source, gpointer data);
 };
 
 struct _Automaton
 };
 
 struct _Automaton
@@ -43,12 +45,13 @@ struct _Automaton
        gboolean terminated;
        gpointer data;
        AtmState *state;
        gboolean terminated;
        gpointer data;
        AtmState *state;
-       gint (*terminate)(gint source, gpointer data);
+       gint (*terminate)(SockInfo *source, gpointer data);
+       SockInfo *help_sock;
 };
 
 Automaton *automaton_create(gint num);
 void automaton_destroy(Automaton *atm);
 };
 
 Automaton *automaton_create(gint num);
 void automaton_destroy(Automaton *atm);
-void automaton_input_cb(gpointer data, gint source,
+void automaton_input_cb(gpointer data, gint dummy_source,
                        GdkInputCondition condition);
 
 #endif /* __AUTOMATON_H__ */
                        GdkInputCondition condition);
 
 #endif /* __AUTOMATON_H__ */
index 4fe9745df1e1fa829d113c906fdb339cad62bd2b..fa53ac9ffb54cd6994799f6118529f4821708777 100644 (file)
@@ -1171,7 +1171,7 @@ static void compose_insert_sig(Compose *compose)
        if (compose->account && compose->account->sig_path)
                sigfile = g_strdup(compose->account->sig_path);
        else {
        if (compose->account && compose->account->sig_path)
                sigfile = g_strdup(compose->account->sig_path);
        else {
-               sigfile = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S,
+               sigfile = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S,
                                      DEFAULT_SIGNATURE, NULL);
        }
 
                                      DEFAULT_SIGNATURE, NULL);
        }
 
@@ -3235,20 +3235,20 @@ static void compose_exec_ext_editor(Compose *compose)
                close(pipe_fds[0]);
 
                if (compose_write_body_to_file(compose, tmp) < 0) {
                close(pipe_fds[0]);
 
                if (compose_write_body_to_file(compose, tmp) < 0) {
-                       sock_write(pipe_fds[1], "2\n", 2);
+                       fd_write(pipe_fds[1], "2\n", 2);
                        _exit(1);
                }
 
                pid_ed = compose_exec_ext_editor_real(tmp);
                if (pid_ed < 0) {
                        _exit(1);
                }
 
                pid_ed = compose_exec_ext_editor_real(tmp);
                if (pid_ed < 0) {
-                       sock_write(pipe_fds[1], "1\n", 2);
+                       fd_write(pipe_fds[1], "1\n", 2);
                        _exit(1);
                }
 
                /* wait until editor is terminated */
                waitpid(pid_ed, NULL, 0);
 
                        _exit(1);
                }
 
                /* wait until editor is terminated */
                waitpid(pid_ed, NULL, 0);
 
-               sock_write(pipe_fds[1], "0\n", 2);
+               fd_write(pipe_fds[1], "0\n", 2);
 
                close(pipe_fds[1]);
                _exit(0);
 
                close(pipe_fds[1]);
                _exit(0);
index dfb2ef1bb5daad610e4886880f32d0f60105fb36..0578630af52d076cd8f9dc01805a7ba247adfcd3 100644 (file)
 static gint verbose = 1;
 static gchar esmtp_response[MSGBUFSIZE];
 
 static gint verbose = 1;
 static gchar esmtp_response[MSGBUFSIZE];
 
-/*
-** Function: hmac_md5
-** taken from the file rfc2104.txt
-*/
-void hmac_md5(guchar *text, gint text_len, guchar *key, gint key_len,
-             guchar *digest)
-{
-       MD5_CTX context;
-       guchar k_ipad[65];      /* inner padding -
-                                * key XORd with ipad
-                                */
-       guchar k_opad[65];      /* outer padding -
-                                * key XORd with opad
-                                */
-       guchar tk[16];
-       gint i;
-
-       /* if key is longer than 64 bytes reset it to key=MD5(key) */
-       if (key_len > 64) {
-               MD5_CTX tctx;
-
-               MD5Init(&tctx);
-               MD5Update(&tctx, key, key_len);
-               MD5Final(tk, &tctx);
-
-               key = tk;
-               key_len = 16;
-       }
-
-       /*
-        * the HMAC_MD5 transform looks like:
-        *
-        * MD5(K XOR opad, MD5(K XOR ipad, text))
-        *
-        * where K is an n byte key
-        * ipad is the byte 0x36 repeated 64 times
-        * opad is the byte 0x5c repeated 64 times
-        * and text is the data being protected
-        */
-
-       /* start out by storing key in pads */
-       bzero(k_ipad, sizeof k_ipad);
-       bzero(k_opad, sizeof k_opad);
-       bcopy(key, k_ipad, key_len);
-       bcopy(key, k_opad, key_len);
-
-       /* XOR key with ipad and opad values */
-       for (i = 0; i < 64; i++) {
-               k_ipad[i] ^= 0x36;
-               k_opad[i] ^= 0x5c;
-       }
-
-       /*
-        * perform inner MD5
-        */
-       MD5Init(&context);                   /* init context for 1st
-                                             * pass */
-       MD5Update(&context, k_ipad, 64);     /* start with inner pad */
-       MD5Update(&context, text, text_len); /* then text of datagram */
-       MD5Final(digest, &context);          /* finish up 1st pass */
-
-       /*
-        * perform outer MD5
-        */
-       MD5Init(&context);                   /* init context for 2nd
-                                             * pass */
-       MD5Update(&context, k_opad, 64);     /* start with outer pad */
-       MD5Update(&context, digest, 16);     /* then results of 1st
-                                             * hash */
-       MD5Final(digest, &context);          /* finish up 2nd pass */
-}
-
-void md5_hex_hmac(gchar *hexdigest, guchar *text, gint text_len,
-                 guchar *key, gint key_len)
-{
-       guchar digest[16];
-       gint i;
-
-       hmac_md5(text, text_len, key, key_len, digest);
-       for(i = 0; i < 16; i++)
-               sprintf(hexdigest + 2 * i, "%02x", digest[i]);
-}
-
-gint esmtp_auth_cram_md5(gint sock)
+gint esmtp_auth_cram_md5(SockInfo *sock)
 {
        gchar buf[MSGBUFSIZE];
 
 {
        gchar buf[MSGBUFSIZE];
 
@@ -129,7 +46,7 @@ gint esmtp_auth_cram_md5(gint sock)
        return esmtp_ok(sock);
 }
 
        return esmtp_ok(sock);
 }
 
-gint esmtp_auth_login(gint sock)
+gint esmtp_auth_login(SockInfo *sock)
 {
        gchar buf[MSGBUFSIZE];
 
 {
        gchar buf[MSGBUFSIZE];
 
@@ -142,7 +59,7 @@ gint esmtp_auth_login(gint sock)
        return esmtp_ok(sock);
 }
 
        return esmtp_ok(sock);
 }
 
-gint esmtp_auth(gint sock, SMTPAuthType authtype,
+gint esmtp_auth(SockInfo *sock, SMTPAuthType authtype,
                const gchar *userid, const gchar *passwd,
                gboolean use_smtp_auth)
 {
                const gchar *userid, const gchar *passwd,
                gboolean use_smtp_auth)
 {
@@ -221,7 +138,7 @@ gint esmtp_auth(gint sock, SMTPAuthType authtype,
        return esmtp_ok(sock);
 }
 
        return esmtp_ok(sock);
 }
 
-gint esmtp_ok(gint sock)
+gint esmtp_ok(SockInfo *sock)
 {
        while (sock_read(sock, esmtp_response, sizeof(esmtp_response) - 1)
               != -1) {
 {
        while (sock_read(sock, esmtp_response, sizeof(esmtp_response) - 1)
               != -1) {
index 39b8ad23c026781a3c0f540a440c237bda82edf6..95bf8b8101c855dd67eff8682805463367edf2f1 100644 (file)
@@ -21,6 +21,7 @@
 #define __ESMTP_H__
 
 #include <glib.h>
 #define __ESMTP_H__
 
 #include <glib.h>
+#include "socket.h"
 
 typedef enum
 {
 
 typedef enum
 {
@@ -29,13 +30,11 @@ typedef enum
        SMTPAUTH_DIGEST_MD5 = 3
 } SMTPAuthType;
 
        SMTPAUTH_DIGEST_MD5 = 3
 } SMTPAuthType;
 
-gint esmtp_auth_login(gint sock);
-gint esmtp_auth_cram_md5(gint sock);
-gint esmtp_auth(gint sock, SMTPAuthType authtype,
+gint esmtp_auth_login(SockInfo *sock);
+gint esmtp_auth_cram_md5(SockInfo *sock);
+gint esmtp_auth(SockInfo *sock, SMTPAuthType authtype,
                const gchar *userid, const gchar *passwd,
                gboolean use_smtp_auth);
                const gchar *userid, const gchar *passwd,
                gboolean use_smtp_auth);
-gint esmtp_ok(gint sock);
-void md5_hex_hmac(gchar *hexdigest, guchar *text, gint text_len,
-                 guchar *key, gint key_len);
+gint esmtp_ok(SockInfo *sock);
 
 #endif /* __ESMTP_H__ */
 
 #endif /* __ESMTP_H__ */
index 09c640ac193e04b787b766ffd0ea3f8894beb019..7020806cc350b4cdf8df30833ab4f085074f685f 100644 (file)
@@ -46,6 +46,7 @@
 #include "gtkutils.h"
 #include "manage_window.h"
 #include "folder.h"
 #include "gtkutils.h"
 #include "manage_window.h"
 #include "folder.h"
+#include "utils.h"
 
 static GtkWidget *window;
 static GtkWidget *src_entry;
 
 static GtkWidget *window;
 static GtkWidget *src_entry;
@@ -72,6 +73,8 @@ gint export_mbox(FolderItem *default_src)
        else
                gtk_widget_show(window);
 
        else
                gtk_widget_show(window);
 
+       change_dir(startup_dir);
+
        if (default_src && default_src->path)
                gtk_entry_set_text(GTK_ENTRY(src_entry), default_src->path);
        else
        if (default_src && default_src->path)
                gtk_entry_set_text(GTK_ENTRY(src_entry), default_src->path);
        else
index a988f46f9b1f350db56a51755de3e3d0797f01a6..27093fc55d3956a0d2394d06317c41ba70a74546 100644 (file)
@@ -24,6 +24,7 @@
 #include <gtk/gtkmain.h>
 #include <gtk/gtksignal.h>
 
 #include <gtk/gtkmain.h>
 #include <gtk/gtksignal.h>
 
+#include "main.h"
 #include "filesel.h"
 #include "manage_window.h"
 #include "gtkutils.h"
 #include "filesel.h"
 #include "manage_window.h"
 #include "gtkutils.h"
@@ -51,7 +52,7 @@ gchar *filesel_select_file(const gchar *title, const gchar *file)
        }
 
        if (!cwd)
        }
 
        if (!cwd)
-               cwd = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S, NULL);
+               cwd = g_strconcat(startup_dir, G_DIR_SEPARATOR_S, NULL);
 
        gtk_file_selection_set_filename(GTK_FILE_SELECTION(filesel), cwd);
 
 
        gtk_file_selection_set_filename(GTK_FILE_SELECTION(filesel), cwd);
 
index f4c4e181ffa2b49ea25f02ca7dca207c4fee258f..b8c19ae8dc0fc6e397875fbade6f56ac4b2724a2 100644 (file)
@@ -442,11 +442,11 @@ gchar *folder_item_get_path(FolderItem *item)
                        path = g_strdup(folder_path);
        } else {
                if (item->path)
                        path = g_strdup(folder_path);
        } else {
                if (item->path)
-                       path = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S,
+                       path = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S,
                                           folder_path, G_DIR_SEPARATOR_S,
                                           item->path, NULL);
                else
                                           folder_path, G_DIR_SEPARATOR_S,
                                           item->path, NULL);
                else
-                       path = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S,
+                       path = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S,
                                           folder_path, NULL);
        }
 
                                           folder_path, NULL);
        }
 
index 47c962a45ebc748e263df14b2f1dc6b25b9f7007..612ecf030a33f23363de07cb9e84dc632465bba5 100644 (file)
@@ -477,6 +477,13 @@ static void gtk_stext_show_props (GtkSText* test,
 #define TEXT_SHOW_ADJ(text,adj,msg)
 #endif
 
 #define TEXT_SHOW_ADJ(text,adj,msg)
 #endif
 
+#define AHX_DEBUG
+#if defined(AHX_DEBUG)
+#      define XDEBUG(args) g_message args
+#else
+#      define XDEBUG(args)
+#endif /* AHX_DEBUG */
+
 /* Memory Management. */
 static GMemChunk  *params_mem_chunk    = NULL;
 static GMemChunk  *text_property_chunk = NULL;
 /* Memory Management. */
 static GMemChunk  *params_mem_chunk    = NULL;
 static GMemChunk  *text_property_chunk = NULL;
@@ -2264,15 +2271,19 @@ gtk_stext_key_press (GtkWidget   *widget,
            }
          break;
        case GDK_Delete:
            }
          break;
        case GDK_Delete:
-         if (event->state & GDK_CONTROL_MASK)
-           gtk_stext_delete_forward_word (text);
-         else if (event->state & GDK_SHIFT_MASK)
-           {
-             extend_selection = FALSE;
-             gtk_editable_cut_clipboard (editable);
-           }
-         else
-           gtk_stext_delete_forward_character (text);
+               {
+                       if (event->state & GDK_CONTROL_MASK) {
+                               gtk_stext_delete_forward_word (text);
+                       }       
+                       else if (event->state & GDK_SHIFT_MASK)
+                       {
+                               extend_selection = FALSE;
+                               gtk_editable_cut_clipboard (editable);
+                       }
+                       else {
+                               gtk_stext_delete_forward_character (text);
+                       }       
+               }               
          break;
        case GDK_Tab:
          position = text->point.index;
          break;
        case GDK_Tab:
          position = text->point.index;
@@ -4215,14 +4226,14 @@ static gint back_display_row_fetcher(GtkSText *text,
 {
        if (data->start <= params->start.index
        &&  data->end   >= params->end.index) {
 {
        if (data->start <= params->start.index
        &&  data->end   >= params->end.index) {
-               TDEBUG( ("%s(%d) - FOUND search (%d, %d), current (%d, %d)", __FILE__, __LINE__, 
+               XDEBUG( ("%s(%d) - FOUND search (%d, %d), current (%d, %d)", __FILE__, __LINE__, 
                          data->start, data->end,
                          data->start, data->end,
-                                 params->start.index, params->end.index) )
+                                 params->start.index, params->end.index) );
                data->found = TRUE;
                return TRUE;
        }
        else {
                data->found = TRUE;
                return TRUE;
        }
        else {
-               TDEBUG( ("%s(%d) - NEXT search (%d, %d), current (%d, %d)", __FILE__, __LINE__, 
+               XDEBUG( ("%s(%d) - NEXT search (%d, %d), current (%d, %d)", __FILE__, __LINE__, 
                          data->start, data->end,
                                  params->start.index, params->end.index) );
                data->lp = *params;
                          data->start, data->end,
                                  params->start.index, params->end.index) );
                data->lp = *params;
@@ -4240,7 +4251,7 @@ static void move_cursor_to_display_row_up(GtkSText *text)
 
        /* top of buffer */
        if (mark.index == 0) {
 
        /* top of buffer */
        if (mark.index == 0) {
-               TDEBUG ( ("%s(%d) top of buffer", __FILE__, __LINE__) );        
+               XDEBUG ( ("%s(%d) top of buffer", __FILE__, __LINE__) );        
                return;
        }
 
                return;
        }
 
@@ -4255,30 +4266,30 @@ static void move_cursor_to_display_row_up(GtkSText *text)
        /* get the previous line */
        if (mark.index - 1 > 0) {
                decrement_mark(&mark);
        /* get the previous line */
        if (mark.index - 1 > 0) {
                decrement_mark(&mark);
-               TDEBUG( ("%s(%d) mark decrement", __FILE__, __LINE__) );
+               XDEBUG( ("%s(%d) mark decrement", __FILE__, __LINE__) );
                if (mark.index - 1 > 0) {
                        GtkSPropertyMark smark = mark;
                if (mark.index - 1 > 0) {
                        GtkSPropertyMark smark = mark;
-                       TDEBUG( ("%s(%d) finding line start mark", __FILE__, __LINE__) );
+                       XDEBUG( ("%s(%d) finding line start mark", __FILE__, __LINE__) );
                        mark = find_this_line_start_mark(text, smark.index -1,  &smark);
                }                       
        }               
        
        /* let's get the previous display line */
                        mark = find_this_line_start_mark(text, smark.index -1,  &smark);
                }                       
        }               
        
        /* let's get the previous display line */
-       TDEBUG( ("%s(%d) iterating to get display lines", __FILE__, __LINE__) );
+       XDEBUG( ("%s(%d) iterating to get display lines", __FILE__, __LINE__) );
        line_params_iterate(text, &mark, NULL, FALSE, &data, 
                                                (LineIteratorFunction)back_display_row_fetcher);        
        line_params_iterate(text, &mark, NULL, FALSE, &data, 
                                                (LineIteratorFunction)back_display_row_fetcher);        
-       TDEBUG( ("%s(%d) done iterating. found = %d", __FILE__, __LINE__, data.found) );                                        
+       XDEBUG( ("%s(%d) done iterating. found = %d", __FILE__, __LINE__, data.found) );                                        
                
        if (data.found) {
                if (col < text->persist_column) col = text->persist_column; 
                else text->persist_column = col;
                new_index = data.lp.start.index + col;
                
        if (data.found) {
                if (col < text->persist_column) col = text->persist_column; 
                else text->persist_column = col;
                new_index = data.lp.start.index + col;
-               TDEBUG( ("%s(%d) - new index = %d", __FILE__, __LINE__, new_index) );
+               XDEBUG( ("%s(%d) - new index = %d", __FILE__, __LINE__, new_index) );
                if (new_index > data.lp.end.index) {
                        new_index = data.lp.end.index;
                }
                /* and move the cursor */
                if (new_index > data.lp.end.index) {
                        new_index = data.lp.end.index;
                }
                /* and move the cursor */
-               TDEBUG( ("%s(%d) - setting index", __FILE__, __LINE__) );
+               XDEBUG( ("%s(%d) - setting index", __FILE__, __LINE__) );
                gtk_stext_set_position_X(GTK_EDITABLE(text), new_index);                
        }
 }
                gtk_stext_set_position_X(GTK_EDITABLE(text), new_index);                
        }
 }
@@ -4577,8 +4588,9 @@ static void
 gtk_stext_kill_word (GtkEditable *editable,
                    gint         direction)
 {
 gtk_stext_kill_word (GtkEditable *editable,
                    gint         direction)
 {
-  if (editable->selection_start_pos != editable->selection_end_pos)
+  if (editable->selection_start_pos != editable->selection_end_pos) {
     gtk_editable_delete_selection (editable);
     gtk_editable_delete_selection (editable);
+  }    
   else
     {
       gint old_pos = editable->current_pos;
   else
     {
       gint old_pos = editable->current_pos;
index d0bb81c1a36f06847e6ee0b2a979ffa4679d4bce..a6d6ee306cf3e301985d6ba5b13e71ddfd201a26 100644 (file)
@@ -53,34 +53,34 @@ static GSList *imap_delete_messages  (GSList        *mlist,
                                          gint          last);
 static void imap_delete_all_messages    (FolderItem    *item);
 
                                          gint          last);
 static void imap_delete_all_messages    (FolderItem    *item);
 
-static gint imap_open          (const gchar    *server,
+static SockInfo *imap_open     (const gchar    *server,
                                 gushort         port,
                                 gchar          *buf);
                                 gushort         port,
                                 gchar          *buf);
-static gint imap_auth          (gint            sock,
+static gint imap_auth          (SockInfo       *sock,
                                 const gchar    *user,
                                 const gchar    *pass);
                                 const gchar    *user,
                                 const gchar    *pass);
-static gint imap_logout                (gint            sock);
-static gint imap_noop          (gint            sock);
-static gint imap_select                (gint            sock,
+static gint imap_logout                (SockInfo       *sock);
+static gint imap_noop          (SockInfo       *sock);
+static gint imap_select                (SockInfo       *sock,
                                 const gchar    *folder,
                                 gint           *exists,
                                 gint           *recent,
                                 gint           *unseen,
                                 gulong         *uid);
                                 const gchar    *folder,
                                 gint           *exists,
                                 gint           *recent,
                                 gint           *unseen,
                                 gulong         *uid);
-static gint imap_get_envelope  (gint            sock,
+static gint imap_get_envelope  (SockInfo       *sock,
                                 gint            first,
                                 gint            last);
 #if 0
                                 gint            first,
                                 gint            last);
 #if 0
-static gint imap_search                (gint            sock,
+static gint imap_search                (SockInfo       *sock,
                                 GSList         *numlist);
 #endif
                                 GSList         *numlist);
 #endif
-static gint imap_get_message   (gint            sock,
+static gint imap_get_message   (SockInfo       *sock,
                                 gint            num,
                                 const gchar    *filename);
                                 gint            num,
                                 const gchar    *filename);
-static gint imap_copy_message  (gint            sock,
+static gint imap_copy_message  (SockInfo       *sock,
                                 gint            num,
                                 const gchar    *destfolder);
                                 gint            num,
                                 const gchar    *destfolder);
-static gint imap_store         (gint            sock,
+static gint imap_store         (SockInfo       *sock,
                                 gint            first,
                                 gint            last,
                                 gchar          *sub_cmd);
                                 gint            first,
                                 gint            last,
                                 gchar          *sub_cmd);
@@ -92,29 +92,29 @@ static gint imap_set_article_flags  (IMAPSession    *session,
                                         gboolean        is_set);
 static gint imap_expunge               (IMAPSession    *session);
 
                                         gboolean        is_set);
 static gint imap_expunge               (IMAPSession    *session);
 
-static gchar *imap_parse_atom          (gint    sock,
-                                        gchar  *src,
-                                        gchar  *dest,
-                                        gchar  *orig_buf);
-static gchar *imap_parse_one_address   (gint    sock,
-                                        gchar  *start,
-                                        gchar  *out_from_str,
-                                        gchar  *out_fromname_str,
-                                        gchar  *orig_buf);
-static gchar *imap_parse_address       (gint    sock,
-                                        gchar  *start,
-                                        gchar **out_from_str,
-                                        gchar **out_fromname_str,
-                                        gchar  *orig_buf);
+static gchar *imap_parse_atom          (SockInfo *sock,
+                                        gchar    *src,
+                                        gchar    *dest,
+                                        gchar    *orig_buf);
+static gchar *imap_parse_one_address   (SockInfo *sock,
+                                        gchar    *start,
+                                        gchar    *out_from_str,
+                                        gchar    *out_fromname_str,
+                                        gchar    *orig_buf);
+static gchar *imap_parse_address       (SockInfo *sock,
+                                        gchar    *start,
+                                        gchar   **out_from_str,
+                                        gchar   **out_fromname_str,
+                                        gchar    *orig_buf);
 static MsgFlags imap_parse_flags       (const gchar    *flag_str);
 static MsgFlags imap_parse_flags       (const gchar    *flag_str);
-static MsgInfo *imap_parse_envelope    (gint    sock,
-                                        gchar  *line_str);
+static MsgInfo *imap_parse_envelope    (SockInfo *sock,
+                                        gchar    *line_str);
 
 
-static gint imap_ok            (gint            sock,
+static gint imap_ok            (SockInfo       *sock,
                                 GPtrArray      *argbuf);
                                 GPtrArray      *argbuf);
-static void imap_gen_send      (gint            sock,
+static void imap_gen_send      (SockInfo       *sock,
                                 const gchar    *format, ...);
                                 const gchar    *format, ...);
-static gint imap_gen_recv      (gint            sock,
+static gint imap_gen_recv      (SockInfo       *sock,
                                 gchar          *buf,
                                 gint            size);
 
                                 gchar          *buf,
                                 gint            size);
 
@@ -157,7 +157,7 @@ Session *imap_session_new(const gchar *server, gushort port,
 {
        gchar buf[IMAPBUFSIZE];
        IMAPSession *session;
 {
        gchar buf[IMAPBUFSIZE];
        IMAPSession *session;
-       gint imap_sock;
+       SockInfo *imap_sock;
 
        g_return_val_if_fail(server != NULL, NULL);
 
 
        g_return_val_if_fail(server != NULL, NULL);
 
@@ -168,7 +168,7 @@ Session *imap_session_new(const gchar *server, gushort port,
                return NULL;
        if (imap_auth(imap_sock, user, pass) != IMAP_SUCCESS) {
                imap_logout(imap_sock);
                return NULL;
        if (imap_auth(imap_sock, user, pass) != IMAP_SUCCESS) {
                imap_logout(imap_sock);
-               close(imap_sock);
+               sock_close(imap_sock);
                return NULL;
        }
 
                return NULL;
        }
 
@@ -188,7 +188,8 @@ Session *imap_session_new(const gchar *server, gushort port,
 
 void imap_session_destroy(IMAPSession *session)
 {
 
 void imap_session_destroy(IMAPSession *session)
 {
-       close(SESSION(session)->sock);
+       sock_close(SESSION(session)->sock);
+       SESSION(session)->sock = NULL;
 
        g_free(session->mbox);
 
 
        g_free(session->mbox);
 
@@ -222,8 +223,8 @@ GSList *imap_get_msg_list(Folder *folder, FolderItem *item, gboolean use_cache)
                item->last_num = procmsg_get_last_num_in_cache(mlist);
                procmsg_set_flags(mlist, item);
        } else {
                item->last_num = procmsg_get_last_num_in_cache(mlist);
                procmsg_set_flags(mlist, item);
        } else {
-                gint ok, exists = 0, recent = 0, unseen = 0, begin = 1;
-                gulong uid = 0, last_uid = item->mtime;
+               gint ok, exists = 0, recent = 0, unseen = 0, begin = 1;
+               gulong uid = 0, last_uid = item->mtime;
 
                ok = imap_select(SESSION(session)->sock, item->path,
                                        &exists, &recent, &unseen, &uid);
 
                ok = imap_select(SESSION(session)->sock, item->path,
                                        &exists, &recent, &unseen, &uid);
@@ -619,30 +620,27 @@ static void imap_delete_all_messages(FolderItem *item)
 }
 
 
 }
 
 
-static gint imap_open(const gchar *server, gushort port, gchar *buf)
+static SockInfo *imap_open(const gchar *server, gushort port, gchar *buf)
 {
 {
-       SockInfo *sockinfo;
-       gint sock;
+       SockInfo *sock;
 
 
-       if ((sockinfo = sock_connect(server, port)) == NULL) {
+       if ((sock = sock_connect(server, port)) == NULL) {
                log_warning(_("Can't connect to IMAP4 server: %s:%d\n"),
                            server, port);
                log_warning(_("Can't connect to IMAP4 server: %s:%d\n"),
                            server, port);
-               return -1;
+               return NULL;
        }
        }
-       sock = sockinfo->sock;
-       sock_sockinfo_free(sockinfo);
 
        imap_cmd_count = 0;
 
        if (imap_noop(sock) != IMAP_SUCCESS) {
                sock_close(sock);
 
        imap_cmd_count = 0;
 
        if (imap_noop(sock) != IMAP_SUCCESS) {
                sock_close(sock);
-               return -1;
+               return NULL;
        }
 
        return sock;
 }
 
        }
 
        return sock;
 }
 
-static gint imap_auth(gint sock, const gchar *user, const gchar *pass)
+static gint imap_auth(SockInfo *sock, const gchar *user, const gchar *pass)
 {
        gint ok;
        GPtrArray *argbuf;
 {
        gint ok;
        GPtrArray *argbuf;
@@ -657,19 +655,19 @@ static gint imap_auth(gint sock, const gchar *user, const gchar *pass)
        return ok;
 }
 
        return ok;
 }
 
-static gint imap_logout(gint sock)
+static gint imap_logout(SockInfo *sock)
 {
        imap_gen_send(sock, "LOGOUT");
        return imap_ok(sock, NULL);
 }
 
 {
        imap_gen_send(sock, "LOGOUT");
        return imap_ok(sock, NULL);
 }
 
-static gint imap_noop(gint sock)
+static gint imap_noop(SockInfo *sock)
 {
        imap_gen_send(sock, "NOOP");
        return imap_ok(sock, NULL);
 }
 
 {
        imap_gen_send(sock, "NOOP");
        return imap_ok(sock, NULL);
 }
 
-static gint imap_select(gint sock, const gchar *folder,
+static gint imap_select(SockInfo *sock, const gchar *folder,
                        gint *exists, gint *recent, gint *unseen, gulong *uid)
 {
        gint ok;
                        gint *exists, gint *recent, gint *unseen, gulong *uid)
 {
        gint ok;
@@ -741,7 +739,7 @@ static gchar *strchr_cpy(const gchar *src, gchar ch, gchar *dest, gint len)
        return tmp + 1;
 }
 
        return tmp + 1;
 }
 
-static gint imap_get_message(gint sock, gint num, const gchar *filename)
+static gint imap_get_message(SockInfo *sock, gint num, const gchar *filename)
 {
        gint ok;
        gchar buf[IMAPBUFSIZE];
 {
        gint ok;
        gchar buf[IMAPBUFSIZE];
@@ -782,7 +780,7 @@ static gint imap_get_message(gint sock, gint num, const gchar *filename)
        return ok;
 }
 
        return ok;
 }
 
-static gint imap_copy_message(gint sock, gint num, const gchar *destfolder)
+static gint imap_copy_message(SockInfo *sock, gint num, const gchar *destfolder)
 {
        gint ok;
 
 {
        gint ok;
 
@@ -798,7 +796,7 @@ static gint imap_copy_message(gint sock, gint num, const gchar *destfolder)
        return ok;
 }
 
        return ok;
 }
 
-static gchar *imap_parse_atom(gint sock, gchar *src, gchar *dest,
+static gchar *imap_parse_atom(SockInfo *sock, gchar *src, gchar *dest,
                              gchar *orig_buf)
 {
        gchar *cur_pos = src;
                              gchar *orig_buf)
 {
        gchar *cur_pos = src;
@@ -834,7 +832,7 @@ static gchar *imap_parse_atom(gint sock, gchar *src, gchar *dest,
        return cur_pos;
 }
 
        return cur_pos;
 }
 
-static gchar *imap_parse_one_address(gint sock, gchar *start,
+static gchar *imap_parse_one_address(SockInfo *sock, gchar *start,
                                     gchar *out_from_str,
                                     gchar *out_fromname_str,
                                     gchar *orig_buf)
                                     gchar *out_from_str,
                                     gchar *out_fromname_str,
                                     gchar *orig_buf)
@@ -870,7 +868,7 @@ static gchar *imap_parse_one_address(gint sock, gchar *start,
        return cur_pos + 1;
 }
 
        return cur_pos + 1;
 }
 
-static gchar *imap_parse_address(gint sock, gchar *start,
+static gchar *imap_parse_address(SockInfo *sock, gchar *start,
                                 gchar **out_from_str,
                                 gchar **out_fromname_str,
                                 gchar *orig_buf)
                                 gchar **out_from_str,
                                 gchar **out_fromname_str,
                                 gchar *orig_buf)
@@ -944,7 +942,7 @@ static MsgFlags imap_parse_flags(const gchar *flag_str)
        return flags;
 }
 
        return flags;
 }
 
-static MsgInfo *imap_parse_envelope(gint sock, gchar *line_str)
+static MsgInfo *imap_parse_envelope(SockInfo *sock, gchar *line_str)
 {
        MsgInfo *msginfo;
        gchar buf[IMAPBUFSIZE];
 {
        MsgInfo *msginfo;
        gchar buf[IMAPBUFSIZE];
@@ -1079,7 +1077,7 @@ static MsgInfo *imap_parse_envelope(gint sock, gchar *line_str)
        return msginfo;
 }
 
        return msginfo;
 }
 
-gint imap_get_envelope(gint sock, gint first, gint last)
+gint imap_get_envelope(SockInfo *sock, gint first, gint last)
 {
        imap_gen_send(sock, "FETCH %d:%d (FLAGS RFC822.SIZE ENVELOPE)",
                      first, last);
 {
        imap_gen_send(sock, "FETCH %d:%d (FLAGS RFC822.SIZE ENVELOPE)",
                      first, last);
@@ -1087,7 +1085,7 @@ gint imap_get_envelope(gint sock, gint first, gint last)
        return IMAP_SUCCESS;
 }
 
        return IMAP_SUCCESS;
 }
 
-static gint imap_store(gint sock, gint first, gint last, gchar *sub_cmd)
+static gint imap_store(SockInfo *sock, gint first, gint last, gchar *sub_cmd)
 {
        gint ok;
        GPtrArray *argbuf;
 {
        gint ok;
        GPtrArray *argbuf;
@@ -1156,7 +1154,7 @@ static gint imap_expunge(IMAPSession *session)
        return IMAP_SUCCESS;
 }
 
        return IMAP_SUCCESS;
 }
 
-static gint imap_ok(gint sock, GPtrArray *argbuf)
+static gint imap_ok(SockInfo *sock, GPtrArray *argbuf)
 {
        gint ok;
        gchar buf[IMAPBUFSIZE];
 {
        gint ok;
        gchar buf[IMAPBUFSIZE];
@@ -1198,7 +1196,7 @@ static gchar *search_array_contain_str(GPtrArray *array, gchar *str)
        return NULL;
 }
 
        return NULL;
 }
 
-static void imap_gen_send(gint sock, const gchar *format, ...)
+static void imap_gen_send(SockInfo *sock, const gchar *format, ...)
 {
        gchar buf[IMAPBUFSIZE];
        gchar tmp[IMAPBUFSIZE];
 {
        gchar buf[IMAPBUFSIZE];
        gchar tmp[IMAPBUFSIZE];
@@ -1221,7 +1219,7 @@ static void imap_gen_send(gint sock, const gchar *format, ...)
        sock_write(sock, buf, strlen(buf));
 }
 
        sock_write(sock, buf, strlen(buf));
 }
 
-static gint imap_gen_recv(gint sock, gchar *buf, gint size)
+static gint imap_gen_recv(SockInfo *sock, gchar *buf, gint size)
 {
        if (sock_read(sock, buf, size) == -1)
                return IMAP_SOCKET;
 {
        if (sock_read(sock, buf, size) == -1)
                return IMAP_SOCKET;
index 8bc2389706de0c7a5c5147700c5750f190e7dfcb..c7a09c8399cfb4361b267d7c7cfc3c970f5bf756 100644 (file)
@@ -78,12 +78,12 @@ gchar *imap_fetch_msg                       (Folder         *folder,
                                         gint            num);
 
 gint imap_move_msg                     (Folder         *folder,
                                         gint            num);
 
 gint imap_move_msg                     (Folder         *folder,
-                                        FolderItem     *dest,
-                                        MsgInfo        *msginfo);
+                                        FolderItem     *dest,
+                                        MsgInfo        *msginfo);
 
 
-gint imap_move_msgs_with_dest          (Folder         *folder,
-                                        FolderItem     *dest,
-                                        GSList         *msglist);
+gint imap_move_msgs_with_dest          (Folder         *folder,
+                                        FolderItem     *dest,
+                                        GSList         *msglist);
 gint imap_remove_msg                   (Folder         *folder,
                                         FolderItem     *item,
                                         gint            num);
 gint imap_remove_msg                   (Folder         *folder,
                                         FolderItem     *item,
                                         gint            num);
index e1ca14362e7f569f361279a67d7c6946bcb1414a..75907753f803a35d042fad83ad2e29ddce482364 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999,2000 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2001 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include "automaton.h"
 #include "folder.h"
 
 #include "automaton.h"
 #include "folder.h"
 
+#include "pixmaps/continue.xpm"
+#include "pixmaps/complete.xpm"
+#include "pixmaps/error.xpm"
+
+GdkPixmap *currentxpm;
+GdkBitmap *currentxpmmask;
+GdkPixmap *errorxpm;
+GdkBitmap *errorxpmmask;
+GdkPixmap *okxpm;
+GdkBitmap *okxpmmask;
+
 #define MSGBUFSIZE     8192
 
 static void inc_finished               (MainWindow             *mainwin);
 #define MSGBUFSIZE     8192
 
 static void inc_finished               (MainWindow             *mainwin);
@@ -76,7 +87,7 @@ static Pop3State *inc_pop3_state_new  (PrefsAccount           *account);
 static void inc_pop3_state_destroy     (Pop3State              *state);
 static void inc_start                  (IncProgressDialog      *inc_dialog);
 static IncState inc_pop3_session_do    (IncSession             *session);
 static void inc_pop3_state_destroy     (Pop3State              *state);
 static void inc_start                  (IncProgressDialog      *inc_dialog);
 static IncState inc_pop3_session_do    (IncSession             *session);
-static gint pop3_automaton_terminate   (gint                    source,
+static gint pop3_automaton_terminate   (SockInfo               *source,
                                         Automaton              *atm);
 
 static GHashTable *inc_get_uidl_table  (PrefsAccount           *ac_prefs);
                                         Automaton              *atm);
 
 static GHashTable *inc_get_uidl_table  (PrefsAccount           *ac_prefs);
@@ -95,6 +106,7 @@ static gint inc_spool                        (void);
 static gint get_spool                  (FolderItem     *dest,
                                         const gchar    *mbox);
 
 static gint get_spool                  (FolderItem     *dest,
                                         const gchar    *mbox);
 
+
 static void inc_finished(MainWindow *mainwin)
 {
        FolderItem *item;
 static void inc_finished(MainWindow *mainwin)
 {
        FolderItem *item;
@@ -152,6 +164,7 @@ static void inc_account_mail(PrefsAccount *account, MainWindow *mainwin)
 {
        IncProgressDialog *inc_dialog;
        IncSession *session;
 {
        IncProgressDialog *inc_dialog;
        IncSession *session;
+       gchar *text[3];
 
        session = inc_session_new(account);
        if (!session) return;
 
        session = inc_session_new(account);
        if (!session) return;
@@ -161,6 +174,11 @@ static void inc_account_mail(PrefsAccount *account, MainWindow *mainwin)
        inc_dialog->mainwin = mainwin;
        session->data = inc_dialog;
 
        inc_dialog->mainwin = mainwin;
        session->data = inc_dialog;
 
+       text[0] = NULL;
+       text[1] = account->account_name;
+       text[2] = _("Standby");
+       gtk_clist_append(GTK_CLIST(inc_dialog->dialog->clist), text);
+
        inc_start(inc_dialog);
 }
 
        inc_start(inc_dialog);
 }
 
@@ -194,7 +212,14 @@ void inc_all_account_mail(MainWindow *mainwin)
        inc_dialog->mainwin = mainwin;
        for (list = queue_list; list != NULL; list = list->next) {
                IncSession *session = list->data;
        inc_dialog->mainwin = mainwin;
        for (list = queue_list; list != NULL; list = list->next) {
                IncSession *session = list->data;
+               gchar *text[3];
+
                session->data = inc_dialog;
                session->data = inc_dialog;
+
+               text[0] = NULL;
+               text[1] = session->pop3_state->ac_prefs->account_name;
+               text[2] = _("Standby");
+               gtk_clist_append(GTK_CLIST(inc_dialog->dialog->clist), text);
        }
 
        inc_start(inc_dialog);
        }
 
        inc_start(inc_dialog);
@@ -220,6 +245,13 @@ static IncProgressDialog *inc_progress_dialog_create(void)
 
        progress_dialog_set_value(progress, 0.0);
 
 
        progress_dialog_set_value(progress, 0.0);
 
+       gtk_widget_show(progress->window);
+
+       PIXMAP_CREATE(progress->clist, okxpm, okxpmmask, complete_xpm);
+       PIXMAP_CREATE(progress->clist,
+                     currentxpm, currentxpmmask, continue_xpm);
+       PIXMAP_CREATE(progress->clist, errorxpm, errorxpmmask, error_xpm);
+
        gtk_widget_show_now(progress->window);
 
        dialog->dialog = progress;
        gtk_widget_show_now(progress->window);
 
        dialog->dialog = progress;
@@ -308,8 +340,10 @@ static void inc_pop3_state_destroy(Pop3State *state)
 static void inc_start(IncProgressDialog *inc_dialog)
 {
        IncSession *session;
 static void inc_start(IncProgressDialog *inc_dialog)
 {
        IncSession *session;
+       GtkCList *clist = GTK_CLIST(inc_dialog->dialog->clist);
        Pop3State *pop3_state;
        IncState inc_state;
        Pop3State *pop3_state;
        IncState inc_state;
+       gint num = 0;
 
        while (inc_dialog->queue_list != NULL) {
                session = inc_dialog->queue_list->data;
 
        while (inc_dialog->queue_list != NULL) {
                session = inc_dialog->queue_list->data;
@@ -349,9 +383,20 @@ static void inc_start(IncProgressDialog *inc_dialog)
                        }
                }
 
                        }
                }
 
+               gtk_clist_set_pixmap(clist, num, 0, currentxpm, currentxpmmask);
+               gtk_clist_set_text(clist, num, 2, _("Retrieving"));
+
                /* begin POP3 session */
                inc_state = inc_pop3_session_do(session);
 
                /* begin POP3 session */
                inc_state = inc_pop3_session_do(session);
 
+               if (inc_state == INC_SUCCESS || inc_state == INC_CANCEL) {
+                       gtk_clist_set_pixmap(clist, num, 0, okxpm, okxpmmask);
+                       gtk_clist_set_text(clist, num, 2, _("Done"));
+               } else {
+                       gtk_clist_set_pixmap(clist, num, 0, errorxpm, errorxpmmask);
+                       gtk_clist_set_text(clist, num, 2, _("Error"));
+               }
+
                if (pop3_state->error_val == PS_AUTHFAIL) {
                        manage_window_focus_in(inc_dialog->dialog->window, NULL, NULL);
                        alertpanel_error
                if (pop3_state->error_val == PS_AUTHFAIL) {
                        manage_window_focus_in(inc_dialog->dialog->window, NULL, NULL);
                        alertpanel_error
@@ -382,6 +427,8 @@ static void inc_start(IncProgressDialog *inc_dialog)
                inc_session_destroy(session);
                inc_dialog->queue_list =
                        g_list_remove(inc_dialog->queue_list, session);
                inc_session_destroy(session);
                inc_dialog->queue_list =
                        g_list_remove(inc_dialog->queue_list, session);
+
+               num++;
        }
 
        while (inc_dialog->queue_list != NULL) {
        }
 
        while (inc_dialog->queue_list != NULL) {
@@ -394,6 +441,7 @@ static void inc_start(IncProgressDialog *inc_dialog)
        inc_progress_dialog_destroy(inc_dialog);
 }
 
        inc_progress_dialog_destroy(inc_dialog);
 }
 
+
 static IncState inc_pop3_session_do(IncSession *session)
 {
        Pop3State *pop3_state = session->pop3_state;
 static IncState inc_pop3_session_do(IncSession *session)
 {
        Pop3State *pop3_state = session->pop3_state;
@@ -463,21 +511,24 @@ static IncState inc_pop3_session_do(IncSession *session)
                alertpanel_error(_("Can't connect to POP3 server: %s:%d"),
                                 server, port);
                manage_window_focus_out(inc_dialog->dialog->window, NULL, NULL);
                alertpanel_error(_("Can't connect to POP3 server: %s:%d"),
                                 server, port);
                manage_window_focus_out(inc_dialog->dialog->window, NULL, NULL);
-               pop3_automaton_terminate(-1, atm);
+               pop3_automaton_terminate(NULL, atm);
                automaton_destroy(atm);
 
                automaton_destroy(atm);
 
-               return pop3_state->inc_state;
+               return INC_ERROR;
        }
 
        }
 
+       /* :WK: Hmmm, with the later sock_gdk_input, we have 2 references
+        * to the sock structure - implement a reference counter?? */
        pop3_state->sockinfo = sockinfo;
        pop3_state->sockinfo = sockinfo;
+       atm->help_sock = sockinfo;
 
 #if USE_THREADS
        atm->timeout_tag = gtk_timeout_add
                (TIMEOUT_ITV, (GtkFunction)connection_check_cb, atm);
 #else
 
 #if USE_THREADS
        atm->timeout_tag = gtk_timeout_add
                (TIMEOUT_ITV, (GtkFunction)connection_check_cb, atm);
 #else
-       atm->tag = gdk_input_add(sockinfo->sock,
-                                atm->state[atm->num].condition,
-                                automaton_input_cb, atm);
+       atm->tag = sock_gdk_input_add(sockinfo,
+                                     atm->state[atm->num].condition,
+                                     automaton_input_cb, atm);
 #endif
 
        gtk_main();
 #endif
 
        gtk_main();
@@ -485,13 +536,12 @@ static IncState inc_pop3_session_do(IncSession *session)
 #if USE_THREADS
        //pthread_join(sockinfo->connect_thr, NULL);
 #endif
 #if USE_THREADS
        //pthread_join(sockinfo->connect_thr, NULL);
 #endif
-       sock_sockinfo_free(sockinfo);
        automaton_destroy(atm);
 
        return pop3_state->inc_state;
 }
 
        automaton_destroy(atm);
 
        return pop3_state->inc_state;
 }
 
-static gint pop3_automaton_terminate(gint source, Automaton *atm)
+static gint pop3_automaton_terminate(SockInfo *source, Automaton *atm)
 {
        if (atm->tag > 0) {
                gdk_input_remove(atm->tag);
 {
        if (atm->tag > 0) {
                gdk_input_remove(atm->tag);
@@ -501,7 +551,7 @@ static gint pop3_automaton_terminate(gint source, Automaton *atm)
                gtk_timeout_remove(atm->timeout_tag);
                atm->timeout_tag = 0;
        }
                gtk_timeout_remove(atm->timeout_tag);
                atm->timeout_tag = 0;
        }
-       if (source > 0) {
+       if (source) {
                sock_close(source);
                gtk_main_quit();
        }
                sock_close(source);
                gtk_main_quit();
        }
@@ -725,7 +775,7 @@ static void inc_cancel(GtkWidget *widget, gpointer data)
 #endif
 
        session->pop3_state->inc_state = INC_CANCEL;
 #endif
 
        session->pop3_state->inc_state = INC_CANCEL;
-       pop3_automaton_terminate(sockinfo->sock, session->atm);
+       pop3_automaton_terminate(sockinfo, session->atm);
 }
 
 static gint inc_spool(void)
 }
 
 static gint inc_spool(void)
@@ -786,4 +836,4 @@ static gint get_spool(FolderItem *dest, const gchar *mbox)
        }
 
        return msgs;
        }
 
        return msgs;
-}
+}
\ No newline at end of file
index f0598e3029fb099b2153186d8f31126c9cbcd1ff..40e945a687a894b0f5020bb44fdaae86d6a6b3a3 100644 (file)
@@ -61,6 +61,7 @@
 #include "procmsg.h"
 #include "inc.h"
 #include "import.h"
 #include "procmsg.h"
 #include "inc.h"
 #include "import.h"
+#include "manage_window.h"
 #include "alertpanel.h"
 #include "addressbook.h"
 #include "compose.h"
 #include "alertpanel.h"
 #include "addressbook.h"
 #include "compose.h"
@@ -70,6 +71,7 @@
 #include "gtkutils.h"
 
 gchar *prog_version;
 #include "gtkutils.h"
 
 gchar *prog_version;
+gchar *startup_dir;
 gboolean debug_mode = FALSE;
 
 static gint lock_socket = -1;
 gboolean debug_mode = FALSE;
 
 static gint lock_socket = -1;
@@ -147,11 +149,11 @@ int main(int argc, char *argv[])
 #endif
 
        /* parse gtkrc files */
 #endif
 
        /* parse gtkrc files */
-       userrc = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S, ".gtkrc",
+       userrc = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S, ".gtkrc",
                             NULL);
        gtk_rc_parse(userrc);
        g_free(userrc);
                             NULL);
        gtk_rc_parse(userrc);
        g_free(userrc);
-       userrc = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S, ".gtk",
+       userrc = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S, ".gtk",
                             G_DIR_SEPARATOR_S, "gtkrc", NULL);
        gtk_rc_parse(userrc);
        g_free(userrc);
                             G_DIR_SEPARATOR_S, "gtkrc", NULL);
        gtk_rc_parse(userrc);
        g_free(userrc);
@@ -166,10 +168,11 @@ int main(int argc, char *argv[])
        g_free(userrc);
 
        prog_version = PROG_VERSION;
        g_free(userrc);
 
        prog_version = PROG_VERSION;
+       startup_dir = g_get_current_dir();
 
        parse_cmd_opt(argc, argv);
 
 
        parse_cmd_opt(argc, argv);
 
-       CHDIR_RETURN_VAL_IF_FAIL(g_get_home_dir(), 1);
+       CHDIR_RETURN_VAL_IF_FAIL(get_home_dir(), 1);
 
        /* check and create unix domain socket */
        lock_socket = prohibit_duplicate_launch();
 
        /* check and create unix domain socket */
        lock_socket = prohibit_duplicate_launch();
@@ -196,6 +199,13 @@ int main(int argc, char *argv[])
        srandom((gint)time(NULL));
 
 #if USE_GPGME
        srandom((gint)time(NULL));
 
 #if USE_GPGME
+       if (gpgme_check_engine()) {  /* Also does some gpgme init */
+               rfc2015_disable_all();
+               debug_print("gpgme_engine_version:\n%s\n",
+                           gpgme_get_engine_info());
+               alertpanel_warning(_("GnuPG is not installed properly.\n"
+                                    "OpenPGP support disabled."));
+       }
        gpgme_register_idle(idle_function_for_gpgme);
 #endif
 
        gpgme_register_idle(idle_function_for_gpgme);
 #endif
 
@@ -282,6 +292,17 @@ static void parse_cmd_opt(int argc, char *argv[])
        }
 }
 
        }
 }
 
+static gint get_queued_message_num(void)
+{
+       FolderItem *queue;
+
+       queue = folder_get_default_queue();
+       g_return_val_if_fail(queue != NULL, -1);
+
+       folder_item_scan(queue);
+       return queue->total;
+}
+
 void app_will_exit(GtkWidget *widget, gpointer data)
 {
        MainWindow *mainwin = data;
 void app_will_exit(GtkWidget *widget, gpointer data)
 {
        MainWindow *mainwin = data;
@@ -292,6 +313,15 @@ void app_will_exit(GtkWidget *widget, gpointer data)
                               _("Composing message exists. Really quit?"),
                               _("OK"), _("Cancel"), NULL) != G_ALERTDEFAULT)
                        return;
                               _("Composing message exists. Really quit?"),
                               _("OK"), _("Cancel"), NULL) != G_ALERTDEFAULT)
                        return;
+               manage_window_focus_in(mainwin->window, NULL, NULL);
+       }
+
+       if (prefs_common.warn_queued_on_exit && get_queued_message_num() > 0) {
+               if (alertpanel(_("Queued messages"),
+                              _("Some unsent messages are queued. Exit now?"),
+                              _("OK"), _("Cancel"), NULL) != G_ALERTDEFAULT)
+                       return;
+               manage_window_focus_in(mainwin->window, NULL, NULL);
        }
 
        if (prefs_common.clean_on_exit)
        }
 
        if (prefs_common.clean_on_exit)
@@ -317,7 +347,7 @@ void app_will_exit(GtkWidget *widget, gpointer data)
 
        /* delete unix domain socket */
        gdk_input_remove(lock_socket_tag);
 
        /* delete unix domain socket */
        gdk_input_remove(lock_socket_tag);
-       sock_close(lock_socket);
+       fd_close(lock_socket);
        filename = get_socket_name();
        unlink(filename);
 
        filename = get_socket_name();
        unlink(filename);
 
@@ -351,10 +381,10 @@ static gint prohibit_duplicate_launch(void)
        gchar *path;
 
        path = get_socket_name();
        gchar *path;
 
        path = get_socket_name();
-       uxsock = sock_connect_unix(path);
+       uxsock = fd_connect_unix(path);
        if (uxsock < 0) {
                unlink(path);
        if (uxsock < 0) {
                unlink(path);
-               return sock_open_unix(path);
+               return fd_open_unix(path);
        }
 
        /* remote command mode */
        }
 
        /* remote command mode */
@@ -362,9 +392,9 @@ static gint prohibit_duplicate_launch(void)
        debug_print(_("another Sylpheed is already running.\n"));
 
        if (cmd.receive_all)
        debug_print(_("another Sylpheed is already running.\n"));
 
        if (cmd.receive_all)
-               sock_write(uxsock, "receive_all\n", 12);
+               fd_write(uxsock, "receive_all\n", 12);
        else if (cmd.receive)
        else if (cmd.receive)
-               sock_write(uxsock, "receive\n", 8);
+               fd_write(uxsock, "receive\n", 8);
        else if (cmd.compose) {
                gchar *compose_str;
 
        else if (cmd.compose) {
                gchar *compose_str;
 
@@ -373,12 +403,12 @@ static gint prohibit_duplicate_launch(void)
                else
                        compose_str = g_strdup("compose\n");
 
                else
                        compose_str = g_strdup("compose\n");
 
-               sock_write(uxsock, compose_str, strlen(compose_str));
+               fd_write(uxsock, compose_str, strlen(compose_str));
                g_free(compose_str);
        } else
                g_free(compose_str);
        } else
-               sock_write(uxsock, "popup\n", 6);
+               fd_write(uxsock, "popup\n", 6);
 
 
-       sock_close(uxsock);
+       fd_close(uxsock);
        return -1;
 }
 
        return -1;
 }
 
@@ -390,9 +420,9 @@ static void lock_socket_input_cb(gpointer data,
        gint sock;
        gchar buf[BUFFSIZE];
 
        gint sock;
        gchar buf[BUFFSIZE];
 
-       sock = sock_accept(source);
-       sock_read(sock, buf, sizeof(buf));
-       sock_close(sock);
+       sock = fd_accept(source);
+       fd_read(sock, buf, sizeof(buf));
+       fd_close(sock);
 
        if (!strncmp(buf, "popup", 5)){
                main_window_popup(mainwin);
 
        if (!strncmp(buf, "popup", 5)){
                main_window_popup(mainwin);
@@ -421,3 +451,4 @@ static void open_compose_new_with_recipient(const gchar *address)
        else
                compose_new(NULL);
 }
        else
                compose_new(NULL);
 }
+
index cf4d42e7ad59721704b519c73feb5020afa4ab66..d365cc6680eb0712f5041d877faddd93d5a6326f 100644 (file)
@@ -24,6 +24,7 @@
 #include <gtk/gtkwidget.h>
 
 extern gchar *prog_version;
 #include <gtk/gtkwidget.h>
 
 extern gchar *prog_version;
+extern gchar *startup_dir;
 extern gboolean debug_mode;
 
 void app_will_exit     (GtkWidget *widget, gpointer data);
 extern gboolean debug_mode;
 
 void app_will_exit     (GtkWidget *widget, gpointer data);
index d9508fbfed6178cb4386d7a795c2f5ba2991e8f7..5359cede45156d2688e289f6e90525ba58cd8f17 100644 (file)
@@ -783,6 +783,7 @@ void main_window_reflect_prefs_all(void)
                }
 
                summary_change_display_item(mainwin->summaryview);
                }
 
                summary_change_display_item(mainwin->summaryview);
+               summary_redisplay_msg(mainwin->summaryview);
                headerview_set_visibility(mainwin->messageview->headerview,
                                          prefs_common.display_header_pane);
        }
                headerview_set_visibility(mainwin->messageview->headerview,
                                          prefs_common.display_header_pane);
        }
@@ -942,6 +943,7 @@ void main_window_empty_trash(MainWindow *mainwin, gboolean confirm)
                               _("Empty all messages in trash?"),
                               _("Yes"), _("No"), NULL) != G_ALERTDEFAULT)
                        return;
                               _("Empty all messages in trash?"),
                               _("Yes"), _("No"), NULL) != G_ALERTDEFAULT)
                        return;
+               manage_window_focus_in(mainwin->window, NULL, NULL);
        }
 
        procmsg_empty_trash();
        }
 
        procmsg_empty_trash();
@@ -1646,29 +1648,15 @@ static void print_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
        summary_print(mainwin->summaryview);
 }
 
        summary_print(mainwin->summaryview);
 }
 
-static gint queued_messages(void)
-{
-       FolderItem *queue = folder_get_default_queue();
-       folder_item_scan(queue);
-       return queue->total;
-}
-
 static void app_exit_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
 {
        if (prefs_common.confirm_on_exit) {
                if (alertpanel(_("Exit"), _("Exit this program?"),
                               _("OK"), _("Cancel"), NULL) != G_ALERTDEFAULT)
                        return;
 static void app_exit_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
 {
        if (prefs_common.confirm_on_exit) {
                if (alertpanel(_("Exit"), _("Exit this program?"),
                               _("OK"), _("Cancel"), NULL) != G_ALERTDEFAULT)
                        return;
+               manage_window_focus_in(mainwin->window, NULL, NULL);
        }
 
        }
 
-       if (prefs_common.warn_queued_on_exit && queued_messages() > 0) {
-               if (alertpanel(_("Queued messages"), 
-                              _("Some unsent messages are queued. Exit now?"),
-                              _("OK"), _("Cancel"), NULL) != G_ALERTDEFAULT)
-                       return;
-       }
-
-       manage_window_focus_in(mainwin->window, NULL, NULL);
        app_will_exit(widget, mainwin);
 }
 
        app_will_exit(widget, mainwin);
 }
 
index 6513beb6e719663d37619e9fe6b35961c90732ea..073ca496382f252bcb79e1310f09e81b6584b0c5 100644 (file)
@@ -394,7 +394,10 @@ gint export_to_mbox(FolderItem *src, const gchar *mbox)
                msginfo = (MsgInfo *)cur->data;
 
                msg_fp = procmsg_open_message(msginfo);
                msginfo = (MsgInfo *)cur->data;
 
                msg_fp = procmsg_open_message(msginfo);
-               if (!msg_fp) continue;
+               if (!msg_fp) {
+                       procmsg_msginfo_free(msginfo);
+                       continue;
+               }
 
                strncpy2(buf,
                         msginfo->from ? msginfo->from :
 
                strncpy2(buf,
                         msginfo->from ? msginfo->from :
index f9deb4efb0b0fb8c4ece7689cdb06841af9266a1..013a305a33ec61c967fea90de2bfd4a2be9c2475 100644 (file)
--- a/src/md5.h
+++ b/src/md5.h
@@ -1,42 +1,51 @@
-/* MD5.H - header file for MD5C.C
+/* md5.h - MD5 Message-Digest Algorithm
+ *     Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc.
+ *
+ * according to the definition of MD5 in RFC 1321 from April 1992.
+ * NOTE: This is *not* the same file as the one from glibc
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
  */
 
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
-rights reserved.
+#ifndef _MD5_HDR_
+#define _MD5_HDR_
 
 
-License to copy and use this software is granted provided that it
-is identified as the "RSA Data Security, Inc. MD5 Message-Digest
-Algorithm" in all material mentioning or referencing this software
-or this function.
+#include "utils.h"
 
 
-License is also granted to make and use derivative works provided
-that such works are identified as "derived from the RSA Data
-Security, Inc. MD5 Message-Digest Algorithm" in all material
-mentioning or referencing the derived work.
+typedef struct {  /* Hmm, should be private */
+    u32 A,B,C,D;
+    u32  nblocks;
+    unsigned char buf[64];
+    int  count;
+    int  finalized;
+} MD5_CONTEXT;
 
 
-RSA Data Security, Inc. makes no representations concerning either
-the merchantability of this software or the suitability of this
-software for any particular purpose. It is provided "as is"
-without express or implied warranty of any kind.
+typedef MD5_CONTEXT MD5_CTX;
 
 
-These notices must be retained in any copies of any part of this
-documentation and/or software.
- */
+void md5_init(MD5_CONTEXT *ctx);
+void md5_update(MD5_CONTEXT *hd, const unsigned char *inbuf, size_t inlen);
+void md5_final(unsigned char *digest, MD5_CONTEXT *ctx);
 
 
-#ifndef MD5_H__
-#define MD5_H__
+void md5_hex_digest(char *hexdigest, const unsigned char *s);
 
 
-#include "md5global.h"
+void md5_hmac(unsigned char *digest,
+              const unsigned char* text, int text_len,
+              const unsigned char* key, int key_len);
+void md5_hex_hmac(char *hexdigest,
+                  const unsigned char* text, int text_len,
+                  const unsigned char* key, int key_len);
 
 
-/* MD5 context. */
-typedef struct {
-  UINT4 state[4];                                   /* state (ABCD) */
-  UINT4 count[2];        /* number of bits, modulo 2^64 (lsb first) */
-  unsigned char buffer[64];                         /* input buffer */
-} MD5_CTX;
+#endif /* _MD5_HDR_ */
 
 
-void MD5Init PROTO_LIST ((MD5_CTX *));
-void MD5Update PROTO_LIST
-  ((MD5_CTX *, unsigned char *, unsigned int));
-void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *));
-#endif /* MD5_H__ */
index 92b5d44aa6c63d39786c35e96d6444cc6adf3aaf..aa6192cd18cb51d4832d077773f6360b5a4940e1 100644 (file)
-/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
+/* md5.c - MD5 Message-Digest Algorithm
+ *     Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc.
+ *
+ * according to the definition of MD5 in RFC 1321 from April 1992.
+ * NOTE: This is *not* the same file as the one from glibc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
  */
+/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.  */
+/* heavily modified for GnuPG by <werner.koch@guug.de> */
+/* modified again for Sylpheed by <wk@gnupg.org> 2001-02-11 */
 
 
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
-rights reserved.
 
 
-License to copy and use this software is granted provided that it
-is identified as the "RSA Data Security, Inc. MD5 Message-Digest
-Algorithm" in all material mentioning or referencing this software
-or this function.
-
-License is also granted to make and use derivative works provided
-that such works are identified as "derived from the RSA Data
-Security, Inc. MD5 Message-Digest Algorithm" in all material
-mentioning or referencing the derived work.
-
-RSA Data Security, Inc. makes no representations concerning either
-the merchantability of this software or the suitability of this
-software for any particular purpose. It is provided "as is"
-without express or implied warranty of any kind.
-
-These notices must be retained in any copies of any part of this
-documentation and/or software.
+/* Test values:
+ * ""                  D4 1D 8C D9 8F 00 B2 04  E9 80 09 98 EC F8 42 7E
+ * "a"                 0C C1 75 B9 C0 F1 B6 A8  31 C3 99 E2 69 77 26 61
+ * "abc                90 01 50 98 3C D2 4F B0  D6 96 3F 7D 28 E1 7F 72
+ * "message digest"    F9 6B 69 7D 7C B7 93 8D  52 5A 2F 31 AA F1 61 D0
  */
 
  */
 
-#include "config.h"
-#include "md5global.h"
-#include "md5.h"
+#include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
 
 
-/* Constants for MD5Transform routine.
- */
-#define S11 7
-#define S12 12
-#define S13 17
-#define S14 22
-#define S21 5
-#define S22 9
-#define S23 14
-#define S24 20
-#define S31 4
-#define S32 11
-#define S33 16
-#define S34 23
-#define S41 6
-#define S42 10
-#define S43 15
-#define S44 21
-
-static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64]));
-static void Encode PROTO_LIST
-  ((unsigned char *, UINT4 *, unsigned int));
-static void Decode PROTO_LIST
-  ((UINT4 *, unsigned char *, unsigned int));
-static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
-static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
-
-static unsigned char PADDING[64] = {
-  0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-/* F, G, H and I are basic MD5 functions.
- */
-#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
-#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
-#define H(x, y, z) ((x) ^ (y) ^ (z))
-#define I(x, y, z) ((y) ^ ((x) | (~z)))
+#include "utils.h"
+#include "md5.h"
 
 
-/* ROTATE_LEFT rotates x left n bits.
- */
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
 
 
-/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
-Rotation is separate from addition to prevent recomputation.
- */
-#define FF(a, b, c, d, x, s, ac) { \
- (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
-  }
-#define GG(a, b, c, d, x, s, ac) { \
- (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
-  }
-#define HH(a, b, c, d, x, s, ac) { \
- (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
-  }
-#define II(a, b, c, d, x, s, ac) { \
- (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
-  }
-
-/* MD5 initialization. Begins an MD5 operation, writing a new context.
+/****************
+ * Rotate a 32 bit integer by n bytes
  */
  */
-void MD5Init (context)
-MD5_CTX *context;                                        /* context */
+#if defined(__GNUC__) && defined(__i386__)
+static inline u32
+rol( u32 x, int n)
 {
 {
-  context->count[0] = context->count[1] = 0;
-  /* Load magic initialization constants.
-*/
-  context->state[0] = 0x67452301;
-  context->state[1] = 0xefcdab89;
-  context->state[2] = 0x98badcfe;
-  context->state[3] = 0x10325476;
+       __asm__("roll %%cl,%0"
+               :"=r" (x)
+               :"0" (x),"c" (n));
+       return x;
 }
 }
+#else
+  #define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) )
+#endif
 
 
-/* MD5 block update operation. Continues an MD5 message-digest
-  operation, processing another message block, and updating the
-  context.
- */
-void MD5Update (context, input, inputLen)
-MD5_CTX *context;                                        /* context */
-unsigned char *input;                                /* input block */
-unsigned int inputLen;                     /* length of input block */
-{
-  unsigned int i, index, partLen;
-
-  /* Compute number of bytes mod 64 */
-  index = (unsigned int)((context->count[0] >> 3) & 0x3F);
 
 
-  /* Update number of bits */
-  if ((context->count[0] += ((UINT4)inputLen << 3))
-   < ((UINT4)inputLen << 3))
- context->count[1]++;
-  context->count[1] += ((UINT4)inputLen >> 29);
+void
+md5_init( MD5_CONTEXT *ctx )
+{
+    ctx->A = 0x67452301;
+    ctx->B = 0xefcdab89;
+    ctx->C = 0x98badcfe;
+    ctx->D = 0x10325476;
+
+    ctx->nblocks = 0;
+    ctx->count = 0;
+    ctx->finalized = 0;
+}
 
 
-  partLen = 64 - index;
+/* These are the four functions used in the four steps of the MD5 algorithm
+   and defined in the RFC 1321.  The first function is a little bit optimized
+   (as found in Colin Plumbs public domain implementation).  */
+/* #define FF(b, c, d) ((b & c) | (~b & d)) */
+#define FF(b, c, d) (d ^ (b & (c ^ d)))
+#define FG(b, c, d) FF (d, b, c)
+#define FH(b, c, d) (b ^ c ^ d)
+#define FI(b, c, d) (c ^ (b | ~d))
 
 
-  /* Transform as many times as possible.
-*/
-  if (inputLen >= partLen) {
- MD5_memcpy
-   ((POINTER)&context->buffer[index], (POINTER)input, partLen);
- MD5Transform (context->state, context->buffer);
-
- for (i = partLen; i + 63 < inputLen; i += 64)
-   MD5Transform (context->state, &input[i]);
-
- index = 0;
-  }
-  else
- i = 0;
-
-  /* Buffer remaining input */
-  MD5_memcpy
- ((POINTER)&context->buffer[index], (POINTER)&input[i],
-  inputLen-i);
-}
 
 
-/* MD5 finalization. Ends an MD5 message-digest operation, writing the
-  the message digest and zeroizing the context.
+/****************
+ * transform n*64 bytes
  */
  */
-void MD5Final (digest, context)
-unsigned char digest[16];                         /* message digest */
-MD5_CTX *context;                                       /* context */
+static void
+transform( MD5_CONTEXT *ctx, const unsigned char *data )
 {
 {
-  unsigned char bits[8];
-  unsigned int index, padLen;
+    u32 correct_words[16];
+    u32 A = ctx->A;
+    u32 B = ctx->B;
+    u32 C = ctx->C;
+    u32 D = ctx->D;
+    u32 *cwp = correct_words;
+
+  #ifdef BIG_ENDIAN_HOST
+    { int i;
+      const unsigned char *p2, *p1;
+      for(i=0, p1=data, p2=(unsigned char*)correct_words; i < 16; i++, p2 += 4 ) {
+       p2[3] = *p1++;
+       p2[2] = *p1++;
+       p2[1] = *p1++;
+       p2[0] = *p1++;
+      }
+    }
+  #else
+    memcpy( correct_words, data, 64 );
+  #endif
+
+
+#define OP(a, b, c, d, s, T)                                       \
+  do                                                               \
+    {                                                              \
+      a += FF (b, c, d) + (*cwp++) + T;            \
+      a = rol(a, s);                                               \
+      a += b;                                                      \
+    }                                                              \
+  while (0)
+
+    /* Before we start, one word about the strange constants.
+       They are defined in RFC 1321 as
+
+       T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
+     */
+
+    /* Round 1.  */
+    OP (A, B, C, D,  7, 0xd76aa478);
+    OP (D, A, B, C, 12, 0xe8c7b756);
+    OP (C, D, A, B, 17, 0x242070db);
+    OP (B, C, D, A, 22, 0xc1bdceee);
+    OP (A, B, C, D,  7, 0xf57c0faf);
+    OP (D, A, B, C, 12, 0x4787c62a);
+    OP (C, D, A, B, 17, 0xa8304613);
+    OP (B, C, D, A, 22, 0xfd469501);
+    OP (A, B, C, D,  7, 0x698098d8);
+    OP (D, A, B, C, 12, 0x8b44f7af);
+    OP (C, D, A, B, 17, 0xffff5bb1);
+    OP (B, C, D, A, 22, 0x895cd7be);
+    OP (A, B, C, D,  7, 0x6b901122);
+    OP (D, A, B, C, 12, 0xfd987193);
+    OP (C, D, A, B, 17, 0xa679438e);
+    OP (B, C, D, A, 22, 0x49b40821);
+
+#undef OP
+#define OP(f, a, b, c, d, k, s, T)  \
+    do                                                               \
+      {                                                              \
+       a += f (b, c, d) + correct_words[k] + T;                      \
+       a = rol(a, s);                                                \
+       a += b;                                                       \
+      }                                                              \
+    while (0)
+
+    /* Round 2.  */
+    OP (FG, A, B, C, D,  1,  5, 0xf61e2562);
+    OP (FG, D, A, B, C,  6,  9, 0xc040b340);
+    OP (FG, C, D, A, B, 11, 14, 0x265e5a51);
+    OP (FG, B, C, D, A,  0, 20, 0xe9b6c7aa);
+    OP (FG, A, B, C, D,  5,  5, 0xd62f105d);
+    OP (FG, D, A, B, C, 10,  9, 0x02441453);
+    OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);
+    OP (FG, B, C, D, A,  4, 20, 0xe7d3fbc8);
+    OP (FG, A, B, C, D,  9,  5, 0x21e1cde6);
+    OP (FG, D, A, B, C, 14,  9, 0xc33707d6);
+    OP (FG, C, D, A, B,  3, 14, 0xf4d50d87);
+    OP (FG, B, C, D, A,  8, 20, 0x455a14ed);
+    OP (FG, A, B, C, D, 13,  5, 0xa9e3e905);
+    OP (FG, D, A, B, C,  2,  9, 0xfcefa3f8);
+    OP (FG, C, D, A, B,  7, 14, 0x676f02d9);
+    OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
+
+    /* Round 3.  */
+    OP (FH, A, B, C, D,  5,  4, 0xfffa3942);
+    OP (FH, D, A, B, C,  8, 11, 0x8771f681);
+    OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);
+    OP (FH, B, C, D, A, 14, 23, 0xfde5380c);
+    OP (FH, A, B, C, D,  1,  4, 0xa4beea44);
+    OP (FH, D, A, B, C,  4, 11, 0x4bdecfa9);
+    OP (FH, C, D, A, B,  7, 16, 0xf6bb4b60);
+    OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);
+    OP (FH, A, B, C, D, 13,  4, 0x289b7ec6);
+    OP (FH, D, A, B, C,  0, 11, 0xeaa127fa);
+    OP (FH, C, D, A, B,  3, 16, 0xd4ef3085);
+    OP (FH, B, C, D, A,  6, 23, 0x04881d05);
+    OP (FH, A, B, C, D,  9,  4, 0xd9d4d039);
+    OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);
+    OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);
+    OP (FH, B, C, D, A,  2, 23, 0xc4ac5665);
+
+    /* Round 4.  */
+    OP (FI, A, B, C, D,  0,  6, 0xf4292244);
+    OP (FI, D, A, B, C,  7, 10, 0x432aff97);
+    OP (FI, C, D, A, B, 14, 15, 0xab9423a7);
+    OP (FI, B, C, D, A,  5, 21, 0xfc93a039);
+    OP (FI, A, B, C, D, 12,  6, 0x655b59c3);
+    OP (FI, D, A, B, C,  3, 10, 0x8f0ccc92);
+    OP (FI, C, D, A, B, 10, 15, 0xffeff47d);
+    OP (FI, B, C, D, A,  1, 21, 0x85845dd1);
+    OP (FI, A, B, C, D,  8,  6, 0x6fa87e4f);
+    OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
+    OP (FI, C, D, A, B,  6, 15, 0xa3014314);
+    OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);
+    OP (FI, A, B, C, D,  4,  6, 0xf7537e82);
+    OP (FI, D, A, B, C, 11, 10, 0xbd3af235);
+    OP (FI, C, D, A, B,  2, 15, 0x2ad7d2bb);
+    OP (FI, B, C, D, A,  9, 21, 0xeb86d391);
+
+    /* Put checksum in context given as argument.  */
+    ctx->A += A;
+    ctx->B += B;
+    ctx->C += C;
+    ctx->D += D;
+}
 
 
-  /* Save number of bits */
-  Encode (bits, context->count, 8);
 
 
-  /* Pad out to 56 mod 64.
-*/
-  index = (unsigned int)((context->count[0] >> 3) & 0x3f);
-  padLen = (index < 56) ? (56 - index) : (120 - index);
-  MD5Update (context, PADDING, padLen);
 
 
-  /* Append length (before padding) */
-  MD5Update (context, bits, 8);
-  /* Store state in digest */
-  Encode (digest, context->state, 16);
+/* The routine updates the message-digest context to
+ * account for the presence of each of the characters inBuf[0..inLen-1]
+ * in the message whose digest is being computed.
+ */
+void
+md5_update( MD5_CONTEXT *hd, const unsigned char *inbuf, size_t inlen)
+{
+    if( hd->count == 64 ) { /* flush the buffer */
+       transform( hd, hd->buf );
+       hd->count = 0;
+       hd->nblocks++;
+    }
+    if( !inbuf )
+       return;
+    if( hd->count ) {
+       for( ; inlen && hd->count < 64; inlen-- )
+           hd->buf[hd->count++] = *inbuf++;
+       md5_update( hd, NULL, 0 );
+       if( !inlen )
+           return;
+    }
+
+    while( inlen >= 64 ) {
+       transform( hd, inbuf );
+       hd->count = 0;
+       hd->nblocks++;
+       inlen -= 64;
+       inbuf += 64;
+    }
+    for( ; inlen && hd->count < 64; inlen-- )
+       hd->buf[hd->count++] = *inbuf++;
 
 
-  /* Zeroize sensitive information.
-*/
-  MD5_memset ((POINTER)context, 0, sizeof (*context));
 }
 
 }
 
-/* MD5 basic transformation. Transforms state based on block.
+
+
+/* The routine final terminates the message-digest computation and
+ * ends with the desired message digest in mdContext->digest[0...15].
+ * The handle is prepared for a new MD5 cycle.
+ * Returns 16 bytes representing the digest.
  */
  */
-static void MD5Transform (state, block)
-UINT4 state[4];
-unsigned char block[64];
+
+static void
+do_final( MD5_CONTEXT *hd )
 {
 {
-  UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
-
-  Decode (x, block, 64);
-
-  /* Round 1 */
-  FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
-  FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
-  FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
-  FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
-  FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
-  FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
-  FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
-  FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
-  FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
-  FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
-  FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
-  FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
-  FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
-  FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
-  FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
-  FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
-
- /* Round 2 */
-  GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
-  GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
-  GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
-  GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
-  GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
-  GG (d, a, b, c, x[10], S22,  0x2441453); /* 22 */
-  GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
-  GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
-  GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
-  GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
-  GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
-  GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
-  GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
-  GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
-  GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
-  GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
-
-  /* Round 3 */
-  HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
-  HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
-  HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
-  HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
-  HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
-  HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
-  HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
-  HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
-  HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
-  HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
-  HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
-  HH (b, c, d, a, x[ 6], S34,  0x4881d05); /* 44 */
-  HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
-  HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
-  HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
-  HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
-
-  /* Round 4 */
-  II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
-  II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
-  II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
-  II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
-  II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
-  II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
-  II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
-  II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
-  II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
-  II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
-  II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
-  II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
-  II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
-  II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
-  II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
-  II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
-
-  state[0] += a;
-  state[1] += b;
-  state[2] += c;
-  state[3] += d;
-
-  /* Zeroize sensitive information.
-*/
-  MD5_memset ((POINTER)x, 0, sizeof (x));
+    u32 t, msb, lsb;
+    unsigned char *p;
+
+    md5_update(hd, NULL, 0); /* flush */;
+
+    msb = 0;
+    t = hd->nblocks;
+    if( (lsb = t << 6) < t ) /* multiply by 64 to make a byte count */
+       msb++;
+    msb += t >> 26;
+    t = lsb;
+    if( (lsb = t + hd->count) < t ) /* add the count */
+       msb++;
+    t = lsb;
+    if( (lsb = t << 3) < t ) /* multiply by 8 to make a bit count */
+       msb++;
+    msb += t >> 29;
+
+    if( hd->count < 56 ) { /* enough room */
+       hd->buf[hd->count++] = 0x80; /* pad */
+       while( hd->count < 56 )
+           hd->buf[hd->count++] = 0;  /* pad */
+    }
+    else { /* need one extra block */
+       hd->buf[hd->count++] = 0x80; /* pad character */
+       while( hd->count < 64 )
+           hd->buf[hd->count++] = 0;
+       md5_update(hd, NULL, 0);  /* flush */;
+       memset(hd->buf, 0, 56 ); /* fill next block with zeroes */
+    }
+    /* append the 64 bit count */
+    hd->buf[56] = lsb     ;
+    hd->buf[57] = lsb >>  8;
+    hd->buf[58] = lsb >> 16;
+    hd->buf[59] = lsb >> 24;
+    hd->buf[60] = msb     ;
+    hd->buf[61] = msb >>  8;
+    hd->buf[62] = msb >> 16;
+    hd->buf[63] = msb >> 24;
+    transform( hd, hd->buf );
+
+    p = hd->buf;
+  #ifdef BIG_ENDIAN_HOST
+    #define X(a) do { *p++ = hd->##a     ; *p++ = hd->##a >> 8;      \
+                     *p++ = hd->##a >> 16; *p++ = hd->##a >> 24; } while(0)
+  #else /* little endian */
+    /*#define X(a) do { *(u32*)p = hd->##a ; p += 4; } while(0)*/
+    /* Unixware's cpp doesn't like the above construct so we do it his way:
+     * (reported by Allan Clark) */
+    #define X(a) do { *(u32*)p = (*hd).a ; p += 4; } while(0)
+  #endif
+    X(A);
+    X(B);
+    X(C);
+    X(D);
+  #undef X
+    hd->finalized = 1;
 }
 
 }
 
-/* Encodes input (UINT4) into output (unsigned char). Assumes len is
-  a multiple of 4.
- */
-static void Encode (output, input, len)
-unsigned char *output;
-UINT4 *input;
-unsigned int len;
+void 
+md5_final ( unsigned char *digest, MD5_CONTEXT *ctx )
 {
 {
-  unsigned int i, j;
-
-  for (i = 0, j = 0; j < len; i++, j += 4) {
- output[j] = (unsigned char)(input[i] & 0xff);
- output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
- output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
- output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
-  }
+    if ( !ctx->finalized )
+        do_final (ctx);
+    memcpy (digest, ctx->buf, 16);
 }
 
 }
 
-/* Decodes input (unsigned char) into output (UINT4). Assumes len is
-  a multiple of 4.
+/*
+ * Creates a MD5 digest in hex fomrat (lowercase letters) from the
+ * string S.  hextdigest but be buffer of at lease 33 bytes!
  */
  */
-static void Decode (output, input, len)
-UINT4 *output;
-unsigned char *input;
-unsigned int len;
+void
+md5_hex_digest (char *hexdigest, const unsigned char *s)
 {
 {
-  unsigned int i, j;
-
-  for (i = 0, j = 0; j < len; i++, j += 4)
- output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
-   (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
+    int i;
+    MD5_CTX context;
+    unsigned char digest[16];
+
+    md5_init(&context);
+    md5_update(&context, s, strlen(s));
+    md5_final(digest, &context);
+  
+    for (i = 0;  i < 16;  i++) 
+        sprintf(hexdigest+2*i, "%02x", digest[i]);
 }
 
 }
 
-/* Note: Replace "for loop" with standard memcpy if possible.
- */
 
 
-static void MD5_memcpy (output, input, len)
-POINTER output;
-POINTER input;
-unsigned int len;
+/*
+** Function: md5_hmac
+** taken from the file rfc2104.txt
+** written by Martin Schaaf <mascha@ma-scha.de>
+*/
+void 
+md5_hmac(unsigned char *digest,
+         const unsigned char* text, int text_len,
+         const unsigned char* key, int key_len )
 {
 {
-  unsigned int i;
-
-  for (i = 0; i < len; i++)
- output[i] = input[i];
+        MD5_CTX context;
+        unsigned char k_ipad[64];    /* inner padding -
+                                      * key XORd with ipad
+                                      */
+        unsigned char k_opad[64];    /* outer padding -
+                                      * key XORd with opad
+                                      */
+        /* unsigned char tk[16]; */
+        int i;
+
+        /* start out by storing key in pads */
+        memset( k_ipad, 0, sizeof k_ipad);
+        memset( k_opad, 0, sizeof k_opad);
+        if (key_len > 64) { 
+                /* if key is longer than 64 bytes reset it to key=MD5(key) */
+                MD5_CTX      tctx;
+                
+                md5_init(&tctx);
+                md5_update(&tctx, key, key_len);
+                md5_final(k_ipad, &tctx);
+                md5_final(k_opad, &tctx);
+        }
+        else {
+                memcpy(k_ipad, key, key_len);
+                memcpy(k_opad, key, key_len);
+        }
+
+        /*
+         * the HMAC_MD5 transform looks like:
+         *
+         * MD5(K XOR opad, MD5(K XOR ipad, text))
+         *
+         * where K is an n byte key
+         * ipad is the byte 0x36 repeated 64 times
+         * opad is the byte 0x5c repeated 64 times
+         * and text is the data being protected
+         */
+
+
+        /* XOR key with ipad and opad values */
+        for (i=0; i<64; i++) {
+                k_ipad[i] ^= 0x36;
+                k_opad[i] ^= 0x5c;
+        }
+        /*
+         * perform inner MD5
+         */
+        md5_init(&context);                   /* init context for 1st
+                                               * pass */
+        md5_update(&context, k_ipad, 64);     /* start with inner pad */
+        md5_update(&context, text, text_len); /* then text of datagram */
+        md5_final(digest, &context);          /* finish up 1st pass */
+        /*
+         * perform outer MD5
+         */
+        md5_init(&context);                   /* init context for 2nd
+                                              * pass */
+        md5_update(&context, k_opad, 64);     /* start with outer pad */
+        md5_update(&context, digest, 16);     /* then results of 1st
+                                              * hash */
+        md5_final(digest, &context);          /* finish up 2nd pass */
 }
 
 }
 
-/* Note: Replace "for loop" with standard memset if possible.
- */
-static void MD5_memset (output, value, len)
-POINTER output;
-int value;
-unsigned int len;
+
+void 
+md5_hex_hmac(char *hexdigest,
+             const unsigned char* text, int text_len,
+             const unsigned char* key, int key_len )
 {
 {
-  unsigned int i;
+    unsigned char digest[16];
+    int i;
 
 
-  for (i = 0; i < len; i++)
- ((char *)output)[i] = (char)value;
+    md5_hmac( digest, text, text_len, key, key_len);
+    for (i = 0;  i < 16;  i++) 
+        sprintf(hexdigest+2*i, "%02x", digest[i]);
 }
 }
index fd3259e53e647718ff095f8e07d632909b329633..77e23251054e7d5c730589235fd9d0b753f50d3e 100644 (file)
--- a/src/mh.c
+++ b/src/mh.c
@@ -632,7 +632,7 @@ gint mh_create_tree(Folder *folder)
 
        g_return_val_if_fail(folder != NULL, -1);
 
 
        g_return_val_if_fail(folder != NULL, -1);
 
-       CHDIR_RETURN_VAL_IF_FAIL(g_get_home_dir(), -1);
+       CHDIR_RETURN_VAL_IF_FAIL(get_home_dir(), -1);
        rootpath = LOCAL_FOLDER(folder)->rootpath;
        MAKE_DIR_IF_NOT_EXIST(rootpath);
        CHDIR_RETURN_VAL_IF_FAIL(rootpath, -1);
        rootpath = LOCAL_FOLDER(folder)->rootpath;
        MAKE_DIR_IF_NOT_EXIST(rootpath);
        CHDIR_RETURN_VAL_IF_FAIL(rootpath, -1);
@@ -885,6 +885,30 @@ static MsgInfo *mh_parse_msg(const gchar *file, FolderItem *item)
        return msginfo;
 }
 
        return msginfo;
 }
 
+static gboolean mh_is_maildir_one(const gchar *path, const gchar *dir)
+{
+       char *entry;
+       gboolean result;
+
+       entry = g_strconcat(path, G_DIR_SEPARATOR_S, dir, NULL);
+       result = is_dir_exist(entry);
+       g_free(entry);
+
+       return result;
+}
+
+/*
+ * check whether PATH is a Maildir style mailbox.
+ * This is the case if the 3 subdir: new, cur, tmp are existing.
+ * This functon assumes that entry is an directory
+ */
+static gboolean mh_is_maildir(const gchar *path)
+{
+       return mh_is_maildir_one(path, "new") &&
+              mh_is_maildir_one(path, "cur") &&
+              mh_is_maildir_one(path, "tmp");
+}
+
 static void mh_scan_tree_recursive(FolderItem *item)
 {
        DIR *dp;
 static void mh_scan_tree_recursive(FolderItem *item)
 {
        DIR *dp;
@@ -927,6 +951,11 @@ static void mh_scan_tree_recursive(FolderItem *item)
                if (S_ISDIR(s.st_mode)) {
                        FolderItem *new_item;
 
                if (S_ISDIR(s.st_mode)) {
                        FolderItem *new_item;
 
+                       if (mh_is_maildir(entry)) {
+                               g_free(entry);
+                               continue;
+                       }
+
                        new_item = folder_item_new(d->d_name, entry);
                        folder_item_append(item, new_item);
                        if (!item->path) {
                        new_item = folder_item_new(d->d_name, entry);
                        folder_item_append(item, new_item);
                        if (!item->path) {
index b72fd644553fd63b6d27d600356ee9d03fdfc5ff..80d953efbe47feec68cce2b9dd0fb3e9eafd9e22 100644 (file)
@@ -242,7 +242,7 @@ static void set_unchecked_signature(MimeInfo *mimeinfo)
        g_free(sig_partinfo->sigstatus_full);
        sig_partinfo->sigstatus_full = NULL;
 }
        g_free(sig_partinfo->sigstatus_full);
        sig_partinfo->sigstatus_full = NULL;
 }
-#endif /*USE_GPGME*/
+#endif /* USE_GPGME */
 
 void mimeview_show_message(MimeView *mimeview, MimeInfo *mimeinfo,
                           const gchar *file)
 
 void mimeview_show_message(MimeView *mimeview, MimeInfo *mimeinfo,
                           const gchar *file)
@@ -855,4 +855,4 @@ static void mimeview_check_signature(MimeView *mimeview)
        mimeview_update_names(mimeview);
        mimeview_update_signature_info(mimeview);
 }
        mimeview_update_names(mimeview);
        mimeview_update_signature_info(mimeview);
 }
-#endif /*USE_GPGME*/
+#endif /* USE_GPGME */
index 8f843388f9f8f738f51ecd94c015c548dc468be6..db631d285f3ce3799af5c48dfb8203d911b2092a 100644 (file)
@@ -72,7 +72,7 @@ Session *news_session_new(const gchar *server, gushort port)
 {
        gchar buf[NNTPBUFSIZE];
        NNTPSession *session;
 {
        gchar buf[NNTPBUFSIZE];
        NNTPSession *session;
-       gint nntp_sock;
+       SockInfo *nntp_sock;
 
        g_return_val_if_fail(server != NULL, NULL);
 
 
        g_return_val_if_fail(server != NULL, NULL);
 
@@ -95,7 +95,8 @@ Session *news_session_new(const gchar *server, gushort port)
 
 void news_session_destroy(NNTPSession *session)
 {
 
 void news_session_destroy(NNTPSession *session)
 {
-       close(SESSION(session)->sock);
+       sock_close(SESSION(session)->sock);
+       SESSION(session)->sock = NULL;
 
        g_free(session->group);
 }
 
        g_free(session->group);
 }
@@ -584,22 +585,19 @@ GSList * news_get_group_list(FolderItem *item)
        if (is_file_exist(filename)) {
                debug_print(_("group list has been already cached.\n"));
        }
        if (is_file_exist(filename)) {
                debug_print(_("group list has been already cached.\n"));
        }
-       else
-         {
+       else {
            ok = nntp_list(SESSION(session)->sock);
            if (ok != NN_SUCCESS)
              return NULL;
            
            ok = nntp_list(SESSION(session)->sock);
            if (ok != NN_SUCCESS)
              return NULL;
            
-           if (recv_write_to_file(SESSION(session)->sock, filename)
-               < 0) {
+           if (recv_write_to_file(SESSION(session)->sock, filename) < 0) {
              log_warning(_("can't retrieve group list\n"));
              return NULL;
            }
              log_warning(_("can't retrieve group list\n"));
              return NULL;
            }
-         }
+       }
 
        f = fopen(filename, "r");
 
        f = fopen(filename, "r");
-       while (fgets(buf, NNTPBUFSIZE, f))
-         {
+       while (fgets(buf, NNTPBUFSIZE, f)) {
            char * s;
 
            len = 0;
            char * s;
 
            len = 0;
@@ -609,7 +607,7 @@ GSList * news_get_group_list(FolderItem *item)
            s = g_strdup(buf);
 
            group_list = g_slist_append(group_list, s);
            s = g_strdup(buf);
 
            group_list = g_slist_append(group_list, s);
-         }
+       }
        fclose(f);
        g_free(filename);
 
        fclose(f);
        g_free(filename);
 
index 59a30d0a93f400b40268730a69933522ccc2df61..20ea82ef6ddcc9ed7be7cb5de047f7918448f33f 100644 (file)
 
 static gint verbose = 1;
 
 
 static gint verbose = 1;
 
-static void nntp_gen_send(gint sock, const gchar *format, ...);
-static gint nntp_gen_recv(gint sock, gchar *buf, gint size);
+static void nntp_gen_send(SockInfo *sock, const gchar *format, ...);
+static gint nntp_gen_recv(SockInfo *sock, gchar *buf, gint size);
 
 
-gint nntp_open(const gchar *server, gushort port, gchar *buf)
+SockInfo *nntp_open(const gchar *server, gushort port, gchar *buf)
 {
 {
-       SockInfo *sockinfo;
-       gint sock;
+       SockInfo *sock;
 
 
-       if ((sockinfo = sock_connect(server, port)) == NULL) {
+       if ((sock = sock_connect(server, port)) == NULL) {
                log_warning(_("Can't connect to NNTP server: %s:%d\n"),
                            server, port);
                log_warning(_("Can't connect to NNTP server: %s:%d\n"),
                            server, port);
-               return -1;
+               return NULL;
        }
        }
-       sock = sockinfo->sock;
-       sock_sockinfo_free(sockinfo);
 
        if (nntp_ok(sock, buf) == NN_SUCCESS)
                return sock;
        else {
                sock_close(sock);
 
        if (nntp_ok(sock, buf) == NN_SUCCESS)
                return sock;
        else {
                sock_close(sock);
-               return -1;
+               return NULL;
        }
 }
 
        }
 }
 
-gint nntp_group(gint sock, const gchar *group,
+gint nntp_group(SockInfo *sock, const gchar *group,
                gint *num, gint *first, gint *last)
 {
        gint ok;
                gint *num, gint *first, gint *last)
 {
        gint ok;
@@ -77,7 +74,7 @@ gint nntp_group(gint sock, const gchar *group,
        return NN_SUCCESS;
 }
 
        return NN_SUCCESS;
 }
 
-gint nntp_get_article(gint sock, const gchar *cmd, gint num, gchar **msgid)
+gint nntp_get_article(SockInfo *sock, const gchar *cmd, gint num, gchar **msgid)
 {
        gint ok;
        gchar buf[NNTPBUFSIZE];
 {
        gint ok;
        gchar buf[NNTPBUFSIZE];
@@ -100,27 +97,27 @@ gint nntp_get_article(gint sock, const gchar *cmd, gint num, gchar **msgid)
        return NN_SUCCESS;
 }
 
        return NN_SUCCESS;
 }
 
-gint nntp_article(gint sock, gint num, gchar **msgid)
+gint nntp_article(SockInfo *sock, gint num, gchar **msgid)
 {
        return nntp_get_article(sock, "ARTICLE", num, msgid);
 }
 
 {
        return nntp_get_article(sock, "ARTICLE", num, msgid);
 }
 
-gint nntp_body(gint sock, gint num, gchar **msgid)
+gint nntp_body(SockInfo *sock, gint num, gchar **msgid)
 {
        return nntp_get_article(sock, "BODY", num, msgid);
 }
 
 {
        return nntp_get_article(sock, "BODY", num, msgid);
 }
 
-gint nntp_head(gint sock, gint num, gchar **msgid)
+gint nntp_head(SockInfo *sock, gint num, gchar **msgid)
 {
        return nntp_get_article(sock, "HEAD", num, msgid);
 }
 
 {
        return nntp_get_article(sock, "HEAD", num, msgid);
 }
 
-gint nntp_stat(gint sock, gint num, gchar **msgid)
+gint nntp_stat(SockInfo *sock, gint num, gchar **msgid)
 {
        return nntp_get_article(sock, "STAT", num, msgid);
 }
 
 {
        return nntp_get_article(sock, "STAT", num, msgid);
 }
 
-gint nntp_next(gint sock, gint *num, gchar **msgid)
+gint nntp_next(SockInfo *sock, gint *num, gchar **msgid)
 {
        gint ok;
        gint resp;
 {
        gint ok;
        gint resp;
@@ -146,7 +143,7 @@ gint nntp_next(gint sock, gint *num, gchar **msgid)
        return NN_SUCCESS;
 }
 
        return NN_SUCCESS;
 }
 
-gint nntp_xover(gint sock, gint first, gint last)
+gint nntp_xover(SockInfo *sock, gint first, gint last)
 {
        gint ok;
        gchar buf[NNTPBUFSIZE];
 {
        gint ok;
        gchar buf[NNTPBUFSIZE];
@@ -158,7 +155,7 @@ gint nntp_xover(gint sock, gint first, gint last)
        return NN_SUCCESS;
 }
 
        return NN_SUCCESS;
 }
 
-gint nntp_post(gint sock, FILE *fp)
+gint nntp_post(SockInfo *sock, FILE *fp)
 {
        gint ok;
        gchar buf[NNTPBUFSIZE];
 {
        gint ok;
        gchar buf[NNTPBUFSIZE];
@@ -189,17 +186,17 @@ gint nntp_post(gint sock, FILE *fp)
        return NN_SUCCESS;
 }
 
        return NN_SUCCESS;
 }
 
-gint nntp_newgroups(gint sock)
+gint nntp_newgroups(SockInfo *sock)
 {
        return NN_SUCCESS;
 }
 
 {
        return NN_SUCCESS;
 }
 
-gint nntp_newnews(gint sock)
+gint nntp_newnews(SockInfo *sock)
 {
        return NN_SUCCESS;
 }
 
 {
        return NN_SUCCESS;
 }
 
-gint nntp_mode(gint sock, gboolean stream)
+gint nntp_mode(SockInfo *sock, gboolean stream)
 {
        gint ok;
 
 {
        gint ok;
 
@@ -209,7 +206,7 @@ gint nntp_mode(gint sock, gboolean stream)
        return ok;
 }
 
        return ok;
 }
 
-gint nntp_authinfo_user(gint sock, const gchar *user)
+gint nntp_authinfo_user(SockInfo *sock, const gchar *user)
 {
        gint ok;
        gchar buf[NNTPBUFSIZE];
 {
        gint ok;
        gchar buf[NNTPBUFSIZE];
@@ -220,7 +217,7 @@ gint nntp_authinfo_user(gint sock, const gchar *user)
        return ok;
 }
 
        return ok;
 }
 
-gint nntp_authinfo_pass(gint sock, const gchar *pass)
+gint nntp_authinfo_pass(SockInfo *sock, const gchar *pass)
 {
        gint ok;
        gchar buf[NNTPBUFSIZE];
 {
        gint ok;
        gchar buf[NNTPBUFSIZE];
@@ -231,7 +228,7 @@ gint nntp_authinfo_pass(gint sock, const gchar *pass)
        return ok;
 }
 
        return ok;
 }
 
-gint nntp_ok(gint sock, gchar *argbuf)
+gint nntp_ok(SockInfo *sock, gchar *argbuf)
 {
        gint ok;
        gchar buf[NNTPBUFSIZE];
 {
        gint ok;
        gchar buf[NNTPBUFSIZE];
@@ -257,7 +254,7 @@ gint nntp_ok(gint sock, gchar *argbuf)
        return ok;
 }
 
        return ok;
 }
 
-static void nntp_gen_send(gint sock, const gchar *format, ...)
+static void nntp_gen_send(SockInfo *sock, const gchar *format, ...)
 {
        gchar buf[NNTPBUFSIZE];
        va_list args;
 {
        gchar buf[NNTPBUFSIZE];
        va_list args;
@@ -277,7 +274,7 @@ static void nntp_gen_send(gint sock, const gchar *format, ...)
        sock_write(sock, buf, strlen(buf));
 }
 
        sock_write(sock, buf, strlen(buf));
 }
 
-static gint nntp_gen_recv(gint sock, gchar *buf, gint size)
+static gint nntp_gen_recv(SockInfo *sock, gchar *buf, gint size)
 {
        if (sock_read(sock, buf, size) == -1)
                return NN_SOCKET;
 {
        if (sock_read(sock, buf, size) == -1)
                return NN_SOCKET;
@@ -295,7 +292,7 @@ static gint nntp_gen_recv(gint sock, gchar *buf, gint size)
   a function is needed to read the newsgroups list.
  */
 
   a function is needed to read the newsgroups list.
  */
 
-gint nntp_list(gint sock)
+gint nntp_list(SockInfo *sock)
 {
        GList * result = NULL;
 
 {
        GList * result = NULL;
 
index 54bbd090c53e9c6594f000dd6434d6c7182e1fa6..941da3d64f3595c7b57170f37e72599e93abd708 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef __NNTP_H__
 #define __NNTP_H__
 
 #ifndef __NNTP_H__
 #define __NNTP_H__
 
+#include "socket.h"
+
 #define NN_SUCCESS     0
 #define NN_SOCKET      2
 #define NN_AUTHFAIL    3
 #define NN_SUCCESS     0
 #define NN_SOCKET      2
 #define NN_AUTHFAIL    3
 #define NN_IOERR       6
 #define NN_ERROR       7
 #define NN_AUTHREQ     8
 #define NN_IOERR       6
 #define NN_ERROR       7
 #define NN_AUTHREQ     8
-#define NN_AUTHCONT    9
+#define NN_AUTHCONT 9
 
 #define NNTPBUFSIZE    8192
 
 
 #define NNTPBUFSIZE    8192
 
-gint nntp_open(const gchar *server, gushort port, gchar *buf);
-gint nntp_group(gint sock, const gchar *group,
+SockInfo *nntp_open(const gchar *server, gushort port, gchar *buf);
+gint nntp_group(SockInfo *sock, const gchar *group,
                gint *num, gint *first, gint *last);
                gint *num, gint *first, gint *last);
-gint nntp_get_article(gint sock, const gchar *cmd, gint num, gchar **msgid);
-gint nntp_article(gint sock, gint num, gchar **msgid);
-gint nntp_body(gint sock, gint num, gchar **msgid);
-gint nntp_head(gint sock, gint num, gchar **msgid);
-gint nntp_stat(gint sock, gint num, gchar **msgid);
-gint nntp_next(gint sock, gint *num, gchar **msgid);
-gint nntp_xover(gint sock, gint first, gint last);
-gint nntp_authinfo_user(gint sock, const gchar *user);
-gint nntp_authinfo_pass(gint sock, const gchar *pass);
-gint nntp_post(gint sock, FILE *fp);
-gint nntp_newgroups(gint sock);
-gint nntp_newnews(gint sock);
-gint nntp_mode(gint sock, gboolean stream);
-gint nntp_ok(gint sock, gchar *argbuf);
-gint nntp_list(gint sock);
+gint nntp_get_article(SockInfo *sock, const gchar *cmd, gint num, gchar **msgid);
+gint nntp_article(SockInfo *sock, gint num, gchar **msgid);
+gint nntp_body(SockInfo *sock, gint num, gchar **msgid);
+gint nntp_head(SockInfo *sock, gint num, gchar **msgid);
+gint nntp_stat(SockInfo *sock, gint num, gchar **msgid);
+gint nntp_next(SockInfo *sock, gint *num, gchar **msgid);
+gint nntp_xover(SockInfo *sock, gint first, gint last);
+gint nntp_post(SockInfo *sock, FILE *fp);
+gint nntp_newgroups(SockInfo *sock);
+gint nntp_newnews(SockInfo *sock);
+gint nntp_mode(SockInfo *sock, gboolean stream);
+gint nntp_ok(SockInfo *sock, gchar *argbuf);
+gint nntp_authinfo_user(SockInfo *sock, const gchar *user);
+gint nntp_authinfo_pass(SockInfo *sock, const gchar *pass);
+gint nntp_list(SockInfo *sock);
 
 #endif /* __NNTP_H__ */
 
 #endif /* __NNTP_H__ */
index 1d5116e6c53d4f5582b6d1337164e7109339d3db..e20d70d36621e084c3975b8b441dc99786facb04 100644 (file)
--- a/src/pop.c
+++ b/src/pop.c
 #include "intl.h"
 #include "pop.h"
 #include "socket.h"
 #include "intl.h"
 #include "pop.h"
 #include "socket.h"
-#include "md5ify.h"
+#include "md5.h"
 #include "prefs_account.h"
 #include "utils.h"
 #include "inc.h"
 #include "recv.h"
 
 #include "prefs_account.h"
 #include "utils.h"
 #include "inc.h"
 #include "recv.h"
 
-static gint pop3_ok(gint sock, gchar *argbuf);
-static void pop3_gen_send(gint sock, const gchar *format, ...);
-static gint pop3_gen_recv(gint sock, gchar *buf, gint size);
+static gint pop3_ok(SockInfo *sock, gchar *argbuf);
+static void pop3_gen_send(SockInfo *sock, const gchar *format, ...);
+static gint pop3_gen_recv(SockInfo *sock, gchar *buf, gint size);
 
 
-gint pop3_greeting_recv(gint sock, gpointer data)
+gint pop3_greeting_recv(SockInfo *sock, gpointer data)
 {
        Pop3State *state = (Pop3State *)data;
        gchar buf[POPBUFSIZE];
 {
        Pop3State *state = (Pop3State *)data;
        gchar buf[POPBUFSIZE];
@@ -56,7 +56,7 @@ gint pop3_greeting_recv(gint sock, gpointer data)
                return -1;
 }
 
                return -1;
 }
 
-gint pop3_getauth_user_send(gint sock, gpointer data)
+gint pop3_getauth_user_send(SockInfo *sock, gpointer data)
 {
        Pop3State *state = (Pop3State *)data;
 
 {
        Pop3State *state = (Pop3State *)data;
 
@@ -69,7 +69,7 @@ gint pop3_getauth_user_send(gint sock, gpointer data)
        return POP3_GETAUTH_USER_RECV;
 }
 
        return POP3_GETAUTH_USER_RECV;
 }
 
-gint pop3_getauth_user_recv(gint sock, gpointer data)
+gint pop3_getauth_user_recv(SockInfo *sock, gpointer data)
 {
        if (pop3_ok(sock, NULL) == PS_SUCCESS)
                return POP3_GETAUTH_PASS_SEND;
 {
        if (pop3_ok(sock, NULL) == PS_SUCCESS)
                return POP3_GETAUTH_PASS_SEND;
@@ -77,7 +77,7 @@ gint pop3_getauth_user_recv(gint sock, gpointer data)
                return -1;
 }
 
                return -1;
 }
 
-gint pop3_getauth_pass_send(gint sock, gpointer data)
+gint pop3_getauth_pass_send(SockInfo *sock, gpointer data)
 {
        Pop3State *state = (Pop3State *)data;
 
 {
        Pop3State *state = (Pop3State *)data;
 
@@ -88,7 +88,7 @@ gint pop3_getauth_pass_send(gint sock, gpointer data)
        return POP3_GETAUTH_PASS_RECV;
 }
 
        return POP3_GETAUTH_PASS_RECV;
 }
 
-gint pop3_getauth_pass_recv(gint sock, gpointer data)
+gint pop3_getauth_pass_recv(SockInfo *sock, gpointer data)
 {
        Pop3State *state = (Pop3State *)data;
 
 {
        Pop3State *state = (Pop3State *)data;
 
@@ -101,11 +101,12 @@ gint pop3_getauth_pass_recv(gint sock, gpointer data)
        }
 }
 
        }
 }
 
-gint pop3_getauth_apop_send(gint sock, gpointer data)
+gint pop3_getauth_apop_send(SockInfo *sock, gpointer data)
 {
        Pop3State *state = (Pop3State *)data;
        gchar *start, *end;
 {
        Pop3State *state = (Pop3State *)data;
        gchar *start, *end;
-       gchar *apop_str, *md5sum;
+       gchar *apop_str;
+       gchar md5sum[33];
 
        g_return_val_if_fail(state->user != NULL, -1);
        g_return_val_if_fail(state->pass != NULL, -1);
 
        g_return_val_if_fail(state->user != NULL, -1);
        g_return_val_if_fail(state->pass != NULL, -1);
@@ -126,7 +127,7 @@ gint pop3_getauth_apop_send(gint sock, gpointer data)
        *(end + 1) = '\0';
 
        apop_str = g_strconcat(start, state->pass, NULL);
        *(end + 1) = '\0';
 
        apop_str = g_strconcat(start, state->pass, NULL);
-       md5sum = MD5Digest(apop_str);
+       md5_hex_digest(md5sum, apop_str);
        g_free(apop_str);
 
        pop3_gen_send(sock, "APOP %s %s", state->user, md5sum);
        g_free(apop_str);
 
        pop3_gen_send(sock, "APOP %s %s", state->user, md5sum);
@@ -134,7 +135,7 @@ gint pop3_getauth_apop_send(gint sock, gpointer data)
        return POP3_GETAUTH_APOP_RECV;
 }
 
        return POP3_GETAUTH_APOP_RECV;
 }
 
-gint pop3_getauth_apop_recv(gint sock, gpointer data)
+gint pop3_getauth_apop_recv(SockInfo *sock, gpointer data)
 {
        Pop3State *state = (Pop3State *)data;
 
 {
        Pop3State *state = (Pop3State *)data;
 
@@ -147,7 +148,7 @@ gint pop3_getauth_apop_recv(gint sock, gpointer data)
        }
 }
 
        }
 }
 
-gint pop3_getrange_stat_send(gint sock, gpointer data)
+gint pop3_getrange_stat_send(SockInfo *sock, gpointer data)
 {
        Pop3State *state = (Pop3State *)data;
 
 {
        Pop3State *state = (Pop3State *)data;
 
@@ -158,7 +159,7 @@ gint pop3_getrange_stat_send(gint sock, gpointer data)
        return POP3_GETRANGE_STAT_RECV;
 }
 
        return POP3_GETRANGE_STAT_RECV;
 }
 
-gint pop3_getrange_stat_recv(gint sock, gpointer data)
+gint pop3_getrange_stat_recv(SockInfo *sock, gpointer data)
 {
        Pop3State *state = (Pop3State *)data;
        gchar buf[POPBUFSIZE + 1];
 {
        Pop3State *state = (Pop3State *)data;
        gchar buf[POPBUFSIZE + 1];
@@ -187,14 +188,14 @@ gint pop3_getrange_stat_recv(gint sock, gpointer data)
                return -1;
 }
 
                return -1;
 }
 
-gint pop3_getrange_last_send(gint sock, gpointer data)
+gint pop3_getrange_last_send(SockInfo *sock, gpointer data)
 {
        pop3_gen_send(sock, "LAST");
 
        return POP3_GETRANGE_LAST_RECV;
 }
 
 {
        pop3_gen_send(sock, "LAST");
 
        return POP3_GETRANGE_LAST_RECV;
 }
 
-gint pop3_getrange_last_recv(gint sock, gpointer data)
+gint pop3_getrange_last_recv(SockInfo *sock, gpointer data)
 {
        Pop3State *state = (Pop3State *)data;
        gchar buf[POPBUFSIZE + 1];
 {
        Pop3State *state = (Pop3State *)data;
        gchar buf[POPBUFSIZE + 1];
@@ -218,14 +219,14 @@ gint pop3_getrange_last_recv(gint sock, gpointer data)
                return POP3_RETR_SEND;
 }
 
                return POP3_RETR_SEND;
 }
 
-gint pop3_getrange_uidl_send(gint sock, gpointer data)
+gint pop3_getrange_uidl_send(SockInfo *sock, gpointer data)
 {
        pop3_gen_send(sock, "UIDL");
 
        return POP3_GETRANGE_UIDL_RECV;
 }
 
 {
        pop3_gen_send(sock, "UIDL");
 
        return POP3_GETRANGE_UIDL_RECV;
 }
 
-gint pop3_getrange_uidl_recv(gint sock, gpointer data)
+gint pop3_getrange_uidl_recv(SockInfo *sock, gpointer data)
 {
        Pop3State *state = (Pop3State *)data;
        gboolean nb;
 {
        Pop3State *state = (Pop3State *)data;
        gboolean nb;
@@ -270,7 +271,7 @@ gint pop3_getrange_uidl_recv(gint sock, gpointer data)
                return POP3_LOGOUT_SEND;
 }
 
                return POP3_LOGOUT_SEND;
 }
 
-gint pop3_retr_send(gint sock, gpointer data)
+gint pop3_retr_send(SockInfo *sock, gpointer data)
 {
        Pop3State *state = (Pop3State *)data;
 
 {
        Pop3State *state = (Pop3State *)data;
 
@@ -281,7 +282,7 @@ gint pop3_retr_send(gint sock, gpointer data)
        return POP3_RETR_RECV;
 }
 
        return POP3_RETR_RECV;
 }
 
-gint pop3_retr_recv(gint sock, gpointer data)
+gint pop3_retr_recv(SockInfo *sock, gpointer data)
 {
        Pop3State *state = (Pop3State *)data;
        const gchar *file;
 {
        Pop3State *state = (Pop3State *)data;
        const gchar *file;
@@ -318,7 +319,7 @@ gint pop3_retr_recv(gint sock, gpointer data)
                return -1;
 }
 
                return -1;
 }
 
-gint pop3_delete_send(gint sock, gpointer data)
+gint pop3_delete_send(SockInfo *sock, gpointer data)
 {
        Pop3State *state = (Pop3State *)data;
 
 {
        Pop3State *state = (Pop3State *)data;
 
@@ -329,7 +330,7 @@ gint pop3_delete_send(gint sock, gpointer data)
        return POP3_DELETE_RECV;
 }
 
        return POP3_DELETE_RECV;
 }
 
-gint pop3_delete_recv(gint sock, gpointer data)
+gint pop3_delete_recv(SockInfo *sock, gpointer data)
 {
        Pop3State *state = (Pop3State *)data;
        gint ok;
 {
        Pop3State *state = (Pop3State *)data;
        gint ok;
@@ -346,7 +347,7 @@ gint pop3_delete_recv(gint sock, gpointer data)
                return -1;
 }
 
                return -1;
 }
 
-gint pop3_logout_send(gint sock, gpointer data)
+gint pop3_logout_send(SockInfo *sock, gpointer data)
 {
        Pop3State *state = (Pop3State *)data;
 
 {
        Pop3State *state = (Pop3State *)data;
 
@@ -357,7 +358,7 @@ gint pop3_logout_send(gint sock, gpointer data)
        return POP3_LOGOUT_RECV;
 }
 
        return POP3_LOGOUT_RECV;
 }
 
-gint pop3_logout_recv(gint sock, gpointer data)
+gint pop3_logout_recv(SockInfo *sock, gpointer data)
 {
        if (pop3_ok(sock, NULL) == PS_SUCCESS)
                return -1;
 {
        if (pop3_ok(sock, NULL) == PS_SUCCESS)
                return -1;
@@ -365,7 +366,7 @@ gint pop3_logout_recv(gint sock, gpointer data)
                return -1;
 }
 
                return -1;
 }
 
-static gint pop3_ok(gint sock, gchar *argbuf)
+static gint pop3_ok(SockInfo *sock, gchar *argbuf)
 {
        gint ok;
        gchar buf[POPBUFSIZE + 1];
 {
        gint ok;
        gchar buf[POPBUFSIZE + 1];
@@ -407,7 +408,7 @@ static gint pop3_ok(gint sock, gchar *argbuf)
        return ok;
 }
 
        return ok;
 }
 
-static void pop3_gen_send(gint sock, const gchar *format, ...)
+static void pop3_gen_send(SockInfo *sock, const gchar *format, ...)
 {
        gchar buf[POPBUFSIZE + 1];
        va_list args;
 {
        gchar buf[POPBUFSIZE + 1];
        va_list args;
@@ -425,7 +426,7 @@ static void pop3_gen_send(gint sock, const gchar *format, ...)
        sock_write(sock, buf, strlen(buf));
 }
 
        sock_write(sock, buf, strlen(buf));
 }
 
-static gint pop3_gen_recv(gint sock, gchar *buf, gint size)
+static gint pop3_gen_recv(SockInfo *sock, gchar *buf, gint size)
 {
        gboolean nb;
 
 {
        gboolean nb;
 
index 840b9a91b0d2c6484511cd959202c4b43ce0c64f..d28f7d47fef67bc96f544788268de24824da091c 100644 (file)
--- a/src/pop.h
+++ b/src/pop.h
@@ -22,6 +22,8 @@
 
 #include <glib.h>
 
 
 #include <glib.h>
 
+#include "socket.h"
+
 typedef enum {
        POP3_GREETING_RECV,
        POP3_GETAUTH_USER_SEND,
 typedef enum {
        POP3_GREETING_RECV,
        POP3_GETAUTH_USER_SEND,
@@ -71,24 +73,24 @@ typedef enum {
 #define                PS_RETAINED     26      /* message retained (internal use) */
 #define                PS_TRUNCATED    27      /* headers incomplete (internal use) */
 
 #define                PS_RETAINED     26      /* message retained (internal use) */
 #define                PS_TRUNCATED    27      /* headers incomplete (internal use) */
 
-gint pop3_greeting_recv                (gint sock, gpointer data);
-gint pop3_getauth_user_send    (gint sock, gpointer data);
-gint pop3_getauth_user_recv    (gint sock, gpointer data);
-gint pop3_getauth_pass_send    (gint sock, gpointer data);
-gint pop3_getauth_pass_recv    (gint sock, gpointer data);
-gint pop3_getauth_apop_send    (gint sock, gpointer data);
-gint pop3_getauth_apop_recv    (gint sock, gpointer data);
-gint pop3_getrange_stat_send   (gint sock, gpointer data);
-gint pop3_getrange_stat_recv   (gint sock, gpointer data);
-gint pop3_getrange_last_send   (gint sock, gpointer data);
-gint pop3_getrange_last_recv   (gint sock, gpointer data);
-gint pop3_getrange_uidl_send   (gint sock, gpointer data);
-gint pop3_getrange_uidl_recv   (gint sock, gpointer data);
-gint pop3_retr_send            (gint sock, gpointer data);
-gint pop3_retr_recv            (gint sock, gpointer data);
-gint pop3_delete_send          (gint sock, gpointer data);
-gint pop3_delete_recv          (gint sock, gpointer data);
-gint pop3_logout_send          (gint sock, gpointer data);
-gint pop3_logout_recv          (gint sock, gpointer data);
+gint pop3_greeting_recv                (SockInfo *sock, gpointer data);
+gint pop3_getauth_user_send    (SockInfo *sock, gpointer data);
+gint pop3_getauth_user_recv    (SockInfo *sock, gpointer data);
+gint pop3_getauth_pass_send    (SockInfo *sock, gpointer data);
+gint pop3_getauth_pass_recv    (SockInfo *sock, gpointer data);
+gint pop3_getauth_apop_send    (SockInfo *sock, gpointer data);
+gint pop3_getauth_apop_recv    (SockInfo *sock, gpointer data);
+gint pop3_getrange_stat_send   (SockInfo *sock, gpointer data);
+gint pop3_getrange_stat_recv   (SockInfo *sock, gpointer data);
+gint pop3_getrange_last_send   (SockInfo *sock, gpointer data);
+gint pop3_getrange_last_recv   (SockInfo *sock, gpointer data);
+gint pop3_getrange_uidl_send   (SockInfo *sock, gpointer data);
+gint pop3_getrange_uidl_recv   (SockInfo *sock, gpointer data);
+gint pop3_retr_send            (SockInfo *sock, gpointer data);
+gint pop3_retr_recv            (SockInfo *sock, gpointer data);
+gint pop3_delete_send          (SockInfo *sock, gpointer data);
+gint pop3_delete_recv          (SockInfo *sock, gpointer data);
+gint pop3_logout_send          (SockInfo *sock, gpointer data);
+gint pop3_logout_recv          (SockInfo *sock, gpointer data);
 
 #endif /* __POP_H__ */
 
 #endif /* __POP_H__ */
index 3ebd5346fb55023614e27ef9b0679fcfba5d8b23..1bc0153705f63da7935884c8b03e031d370446e6 100644 (file)
@@ -368,7 +368,7 @@ void prefs_set_default(PrefParam *param)
                                                g_strdup(g_getenv(param[i].defval + 4));
                                else if (param[i].defval[0] == '~')
                                        *((gchar **)param[i].data) =
                                                g_strdup(g_getenv(param[i].defval + 4));
                                else if (param[i].defval[0] == '~')
                                        *((gchar **)param[i].data) =
-                                               g_strconcat(g_get_home_dir(),
+                                               g_strconcat(get_home_dir(),
                                                            param[i].defval + 1,
                                                            NULL);
                                else if (param[i].defval[0] != '\0')
                                                            param[i].defval + 1,
                                                            NULL);
                                else if (param[i].defval[0] != '\0')
@@ -530,7 +530,7 @@ void prefs_set_dialog_to_default(PrefParam *param)
                                        break;
                                } else if (tmpparam.defval[0] == '~') {
                                        str_data =
                                        break;
                                } else if (tmpparam.defval[0] == '~') {
                                        str_data =
-                                               g_strconcat(g_get_home_dir(),
+                                               g_strconcat(get_home_dir(),
                                                            param[i].defval + 1,
                                                            NULL);
                                        tmpparam.data = &str_data;
                                                            param[i].defval + 1,
                                                            NULL);
                                        tmpparam.data = &str_data;
index e4241028e67367e32486e279373cdcbdc5e9b386..07e32e892b6ea584c763e4a2ecb478d28bcf85b4 100644 (file)
@@ -823,7 +823,7 @@ static void prefs_account_send_create(void)
        gtk_widget_show (hbox);
        gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
 
        gtk_widget_show (hbox);
        gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
 
-       //      gtk_widget_set_sensitive(hbox, FALSE);
+       /* gtk_widget_set_sensitive(hbox, FALSE); */
 
        PACK_CHECK_BUTTON (hbox, customhdr_chkbtn,
                           _("Add user-defined header"));
 
        PACK_CHECK_BUTTON (hbox, customhdr_chkbtn,
                           _("Add user-defined header"));
index 57f40ef8307fd5b2d0a184af55505f7644b588d8..a58a883b932e12206eeab43253254497f5470293 100644 (file)
 #ifndef __PREFS_ACCOUNT_H__
 #define __PREFS_ACCOUNT_H__
 
 #ifndef __PREFS_ACCOUNT_H__
 #define __PREFS_ACCOUNT_H__
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include <glib.h>
 
 typedef struct _PrefsAccount   PrefsAccount;
 #include <glib.h>
 
 typedef struct _PrefsAccount   PrefsAccount;
index 9ef7b910ea6aa6e68bd938d0ad682c019d571d65..93f1ea59fe67f4779e03c8effedd9d2b79db9461 100644 (file)
@@ -102,6 +102,7 @@ static struct Display {
        GtkWidget *chkbtn_folder_unread;
 
        GtkWidget *chkbtn_transhdr;
        GtkWidget *chkbtn_folder_unread;
 
        GtkWidget *chkbtn_transhdr;
+
        GtkWidget *chkbtn_swapfrom;
        GtkWidget *chkbtn_hscrollbar;
        GtkWidget *entry_datefmt;
        GtkWidget *chkbtn_swapfrom;
        GtkWidget *chkbtn_hscrollbar;
        GtkWidget *entry_datefmt;
@@ -274,10 +275,11 @@ static PrefParam param[] = {
         &display.chkbtn_folder_unread,
         prefs_set_data_from_toggle, prefs_set_toggle},
 
         &display.chkbtn_folder_unread,
         prefs_set_data_from_toggle, prefs_set_toggle},
 
-       /* Display: Summary View */
        {"translate_header", "TRUE", &prefs_common.trans_hdr, P_BOOL,
         &display.chkbtn_transhdr,
         prefs_set_data_from_toggle, prefs_set_toggle},
        {"translate_header", "TRUE", &prefs_common.trans_hdr, P_BOOL,
         &display.chkbtn_transhdr,
         prefs_set_data_from_toggle, prefs_set_toggle},
+
+       /* Display: Summary View */
        {"enable_swap_from", "TRUE", &prefs_common.swap_from, P_BOOL,
         &display.chkbtn_swapfrom,
         prefs_set_data_from_toggle, prefs_set_toggle},
        {"enable_swap_from", "TRUE", &prefs_common.swap_from, P_BOOL,
         &display.chkbtn_swapfrom,
         prefs_set_data_from_toggle, prefs_set_toggle},
@@ -433,9 +435,11 @@ static PrefParam param[] = {
         &prefs_common.auto_check_signatures, P_BOOL,
         &privacy.checkbtn_auto_check_signatures,
         prefs_set_data_from_toggle, prefs_set_toggle},
         &prefs_common.auto_check_signatures, P_BOOL,
         &privacy.checkbtn_auto_check_signatures,
         prefs_set_data_from_toggle, prefs_set_toggle},
+#ifndef __MINGW32__
        {"passphrase_grab", "FALSE", &prefs_common.passphrase_grab, P_BOOL,
         &privacy.checkbtn_passphrase_grab,
         prefs_set_data_from_toggle, prefs_set_toggle},
        {"passphrase_grab", "FALSE", &prefs_common.passphrase_grab, P_BOOL,
         &privacy.checkbtn_passphrase_grab,
         prefs_set_data_from_toggle, prefs_set_toggle},
+#endif /* __MINGW32__ */
        {"default_signkey", CS_AUTO, &prefs_common.default_signkey, P_STRING,
         &privacy.optmenu_default_signkey,
         prefs_common_default_signkey_set_data_from_optmenu,
        {"default_signkey", CS_AUTO, &prefs_common.default_signkey, P_STRING,
         &privacy.optmenu_default_signkey,
         prefs_common_default_signkey_set_data_from_optmenu,
@@ -1150,6 +1154,10 @@ static void prefs_display_create(void)
        PACK_CHECK_BUTTON
                (vbox2, chkbtn_hscrollbar, _("Enable horizontal scroll bar"));
 
        PACK_CHECK_BUTTON
                (vbox2, chkbtn_hscrollbar, _("Enable horizontal scroll bar"));
 
+       hbox1 = gtk_hbox_new (FALSE, 8);
+       gtk_widget_show (hbox1);
+       gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0);
+
        label_datefmt = gtk_label_new (_("Date format"));
        gtk_widget_show (label_datefmt);
        gtk_box_pack_start (GTK_BOX (hbox1), label_datefmt, FALSE, FALSE, 0);
        label_datefmt = gtk_label_new (_("Date format"));
        gtk_widget_show (label_datefmt);
        gtk_box_pack_start (GTK_BOX (hbox1), label_datefmt, FALSE, FALSE, 0);
@@ -1201,8 +1209,8 @@ static void prefs_display_create(void)
        display.button_textfont = button_textfont;
 
        display.chkbtn_folder_unread = chkbtn_folder_unread;
        display.button_textfont = button_textfont;
 
        display.chkbtn_folder_unread = chkbtn_folder_unread;
-
        display.chkbtn_transhdr   = chkbtn_transhdr;
        display.chkbtn_transhdr   = chkbtn_transhdr;
+
        display.chkbtn_swapfrom   = chkbtn_swapfrom;
        display.chkbtn_hscrollbar = chkbtn_hscrollbar;
        display.entry_datefmt     = entry_datefmt;
        display.chkbtn_swapfrom   = chkbtn_swapfrom;
        display.chkbtn_hscrollbar = chkbtn_hscrollbar;
        display.entry_datefmt     = entry_datefmt;
@@ -1383,8 +1391,10 @@ static void prefs_privacy_create(void)
        PACK_CHECK_BUTTON (vbox2, checkbtn_auto_check_signatures,
                           _("Automatically check signatures"));
 
        PACK_CHECK_BUTTON (vbox2, checkbtn_auto_check_signatures,
                           _("Automatically check signatures"));
 
+#ifndef __MINGW32__
        PACK_CHECK_BUTTON (vbox2, checkbtn_passphrase_grab,
                           _("Grab input while entering a passphrase"));
        PACK_CHECK_BUTTON (vbox2, checkbtn_passphrase_grab,
                           _("Grab input while entering a passphrase"));
+#endif
 
        hbox1 = gtk_hbox_new (FALSE, 8);
        gtk_widget_show (hbox1);
 
        hbox1 = gtk_hbox_new (FALSE, 8);
        gtk_widget_show (hbox1);
@@ -1546,7 +1556,7 @@ static void prefs_interface_create(void)
        SET_TOGGLE_SENSITIVITY (checkbtn_cleanonexit, checkbtn_askonclean);
 
        PACK_CHECK_BUTTON (vbox_exit, checkbtn_warnqueued,
        SET_TOGGLE_SENSITIVITY (checkbtn_cleanonexit, checkbtn_askonclean);
 
        PACK_CHECK_BUTTON (vbox_exit, checkbtn_warnqueued,
-                          _("Warn if there are queued messages on exit"));
+                          _("Warn if there are queued messages"));
 
        interface.checkbtn_emacs          = checkbtn_emacs;
        interface.checkbtn_openunread     = checkbtn_openunread;
 
        interface.checkbtn_emacs          = checkbtn_emacs;
        interface.checkbtn_openunread     = checkbtn_openunread;
@@ -1666,6 +1676,7 @@ void prefs_quote_colors_dialog(void)
        gtk_widget_hide(quote_color_win);
 
        textview_update_message_colors();
        gtk_widget_hide(quote_color_win);
 
        textview_update_message_colors();
+       main_window_reflect_prefs_all();
 }
 
 static void prefs_quote_colors_dialog_create(void)
 }
 
 static void prefs_quote_colors_dialog_create(void)
index baabd1b3f3cb3927316b6255edb7e9d273b96a6a..c10bc0d06199c039a380b868e5817851ae117a9d 100644 (file)
 #ifndef __PREFS_COMMON_H__
 #define __PREFS_COMMON_H__
 
 #ifndef __PREFS_COMMON_H__
 #define __PREFS_COMMON_H__
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include <glib.h>
 
 #include "mainwindow.h"
 #include <glib.h>
 
 #include "mainwindow.h"
index 7a931019a5022a55f16e4f716a8a8146424a9add..39cb58e4f99b8e6b72819ec7b5e54e1e479fdc08 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999,2000 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2001 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
index eeab75be8ccd08d08b92d732baee9ffd016bd2da..f0bd3084930b7c01477bfdfe0e32cc2cb5a0d9d5 100644 (file)
@@ -44,6 +44,11 @@ ProgressDialog *progress_dialog_create(void)
        GtkWidget *cancel_btn;
        GtkWidget *cancel_area;
        GtkWidget *progressbar;
        GtkWidget *cancel_btn;
        GtkWidget *cancel_area;
        GtkWidget *progressbar;
+       GtkWidget *clist;
+       gchar *text[] = {NULL, NULL, NULL};
+
+       text[1] = _("Account");
+       text[2] = _("Status");
 
        debug_print(_("Creating progress dialog...\n"));
        progress = g_new0(ProgressDialog, 1);
 
        debug_print(_("Creating progress dialog...\n"));
        progress = g_new0(ProgressDialog, 1);
@@ -74,13 +79,23 @@ ProgressDialog *progress_dialog_create(void)
        gtk_widget_show_all(cancel_area);
 
        progressbar = gtk_progress_bar_new();
        gtk_widget_show_all(cancel_area);
 
        progressbar = gtk_progress_bar_new();
-       gtk_box_pack_end(GTK_BOX(vbox), progressbar, FALSE, FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(vbox), progressbar, FALSE, FALSE, 0);
        gtk_widget_show(progressbar);
 
        gtk_widget_show(progressbar);
 
+       clist = gtk_clist_new_with_titles(3, text);
+       gtk_widget_show(clist);
+       gtk_box_pack_start(GTK_BOX(vbox), clist, TRUE, TRUE, 0);
+       gtk_widget_set_usize(clist, -1, 120);
+       gtk_clist_set_column_justification(GTK_CLIST(clist), 0,
+                                          GTK_JUSTIFY_CENTER);
+       gtk_clist_set_column_width(GTK_CLIST(clist), 0, 16);
+       gtk_clist_set_column_width(GTK_CLIST(clist), 1, 100);
+
        progress->window      = window;
        progress->label       = label;
        progress->cancel_btn  = cancel_btn;
        progress->progressbar = progressbar;
        progress->window      = window;
        progress->label       = label;
        progress->cancel_btn  = cancel_btn;
        progress->progressbar = progressbar;
+       progress->clist       = clist;
 
        return progress;
 }
 
        return progress;
 }
index 784c9bfa2d9a6a173e7d089b9f892ec611651350..4b88050351c799134bfde8f5fec4448b0150e465 100644 (file)
@@ -20,6 +20,7 @@
 #ifndef __PROGRESS_H__
 #define __PROGRESS_H__
 
 #ifndef __PROGRESS_H__
 #define __PROGRESS_H__
 
+#include <glib.h>
 #include <gtk/gtkwidget.h>
 
 typedef struct _ProgressDialog ProgressDialog;
 #include <gtk/gtkwidget.h>
 
 typedef struct _ProgressDialog ProgressDialog;
@@ -30,6 +31,7 @@ struct _ProgressDialog
        GtkWidget *label;
        GtkWidget *cancel_btn;
        GtkWidget *progressbar;
        GtkWidget *label;
        GtkWidget *cancel_btn;
        GtkWidget *progressbar;
+       GtkWidget *clist;
 };
 
 ProgressDialog *progress_dialog_create (void);
 };
 
 ProgressDialog *progress_dialog_create (void);
index e444a6d077874338067f2583d7ae21521e986a64..5aec6ad996ee22debef049597c12bd81d68ca239 100644 (file)
@@ -33,7 +33,7 @@
 
 #define BUFFSIZE       8192
 
 
 #define BUFFSIZE       8192
 
-gint recv_write_to_file(gint sock, const gchar *filename)
+gint recv_write_to_file(SockInfo *sock, const gchar *filename)
 {
        FILE *fp;
 
 {
        FILE *fp;
 
@@ -63,7 +63,7 @@ gint recv_write_to_file(gint sock, const gchar *filename)
        return 0;
 }
 
        return 0;
 }
 
-gint recv_bytes_write_to_file(gint sock, glong size, const gchar *filename)
+gint recv_bytes_write_to_file(SockInfo *sock, glong size, const gchar *filename)
 {
        FILE *fp;
 
 {
        FILE *fp;
 
@@ -93,7 +93,7 @@ gint recv_bytes_write_to_file(gint sock, glong size, const gchar *filename)
        return 0;
 }
 
        return 0;
 }
 
-gint recv_write(gint sock, FILE *fp)
+gint recv_write(SockInfo *sock, FILE *fp)
 {
        gchar buf[BUFFSIZE];
        gint len;
 {
        gchar buf[BUFFSIZE];
        gint len;
@@ -137,7 +137,7 @@ gint recv_write(gint sock, FILE *fp)
        return 0;
 }
 
        return 0;
 }
 
-gint recv_bytes_write(gint sock, glong size, FILE *fp)
+gint recv_bytes_write(SockInfo *sock, glong size, FILE *fp)
 {
        gchar *buf;
        gboolean nb;
 {
        gchar *buf;
        gboolean nb;
@@ -152,7 +152,8 @@ gint recv_bytes_write(gint sock, glong size, FILE *fp)
        do {
                size_t read_count;
 
        do {
                size_t read_count;
 
-               read_count = read(sock, buf + count, size - count);
+               /* FIXME: put this into socket.c :WK: */
+               read_count = fd_read(sock->sock, buf + count, size - count);
                if (read_count < 0) {
                        if (nb) sock_set_nonblocking_mode(sock, TRUE);
                        return -1;
                if (read_count < 0) {
                        if (nb) sock_set_nonblocking_mode(sock, TRUE);
                        return -1;
index e6980a66372f3d9d04e10eee493b1400bad8acc2..897e52b519b52ae5f31cba054c802f991f55fabb 100644 (file)
 
 #include <glib.h>
 
 
 #include <glib.h>
 
-gint recv_write_to_file(gint sock, const gchar *filename);
-gint recv_bytes_write_to_file(gint sock, glong size, const gchar *filename);
-gint recv_write(gint sock, FILE *fp);
-gint recv_bytes_write(gint sock, glong size, FILE *fp);
+#include "socket.h"
+
+gint recv_write_to_file(SockInfo *sock, const gchar *filename);
+gint recv_bytes_write_to_file(SockInfo *sock, glong size, const gchar *filename);
+gint recv_write(SockInfo *sock, FILE *fp);
+gint recv_bytes_write(SockInfo *sock, glong size, FILE *fp);
 
 #endif /* __RECV_H__ */
 
 #endif /* __RECV_H__ */
index 3791441cc57b563fb54e91cc9f00a77b70666401..36eee909366afa829e037d26a9c6f5b6373caffb 100644 (file)
@@ -43,6 +43,7 @@
 #include "prefs_common.h"
 #include "passphrase.h"
 #include "select-keys.h"
 #include "prefs_common.h"
 #include "passphrase.h"
 #include "select-keys.h"
+#include "sigstatus.h"
 #include "rfc2015.h"
 
 #define DIM(v)     (sizeof(v)/sizeof((v)[0]))
 #include "rfc2015.h"
 
 #define DIM(v)     (sizeof(v)/sizeof((v)[0]))
@@ -278,8 +279,11 @@ static void check_signature (MimeInfo *mimeinfo, MimeInfo *partinfo, FILE *fp)
     GpgmeError err;
     GpgmeData sig = NULL, text = NULL;
     GpgmeSigStat status = GPGME_SIG_STAT_NONE;
     GpgmeError err;
     GpgmeData sig = NULL, text = NULL;
     GpgmeSigStat status = GPGME_SIG_STAT_NONE;
+    GpgmegtkSigStatus statuswindow;
     const char *result = NULL;
 
     const char *result = NULL;
 
+    statuswindow = gpgmegtk_sig_status_create ();
+
     err = gpgme_new (&ctx);
     if (err) {
        g_warning ("gpgme_new failed: %s", gpgme_strerror (err));
     err = gpgme_new (&ctx);
     if (err) {
        g_warning ("gpgme_new failed: %s", gpgme_strerror (err));
@@ -305,20 +309,24 @@ static void check_signature (MimeInfo *mimeinfo, MimeInfo *partinfo, FILE *fp)
     if (err) 
         g_message ("gpgme_op_verify failed: %s", gpgme_strerror (err));
 
     if (err) 
         g_message ("gpgme_op_verify failed: %s", gpgme_strerror (err));
 
+    /* FIXME: check what the heck this sig_status_full stuff is.
+     * it should better go into sigstatus.c */
     g_free (partinfo->sigstatus_full);
     partinfo->sigstatus_full = sig_status_full (ctx);
 
 leave:
     g_free (partinfo->sigstatus_full);
     partinfo->sigstatus_full = sig_status_full (ctx);
 
 leave:
-    result = sig_status_to_string(status);
+    result = gpgmegtk_sig_status_to_string(status);
     debug_print("verification status: %s\n", result);
     debug_print("verification status: %s\n", result);
+    gpgmegtk_sig_status_update(statuswindow,ctx);
 
 
-    g_assert (!err);
+    g_assert (!err); /* FIXME: Hey: this may indeed happen */
     g_free (partinfo->sigstatus);
     partinfo->sigstatus = g_strdup (result);
 
     gpgme_data_release (sig);
     gpgme_data_release (text);
     gpgme_release (ctx);
     g_free (partinfo->sigstatus);
     partinfo->sigstatus = g_strdup (result);
 
     gpgme_data_release (sig);
     gpgme_data_release (text);
     gpgme_release (ctx);
+    gpgmegtk_sig_status_destroy(statuswindow);
 }
 
 static const char *
 }
 
 static const char *
@@ -867,7 +875,7 @@ failure:
     return -1; /* error */
 }
 
     return -1; /* error */
 }
 
-static int
+int
 set_signers (GpgmeCtx ctx, PrefsAccount *ac)
 {
     GSList *key_list = NULL;
 set_signers (GpgmeCtx ctx, PrefsAccount *ac)
 {
     GSList *key_list = NULL;
index b397ef87599a8771497e6bf60f5addb774aa1735..6b8820d991a1175bc83890a78326c2b5e54b7e6f 100644 (file)
@@ -74,8 +74,8 @@ struct select_keys_s {
 };
 
 
 };
 
 
-static void set_row (GtkCList *clist, GpgmeKey key );
-static void fill_clist (struct select_keys_s *sk, const char *pattern );
+static void set_row (GtkCList *clist, GpgmeKey key);
+static void fill_clist (struct select_keys_s *sk, const char *pattern);
 static void create_dialog (struct select_keys_s *sk);
 static void open_dialog (struct select_keys_s *sk);
 static void close_dialog (struct select_keys_s *sk);
 static void create_dialog (struct select_keys_s *sk);
 static void open_dialog (struct select_keys_s *sk);
 static void close_dialog (struct select_keys_s *sk);
@@ -84,7 +84,7 @@ static void key_pressed_cb (GtkWidget *widget,
 static void select_btn_cb (GtkWidget *widget, gpointer data);
 static void cancel_btn_cb (GtkWidget *widget, gpointer data);
 static void other_btn_cb (GtkWidget *widget, gpointer data);
 static void select_btn_cb (GtkWidget *widget, gpointer data);
 static void cancel_btn_cb (GtkWidget *widget, gpointer data);
 static void other_btn_cb (GtkWidget *widget, gpointer data);
-static void sort_keys ( struct select_keys_s *sk, enum col_titles column);
+static void sort_keys (struct select_keys_s *sk, enum col_titles column);
 static void sort_keys_name (GtkWidget *widget, gpointer data);
 static void sort_keys_email (GtkWidget *widget, gpointer data);
 
 static void sort_keys_name (GtkWidget *widget, gpointer data);
 static void sort_keys_email (GtkWidget *widget, gpointer data);
 
@@ -101,8 +101,8 @@ update_progress (struct select_keys_s *sk, int running, const char *pattern)
     else 
         buf = g_strdup_printf (_("Collecting info for `%s' ... %c"), 
                                pattern,
     else 
         buf = g_strdup_printf (_("Collecting info for `%s' ... %c"), 
                                pattern,
-                               windmill[running%DIM(windmill)] );
-    gtk_label_set_text (sk->toplabel, buf );
+                               windmill[running%DIM(windmill)]);
+    gtk_label_set_text (sk->toplabel, buf);
     g_free (buf);
 }
 
     g_free (buf);
 }
 
@@ -128,7 +128,7 @@ gpgmegtk_recipient_selection (GSList *recp_names)
     err = gpgme_recipients_new (&sk.rset);
     if (err) {
         g_message ("** failed to allocate recipients set: %s",
     err = gpgme_recipients_new (&sk.rset);
     if (err) {
         g_message ("** failed to allocate recipients set: %s",
-                   gpgme_strerror (err) );
+                   gpgme_strerror (err));
         return NULL;
     }
         
         return NULL;
     }
         
@@ -142,7 +142,7 @@ gpgmegtk_recipient_selection (GSList *recp_names)
         gtk_main ();
         if (recp_names)
             recp_names = recp_names->next;
         gtk_main ();
         if (recp_names)
             recp_names = recp_names->next;
-    } while (sk.okay && recp_names );
+    } while (sk.okay && recp_names);
 
     close_dialog (&sk);
 
 
     close_dialog (&sk);
 
@@ -161,30 +161,35 @@ destroy_key (gpointer data)
 }
 
 static void
 }
 
 static void
-set_row (GtkCList *clist, GpgmeKey key )
+set_row (GtkCList *clist, GpgmeKey key)
 {
     const char *s;
     const char *text[N_COL_TITLES];
     char *algo_buf;
     int row;
 {
     const char *s;
     const char *text[N_COL_TITLES];
     char *algo_buf;
     int row;
+
+    /* first check whether the key is capable of encryption which is not
+     * the case for revoked, expired or sign-only keys */
+    if ( !gpgme_key_get_ulong_attr (key, GPGME_ATTR_CAN_ENCRYPT, NULL, 0 ) )
+        return;
     
     algo_buf = g_strdup_printf ("%lu/%s", 
          gpgme_key_get_ulong_attr (key, GPGME_ATTR_LEN, NULL, 0 ),
          gpgme_key_get_string_attr (key, GPGME_ATTR_ALGO, NULL, 0 ) );
     text[COL_ALGO] = algo_buf;
 
     
     algo_buf = g_strdup_printf ("%lu/%s", 
          gpgme_key_get_ulong_attr (key, GPGME_ATTR_LEN, NULL, 0 ),
          gpgme_key_get_string_attr (key, GPGME_ATTR_ALGO, NULL, 0 ) );
     text[COL_ALGO] = algo_buf;
 
-    s = gpgme_key_get_string_attr (key, GPGME_ATTR_KEYID, NULL, 0 );
-    if ( strlen (s) == 16 )
+    s = gpgme_key_get_string_attr (key, GPGME_ATTR_KEYID, NULL, 0);
+    if (strlen (s) == 16)
         s += 8; /* show only the short keyID */
     text[COL_KEYID] = s;
 
         s += 8; /* show only the short keyID */
     text[COL_KEYID] = s;
 
-    s = gpgme_key_get_string_attr (key, GPGME_ATTR_NAME, NULL, 0 );
+    s = gpgme_key_get_string_attr (key, GPGME_ATTR_NAME, NULL, 0);
     text[COL_NAME] = s;
 
     text[COL_NAME] = s;
 
-    s = gpgme_key_get_string_attr (key, GPGME_ATTR_EMAIL, NULL, 0 );
+    s = gpgme_key_get_string_attr (key, GPGME_ATTR_EMAIL, NULL, 0);
     text[COL_EMAIL] = s;
 
     text[COL_EMAIL] = s;
 
-    s = gpgme_key_get_string_attr (key, GPGME_ATTR_VALIDITY, NULL, 0 );
+    s = gpgme_key_get_string_attr (key, GPGME_ATTR_VALIDITY, NULL, 0);
     text[COL_VALIDITY] = s;
 
     row = gtk_clist_append (clist, (gchar**)text);
     text[COL_VALIDITY] = s;
 
     row = gtk_clist_append (clist, (gchar**)text);
@@ -195,7 +200,7 @@ set_row (GtkCList *clist, GpgmeKey key )
 
 
 static void 
 
 
 static void 
-fill_clist (struct select_keys_s *sk, const char *pattern )
+fill_clist (struct select_keys_s *sk, const char *pattern)
 {
     GtkCList *clist;
     GpgmeCtx ctx;
 {
     GtkCList *clist;
     GpgmeCtx ctx;
@@ -207,15 +212,11 @@ fill_clist (struct select_keys_s *sk, const char *pattern )
     clist = sk->clist;
     g_return_if_fail (clist);
 
     clist = sk->clist;
     g_return_if_fail (clist);
 
-    debug_print ("select_keys:fill_clist:  pattern `%s'\n", pattern );
+    debug_print ("select_keys:fill_clist:  pattern `%s'\n", pattern);
 
     /*gtk_clist_freeze (select_keys.clist);*/
     err = gpgme_new (&ctx);
 
     /*gtk_clist_freeze (select_keys.clist);*/
     err = gpgme_new (&ctx);
-    if (err) {
-        g_message ("** gpgme_new failed: %s",
-                   gpgme_strerror (err));
-        return;
-    }
+    g_assert (!err);
 
     sk->select_ctx = ctx;
 
 
     sk->select_ctx = ctx;
 
@@ -223,12 +224,11 @@ fill_clist (struct select_keys_s *sk, const char *pattern )
     while (gtk_events_pending ())
         gtk_main_iteration ();
 
     while (gtk_events_pending ())
         gtk_main_iteration ();
 
-    err = gpgme_op_keylist_start (ctx, pattern, 0 );
+    err = gpgme_op_keylist_start (ctx, pattern, 0);
     if (err) {
         g_message ("** gpgme_op_keylist_start(%s) failed: %s",
                    pattern, gpgme_strerror (err));
         sk->select_ctx = NULL;
     if (err) {
         g_message ("** gpgme_op_keylist_start(%s) failed: %s",
                    pattern, gpgme_strerror (err));
         sk->select_ctx = NULL;
-       gpgme_release (ctx);
         return;
     }
     update_progress (sk, ++running, pattern);
         return;
     }
     update_progress (sk, ++running, pattern);
@@ -240,7 +240,7 @@ fill_clist (struct select_keys_s *sk, const char *pattern )
             gtk_main_iteration ();
     }
     debug_print ("%% %s:%d:  ready\n", __FILE__ ,__LINE__ );
             gtk_main_iteration ();
     }
     debug_print ("%% %s:%d:  ready\n", __FILE__ ,__LINE__ );
-    if ( err != GPGME_EOF )
+    if (err != GPGME_EOF)
         g_message ("** gpgme_op_keylist_next failed: %s",
                    gpgme_strerror (err));
     sk->select_ctx = NULL;
         g_message ("** gpgme_op_keylist_next failed: %s",
                    gpgme_strerror (err));
     sk->select_ctx = NULL;
@@ -499,13 +499,13 @@ sort_keys ( struct select_keys_s *sk, enum col_titles column)
 static void
 sort_keys_name (GtkWidget *widget, gpointer data)
 {
 static void
 sort_keys_name (GtkWidget *widget, gpointer data)
 {
-    sort_keys ( (struct select_keys_s*)data, COL_NAME );
+    sort_keys ((struct select_keys_s*)data, COL_NAME);
 }
 
 static void
 sort_keys_email (GtkWidget *widget, gpointer data)
 {
 }
 
 static void
 sort_keys_email (GtkWidget *widget, gpointer data)
 {
-    sort_keys ( (struct select_keys_s*)data, COL_EMAIL );
+    sort_keys ((struct select_keys_s*)data, COL_EMAIL);
 }
 
 
 }
 
 
index 3d9e0b692728d540939b631745a66cf4f8d296a1..37c185d8cd84daedebc25de55739d22d00b03e68 100644 (file)
@@ -45,14 +45,15 @@ static gint send_message_smtp       (GSList *to_list, const gchar *from,
                                 const gchar *domain, const gchar *userid,
                                 const gchar *passwd, gboolean use_smtp_auth,
                                 FILE *fp);
                                 const gchar *domain, const gchar *userid,
                                 const gchar *passwd, gboolean use_smtp_auth,
                                 FILE *fp);
-static gint send_smtp_open     (const gchar *server, gushort port,
+static SockInfo *send_smtp_open        (const gchar *server, gushort port,
                                 const gchar *domain, gboolean use_smtp_auth);
 
 #define SEND_EXIT_IF_ERROR(f, s) \
 { \
                                 const gchar *domain, gboolean use_smtp_auth);
 
 #define SEND_EXIT_IF_ERROR(f, s) \
 { \
-       if ((f) < 0) { \
+       if (!(f)) { \
                log_warning("Error occurred while %s\n", s); \
                log_warning("Error occurred while %s\n", s); \
-               if (smtp_sock > 0) sock_close(smtp_sock); \
+               sock_close(smtp_sock); \
+               smtp_sock = NULL; \
                return -1; \
        } \
 }
                return -1; \
        } \
 }
@@ -64,6 +65,7 @@ static gint send_smtp_open    (const gchar *server, gushort port,
                if (smtp_quit(smtp_sock) != SM_OK) \
                        log_warning("Error occurred while sending QUIT\n"); \
                sock_close(smtp_sock); \
                if (smtp_quit(smtp_sock) != SM_OK) \
                        log_warning("Error occurred while sending QUIT\n"); \
                sock_close(smtp_sock); \
+               smtp_sock = NULL; \
                return -1; \
        } \
 }
                return -1; \
        } \
 }
@@ -185,7 +187,7 @@ static gint send_message_smtp(GSList *to_list, const gchar *from,
                              const gchar* passwd, gboolean use_smtp_auth,
                              FILE *fp)
 {
                              const gchar* passwd, gboolean use_smtp_auth,
                              FILE *fp)
 {
-       gint smtp_sock;
+       SockInfo *smtp_sock;
        gchar buf[BUFFSIZE];
        GSList *cur;
 
        gchar buf[BUFFSIZE];
        GSList *cur;
 
@@ -226,22 +228,19 @@ static gint send_message_smtp(GSList *to_list, const gchar *from,
        return 0;
 }
 
        return 0;
 }
 
-static gint send_smtp_open(const gchar *server, gushort port,
+static SockInfo *send_smtp_open(const gchar *server, gushort port,
                           const gchar *domain, gboolean use_smtp_auth)
 {
                           const gchar *domain, gboolean use_smtp_auth)
 {
-       SockInfo *sockinfo;
-       gint sock;
+       SockInfo *sock;
        gint val;
 
        gint val;
 
-       g_return_val_if_fail(server != NULL, -1);
+       g_return_val_if_fail(server != NULL, NULL);
 
 
-       if ((sockinfo = sock_connect(server, port)) == NULL) {
+       if ((sock = sock_connect(server, port)) == NULL) {
                log_warning(_("Can't connect to SMTP server: %s:%d\n"),
                            server, port);
                log_warning(_("Can't connect to SMTP server: %s:%d\n"),
                            server, port);
-               return -1;
+               return NULL;
        }
        }
-       sock = sockinfo->sock;
-       sock_sockinfo_free(sockinfo);
 
        if (smtp_ok(sock) == SM_OK) {
                val = smtp_helo(sock, domain ? domain : get_domain_name(),
 
        if (smtp_ok(sock) == SM_OK) {
                val = smtp_helo(sock, domain ? domain : get_domain_name(),
@@ -252,5 +251,5 @@ static gint send_smtp_open(const gchar *server, gushort port,
        log_warning(_("Error occurred while sending HELO\n"));
        sock_close(sock);
 
        log_warning(_("Error occurred while sending HELO\n"));
        sock_close(sock);
 
-       return -1;
+       return NULL;
 }
 }
index f1dba91f52336e363747ed091ab90cd511fbc8a3..58155cc1c9839a9841182a4b12e50e3f5b01b061 100644 (file)
@@ -21,6 +21,7 @@
 #define __SESSION_H__
 
 #include <glib.h>
 #define __SESSION_H__
 
 #include <glib.h>
+#include "socket.h"
 
 typedef struct _Session        Session;
 
 
 typedef struct _Session        Session;
 
@@ -41,7 +42,7 @@ struct _Session
 {
        SessionType type;
 
 {
        SessionType type;
 
-       gint   sock;
+       SockInfo *sock;
        gchar *server;
 
        gboolean connected;
        gchar *server;
 
        gboolean connected;
diff --git a/src/sigstatus.c b/src/sigstatus.c
new file mode 100644 (file)
index 0000000..fe0f2dc
--- /dev/null
@@ -0,0 +1,236 @@
+/* sigstatus.h - GTK+ based signature status display
+ *      Copyright (C) 2001 Werner Koch (dd9jn)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#if USE_GPGME
+
+#include <glib.h>
+#include <gtk/gtkwindow.h>
+#include <gtk/gtkvbox.h>
+#include <gtk/gtkhbox.h>
+#include <gtk/gtklabel.h>
+#include <gtk/gtkbutton.h>
+#include <gdk/gdkkeysyms.h>
+#include <gpgme.h>
+
+#include "intl.h"
+#include "gtkutils.h"
+#include "utils.h"
+#include "sigstatus.h"
+
+/* remove the window after 30 seconds to avoid cluttering the deskop 
+ * with too many of them */
+#define MY_TIMEOUT (30*1000)
+
+
+struct gpgmegtk_sig_status_s {
+        GtkWidget *mainwindow;
+        GtkWidget *label;
+        int running;
+        int destroy_pending;
+        guint timeout_id;
+        int timeout_id_valid;
+};
+
+
+static void do_destroy(GpgmegtkSigStatus hd)
+{
+        if (!hd->running ) {
+                if (hd->mainwindow) {
+                        gtk_widget_destroy ( hd->mainwindow );
+                        hd->mainwindow = NULL;
+                }
+                if (hd->timeout_id_valid) {
+                        gtk_timeout_remove(hd->timeout_id);
+                        hd->timeout_id_valid = 0;
+                }
+                if(hd->destroy_pending) 
+                        g_free(hd);
+        }
+}
+
+
+static void okay_cb(GtkWidget *widget, gpointer data)
+{
+        GpgmegtkSigStatus hd = data;
+
+        hd->running = 0;
+        do_destroy(hd);
+}
+
+
+static void key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data)
+{
+        GpgmegtkSigStatus hd = data;
+
+        if (event && event->keyval == GDK_Escape) {
+                hd->running = 0;
+                do_destroy(hd);
+        }
+}
+
+
+GpgmegtkSigStatus gpgmegtk_sig_status_create()
+{
+       GtkWidget *window;
+       GtkWidget *vbox;
+       GtkWidget *hbox;
+       GtkWidget *label;
+       GtkWidget *okay_btn;
+       GtkWidget *okay_area;
+        GpgmegtkSigStatus hd;
+
+        hd = g_malloc0(sizeof *hd);
+        hd->running = 1;
+
+       window = gtk_window_new(GTK_WINDOW_DIALOG);
+        hd->mainwindow = window;
+       gtk_widget_set_usize(window, 400, -1);
+       gtk_container_set_border_width(GTK_CONTAINER(window), 8);
+       gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
+       gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE);
+        gtk_signal_connect(GTK_OBJECT(window), "delete_event",
+                           GTK_SIGNAL_FUNC(okay_cb), hd);
+        gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
+                           GTK_SIGNAL_FUNC(key_pressed), hd);
+
+       vbox = gtk_vbox_new(FALSE, 8);
+       gtk_container_add(GTK_CONTAINER(window), vbox);
+       gtk_widget_show(vbox);
+
+       hbox = gtk_hbox_new(FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 8);
+       gtk_widget_show(hbox);
+
+       label = gtk_label_new(_("Checking signature"));
+        hd->label = label;
+       gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 8);
+       gtk_widget_show(label);
+
+       gtkut_button_set_create(&okay_area, &okay_btn, _("Okay"),
+                               NULL, NULL, NULL, NULL);
+       gtk_box_pack_end(GTK_BOX(vbox), okay_area, FALSE, FALSE, 0);
+       gtk_widget_grab_default(okay_btn);
+        gtk_signal_connect(GTK_OBJECT(okay_btn), "clicked",
+                           GTK_SIGNAL_FUNC(okay_cb), hd);
+
+       gtk_widget_show_all(window);
+
+        while (gtk_events_pending())
+            gtk_main_iteration();
+
+        return hd;
+}
+
+static gint timeout_cb(gpointer data)
+{
+    GpgmegtkSigStatus hd = data;
+
+    hd->running = 0;
+    hd->timeout_id_valid = 0;
+    do_destroy(hd);
+    return FALSE;
+}
+
+void gpgmegtk_sig_status_destroy(GpgmegtkSigStatus hd)
+{
+        if( hd ) {
+                hd->destroy_pending = 1;
+                if (hd->running && !hd->timeout_id_valid) {
+                    hd->timeout_id = gtk_timeout_add(MY_TIMEOUT,
+                                                     timeout_cb, hd);
+                    hd->timeout_id_valid = 1;
+                }
+                do_destroy(hd);
+        }
+}
+
+
+/* Fixme: remove status and get it from the context */
+void gpgmegtk_sig_status_update(GpgmegtkSigStatus hd, GpgmeCtx ctx)
+{
+    int idx;
+    time_t created;
+    GpgmeSigStat status;
+    char *text = NULL;
+
+    if (!hd || !hd->running || !ctx)
+        return;
+
+    for (idx=0; gpgme_get_sig_status(ctx, idx, &status, &created); idx++ ) {
+        char *tmp;
+        const char *userid;
+        GpgmeKey key = NULL;
+
+        if ( !gpgme_get_sig_key (ctx, idx, &key) ) {
+            userid = gpgme_key_get_string_attr (key, GPGME_ATTR_USERID,
+                                                NULL, 0);
+        }
+        else
+            userid = "[?]";
+
+        tmp = g_strdup_printf ( "%s%s%s from \"%s\"",
+                                text? text:"",
+                                text? "\n":"",
+                                gpgmegtk_sig_status_to_string(status),
+                                userid );
+        g_free (text);
+        text = tmp;
+        gpgme_key_unref (key);
+    }
+
+    gtk_label_set_text(GTK_LABEL(hd->label), text ); 
+    g_free (text);
+
+    while (gtk_events_pending())
+        gtk_main_iteration();
+}
+
+
+const char *gpgmegtk_sig_status_to_string(GpgmeSigStat status)
+{
+        const char *result = "?";
+
+        switch ( status ) {
+            case GPGME_SIG_STAT_NONE:
+                result = _("Oops: Signature not verified");
+                break;
+            case GPGME_SIG_STAT_NOSIG:
+                result = _("No signature found");
+                break;
+            case GPGME_SIG_STAT_GOOD:
+                result = _("Good signature");
+                break;
+            case GPGME_SIG_STAT_BAD:
+                result = _("BAD signature");
+                break;
+            case GPGME_SIG_STAT_NOKEY:
+                result = _("No public key to verify the signature");
+                break;
+            case GPGME_SIG_STAT_ERROR:
+                result = _("Error verifying the signature");
+                break;
+        }
+
+        return result;
+}
+
+#endif /* USE_GPGME */
diff --git a/src/sigstatus.h b/src/sigstatus.h
new file mode 100644 (file)
index 0000000..f4834b0
--- /dev/null
@@ -0,0 +1,33 @@
+/* sigstatus.h - GTK+ based signature status display
+ *      Copyright (C) 2001 Werner Koch (dd9jn)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef GPGMEGTK_SIGSTATUS_H
+#define GPGMEGTK_SIGSTATUS_H
+
+#include <gpgme.h>
+
+struct gpgmegtk_sig_status_s;
+typedef struct gpgmegtk_sig_status_s *GpgmegtkSigStatus;
+
+GpgmegtkSigStatus gpgmegtk_sig_status_create(void);
+void gpgmegtk_sig_status_destroy(GpgmegtkSigStatus hd);
+void gpgmegtk_sig_status_update(GpgmegtkSigStatus hd, GpgmeCtx ctx);
+
+const char *gpgmegtk_sig_status_to_string(GpgmeSigStat status);
+
+#endif /* GPGMEGTK_SIGSTATUS_H */
diff --git a/src/simple-gettext.c b/src/simple-gettext.c
new file mode 100644 (file)
index 0000000..be6292b
--- /dev/null
@@ -0,0 +1,386 @@
+/* simple-gettext.c  - a simplified version of gettext.
+ * Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ *
+ * This file is part of GnuPG.
+ *
+ * GnuPG is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GnuPG 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 is a simplified version of gettext written by Ulrich Drepper.
+ * It is used for the Win32 version of GnuPG becuase all the overhead
+ * of gettext is not needed and we have to do some special Win32 stuff.
+ * I decided that this is far easier than to tweak gettext for the special
+ * cases (I tried it but it is a lot of code). wk 15.09.99
+ */
+
+#include <config.h>
+#ifdef USE_SIMPLE_GETTEXT
+#ifndef __MINGW32__
+  #error This file can only be used with MinGW32
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <windows.h>
+#include "w32reg.h"
+
+typedef unsigned int u32; /* That is fine with MingW32 */
+
+typedef unsigned long ulong;
+
+/* The magic number of the GNU message catalog format. */
+#define MAGIC        0x950412de
+#define MAGIC_SWAPPED 0xde120495
+
+/* Revision number of the currently used .mo (binary) file format.  */
+#define MO_REVISION_NUMBER 0
+
+
+/* Header for binary .mo file format.  */
+struct mo_file_header
+{
+  /* The magic number. */
+  u32 magic;
+  /* The revision number of the file format.  */
+  u32 revision;
+  /* The number of strings pairs.  */
+  u32 nstrings;
+  /* Offset of table with start offsets of original strings.  */
+  u32 orig_tab_offset;
+  /* Offset of table with start offsets of translation strings.  */
+  u32 trans_tab_offset;
+  /* Size of hashing table.  */
+  u32 hash_tab_size;
+  /* Offset of first hashing entry.  */
+  u32 hash_tab_offset;
+};
+
+struct string_desc
+{
+  /* Length of addressed string.  */
+  u32 length;
+  /* Offset of string in file. */
+  u32 offset;
+};
+
+
+
+struct loaded_domain
+{
+  char *data;
+  int must_swap;
+  u32 nstrings;
+  char *mapped;
+  struct string_desc *orig_tab;
+  struct string_desc *trans_tab;
+  u32 hash_size;
+  u32 *hash_tab;
+};
+
+
+static struct loaded_domain *the_domain;
+
+static __inline__ u32
+do_swap_u32( u32 i )
+{
+  return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
+}
+
+#define SWAPIT(flag, data) ((flag) ? do_swap_u32(data) : (data) )
+
+
+/* We assume to have `unsigned long int' value with at least 32 bits.  */
+#define HASHWORDBITS 32
+
+/* The so called `hashpjw' function by P.J. Weinberger
+   [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
+   1986, 1987 Bell Telephone Laboratories, Inc.]  */
+
+static __inline__ ulong
+hash_string( const char *str_param )
+{
+    unsigned long int hval, g;
+    const char *str = str_param;
+
+    hval = 0;
+    while (*str != '\0')
+    {
+       hval <<= 4;
+       hval += (unsigned long int) *str++;
+       g = hval & ((unsigned long int) 0xf << (HASHWORDBITS - 4));
+       if (g != 0)
+       {
+         hval ^= g >> (HASHWORDBITS - 8);
+         hval ^= g;
+       }
+    }
+    return hval;
+}
+
+
+static struct loaded_domain *
+load_domain( const char *filename )
+{
+    FILE *fp;
+    size_t size;
+    struct stat st;
+    struct mo_file_header *data = NULL;
+    struct loaded_domain *domain = NULL;
+    size_t to_read;
+    char *read_ptr;
+
+    fp = fopen( filename, "rb" );
+    if( !fp )
+       return NULL; /* can't open the file */
+    /* we must know about the size of the file */
+    if( fstat( fileno(fp ), &st )
+       || (size = (size_t)st.st_size) != st.st_size
+       || size < sizeof (struct mo_file_header) ) {
+       fclose( fp );
+       return NULL;
+    }
+
+    data = malloc( size );
+    if( !data ) {
+       fclose( fp );
+       return NULL; /* out of memory */
+    }
+
+    to_read = size;
+    read_ptr = (char *) data;
+    do {
+       long int nb = fread( read_ptr, 1, to_read, fp );
+       if( nb < to_read ) {
+           fclose (fp);
+           free(data);
+           return NULL; /* read error */
+       }
+       read_ptr += nb;
+       to_read -= nb;
+    } while( to_read > 0 );
+    fclose (fp);
+
+    /* Using the magic number we can test whether it really is a message
+     * catalog file.  */
+    if( data->magic != MAGIC && data->magic != MAGIC_SWAPPED ) {
+       /* The magic number is wrong: not a message catalog file.  */
+       free( data );
+       return NULL;
+    }
+
+    domain = calloc( 1, sizeof *domain );
+    if( !domain )  {
+       free( data );
+       return NULL;
+    }
+    domain->data = (char *) data;
+    domain->must_swap = data->magic != MAGIC;
+
+    /* Fill in the information about the available tables.  */
+    switch( SWAPIT(domain->must_swap, data->revision) ) {
+      case 0:
+       domain->nstrings = SWAPIT(domain->must_swap, data->nstrings);
+       domain->orig_tab = (struct string_desc *)
+         ((char *) data + SWAPIT(domain->must_swap, data->orig_tab_offset));
+       domain->trans_tab = (struct string_desc *)
+         ((char *) data + SWAPIT(domain->must_swap, data->trans_tab_offset));
+       domain->hash_size = SWAPIT(domain->must_swap, data->hash_tab_size);
+       domain->hash_tab = (u32 *)
+         ((char *) data + SWAPIT(domain->must_swap, data->hash_tab_offset));
+      break;
+
+      default: /* This is an invalid revision. */
+       free( data );
+       free( domain );
+       return NULL;
+    }
+
+    /* allocate an array to keep track of code page mappings */
+    domain->mapped = calloc( 1, domain->nstrings );
+    if( !domain->mapped ) {
+       free( data );
+       free( domain );
+       return NULL;
+    }
+
+    return domain;
+}
+
+
+/****************
+ * Set the file used for translations. Pass a NULL to disable
+ * translation.  A new filename may be set at anytime.
+ * WARNING: After changing the filename you shoudl not access any data
+ *         retrieved by gettext().
+ */
+int
+set_gettext_file( const char *filename )
+{
+    struct loaded_domain *domain = NULL;
+
+    if( filename && *filename ) {
+       if( filename[0] == '/'
+          #ifdef HAVE_DRIVE_LETTERS
+           || ( isalpha(filename[0])
+                && filename[1] == ':'
+                && (filename[2] == '/' || filename[2] == '\\') )
+          #endif
+          ) {
+           /* absolute path - use it as is */
+           domain = load_domain( filename );
+       }
+       else { /* relative path - append ".mo" and get dir from the environment */
+           char *buf = NULL;
+           char *dir;
+
+           dir = read_w32_registry_string( NULL,
+                                           "Control Panel\\Mingw32\\NLS",
+                                           "MODir" );
+           if( dir && (buf=malloc(strlen(dir)+strlen(filename)+1+3+1)) ) {
+               strcpy(stpcpy(stpcpy(stpcpy( buf, dir),"\\"), filename),".mo");
+               domain = load_domain( buf );
+               free(buf);
+           }
+           free(dir);
+       }
+       if( !domain ) {
+           return -1; }
+    }
+    if( the_domain ) {
+       free( the_domain->data );
+       free( the_domain->mapped );
+       free( the_domain );
+       the_domain = NULL;
+    }
+    the_domain = domain;
+    return NULL;
+}
+
+
+static const char*
+get_string( struct loaded_domain *domain, u32 idx )
+{
+    char *p = domain->data + SWAPIT(domain->must_swap,
+                                   domain->trans_tab[idx].offset);
+
+       /* status of domain->mapped[idx] is ignored.
+        * not sure about the consequences.
+        * perhaps mapped can entirely be removed?
+        */
+
+       /* we assume, strings are already correctly
+        * encoded.
+        */
+
+    return (const char*)p;
+}
+
+
+
+const char *
+gettext( const char *msgid )
+{
+    struct loaded_domain *domain;
+    size_t act = 0;
+    size_t top, bottom;
+
+    if( !(domain = the_domain) ) {
+       goto not_found;
+       }
+
+    /* Locate the MSGID and its translation.  */
+    if( domain->hash_size > 2 && domain->hash_tab ) {
+       /* Use the hashing table.  */
+       u32 len = strlen (msgid);
+       u32 hash_val = hash_string (msgid);
+       u32 idx = hash_val % domain->hash_size;
+       u32 incr = 1 + (hash_val % (domain->hash_size - 2));
+       u32 nstr = SWAPIT (domain->must_swap, domain->hash_tab[idx]);
+
+       if ( !nstr ) /* Hash table entry is empty.  */
+           goto not_found;
+
+       if( SWAPIT(domain->must_swap,
+                   domain->orig_tab[nstr - 1].length) == len
+           && !strcmp( msgid,
+                      domain->data + SWAPIT(domain->must_swap,
+                                   domain->orig_tab[nstr - 1].offset)) )
+           return get_string( domain, nstr - 1 );
+
+       for(;;) {
+           if (idx >= domain->hash_size - incr)
+               idx -= domain->hash_size - incr;
+           else
+               idx += incr;
+
+           nstr = SWAPIT(domain->must_swap, domain->hash_tab[idx]);
+           if( !nstr )
+               goto not_found; /* Hash table entry is empty.  */
+
+           if ( SWAPIT(domain->must_swap,
+                               domain->orig_tab[nstr - 1].length) == len
+                && !strcmp (msgid,
+                        domain->data + SWAPIT(domain->must_swap,
+                                          domain->orig_tab[nstr - 1].offset)))
+               return get_string( domain, nstr-1 );
+       }
+       /* NOTREACHED */
+    }
+
+    /* Now we try the default method:  binary search in the sorted
+       array of messages.  */
+    bottom = 0;
+    top = domain->nstrings;
+    while( bottom < top ) {
+       int cmp_val;
+
+       act = (bottom + top) / 2;
+       cmp_val = strcmp(msgid, domain->data
+                              + SWAPIT(domain->must_swap,
+                                       domain->orig_tab[act].offset));
+       if (cmp_val < 0)
+           top = act;
+       else if (cmp_val > 0)
+           bottom = act + 1;
+       else
+           return get_string( domain, act );
+    }
+
+  not_found:
+    return msgid;
+}
+
+#if 0
+       unsigned int cp1, cp2;
+
+       cp1 = GetConsoleCP();
+       cp2 = GetConsoleOutputCP();
+
+       log_info("InputCP=%u  OutputCP=%u\n", cp1, cp2 );
+
+       if( !SetConsoleOutputCP( 1252 ) )
+          log_info("SetConsoleOutputCP failed: %d\n", (int)GetLastError() );
+
+       cp1 = GetConsoleCP();
+       cp2 = GetConsoleOutputCP();
+       log_info("InputCP=%u  OutputCP=%u after switch1\n", cp1, cp2 );
+#endif
+
+#endif /* USE_SIMPLE_GETTEXT */
index a3b5a37890743fe7a75e50d9479a765fb3587613..ec99637784792a043c4ae4f3b4951911f415f431 100644 (file)
@@ -31,7 +31,7 @@
 static gint verbose = 1;
 static gchar smtp_response[MSGBUFSIZE];
 
 static gint verbose = 1;
 static gchar smtp_response[MSGBUFSIZE];
 
-gint smtp_helo(gint sock, const char *hostname, gboolean use_smtp_auth)
+gint smtp_helo(SockInfo *sock, const char *hostname, gboolean use_smtp_auth)
 {
        if (use_smtp_auth) {
                sock_printf(sock, "EHLO %s\r\n", hostname);
 {
        if (use_smtp_auth) {
                sock_printf(sock, "EHLO %s\r\n", hostname);
@@ -48,7 +48,7 @@ gint smtp_helo(gint sock, const char *hostname, gboolean use_smtp_auth)
        }
 }
 
        }
 }
 
-gint smtp_from(gint sock, const gchar *from,
+gint smtp_from(SockInfo *sock, const gchar *from,
               const gchar *userid, const gchar *passwd,
               gboolean use_smtp_auth)
 {
               const gchar *userid, const gchar *passwd,
               gboolean use_smtp_auth)
 {
@@ -81,7 +81,7 @@ gint smtp_from(gint sock, const gchar *from,
        return smtp_ok(sock);
 }
 
        return smtp_ok(sock);
 }
 
-gint smtp_rcpt(gint sock, const gchar *to)
+gint smtp_rcpt(SockInfo *sock, const gchar *to)
 {
        gchar buf[MSGBUFSIZE];
 
 {
        gchar buf[MSGBUFSIZE];
 
@@ -97,7 +97,7 @@ gint smtp_rcpt(gint sock, const gchar *to)
        return smtp_ok(sock);
 }
 
        return smtp_ok(sock);
 }
 
-gint smtp_data(gint sock)
+gint smtp_data(SockInfo *sock)
 {
        sock_printf(sock, "DATA\r\n");
        if (verbose)
 {
        sock_printf(sock, "DATA\r\n");
        if (verbose)
@@ -106,7 +106,7 @@ gint smtp_data(gint sock)
        return smtp_ok(sock);
 }
 
        return smtp_ok(sock);
 }
 
-gint smtp_rset(gint sock)
+gint smtp_rset(SockInfo *sock)
 {
        sock_printf(sock, "RSET\r\n");
        if (verbose)
 {
        sock_printf(sock, "RSET\r\n");
        if (verbose)
@@ -115,7 +115,7 @@ gint smtp_rset(gint sock)
        return smtp_ok(sock);
 }
 
        return smtp_ok(sock);
 }
 
-gint smtp_quit(gint sock)
+gint smtp_quit(SockInfo *sock)
 {
        sock_printf(sock, "QUIT\r\n");
        if (verbose)
 {
        sock_printf(sock, "QUIT\r\n");
        if (verbose)
@@ -124,7 +124,7 @@ gint smtp_quit(gint sock)
        return smtp_ok(sock);
 }
 
        return smtp_ok(sock);
 }
 
-gint smtp_eom(gint sock)
+gint smtp_eom(SockInfo *sock)
 {
        sock_printf(sock, ".\r\n");
        if (verbose)
 {
        sock_printf(sock, ".\r\n");
        if (verbose)
@@ -133,7 +133,7 @@ gint smtp_eom(gint sock)
        return smtp_ok(sock);
 }
 
        return smtp_ok(sock);
 }
 
-gint smtp_ok(gint sock)
+gint smtp_ok(SockInfo *sock)
 {
        while ((sock_read(sock, smtp_response, sizeof(smtp_response) - 1))
               != 1) {
 {
        while ((sock_read(sock, smtp_response, sizeof(smtp_response) - 1))
               != 1) {
index ea4c88a8d63379896a43355f130b30209f486a71..42ae2295e31e3d2462262e85650765586c287cfa 100644 (file)
@@ -22,6 +22,8 @@
 
 #include <glib.h>
 
 
 #include <glib.h>
 
+#include "socket.h"
+
 #define        SMTPBUFSIZE             256
 
 #define        SM_OK                   0
 #define        SMTPBUFSIZE             256
 
 #define        SM_OK                   0
 #define        ESMTP_SIZE              0x02
 #define        ESMTP_ETRN              0x04
 
 #define        ESMTP_SIZE              0x02
 #define        ESMTP_ETRN              0x04
 
-gint smtp_helo(gint sock, const char *hostname, gboolean use_smtp_auth);
-gint smtp_from(gint sock, const gchar *from, const gchar *userid,
+gint smtp_helo(SockInfo *sock, const char *hostname, gboolean use_smtp_auth);
+gint smtp_from(SockInfo *sock, const gchar *from, const gchar *userid,
               const gchar *passwd, gboolean use_smtp_auth);
               const gchar *passwd, gboolean use_smtp_auth);
-gint smtp_rcpt(gint sock, const gchar *to);
-gint smtp_data(gint sock);
-gint smtp_rset(gint sock);
-gint smtp_quit(gint sock);
-gint smtp_eom(gint sock);
-gint smtp_ok(gint sock);
+gint smtp_rcpt(SockInfo *sock, const gchar *to);
+gint smtp_data(SockInfo *sock);
+gint smtp_rset(SockInfo *sock);
+gint smtp_quit(SockInfo *sock);
+gint smtp_eom(SockInfo *sock);
+gint smtp_ok(SockInfo *sock);
 
 #endif /* __SMTP_H__ */
 
 #endif /* __SMTP_H__ */
index 83012da23733341c0ef7785e358b4ffcd5779da0..9a1d8eb0f4edaefc5cd60ca148a2456b15bddf0c 100644 (file)
 
 #include "socket.h"
 
 
 #include "socket.h"
 
+#if USE_GIO
+#error USE_GIO is currently not supported
+#endif
+
 #define BUFFSIZE       8192
 
 #ifndef INET6
 #define BUFFSIZE       8192
 
 #ifndef INET6
@@ -53,7 +57,8 @@ static gint sock_connect_by_getaddrinfo       (const gchar    *hostname,
                                         gushort         port);
 #endif
 
                                         gushort         port);
 #endif
 
-gint sock_connect_unix(const gchar *path)
+
+gint fd_connect_unix(const gchar *path)
 {
        gint sock;
        struct sockaddr_un addr;
 {
        gint sock;
        struct sockaddr_un addr;
@@ -76,7 +81,7 @@ gint sock_connect_unix(const gchar *path)
        return sock;
 }
 
        return sock;
 }
 
-gint sock_open_unix(const gchar *path)
+gint fd_open_unix(const gchar *path)
 {
        gint sock;
        struct sockaddr_un addr;
 {
        gint sock;
        struct sockaddr_un addr;
@@ -107,7 +112,7 @@ gint sock_open_unix(const gchar *path)
        return sock;
 }
 
        return sock;
 }
 
-gint sock_accept(gint sock)
+gint fd_accept(gint sock)
 {
        struct sockaddr_in caddr;
        gint caddr_len;
 {
        struct sockaddr_in caddr;
        gint caddr_len;
@@ -116,11 +121,12 @@ gint sock_accept(gint sock)
        return accept(sock, (struct sockaddr *)&caddr, &caddr_len);
 }
 
        return accept(sock, (struct sockaddr *)&caddr, &caddr_len);
 }
 
-gint sock_set_nonblocking_mode(gint sock, gboolean nonblock)
+
+static gint set_nonblocking_mode(gint fd, gboolean nonblock)
 {
        gint flags;
 
 {
        gint flags;
 
-       flags = fcntl(sock, F_GETFL, 0);
+       flags = fcntl(fd, F_GETFL, 0);
        if (flags < 0) {
                perror("fcntl");
                return -1;
        if (flags < 0) {
                perror("fcntl");
                return -1;
@@ -131,14 +137,22 @@ gint sock_set_nonblocking_mode(gint sock, gboolean nonblock)
        else
                flags &= ~O_NONBLOCK;
 
        else
                flags &= ~O_NONBLOCK;
 
-       return fcntl(sock, F_SETFL, flags);
+       return fcntl(fd, F_SETFL, flags);
 }
 
 }
 
-gboolean sock_is_nonblocking_mode(gint sock)
+gint sock_set_nonblocking_mode(SockInfo *sock, gboolean nonblock)
+{
+       g_return_val_if_fail(sock != NULL, -1);
+
+       return set_nonblocking_mode(sock->sock, nonblock);
+}
+
+
+static gboolean is_nonblocking_mode(gint fd)
 {
        gint flags;
 
 {
        gint flags;
 
-       flags = fcntl(sock, F_GETFL, 0);
+       flags = fcntl(fd, F_GETFL, 0);
        if (flags < 0) {
                perror("fcntl");
                return FALSE;
        if (flags < 0) {
                perror("fcntl");
                return FALSE;
@@ -147,6 +161,14 @@ gboolean sock_is_nonblocking_mode(gint sock)
        return ((flags & O_NONBLOCK) != 0);
 }
 
        return ((flags & O_NONBLOCK) != 0);
 }
 
+gboolean sock_is_nonblocking_mode(SockInfo *sock)
+{
+       g_assert(sock);
+
+       return is_nonblocking_mode(sock->sock);
+}
+
+
 #ifndef INET6
 static gint sock_connect_by_hostname(gint sock, const gchar *hostname,
                                     gushort port)
 #ifndef INET6
 static gint sock_connect_by_hostname(gint sock, const gchar *hostname,
                                     gushort port)
@@ -245,7 +267,7 @@ SockInfo *sock_connect_nb(const gchar *hostname, gushort port)
 #ifdef INET6
        if ((sock = sock_connect_by_getaddrinfo(hostname, port)) < 0)
                return NULL;
 #ifdef INET6
        if ((sock = sock_connect_by_getaddrinfo(hostname, port)) < 0)
                return NULL;
-       if (sock_set_nonblocking_mode(sock, TRUE) < 0) return NULL;
+       if (set_nonblocking_mode(sock, TRUE) < 0) return NULL;
        ret = sock;
 #else
        if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
        ret = sock;
 #else
        if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
@@ -253,13 +275,13 @@ SockInfo *sock_connect_nb(const gchar *hostname, gushort port)
                return NULL;
        }
 
                return NULL;
        }
 
-       if (sock_set_nonblocking_mode(sock, TRUE) < 0) return NULL;
+       if (set_nonblocking_mode(sock, TRUE) < 0) return NULL;
 
        ret = sock_connect_by_hostname(sock, hostname, port);
 
        if (ret < 0 && errno != EINPROGRESS) {
                if (errno != 0) perror("connect");
 
        ret = sock_connect_by_hostname(sock, hostname, port);
 
        if (ret < 0 && errno != EINPROGRESS) {
                if (errno != 0) perror("connect");
-               sock_close(sock);
+               close(sock);
                return NULL;
        }
 #endif /* INET6 */
                return NULL;
        }
 #endif /* INET6 */
@@ -292,7 +314,7 @@ SockInfo *sock_connect(const gchar *hostname, gushort port)
 
        if (sock_connect_by_hostname(sock, hostname, port) < 0) {
                if (errno != 0) perror("connect");
 
        if (sock_connect_by_hostname(sock, hostname, port) < 0) {
                if (errno != 0) perror("connect");
-               sock_close(sock);
+               close(sock);
                return NULL;
        }
 #endif /* INET6 */
                return NULL;
        }
 #endif /* INET6 */
@@ -356,13 +378,8 @@ SockInfo *sock_connect_with_thread(const gchar *hostname, gushort port)
 }
 #endif
 
 }
 #endif
 
-void sock_sockinfo_free(SockInfo *sockinfo)
-{
-       g_free(sockinfo->hostname);
-       g_free(sockinfo);
-}
 
 
-gint sock_printf(gint sock, const gchar *format, ...)
+gint sock_printf(SockInfo *sock, const gchar *format, ...)
 {
        va_list args;
        gchar buf[BUFFSIZE];
 {
        va_list args;
        gchar buf[BUFFSIZE];
@@ -374,12 +391,19 @@ gint sock_printf(gint sock, const gchar *format, ...)
        return sock_write(sock, buf, strlen(buf));
 }
 
        return sock_write(sock, buf, strlen(buf));
 }
 
-gint sock_write(gint sock, const gchar *buf, gint len)
+gint sock_write(SockInfo *sock, const gchar *buf, gint len)
+{
+       g_return_val_if_fail(sock != NULL, -1);
+
+       return fd_write(sock->sock, buf, len);
+}
+
+gint fd_write(gint fd, const gchar *buf, gint len)
 {
        gint n, wrlen = 0;
 
        while (len) {
 {
        gint n, wrlen = 0;
 
        while (len) {
-               n = write(sock, buf, len);
+               n = write(fd, buf, len);
                if (n <= 0)
                        return -1;
                len -= n;
                if (n <= 0)
                        return -1;
                len -= n;
@@ -390,7 +414,14 @@ gint sock_write(gint sock, const gchar *buf, gint len)
        return wrlen;
 }
 
        return wrlen;
 }
 
-gint sock_read(gint sock, gchar *buf, gint len)
+gint sock_read(SockInfo *sock, gchar *buf, gint len)
+{
+       g_return_val_if_fail(sock != NULL, -1);
+
+       return fd_read(sock->sock, buf, len);
+}
+
+gint fd_read(gint fd, gchar *buf, gint len)
 {
        gchar *newline, *bp = buf;
        gint n;
 {
        gchar *newline, *bp = buf;
        gint n;
@@ -398,11 +429,11 @@ gint sock_read(gint sock, gchar *buf, gint len)
        if (--len < 1)
                return -1;
        do {
        if (--len < 1)
                return -1;
        do {
-               if ((n = recv(sock, bp, len, MSG_PEEK)) <= 0)
+               if ((n = recv(fd, bp, len, MSG_PEEK)) <= 0)
                        return -1;
                if ((newline = memchr(bp, '\n', n)) != NULL)
                        n = newline - bp + 1;
                        return -1;
                if ((newline = memchr(bp, '\n', n)) != NULL)
                        n = newline - bp + 1;
-               if ((n = read(sock, bp, n)) < 0)
+               if ((n = read(fd, bp, n)) < 0)
                        return -1;
                bp += n;
                len -= n;
                        return -1;
                bp += n;
                len -= n;
@@ -412,7 +443,7 @@ gint sock_read(gint sock, gchar *buf, gint len)
        return bp - buf;
 }
 
        return bp - buf;
 }
 
-gint sock_puts(gint sock, const gchar *buf)
+gint sock_puts(SockInfo *sock, const gchar *buf)
 {
        gint ret;
 
 {
        gint ret;
 
@@ -422,18 +453,45 @@ gint sock_puts(gint sock, const gchar *buf)
 }
 
 /* peek at the next socket character without actually reading it */
 }
 
 /* peek at the next socket character without actually reading it */
-gint sock_peek(gint sock)
+gint sock_peek(SockInfo *sock)
 {
        gint n;
        gchar ch;
 
 {
        gint n;
        gchar ch;
 
-       if ((n = recv(sock, &ch, 1, MSG_PEEK)) < 0)
+       g_return_val_if_fail(sock != NULL, -1);
+
+       if ((n = recv(sock->sock, &ch, 1, MSG_PEEK)) < 0)
                return -1;
        else
                return ch;
 }
 
                return -1;
        else
                return ch;
 }
 
-gint sock_close(gint sock)
+gint sock_close(SockInfo *sock)
 {
 {
-       return close(sock);
+       gint rc;
+
+       if (!sock)
+               return 0;
+
+       rc = fd_close(sock->sock); 
+       g_free(sock->hostname);
+       g_free(sock);
+       return rc;
+}
+
+gint fd_close(gint fd)
+{
+       return close(fd);
+}
+
+gint sock_gdk_input_add(SockInfo *sock,
+                        GdkInputCondition condition,
+                        GdkInputFunction function,
+                        gpointer data)
+{
+       g_return_val_if_fail(sock != NULL, -1);
+
+       /* :WK: We have to change some things here becuse most likey
+          function() does take SockInfo * and not an gint */
+       return gdk_input_add(sock->sock, condition, function, data);
 }
 }
index 2522a9b2fd915c69a38f1c764e9491f4c4febb5e..3cb423f4c54915901c97a8fb55c48f51fa2dc7b4 100644 (file)
@@ -25,6 +25,7 @@
 #endif
 
 #include <glib.h>
 #endif
 
 #include <glib.h>
+#include <gdk/gdk.h> /* ugly, just needed for the GdkInputCondition et al. */
 
 #if USE_THREADS
 #  include <pthread.h>
 
 #if USE_THREADS
 #  include <pthread.h>
@@ -43,7 +44,13 @@ typedef enum
 
 struct _SockInfo
 {
 
 struct _SockInfo
 {
+#if USE_GIO
+       GIOChannel *channel;
+       gchar *buf;
+       gint buflen;
+#else
        gint sock;
        gint sock;
+#endif
        gchar *hostname;
        gushort port;
        ConnectionState state;
        gchar *hostname;
        gushort port;
        ConnectionState state;
@@ -54,27 +61,39 @@ struct _SockInfo
 #endif
 };
 
 #endif
 };
 
-gint sock_set_nonblocking_mode         (gint sock, gboolean nonblock);
-gboolean sock_is_nonblocking_mode      (gint sock);
+gint sock_set_nonblocking_mode         (SockInfo *sock, gboolean nonblock);
+gboolean sock_is_nonblocking_mode      (SockInfo *sock);
 
 SockInfo *sock_connect_nb              (const gchar *hostname, gushort port);
 SockInfo *sock_connect                 (const gchar *hostname, gushort port);
 
 
 SockInfo *sock_connect_nb              (const gchar *hostname, gushort port);
 SockInfo *sock_connect                 (const gchar *hostname, gushort port);
 
-gint sock_connect_unix (const gchar *path);
-gint sock_open_unix    (const gchar *path);
-gint sock_accept       (gint sock);
 
 #if USE_THREADS
 SockInfo *sock_connect_with_thread     (const gchar *hostname, gushort port);
 #endif
 
 
 #if USE_THREADS
 SockInfo *sock_connect_with_thread     (const gchar *hostname, gushort port);
 #endif
 
-void sock_sockinfo_free        (SockInfo *sockinfo);
-
-gint sock_printf       (gint sock, const gchar *format, ...)
+gint sock_printf       (SockInfo *sock, const gchar *format, ...)
                         G_GNUC_PRINTF(2, 3);
                         G_GNUC_PRINTF(2, 3);
-gint sock_write                (gint sock, const gchar *buf, gint len);
-gint sock_read         (gint sock, gchar *buf, gint len);
-gint sock_puts         (gint sock, const gchar *buf);
-gint sock_close                (gint sock);
+gint sock_write                (SockInfo *sock, const gchar *buf, gint len);
+gint sock_read         (SockInfo *sock, gchar *buf, gint len);
+gint sock_puts         (SockInfo *sock, const gchar *buf);
+gint sock_close                (SockInfo *sock);
+
+/* wrapper functions */
+gint sock_gdk_input_add          (SockInfo             *sock,
+                          GdkInputCondition     condition,
+                          GdkInputFunction      function,
+                          gpointer              data);
+
+
+/* Functions to directly work on FD.  They are needed for pipes */
+gint fd_connect_unix   (const gchar *path);
+gint fd_open_unix      (const gchar *path);
+gint fd_accept         (gint sock);
+
+gint fd_read           (gint sock, gchar *buf, gint len);
+gint fd_write          (gint sock, const gchar *buf, gint len);
+gint fd_close          (gint sock);
 
 #endif /* __SOCKET_H__ */
 
 #endif /* __SOCKET_H__ */
+
index d308f99b010cd21eab22f4c873568a369bfa5a16..f7784a08d532859c2aad496da6a8981e9be9f155 100644 (file)
@@ -63,6 +63,7 @@
 #include "utils.h"
 #include "gtkutils.h"
 #include "filesel.h"
 #include "utils.h"
 #include "gtkutils.h"
 #include "filesel.h"
+#include "manage_window.h"
 #include "alertpanel.h"
 #include "inputdialog.h"
 #include "statusbar.h"
 #include "alertpanel.h"
 #include "inputdialog.h"
 #include "statusbar.h"
@@ -2520,6 +2521,9 @@ static void summary_key_pressed(GtkWidget *widget, GdkEventKey *event,
                        if (alertpanel(_("Exit"), _("Exit this program?"),
                                       _("OK"), _("Cancel"), NULL)
                                       == G_ALERTDEFAULT) {
                        if (alertpanel(_("Exit"), _("Exit this program?"),
                                       _("OK"), _("Cancel"), NULL)
                                       == G_ALERTDEFAULT) {
+                               manage_window_focus_in
+                                       (summaryview->mainwin->window,
+                                        NULL, NULL);
                                app_will_exit(NULL, summaryview->mainwin);
                        }
                }
                                app_will_exit(NULL, summaryview->mainwin);
                        }
                }
index 6c01c73e6ec9ae165afbb1e311fd0054efed9f38..5052db1d9dbb82741d5f9f1412b4a3d5bfda96fa 100644 (file)
@@ -1028,12 +1028,43 @@ gchar **strsplit_with_quote(const gchar *str, const gchar *delim,
        return str_array;
 }
 
        return str_array;
 }
 
+/*
+ * We need this wrapper around g_get_home_dir(), so that
+ * we can fix some Windoze things here.  Should be done in glibc of course
+ * but as long as we are not able to do our own extensions to glibc, we do 
+ * it here.
+ */
+gchar *get_home_dir(void)
+{
+#if HAVE_DOSISH_SYSTEM
+    static gchar *home_dir;
+
+    if (!home_dir) {
+        home_dir = read_w32_registry_string(NULL,
+                                            "Software\\Sylpheed", "HomeDir" );
+        if (!home_dir || !*home_dir) {
+            if (getenv ("HOMEDRIVE") && getenv("HOMEPATH")) {
+                const char *s = g_get_home_dir();
+                if (s && *s)
+                    home_dir = g_strdup (s);
+            }
+            if (!home_dir || !*home_dir) 
+                home_dir = g_strdup ("c:\\sylpheed");
+        }
+        debug_print("initialized home_dir to `%s'\n", home_dir);
+    }
+    return home_dir;
+#else /* standard glib */
+    return g_get_home_dir();
+#endif
+}
+
 gchar *get_rc_dir(void)
 {
        static gchar *rc_dir = NULL;
 
        if (!rc_dir)
 gchar *get_rc_dir(void)
 {
        static gchar *rc_dir = NULL;
 
        if (!rc_dir)
-               rc_dir = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S,
+               rc_dir = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S,
                                     RC_DIR, NULL);
 
        return rc_dir;
                                     RC_DIR, NULL);
 
        return rc_dir;
index 6f6ac12a42dd507232beb796352e262bd79c3769..1959fb0b4d9f9fe61dbcd5d534062d37756c7b08 100644 (file)
 #  include <wchar.h>
 #endif
 
 #  include <wchar.h>
 #endif
 
+
+/* The AC_CHECK_SIZEOF() in configure fails for some machines.
+ * we provide some fallback values here */
+#if !SIZEOF_UNSIGNED_SHORT
+  #undef SIZEOF_UNSIGNED_SHORT
+  #define SIZEOF_UNSIGNED_SHORT 2
+#endif
+#if !SIZEOF_UNSIGNED_INT
+  #undef SIZEOF_UNSIGNED_INT
+  #define SIZEOF_UNSIGNED_INT 4
+#endif
+#if !SIZEOF_UNSIGNED_LONG
+  #undef SIZEOF_UNSIGNED_LONG
+  #define SIZEOF_UNSIGNED_LONG 4
+#endif
+
+#ifndef HAVE_U32_TYPEDEF
+  #undef u32       /* maybe there is a macro with this name */
+  #if SIZEOF_UNSIGNED_INT == 4
+    typedef unsigned int u32;
+  #elif SIZEOF_UNSIGNED_LONG == 4
+    typedef unsigned long u32;
+  #else
+    #error no typedef for u32
+  #endif
+  #define HAVE_U32_TYPEDEF
+#endif
+
+
 #define CHDIR_RETURN_IF_FAIL(dir) \
 { \
        if (change_dir(dir) < 0) return; \
 #define CHDIR_RETURN_IF_FAIL(dir) \
 { \
        if (change_dir(dir) < 0) return; \
@@ -205,6 +234,7 @@ gchar **strsplit_with_quote         (const gchar    *str,
                                         gint            max_tokens);
 
 /* return static strings */
                                         gint            max_tokens);
 
 /* return static strings */
+gchar *get_home_dir            (void);
 gchar *get_rc_dir              (void);
 gchar *get_news_cache_dir      (void);
 gchar *get_imap_cache_dir      (void);
 gchar *get_rc_dir              (void);
 gchar *get_news_cache_dir      (void);
 gchar *get_imap_cache_dir      (void);