[Mew-dist 06408] Re: "In-Reply-To" and "References" fields

Mito mit at example.com
1998年 9月 11日 (金) 18:03:34 JST


ちょっと古い話題ですが、

※ "堀" こと toshi at example.com さんの
   『[Mew-dist 05846] "In-Reply-To" and "References" fields』より

堀>   - In-Reply-Toには「現在直接replyしているmail」のmessage-IDを入れる
堀>   - Referencesには「いま書いているmail」で参照している、他のmailの
堀>     message-IDを入れる

これと、

※ "鯉" こと koie at example.com さんの
   『[Mew-dist 05849] RE: "In-Reply-To" and "References" fields』より

鯉> Mewって複数のメイルから引用できるので、C-c C-yで引用した
鯉> previousでないmailのmessage-IDもreferences: に入れた方が
鯉> いいんではないでしょうか。もちろん、手動でできますが...

について、一応、draft-ietf-drums-msg-fmt-05.txt なんかもちょっ
と覗いてみて、対応してみました

r などで reply する場合は、元のメッセージの References に、
元のメッセージの Message-Id をくっつけたものを References に
します。

In-Reply-To には元のメッセージの Message-Id だけをつけます。

C-c C-y の場合は元のメッセージの References は見ません。
draft の References に元のメッセージの Message-Id を追加する
だけです。
In-Reply-To は変化しません。

こんな感じですが、いかがでしょう?
draft-ietf-drums-msg-fmt-05.txt は、ほんとにちょっとしか見て
ないので、おかしいところがあったらどなたか直してください。(_ _)
-- 
9/11 17:59頃
NECソフトウェア新潟 水戸
mailto:mit at example.com \n
-------------- next part --------------
--- mew-draft.el	1998/09/09 12:44:25	1.1
+++ mew-draft.el	1998/09/11 06:39:27
@@ -578,11 +578,6 @@
   (mew-header-insert-here mew-fcc:        mew-fcc)
   (mew-header-insert-here mew-dcc:        mew-dcc)
   (mew-header-insert-here mew-reply-to:   mew-reply-to)
-  (if in-reply-to
-      (if references
-	  (setq in-reply-to (concat "Your message of \"" 
-				    in-reply-to "\"\n\t" references))
-	(setq in-reply-to (concat "Your message of \"" in-reply-to "\""))))
   (mew-header-insert-here mew-in-reply-to: in-reply-to)
   (mew-header-insert-here mew-references:  references)
   (if (and mew-x-face-file
@@ -804,7 +799,7 @@
   (if (and (not force) (or (mew-in-header-p) (mew-in-attach-p)))
       (message "You cannot cite a message here.")
     (let ((nonmewbuf mew-message-citation-buffer) ;; buffer local, so copy here
-	  cite beg end)
+	  cite beg end ref-msgid)
       (save-excursion
 	;;
 	;; extract the body without header
@@ -840,10 +835,32 @@
 	  (mew-header-goto-end)
 	  (setq cite (concat (mew-buffer-substring (point-min) (point)) 
 			     "\n" cite))
+          (setq ref-msgid (mew-header-get-value mew-message-id:))
 	  ))
       ;; 
       ;; Draft mode, insert the header and the body.
       ;;
+
+      ;; append message-id to references
+      (if ref-msgid
+          (save-excursion
+            (let ((ref (mew-header-get-value mew-references:))
+                  (refl nil) rb)
+              (if (not ref)
+                  ()
+                (setq rb ref)
+                (while (string-match "<[^>]+>" rb)
+                  (setq refl (cons (mew-match 0 rb) refl)) 
+                  (setq rb (substring rb (match-end 0))))
+                (if (member ref-msgid refl)
+                    (setq ref-msgid nil)))
+              (if (null ref-msgid)
+                  ()
+                (setq ref (concat ref (if ref "\n\t") ref-msgid))
+                (mew-header-delete-lines (list mew-references:))
+                (if (null refl)
+                    (goto-char (mew-header-end)))
+                (mew-header-insert-here mew-references: ref)))))
       (save-restriction
 	;; this gets complicated due to supercite, please don't care
 	(narrow-to-region (point)(point)) ;; for (goto-char (point-min))
--- mew-summary.el	1998/09/09 12:49:04	1.1
+++ mew-summary.el	1998/09/11 06:20:28
@@ -1084,8 +1084,29 @@
 	(setq subject (mew-header-get-value mew-subj:))
 	(if (and subject (not (string-match mew-reply-regex subject)))
 	    (setq subject (concat mew-reply-string subject)))
-	(setq in-reply-to (mew-header-get-value mew-date:))
-	(setq references (mew-header-get-value mew-message-id:))
+	(setq in-reply-to (mew-header-get-value mew-message-id:))
+	(let* (;(dat "[-a-zA-Z0-9!#-'*+/=?^`{^~][-a-zA-Z0-9!#-'*+/=?^`{^~].*")
+	       ;(mid (format "<%s@%s>" dat dat)))
+	       (mid "<[^\t >]+>"))
+	  (if (and in-reply-to (string-match mid in-reply-to))
+	      (setq in-reply-to (mew-match 0 in-reply-to))
+            (setq in-reply-to nil)))
+        (setq references (mew-header-get-value mew-references:))
+        (if in-reply-to
+            (let ((ref references)
+                  (refl nil))
+              (if (null ref)
+                  (setq references in-reply-to)
+                (while (string-match "<[^>]+>" ref)
+                  (setq refl (append refl (list (mew-match 0 ref))))
+                  (setq ref (substring ref (match-end 0))))
+                (if (member in-reply-to refl)
+                    ()
+                  (setq references (car refl))
+                  (setq refl (append (cdr refl) (list in-reply-to)))
+                  (mapcar (lambda (i)
+                            (setq references (concat references "\n\t" i)))
+                          refl)))))
 	)
       ;;
       (mew-pop-to-buffer cbuf) ;; draft
--- contrib/mew-gnus.el	1998/09/10 02:43:14	1.1
+++ contrib/mew-gnus.el	1998/09/11 06:24:36
@@ -134,9 +134,27 @@
 	  newsgroups (or (gnus-fetch-field "Followup-To")
 			 (gnus-fetch-field "Newsgroups"))
 	  date (gnus-fetch-field "Date")
-	  in-reply-to (mew-header-get-value "Date:")
-	  references (mew-header-get-value "Message-ID:")
-	  distribution (gnus-fetch-field "Distribution"))
+	  distribution (gnus-fetch-field "Distribution")
+	  in-reply-to (mew-header-get-value mew-message-id:)
+	  references (mew-header-get-value mew-references:))
+    (if (and in-reply-to (string-match "<[^\t >]>" in-reply-to))
+	(setq in-reply-to (mew-match 0 in-reply-to))
+      (setq in-reply-to nil))
+    (if in-reply-to
+        (let ((ref references)
+              (refl nil))
+          (if (null ref)
+              (setq references in-reply-to)
+            (while (string-match "<[^>]+>" ref)
+              (setq refl (append refl (list (mew-match 0 ref))))
+              (setq ref (substring ref (match-end 0))))
+            (if (member in-reply-to refl)
+                ()
+              (setq references (car refl))
+              (setq refl (append (cdr refl) (list in-reply-to)))
+              (mapcar (lambda (i)
+                        (setq references (concat references "\n\t" i)))
+                      refl)))))
     (switch-to-buffer-other-window (find-file-noselect file))
     (mew-draft-rename file)
     (mew-draft-header subject nil to cc newsgroups in-reply-to references)
-------------- next part --------------
ついでに、draft-ietf-usefor-article-01.txt の User-Agent に
も対応しようと思って以下のようにしたのですが、私は Mew はメー
ルにしか使わないから X-Mailer のままでいいかなと思ってやめちゃ
いました。

# g/mew-x-mailer/mew-user-agent/s
# g/X-Mailer/User-Agent/s
# すればいいだけだと思うんですけど...。(_ _)

--- mew-vars.el	1998/09/10 02:45:39	1.1
+++ mew-vars.el	1998/09/10 02:55:09
@@ -119,11 +119,16 @@
   (+ (length [key beg end pri]) (length mew-mime-fields)))
 
 (defconst mew-x-mailer
-  (concat mew-version " on "
-          (if (string-match "XEmacs" emacs-version) "XEmacs" "Emacs")
-          (format " %d.%d " emacs-major-version emacs-minor-version)
-          (and (boundp 'xemacs-codename) (concat "(" xemacs-codename ")"))
-          (and (boundp 'mule-version) (concat "/ Mule " mule-version)))
+  (if (string-match "\\(.*\\) +version +\\(.*$\\)" mew-version)
+      (concat
+       (format "%s/%s"
+               (substring mew-version (match-beginning 1) (match-end 1))
+               (substring mew-version (match-beginning 2) (match-end 2)))
+       (format " %s/%d.%d"
+               (if (string-match "XEmacs" emacs-version) "XEmacs" "Emacs")
+               emacs-major-version emacs-minor-version)
+       (format " ( %s )" system-configuration))
+    nil)
   "*A value inserted into X-Mailer: field in Draft mode if *non-nil*.")
 
 (defconst mew-buffer-message     "*Mew message*")


Mew-dist メーリングリストの案内