(postpone GCC until message is actually sent).
* gnus-draft.el (gnus-draft-send): Call `gnus-agent-restore-gcc'.
* gnus-agent.el (gnus-agent-possibly-do-gcc):
(gnus-agent-restore-gcc):
(gnus-agent-possibly-save-gcc): New functions.
* gnus-msg.el (gnus-inews-add-send-actions): Use
`gnus-agent-possibly-do-gcc' if Agentized.
(gnus-inews-add-send-actions): Add `gnus-agent-possibly-save-gcc'
to `message-header-hook'.
* gnus.el (gnus-agent-gcc-header): New variable.
+2000-08-05 Simon Josefsson <simon@josefsson.org>
+
+ Make GCC to remote groups work when unplugged
+ (postpone GCC until message is actually sent).
+
+ * gnus-draft.el (gnus-draft-send): Call `gnus-agent-restore-gcc'.
+
+ * gnus-agent.el (gnus-agent-possibly-do-gcc):
+ (gnus-agent-restore-gcc):
+ (gnus-agent-possibly-save-gcc): New functions.
+
+ * gnus-msg.el (gnus-inews-add-send-actions): Use
+ `gnus-agent-possibly-do-gcc' if Agentized.
+ (gnus-inews-add-send-actions): Add `gnus-agent-possibly-save-gcc'
+ to `message-header-hook'.
+
+ * gnus.el (gnus-agent-gcc-header): New variable.
+
2000-07-13 Simon Josefsson <simon@josefsson.org>
Asks the user to synch flags with server when you plug in.
(while (search-backward "\n" nil t)
(replace-match "\\n" t t))))
+(defun gnus-agent-restore-gcc ()
+ "Restore GCC field from saved header."
+ (save-excursion
+ (goto-char (point-min))
+ (while (re-search-forward (concat gnus-agent-gcc-header ":") nil t)
+ (replace-match "Gcc:" 'fixedcase))))
+
+(defun gnus-agent-possibly-save-gcc ()
+ "Save GCC if Gnus is unplugged."
+ (unless gnus-plugged
+ (save-excursion
+ (goto-char (point-min))
+ (let ((case-fold-search t))
+ (while (re-search-forward "^gcc:" nil t)
+ (replace-match (concat gnus-agent-gcc-header ":") 'fixedcase))))))
+
+(defun gnus-agent-possibly-do-gcc ()
+ "Do GCC if Gnus is plugged."
+ (when gnus-plugged
+ (gnus-inews-do-gcc)))
+
;;;
;;; Group mode commands
;;;
(require 'message)
(require 'gnus-msg)
(require 'nndraft)
+(require 'gnus-agent)
(eval-when-compile (require 'cl))
;;; Draft minor mode
(setq type (ignore-errors (read (current-buffer)))
method (ignore-errors (read (current-buffer))))
(message-remove-header gnus-agent-meta-information-header)))
+ ;; Let Agent restore any GCC lines and have message.el perform them.
+ (gnus-agent-restore-gcc)
;; Then we send it. If we have no meta-information, we just send
;; it and let Message figure out how.
(when (and (or (null method)
(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)))
\f
;;; Internal variables
+(defvar gnus-agent-gcc-header "X-Gnus-Agent-Gcc")
(defvar gnus-agent-meta-information-header "X-Gnus-Agent-Meta-Information")
(defvar gnus-group-get-parameter-function 'gnus-group-get-parameter)
(defvar gnus-original-article-buffer " *Original Article*")