2000-06-12 Yuuichi Teranishi <teranisi@gohome.org>
authorteranisi <teranisi>
Mon, 12 Jun 2000 04:54:22 +0000 (04:54 +0000)
committerteranisi <teranisi>
Mon, 12 Jun 2000 04:54:22 +0000 (04:54 +0000)
* wl-address.el (wl-ldap-search): Use `with-temp-buffer'.
Use `let' instead of `let*'.
Require 'wl-vars.

* wl-vars.el (wl-ldap-server): Moved from wl-address.el.
Define as defcustom.
(wl-ldap-base): Ditto.
(wl-use-ldap): Ditto.

2000-06-09  Takeshi Chiba <chiba@d3.bs1.fc.nec.co.jp>

* wl-address.el (wl-ldap-search): New function.
(wl-complete-field-body): Use `wl-ldap-search'.
(wl-ldap-server): New variable.
(wl-ldap-base): Ditto.
(wl-use-ldap): Ditto.

2000-06-08  OKAZAKI Tetsurou  <okazaki@be.to>

* wl-score.el (wl-score-guess-like-gnus): Use `elmo-string'
(Pointed out by Mito <mit@nines.nec.co.jp>).

wl/ChangeLog
wl/wl-address.el
wl/wl-score.el
wl/wl-vars.el

index e824479..a4f51f3 100644 (file)
@@ -1,5 +1,26 @@
+2000-06-12  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-address.el (wl-ldap-search): Use `with-temp-buffer'.
+       Use `let' instead of `let*'.
+       Require 'wl-vars.
+
+       * wl-vars.el (wl-ldap-server): Moved from wl-address.el.
+       Define as defcustom.
+       (wl-ldap-base): Ditto.
+       (wl-use-ldap): Ditto.
+
+2000-06-09  Takeshi Chiba <chiba@d3.bs1.fc.nec.co.jp>
+
+       * wl-address.el (wl-ldap-search): New function.
+       (wl-complete-field-body): Use `wl-ldap-search'.
+       (wl-ldap-server): New variable.
+       (wl-ldap-base): Ditto.
+       (wl-use-ldap): Ditto.
+
 2000-06-08  OKAZAKI Tetsurou  <okazaki@be.to>
 
+       * wl-score.el (wl-score-guess-like-gnus): Use `elmo-string'
+       (Pointed out by Mito <mit@nines.nec.co.jp>).
        * wl-summary.el (wl-summary-redisplay-no-mime): Update
        buffer-local variables like `wl-summary-redisplay-internal'.
        (wl-summary-redisplay-all-header): Likewise.  Update
index 23e7edb..063d919 100644 (file)
@@ -4,7 +4,7 @@
 
 ;; Author: Yuuichi Teranishi <teranisi@gohome.org>
 ;; Keywords: mail, net news
-;; Time-stamp: <2000-04-10 09:29:44 teranisi>
+;; Time-stamp: <00/06/12 13:41:52 teranisi>
 
 ;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen).
 
@@ -31,6 +31,7 @@
 ;; 
 
 (require 'wl-util)
+(require 'wl-vars)
 (require 'std11)
 
 (defvar wl-address-complete-header-regexp "^\\(To\\|From\\|Cc\\|Bcc\\|Mail-Followup-To\\|Reply-To\\|Return-Receipt-To\\):")
 (defvar wl-address-completion-list nil)
 (defvar wl-address-petname-hash nil)
 
+(defun wl-ldap-search (pat &optional cl)
+  "make completion-list by ldap search"
+  (let ((ldap-pat (concat "mail=" pat "*"))
+       (ret cl)
+       addr)
+    (with-temp-buffer
+      (call-process "ldapsearch" nil (current-buffer)
+                   t "-L" "-b" wl-ldap-base
+                   "-h" wl-ldap-server ldap-pat "mail")
+      (goto-char (point-min))
+      (while (re-search-forward "^\\(mail: \\)\\(.*\\)$" nil t)
+       (progn
+         (setq addr (match-string 2))
+         (setq addr (cons addr addr))
+         (if ret
+             (setq ret (append ret (list addr)))
+           (setq ret (list addr))))))
+    ret))
+
+
 (defun wl-complete-field-to ()
   (interactive)
   (let ((cl wl-address-completion-list))
@@ -51,6 +72,7 @@
   (interactive)
   (let ((case-fold-search t)
        epand-char skip-chars
+       (use-ldap nil)
        completion-list)
     (if (wl-draft-on-field-p)
        (wl-complete-field)
                (point)))
           (save-excursion
             (beginning-of-line)
+            (setq use-ldap nil)
             (while (and (looking-at "^[ \t]")
                         (not (= (point) (point-min))))
               (forward-line -1))
             (cond ((looking-at wl-address-complete-header-regexp)
                    (setq completion-list wl-address-completion-list)
+                   (if wl-use-ldap
+                       (setq use-ldap t))
                    (setq epand-char ?@))
                   ((looking-at wl-folder-complete-header-regexp)
                    (setq completion-list wl-folder-entity-hashtb)
@@ -74,7 +99,7 @@
                   ((looking-at wl-newsgroups-complete-header-regexp)
                    (setq completion-list wl-folder-newsgroups-hashtb)))))
          (wl-complete-field-body completion-list 
-                                 epand-char skip-chars)
+                                 epand-char skip-chars use-ldap)
        (indent-for-tab-command)))))
 
 (defvar wl-completion-buf-name "*Completions*")
              (if (setq comp-win (get-buffer-window comp-buf))
                  (delete-window comp-win)))))))
 
-(defun wl-complete-field-body (completion-list &optional epand-char skip-chars)
+(defun wl-complete-field-body (completion-list &optional epand-char skip-chars use-ldap)
   (interactive)
   (let* ((end (point))
         (start (save-excursion
         (pattern (buffer-substring start end))
         (len (length pattern))
         (cl completion-list))
+    (if use-ldap
+       (progn
+         (setq completion-list (wl-ldap-search pattern cl))
+         (setq cl completion-list)))
     (if (null cl)
-       nil
+       (if use-ldap
+           (progn
+             (message "Can't find completion for \"%s\"" pattern)
+             (ding)))
       (setq completion (try-completion pattern cl))
       (cond ((eq completion t)
             (wl-complete-insert start end pattern completion-list)
index 2b6553b..0332224 100644 (file)
@@ -5,7 +5,7 @@
 
 ;; Author: Masahiro MURATA <muse@ba2.so-net.ne.jp>
 ;; Keywords: mail, net news
-;; Time-stamp: <00/03/14 19:35:28 teranisi>
+;; Time-stamp: <00/06/12 13:22:49 teranisi>
 
 ;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen).
 
@@ -339,7 +339,7 @@ See `wl-score-simplify-buffer-fuzzy' for details."
   (let* (score-list
          (spec (elmo-folder-get-spec folder))
          (method (symbol-name (car spec)))
-         (fld-name (car (cdr spec))))
+         (fld-name (elmo-string (car (cdr spec)))))
     (when (stringp fld-name)
       (while (string-match "[\\/:,;*?\"<>|]" fld-name)
         (setq fld-name (replace-match "." t nil fld-name)))
index e79dbdc..b5e43dd 100644 (file)
@@ -4,7 +4,7 @@
 
 ;; Author: Yuuichi Teranishi <teranisi@gohome.org>
 ;; Keywords: mail, net news
-;; Time-stamp: <2000-05-18 17:04:43 teranisi>
+;; Time-stamp: <00/06/12 13:43:58 teranisi>
 
 ;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen).
 
@@ -586,6 +586,21 @@ Default is for 'reply-to-all'."
   :type 'file
   :group 'wl)
 
+(defcustom wl-ldap-server "localhost"
+  "*LDAP server."
+  :type '(string :tag "Server")
+  :group 'wl)
+
+(defcustom wl-ldap-base "c=US"
+  "*LDAP base."
+  :type '(string :tag "Base")
+  :group 'wl)
+
+(defcustom wl-use-ldap nil
+  "*If non-nil, use LDAP for address completion."
+  :type 'boolean
+  :group 'wl)
+
 (defcustom wl-folder-info-save t
   "If non-nil, save elmo-folder-info-alist."
   :type 'boolean