;;; wl-address.el -- Tiny address management for Wanderlust.
-;; Copyright 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
+;; Copyright (C) 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
+;; Copyright (C) 1998,1999,2000 Shun-ichi GOTO <gotoh@taiyo.co.jp>
+;; Copyright (C) 1998,1999,2000 Takeshi Chiba <chiba@d3.bs1.fc.nec.co.jp>
;; Author: Yuuichi Teranishi <teranisi@gohome.org>
+;; Shun-ichi GOTO <gotoh@taiyo.co.jp>
+;; Takeshi Chiba <chiba@d3.bs1.fc.nec.co.jp>
;; Keywords: mail, net news
;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen).
Valid value is nit, t, 1 or larget integer.
If this value nil, minimum alias postfix is made depends on uniqness
-with other candidates. In this implementation, it's same to 1. If t,
-always append all dn data. If number, always append spcified level of
+with other candidates. In this implementation, it's same to 1. If t,
+always append all dn data. If number, always append spcified level of
data but maybe appended more uniqness. If invalid value, treat as
nil.
2 => Goto/Shun-ichi_GOTO/Mew/Emacs ... appended more
3 => Goto/Shun-ichi_GOTO/Mew/Emacs
4 => Goto/Shun-ichi_GOTO/Mew/Emacs/Lisper
- (so on...)
-")
+ (so on...)")
(defconst wl-ldap-alias-sep "/")
(setq type (car (car entry))
values (mapcar (function wl-ldap-alias-safe-string)
(cdr (car entry)))
+ values (elmo-flatten values)
entry (cdr entry))
(if (string-match "::?$" type)
(setq type (substring type 0 (match-beginning 0))))
(defun wl-ldap-alias-safe-string (str)
"Modify STR for alias.
Replace space/tab in STR into '_' char.
-And remove domain part of mail addr."
+Replace '@' in STR into list of mailbox and sub-domains."
(while (string-match "[^_a-zA-Z0-9+@%.!\\-/]+" str)
(setq str (concat (substring str 0 (match-beginning 0))
"_"
(substring str (match-end 0)))))
- (if (string-match "@[^/@]+" str)
- (setq str (concat (substring str 0 (match-beginning 0))
- (substring str (match-end 0)))))
+ (if (string-match "\\(@\\)[^/@]+" str)
+ (setq str (split-string str "[@\\.]")))
str)
(defun wl-ldap-register-dn-string (hash dn &optional str dn-list)
(if (string-match "[a-z]+=\\(.*\\)" str)
(wl-ldap-alias-safe-string
(wl-match-string 1 str))))
- (split-string dn ",")))))
+ (split-string dn "[ \t]*,[ \t]*")))))
+ (setq dn-list (elmo-flatten dn-list))
;; prepare candidate for uniq str
(if str
(setq str (concat str wl-ldap-alias-sep (car dn-list))
(completing-read "To: " cl)
(read-string "To: "))))
+(defconst wl-address-specials-regexp "[]\"(),.:;<>@[\\]")
+
(defun wl-address-quote-specials (word)
"Make quoted string of WORD if needed."
- (if (assq 'specials (std11-lexical-analyze word))
+ (if (string-match wl-address-specials-regexp word)
(prin1-to-string word)
word))
(progn
(delete-region start end)
(insert (cdr alias))
- ; (wl-highlight-message (point-min)(point-max) t)
+;;; (wl-highlight-message (point-min)(point-max) t)
)))
(wl-complete-window-delete))
((null completion)
(defvar wl-address-init-func 'wl-local-address-init)
(defun wl-address-init ()
+ "Call `wl-address-init-func'."
(funcall wl-address-init-func))
(defun wl-local-address-init ()
+ "Reload `wl-address-file'.
+Refresh `wl-address-list', `wl-address-completion-list', and
+`wl-address-petname-hash'."
(message "Updating addresses...")
(setq wl-address-list
(wl-address-make-address-list wl-address-file))
(forward-line))
ret))))
-(defsubst wl-address-get-petname-1 (string)
+(defun wl-address-get-petname-1 (string)
(let ((address (downcase (wl-address-header-extract-address string))))
(elmo-get-hash-val address wl-address-petname-hash)))
wl-from))))))
(defsubst wl-address-header-extract-address (str)
- "Extracts a real e-mail address from STR and returns it.
+ "Extracts a real e-mail address from STR and return it.
e.g. \"Mine Sakurai <m-sakura@ccs.mt.nec.co.jp>\"
-> \"m-sakura@ccs.mt.nec.co.jp\".
e.g. \"m-sakura@ccs.mt.nec.co.jp (Mine Sakurai)\"
(t str)))
(defsubst wl-address-header-extract-realname (str)
- "Extracts a real name from STR and returns it.
+ "Extracts a real name from STR and return it.
e.g. \"Mr. bar <hoge@foo.com>\"
-> \"Mr. bar\"."
(cond ((string-match "\\(.*[^ \t]\\)[ \t]*<[^>]*>" str)
address-string))
(defun wl-address-petname-delete (the-email)
- "Delete petname in wl-address-file."
+ "Delete petname in `wl-address-file'."
(let* ( (tmp-buf (get-buffer-create " *wl-petname-tmp*"))
(output-coding-system
(mime-charset-to-coding-system wl-mime-charset)))
default-petname
default-realname
&optional change-petname)
- "Add petname to wl-address-file, if not registerd.
+ "Add petname to `wl-address-file', if not registerd.
If already registerd, change it."
(let (the-realname the-petname)
;; setup output "realname"
(setq the-realname
(read-from-minibuffer (format "Real Name: ") default-realname))
-;; (if (string= the-realname "")
-;; (setq the-realname default-petname))
+;;; (if (string= the-realname "")
+;;; (setq the-realname default-petname))
;; writing to ~/.address
(let ( (tmp-buf (get-buffer-create " *wl-petname-tmp*"))