Patch by Ed L. Cashin to make gnus-move-split-methods move to
[gnus] / lisp / gnus-msg.el
index e8f5a1b..8210579 100644 (file)
@@ -202,6 +202,20 @@ Thank you for your help in stamping out bugs.
   ;; "c" gnus-summary-send-draft
   "r" gnus-summary-resend-message)
 
+;;;###autoload
+(defun gnus-msg-mail (&rest args)
+  "Start editing a mail message to be sent.
+Like `message-mail', but with Gnus paraphernalia, particularly the
+the Gcc: header for archiving purposes."
+  (interactive)
+  (gnus-setup-message 'message
+    (apply 'message-mail args)))
+
+;;;###autoload
+(define-mail-user-agent 'gnus-user-agent
+      'gnus-msg-mail 'message-send-and-exit
+      'message-kill-buffer 'message-send-hook)
+
 ;;; Internal functions.
 
 (defvar gnus-article-reply nil)
@@ -262,7 +276,11 @@ Thank you for your help in stamping out bugs.
 
 (defun gnus-inews-add-send-actions (winconf buffer article)
   (make-local-hook 'message-sent-hook)
-  (add-hook 'message-sent-hook 'gnus-inews-do-gcc nil t)
+  (add-hook 'message-sent-hook (if gnus-agent 'gnus-agent-possibly-do-gcc
+                                'gnus-inews-do-gcc) nil t)
+  (when gnus-agent
+    (make-local-hook 'message-header-hook)
+    (add-hook 'message-header-hook 'gnus-agent-possibly-save-gcc nil t))
   (setq message-post-method
        `(lambda (arg)
           (gnus-post-method arg ,gnus-newsgroup-name)))
@@ -709,19 +727,18 @@ If POST, post instead of mail."
            text)
        (save-excursion
          (set-buffer gnus-original-article-buffer)
-         (mm-with-unibyte-current-buffer
-           (setq text (buffer-string))))
+         (setq text (buffer-string)))
        (set-buffer 
         (gnus-get-buffer-create
          (generate-new-buffer-name " *Gnus forward*")))
        (erase-buffer)
-       (mm-disable-multibyte)
+       (unless message-forward-show-mml
+         (mm-disable-multibyte))
        (insert text)
        (goto-char (point-min))
        (when (looking-at "From ")
          (replace-match "X-From-Line: ") )
        (when message-forward-show-mml
-         (mm-enable-multibyte)
          (mime-to-mml))
        (message-forward post)))))
 
@@ -1024,6 +1041,21 @@ this is a reply."
 
 ;;; Gcc handling.
 
+(defun gnus-inews-group-method (group)
+  (cond ((and (null (gnus-get-info group))
+             (eq (car gnus-message-archive-method)
+                 (car
+                  (gnus-server-to-method
+                   (gnus-group-method group)))))
+        ;; If the group doesn't exist, we assume
+        ;; it's an archive group...
+        gnus-message-archive-method)
+       ;; Use the method.
+       ((gnus-info-method (gnus-get-info group))
+        (gnus-info-method (gnus-get-info group)))
+       ;; Find the method.
+       (t (gnus-group-method group))))
+
 ;; Do Gcc handling, which copied the message over to some group.
 (defun gnus-inews-do-gcc (&optional gcc)
   (interactive)
@@ -1042,21 +1074,7 @@ this is a reply."
            ;; Copy the article over to some group(s).
            (while (setq group (pop groups))
              (gnus-check-server
-              (setq method
-                    (cond ((and (null (gnus-get-info group))
-                                (eq (car gnus-message-archive-method)
-                                    (car
-                                     (gnus-server-to-method
-                                      (gnus-group-method group)))))
-                           ;; If the group doesn't exist, we assume
-                           ;; it's an archive group...
-                           gnus-message-archive-method)
-                          ;; Use the method.
-                          ((gnus-info-method (gnus-get-info group))
-                           (gnus-info-method (gnus-get-info group)))
-                          ;; Find the method.
-                          (t (gnus-group-method group)))))
-             (gnus-check-server method)
+              (setq method (gnus-inews-group-method group)))
              (unless (gnus-request-group group t method)
                (gnus-request-create-group group method))
              (save-excursion