*** empty log message ***
[gnus] / lisp / gnus-msg.el
index 535f6fb..2f9afb4 100644 (file)
@@ -48,7 +48,7 @@ posting.")
 (defvar gnus-outgoing-message-group nil
   "*All outgoing messages will be put in this group.
 If you want to store all your outgoing mail and articles in the group
-\"nnml:archive\", you set this variable to that value. This variable
+\"nnml:archive\", you set this variable to that value.  This variable
 can also be a list of group names. 
 
 If you want to have greater control over what group to put each
@@ -69,6 +69,24 @@ the group.")
 (defvar gnus-sent-message-ids-length 1000
   "The number of sent Message-IDs to save.")
 
+(defvar gnus-crosspost-complaint
+  "Hi,
+
+You posted the article below with the following Newsgroups header:
+
+Newsgroups: %s
+
+The %s group, at least, was an inappropriate recipient
+of this message.  Please trim your Newsgroups header to exclude this
+group before posting in the future.
+
+Thank you.
+
+"
+  "Format string to be inserted when complaining about crossposts.
+The first %s will be replaced by the Newsgroups header;
+the second with the current group name.")
+
 ;;; Internal variables.
 
 (defvar gnus-message-buffer "*Mail Gnus*")
@@ -145,6 +163,7 @@ Thank you for your help in stamping out bugs.
        ,@forms
        (gnus-inews-add-send-actions ,winconf ,buffer ,article)
        (setq gnus-message-buffer (current-buffer))
+       (make-local-variable 'gnus-newsgroup-name)
        (gnus-configure-windows ,config t))))
     
 (defun gnus-inews-add-send-actions (winconf buffer article)
@@ -229,12 +248,12 @@ If prefix argument YANK is non-nil, original article is yanked automatically."
        (gnus-summary-select-article nil nil nil article)
        (gnus-summary-remove-process-mark article))
       (gnus-copy-article-buffer)
+      (message-goto-body)      
       (let ((message-reply-buffer gnus-article-copy)
            (message-reply-headers gnus-current-headers))
        (message-yank-original)
        (setq beg (or beg (mark t))))
       (when articles (insert "\n")))
-    
     (push-mark)
     (goto-char beg)))
 
@@ -290,20 +309,30 @@ header line with the old Message-ID."
       (save-excursion
        (set-buffer article-buffer)
        (save-restriction
+         ;; Copy over the (displayed) article buffer, delete
+         ;; hidden text and remove text properties.
          (widen)
-         (setq contents (format "%s" (buffer-string)))
+         (copy-to-buffer gnus-article-copy (point-min) (point-max))
+         (set-buffer gnus-article-copy)
+         (article-delete-text-of-type 'annotation)
+         (insert
+          (prog1
+              (format "%s" (buffer-string))
+            (erase-buffer)))
+         ;; Find the original headers.
          (set-buffer gnus-original-article-buffer)
          (goto-char (point-min))
          (while (looking-at message-unix-mail-delimiter)
            (forward-line 1))
          (setq beg (point))
          (setq end (or (search-forward "\n\n" nil t) (point)))
+         ;; Delete the headers from the displayed articles.
          (set-buffer gnus-article-copy)
-         (erase-buffer)
-         (insert contents)
          (delete-region (goto-char (point-min))
                         (or (search-forward "\n\n" nil t) (point)))
-         (insert-buffer-substring gnus-original-article-buffer beg end)))
+         ;; Insert the original article headers.
+         (insert-buffer-substring gnus-original-article-buffer beg end)
+         (article-decode-rfc1522)))
       gnus-article-copy)))
 
 (defun gnus-post-news (post &optional group header article-buffer yank subject
@@ -338,7 +367,7 @@ header line with the old Message-ID."
            (if post
                (message-news (or to-group group))
              (set-buffer gnus-article-copy)
-             (message-followup))
+             (message-followup to-group))
          ;; The is mail.
          (if post
              (progn
@@ -404,14 +433,8 @@ If SILENT, don't prompt the user."
                   (cons (or gnus-last-posting-server "") 0))))
          method-alist))))
      ;; Override normal method.
-     ((and gnus-post-method
-          (or (gnus-method-option-p group-method 'post)
-              (gnus-method-option-p group-method 'post-mail)))
+     (gnus-post-method
       gnus-post-method)
-     ;; Perhaps this is a mail group?
-     ((and (not (gnus-member-of-valid 'post group))
-          (not (gnus-method-option-p group-method 'post-mail)))
-      group-method)
      ;; Use the normal select method.
      (t gnus-select-method))))
 
@@ -453,8 +476,7 @@ If SILENT, don't prompt the user."
                                  gnus-inews-sent-ids))
            (setcdr end nil))
          (nnheader-temp-write gnus-sent-message-ids-file
-           (prin1 `(setq gnus-inews-sent-ids ',gnus-inews-sent-ids)
-                  (current-buffer)))
+           (gnus-prin1 `(setq gnus-inews-sent-ids ',gnus-inews-sent-ids)))
          nil)))))
 
 \f
@@ -564,7 +586,7 @@ If prefix argument YANK is non-nil, original article is yanked automatically."
   (gnus-summary-mail-forward t))
 
 (defvar gnus-nastygram-message 
-  "The following article was inappropriately posted to %s.\n"
+  "The following article was inappropriately posted to %s.\n\n"
   "Format string to insert in nastygrams.
 The current group name will be inserted at \"%s\".")
 
@@ -577,26 +599,10 @@ The current group name will be inserted at \"%s\".")
       (let ((group gnus-newsgroup-name))
        (gnus-summary-reply-with-original n)
        (set-buffer gnus-message-buffer)
+       (message-goto-body)
        (insert (format gnus-nastygram-message group))
        (message-send-and-exit))))
 
-(defvar gnus-crosspost-complaint
-  "Hi,
-
-You posted the article below with the following Newsgroups header:
-
-Newsgroups: %s
-
-The %s group, at least, was an inappropriate recipient
-of this message.  Please trim your Newsgroups header to exclude this
-group before posting in the future.
-
-Thank you.
-"
-  "Format string to be inserted when complaining about crossposts.
-The first %s will be replaced by the Newsgroups header;
-the second with the current group name.")
-
 (defun gnus-summary-mail-crosspost-complaint (n)
   "Send a complaint about crossposting to the current article(s)."
   (interactive "P")
@@ -606,17 +612,23 @@ the second with the current group name.")
       (set-buffer gnus-summary-buffer)
       (gnus-summary-goto-subject article)
       (let ((group (gnus-group-real-name gnus-newsgroup-name))
-           newsgroups)
+           newsgroups followup-to)
        (gnus-summary-select-article)
        (set-buffer gnus-original-article-buffer)
-       (if (<= (length (message-tokenize-header
-                        (setq newsgroups (mail-fetch-field "newsgroups"))
-                        ", "))
-               1)
-           (gnus-message 1 "Not a crossposted article")
+       (if (and (<= (length (message-tokenize-header
+                             (setq newsgroups (mail-fetch-field "newsgroups"))
+                             ", "))
+                    1)
+                (or (not (setq followup-to (mail-fetch-field "followup-to")))
+                    (not (member group (message-tokenize-header
+                                        followup-to ", ")))))
+           (if followup-to
+               (gnus-message 1 "Followup-to restricted")
+             (gnus-message 1 "Not a crossposted article"))
          (set-buffer gnus-summary-buffer)
          (gnus-summary-reply-with-original 1)
          (set-buffer gnus-message-buffer)
+         (message-goto-body)
          (insert (format gnus-crosspost-complaint newsgroups group))
          (when (gnus-y-or-n-p "Send this complaint? ")
            (message-send-and-exit)))))))
@@ -749,47 +761,39 @@ If YANK is non-nil, include the original article."
        (kill-buffer "*Gnus Help Bug*")))
 
 (defun gnus-debug ()
-  "Attemps to go through the Gnus source file and report what variables have been changed.
+  "Attempts to go through the Gnus source file and report what variables have been changed.
 The source file has to be in the Emacs load path."
   (interactive)
   (let ((files '("gnus-load.el" "gnus-sum.el" "gnus-group.el"
                 "gnus-art.el" "gnus-start.el"
-                "gnus-msg.el" "gnus-score.el"
+                "gnus-msg.el" "gnus-score.el" "gnus-win.el"
                 "nnmail.el" "message.el"))
-       file dirs expr olist sym)
+       file expr olist sym)
     (gnus-message 4 "Please wait while we snoop your variables...")
     (sit-for 0)
+    ;; Go through all the files looking for non-default values for variables.
     (save-excursion
       (set-buffer (get-buffer-create " *gnus bug info*"))
       (buffer-disable-undo (current-buffer))
       (while files
        (erase-buffer)
-       (setq dirs load-path)
-       (while dirs
-         (if (or (not (car dirs))
-                 (not (stringp (car dirs)))
-                 (not (file-exists-p 
-                       (setq file (concat (file-name-as-directory 
-                                           (car dirs)) (car files))))))
-             (setq dirs (cdr dirs))
-           (setq dirs nil)
-           (insert-file-contents file)
+       (when (file-exists-p (setq file (locate-library (pop files))))
+         (insert-file-contents file)
+         (goto-char (point-min))
+         (if (not (re-search-forward "^;;* *Internal variables" nil t))
+             (gnus-message 4 "Malformed sources in file %s" file)
+           (narrow-to-region (point-min) (point))
            (goto-char (point-min))
-           (if (not (re-search-forward "^;;* *Internal variables" nil t))
-               (gnus-message 4 "Malformed sources in file %s" file)
-             (narrow-to-region (point-min) (point))
-             (goto-char (point-min))
-             (while (setq expr (condition-case () 
-                                   (read (current-buffer)) (error nil)))
-               (condition-case ()
-                   (and (eq (car expr) 'defvar)
-                        (stringp (nth 3 expr))
-                        (or (not (boundp (nth 1 expr)))
-                            (not (equal (eval (nth 2 expr))
-                                        (symbol-value (nth 1 expr)))))
-                        (setq olist (cons (nth 1 expr) olist)))
-                 (error nil))))))
-       (setq files (cdr files)))
+           (while (setq expr (condition-case () 
+                                 (read (current-buffer)) (error nil)))
+             (condition-case ()
+                 (and (eq (car expr) 'defvar)
+                      (stringp (nth 3 expr))
+                      (or (not (boundp (nth 1 expr)))
+                          (not (equal (eval (nth 2 expr))
+                                      (symbol-value (nth 1 expr)))))
+                      (push (nth 1 expr) olist))
+               (error nil))))))
       (kill-buffer (current-buffer)))
     (when (setq olist (nreverse olist))
       (insert "------------------ Environment follows ------------------\n\n"))
@@ -810,7 +814,7 @@ The source file has to be in the Emacs load path."
       (setq olist (cdr olist)))
     (insert "\n\n")
     ;; Remove any null chars - they seem to cause trouble for some
-    ;; mailers. (Byte-compiled output from the stuff above.) 
+    ;; mailers.  (Byte-compiled output from the stuff above.) 
     (goto-char (point-min))
     (while (re-search-forward "[\000\200]" nil t)
       (replace-match "" t t))))
@@ -954,7 +958,7 @@ this is a reply."
          (insert "Gcc: ")
          (if (and gnus-newsgroup-name
                   (setq gcc-self-val
-                        (gnus-group-get-parameter
+                        (gnus-group-find-parameter
                          gnus-newsgroup-name 'gcc-self)))
              (progn 
                (insert