+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-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-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() ¤ËÊѹ¹¡£
/* 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
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
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 \
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 \
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 \
- export.c export.h \
gtkstext.c gtkstext.h \
grouplist_dialog.c grouplist_dialog.h \
headers.c headers.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"
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;
+#endif
gchar buf[1024];
gint i;
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",
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);
+#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);
"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);
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;
+ SockInfo *sock;
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;
}
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 (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,
- data);
+ data);
} else {
- atm->terminate(source, data);
+ atm->terminate(sock, data);
}
}
+
#include <glib.h>
+#include "socket.h"
+
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;
- gint (*handler)(gint source, gpointer data);
+ gint (*handler)(SockInfo *source, gpointer data);
};
struct _Automaton
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);
-void automaton_input_cb(gpointer data, gint source,
+void automaton_input_cb(gpointer data, gint dummy_source,
GdkInputCondition condition);
#endif /* __AUTOMATON_H__ */
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);
}
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) {
- 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);
- sock_write(pipe_fds[1], "0\n", 2);
+ fd_write(pipe_fds[1], "0\n", 2);
close(pipe_fds[1]);
_exit(0);
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];
return esmtp_ok(sock);
}
-gint esmtp_auth_login(gint sock)
+gint esmtp_auth_login(SockInfo *sock)
{
gchar buf[MSGBUFSIZE];
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)
{
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) {
#define __ESMTP_H__
#include <glib.h>
+#include "socket.h"
typedef enum
{
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);
-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__ */
#include "gtkutils.h"
#include "manage_window.h"
#include "folder.h"
+#include "utils.h"
static GtkWidget *window;
static GtkWidget *src_entry;
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
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
+#include "main.h"
#include "filesel.h"
#include "manage_window.h"
#include "gtkutils.h"
}
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);
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
- path = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S,
+ path = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S,
folder_path, NULL);
}
#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;
}
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;
{
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,
- params->start.index, params->end.index) )
+ params->start.index, params->end.index) );
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;
/* top of buffer */
if (mark.index == 0) {
- TDEBUG ( ("%s(%d) top of buffer", __FILE__, __LINE__) );
+ XDEBUG ( ("%s(%d) top of buffer", __FILE__, __LINE__) );
return;
}
/* 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;
- 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 */
- 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);
- 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;
- 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 */
- 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_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);
+ }
else
{
gint old_pos = editable->current_pos;
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);
-static gint imap_auth (gint sock,
+static gint imap_auth (SockInfo *sock,
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);
-static gint imap_get_envelope (gint sock,
+static gint imap_get_envelope (SockInfo *sock,
gint first,
gint last);
#if 0
-static gint imap_search (gint sock,
+static gint imap_search (SockInfo *sock,
GSList *numlist);
#endif
-static gint imap_get_message (gint sock,
+static gint imap_get_message (SockInfo *sock,
gint num,
const gchar *filename);
-static gint imap_copy_message (gint sock,
+static gint imap_copy_message (SockInfo *sock,
gint num,
const gchar *destfolder);
-static gint imap_store (gint sock,
+static gint imap_store (SockInfo *sock,
gint first,
gint last,
gchar *sub_cmd);
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 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);
-static void imap_gen_send (gint sock,
+static void imap_gen_send (SockInfo *sock,
const gchar *format, ...);
-static gint imap_gen_recv (gint sock,
+static gint imap_gen_recv (SockInfo *sock,
gchar *buf,
gint size);
{
gchar buf[IMAPBUFSIZE];
IMAPSession *session;
- gint imap_sock;
+ SockInfo *imap_sock;
g_return_val_if_fail(server != NULL, NULL);
return NULL;
if (imap_auth(imap_sock, user, pass) != IMAP_SUCCESS) {
imap_logout(imap_sock);
- close(imap_sock);
+ sock_close(imap_sock);
return NULL;
}
void imap_session_destroy(IMAPSession *session)
{
- close(SESSION(session)->sock);
+ sock_close(SESSION(session)->sock);
+ SESSION(session)->sock = NULL;
g_free(session->mbox);
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);
}
-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);
- return -1;
+ return NULL;
}
- sock = sockinfo->sock;
- sock_sockinfo_free(sockinfo);
imap_cmd_count = 0;
if (imap_noop(sock) != IMAP_SUCCESS) {
sock_close(sock);
- return -1;
+ return NULL;
}
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;
return ok;
}
-static gint imap_logout(gint sock)
+static gint imap_logout(SockInfo *sock)
{
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);
}
-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;
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];
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;
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;
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)
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)
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];
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);
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;
return IMAP_SUCCESS;
}
-static gint imap_ok(gint sock, GPtrArray *argbuf)
+static gint imap_ok(SockInfo *sock, GPtrArray *argbuf)
{
gint ok;
gchar buf[IMAPBUFSIZE];
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];
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;
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);
/*
* 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
#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);
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);
static gint get_spool (FolderItem *dest,
const gchar *mbox);
+
static void inc_finished(MainWindow *mainwin)
{
FolderItem *item;
{
IncProgressDialog *inc_dialog;
IncSession *session;
+ gchar *text[3];
session = inc_session_new(account);
if (!session) return;
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_dialog->mainwin = mainwin;
for (list = queue_list; list != NULL; list = list->next) {
IncSession *session = list->data;
+ gchar *text[3];
+
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);
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;
static void inc_start(IncProgressDialog *inc_dialog)
{
IncSession *session;
+ GtkCList *clist = GTK_CLIST(inc_dialog->dialog->clist);
Pop3State *pop3_state;
IncState inc_state;
+ gint num = 0;
while (inc_dialog->queue_list != NULL) {
session = inc_dialog->queue_list->data;
}
}
+ 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);
+ 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
inc_session_destroy(session);
inc_dialog->queue_list =
g_list_remove(inc_dialog->queue_list, session);
+
+ num++;
}
while (inc_dialog->queue_list != NULL) {
inc_progress_dialog_destroy(inc_dialog);
}
+
static IncState inc_pop3_session_do(IncSession *session)
{
Pop3State *pop3_state = session->pop3_state;
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);
- 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;
+ atm->help_sock = sockinfo;
#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();
#if USE_THREADS
//pthread_join(sockinfo->connect_thr, NULL);
#endif
- sock_sockinfo_free(sockinfo);
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);
gtk_timeout_remove(atm->timeout_tag);
atm->timeout_tag = 0;
}
- if (source > 0) {
+ if (source) {
sock_close(source);
gtk_main_quit();
}
#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)
}
return msgs;
-}
+}
\ No newline at end of file
#include "procmsg.h"
#include "inc.h"
#include "import.h"
+#include "manage_window.h"
#include "alertpanel.h"
#include "addressbook.h"
#include "compose.h"
#include "gtkutils.h"
gchar *prog_version;
+gchar *startup_dir;
gboolean debug_mode = FALSE;
static gint lock_socket = -1;
#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);
- 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_free(userrc);
prog_version = PROG_VERSION;
+ startup_dir = g_get_current_dir();
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();
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
}
}
+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;
_("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)
/* delete unix domain socket */
gdk_input_remove(lock_socket_tag);
- sock_close(lock_socket);
+ fd_close(lock_socket);
filename = get_socket_name();
unlink(filename);
gchar *path;
path = get_socket_name();
- uxsock = sock_connect_unix(path);
+ uxsock = fd_connect_unix(path);
if (uxsock < 0) {
unlink(path);
- return sock_open_unix(path);
+ return fd_open_unix(path);
}
/* remote command mode */
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)
- sock_write(uxsock, "receive\n", 8);
+ fd_write(uxsock, "receive\n", 8);
else if (cmd.compose) {
gchar *compose_str;
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
- sock_write(uxsock, "popup\n", 6);
+ fd_write(uxsock, "popup\n", 6);
- sock_close(uxsock);
+ fd_close(uxsock);
return -1;
}
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);
else
compose_new(NULL);
}
+
#include <gtk/gtkwidget.h>
extern gchar *prog_version;
+extern gchar *startup_dir;
extern gboolean debug_mode;
void app_will_exit (GtkWidget *widget, gpointer data);
}
summary_change_display_item(mainwin->summaryview);
+ summary_redisplay_msg(mainwin->summaryview);
headerview_set_visibility(mainwin->messageview->headerview,
prefs_common.display_header_pane);
}
_("Empty all messages in trash?"),
_("Yes"), _("No"), NULL) != G_ALERTDEFAULT)
return;
+ manage_window_focus_in(mainwin->window, NULL, NULL);
}
procmsg_empty_trash();
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;
+ 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);
}
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 :
-/* 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__ */
-/* 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]);
}
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);
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;
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) {
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)
mimeview_update_names(mimeview);
mimeview_update_signature_info(mimeview);
}
-#endif /*USE_GPGME*/
+#endif /* USE_GPGME */
{
gchar buf[NNTPBUFSIZE];
NNTPSession *session;
- gint nntp_sock;
+ SockInfo *nntp_sock;
g_return_val_if_fail(server != NULL, NULL);
void news_session_destroy(NNTPSession *session)
{
- close(SESSION(session)->sock);
+ sock_close(SESSION(session)->sock);
+ SESSION(session)->sock = NULL;
g_free(session->group);
}
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;
- 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;
}
- }
+ }
f = fopen(filename, "r");
- while (fgets(buf, NNTPBUFSIZE, f))
- {
+ while (fgets(buf, NNTPBUFSIZE, f)) {
char * s;
len = 0;
s = g_strdup(buf);
group_list = g_slist_append(group_list, s);
- }
+ }
fclose(f);
g_free(filename);
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);
- return -1;
+ return NULL;
}
- sock = sockinfo->sock;
- sock_sockinfo_free(sockinfo);
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;
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];
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);
}
-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);
}
-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);
}
-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);
}
-gint nntp_next(gint sock, gint *num, gchar **msgid)
+gint nntp_next(SockInfo *sock, gint *num, gchar **msgid)
{
gint ok;
gint resp;
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];
return NN_SUCCESS;
}
-gint nntp_post(gint sock, FILE *fp)
+gint nntp_post(SockInfo *sock, FILE *fp)
{
gint ok;
gchar buf[NNTPBUFSIZE];
return NN_SUCCESS;
}
-gint nntp_newgroups(gint sock)
+gint nntp_newgroups(SockInfo *sock)
{
return NN_SUCCESS;
}
-gint nntp_newnews(gint sock)
+gint nntp_newnews(SockInfo *sock)
{
return NN_SUCCESS;
}
-gint nntp_mode(gint sock, gboolean stream)
+gint nntp_mode(SockInfo *sock, gboolean stream)
{
gint 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];
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];
return ok;
}
-gint nntp_ok(gint sock, gchar *argbuf)
+gint nntp_ok(SockInfo *sock, gchar *argbuf)
{
gint ok;
gchar buf[NNTPBUFSIZE];
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;
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;
a function is needed to read the newsgroups list.
*/
-gint nntp_list(gint sock)
+gint nntp_list(SockInfo *sock)
{
GList * result = NULL;
#ifndef __NNTP_H__
#define __NNTP_H__
+#include "socket.h"
+
#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_AUTHCONT 9
+#define NN_AUTHCONT 9
#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 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__ */
#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"
-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];
return -1;
}
-gint pop3_getauth_user_send(gint sock, gpointer data)
+gint pop3_getauth_user_send(SockInfo *sock, gpointer data)
{
Pop3State *state = (Pop3State *)data;
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;
return -1;
}
-gint pop3_getauth_pass_send(gint sock, gpointer data)
+gint pop3_getauth_pass_send(SockInfo *sock, gpointer data)
{
Pop3State *state = (Pop3State *)data;
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;
}
}
-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;
- 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);
*(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);
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;
}
}
-gint pop3_getrange_stat_send(gint sock, gpointer data)
+gint pop3_getrange_stat_send(SockInfo *sock, gpointer data)
{
Pop3State *state = (Pop3State *)data;
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];
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;
}
-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];
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;
}
-gint pop3_getrange_uidl_recv(gint sock, gpointer data)
+gint pop3_getrange_uidl_recv(SockInfo *sock, gpointer data)
{
Pop3State *state = (Pop3State *)data;
gboolean nb;
return POP3_LOGOUT_SEND;
}
-gint pop3_retr_send(gint sock, gpointer data)
+gint pop3_retr_send(SockInfo *sock, gpointer data)
{
Pop3State *state = (Pop3State *)data;
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;
return -1;
}
-gint pop3_delete_send(gint sock, gpointer data)
+gint pop3_delete_send(SockInfo *sock, gpointer data)
{
Pop3State *state = (Pop3State *)data;
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;
return -1;
}
-gint pop3_logout_send(gint sock, gpointer data)
+gint pop3_logout_send(SockInfo *sock, gpointer data)
{
Pop3State *state = (Pop3State *)data;
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;
return -1;
}
-static gint pop3_ok(gint sock, gchar *argbuf)
+static gint pop3_ok(SockInfo *sock, gchar *argbuf)
{
gint ok;
gchar buf[POPBUFSIZE + 1];
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;
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;
#include <glib.h>
+#include "socket.h"
+
typedef enum {
POP3_GREETING_RECV,
POP3_GETAUTH_USER_SEND,
#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__ */
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')
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;
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"));
#ifndef __PREFS_ACCOUNT_H__
#define __PREFS_ACCOUNT_H__
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <glib.h>
typedef struct _PrefsAccount PrefsAccount;
GtkWidget *chkbtn_folder_unread;
GtkWidget *chkbtn_transhdr;
+
GtkWidget *chkbtn_swapfrom;
GtkWidget *chkbtn_hscrollbar;
GtkWidget *entry_datefmt;
&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},
+
+ /* Display: Summary View */
{"enable_swap_from", "TRUE", &prefs_common.swap_from, P_BOOL,
&display.chkbtn_swapfrom,
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},
+#endif /* __MINGW32__ */
{"default_signkey", CS_AUTO, &prefs_common.default_signkey, P_STRING,
&privacy.optmenu_default_signkey,
prefs_common_default_signkey_set_data_from_optmenu,
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);
display.button_textfont = button_textfont;
display.chkbtn_folder_unread = chkbtn_folder_unread;
-
display.chkbtn_transhdr = chkbtn_transhdr;
+
display.chkbtn_swapfrom = chkbtn_swapfrom;
display.chkbtn_hscrollbar = chkbtn_hscrollbar;
display.entry_datefmt = entry_datefmt;
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"));
+#endif
hbox1 = gtk_hbox_new (FALSE, 8);
gtk_widget_show (hbox1);
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;
gtk_widget_hide(quote_color_win);
textview_update_message_colors();
+ main_window_reflect_prefs_all();
}
static void prefs_quote_colors_dialog_create(void)
#ifndef __PREFS_COMMON_H__
#define __PREFS_COMMON_H__
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <glib.h>
#include "mainwindow.h"
/*
* 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
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);
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);
+ 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->clist = clist;
return progress;
}
#ifndef __PROGRESS_H__
#define __PROGRESS_H__
+#include <glib.h>
#include <gtk/gtkwidget.h>
typedef struct _ProgressDialog ProgressDialog;
GtkWidget *label;
GtkWidget *cancel_btn;
GtkWidget *progressbar;
+ GtkWidget *clist;
};
ProgressDialog *progress_dialog_create (void);
#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;
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;
return 0;
}
-gint recv_write(gint sock, FILE *fp)
+gint recv_write(SockInfo *sock, FILE *fp)
{
gchar buf[BUFFSIZE];
gint len;
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;
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;
#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__ */
#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]))
GpgmeError err;
GpgmeData sig = NULL, text = NULL;
GpgmeSigStat status = GPGME_SIG_STAT_NONE;
+ GpgmegtkSigStatus statuswindow;
const char *result = NULL;
+ statuswindow = gpgmegtk_sig_status_create ();
+
err = gpgme_new (&ctx);
if (err) {
g_warning ("gpgme_new 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:
- result = sig_status_to_string(status);
+ result = gpgmegtk_sig_status_to_string(status);
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);
+ gpgmegtk_sig_status_destroy(statuswindow);
}
static const char *
return -1; /* error */
}
-static int
+int
set_signers (GpgmeCtx ctx, PrefsAccount *ac)
{
GSList *key_list = NULL;
};
-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 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);
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);
}
err = gpgme_recipients_new (&sk.rset);
if (err) {
g_message ("** failed to allocate recipients set: %s",
- gpgme_strerror (err) );
+ gpgme_strerror (err));
return NULL;
}
gtk_main ();
if (recp_names)
recp_names = recp_names->next;
- } while (sk.okay && recp_names );
+ } while (sk.okay && recp_names);
close_dialog (&sk);
}
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;
+
+ /* 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;
- 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 = 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;
- 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;
- 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);
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;
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);
- if (err) {
- g_message ("** gpgme_new failed: %s",
- gpgme_strerror (err));
- return;
- }
+ g_assert (!err);
sk->select_ctx = ctx;
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;
- gpgme_release (ctx);
return;
}
update_progress (sk, ++running, pattern);
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;
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)
{
- sort_keys ( (struct select_keys_s*)data, COL_EMAIL );
+ sort_keys ((struct select_keys_s*)data, COL_EMAIL);
}
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) \
{ \
- if ((f) < 0) { \
+ if (!(f)) { \
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; \
} \
}
if (smtp_quit(smtp_sock) != SM_OK) \
log_warning("Error occurred while sending QUIT\n"); \
sock_close(smtp_sock); \
+ smtp_sock = NULL; \
return -1; \
} \
}
const gchar* passwd, gboolean use_smtp_auth,
FILE *fp)
{
- gint smtp_sock;
+ SockInfo *smtp_sock;
gchar buf[BUFFSIZE];
GSList *cur;
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)
{
- SockInfo *sockinfo;
- gint sock;
+ SockInfo *sock;
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);
- 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(),
log_warning(_("Error occurred while sending HELO\n"));
sock_close(sock);
- return -1;
+ return NULL;
}
#define __SESSION_H__
#include <glib.h>
+#include "socket.h"
typedef struct _Session Session;
{
SessionType type;
- gint sock;
+ SockInfo *sock;
gchar *server;
gboolean connected;
--- /dev/null
+/* 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 */
--- /dev/null
+/* 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 */
--- /dev/null
+/* 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 */
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);
}
}
-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)
{
return smtp_ok(sock);
}
-gint smtp_rcpt(gint sock, const gchar *to)
+gint smtp_rcpt(SockInfo *sock, const gchar *to)
{
gchar buf[MSGBUFSIZE];
return smtp_ok(sock);
}
-gint smtp_data(gint sock)
+gint smtp_data(SockInfo *sock)
{
sock_printf(sock, "DATA\r\n");
if (verbose)
return smtp_ok(sock);
}
-gint smtp_rset(gint sock)
+gint smtp_rset(SockInfo *sock)
{
sock_printf(sock, "RSET\r\n");
if (verbose)
return smtp_ok(sock);
}
-gint smtp_quit(gint sock)
+gint smtp_quit(SockInfo *sock)
{
sock_printf(sock, "QUIT\r\n");
if (verbose)
return smtp_ok(sock);
}
-gint smtp_eom(gint sock)
+gint smtp_eom(SockInfo *sock)
{
sock_printf(sock, ".\r\n");
if (verbose)
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) {
#include <glib.h>
+#include "socket.h"
+
#define SMTPBUFSIZE 256
#define SM_OK 0
#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);
-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__ */
#include "socket.h"
+#if USE_GIO
+#error USE_GIO is currently not supported
+#endif
+
#define BUFFSIZE 8192
#ifndef INET6
gushort port);
#endif
-gint sock_connect_unix(const gchar *path)
+
+gint fd_connect_unix(const gchar *path)
{
gint sock;
struct sockaddr_un addr;
return sock;
}
-gint sock_open_unix(const gchar *path)
+gint fd_open_unix(const gchar *path)
{
gint sock;
struct sockaddr_un addr;
return sock;
}
-gint sock_accept(gint sock)
+gint fd_accept(gint sock)
{
struct sockaddr_in caddr;
gint 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;
- flags = fcntl(sock, F_GETFL, 0);
+ flags = fcntl(fd, F_GETFL, 0);
if (flags < 0) {
perror("fcntl");
return -1;
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;
- flags = fcntl(sock, F_GETFL, 0);
+ flags = fcntl(fd, F_GETFL, 0);
if (flags < 0) {
perror("fcntl");
return FALSE;
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)
#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) {
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");
- sock_close(sock);
+ close(sock);
return NULL;
}
#endif /* INET6 */
if (sock_connect_by_hostname(sock, hostname, port) < 0) {
if (errno != 0) perror("connect");
- sock_close(sock);
+ close(sock);
return NULL;
}
#endif /* INET6 */
}
#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];
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) {
- n = write(sock, buf, len);
+ n = write(fd, buf, len);
if (n <= 0)
return -1;
len -= n;
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;
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;
- if ((n = read(sock, bp, n)) < 0)
+ if ((n = read(fd, bp, n)) < 0)
return -1;
bp += n;
len -= n;
return bp - buf;
}
-gint sock_puts(gint sock, const gchar *buf)
+gint sock_puts(SockInfo *sock, const gchar *buf)
{
gint ret;
}
/* peek at the next socket character without actually reading it */
-gint sock_peek(gint sock)
+gint sock_peek(SockInfo *sock)
{
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;
}
-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);
}
#endif
#include <glib.h>
+#include <gdk/gdk.h> /* ugly, just needed for the GdkInputCondition et al. */
#if USE_THREADS
# include <pthread.h>
struct _SockInfo
{
+#if USE_GIO
+ GIOChannel *channel;
+ gchar *buf;
+ gint buflen;
+#else
gint sock;
+#endif
gchar *hostname;
gushort port;
ConnectionState state;
#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);
-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
-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);
-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__ */
+
#include "utils.h"
#include "gtkutils.h"
#include "filesel.h"
+#include "manage_window.h"
#include "alertpanel.h"
#include "inputdialog.h"
#include "statusbar.h"
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);
}
}
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)
- 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;
# 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; \
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);