* wl-summary.el (wl-summary-write-current-folder): Renamed from
authorkaoru <kaoru>
Wed, 1 Nov 2000 05:05:29 +0000 (05:05 +0000)
committerkaoru <kaoru>
Wed, 1 Nov 2000 05:05:29 +0000 (05:05 +0000)
`wl-summary-write-current-newsgroup'.
(wl-summary-write-current-folder-functions): New variable.
* wl-folder.el (wl-folder-get-newsgroups): New function.
(wl-folder-guess-mailing-list-by-refile-rule): New function.
(wl-folder-write-current-folder): Renamed from
`wl-folder-write-current-newsgroup'.

wl/ChangeLog
wl/wl-folder.el
wl/wl-summary.el

index a378e62..97796cf 100644 (file)
@@ -1,5 +1,15 @@
 2000-11-01  TAKAHASHI Kaoru  <kaoru@kaisei.org>
 
+       * wl-summary.el (wl-summary-write-current-folder): Renamed from
+       `wl-summary-write-current-newsgroup'.
+       (wl-summary-write-current-folder-functions): New variable.
+       * wl-folder.el (wl-folder-get-newsgroups): New function.
+       (wl-folder-guess-mailing-list-by-refile-rule): New function.
+       (wl-folder-write-current-folder): Renamed from
+       `wl-folder-write-current-newsgroup'.
+
+2000-11-01  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
        * Version number is increased to 2.3.93.
 
 2000-11-01  Yuuichi Teranishi  <teranisi@gohome.org>
index 40144bc..5f75732 100644 (file)
   (define-key wl-folder-mode-map "g"    'wl-folder-goto-folder)
   (define-key wl-folder-mode-map "j"    'wl-folder-jump-to-current-entity)
   (define-key wl-folder-mode-map "w"    'wl-draft)
-  (define-key wl-folder-mode-map "W"    'wl-folder-write-current-newsgroup)
+  (define-key wl-folder-mode-map "W"    'wl-folder-write-current-folder)
   (define-key wl-folder-mode-map "\C-c\C-o" 'wl-jump-to-draft-buffer)
   (define-key wl-folder-mode-map "rS"   'wl-folder-sync-region)
   (define-key wl-folder-mode-map "S"    'wl-folder-sync-current-entity)
@@ -2002,6 +2002,55 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'."
       (setq alist (cdr alist)))
     hashtb))
 
+(defun wl-folder-get-newsgroups (folder)
+  "Return Newsgroups field value string for FOLDER newsgroup.
+If FOLDER is multi, return comma separated string (cross post)."
+  (let ((flist (elmo-folder-get-primitive-folder-list folder)) ; multi
+       newsgroups fld ret)
+    (while (setq fld (car flist))
+      (if (setq ret
+               (cond ((eq 'nntp (elmo-folder-get-type fld))
+                      (nth 1 (elmo-folder-get-spec fld)))
+                     ((eq 'localnews (elmo-folder-get-type fld))
+                      (elmo-replace-in-string
+                       (nth 1 (elmo-folder-get-spec fld)) "/" "\\."))))
+         ;; append newsgroup
+         (setq newsgroups (if (stringp newsgroups)
+                              (concat newsgroups "," ret)
+                            ret)))
+      (setq flist (cdr flist)))
+    (list nil nil newsgroups)))
+
+(defun wl-folder-guess-mailing-list-by-refile-rule (folder)
+  "Return ML address guess by FOLDER.
+Use `wl-subscribed-mailing-list' and `wl-refile-rule-alist'.
+Don't care multi."
+  (setq folder (car (elmo-folder-get-primitive-folder-list folder)))
+  (unless (memq (elmo-folder-get-type folder)
+               '(localnews nntp))
+    (let ((rules wl-refile-rule-alist)
+         mladdress tokey toalist histkey)
+      (while rules
+       (if (or (and (stringp (car (car rules)))
+                    (string-match "[Tt]o" (car (car rules))))
+               (and (listp (car (car rules)))
+                    (elmo-string-matched-member "to" (car (car rules))
+                                                'case-ignore)))
+           (setq toalist (append toalist (cdr (car rules)))))
+       (setq rules (cdr rules)))
+      (when toalist
+       (setq tokey (car (rassoc folder toalist)))
+;;;     (setq histkey (car (rassoc folder wl-refile-alist)))
+       (elmo-string-matched-member tokey
+                                   wl-subscribed-mailing-list t))
+
+      ;; case-ignore search `wl-subscribed-mailing-list'
+      (if (stringp tokey)
+         (list
+          (elmo-string-matched-member tokey wl-subscribed-mailing-list t)
+          nil nil)
+       nil))))
+
 (defun wl-folder-update-diff-line (diffs)
   (let ((inhibit-read-only t)
        (buffer-read-only nil)
@@ -2627,10 +2676,10 @@ If optional arg exists, don't check any folders."
        (wl-folder-drop-unsync-entity entity)
        (message "All unsync messages in %s are dropped!" entity-name)))))
 
-(defun wl-folder-write-current-newsgroup ()
+(defun wl-folder-write-current-folder ()
   ""
   (interactive)
-  (wl-summary-write-current-newsgroup (wl-folder-entity-name)))
+  (wl-summary-write-current-folder (wl-folder-entity-name)))
 
 (defun wl-folder-mimic-kill-buffer ()
   "Kill the current (Folder) buffer with query."
index ad0ccbc..66676b6 100644 (file)
   (define-key wl-summary-mode-map "P"    'wl-summary-up)
 ;;;(define-key wl-summary-mode-map "w"    'wl-draft)
   (define-key wl-summary-mode-map "w"    'wl-summary-write)
-  (define-key wl-summary-mode-map "W"    'wl-summary-write-current-newsgroup)
+  (define-key wl-summary-mode-map "W"    'wl-summary-write-current-folder)
 ;;;(define-key wl-summary-mode-map "e"     'wl-draft-open-file)
   (define-key wl-summary-mode-map "e"     'wl-summary-save)
   (define-key wl-summary-mode-map "\C-c\C-o" 'wl-jump-to-draft-buffer)
@@ -5117,28 +5117,39 @@ Reply to author if invoked with ARG."
   (run-hooks 'wl-mail-setup-hook)
   (mail-position-on-field "To"))
 
-(defun wl-summary-write-current-newsgroup (&optional folder)
-  ""
+(defvar wl-summary-write-current-folder-functions
+  '(wl-folder-get-newsgroups
+;;; wl-folder-guess-mailing-list-by-refile-rule
+    )
+  "Newsgroups or Mailing List address guess functions list.
+Call from `wl-summary-write-current-folder'")
+
+(defun wl-summary-write-current-folder (&optional folder)
+  "Write message to current FOLDER's newsgroup or mailing-list.
+Use function list is `wl-summary-write-current-folder-functions'."
   (interactive)
-  (let* ((folder (or folder wl-summary-buffer-folder-name))
-        (flist (elmo-folder-get-primitive-folder-list folder))
-        newsgroups fld ret)
-    (while (setq fld (car flist))
-      (if (setq ret
-               (cond ((eq 'nntp (elmo-folder-get-type fld))
-                      (nth 1 (elmo-folder-get-spec fld)))
-                     ((eq 'localnews (elmo-folder-get-type fld))
-                      (elmo-replace-in-string
-                       (nth 1 (elmo-folder-get-spec fld)) "/" "\\."))))
-         (setq newsgroups (cond (newsgroups
-                                 (concat newsgroups "," ret))
-                                (t ret))))
-      (setq flist (cdr flist)))
-    (if newsgroups
-       (progn
-         (wl-draft nil nil nil nil nil newsgroups)
-         (run-hooks 'wl-mail-setup-hook))
-      (error "%s is not newsgroup" folder))))
+  (let (newsgroups to cc)
+    ;; default FOLDER is current buffer folder
+    (setq folder (or folder wl-summary-buffer-folder-name))
+    (let ((flist wl-summary-write-current-folder-functions)
+         guess-list)
+      (while flist
+       (setq guess-list (funcall (car flist) folder))
+       (if (or (nth 0 guess-list)      ; To:
+;;;            (nth 1 guess-list)      ; Cc:
+               (nth 2 guess-list))     ; Newsgroups:
+           (setq flist nil)
+         (setq flist (cdr flist))))
+      (if guess-list
+         (progn
+           (wl-draft (nth 0 guess-list) ; To:
+                     nil nil
+                     (nth 1 guess-list) ; Cc:
+                     nil               
+                     (nth 2 guess-list)) ; Newsgroups:
+           (run-hooks 'wl-mail-setup-hook))
+;;;    (error "%s is not newsgroup" folder)
+       (error "Can't guess by folder %s" folder)))))
 
 (defun wl-summary-forward (&optional without-setup-hook)
   ""