From 1bd16c42e347b6e5caf3664230071cff98686ec9 Mon Sep 17 00:00:00 2001 From: teranisi Date: Wed, 29 Aug 2001 05:50:08 +0000 Subject: [PATCH] * wl.el (wl): Changed position of `wl-check-environment'. (toplevel): Added autoload setting for wl-acap. * wl-vars.el (wl-setting): New custom group. (wl-from): Added wl-setting group. (wl-user-mail-address-list): Ditto. (wl-organization): Ditto. (wl-subscribed-mailing-list): Ditto. (wl-envelope-from): Ditto. (wl-smtp-posting-user): Ditto. (wl-smtp-posting-server): Ditto. (wl-smtp-posting-port): Ditto. (wl-smtp-authenticate-type): Ditto. (wl-pop-before-smtp-user): Ditto. (wl-pop-before-smtp-server): Ditto. (wl-pop-before-smtp-port): Ditto. (wl-pop-before-smtp-authenticate-type): Ditto. (wl-nntp-posting-server): Ditto. (wl-nntp-posting-user): Ditto. (wl-nntp-posting-port): Ditto. (wl-fetch-confirm-threshold): Ditto. (wl-prefetch-threshold): Ditto. (wl-thread-insert-opened): Ditto. (wl-ldap-server): Ditto. (wl-ldap-port): Ditto. (wl-ldap-base): Ditto. (wl-ldap-objectclass): Ditto. (wl-use-ldap): Ditto. (wl-draft-config-alist): Ditto. (wl-draft-config-matchone): Ditto. (wl-template-alist): Ditto. (wl-message-sort-field-list): Ditto. (wl-message-ignored-field-list): Ditto. (wl-message-visible-field-list): Ditto. (wl-interactive-send): Ditto. (wl-summary-move-order): Ditto. (wl-auto-select-first): Ditto. (wl-auto-select-next): Ditto. (wl-interactive-save-folders): Ditto. * wl-folder.el (wl-folder): Moved position of `wl-folder-init'; Initialization codes are moved from wl-local-folder-init. (wl-local-folder-init): Follow the change above. (wl-folder-init): Call `wl-acap-init' when `wl-use-acap' is non-nil. * wl-acap.el: New file. * elmo-imap4.el (elmo-imap4-default-mailbox, elmo-imap4-default-server elmo-imap4-default-authenticate-type, elmo-imap4-default-user, elmo-imap4-default-port, elmo-imap4-default-stream-type, elmo-imap4-stream-type-alist): Moved to elmo-vars.el. * elmo-pop3.el (elmo-pop3-default-user, elmo-pop3-default-server, elmo-pop3-default-authenticate-type, elmo-pop3-default-port, elmo-pop3-default-stream-type, elmo-pop3-stream-type-alist): Ditto. * elmo-nntp.el (elmo-nntp-default-server, elmo-nntp-default-user, elmo-nntp-default-port, elmo-nntp-default-stream-type, elmo-nntp-stream-type-alist): Ditto. * elmo-vars.el: Follow changes above. (elmo-setting): New custom group; added 'elmo-setting group to above variables. * acap.el (acap-parse-response): Don't delete process when BYE response (It causes hang-up on slow network environment). (toplevel): Added comment. * WL-ELS (WL-MODULES): Added wl-acap. --- ChangeLog | 4 + WL-ELS | 2 +- elmo/ChangeLog | 25 +++++ elmo/acap.el | 3 + elmo/elmo-imap4.el | 39 ------- elmo/elmo-nntp.el | 27 ----- elmo/elmo-pop3.el | 34 ------- elmo/elmo-vars.el | 128 ++++++++++++++++++++++- wl/ChangeLog | 47 +++++++++ wl/wl-acap.el | 285 ++++++++++++++++++++++++++++++++++++++++++++++++++++ wl/wl-folder.el | 36 +++---- wl/wl-vars.el | 118 +++++++++++++++------- wl/wl.el | 20 ++-- 13 files changed, 602 insertions(+), 166 deletions(-) create mode 100644 wl/wl-acap.el diff --git a/ChangeLog b/ChangeLog index 90cd12a..00d0224 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2001-08-29 Yuuichi Teranishi + + * WL-ELS (WL-MODULES): Added wl-acap. + 2001-08-28 Katsumi Yamaoka * WL-MK: Byte-optimize the function `char-after' for old Emacsen. diff --git a/WL-ELS b/WL-ELS index 8b0834f..c482a33 100644 --- a/WL-ELS +++ b/WL-ELS @@ -10,7 +10,7 @@ wl wl-folder wl-summary wl-message wl-vars wl-draft wl-util wl-version wl-address wl-addrmgr wl-highlight wl-demo wl-refile wl-thread - wl-fldmgr wl-expire wl-template wl-score + wl-fldmgr wl-expire wl-template wl-score wl-acap )) (defconst ELMO-MODULES '( diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 9aeafea..b58d0ff 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,5 +1,30 @@ 2001-08-29 Yuuichi Teranishi + * elmo-imap4.el (elmo-imap4-default-mailbox, + elmo-imap4-default-server + elmo-imap4-default-authenticate-type, + elmo-imap4-default-user, + elmo-imap4-default-port, + elmo-imap4-default-stream-type, + elmo-imap4-stream-type-alist): Moved to elmo-vars.el. + + * elmo-pop3.el (elmo-pop3-default-user, + elmo-pop3-default-server, + elmo-pop3-default-authenticate-type, + elmo-pop3-default-port, + elmo-pop3-default-stream-type, + elmo-pop3-stream-type-alist): Ditto. + + * elmo-nntp.el (elmo-nntp-default-server, + elmo-nntp-default-user, + elmo-nntp-default-port, + elmo-nntp-default-stream-type, + elmo-nntp-stream-type-alist): Ditto. + + * elmo-vars.el: Follow changes above. + (elmo-setting): New custom group; added 'elmo-setting group to + above variables. + * elmo-version.el (elmo-version): Up to 2.7.3. * acap.el (acap-parse-response): Don't delete process when BYE diff --git a/elmo/acap.el b/elmo/acap.el index 384f3b7..448c534 100644 --- a/elmo/acap.el +++ b/elmo/acap.el @@ -50,6 +50,9 @@ ;; ;; (acap-close proc) ;; => t +;; +;; Todo: +;; * Send literal data for STORE. ;;; History: ;; diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index 4f9a27f..2952397 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -51,45 +51,6 @@ ;;; Code: (eval-when-compile (require 'cl)) -;;; User options. -(defcustom elmo-imap4-default-mailbox "inbox" - "*Default IMAP4 mailbox." - :type 'string - :group 'elmo) - -(defcustom elmo-imap4-default-server "localhost" - "*Default IMAP4 server." - :type 'string - :group 'elmo) - -(defcustom elmo-imap4-default-authenticate-type 'login - "*Default Authentication type for IMAP4." - :type 'symbol - :group 'elmo) - -(defcustom elmo-imap4-default-user (or (getenv "USER") - (getenv "LOGNAME") - (user-login-name)) - "*Default username for IMAP4." - :type 'string - :group 'elmo) - -(defcustom elmo-imap4-default-port 143 - "*Default Port number of IMAP." - :type 'integer - :group 'elmo) - -(defcustom elmo-imap4-default-stream-type nil - "*Default stream type for IMAP4. -Any symbol value of `elmo-network-stream-type-alist' or -`elmo-imap4-stream-type-alist'." - :type 'symbol - :group 'elmo) - -(defvar elmo-imap4-stream-type-alist nil - "*Stream bindings for IMAP4. -This is taken precedence over `elmo-network-stream-type-alist'.") - (defvar elmo-imap4-disuse-server-flag-mailbox-regexp "^#mh" ; UW imapd "Regexp to match IMAP4 mailbox names whose message flags on server should be ignored. (Except `\\Deleted' flag).") diff --git a/elmo/elmo-nntp.el b/elmo/elmo-nntp.el index eba3d0c..d4933b3 100644 --- a/elmo/elmo-nntp.el +++ b/elmo/elmo-nntp.el @@ -41,33 +41,6 @@ (require 'elmo) (require 'elmo-net) -;; User options -(defcustom elmo-nntp-default-server "localhost" - "*Default NNTP server." - :type 'string - :group 'elmo) - -(defcustom elmo-nntp-default-user nil - "*Default User of NNTP. nil means no user authentication." - :type 'string - :group 'elmo) - -(defcustom elmo-nntp-default-port 119 - "*Default Port number of NNTP." - :type 'integer - :group 'elmo) - -(defcustom elmo-nntp-default-stream-type nil - "*Default stream type for NNTP. -Any symbol value of `elmo-network-stream-type-alist' or -`elmo-nntp-stream-type-alist'." - :type 'symbol - :group 'elmo) - -(defvar elmo-nntp-stream-type-alist nil - "*Stream bindings for NNTP. -This is taken precedence over `elmo-network-stream-type-alist'.") - (defvar elmo-nntp-overview-fetch-chop-length 200 "*Number of overviews to fetch in one request in nntp.") diff --git a/elmo/elmo-pop3.el b/elmo/elmo-pop3.el index ef2ca15..84a32fc 100644 --- a/elmo/elmo-pop3.el +++ b/elmo/elmo-pop3.el @@ -40,45 +40,11 @@ (eval-and-compile (autoload 'md5 "md5")) -;; POP3 -(defcustom elmo-pop3-default-user (or (getenv "USER") - (getenv "LOGNAME") - (user-login-name)) - "*Default username for POP3." - :type 'string - :group 'elmo) - -(defcustom elmo-pop3-default-server "localhost" - "*Default POP3 server." - :type 'string - :group 'elmo) - -(defcustom elmo-pop3-default-authenticate-type 'user - "*Default Authentication type for POP3." - :type 'symbol - :group 'elmo) - -(defcustom elmo-pop3-default-port 110 - "*Default POP3 port." - :type 'integer - :group 'elmo) - -(defcustom elmo-pop3-default-stream-type nil - "*Default stream type for POP3. -Any symbol value of `elmo-network-stream-type-alist' or -`elmo-pop3-stream-type-alist'." - :type 'symbol - :group 'elmo) - (defcustom elmo-pop3-default-use-uidl t "If non-nil, use UIDL on POP3." :type 'boolean :group 'elmo) -(defvar elmo-pop3-stream-type-alist nil - "*Stream bindings for POP3. -This is taken precedence over `elmo-network-stream-type-alist'.") - (defvar elmo-pop3-use-uidl-internal t "(Internal switch for using UIDL on POP3).") diff --git a/elmo/elmo-vars.el b/elmo/elmo-vars.el index 54b987d..5e5eeb0 100644 --- a/elmo/elmo-vars.el +++ b/elmo/elmo-vars.el @@ -38,9 +38,15 @@ (defgroup elmo nil "ELMO, Elisp Library for Message Orchestration." :tag "ELMO" + :prefix "elmo-" :group 'news :group 'mail) +(defgroup elmo-setting nil + "ELMO common settings." + :prefix "elmo-" + :group 'elmo) + ;; Local (defvar elmo-localnews-folder-path "~/News" "*Local news folder path.") @@ -69,8 +75,126 @@ Each elements are regexp of folder name (This is obsolete).") "A hook called when message is deleted from database.") (defvar elmo-nntp-post-pre-hook nil "A hook called just before the nntp posting.") -(defvar elmo-lang "ja" - "Language for displayed messages.") + +;;; IMAP4 + +(defcustom elmo-imap4-default-mailbox "inbox" + "*Default IMAP4 mailbox." + :type 'string + :group 'elmo + :group 'elmo-setting) + +(defcustom elmo-imap4-default-server "localhost" + "*Default IMAP4 server." + :type 'string + :group 'elmo + :group 'elmo-setting) + +(defcustom elmo-imap4-default-authenticate-type 'login + "*Default Authentication type for IMAP4." + :type 'symbol + :group 'elmo) + +(defcustom elmo-imap4-default-user (or (getenv "USER") + (getenv "LOGNAME") + (user-login-name)) + "*Default username for IMAP4." + :type 'string + :group 'elmo + :group 'elmo-setting) + +(defcustom elmo-imap4-default-port 143 + "*Default Port number of IMAP." + :type 'integer + :group 'elmo + :group 'elmo-setting) + +(defcustom elmo-imap4-default-stream-type nil + "*Default stream type for IMAP4. +Any symbol value of `elmo-network-stream-type-alist' or +`elmo-imap4-stream-type-alist'." + :type 'symbol + :group 'elmo) + +(defvar elmo-imap4-stream-type-alist nil + "*Stream bindings for IMAP4. +This is taken precedence over `elmo-network-stream-type-alist'.") + +;;; NNTP + +;; User options +(defcustom elmo-nntp-default-server "localhost" + "*Default NNTP server." + :type 'string + :group 'elmo + :group 'elmo-setting) + +(defcustom elmo-nntp-default-user nil + "*Default User of NNTP. nil means no user authentication." + :type 'string + :group 'elmo + :group 'elmo-setting) + +(defcustom elmo-nntp-default-port 119 + "*Default Port number of NNTP." + :type 'integer + :group 'elmo + :group 'elmo-setting) + +(defcustom elmo-nntp-default-stream-type nil + "*Default stream type for NNTP. +Any symbol value of `elmo-network-stream-type-alist' or +`elmo-nntp-stream-type-alist'." + :type 'symbol + :group 'elmo) + +(defvar elmo-nntp-stream-type-alist nil + "*Stream bindings for NNTP. +This is taken precedence over `elmo-network-stream-type-alist'.") + +;;; POP3 + +;; POP3 +(defcustom elmo-pop3-default-user (or (getenv "USER") + (getenv "LOGNAME") + (user-login-name)) + "*Default username for POP3." + :type 'string + :group 'elmo + :group 'elmo-setting) + +(defcustom elmo-pop3-default-server "localhost" + "*Default POP3 server." + :type 'string + :group 'elmo + :group 'elmo-setting) + +(defcustom elmo-pop3-default-authenticate-type 'user + "*Default Authentication type for POP3." + :type 'symbol + :group 'elmo) + +(defcustom elmo-pop3-default-port 110 + "*Default POP3 port." + :type 'integer + :group 'elmo + :group 'elmo-setting) + +(defcustom elmo-pop3-default-stream-type nil + "*Default stream type for POP3. +Any symbol value of `elmo-network-stream-type-alist' or +`elmo-pop3-stream-type-alist'." + :type 'symbol + :group 'elmo) + +(defvar elmo-pop3-stream-type-alist nil + "*Stream bindings for POP3. +This is taken precedence over `elmo-network-stream-type-alist'.") + +(defcustom elmo-lang "ja" + "Language for displayed messages." + :type 'string + :group 'elmo-setting) (defvar elmo-mime-charset 'iso-2022-jp) diff --git a/wl/ChangeLog b/wl/ChangeLog index 2c6b470..e2d3101 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,5 +1,52 @@ 2001-08-29 Yuuichi Teranishi + * wl.el (wl): Changed position of `wl-check-environment'. + (toplevel): Added autoload setting for wl-acap. + + * wl-vars.el (wl-setting): New custom group. + (wl-from): Added wl-setting group. + (wl-user-mail-address-list): Ditto. + (wl-organization): Ditto. + (wl-subscribed-mailing-list): Ditto. + (wl-envelope-from): Ditto. + (wl-smtp-posting-user): Ditto. + (wl-smtp-posting-server): Ditto. + (wl-smtp-posting-port): Ditto. + (wl-smtp-authenticate-type): Ditto. + (wl-pop-before-smtp-user): Ditto. + (wl-pop-before-smtp-server): Ditto. + (wl-pop-before-smtp-port): Ditto. + (wl-pop-before-smtp-authenticate-type): Ditto. + (wl-nntp-posting-server): Ditto. + (wl-nntp-posting-user): Ditto. + (wl-nntp-posting-port): Ditto. + (wl-fetch-confirm-threshold): Ditto. + (wl-prefetch-threshold): Ditto. + (wl-thread-insert-opened): Ditto. + (wl-ldap-server): Ditto. + (wl-ldap-port): Ditto. + (wl-ldap-base): Ditto. + (wl-ldap-objectclass): Ditto. + (wl-use-ldap): Ditto. + (wl-draft-config-alist): Ditto. + (wl-draft-config-matchone): Ditto. + (wl-template-alist): Ditto. + (wl-message-sort-field-list): Ditto. + (wl-message-ignored-field-list): Ditto. + (wl-message-visible-field-list): Ditto. + (wl-interactive-send): Ditto. + (wl-summary-move-order): Ditto. + (wl-auto-select-first): Ditto. + (wl-auto-select-next): Ditto. + (wl-interactive-save-folders): Ditto. + + * wl-folder.el (wl-folder): Moved position of `wl-folder-init'; + Initialization codes are moved from wl-local-folder-init. + (wl-local-folder-init): Follow the change above. + (wl-folder-init): Call `wl-acap-init' when `wl-use-acap' is non-nil. + + * wl-acap.el: New file. + * Version number is increased to 2.7.3. 2001-08-21 Kenichi OKADA diff --git a/wl/wl-acap.el b/wl/wl-acap.el new file mode 100644 index 0000000..cef98d7 --- /dev/null +++ b/wl/wl-acap.el @@ -0,0 +1,285 @@ +;;; wl-acap.el -- ACAP support for Wanderlust. + +;; Copyright (C) 2001 Yuuichi Teranishi + +;; Author: Yuuichi Teranishi +;; Keywords: mail, net news + +;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen). + +;; 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. +;; + +;;; Commentary: + +;;; Code: +;; + +(require 'custom) +(require 'cus-edit) +(require 'wl-vars) +(require 'elmo-vars) +(require 'acap) +(require 'slp) + +(eval-and-compile + (cond + ((and (featurep 'xemacs) + (module-installed-p 'xemacs-ucs)) + (require 'xemacs-ucs)) + ((module-installed-p 'un-define) + (require 'un-define)))) + +(defconst wl-acap-dataset-class "vendor.wanderlust") +(defconst wl-acap-entry-name "settings") + +(defcustom wl-acap-user (or (getenv "USER") + (getenv "LOGNAME") + (user-login-name)) + "ACAP user." + :type 'string + :group 'wl) + +(defcustom wl-acap-server nil + "ACAP server. +If nil, SLP is used to find ACAP server. +If nil and SLP is not available, localhost is assumed." + :type 'string + :group 'wl) + +(defcustom wl-acap-port nil + "ACAP server port. +Only valid when `wl-acap-server' is non-nil. +If nil, default acap port is used." + :type 'string + :group 'wl) + +(defcustom wl-acap-authenticate-type 'cram-md5 + "ACAP authenticate type." + :type 'symbol + :group 'wl) + +(defcustom wl-acap-stream-type nil + "ACAP stream type." + :type 'symbol + :group 'wl) + +(defcustom wl-acap-extra-options nil + "Extra options to be saved on ACAP server." + :type '(repeat symbol) + :group 'wl) + +;; Encoding string as BASE64 is temporal solution. +;; As far as I know, current implementation of ACAP server +;; (cyrus-smlacapd 0.5) does not accept literal argument for STORE. +(defvar wl-acap-base64-encode-options + '(wl-template-alist + wl-draft-config-alist) + "Options which should be encoded with base64 to store ACAP server.") + +(defcustom wl-acap-coding-system 'utf-8 + "Coding system for ACAP." + :type 'symbol + :group 'wl) + +(defun wl-acap-init () + "A candidate for `wl-folder-init-function'." + (let ((service (wl-acap-find-acap-service)) + proc entries settings folder-top type) + (setq proc (acap-open (car service) + wl-acap-user + (upcase (symbol-name wl-acap-authenticate-type)) + (cdr service))) + (setq entries (acap-response-entries + (acap-search proc (concat "/" + wl-acap-dataset-class + "/~/") + '((RETURN ("*")))))) + (while entries + (when (string= (acap-response-entry-entry (car entries)) + wl-acap-entry-name) + (setq settings (car (acap-response-entry-return-data-list + (car entries))) + entries nil)) + (setq entries (cdr entries))) + (setq settings + (delq + 'wl-acap-ignored + (mapcar (lambda (x) + (let ((sym (wl-acap-symbol (car x)))) + (cond + ((and sym (eq sym 'wl-folders)) + ;; Folders. + (setq wl-folder-entity + (wl-acap-create-folder-entity (cadr x))) + 'wl-acap-ignored) + ((and sym (boundp sym)) + (setq type (custom-variable-type sym)) + (cons + sym + (when (cadr x) + (cond + ((or (eq (car type) 'string) + (and (eq (car type) 'choice) + (memq 'string type))) + (if (memq sym wl-acap-base64-encode-options) + (wl-acap-base64-decode-string (cadr x)) + (cadr x))) + (t + (if (cadr x) + (read + (if (memq sym + wl-acap-base64-encode-options) + (wl-acap-base64-decode-string (cadr x)) + (read (concat "\"" (cadr x) "\"")))))))))) + (t 'wl-acap-ignored)))) + settings))) + ;; Setup options. + (dolist (setting settings) + (set (car setting) (cdr setting))) + ;; Database directory becomes specific to the ACAP server. + (setq elmo-msgdb-dir (expand-file-name + (concat "acap/" (car service) "/" wl-acap-user) + elmo-msgdb-dir)) + (acap-close proc))) + +(defun wl-acap-create-folder-entity (string) + (with-temp-buffer + (message "Initializing folder...") + (let (folders) + (setq string (elmo-base64-decode-string string)) + (setq string (decode-coding-string string wl-acap-coding-system)) + (insert string) + (goto-char (point-min)) + (while (and (not (eobp)) + (setq entity (wl-create-folder-entity-from-buffer))) + (unless (eq entity 'ignore) + (wl-append folders (list entity)))) + (message "Initializing folder...done") + (list wl-folder-desktop-name 'group folders)))) + +(defun wl-acap-find-acap-service () + (or (and wl-acap-server + (cons wl-acap-server wl-acap-port)) + (with-temp-buffer + (message "Searching ACAP server...") + (prog1 (let ((response (condition-case nil + (slp-findsrvs "acap") + (error)))) + (when response + ;; Only the first service entry is used. + (setq response (car (slp-response-body response))) + (cons (slp-response-srv-url-host response) + (slp-response-srv-url-port response)))) + (message "Searching ACAP server...done."))) + (cons "localhost" nil))) + +(defun wl-acap-name (option) + (let ((name (symbol-name option)) + prefix) + (cond ((string-match "^wl-" name) + (setq name (substring name (match-end 0)) + prefix "wl")) + ((string-match "^elmo-" name) + (setq name (substring name (match-end 0)) + prefix "elmo"))) + (concat + wl-acap-dataset-class "." prefix "." + (mapconcat 'capitalize (split-string name "-") "")))) + +(defun wl-acap-symbol (name) + (let (case-fold-search li) + (when (string-match (concat "^" (regexp-quote wl-acap-dataset-class) + "\\.\\([^\\.]+\\)\\.") name) + (setq li (list (match-string 1 name)) + name (substring name (match-end 0))) + (while (string-match "^[A-Z][a-z0-9]*" name) + (setq li (cons (match-string 0 name) li)) + (setq name (substring name (match-end 0)))) + (intern (mapconcat 'downcase (nreverse li) "-"))))) + +(defun wl-acap-list-options () + (nconc (mapcar 'car (append (custom-group-members 'wl-setting nil) + (custom-group-members 'elmo-setting nil))) + wl-acap-extra-options)) + +(defun wl-acap-store-folders (proc) + (with-temp-buffer + (insert-file-contents wl-folders-file) + (acap-store + proc + (list (concat "/" wl-acap-dataset-class "/~/" + wl-acap-entry-name) + (concat wl-acap-dataset-class ".wl.Folders") + (wl-acap-base64-encode-string (buffer-string)))))) + +(defun wl-acap-base64-encode-string (string) + (elmo-base64-encode-string + (encode-coding-string string wl-acap-coding-system) + 'no-line-break)) + +(defun wl-acap-base64-decode-string (string) + (decode-coding-string + (elmo-base64-decode-string string ) + wl-acap-coding-system)) + +(defun wl-acap-store () + "Store Wanderlust configuration to the ACAP server." + (interactive) + (wl-load-profile) + (let ((service (wl-acap-find-acap-service)) + proc settings type) + (setq proc (acap-open (car service) + wl-acap-user + (upcase (symbol-name wl-acap-authenticate-type)) + (cdr service))) + (dolist (option (wl-acap-list-options)) + (setq settings + (cons (wl-acap-name option) settings) + settings + (cons (when (symbol-value option) + (setq type (custom-variable-type option)) + (cond + ((or (eq (car type) 'string) + (and (eq (car type) 'choice) + (memq 'string type))) + (if (memq option wl-acap-base64-encode-options) + (wl-acap-base64-encode-string + (symbol-value option)) + (symbol-value option))) + (t (if (memq option wl-acap-base64-encode-options) + (wl-acap-base64-encode-string + (prin1-to-string (symbol-value option))) + (prin1-to-string (symbol-value option)))))) + settings))) + (unwind-protect + (progn + (message "Storing settings...") + (acap-store proc + (nconc + (list + (concat + "/" wl-acap-dataset-class "/~/" wl-acap-entry-name)) + (nreverse settings))) + (message "Storing folders...") + (wl-acap-store-folders proc)) + (acap-close proc)) + (if (interactive-p) + (message "Store completed.")))) + +(provide 'wl-acap) + +;;; wl-acap.el ends here diff --git a/wl/wl-folder.el b/wl/wl-folder.el index 74596e8..3669437 100644 --- a/wl/wl-folder.el +++ b/wl/wl-folder.el @@ -1446,6 +1446,8 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'." (defun wl-folder (&optional arg) (interactive "P") (let (initialize folder-buf) + (unless (get-buffer wl-folder-buffer-name) + (wl-folder-init)) (if (setq folder-buf (get-buffer wl-folder-buffer-name)) (if wl-folder-use-frame (let (select-frame) @@ -1464,7 +1466,17 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'." (switch-to-buffer (get-buffer-create wl-folder-buffer-name))) (set-buffer wl-folder-buffer-name) (wl-folder-mode) - (wl-folder-init) + ;; Initialization. + (setq wl-folder-entity-id 0) + (wl-folder-entity-assign-id wl-folder-entity) + (setq wl-folder-entity-hashtb + (wl-folder-create-entity-hashtb wl-folder-entity)) + (setq wl-folder-elmo-folder-hashtb (elmo-make-hash wl-folder-entity-id)) + (setq wl-folder-group-alist + (wl-folder-create-group-alist wl-folder-entity)) + (setq wl-folder-newsgroups-hashtb + (wl-folder-create-newsgroups-hashtb wl-folder-entity)) + (wl-folder-init-info-hashtb) (let ((inhibit-read-only t) (buffer-read-only nil)) (erase-buffer) @@ -1979,28 +1991,16 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'." (defvar wl-folder-init-function 'wl-local-folder-init) (defun wl-folder-init () - "Call `wl-folder-init-function' function." + "Return top-level folder entity." (interactive) - (funcall wl-folder-init-function)) + (if wl-use-acap + (wl-acap-init) + (funcall wl-folder-init-function))) (defun wl-local-folder-init () "Initialize local folder." (message "Initializing folder...") - (save-excursion - (set-buffer wl-folder-buffer-name) - (let ((entity (wl-folder-create-folder-entity)) - (inhibit-read-only t)) - (setq wl-folder-entity entity) - (setq wl-folder-entity-id 0) - (wl-folder-entity-assign-id wl-folder-entity) - (setq wl-folder-entity-hashtb - (wl-folder-create-entity-hashtb entity)) - (setq wl-folder-elmo-folder-hashtb (elmo-make-hash wl-folder-entity-id)) - (setq wl-folder-group-alist - (wl-folder-create-group-alist entity)) - (setq wl-folder-newsgroups-hashtb - (wl-folder-create-newsgroups-hashtb wl-folder-entity)) - (wl-folder-init-info-hashtb))) + (setq wl-folder-entity (wl-folder-create-folder-entity)) (message "Initializing folder...done")) (defun wl-folder-get-realname (petname) diff --git a/wl/wl-vars.el b/wl/wl-vars.el index a84eebd..e15e537 100644 --- a/wl/wl-vars.el +++ b/wl/wl-vars.el @@ -91,6 +91,11 @@ :prefix "wl-" :group 'wl) +(defgroup wl-setting nil + "Wanderlust common settings." + :prefix "wl-" + :group 'wl) + ;;; Emacsen (defconst wl-on-xemacs (featurep 'xemacs)) @@ -132,7 +137,8 @@ user-mail-address) "*From string used in draft." :type 'string - :group 'wl) + :group 'wl + :group 'wl-setting) (defcustom wl-user-mail-address-list nil "*A list of user's mail addresses. @@ -140,13 +146,15 @@ This list is used to judge whether an address is user's or not. You should set this variable if you use multiple e-mail addresses. If you don't have multiple e-mail addresses, you don't have to set this." :type '(repeat string) - :group 'wl) + :group 'wl + :group 'wl-setting) (defcustom wl-organization nil "Organization name." :type '(choice (const :tag "none" nil) string) - :group 'wl) + :group 'wl + :group 'wl-setting) (defcustom wl-tmp-dir "~/tmp/" "*Default temporary directory to save message, part." @@ -243,7 +251,8 @@ If file exists and `wl-auto-insert-x-face' is non-nil." "*Subscribed mailing list. You had better set this variable if you set 'wl-insert-mail-followup-to' as t." :type '(repeat string) - :group 'wl-pref) + :group 'wl-pref + :group 'wl-setting) (defcustom wl-demo t "*Display demo at start time." @@ -255,7 +264,8 @@ You had better set this variable if you set 'wl-insert-mail-followup-to' as t." If nil, `wl-from' is used." :type '(choice (const :tag "Same as 'From' field." nil) string) - :group 'wl) + :group 'wl + :group 'wl-setting) (defcustom wl-draft-add-references t "*If non-nil, message-id of the cited message is inserted to the @@ -275,20 +285,23 @@ If nil, default smtp connection type is used." "*SMTP authentication user." :type '(choice (const :tag "none" nil) string) - :group 'wl) + :group 'wl + :group 'wl-setting) (defcustom wl-smtp-posting-server nil "*SMTP server name to send mail (wl-draft-send-mail-with-smtp)." :type '(choice (const :tag "none" nil) string) - :group 'wl) + :group 'wl + :group 'wl-setting) (defcustom wl-smtp-posting-port nil "*SMTP port number in `wl-smtp-posting-server'. If nil, default SMTP port number(25) is used." :type '(choice (const :tag "Default (25)" nil) integer) - :group 'wl) + :group 'wl + :group 'wl-setting) (defcustom wl-smtp-authenticate-type nil "*SMTP Authentication type. @@ -298,30 +311,34 @@ If nil, don't authenticate." (const :tag "CRAM-MD5" "cram-md5") (const :tag "LOGIN" "login") (string :tag "Other")) - :group 'wl) + :group 'wl + :group 'wl-setting) (defcustom wl-pop-before-smtp-user nil "*POP3 user name to send mail using POP-before-SMTP. If nil, `elmo-pop3-default-user' is used. To use POP-before-SMTP, -(setq wl-draft-send-mail-function 'wl-draft-send-mail-with-pop-before-smtp)" +\(setq wl-draft-send-mail-function 'wl-draft-send-mail-with-pop-before-smtp\)" :type '(choice (const :tag "none" nil) string) - :group 'wl) + :group 'wl + :group 'wl-setting) (defcustom wl-pop-before-smtp-server nil "*POP3 server for POP-before-SMTP. If nil, `elmo-pop3-default-server' is used." :type '(choice (const :tag "none" nil) string) - :group 'wl) + :group 'wl + :group 'wl-setting) (defcustom wl-pop-before-smtp-port nil "*POP3 port for POP-before-SMTP. If nil, `elmo-pop3-default-port' is used." :type '(choice (const :tag "none" nil) integer string) - :group 'wl) + :group 'wl + :group 'wl-setting) (defcustom wl-pop-before-smtp-stream-type nil "*Stream type for POP-before-SMTP. @@ -335,27 +352,31 @@ If nil, `elmo-pop3-default-authenticate-type' is used." :type '(choice (const :tag "none" nil) (const :tag "APOP" "apop") (const :tag "POP3" "user")) - :group 'wl) + :group 'wl + :group 'wl-setting) (defcustom wl-nntp-posting-server nil "*NNTP server name to post news. If nil, `elmo-nntp-default-server' is used." :type '(choice (const :tag "none" nil) string) - :group 'wl) + :group 'wl + :group 'wl-setting) (defcustom wl-nntp-posting-user nil "*NNTP user name to post news for authinfo. If nil, `elmo-nntp-default-user' is used. If nil, don't authenticate." :type '(choice (const :tag "none" nil) string) - :group 'wl) + :group 'wl + :group 'wl-setting) (defcustom wl-nntp-posting-port nil "*NNTP port to post news. If nil, `elmo-nntp-default-port' is used." :type '(choice (const :tag "none" nil) integer string) - :group 'wl) + :group 'wl + :group 'wl-setting) (defcustom wl-nntp-posting-stream-type nil "*Stream type for posting Netnews. If nil, `elmo-nntp-default-stream-type' is used." @@ -365,7 +386,8 @@ If nil, `elmo-nntp-default-stream-type' is used." (defcustom wl-fetch-confirm-threshold 30000 "*Confirm fetching if message size is larger than this value." :type 'integer - :group 'wl-pref) + :group 'wl-pref + :group 'wl-setting) (defcustom wl-prefetch-confirm t "*Confirm prefetching if message size is larger than `wl-prefetch-threshold'." @@ -379,7 +401,8 @@ If message size is larger than this value, confirm prefetching when `wl-prefetch-confirm' is non-nil." :type '(choice (integer :tag "Threshold (bytes)") (const :tag "No limitation" nil)) - :group 'wl-pref) + :group 'wl-pref + :group 'wl-setting) (defcustom wl-cache-prefetch-threshold 30000 "*Quit forward cache prefetching if message size is larger than this value." @@ -389,7 +412,8 @@ when `wl-prefetch-confirm' is non-nil." (defcustom wl-thread-insert-opened nil "*Non-nil forces to insert thread as opened in updating." :type 'boolean - :group 'wl-summary) + :group 'wl-summary + :group 'wl-setting) (defcustom wl-thread-open-reading-thread t "*Non-nil forces to open reading thread." @@ -666,27 +690,37 @@ Default is for 'followup-to-me'." (defcustom wl-ldap-server "localhost" "*LDAP server." :type '(string :tag "Server") - :group 'wl) + :group 'wl + :group 'wl-setting) (defcustom wl-ldap-port nil "*LDAP port." :type '(choice (const :tag "Default port" nil) integer) - :group 'wl) + :group 'wl + :group 'wl-setting) (defcustom wl-ldap-base "c=US" "*LDAP base." :type '(string :tag "Base") - :group 'wl) + :group 'wl + :group 'wl-setting) (defcustom wl-ldap-objectclass "person" "*LDAP objectclass." :type 'string - :group 'wl) + :group 'wl + :group 'wl-setting) (defcustom wl-use-ldap nil "*If non-nil, use LDAP for address completion." :type 'boolean + :group 'wl + :group 'wl-setting) + +(defcustom wl-use-acap nil + "*If non-nil, use ACAP for configuration." + :type 'boolean :group 'wl) (defcustom wl-folder-info-save t @@ -909,12 +943,14 @@ ex. (choice (cons (sexp :tag "Field(Variable)") (sexp :tag "Value")) (sexp :tag "Function"))))) - :group 'wl-draft) + :group 'wl-draft + :group 'wl-setting) (defcustom wl-draft-config-matchone nil "*If non-nil, applied only one element of `wl-draft-config-alist'." :type 'boolean - :group 'wl-draft) + :group 'wl-draft + :group 'wl-setting) (defcustom wl-template-alist nil "Alist of template." @@ -924,7 +960,8 @@ ex. (choice (cons (sexp :tag "Field(Variable)") (sexp :tag "Value")) (sexp :tag "Function"))))) - :group 'wl-draft) + :group 'wl-draft + :group 'wl-setting) (defcustom wl-template-visible-select t "*If non-nil, select template with visible." @@ -1136,22 +1173,24 @@ Set this if (system-name) does not return FQDN." (defcustom wl-message-sort-field-list '("Return-Path" "Received" "^To" "^Cc" "Newsgroups" "Subject" "^From") - "*Sort order of header fields. Each elements are regexp of field name. -(Not valid on tm.)" + "*Sort order of header fields. Each elements are regexp of field name." :type '(repeat (string :tag "Field Regexp")) - :group 'wl-pref) + :group 'wl-pref + :group 'wl-setting) (defcustom wl-message-ignored-field-list nil "All fields that match this list will be hidden in message buffer. Each elements are regexp of field-name." :type '(repeat (string :tag "Field Regexp")) - :group 'wl-pref) + :group 'wl-pref + :group 'wl-setting) (defcustom wl-message-visible-field-list nil "All fields that match this list will be displayed in message buffer. Each elements are regexp of field-name." :type '(repeat (string :tag "Field Regexp")) - :group 'wl-pref) + :group 'wl-pref + :group 'wl-setting) (defcustom wl-folder-window-width 20 "*Width of folder window." @@ -1489,7 +1528,8 @@ even if the value of this option is set to nil. Here are some samples: (defcustom wl-interactive-send nil "*If non-nil, require your confirmation when sending draft message." :type 'boolean - :group 'wl-pref) + :group 'wl-pref + :group 'wl-setting) (defcustom wl-interactive-exit t "*If non-nil, require your confirmation when exiting WL." @@ -1502,7 +1542,8 @@ If this variable is `unread', precede \"U\", \"!\", \"N\" mark. If this variable is `new', precede \"N\" mark." :type '(radio (const new) (const unread)) - :group 'wl-summary) + :group 'wl-summary + :group 'wl-setting) (defvar wl-summary-move-direction-downward t) @@ -1516,7 +1557,8 @@ It uses wl-summary-move-direction-downward as a direction flag." (defcustom wl-auto-select-first nil "*If non-nil, display selected first message when enter summary." :type 'boolean - :group 'wl-pref) + :group 'wl-pref + :group 'wl-setting) (defcustom wl-auto-select-next nil "*If non-nil, offer to go to the next folder from the end of the previous. @@ -1529,7 +1571,8 @@ See also variable `wl-summary-next-no-unread-command'." (const :tag "on" t) (const unread) (const skip-no-unread)) - :group 'wl-pref) + :group 'wl-pref + :group 'wl-setting) (defcustom wl-cache-prefetch-folder-type-list '(imap4 nntp) "*All folder types that match this list prefetch next message, @@ -1801,7 +1844,8 @@ ex. (defcustom wl-interactive-save-folders t "*Non-nil require your confirmation when save folders." :type 'boolean - :group 'wl-folder) + :group 'wl-folder + :group 'wl-setting) (defcustom wl-fldmgr-make-backup t "*Non-nil make backup file when save folders." diff --git a/wl/wl.el b/wl/wl.el index 21e0669..b4526b8 100644 --- a/wl/wl.el +++ b/wl/wl.el @@ -756,20 +756,22 @@ If ARG (prefix argument) is specified, folder checkings are skipped." (unless wl-init (wl-load-profile)) (elmo-init) - (let (demo-buf) + (let (demo-buf check) (unless wl-init (if wl-demo (setq demo-buf (wl-demo))) - (condition-case nil - (progn - (message "Checking environment...") - (wl-check-environment arg) - (message "Checking environment...done")) - (error) - (quit))) + (setq check t)) (wl-init) (condition-case obj (progn (wl-plugged-init (wl-folder arg)) + (if check + (condition-case nil + (progn + (message "Checking environment...") + (wl-check-environment arg) + (message "Checking environment...done")) + (error) + (quit))) (unless arg (run-hooks 'wl-auto-check-folder-pre-hook) (wl-folder-auto-check) @@ -813,6 +815,8 @@ If ARG (prefix argument) is specified, folder checkings are skipped." wl-fldmgr-save-folders wl-fldmgr-set-petname wl-fldmgr-sort wl-fldmgr-subscribe wl-fldmgr-subscribe-region wl-fldmgr-unsubscribe wl-fldmgr-unsubscribe-region wl-fldmgr-yank ) + ("wl-acap" wl-acap-init) + ("wl-acap" :interactive t wl-acap-store) ("wl-fldmgr" (wl-fldmgr-mode-map keymap) wl-fldmgr-add-entity-hashtb) -- 1.7.10.4