2004-07-27  Satoru Takabayashi  <satoru@namazu.org>

	* scmail: 1.3 Released!

	* doc/embed.scm: New file.
	* doc/scmail.html.in: New file.
	* doc/scmail-ja.html.in: New file.
	* doc/Makefile: Simplified.
	* doc/scmail.rd: Removed.
	* doc/scmail-ja.rd: Removed.
	* doc/scbayes.rd: Removed.
	* doc/scbayes-ja.rd: Removed.
	* doc/reformat-html: Removed.
	* doc/html-noarchive: Removed.
	* Makefile: Adopt the above changes.

2004-07-26  Satoru Takabayashi  <satoru@namazu.org>

	* Makefile (VERSION): Bumped version number to 1.3.

	* scmail/util.scm (scmail-ports->file): Removed.

	* scmail/mail.scm (scmail-mail-query): Add optional parameter
	:multi-field based on the suggestion by Keiichiro Nagano
	<knagano@sodan.org> [scmail:272].
	* tests/test-rules.in (lambda): Add the test for that.
	* tests/7: New file.
	* tests/8: New file.
	* tests/Makefile (MAIL): Add them.

2004-06-23  Kimura Fuyuki  <fuyuki@hadaly.org>

	* scmail/mail.scm (scmail-mail-read): Replace `port->string' with
	`get-remaining-input-string' since the former may cause "EOF in
	middle of a multibyte character" error. [scmail:280]

2004-06-13  Satoru Takabayashi  <satoru@namazu.org>

	* tests/scmail-commands: Use dummy-socket.scm to support the test
	for a host that does not has a running local MTA.

	* tests/dummy-socket.scm: New file.

	* scmail-deliver.in (main): Returns 75 to tells the MTA to re-try
	the delivery again if any errors is occurred.

2004-06-02  Satoru Takabayashi  <satoru@namazu.org>

	* doc/Makefile (update-web): Removed.
	(all): Use html-noarchive.

2004-03-17  Satoru Takabayashi  <satoru@namazu.org>

	* scbayes.in (learn-common): Use make-scmail-mailbox and
	scmail-mailbox-mail-list.
	(check-folder-dir): Use scmail-mailbox-folder->path.
	(collect-target-files): Take a new parameter mailbox.
	(collect-target-files-from-folders): Ditto.
	(check-folder): Use make-scmail-mailbox.
	(check-folder-path): Renamed from check-folder-dir.
	(check-spamness-in-folder): Renamed from check-folder.
	(check-spamness-of-mail): Renamed from check-mail.

	* scmail.scm (check-folder): Removed.
	(scmail-folder->directory): Removed.

	* scmail/mailbox.scm (scmail-mailbox-folder->path): Renamed
	from scmail-mailbox-folder->directory.

	* scmail.scm (scmail-mail-list): Removed.

2004-03-16  Satoru Takabayashi  <satoru@namazu.org>

	* scmail/util.scm (scmail-not-implemented-error): New function.

	* scmail.scm (copy-mail): Removed.
	(maildir-copy-mail): Ditto.
	(mh-copy-mail): Ditto.
	(move-mail): Ditto.
	(mh-move-mail): Ditto.
	(maildir-move-mail): Ditto.
	(mh-prepare-new-file): Ditto.
	(maildir-prepare-new-file): Ditto.
	(maildir-get-subdir): Ditto.
	(mh-last-mail-id): Ditto.
	(mh-dry-run-last-id): Ditto.
	(maildir-file): Ditto.
	(mh-file): Ditto.
	(maildir-make-sub-directories): Ditto.
	(maildir-generate-new-id): Ditto.
	(make-dest-directory): Ditto.
	(maildir-safe-write-mail): Ditto.

	* scmail/mail.scm (scmail-mail-copy): New method.
	(scmail-mail-move): Ditto.

	* scmail-refile.in (main-process): Use make-scmail-mail.

	* scmail-deliver.in (main-process): Use make-scmail-mail.

	* scmail/mail.scm (scmail-mail-add-type!): New function.
	(make-scmail-mail): Ditto.

	* scmail/maildir.scm: New file.

	* scmail/mh.scm: New file.

	* scmail/mail.scm: Added "scmail-" prefix to all exported methods.
	(write-object): Use class-name and class-of.

	* scmail.scm (scmail-mail-list): Renamed from scmail-file-list.

	* tests/scmail.scm (test-mailbox): Removed a test for scmail-file-list.

	* scmail.scm (mh-file-list): Removed.
	(maildir-file-list): Ditto.

	* scbayes.in (collect-target-files): Use scmail-mailbox-mail-list.

	* scmail.scm (scmail-main): Pass mailbox object to main-process.

	* scmail-refile.in (main-process): Use scmail-mailbox-mail-list.

	* tests/mailbox.scm: New file.

	* scmail/mailbox.scm: New file.

2004-03-12  Satoru Takabayashi  <satoru@namazu.org>

	* scmail.scm (maildir-safe-copy-mail): Take third parametre
	write-proc.
	(maildir-safe-write-mail): Renamed from maildir-safe-copy-mail.

	* scmail/util.scm (scmail-ports->file): New function.

	* tests/scmail-commands (file): Added a test for the size limit.

	* scmail/config.scm (<config>): New slot: size-limit.

	* scmail.scm (mh-prepare-new-file): New function.
	(mh-copy-mail): Use it.
	(mh-move-mail): Use it.
	(maildir-prepare-new-file): New function.
	(maildir-copy-mail): Use it.
	(maildir-move-mail): Use it.
	(safe-copy-mail): New function.
	(mh-safe-copy-mail): New function.
	(prepare-new-file): New function.

	* scmail/mail.scm (mail-from-stdin?): Just check 'file instead of
	comparing to (standard-input-port).
	(<mail>): Use init-form instead of init-value for 'port.
	(mail-read): Set port-buffering to :none only if the port is
	(standard-input-port).

2004-03-11  Satoru Takabayashi  <satoru@namazu.org>

	* scmail: 1.2 Released!

	* scbayes.in (usage): Use sys-basename to modify *program-name*.

	* scmail.scm (show-help): Ditto.

	* NEWS: Updated.

	* doc/scmail.rd: Updated.

	* doc/scmail-ja.rd: Updated.

2004-03-10  Satoru Takabayashi  <satoru@namazu.org>

	* scmail.scm (maildir-generate-new-id): Removed.
	(maildir-generate-new-id): Simplified.
	(maildir-get-suffix): Removed.
	(maildir-copy-mail): Don't use maildir-get-suffix and use
	maildir-generate-new-id only if mail is from stdin.

	* scmail/mail.scm (mail-dry-run-mode?): New function.
	(mail-write): Use it.
	(mail-remove): Ditto.
	(mail-rename): Ditto.
	(mail-forward): Ditto.
	(mail-port): Renamed from mail->port.
	(mail-write): Modified to take a file name instead of port.

	* scmail-deliver.in (main-process): Use :dry-run-mode keyword to
	make <mail> object.

	* scmail-refile.in (main-process): Ditto.

	* scmail.scm (mh-move-mail): Use mail-rename instead of sys-rename.
	(maildir-move-mail): Ditto.
	(set-dry-run-mode!): Removed.

	* scmail/mail.scm (mail-rename): New function.
	(<mail>): New slot: dry-run-mode.

2004-03-09  Satoru Takabayashi  <satoru@namazu.org>

	* scmail.scm (scmail-main): New option --dry-run. Suggested by
	Fuyuki Kimra [scmail:264].
	(show-help): Updated.
	(set-dry-run-mode!): New function.
	(scmail-log-to-file): New function.
	(scmail-main): Assign short options.

2004-03-03  Satoru Takabayashi  <satoru@namazu.org>

	* tests/scmail.scm: Added a new test for log files to ensure not
	to contain #<undef>.

	* scmail.scm (maildir-move-mail): Set removed? to #t.
	(mh-move-mail): Ditto.
	(move-mail): Don't set removed? field in the function.

	* Makefile (VERSION): Bumped version number to 1.2.

2004-03-02  Satoru Takabayashi  <satoru@namazu.org>

	* doc/scbayes.rd: Shorten the title.

	* doc/scbayes-ja.rd: Ditto.

2004-02-29  Satoru Takabayashi  <satoru@namazu.org>

	* dot.scmail/deliver-rules.sample.in: Added (use
	scmail.bayesian-filter) for using mail-is-spam?.

	* scmail.scm: Use autoload to load scmail.bayesian-filter only if
	it's necessary. Applied patch by Kimura Fuyuki [scmail:245].
	(refile): Set 'removed? field to #t after calling move-mail.

	* scmail-deliver.in: Don't load scmail.bayesian-filter in the
	program. Applied patch by Kimura Fuyuki [scmail:245].

	* scmail-refile.in: Ditto.

2004-02-21  Satoru Takabayashi  <satoru@namazu.org>

	* scmail.scm (refile): Dont' call mail-remove when move-mail is used.
	(check-folder): New function.
	(scmail-file-list): Use it.

2004-02-18  Satoru Takabayashi  <satoru@namazu.org>

	* tests/scmail.scm ("log files"): Added a test for handling of
	"new" subdir in Maildir.

	* scmail.scm (maildir-file): New parameter: subdir.
	(maildir-get-subdir): New function.
	(maildir-copy-mail): Use it.
	(maildir-move-mail): Ditto.
	(maildir-file-list): Collect files from "new" as well as "cur".

2004-02-16  Satoru Takabayashi  <satoru@namazu.org>

	* scmail/util.scm (scmail-set-program-name!): Use  sys-basename.

	* scbayes.in (main): Added a condition for handling null folders.

	* scmail/bayesian-filter.scm.in (get-mime-boundary): Fixed
	incomplete string bug. Based on the patch from Kimura Fuyuki
	[scmail:228]
	(get-charset): Ditto.

2004-02-10  Satoru Takabayashi  <satoru@namazu.org>

	* scmail/config.scm (scmail-config-set-directory!): Don't use
	expand-path. 

	* scmail.scm (mh-file-list): Use file-is-readable?.
	(maildir-file-list): Ditto.
	(mh-file): Simplified (Don't use exapand-path).
	(maildir-file): Ditto.
	(read-filter-rule): Ditto.

	* scmail-refile.in (main-process): Use file-exists?. [scmail:220].

2004-02-07  Satoru Takabayashi  <satoru@namazu.org>

	* scmail: 1.1 Released!

	* Makefile (DIST): Added an ad hoc code for removing files should
	be generated at build time. [scmail:215]

	* tests/scmail-commands: Removed ^function. [scmail:215]

	* Makefile (VERSION): Bumped version number to 1.1.

2004-02-05  Satoru Takabayashi  <satoru@namazu.org>

	* scmail: 1.0 Released!

	* Makefile (check-gauche): New rule.

	* check-gauche.scm: New file.

	* Makefile (VERSION): Bumped version number to 1.0.

	* scmail/util.scm (scmail-check-gauche-version): Changed the
	required version of Gauche from 0.7.3 to 0.7.4.1.

2004-02-03  Satoru Takabayashi  <satoru@namazu.org>

	* tests/scmail-commands: Added a test for checking the use of
	sys-rename.

	* scmail.scm (refile): Use sys-rename.
	(move-mail): New function.
	(mh-move-mail): New function.
	(*maildir-seq*): Renamed from maildir-id.

	* scmail/config.scm (scmail-config-make-directory): Don't call
	sys-chmod any longer.

	* dot.scmail/config.sample: Added :umask.

	* scmail.scm (scmail-main): Call sys-umask to set umask.

	* scmail/config.scm (<config>): New slot: umask.

	* scmail.scm (scmail-log): Add timezone offset to the time
	part. [scmail:176].
	(redirect): Renamed from forward!. [scmail:206].

	* scmail/bayesian-filter.scm.in: s/jp/ja/g [scmail:176].

2004-02-02  Satoru Takabayashi  <satoru@namazu.org>

	* scmail.scm (valid-rule?): Allow "remove" command.
	(scmail-command-log): Made dest optional.

	* tests/scmail.scm (valid-rules): Added a test for "remove" command.

	* scmail.scm (remove): Write log. Suggested by ABE Yasushi
	[scmail:204].

	* tests/test-rules.in (lambda): Added a test for "remove" command.

	* tests/Makefile (MAIL): Added 6.

	* tests/6: New file.

	* scmail.scm: Use define-method instead of define.
	(refile): Ditto.
	(forward-internal): Ditto.
	(forward): Ditto.
	(forward!): Ditto.
	(remove): New function. Suggested by ABE Yasushi
	<yasushi@stbbs.net> [scmail:197].
	(process-command): Support "remove" command.
	(apply-rule): Ditto.
	(process-command): Simplified.

	* scbayes.in (lock): Fixed the lock mechanism. create-directory*
	no longer raises an exception when the directory already exists.

2004-02-01  Satoru Takabayashi  <satoru@namazu.org>

	* scbayes.in (learn-common): Use with-error-handler to prevent
	accidental exit by an error (e.g. a file is removed while learning).
	(flush-interval): Set default to 0 (unlimited).

2004-01-30  Satoru Takabayashi  <satoru@namazu.org>

	* scbayes.in (learn-common): Use . for displaying the progress bar.

	* scmail/progress.scm (<progress>): bar-mark becomes initializable.

	* tests/scmail-commands: Add a test for scbayes --flush-interval.

	* scbayes.in (flush-interval): New parameter.
	(learn-common): Use it for periodic flushing of both DB files.
	(usage): Updated.
	(main): New option: --flush-interval.

	* scmail/bayesian-filter.scm.in (token-table-cache-flush): Use
	make-hash-table to reset the hash table.

2004-01-29  Satoru Takabayashi  <satoru@namazu.org>

	* scbayes.in (mail-digest): Renaed from file->md5-hex-digest.
	(learn-common): Use it.
	(mail-digest): Calculate MD5 digest using
	from/date/subject/message-id fields instead of the whole content.
	(mail-digest): Use digest-hexify.

2004-01-20  Satoru Takabayashi  <satoru@namazu.org>

	* Makefile (DIST): Add AUTHORS.

	* AUTHORS: New file.

	* doc/scbayes-ja.rd (index): Documentation updated.

	* doc/scbayes.rd: Documentation updated.

2004-01-19  Satoru Takabayashi  <satoru@namazu.org>

	* scmail/progress.scm (<progress>): New slot: title-width.
	(title): Use it.
	(show): Ditto.
	(<progress>): Rename a slot: bar-length -> bar-width.
	(initialize): Call show instead of show-progress.

	* scbayes.in (prepare-temporary-files): Sleep one second per 1 MB
	while copying a file in slow mode.
	(learn-common): Sleep one secound per 100 digests while flushing
	the digest cache in slow mode.
	(prepare-temporary-files): Check if a digest file is found while a
	token table file is not found.

	* scmail/bayesian-filter.scm.in (token-table-cache-flush): Count the
	number of keys in the cache and pass it to proc.

	* scbayes.in (prepare-temporary-files): Renamed from
	prepare-temporary-table-file and create a temporary digest file.
	(temporary-digest-file): New function.
	(open-digest-db): Take a parameter: file.
	(swap-files): Renamed from swap-table-file and use signal handlers
	to ignore SIGINT SIGHUP SIGTERM.
	(swap-files): Handle a temporary digest file as well as a token
	table file.
	(main): New option: --slow.
	(slow?): New parameter.
	(learn-common): Sleep one second per file and also sleep one
	secound per 100 keys while flushing the token table cache in
	slow mode.

2004-01-18  Satoru Takabayashi  <satoru@namazu.org>

	* scbayes.in (main): Rename options: --learned -> --digest
	--dump-learned -> --dump-digest.
	(usage): Updated.
	(add-to-digest-cache!): New function.
	(flush-digest-cache): New function.
	(learned?): Refer (digest-cache) as well as (digest-db).

	* dot.scmail/config.sample (:digest): Renamed from :learned.

	* scmail/config.scm (<config>): Rename a slot: learned -> digest.

	* scbayes.in (learn-common): Clean a temporary table file if the
	processing is aborted.
	(learn-files): Returns number of learned files.
	(learn-common): Show a summary at the end of the processing.
	(learned-cache): New variable.

	* scmail/progress.scm (show): Add an extra space to the end of format.

2004-01-16  Shiro Kawai  <shiro@acm.org>

	* scbayes.in (update-db) : removed --update-db option.  It is
	obsolete and useless now.

	* scmail/bayesian-filter.scm.in (tokenize-port): count multibyte
	chars and ascii chars, to determine whether the parsed mail is in
	japanese or not heuristically.
	(tokenize-email, tokenize-message, tokenize-header, tokenize-body):
	use a special charset name "none" to indicate the fallback parsing
	after the default parsing scheme failed.

	* doc/scbayes-ja.rd : revised to reflect the recent changes.

	* doc/scbayes.rd : added contents.

2004-01-16  Satoru Takabayashi  <satoru@namazu.org>

	* scmail/progress.scm (initialize): Call port-buffering to turn
	off buffering.
	(show-progress): Update the progress bar if one sec. elapsed.

	* scmail.scm (scmail-main): Use with-output-to-file to realize
	quiet-mode. 
	(scmail-main): New parameter: quiet-mode.

	* scmail/config.scm (scmail-config-set-quiet-mode!): Removed.
	(scmail-config-quiet-mode?): ditto.

	* scmail/util.scm (scmail-wformat): Don't refer
	(scmail-config-queit-mode?) any longer.

	* scmail/progress.scm (<progress>): Change the default value of
	port to (current-output-port).
	(<null-progress>): Removed.

	* scbayes.in: Don't use
	scmail-print/scmail-format/scmail-make-progress any longer.

	* scmail/util.scm (scmail-print): Removed.
	(scmail-format): Ditto.
	(scmail-make-progress): Ditto.

	* scbayes.in (dump-table): New function.
	(dump-learned): New function.
	(main): New option: --dump-table, --dump-learned, --learned.
	(usage): Updated.
	(learn-common): Accept directories as well as folders.
	(collect-target-files-from-folders): New function.
	(collect-target-files): New function.
	(check-folder): use it.
	(check-folder-dir): Accept a directory in absolute path.
	(learn-common): Call scmail-config-make-directory in the function.
	(main): Use with-output-to-file to realize quiet-mode.

	* scmail/bayesian-filter.scm.in: Remove $ Id $ line.
	(token-table-index-of-spam): Renamed from spam-table.
	(token-table-index-of-nonspam): Renamed from nonspam-table.

	* scbayes.in: Remove $ Id $ line.

	* scmail/progress.scm (progress-finish!): Renamed from
	progress-finish.
	(progress-set!): Ditto.
	(progress-inc!): Ditto.
	(progress-set!): Removed because it has not been used.

	* scmail/bayesian-filter.scm.in (token-table-collect-words):
	Renamed from collect-words and take a main instead of a file as a
	parameter.
	(token-table-discard-words): Ditto.

	* scbayes.in (learn-common): Show a progress bar for "write" in
	this function instead of in bayesian-filter.scm.

	* scmail/bayesian-filter.scm.in (token-table-cache-length): New
	function. 

	* scbayes.in (learn-common): Use token-table-cache-flush.

	* scmail/bayesian-filter.scm.in (load-token-table-if-not-loaded):
	Use errorf.
	(close-token-table): Don't flush the hash table in this function.
	(token-table-cache-flush): New function.

	* scbayes.in (check-mail): Don't use test-spamness-of-file any longer.
	(test-spamness-of-files): Moved from bayesian-filter.in.

	* scmail/bayesian-filter.scm.in (table-for-each): New function.
	(special-key-prefix): New function.
	(*message-count-key*): Use it.
	(total-token-count): Use it.
	(simple-stat): Removed.
	(message-count): Be exported.
	(total-token-count): Ditto.
	(token-table-languages): Renamed from *languages*.
	(token-table-number-of-values): Renamed from *num-values*.
	(token-table-for-each): Renamed from table-for-each.
	(token-table-special-key-prefix): Renamed from special-key-prefix.
	(token-table-message-count): Renamed from message-count.
	(token-table-token-count): Renamed from total-token-count.
	(test-spamness-of-file): Removed.

	* tests/scmail-commands: Add test for scbayes --unlearn.

	* scbayes.in (usage): Updated.
	(main): New option: --unlearn-nonspam and --unlearn-spam.
	(learn-common): Fix the skip? condition.

	* tests/bayesian-filter.scm.in (get-total-token-count): Add test
	for discard-words.

	* scmail/bayesian-filter.scm.in (total-token-count): Renamed from
	count-tokens. 
	(message-count): New method.
	(simple-stat): Never call load-token-table-if-not-loaded.

2004-01-15  Shiro Kawai  <shiro@acm.org>

	* Makefile (install): use '-f' option of cp to avoid an error
	when installed by non-priviledged user.

	* scmail/bayesian-filter.scm.in (tokenize-header):
	use tokenize-iso8859 when charset is us-ascii, to avoid "EOF
	encountered during reading multibyte character" error.

2004-01-15  Satoru Takabayashi  <satoru@namazu.org>

	* scmail/bayesian-filter.scm.in (process-words): New function.
	(collect-words): Use it.
	(discard-words): New function.
	(delete-token): New function.
	(process-token): New function.
	(add-token): Use it.
	(minus->zero): New function.
	(close-token-table): Use it.
	(close-token-table): Set token-table to #f.
	(simple-stat): Use load-token-table-if-not-loaded.
	(test-spamness-of-file): Ditto.
	(test-spamness-of-files): Ditto.
	(close-token-table): Never use minus->zero.
	(safe-inc!): New syntax.
	(process-words): Use safe-inc!.
	(process-token): Ditto.
	(with-token-table): Returns nothing.
	(message-count-of-type): Renamed from message-count.
	(process-token): Fix the bug of counting total-token-count
	redundantly.
	(process-token): Simplified.
	(safe-inc!): Removed.
	(close-token-table): Use minus->zero.
	(<token-table>): Remove a slot: total-token-count.
	(open-token-table): Remove total-token-count related code.
	(*total-token-count-key*): Removed.
	(count-tokens): New function.
	(simple-stat): Use it.

	* scbayes.in (learn-common): New function.
	(learn): Use it.
	(unlearn): New function.
	(not-learned?): New function.
	(delete-from-learned-db!): New function.
	

	* tests/scmail-commands: Add test for scbayes --force.

	* scbayes.in (learned?): New function.
	(add-to-learned-db!): New function.
	(file->md5hex-digest): New function.
	(open-learned-db): New function.
	(force-learn?): New parameter.
	(learn): Use them.
	(learned-file): New function.
	(*learned-file*): New variable.
	(main): New option: --force.
	(usage): Updated.

	* scmail/progress.scm (<null-progress>>): Simplified.

	* scmail/util.scm (scmail-format): New function.

	* scmail/bayesian-filter.scm.in: Use scmail-format and
	scmail-print for --quiet option.

	* scbayes.in (update-db): Use scmail-format and scmail-print for
	--queiet option.
	(usage): Change exit code to zero (GNU command style).

	* scmail/bayesian-filter.scm.in (load-token-table-if-not-loaded):
	Use scmail-eformat.

	* scbayes.in (check-folder-dir): Use scmail-eformat.
	(check-mail): Ditto.

	* scmail/util.scm (scmail-xformat): Renamed from scmail-xprintf.
	(scmail-wformat): Renamed from scmail-wprintf.
	(scmail-dformat): Renamed from scmail-dprintf.
	(scmail-eformat): Renamed from scmail-eprintf.

	* scmail.scm (scmail-log): Use format and take optional arguments
	for it.
	(scmail-error-log): Ditto.

	* scbayes.in (scmail-main): Use scmail-check-gauche-version.

	* scbayes.in (main): Use scmail-check-gauche-version.

	* scmail/util.scm (scmail-check-gauche-version): New function.

	* scmail/config.scm: Remove an old path of token-table.dbm. 

	* tests/scmail-commands: Add tests for scbayes.

	* scbayes.in (main): Change exit status according to the result.
	(check-mail): Returns always 0.
	(check-folder): Returns the number of incorrect answers.
	(table-stat): Returns always 0.
	(update-db): Returns always 0.

	* scmail/config.scm (scmail-config-read): Simplified.

	* scmail/util.scm (scmail-xprintf): Simplified.
	(scmail-wprintf): Ditto.
	(scmail-eprintf): Ditto.
	(scmail-dprintf): Ditto.
	(scmail-make-progress): Ditto.

	* dot.scmail/deliver-rules.sample.in: Renamed from
	dot.scmail/deliver-rules.

	* Makefile (dot.scmail/deliver-rules.sample): new rule.

	* tests/mail.scm: Check send-mail whether or not it allows
	incomplete string. [scmail:147] [scmail:149]

2004-01-14  Satoru Takabayashi  <satoru@namazu.org>

	* scmail/mail.scm: Support incomplete string. [scmail:147] by Shiro.

	* scmail/bayesian-filter.scm.in (test-spamness-of-file): Returns
	prob.
	(test-spamness-of-files): Returns the number of incorrect answers.

	* tests/Makefile (TESTS): Add bayesian-filter.scm

	* scmail/bayesian-filter.scm.in (spamness-of-mail): Call
	load-token-table-if-not-loaded.
	(spamness-of-word): Ditto.
	(load-prob-tables): Returns #t.

	* Makefile (tests/test-rules): Removed.

	* scmail/bayesian-filter.scm.in: Returns total-token-count.
	(load-token-table-if-not-loaded): Reopen if db is closed.

2004-01-13  Shiro Kawai  <shiro@acm.org>

	* scmail/bayesian-filter.scm.in (tokenize-port): Make tokenizer's
	character sets work on any internal character encodings.

2004-01-14  Satoru Takabayashi  <satoru@namazu.org>

	* COPYING: New file. Based on Gauche's.

	* scmail: Change the licence: GPL -> BSD. [scmail:142].

	* Makefile (dist-scbayes): Removed.

	* Makefile.scbayes (install): Removed. [scmail:143].

	* tests/progress.scm: New file.

	* doc/scmail.rd (index): Updated.

	* doc/scmail-ja.rd: Updated.

	* tests/scmail-commands: New file.

	* scmail/mail.scm (mail-read): Use filter to avoid old Gauche
	versions bug. rfc822-header->list returns (#t #t).

	* Makefile (tests/test-rules): New rule.

	* tests/test-rules.in: New file.

	* Makefile (scmail/bayesian-filter.scm): Use codeconv.scm.
	(tests/scmail.scm): New rule.

	* codeconv.scm: New file.

	* scmail.scm (scmail-main): Simplified.
	(mh-copy-mail): Fix the argument for mh-last-mail-id.
	(mh-last-mail-id): Fix the return value bug.

	* scmail-deliver.in (main-process): Simplified.

	* scmail-refile.in (main-process): Simplified.

	* scmail.scm (scmail-filter): Remove second parameter: filter-rules.

	* tests/5: New file.

	* tests/4: New file.

	* tests/3: New file.

	* tests/Makefile (mh-mailbox): New rule.
	(maildir-mailbox): New rule.

2004-01-13  Satoru Takabayashi  <satoru@namazu.org>

	* scmail/bayesian-filter.scm.in: New fie.

	* Makefile (scmail/bayesian-filter.scm): Generate it at build time.
	Patch by ABE Yasushi <yasushi@stbbs.net> [scmail:137]. 

	* scmail/mail.scm (mail-name): Preserve file-name info. Suggested
	by  Shiro Kawai <shiro@acm.org> [scmail:135].
	(mail-read): Fix 'body info.

	* scmail.scm (valid-rule?): New function.
	(add-filter-rule!): Use it.
	(add-bayesian-filter-rule!): Simplified.
	(scmail-filter): Add error handling.
	(bayesian-filter): New function.
	(add-bayesian-filter-rule!): Use it.

	* tests/Makefile (TESTS): Add scmail.scm.

	* tests/scmail.scm: New file.

	* scmail/config.scm (<config>): Remove a slot: stdout-report.

	* scmail.scm (scmail-log): Not to refer stdout-report slot.

	* scmail-deliver.in (main-process): Use scmail-config-set-quiet-mode!.

	* scmail-refile.in (main-process): Not to use stdout-report slot.

	* scmail.scm (scmail-main): New option: --scmail-dir.
	(show-help): Updated.

	* scbayes.in (main): New option: --scmail-dir.
	(usage): Updated.

	* scmail/config.scm (scmail-config-set-directory!): New function.
	(scmail-config-directory): New parameter.
	(build-config-path): New function.
	(scmail-config-default-file): Use it.
	(choose): Ditto.
	(scmail-config-get-path): Ditto.
	(initialize): Simplified.

	* tests/Makefile (TESTS): Add mail.scm and util.scm, config.scm.

	* tests/util.scm: New file.

	* scmail/util.scm (scmail-wprintf): Fix the infinite recursion bug.

	* tests/syntax.scm: Renamed from check-syntax.scm

	* scmail/mail.scm (scmail.mail): Not to export mail-read.
	(send-mail): Return #t if successful.

	* tests/check-syntax: Removed.

	* tests/Makefile (check): Modified to use gosh for testing.

	* tests/mail.scm: New file.

	* scmail/mail.scm (mail-from-stdin?): Refer (standard-input-port)
	instead of (current-input-port).

	* scmail.scm (scmail-main): New option: --quiet.
	(scmail-log): Use scmail-config-queit-mode?.

	* scmail/util.scm (scmail-set-program-name!): Renamed from
	scmail-set-program-name. 

	* scmail/config.scm (scmail-config-set-verbose-mode!): Renamed
	from scmail-config-set-verbose-mode.
	(scmail-config-set-quiet-mode!): Renamed from
	scmail-config-set-quiet-mode. 

	* scmail.scm (scmail): Export scmail-log and forward!

2004-01-12  Satoru Takabayashi  <satoru@namazu.org>

	* scmail.scm (make-dest-directory): Remove a parameter: mailbox.
	(copy-mail): Ditto.
	(mh-copy-mail): Ditto.
	(maildir-copy-mail): Ditto.
	(foward!): New function.
	(forward-internal): New function.
	(forward): Use it.
	(forward!): Ditto.
	(process-command): Add forward!.

	* scmail/mail.scm (scmail.mail): Export mail-forward. Reported by
	ABE Yasushi <yasushi@stbbs.net> [scmail:129]. 

	* scmail.scm (mh-file): Restored. Reported by ABE Yasushi
	<yasushi@stbbs.net> [scmail:127]. 
	(maildir-file): Ditto.

2004-01-10  Satoru Takabayashi  <satoru@namazu.org>

	* scmail/config.scm (scmail-config-make-directory): Use #o notation.

	* scmail.scm (read-black-list-file): Removed.
	(scmail-main): No longer use black-list.

	* scmail/config.scm (<config>): Remove a slot: black-list.
	(initialize): Ditto.
	(choose): Ditto.

	* dot.scmail/config.sample: Remove black-list.

	* Makefile (check): New rule.

	* tests/Makefile: New file.

	* tests/check-syntax: New file.

	* tests/check-syntax.scm: New file.

	* dot.scmail/deliver-rules.sample: New file.

	* dot.scmail/refile-rules.sample: New file.

	* dot.scmail/config.sample: New file.

	* Makefile (DIST): Remove scmailrc*.sample
	(install): Copy dot.scmail files.
	(dist): Include dot.scmail files.

	* scmail.scm (scmail-folder->directory): Renamed from
	folder->directory.

	* scbayes.in (check-mail): Use test-spamness-of-file.
	(check-folder): Use test-spamness-of-files.
	(check-folder-dir): Use scmail-folder->directory.
	(folder-dir): Removed.
	(mailbox-type): Removed.
	(mailbox-dir): Removed.

	* scmail/bayesian-filter.scm (test-spamness-of-file): Renamed from
	test-spamness-of-mail. 
	(test-spamness-of-files): Renamed from test-spamness-in-folder and
	modify parameters..

	* scbayes.in (collect-target-files): Removed.

	* scmail-refile.in (main-process): Simplified.

	* scmail.scm (scmail-file): Removed.
	(mh-file): Removed.
	(maildir-file): Removed.
	(scmail-file-list): Take folder instead of directory.
	(mh-file-list): Ditto.
	(maildir-file-list): Ditto.
	(folder->directory): New function.

	* scbayes.in (lock): Use create-directory* instead of sys-mkdir.

	* scmail/config.scm (scmail-config-make-directory): Use
	create-directory* instead of sys-mkdir.

	* scmail.scm (mh-file-list): Simplified.
	(maildir-make-sub-directories): Ditto.
	(maildir-generate-new-id): Use inc!.

	* scmail/util.scm (scmail-dprintf): Use scmail-config-verbose-mode?.

	* scmail.scm (scmail-main): Use verbose instead of debug.
	(show-help): Updated.

	* scbayes.in (main): Use verbose instead of debug.
	(usage): Updated.

	* scmail/config.scm (<config>): Rename slot: debug-mode ->
	verbose-mode.
	(scmail-config-set-verbose-mode): Renamed from debug to verbose.
	(scmail-config-verbose-mode?): Ditto.

	* scmail/mail.scm (mail-read): Don't parse the content if it is empty.

	* scmail/bayesian-filter.scm (load-token-table-if-not-loaded):
	Fixed slot name: scbayes-table-file -> token-table.

	* scmail.scm: Use scmail-set-program-name.

	* scbayes.in (lock): Fixed the mode for sys-mkdir.

	* scmail.scm (scmail-main): Use scmail-config-make-directory.

	* scmail/config.scm (scmail-config-make-directory): New function.

	* scmail/config.scm (scmail-config-default-file): Use choose.
	(scmail-config-get-path): New function.

	* scmail.scm: Use scmail-config-get-path.
	(scmail-log): Ditto.

	* scmail/config.scm (scmail-config-default-file): ~/.scmailrc ->
	~/.scmail/config.

	* scmail.scm (scmail-main): Remove an option: --kill.

	* scmail-deliver.in (main): Simplified.

	* scmail-refile.in (main): Simplified.

	* scmail/config.scm (<config>): Rename slot: scbayes-table-file ->
	token-table. 
	(<config>): New slot: learned, black-list, white-list.

	* scbayes.in (learn): Take folders instead of a single folder.

	* scmail/progress.scm (time-difference->real): New function.

	* scbayes.in (lock): New function.
	(collect-target-files): New function.
	(learn): Use them.

	* scmail/bayesian-filter.scm (collect-words): Simplified. Take a
	file instead of a folder as a parameter.

2004-01-09  Satoru Takabayashi  <satoru@namazu.org>

	* scbayes.in (prepare-temporary-table-file): Use make-progress.

	* scmail/util.scm (scmail-make-progress): Moved from
	bayesian-filter.scm. 

	* scmail/bayesian-filter.scm (scmail-make-progress): Renamed from
	make-progress. 

	* scbayes.in (main): New option: --quiet.
	(usage): Updated.

	* scmail/config.scm (scmail-config-quiet-mode?): New function.
	(scmail-config-set-quiet-mode): New function.
	(<config>): New slot: quiet-mode.

	* scmail/bayesian-filter.scm (collect-words): Use <progress>.
	(make-progress): New function.
	(collect-words): Use make-progress.
	(make-progress): Use scmail-config-queit-mode.
	(close-token-table): Use make-progress.

	* scmail/util.scm (scmail-dprintf): Use scmail-config-debug-mode?.

	* scmail/config.scm (scmail-config-debug-mode?): New function.

	* scbayes.in (main): Use scmail-config-set-debug-mode.

	* scmail.scm (main-process): Use scmail-config-set-debug-mode.

	* scmail/config.scm (scmail-set-debug-mode): Moved from util.scm.
	(scmail-config-set-debug-mode): Renamed from scmail-set-debug-mode.

	* scmail/util.scm (debug-mode): Removed.
	(scmail-dprintf): Use scmail-config.

	* scmail/config.scm (write-object): Simplified.
	(<config>): New slot: debug-mode.

	* scmail/progress.scm: New file.

	* scmail/bayesian-filter.scm (tokenize-body): Use scmail-dprintf
	instead of report.
	(tokenize-body): Ditto.
	(tokenize-email): Use scmail-wprintf instead of report.
	(report): Removed.

	* scbayes.in (main): New option: --debug.

	* scmail.scm (scmail-main): New option: --debug.
	(show-help): Updated.

	* scmail/util.scm (scmail-dprintf): New function.
	(scmail-set-debug-mode): New function.
	(debug-mode): New parameter.

	* scmail/bayesian-filter.scm (tokenize-header): Use mail-decode-field.

	* scmail/mail.scm (mail-decode-field): Renamed from decode-field.
	(mail-read): Use mail-decode-field.

	* scmail.scm (*last-match-data*): Parameterized.
	(*match-data-replace-rule*): Ditto.
	(*filter-rules*): Ditto.
	(replace-param): Renamed from replace-folder-name.
	(copy): Use it.
	(refile): Ditto.
	(forward): Ditto.

	* scbayes.in (main): New option: --config.
	(usage): Updated.
	(read-config): Removed.
	(mailbox-dir): Use scmail-config.
	(mailbox-type): Ditto.
	(table-file): Ditto.

	* scmail/config.scm (scmail-default-config-file): New function.

	* scmail-deliver.in (main): Simplified.

	* scmail-refile.in (main): Simplified.

	* scbayes.in (main): Use scmail-set-program-name.
	(learn): Use scmail-wprintf and scmail-eprintf.

	* scmail.scm (scmail-main): Use scmail-set-program-name.

	* scmail/util.scm (program-name): New parameter.
	(scmail-set-program-name): New function.
	(scmail-eprintf): Ditto.
	(scmail-wprintf): Ditto.

	* scmailrc-deliver.sample: Update examples.

	* scmail.scm (process-rule): Simplified.
	(*last-match-data*): New global variable.
	(replace-folder-name): Use it.
	(match-rule?): New function.
	(object-apply): Make <mail> applicable.

	* scmail/bayesian-filter.scm (decode-field): Removed.

	* scmail/config.scm (<config>): Remove a slot: charcode.

	* scmailrc-refile.sample: Update examples.

	* scmail/bayesian-filter.scm (tokenize-body): Commented out
	"skipping ..." message.

	* scmail.scm (scmail-file): Renamed from scmail-file-name.
	(mh-file): Renamed from mh-file-name.
	(maildir-file-name): Renamed from maildir-file-name.

	* scmail/mail.scm (mail-read): Eliminate an unnecessary call of
	read-content. 

2004-01-08  Satoru Takabayashi  <satoru@namazu.org>

	* scmail/mail.scm (<mail>): New slot: file.

	* scmail-refile.in (main): Simplified.

	* scmail-deliver.in (main-process): Simplified.

	* scmail/mail.scm (<mail>): Remove a slot: charcode.

	* scmail/bayesian-filter.scm (test-spamness-of-mail): Use <mail>
	class.
	(test-spamness-in-folder): Change a variable name: email -> file-name.

	* scmail.scm (add-bayesian-filter-rule!): New method.

	* scmail/bayesian-filter.scm (load-token-table-if-not-loaded): New
	function. 
	(mail-is-spam?): Use load-token-table-if-not-loaded.

	* scmail.scm: Use expand-path and build-path instead of
	expand-file-name throughout the file.

	* scmail/config.scm: Use expand-path instead of expand-file-name
	throughout the file.

	* scmail/util.scm (safe-rxmatch): Moved from scmail.scm.
	(expand-file-name): Removed. 

	* scmail.scm (*filter-rules*): Renamed from global-filter-rules.
	(*match-data-replace-rule*): Renamed from
	global-match-data-replace-rule. 

	* scbayes.in (*from*): Removed.
	(*to*): Removed.

	* scmail-refile.in (main-process): Simplified.

	* scmail.scm: Use scmail-config function instead of config
	variable throughout the file and remove unnecessary parameters for
	all functions.
	(scmail-file-list): Renamed from file-list.
	(scmail-file-name): Renamed from file-name.
	(copy): New function.
	(refile): Ditto.
	(forward): Ditto.

	* scmail/config.scm (scmail-config-read): Renamed from
	read-config-file.
	(scmail-config): New function.

	* scmail/util.scm: New file.

	* scmail.scm (copy-mail): Dispatch according to 'mailbox-type.
	(file-name): Ditto.
	(file-list): Ditto.
	(initialize): Simplified.
	(<config>): Remove slots: copy-mail, file-list, file-name.
	(<config>): New parameter: scbayes-table-file.

	* scmailrc.sample: New parameter: scbayes-table-file.

	* scmail.scm (scmail-filter): Renamed from mail-filter.
	(copy-mail): Renamed from mail-copy.

	* scmail-refile.in: Use scmail.mail module. 

	* scmail-deliver.in: Use scmail.mail module.

	* scmail/mail.scm: New file.

	* scmail/bayesian-filter.scm (mail-is-spam?): Take mail instead of
	file.
	(spamness-of-mail): Ditto.
	(tokenize-email): Ditto.
	(tokenize-mime): Rename the first parameter: file -> file-name.
	(tokenize-body): Ditto.
	(tokenize-message): Ditto.
	(collect-words): Use <mail> class.

	* scmail.scm: Use ref instead of slot-ref throughout the file.

2004-01-07  Satoru Takabayashi  <satoru@namazu.org>

	* scbayes.in (do-read-lock): New function.
	(do-write-lock): Ditto.
	(port-is-write-locked?): Ditto.
	(temporary-table-file): Ditto.
	(prepare-temporary-table-file): Ditto.
	(swap-table-file): Ditto.
	(learn): Use them.
	(lock-file): New function.
	(file-is-write-locked?): Removed.
	(do-write-unlock): Ditto.
	(do-write-lock): Ditto.
	(learn): Do simple locking with sys-mkdir.

2004-01-06  Satoru Takabayashi  <satoru@namazu.org>

	* scbayes.in (main): Modified --learn-nonspam and --learn-spam
	options accept one or more folders using supplemental functions
	called get-folders and learn-lnternal.
	(usage): Updated.

2004-01-05  Satoru Takabayashi  <satoru@namazu.org>

	* scmail.scm (<config>): New slot: spam.
	"junk" slot is now for backward compatibility.
	(read-kill-file): Use "spam" slot instead of "junk".
	(write-object): Ditto.
	(mail-read): Use decode-field to decode a field.

	* scmailrc.sample: s/junk/spam/g.

	* doc/scmail.rd: Document updated.

	* doc/scmail-ja.rd: Document updated.

	* Makefile (VERSION): Bumped version number to 0.3pre1.

2003-12-28  Shiro Kawai  <shiro@acm.org>

	* scmail/bayesian-filter.scm: use srfi-1 explicitly. (Patch from
	Kimura Fuyuki).

2003-12-09  Shiro Kawai  <shiro@acm.org>

	* scmail/bayesian-filter.scm (get-mime-boundary):
	Fixed regexp of finding MIME boundary (pointed by Kimura Fuyuki).

	* scmail.scm (mail-read): Reads message body as a binary block
	to avoid character-encoding related error.  Also changed to
	use rfc.822 module to parse the message headers.

2003-11-25  OHASHI Akira  <bg66@koka-in.org>

	* Makefile (SITELIBDIR): New macro.
	(install): Use it.

2003-11-18  Satoru Takabayashi  <satoru@namazu.org>

	* scbayes.in: Apply a patch by OHASHI Akira <bg66@koka-in.org>.
	<http://www.koka-in.org/~bg66/blog/archives/000068.html>
	(learn): Support Maildir.
	(check-folder): Ditto.
	(main): Ditto.

	* scmail/bayesian-filter.scm: Apply a patch by OHASHI Akira
	<bg66@koka-in.org>.
	(collect-words): Support Maildir.
	(test-spamness-in-folder): Ditto.

2003-05-08  Satoru Takabayashi  <satoru@namazu.org>

	* scmail.scm (read-kill-file): Fix a bug. (forgot to use , to
	evaluate an expression)

2003-04-23  Shiro Kawai  <shiro@acm.org>

	* scbayes.in: Incorporated scbayes source

	* scmail/bayesian-filter.scm: Incorporated scbayes source
	
	* doc/scbayes.txt: Added
	
	* Makefile: Integrated scbayes

2003-04-21  Satoru Takabayashi  <satoru@namazu.org>

	* scmail.scm: Fix the malformed field bug.
	- Thanks to Shiro Kawai <shiro@lava.net> for the
	patch. [scmail:31]

2003-04-16  Satoru Takabayashi  <satoru@namazu.org>

	* scmail.scm (scmail): Export mail-write.
	(maildir-get-suffix): New function.
	(maildir-mail-copy): Preserver suffix info such as ":2,S"
	(read-kill-file): Junk files go to (slot-ref config 'junk).
	(<config>): New field: junk.

2003-03-23  Satoru Takabayashi  <satoru@namazu.org>

	* scmail.scm (safe-rxmatch): New function.
	Use safe-rxmatch instead of rxmatch throughout the file.

2003-03-21  Satoru Takabayashi  <satoru@namazu.org>

	* scmail: 0.2 Released!

2003-03-19  Satoru Takabayashi  <satoru@namazu.org>

	* scmail.scm (set-match-data-replace-rule!): New function.
	(replace-folder-name): Use global-match-data-replace-rule.

2003-03-18  Satoru Takabayashi  <satoru@namazu.org>

	* scmail.scm (mail-separate): Allow a mail with an empty body.
	- Thanks to Shiro Kawai <shiro@lava.net> for the patch.
	(mh-mail-copy): Renamed from mail-copy.
	(mh-last-mail-id): Renamed from last-mail-id.
	(mh-file-list): Renamed from file-list.
	(mh-file-name): Renamed from file-name.
	(mail-copy): Be dispatch function.
	(initialize): Initialize dispatch functions.
	(file-list): New function.
	(file-name): New function.
	(maildir-generate-new-id): New function.
	(maildir-file-name): New function.
	(maildir-mail-copy): New function.
	(maildir-file-list): New function.
	(maildir-safe-mail-copy): New function.
	(command-copy): Modify the log message.
	(command-refile): Ditto.

2002-10-24  Satoru Takabayashi  <satoru@namazu.org>

	* scmail: 0.1 Released!

	* scmail.scm (scmail-main): Add --help option.
	(show-help): New function.

2002-10-23  Satoru Takabayashi  <satoru@namazu.org>

	* scmail.scm (<config>): Use gauche-character-encoding to
	determine the internal character encoding.
	(read-filter-rule): Use with-error-handler to handle a broken
	filter rule.
	(scmail-command-log): New function.
	(scmail-log): Rewritten.
	(read-kill-file): Add facility for error logging.
	(read-filter-rule): Ditto.

2002-10-16  Satoru Takabayashi  <satoru@namazu.org>

	* scmail.scm (send-mail): Fix the period at the beginning of line
	handling.

2002-10-10  Satoru Takabayashi  <satoru@namazu.org>

	* scmail.scm (mail-read): Snip the first "From " line in the function.
	(mail-separate): Don't snip the first "From " line in the function.

2002-10-09  Satoru Takabayashi  <satoru@namazu.org>

	* scmail.scm (filter): Reinvent it because filter in srfi-1 module
	is too slow.

	* Makefile: Create scmail-deliver from scmail-deliver.in.
	Create scmail-refile from scmail-refile.in.

	* scmail-deliver: Removed.

	* scmail-refile: Removed.

	* scmail-deliver.in: New file.

	* scmail-refile.in: New file.

	* scmail-refile (main-process): Set (config 'stdout-report) to #t.

	* scmail.scm (read-kill-file): Use expand-file-name.
	(read-config-file): Ditto.
	(read-filter-rule): Ditto.
	(scmail-log): Ditto.
	(<config>): Add new field: stdout-report

2002-09-26  Satoru Takabayashi  <satoru@namazu.org>

	* scmail.scm (decode-field): Use quoted-printable-decode-string if
	necessary.

2002-09-25  Satoru Takabayashi  <satoru@namazu.org>

	* scmail.scm (regexp?): Abolished. Use Gauche's one.

2002-09-20  Satoru Takabayashi  <satoru@namazu.org>

	* scmailrc-kill.sample: New file.

2002-09-19  Satoru Takabayashi  <satoru@namazu.org>

	* scmailrc-deliver.sample: New file.

	* scmailrc-refile.sample: New file.

	* scmailrc.sample: New file.

	* scmail-deliver: New file.

	* scmail-refile: New file.

2002-09-10  Satoru Takabayashi  <satoru@namazu.org>

	* scmail.scm: Development started!

