diff lisp/gnus/message.el @ 100:4be1180a9e89 r20-1b2

Import from CVS: tag r20-1b2
author cvs
date Mon, 13 Aug 2007 09:15:11 +0200
parents 0d2f883870bc
children cf808b4c4290
line wrap: on
line diff
--- a/lisp/gnus/message.el	Mon Aug 13 09:13:58 2007 +0200
+++ b/lisp/gnus/message.el	Mon Aug 13 09:15:11 2007 +0200
@@ -727,6 +727,8 @@
 (eval-and-compile
   (autoload 'message-setup-toolbar "messagexmas")
   (autoload 'mh-send-letter "mh-comp")
+  (autoload 'gnus-point-at-eol "gnus-util")
+  (autoload 'gnus-point-at-bol "gnus-util")
   (autoload 'gnus-output-to-mail "gnus-util")
   (autoload 'gnus-output-to-rmail "gnus-util"))
 
@@ -736,22 +738,6 @@
 ;;; Utility functions.
 ;;;
 
-(defun message-point-at-bol ()
-  "Return point at the beginning of the line."
-  (let ((p (point)))
-    (beginning-of-line)
-    (prog1
-	(point)
-      (goto-char p))))
-
-(defun message-point-at-eol ()
-  "Return point at the end of the line."
-  (let ((p (point)))
-    (end-of-line)
-    (prog1
-	(point)
-      (goto-char p))))
-
 (defmacro message-y-or-n-p (question show &rest text)
   "Ask QUESTION, displaying the rest of the arguments in a temp. buffer if SHOW"
   `(message-talkative-question 'y-or-n-p ,question ,show ,@text))
@@ -1277,20 +1263,8 @@
     ;; We build the table, if necessary.
     (when (or (not message-caesar-translation-table)
 	      (/= (aref message-caesar-translation-table ?a) (+ ?a n)))
-      (let ((i -1) 
-	    (table (make-string 256 0)))
-	(while (< (incf i) 256)
-	  (aset table i i))
-	(setq table
-	      (concat
-	       (substring table 0 ?A)
-	       (substring table (+ ?A n) (+ ?A n (- 26 n)))
-	       (substring table ?A (+ ?A n))
-	       (substring table (+ ?A 26) ?a)
-	       (substring table (+ ?a n) (+ ?a n (- 26 n)))
-	       (substring table ?a (+ ?a n))
-	       (substring table (+ ?a 26) 255)))
-	(setq message-caesar-translation-table table)))
+	(setq message-caesar-translation-table
+	      (message-make-caesar-translation-table n)))
     ;; Then we translate the region.  Do it this way to retain 
     ;; text properties.
     (while (< b e)
@@ -1299,6 +1273,21 @@
        (aref message-caesar-translation-table (char-after b)))
       (incf b))))
 
+(defun message-make-caesar-translation-table (n)
+  "Create a rot table with offset N."
+  (let ((i -1) 
+	(table (make-string 256 0)))
+    (while (< (incf i) 256)
+      (aset table i i))
+    (concat
+     (substring table 0 ?A)
+     (substring table (+ ?A n) (+ ?A n (- 26 n)))
+     (substring table ?A (+ ?A n))
+     (substring table (+ ?A 26) ?a)
+     (substring table (+ ?a n) (+ ?a n (- 26 n)))
+     (substring table ?a (+ ?a n))
+     (substring table (+ ?a 26) 255))))
+
 (defun message-caesar-buffer-body (&optional rotnum)
   "Caesar rotates all letters in the current buffer by 13 places.
 Used to encode/decode possibly offensive messages (commonly in net.jokes).
@@ -2523,7 +2512,7 @@
 		    (forward-line -1))
 		;; The value of this header was empty, so we clear
 		;; totally and insert the new value.
-		(delete-region (point) (message-point-at-eol))
+		(delete-region (point) (gnus-point-at-eol))
 		(insert value))
 	      ;; Add the deletable property to the headers that require it.
 	      (and (memq header message-deletable-headers)
@@ -2928,7 +2917,7 @@
 	references message-id follow-to 
 	(inhibit-point-motion-hooks t)
 	(message-this-is-news t)
-	followup-to distribution newsgroups gnus-warning)
+	followup-to distribution newsgroups gnus-warning posted-to)
     (save-restriction
       (narrow-to-region
        (goto-char (point-min))
@@ -2945,6 +2934,7 @@
 	    message-id (message-fetch-field "message-id" t)
 	    followup-to (message-fetch-field "followup-to")
 	    newsgroups (message-fetch-field "newsgroups")
+	    posted-to (message-fetch-field "posted-to")
 	    reply-to (message-fetch-field "reply-to")
 	    distribution (message-fetch-field "distribution")
 	    mct (message-fetch-field "mail-copies-to"))
@@ -2983,7 +2973,9 @@
 
 A typical situation where `Followup-To: poster' is used is when the poster
 does not read the newsgroup, so he wouldn't see any replies sent to it."))
-		  (cons 'To (or reply-to from ""))
+		  (progn
+		    (setq message-this-is-news nil)
+		    (cons 'To (or reply-to from "")))
 		(cons 'Newsgroups newsgroups)))
 	     (t
 	      (if (or (equal followup-to newsgroups)
@@ -3006,6 +2998,8 @@
 responses here are directed to other newsgroups."))
 		  (cons 'Newsgroups followup-to)
 		(cons 'Newsgroups newsgroups))))))
+	  (posted-to
+	   `((Newsgroups . ,posted-to)))
 	  (t
 	   `((Newsgroups . ,newsgroups))))
        ,@(and distribution (list (cons 'Distribution distribution)))