sync with Hiroyuki's 0.5.0claws2-3
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Sun, 15 Jul 2001 13:42:30 +0000 (13:42 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Sun, 15 Jul 2001 13:42:30 +0000 (13:42 +0000)
23 files changed:
ChangeLog
ChangeLog.claws
ChangeLog.jp
INSTALL
INSTALL.jp
README
README.jp
TODO
TODO.jp
configure.in
src/Makefile.am
src/account.c
src/defs.h
src/folder.c
src/folderview.c
src/grouplistdialog.c [moved from src/grouplist_dialog.c with 53% similarity]
src/grouplistdialog.h [moved from src/grouplist_dialog.h with 90% similarity]
src/inc.c
src/news.c
src/news.h
src/recv.c
src/recv.h
src/send.c

index 1f648a3..8d78e0e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,59 @@
+2001-07-15
+
+       * README
+         README.jp
+         INSTALL
+         INSTALL.jp
+         TODO
+         TODO.jp: updated.
+       * src/grouplistdialog.c: grouplist_dialog_set_list(): update UI
+         while retrieving newsgroup list.
+         grouplist_dialog_create(): added entry widget and status label.
+         grouplist_recv_func(): new.
+         refresh_clicked(): added exclusive lock variable.
+         clist_selected(): set text entry when the CList is selected.
+         renamed from group_clist_select().
+         entry_activated(): new.
+         grouplist_clear(): renamed from grouplist_free(). Also clears
+         list and entry widget.
+       * src/news.c: news_get_group_list(): sped up the list appending
+         (g_slist_append() becomes very slow if list size is large).
+       * src/defs.h: added UI_REFRESH_INTERVAL definition.
+         Changed the definition of NEWSGROUP_LIST.
+       * src/recv.c: recv_write()
+         src/send.c: send_message_smtp(): changed the UI refresh interval
+         to UI_REFRESH_INTERVAL (50msec).
+       * src/account.c: account_add(): fixed a bug that didn't update
+         folder tree when a news account was added.
+       * src/grouplistdialog.c: made exclusive lock variable global, and
+         lock at grouplist_dialog_set_list().
+
+2001-07-15
+
+       * src/grouplistdialog.c: ok_clicked(), cancel_clicked(): don't
+         quit main loop if gtk_main_level() is 1.
+         grouplist_dialog_set_list(): freeze CList while appending the list.
+         grouplist_dialog(): show dialog before updating the list.
+
+2001-07-14
+
+       * src/folder.c: folder_write_list_recursive(): add the attribute
+         `collapsed' if a node have some children.
+       * src/grouplistdialog.[ch]: new. Newsgroups can be selected from
+         the list.
+       * src/news.[ch]:
+         news_get_group_list(): new. It returns newsgroup list.
+         news_remove_group_list(): new. It removes newsgroup list cache.
+       * src/folderview.c: folderview_new_news_group_cb(): call
+         grouplist_dialog() instead of input_dialog().
+
+2001-07-12
+
+       * autogen.sh: modified.
+       * src/folder.[ch]
+         src/folderview.c: made expand/collapse state of folders persistent
+         (thanks to Alfons).
+
 2001-07-06
 
        * version 0.5.0
index 26a3b67..391c7c6 100644 (file)
@@ -1,3 +1,9 @@
+2001-07-15 [alfons]
+
+       0.5.1claws2
+       
+       sync with Hiroyuki's 0.5.0cvs2-3
+
 2001-07-15 [christoph]
 
        * src/procmsg.c
index 684ae60..021b976 100644 (file)
@@ -1,3 +1,63 @@
+2001-07-15
+
+       * README
+         README.jp
+         INSTALL
+         INSTALL.jp
+         TODO
+         TODO.jp: ¹¹¿·¡£
+       * src/grouplistdialog.c: grouplist_dialog_set_list(): ¥Ë¥å¡¼¥¹
+         ¥°¥ë¡¼¥×¤Î¥ê¥¹¥È¤ò¼õ¿®Ãæ¤Ë UI ¤ò¹¹¿·¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+         grouplist_dialog_create(): ¥¨¥ó¥È¥ê¥¦¥£¥¸¥§¥Ã¥È¤È¥¹¥Æ¡¼¥¿¥¹¥é¥Ù¥ë
+         ¤òÄɲá£
+         grouplist_recv_func(): ¿·µ¬¡£
+         refresh_clicked(): ÇÓ¾¥í¥Ã¥¯ÊÑ¿ô¤òÄɲá£
+         clist_selected(): CList ¤¬ÁªÂò¤µ¤ì¤¿¤é¥Æ¥­¥¹¥È¥¨¥ó¥È¥ê¤ò¥»¥Ã¥È¤¹¤ë
+         ¤è¤¦¤Ë¤·¤¿¡£ group_clist_select() ¤«¤é²þ̾¡£
+         entry_activated(): ¿·µ¬¡£
+         grouplist_clear(): grouplist_free() ¤«¤é²þ̾¡£¥ê¥¹¥È¤È¥¨¥ó¥È¥ê
+         ¥¦¥£¥¸¥§¥Ã¥È¤â¥¯¥ê¥¢¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+       * src/news.c: news_get_group_list(): ¥ê¥¹¥È¤ÎÄɲäò¹â®²½
+         (g_slist_append() ¤Ï¥ê¥¹¥È¤Î¥µ¥¤¥º¤¬Â礭¤¯¤Ê¤ë¤ÈÈó¾ï¤ËÃÙ¤¯¤Ê¤ë)¡£
+       * src/defs.h: UI_REFRESH_INTERVAL ¤ÎÄêµÁ¤òÄɲá£
+         NEWSGROUP_LIST ¤ÎÄêµÁ¤òÊѹ¹¡£
+       * src/recv.c: recv_write()
+         src/send.c: send_message_smtp(): UI ¤Î¹¹¿·´Ö³Ö¤ò UI_REFRESH_INTERVAL
+         (50msec) ¤ËÊѹ¹¡£
+       * src/account.c: account_add(): ¥Ë¥å¡¼¥¹¥¢¥«¥¦¥ó¥È¤òÄɲä·¤¿¤È¤­¤Ë
+         ¥Õ¥©¥ë¥À¥Ä¥ê¡¼¤ò¹¹¿·¤·¤Æ¤¤¤Ê¤«¤Ã¤¿¥Ð¥°¤ò½¤Àµ¡£
+       * src/grouplistdialog.c: ÇÓ¾¥í¥Ã¥¯ÊÑ¿ô¤ò¥°¥í¡¼¥Ð¥ë¤Ë¤·¡¢
+         grouplist_dialog_set_list() ¤Ç¥í¥Ã¥¯¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+
+2001-07-15
+
+       * src/grouplistdialog.c: ok_clicked(), cancel_clicked():
+         gtk_main_level() ¤¬ 1 ¤Ê¤é¥á¥¤¥ó¥ë¡¼¥×¤òÈ´¤±¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£
+         grouplist_dialog_set_list(): ¥ê¥¹¥È¤ÎÄɲÃÃæ¤Ë CList ¤ò¥Õ¥ê¡¼¥º
+         ¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+         grouplist_dialog(): ¥ê¥¹¥È¤ò¹¹¿·¤¹¤ëÁ°¤Ë¥À¥¤¥¢¥í¥°¤òɽ¼¨¤¹¤ë
+         ¤è¤¦¤Ë¤·¤¿¡£
+
+2001-07-14
+
+       * src/folder.c: folder_write_list_recursive(): ¥Î¡¼¥É¤¬»Ò¤ò»ý¤Ã¤Æ
+         ¤¤¤ì¤Ð `collapsed' Â°À­¤òÄɲ乤ë¤è¤¦¤Ë¤·¤¿¡£
+       * src/grouplistdialog.[ch]: ¿·µ¬¡£¥Ë¥å¡¼¥¹¥°¥ë¡¼¥×¤ò°ìÍ÷¤«¤éÁªÂò
+         ²Äǽ¡£
+       * src/news.[ch]
+         news_get_group_list(): ¿·µ¬¡£¥Ë¥å¡¼¥¹¥°¥ë¡¼¥×¤Î¥ê¥¹¥È¤òÊÖ¤¹¡£
+         news_remove_group_list(): ¿·µ¬¡£¥Ë¥å¡¼¥¹¥°¥ë¡¼¥×¥ê¥¹¥È¤Î¥­¥ã¥Ã¥·¥å
+         ¤òºï½ü¤¹¤ë¡£
+       * src/folderview.c: folderview_new_news_group_cb(): input_dialog()
+         ¤ÎÂå¤ï¤ê¤Ë grouplist_dialog() ¤ò¸Æ¤Ö¤è¤¦¤Ë¤·¤¿¡£
+
+2001-07-12
+
+       * autogen.sh: ½¤Àµ¡£
+       * src/folder.[ch]
+         src/folderview.c: ¥Õ¥©¥ë¥À¤Î³«ÊľõÂÖ¤¬Êݸ¤µ¤ì¤ë¤è¤¦¤Ë¤·¤¿
+         (Alfons ¤µ¤ó thanks)¡£
+
 2001-07-06
 
        * version 0.5.0
diff --git a/INSTALL b/INSTALL
index 8d18fd1..a5ee42d 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -3,13 +3,13 @@ Installation
 
 This program requires GTK+ 1.2.6 or higher to be compiled.
 
-This program is developed on Debian GNU/Linux (woody)
-(Linux 2.2.x + glibc 2.2), so it is possible not to work correctly
+This program is developed on Debian GNU/Linux (woody/sid)
+(Linux 2.4.x + glibc 2.2), so it is possible not to work correctly
 on the other environment.
 
 It is confirmed to work on the following environments:
 
-o Debian GNU/Linux (woody/sid) (glibc 2.2)
+o Debian GNU/Linux (woody/sid) (glibc 2.2.x)
 o Kondara MNU/Linux (glibc 2.1.x)
 o Vine Linux 1.1 (glibc 2.0.x + libwcsmbs)
 o Vine Linux 2.0 (glibc 2.1.x) (Intel, PPC)
index a8104e7..247eec4 100644 (file)
@@ -3,12 +3,12 @@
 
 ¤³¤Î¥×¥í¥°¥é¥à¤ò¥³¥ó¥Ñ¥¤¥ë¤¹¤ë¤Ë¤Ï GTK+ 1.2.6 °Ê¹ß¤¬É¬ÍפǤ¹¡£
 
-¤³¤Î¥×¥í¥°¥é¥à¤Ï Debian GNU/Linux (woody) (Linux 2.2.x + glibc 2.2)
+¤³¤Î¥×¥í¥°¥é¥à¤Ï Debian GNU/Linux (woody/sid) (Linux 2.4.x + glibc 2.2.x)
 ¾å¤Ç³«È¯¤µ¤ì¤Æ¤¤¤ë¤¿¤á¡¢Â¾¤Î´Ä¶­¤Ç¤Ï¤¦¤Þ¤¯Æ°ºî¤·¤Ê¤¤²ÄǽÀ­¤¬¤¢¤ê¤Þ¤¹¡£
 
 °Ê²¼¤Î´Ä¶­¤ÇÆ°ºî¤¬³Îǧ¤µ¤ì¤Æ¤¤¤Þ¤¹:
 
-o Debian GNU/Linux (woody/sid) (glibc 2.2)
+o Debian GNU/Linux (woody/sid) (glibc 2.2.x)
 o Kondara MNU/Linux (glibc 2.1.x)
 o Vine Linux 1.1 (glibc 2.0.x + libwcsmbs)
 o Vine Linux 2.0 (glibc 2.1.x) (Intel, PPC)
diff --git a/README b/README
index 70759a4..93d946f 100644 (file)
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
        Sylpheed - a GTK+ based, lightweight, and fast e-mail client
 
-   Copyright(C) 1999,2000 Hiroyuki Yamamoto <hiro-y@kcn.ne.jp>
+   Copyright(C) 1999-2001 Hiroyuki Yamamoto <hiro-y@kcn.ne.jp>
 
    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
@@ -25,10 +25,10 @@ What's Sylpheed
 Sylpheed is an e-mail client (and news reader) based on GTK+, running on
 X Window System, and aiming for
 
- * Quick response
- * Graceful, and sophisticated interface
- * Easy configuration, intuitive operation
- * Abundant features
 * Quick response
 * Graceful, and sophisticated interface
 * Easy configuration, intuitive operation
 * Abundant features
 
 The appearance and interface are similar to some popular e-mail clients for
 Windows, such as Outlook Express, Becky!, and Datula. The interface is also
@@ -47,6 +47,7 @@ Currently implemented features are:
        o ability of keyboard-only operation
        o Mew/Wanderlust-like key bind (most of normally used keys have been
          implemented)
+       o IMAP4rev1 support
        o multipart MIME
        o built-in image view
        o X-Face support
@@ -64,7 +65,7 @@ Currently implemented features are:
        o IPv6 support
        o GnuPG support (currently implementing)
        o multithread support (experimental)
-       o mbox importing
+       o mbox importing / exporting
        o drag & drop (partially implemented)
        o fast thread display
        o high-speed message processing
@@ -72,7 +73,6 @@ Currently implemented features are:
        o easily customizable configuration
        o supports automake + autoconf, and internationalization of message
          by gettext
-       o IMAP4 support (currently implementing)
 
 You'll figure out the usage if you have used a mailer on Windows, or
 Mew or Wanderlust.
index 83f19f4..dcd9861 100644 (file)
--- a/README.jp
+++ b/README.jp
@@ -1,6 +1,6 @@
        Sylpheed - GTK+ ¥Ù¡¼¥¹¤Î·ÚÎ̤ǹ⮤ÊÅŻҥ᡼¥ë¥¯¥é¥¤¥¢¥ó¥È
 
-   Copyright(C) 1999,2000 Hiroyuki Yamamoto <hiro-y@kcn.ne.jp>
+   Copyright(C) 1999-2001 Hiroyuki Yamamoto <hiro-y@kcn.ne.jp>
 
    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
@@ -42,10 +42,10 @@ What's Sylpheed
 
 Sylpheed¤ÏGTK+¤ò»ÈÍѤ·¤¿¡¢X Window System¾å¤ÇÆ°ºî¤¹¤ë
 
- * ·Ú²÷¤ÊÆ°ºî
- * Èþ¤·¤¯¡¢ÀöÎý¤µ¤ì¤¿¥¤¥ó¥¿¥Õ¥§¡¼¥¹
- * ÍưפÊÀßÄꡦľ´ÑŪ¤ÊÁàºî
- * Ë­É٤ʵ¡Ç½
 * ·Ú²÷¤ÊÆ°ºî
 * Èþ¤·¤¯¡¢ÀöÎý¤µ¤ì¤¿¥¤¥ó¥¿¥Õ¥§¡¼¥¹
 * ÍưפÊÀßÄꡦľ´ÑŪ¤ÊÁàºî
 * Ë­É٤ʵ¡Ç½
 
 ¤òÌܻؤ·¤¿ÅŻҥ᡼¥ë¥¯¥é¥¤¥¢¥ó¥È(& ¥Ë¥å¡¼¥¹¥ê¡¼¥À¡¼)¤Ç¤¹¡£
 
@@ -64,6 +64,7 @@ Sylpheed
        o ¥­¡¼¥Ü¡¼¥É¤Î¤ß¤Ë¤è¤ëÁàºî¤¬²Äǽ
        o Mew/Wanderlust ¥é¥¤¥¯¤Ê¥­¡¼¥Ð¥¤¥ó¥É (Ä̾ï»È¤ï¤ì¤ë¥­¡¼¤ÎÂçÉôʬ¤Ï
          ¼ÂÁõºÑ)
+       o IMAP4rev1 Âбþ
        o ¥Þ¥ë¥Á¥Ñ¡¼¥È MIME
        o ²èÁüɽ¼¨µ¡Ç½¤òÆâ¢
        o X-Face Âбþ
@@ -81,14 +82,13 @@ Sylpheed
        o IPv6 Âбþ
        o GnuPG Âбþ (¸½ºß¼ÂÁõÃæ)
        o ¥Þ¥ë¥Á¥¹¥ì¥Ã¥ÉÂбþ (¼Â¸³Åª)
-       o mbox ¥Õ¥¡¥¤¥ë¤Î¥¤¥ó¥Ý¡¼¥È
+       o mbox ¥Õ¥¡¥¤¥ë¤Î¥¤¥ó¥Ý¡¼¥È / ¥¨¥¯¥¹¥Ý¡¼¥È
        o ¥É¥é¥Ã¥° & ¥É¥í¥Ã¥× (°ìÉô¼ÂÁõ)
        o ¹â®¤Ê¥¹¥ì¥Ã¥Éɽ¼¨
        o ¹â®¤Ê¥á¥Ã¥»¡¼¥¸½èÍý
        o Äã¾ÃÈñ¥ê¥½¡¼¥¹
        o Íưפ˥«¥¹¥¿¥Þ¥¤¥º¤Ç¤­¤ëÀßÄê
        o automake + autoconf ¤È gettext ¤Ë¤è¤ë¥á¥Ã¥»¡¼¥¸¤Î¹ñºÝ²½¤ËÂбþ
-       o IMAP4 Âбþ (¸½ºß¼ÂÁõÃæ)
 
 Windows ¾å¤Î¥á¡¼¥é¡¢¤¢¤ë¤¤¤Ï Mew ¤ä Wanderlust ¤ò»ÈÍѤ·¤¿¤³¤È¤Î¤¢¤ë¿Í¤Ê¤é
 ¤¹¤°¤Ë»È¤¤Êý¤Ïʬ¤«¤ë¤È»×¤¤¤Þ¤¹¡£
diff --git a/TODO b/TODO
index 0c5226a..b3790c5 100644 (file)
--- a/TODO
+++ b/TODO
@@ -4,7 +4,6 @@ TODO
 (The upper item has the greater priority or feasibility... maybe :-)
 
 o POP before SMTP
-o list view of newsgroups and subscription of groups from there
 o full-text search of messages (plain, or hooking up with Namazu)
 o original icons and logos
 o template function
@@ -15,7 +14,6 @@ o parallel processing between sending-receiving and others
 o support for some formats other than MH and mbox (ex. Maildir)
 o priority (Priority:, X-Priority:, X-MSMail-Priority:)
 o notification of reception (Disposition-Notification-To:)
-o modification of display color
 o customization of key bindings
 o customization of toolbar
 o virtual folder
@@ -41,6 +39,7 @@ Partially implemented features
 . PGP/GPG support
 . display of HTML messages (composition of HTML message is not scheduled :-P)
 . progress display of time-consuming processes
+. modification of display color
 
 Implemented features
 ====================
@@ -64,3 +63,4 @@ Implemented features
 * periodical check of newly arrived mails
 * designate the displayed headers
 * user-defined headers
+* list view of newsgroups and subscription of groups from there
diff --git a/TODO.jp b/TODO.jp
index 61abf03..c2d8adc 100644 (file)
--- a/TODO.jp
+++ b/TODO.jp
@@ -4,18 +4,16 @@ TODO
 (¾å¤Î¤â¤Î¤Û¤É½ÅÍ×ÅÙ¡¢¼Â¸½²ÄǽÀ­¤¬¹â¤¯¤Ê¤ë¡¢¤«¤â(^^;)
 
 o POP before SMTP
-o ¥Ë¥å¡¼¥¹¥°¥ë¡¼¥×¤Î¥ê¥¹¥Èɽ¼¨¤È¤½¤³¤«¤é¤Î¹ØÆÉ¥°¥ë¡¼¥×ÄɲÃ
 o ¥á¥Ã¥»¡¼¥¸¤ÎÁ´Ê¸¸¡º÷ (¥Ù¥¿¡¢ Namazu ¤È¤ÎÏ¢·È)
 o ¥ª¥ê¥¸¥Ê¥ë¤Î¥¢¥¤¥³¥ó¤È¥í¥´
 o ¥Æ¥ó¥×¥ì¡¼¥Èµ¡Ç½
-o ¿¶¤êʬ¤±½èÍý¤Î¹â®²½
+o ¿¶¤êʬ¤±½èÍý¤Î¶¯²½
 o ¿¶¤êʬ¤±¤ÇÀµµ¬É½¸½¤ËÂбþ¤¹¤ë
 o LDAPÂбþ
 o Á÷¼õ¿®¤È¤½¤ì°Ê³°¤È¤ÎʹԽèÍý
 o MH, mbox °Ê³°¤Î·Á¼°¤Ø¤ÎÂбþ(Maildir Åù)
 o ½ÅÍ×ÅÙ (Priority:, X-Priority:, X-MSMail-Priority:)
 o ¼õ¿®³Îǧ (Disposition-Notification-To:)
-o É½¼¨¿§¤ÎÊѹ¹
 o ¥­¡¼¥Ð¥¤¥ó¥É¤Î¥«¥¹¥¿¥Þ¥¤¥º
 o ¥Ä¡¼¥ë¥Ð¡¼¤Î¥«¥¹¥¿¥Þ¥¤¥º
 o ²¾ÁÛ¥Õ¥©¥ë¥À
@@ -41,6 +39,7 @@ o 
 . PGP/GPGÂбþ
 . HTML¥á¡¼¥ë¤Îɽ¼¨ (HTML¥á¡¼¥ë¤ÎºîÀ®¤ÏͽÄê¤Ê¤·:-P)
 . »þ´Ö¤¬³Ý¤«¤ë½èÍý¤Î¿ÊĽ¾õ¶·É½¼¨
+. É½¼¨¿§¤ÎÊѹ¹
 
 ¼ÂÁõºÑ¤Îµ¡Ç½
 ============
@@ -65,3 +64,4 @@ o 
 * ¿·Ãå¥á¡¼¥ë¤ÎÄê´üŪ¥Á¥§¥Ã¥¯
 * É½¼¨¤µ¤ì¤ë¥Ø¥Ã¥À¤Î»ØÄê
 * ¥æ¡¼¥¶ÄêµÁ¤Î¥Ø¥Ã¥À
+* ¥Ë¥å¡¼¥¹¥°¥ë¡¼¥×¤Î¥ê¥¹¥Èɽ¼¨¤È¤½¤³¤«¤é¤Î¹ØÆÉ¥°¥ë¡¼¥×ÄɲÃ
index 608cb1b..276fc59 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=5
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws1
+EXTRA_VERSION=claws2
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index cee52c1..198cbf1 100644 (file)
@@ -28,9 +28,10 @@ sylpheed_SOURCES = \
        prefs_display_header.c prefs_display_header.h \
        prefs_customheader.c prefs_customheader.h \
        account.c account.h \
-       displayheader.c displayheader.h \
+       displayheader.c displayheader.h \
        customheader.c customheader.h \
        addressbook.c addressbook.h \
+       addr_compl.c addr_compl.h \
        filesel.c filesel.h \
        foldersel.c foldersel.h \
        statusbar.c statusbar.h \
@@ -41,6 +42,7 @@ sylpheed_SOURCES = \
        alertpanel.c alertpanel.h \
        inputdialog.c inputdialog.h \
        progressdialog.c progressdialog.h \
+       grouplistdialog.c grouplistdialog.h \
        about.c about.h \
        setup.c setup.h \
        utils.c utils.h \
@@ -76,9 +78,7 @@ sylpheed_SOURCES = \
        sigstatus.c sigstatus.h \
        simple-gettext.c \
        manual.c manual.h \
-       addr_compl.c addr_compl.h \
        gtkstext.c gtkstext.h \
-       grouplist_dialog.c grouplist_dialog.h \
        scoring.c scoring.h \
        prefs_folder_item.c prefs_folder_item.h \
        matcher.c matcher.h \
index 1c74f31..46a81f6 100644 (file)
@@ -275,8 +275,6 @@ void account_add(void)
                if (ac_prefs->protocol == A_IMAP4) {
                        folder = folder_new(F_IMAP, ac_prefs->account_name,
                                            ac_prefs->recv_server);
-                       folder_item_append(FOLDER_ITEM(folder->node->data),
-                                          folder_item_new("INBOX", "INBOX"));
                } else {
                        folder = folder_new(F_NEWS, ac_prefs->account_name,
                                            ac_prefs->nntp_server);
@@ -285,10 +283,9 @@ void account_add(void)
                folder->account = ac_prefs;
                ac_prefs->folder = REMOTE_FOLDER(folder);
                folder_add(folder);
-               if (ac_prefs->protocol == A_IMAP4) {
+               if (ac_prefs->protocol == A_IMAP4)
                        folder->create_tree(folder);
-                       folderview_set_all();
-               }
+               folderview_set_all();
        }
 }
 
@@ -334,9 +331,6 @@ void account_set_missing_folder(void)
                        if (ap->protocol == A_IMAP4) {
                                folder = folder_new(F_IMAP, ap->account_name,
                                                    ap->recv_server);
-                               folder_item_append
-                                       (FOLDER_ITEM(folder->node->data),
-                                        folder_item_new("INBOX", "INBOX"));
                        } else {
                                folder = folder_new(F_NEWS, ap->account_name,
                                                    ap->nntp_server);
index 40b607e..a253604 100644 (file)
@@ -40,7 +40,6 @@
 #define TRASH_DIR              "trash"
 #define RC_DIR                 ".sylpheed"
 #define NEWS_CACHE_DIR         "newscache"
-#define GROUPLIST_FILE         "grouplist"
 #define IMAP_CACHE_DIR         "imapcache"
 #define MBOX_CACHE_DIR         "mboxcache"
 #define MIME_TMP_DIR           "mimetmp"
@@ -53,6 +52,7 @@
 #define SCORING_RC              "scoringrc"
 #define FILTERING_RC           "filteringrc"
 #define MENU_RC                        "menurc"
+#define NEWSGROUP_LIST         ".newsgroup_list"
 #define ADDRESS_BOOK           "addressbook.xml"
 #define MANUAL_HTML_INDEX      "sylpheed.html"
 #define HOMEPAGE_URI           "http://sylpheed.good-day.net/"
@@ -90,6 +90,7 @@
 #define CTREE_INDENT                   18
 #define FOLDER_SPACING                 4
 #define COLOR_DIM                      35000
+#define UI_REFRESH_INTERVAL            50000
 
 #define NORMAL_FONT prefs_common.normalfont
 #define BOLD_FONT   prefs_common.boldfont
index 1391dd1..8f07067 100644 (file)
@@ -1228,7 +1228,7 @@ static void folder_write_list_recursive(GNode *node, gpointer data)
                if (folder->account)
                        fprintf(fp, " account_id=\"%d\"",
                                folder->account->account_id);
-               if (item->collapsed)
+               if (item->collapsed && node->children)
                        fputs(" collapsed=\"1\"", fp);
        } else {
                fprintf(fp, "<folderitem type=\"%s\"",
@@ -1250,7 +1250,7 @@ static void folder_write_list_recursive(GNode *node, gpointer data)
                        fputs(" no_sub=\"1\"", fp);
                if (item->no_select)
                        fputs(" no_select=\"1\"", fp);
-               if (item->collapsed)
+               if (item->collapsed && node->children)
                        fputs(" collapsed=\"1\"", fp);
                fprintf(fp,
                        " mtime=\"%ld\" new=\"%d\" unread=\"%d\" total=\"%d\"",
index d5d2826..4b781a7 100644 (file)
@@ -43,6 +43,7 @@
 #include "folderview.h"
 #include "summaryview.h"
 #include "inputdialog.h"
+#include "grouplistdialog.h"
 #include "manage_window.h"
 #include "alertpanel.h"
 #include "menu.h"
@@ -53,7 +54,6 @@
 #include "prefs_account.h"
 #include "account.h"
 #include "folder.h"
-#include "grouplist_dialog.h"
 
 #include "pixmaps/inbox.xpm"
 #include "pixmaps/outbox.xpm"
@@ -1927,7 +1927,7 @@ static void folderview_new_news_group_cb(FolderView *folderview, guint action,
        g_return_if_fail(item->folder->type == F_NEWS);
        g_return_if_fail(item->folder->account != NULL);
 
-       new_group = grouplist_dialog(item);
+       new_group = grouplist_dialog(item->folder);
        if (!new_group) return;
 
        if (GTK_CTREE_ROW(folderview->selected)->parent != NULL)
similarity index 53%
rename from src/grouplist_dialog.c
rename to src/grouplistdialog.c
index 32931c0..4e8ac5a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * 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
@@ -21,6 +21,8 @@
 #  include "config.h"
 #endif
 
+#include "defs.h"
+
 #include <glib.h>
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtkmain.h>
 #include <gtk/gtkvbox.h>
 #include <gtk/gtkhbox.h>
 #include <gtk/gtklabel.h>
+#include <gtk/gtkentry.h>
 #include <gtk/gtkclist.h>
 #include <gtk/gtkscrolledwindow.h>
 #include <gtk/gtkbutton.h>
 #include <gtk/gtkhbbox.h>
 
 #include "intl.h"
-#include "grouplist_dialog.h"
+#include "grouplistdialog.h"
 #include "manage_window.h"
 #include "gtkutils.h"
 #include "utils.h"
 #include "news.h"
 #include "folder.h"
 #include "alertpanel.h"
+#include "recv.h"
+#include "socket.h"
 
 #define GROUPLIST_DIALOG_WIDTH 420
 #define GROUPLIST_DIALOG_HEIGHT        400
 
 static gboolean ack;
+static gboolean locked;
 
 static GtkWidget *dialog;
-static GtkWidget *msg_label;
-static GtkWidget *group_clist;
+static GtkWidget *entry;
+static GtkWidget *clist;
+static GtkWidget *status_label;
 static GtkWidget *ok_button;
-static gchar * group_selected;
-static GSList * group_list;
-static FolderItem * item;
+static GSList *group_list;
+static Folder *news_folder;
 
 static void grouplist_dialog_create    (void);
-static void grouplist_dialog_set       (void);
-static void grouplist_free             (void);
+static void grouplist_dialog_set_list  (void);
+static void grouplist_clear            (void);
+static void grouplist_recv_func                (SockInfo       *sock,
+                                        gint            count,
+                                        gint            read_bytes,
+                                        gpointer        data);
 
 static void ok_clicked         (GtkWidget      *widget,
                                 gpointer        data);
 static void cancel_clicked     (GtkWidget      *widget,
                                 gpointer        data);
-static void refresh_clicked(GtkWidget *widget, gpointer data);
+static void refresh_clicked    (GtkWidget      *widget,
+                                gpointer        data);
 static void key_pressed                (GtkWidget      *widget,
                                 GdkEventKey    *event,
                                 gpointer        data);
-static void group_clist_select(GtkCList *clist, gint row, gint column,
-                             GdkEventButton *event, gpointer user_data);
-
-gchar *grouplist_dialog(FolderItem * i)
+static void clist_selected     (GtkCList       *clist,
+                                gint            row,
+                                gint            column,
+                                GdkEventButton *event,
+                                gpointer        user_data);
+static void entry_activated    (GtkEditable    *editable);
+
+gchar *grouplist_dialog(Folder *folder)
 {
        gchar *str;
 
@@ -82,12 +97,14 @@ gchar *grouplist_dialog(FolderItem * i)
        if (!dialog)
                grouplist_dialog_create();
 
-       item = i;
+       news_folder = folder;
 
-       grouplist_dialog_set();
        gtk_widget_show(dialog);
        gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
        manage_window_set_transient(GTK_WINDOW(dialog));
+       GTK_EVENTS_FLUSH();
+
+       grouplist_dialog_set_list();
 
        gtk_main();
 
@@ -95,30 +112,26 @@ gchar *grouplist_dialog(FolderItem * i)
        gtk_widget_hide(dialog);
 
        if (ack) {
-               if (group_selected != NULL)
-                       str = g_strdup(group_selected);
-               else
-                       str = NULL;
-               if (str && *str == '\0')
+               str = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
+               if (str && *str == '\0') {
+                       g_free(str);
                        str = NULL;
+               }
        } else
                str = NULL;
 
-       grouplist_free();
-
+       grouplist_clear();
        GTK_EVENTS_FLUSH();
 
        debug_print("return string = %s\n", str ? str : "(none)");
        return str;
 }
 
-static void grouplist_free(void)
+static void grouplist_clear(void)
 {
-       GSList * group_elt;
-
-       for(group_elt = group_list ; group_elt != NULL ;
-           group_elt = group_elt->next)
-           g_free(group_elt->data);
+       gtk_clist_clear(GTK_CLIST(clist));
+       gtk_entry_set_text(GTK_ENTRY(entry), "");
+       slist_free_strings(group_list);
        g_slist_free(group_list);
 }
 
@@ -126,17 +139,20 @@ static void grouplist_dialog_create(void)
 {
        GtkWidget *vbox;
        GtkWidget *hbox;
+       GtkWidget *msg_label;
        GtkWidget *confirm_area;
        GtkWidget *cancel_button;       
        GtkWidget *refresh_button;      
        GtkWidget *scrolledwin;
 
        dialog = gtk_dialog_new();
-       gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, FALSE, FALSE);
-       gtk_widget_set_usize(dialog, GROUPLIST_DIALOG_WIDTH, GROUPLIST_DIALOG_HEIGHT);
+       gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, TRUE, FALSE);
+       gtk_widget_set_usize(dialog,
+                            GROUPLIST_DIALOG_WIDTH, GROUPLIST_DIALOG_HEIGHT);
        gtk_container_set_border_width
                (GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), 5);
        gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER);
+       gtk_window_set_title(GTK_WINDOW(dialog), _("Subscribe to newsgroup"));
        gtk_signal_connect(GTK_OBJECT(dialog), "delete_event",
                           GTK_SIGNAL_FUNC(cancel_clicked), NULL);
        gtk_signal_connect(GTK_OBJECT(dialog), "key_press_event",
@@ -155,31 +171,38 @@ static void grouplist_dialog_create(void)
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
 
-       msg_label = gtk_label_new("");
+       msg_label = gtk_label_new(_("Input subscribing newsgroup:"));
        gtk_box_pack_start(GTK_BOX(hbox), msg_label, FALSE, FALSE, 0);
-       gtk_label_set_justify(GTK_LABEL(msg_label), GTK_JUSTIFY_LEFT);
-
-
-       scrolledwin = gtk_scrolled_window_new (NULL, NULL);
-       gtk_box_pack_start (GTK_BOX (vbox), scrolledwin,
-                           TRUE, TRUE, 0);
-       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwin),
-                                       GTK_POLICY_AUTOMATIC,
-                                       GTK_POLICY_AUTOMATIC);
-
-       group_clist = gtk_clist_new(1);
-       gtk_container_add (GTK_CONTAINER (scrolledwin), group_clist);
-       gtk_clist_set_column_width (GTK_CLIST (group_clist), 0, 80);
-       gtk_clist_set_selection_mode (GTK_CLIST (group_clist),
-                                     GTK_SELECTION_BROWSE);
-       GTK_WIDGET_UNSET_FLAGS (GTK_CLIST (group_clist)->column[0].button,
-                               GTK_CAN_FOCUS);
-       gtk_signal_connect (GTK_OBJECT (group_clist), "select_row",
-                           GTK_SIGNAL_FUNC (group_clist_select), NULL);
+
+       entry = gtk_entry_new();
+       gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
+       gtk_signal_connect(GTK_OBJECT(entry), "activate",
+                          GTK_SIGNAL_FUNC(entry_activated), NULL);
+
+       scrolledwin = gtk_scrolled_window_new(NULL, NULL);
+       gtk_box_pack_start(GTK_BOX (vbox), scrolledwin, TRUE, TRUE, 0);
+       gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolledwin),
+                                      GTK_POLICY_AUTOMATIC,
+                                      GTK_POLICY_AUTOMATIC);
+
+       clist = gtk_clist_new(1);
+       gtk_container_add(GTK_CONTAINER(scrolledwin), clist);
+       gtk_clist_set_column_width(GTK_CLIST(clist), 0, 80);
+       gtk_clist_set_selection_mode(GTK_CLIST(clist), GTK_SELECTION_BROWSE);
+       GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(clist)->column[0].button,
+                              GTK_CAN_FOCUS);
+       gtk_signal_connect(GTK_OBJECT(clist), "select_row",
+                          GTK_SIGNAL_FUNC(clist_selected), NULL);
+
+       hbox = gtk_hbox_new(FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+
+       status_label = gtk_label_new("");
+       gtk_box_pack_start(GTK_BOX(hbox), status_label, FALSE, FALSE, 0);
 
        gtkut_button_set_create(&confirm_area,
-                               &ok_button,     _("OK"),
-                               &cancel_button, _("Cancel"),
+                               &ok_button,      _("OK"),
+                               &cancel_button,  _("Cancel"),
                                &refresh_button, _("Refresh"));
        gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area),
                          confirm_area);
@@ -192,76 +215,93 @@ static void grouplist_dialog_create(void)
        gtk_signal_connect(GTK_OBJECT(refresh_button), "clicked",
                           GTK_SIGNAL_FUNC(refresh_clicked), NULL);
 
-
        gtk_widget_show_all(GTK_DIALOG(dialog)->vbox);
 }
 
 static void grouplist_dialog_set_list(void)
 {
-       GSList * elt;
+       GSList *cur;
        gint row;
 
-       group_selected = NULL;
-       group_list = news_get_group_list(item);
+       if (locked) return;
+       locked = TRUE;
+
+       recv_set_ui_func(grouplist_recv_func, NULL);
+       group_list = news_get_group_list(news_folder);
+       recv_set_ui_func(NULL, NULL);
        if (group_list == NULL) {
-               alertpanel_error(_("Can't retrieve group list."));
+               alertpanel_error(_("Can't retrieve newsgroup list."));
+               locked = FALSE;
                return;
        }
 
-       gtk_clist_clear(GTK_CLIST(group_clist));
-       for(elt = group_list; elt != NULL ; elt = elt->next)
-         {
-           row = gtk_clist_append(GTK_CLIST(group_clist),
-                                  (void *) &(elt->data));
-           gtk_clist_set_row_data(GTK_CLIST(group_clist), row, elt->data);
-         }
+       gtk_clist_freeze(GTK_CLIST(clist));
+       for (cur = group_list; cur != NULL ; cur = cur->next) {
+               row = gtk_clist_append(GTK_CLIST(clist),
+                                      (gchar **)&(cur->data));
+               gtk_clist_set_row_data(GTK_CLIST(clist), row, cur->data);
+       }
+       gtk_clist_thaw(GTK_CLIST(clist));
 
        gtk_widget_grab_focus(ok_button);
-       gtk_widget_grab_focus(group_clist);
+       gtk_widget_grab_focus(clist);
 
-       if (group_list != NULL)
-         group_selected = group_list->data;
-       else
-         group_selected = NULL;
+       gtk_label_set_text(GTK_LABEL(status_label), _("Done."));
+
+       locked = FALSE;
 }
 
-static void grouplist_dialog_set(void)
+static void grouplist_recv_func(SockInfo *sock, gint count, gint read_bytes,
+                               gpointer data)
 {
-       gtk_window_set_title(GTK_WINDOW(dialog), _("Subscribe newsgroup"));
-       gtk_label_set_text(GTK_LABEL(msg_label), _("Input subscribing newsgroup:"));
-       grouplist_dialog_set_list();
+       gchar buf[BUFFSIZE];
+
+       g_snprintf(buf, sizeof(buf),
+                  _("%d newsgroups received (%d bytes read)"),
+                  count, read_bytes);
+       gtk_label_set_text(GTK_LABEL(status_label), buf);
+       GTK_EVENTS_FLUSH();
 }
 
 static void ok_clicked(GtkWidget *widget, gpointer data)
 {
        ack = TRUE;
-       gtk_main_quit();
+       if (gtk_main_level() > 1)
+               gtk_main_quit();
 }
 
 static void cancel_clicked(GtkWidget *widget, gpointer data)
 {
        ack = FALSE;
-       gtk_main_quit();
+       if (gtk_main_level() > 1)
+               gtk_main_quit();
 }
 
 static void refresh_clicked(GtkWidget *widget, gpointer data)
 { 
-       grouplist_free();
-       news_reset_group_list(item);
+       if (locked) return;
+
+       grouplist_clear();
+       news_remove_group_list(news_folder);
        grouplist_dialog_set_list();
 }
 
 static void key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data)
 {
-       if (event && event->keyval == GDK_Escape) {
-               ack = FALSE;
-               gtk_main_quit();
-       }
+       if (event && event->keyval == GDK_Escape)
+               cancel_clicked(NULL, NULL);
+}
+
+static void clist_selected(GtkCList *clist, gint row, gint column,
+                          GdkEventButton *event, gpointer user_data)
+{
+       gchar *group;
+
+       group = (gchar *)gtk_clist_get_row_data(GTK_CLIST(clist), row);
+       gtk_entry_set_text(GTK_ENTRY(entry), group ? group : "");
 }
 
-static void group_clist_select(GtkCList *clist, gint row, gint column,
-                             GdkEventButton *event, gpointer user_data)
+static void entry_activated(GtkEditable *editable)
 {
-  group_selected = (gchar *)
-    gtk_clist_get_row_data(GTK_CLIST(group_clist), row);
+       ok_clicked(NULL, NULL);
 }
similarity index 90%
rename from src/grouplist_dialog.h
rename to src/grouplistdialog.h
index 75ad71b..6cd0bcb 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * 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
@@ -21,8 +21,9 @@
 #define __GROUPLISTDIALOG_H__
 
 #include <glib.h>
+
 #include "folder.h"
 
-gchar *grouplist_dialog                        (FolderItem * item);
+gchar *grouplist_dialog        (Folder *folder);
 
 #endif /* __GROUPLISTDIALOG_H__ */
index 24edcdc..85791ab 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -99,6 +99,7 @@ static gint connection_check_cb               (Automaton      *atm);
 #endif
 
 static void inc_pop3_recv_func         (SockInfo       *sock,
+                                        gint            count,
                                         gint            read_bytes,
                                         gpointer        data);
 
@@ -664,7 +665,6 @@ static IncState inc_pop3_session_do(IncSession *session)
                SSL_free(sockinfo->ssl);
        }
 #endif
-
        automaton_destroy(atm);
 
        return pop3_state->inc_state;
@@ -788,7 +788,8 @@ static gint connection_check_cb(Automaton *atm)
 }
 #endif
 
-static void inc_pop3_recv_func(SockInfo *sock, gint read_bytes, gpointer data)
+static void inc_pop3_recv_func(SockInfo *sock, gint count, gint read_bytes,
+                              gpointer data)
 {
        gchar buf[MSGBUFSIZE];
        IncSession *session = (IncSession *)data;
index e2a6905..973909a 100644 (file)
@@ -172,6 +172,7 @@ NNTPSession *news_session_get(Folder *folder)
        if (!REMOTE_FOLDER(folder)->session) {
                REMOTE_FOLDER(folder)->session =
                        news_session_new_for_folder(folder);
+               statusbar_pop_all();
                return NNTP_SESSION(REMOTE_FOLDER(folder)->session);
        }
 
@@ -188,6 +189,7 @@ NNTPSession *news_session_get(Folder *folder)
                        news_session_new_for_folder(folder);
        }
 
+       statusbar_pop_all();
        return NNTP_SESSION(REMOTE_FOLDER(folder)->session);
 }
 
@@ -239,6 +241,7 @@ GSList *news_get_article_list(Folder *folder, FolderItem *item,
 gchar *news_fetch_msg(Folder *folder, FolderItem *item, gint num)
 {
        gchar *path, *filename;
+       NNTPSession *session;
        gint ok;
 
        g_return_val_if_fail(folder != NULL, NULL);
@@ -256,13 +259,14 @@ gchar *news_fetch_msg(Folder *folder, FolderItem *item, gint num)
                return filename;
        }
 
-       if (!REMOTE_FOLDER(folder)->session) {
+       session = news_session_get(folder);
+       if (!session) {
                g_free(filename);
                return NULL;
        }
 
-       ok = news_select_group(NNTP_SESSION(REMOTE_FOLDER(folder)->session),
-                              item->path);
+       ok = news_select_group(session, item->path);
+       statusbar_pop_all();
        if (ok != NN_SUCCESS) {
                g_warning(_("can't select group %s\n"), item->path);
                g_free(filename);
@@ -286,6 +290,89 @@ void news_scan_group(Folder *folder, FolderItem *item)
 {
 }
 
+GSList *news_get_group_list(Folder *folder)
+{
+       gchar *path, *filename;
+       FILE *fp;
+       GSList *list = NULL;
+       GSList *last = NULL;
+       gchar buf[NNTPBUFSIZE];
+
+       g_return_val_if_fail(folder != NULL, NULL);
+       g_return_val_if_fail(folder->type == F_NEWS, NULL);
+
+       path = folder_item_get_path(FOLDER_ITEM(folder->node->data));
+       filename = g_strconcat(path, G_DIR_SEPARATOR_S, NEWSGROUP_LIST, NULL);
+       g_free(path);
+
+       if ((fp = fopen(filename, "r")) == NULL) {
+               NNTPSession *session;
+
+               session = news_session_get(folder);
+               if (!session) {
+                       g_free(filename);
+                       return NULL;
+               }
+
+               if (nntp_list(session->nntp_sock) != NN_SUCCESS) {
+                       g_free(filename);
+                       statusbar_pop_all();
+                       return NULL;
+               }
+               statusbar_pop_all();
+               if (recv_write_to_file(SESSION(session)->sock, filename) < 0) {
+                       log_warning(_("can't retrieve newsgroup list\n"));
+                       g_free(filename);
+                       return NULL;
+               }
+
+               if ((fp = fopen(filename, "r")) == NULL) {
+                       FILE_OP_ERROR(filename, "fopen");
+                       g_free(filename);
+                       return NULL;
+               }
+       }
+
+       while (fgets(buf, sizeof(buf), fp) != NULL) {
+               gchar *p = buf;
+               while (*p != '\0' && *p != ' ') p++;
+               *p = '\0';
+               if (!last)
+                       last = list = g_slist_append(NULL, g_strdup(buf));
+               else {
+                       last = g_slist_append(last, g_strdup(buf));
+                       last = last->next;
+               }
+       }
+
+       fclose(fp);
+       g_free(filename);
+
+       list = g_slist_sort(list, (GCompareFunc)g_strcasecmp);
+
+       statusbar_pop_all();
+
+       return list;
+}
+
+void news_remove_group_list(Folder *folder)
+{
+       gchar *path, *filename;
+
+       g_return_if_fail(folder != NULL);
+       g_return_if_fail(folder->type == F_NEWS);
+
+       path = folder_item_get_path(FOLDER_ITEM(folder->node->data));
+       filename = g_strconcat(path, G_DIR_SEPARATOR_S, NEWSGROUP_LIST, NULL);
+       g_free(path);
+
+       if (is_file_exist(filename)) {
+               if (remove(filename) < 0)
+                       FILE_OP_ERROR(filename, "remove");
+       }
+       g_free(filename);
+}
+
 gint news_post(Folder *folder, const gchar *file)
 {
        NNTPSession *session;
@@ -586,7 +673,6 @@ static MsgInfo *news_parse_xover(const gchar *xover_str)
 
 static gchar *news_parse_xhdr(const gchar *xhdr_str, MsgInfo *msginfo)
 {
-       gchar buf[NNTPBUFSIZE];
        gchar *p;
        gchar *tmp;
        gint num;
@@ -661,92 +747,3 @@ static void news_delete_all_articles(FolderItem *item)
 
        debug_print(_("done.\n"));
 }
-
-/*
-  news_get_group_list returns a strings list.
-  These strings are the names of the newsgroups of a server.
-  item is the FolderItem of the news server.
-  The names of the newsgroups are cached into a file so that
-  when the function is called again, there is no need to make
-  a request to the server.
- */
-
-GSList * news_get_group_list(FolderItem *item)
-{
-       gchar *path, *filename;
-       gint ok;
-       NNTPSession *session;
-       GSList * group_list = NULL;
-       FILE * f;
-       gchar buf[NNTPBUFSIZE];
-       int len;
-
-       if (item == NULL)
-         return NULL;
-
-       path = folder_item_get_path(item);
-
-       if (!is_dir_exist(path))
-               make_dir_hier(path);
-
-       filename = g_strconcat(path, G_DIR_SEPARATOR_S, GROUPLIST_FILE, NULL);
-       g_free(path);
-
-       session = news_session_get(item->folder);
-
-       if (session == NULL)
-         return NULL;
-
-       if (is_file_exist(filename)) {
-               debug_print(_("group list has been already cached.\n"));
-       }
-       else {
-           ok = nntp_list(session->nntp_sock);
-           if (ok != NN_SUCCESS)
-             return NULL;
-           
-           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)) {
-           char * s;
-
-           len = 0;
-           while ((buf[len] != 0) && (buf[len] != ' '))
-             len++;
-           buf[len] = 0;
-           s = g_strdup(buf);
-
-           group_list = g_slist_append(group_list, s);
-       }
-       fclose(f);
-       g_free(filename);
-
-       group_list = g_slist_sort(group_list, (GCompareFunc) g_strcasecmp);
-
-       return group_list;
-}
-
-/*
-  remove the cache file of the names of the newsgroups.
- */
-
-void news_reset_group_list(FolderItem *item)
-{
-       gchar *path, *filename;
-
-       debug_print(_("\tDeleting cached group list... "));
-       path = folder_item_get_path(item);
-       if (!is_dir_exist(path))
-               make_dir_hier(path);
-
-       filename = g_strconcat(path, G_DIR_SEPARATOR_S, GROUPLIST_FILE, NULL);
-       g_free(path);
-       if (remove(filename) != 0)
-         log_warning(_("can't delete cached group list %s\n"), filename);
-       g_free(filename);
-}
index 8bd2b6d..4dfe845 100644 (file)
@@ -52,10 +52,10 @@ gchar *news_fetch_msg                       (Folder         *folder,
 void news_scan_group                   (Folder         *folder,
                                         FolderItem     *item);
 
+GSList *news_get_group_list            (Folder         *folder);
+void news_remove_group_list            (Folder         *folder);
+
 gint news_post                         (Folder         *folder,
                                         const gchar    *file);
 
-GSList * news_get_group_list(FolderItem *item);
-void news_reset_group_list();
-
 #endif /* __NEWS_H__ */
index 4ed3e0c..eac5804 100644 (file)
@@ -21,6 +21,8 @@
 #  include "config.h"
 #endif
 
+#include "defs.h"
+
 #include <glib.h>
 #include <stdio.h>
 #include <string.h>
@@ -32,8 +34,6 @@
 #include "socket.h"
 #include "utils.h"
 
-#define BUFFSIZE       8192
-
 static RecvUIFunc      recv_ui_func;
 static gpointer                recv_ui_func_data;
 
@@ -101,6 +101,7 @@ gint recv_write(SockInfo *sock, FILE *fp)
 {
        gchar buf[BUFFSIZE];
        gint len;
+       gint count = 0;
        gint bytes = 0;
        struct timeval tv_prev, tv_cur;
 
@@ -115,9 +116,11 @@ gint recv_write(SockInfo *sock, FILE *fp)
                len = strlen(buf);
                if (len > 1 && buf[0] == '.' && buf[1] == '\r') {
                        if (recv_ui_func)
-                               recv_ui_func(sock, bytes, recv_ui_func_data);
+                               recv_ui_func(sock, count, bytes,
+                                            recv_ui_func_data);
                        break;
                }
+               count++;
                bytes += len;
 
                if (recv_ui_func) {
@@ -125,8 +128,9 @@ gint recv_write(SockInfo *sock, FILE *fp)
                        /* if elapsed time from previous update is greater
                           than 10msec, update UI */
                        if (tv_cur.tv_sec - tv_prev.tv_sec > 0 ||
-                           tv_cur.tv_usec - tv_prev.tv_usec > 10000) {
-                               recv_ui_func(sock, bytes, recv_ui_func_data);
+                           tv_cur.tv_usec - tv_prev.tv_usec > UI_REFRESH_INTERVAL) {
+                               recv_ui_func(sock, count, bytes,
+                                            recv_ui_func_data);
                                gettimeofday(&tv_prev, NULL);
                        }
                }
index dd59ea5..bc1dd89 100644 (file)
@@ -25,6 +25,7 @@
 #include "socket.h"
 
 typedef void (*RecvUIFunc)     (SockInfo       *sock,
+                                gint            count,
                                 gint            read_bytes,
                                 gpointer        data);
 
index 51e818f..ad182fd 100644 (file)
@@ -339,7 +339,7 @@ static gint send_message_smtp(GSList *to_list, const gchar *from,
 
                gettimeofday(&tv_cur, NULL);
                if (tv_cur.tv_sec - tv_prev.tv_sec > 0 ||
-                   tv_cur.tv_usec - tv_prev.tv_usec > 10000) {
+                   tv_cur.tv_usec - tv_prev.tv_usec > UI_REFRESH_INTERVAL) {
                        g_snprintf(str, sizeof(str),
                                   _("Sending message (%d / %d bytes)"),
                                   bytes, size);