;;; Internal variables
+(defvar gnus-agent-meta-information-header "X-Gnus-Agent-Meta-Information")
+
(defvar gnus-agent-history-buffers nil)
(defvar gnus-agent-buffer-alist nil)
(defvar gnus-agent-article-alist nil)
(re-search-forward
(concat "^" (regexp-quote mail-header-separator) "\n"))
(replace-match "\n")
+ (gnus-agent-insert-meta-information 'mail)
(gnus-request-accept-article "nndraft:queue")))
+(defun gnus-agent-insert-meta-information (type &optional method)
+ "Insert meta-information into the message that says how it's to be posted.
+TYPE can be either `mail' or `news'. If the latter METHOD can
+be a select method."
+ (save-excursion
+ (message-remove-header gnus-agent-meta-information-header)
+ (goto-char (point-min))
+ (insert gnus-agent-meta-information-header ": "
+ (symbol-name type) " " (format "%S" method)
+ "\n")
+ (forward-char -1)
+ (while (search-backward "\n" nil t)
+ (replace-match "\\n" t t))))
+
;;;
;;; Group mode commands
;;;
(set-buffer
(setq gnus-agent-current-history
(setq history (gnus-agent-history-buffer))))
+ (goto-char (point-min))
(unless (zerop (buffer-size))
(goto-char (point-min))
(while (not (eobp))
(require 'message)
(require 'gnus-msg)
(require 'nndraft)
+(require 'gnus-agent)
(eval-when-compile (require 'cl))
;;; Draft minor mode
"Send message ARTICLE."
(gnus-draft-setup article (or group "nndraft:queue"))
(let ((message-syntax-checks 'dont-check-for-anything-just-trust-me)
- message-send-hook)
- (message-send-and-exit)))
+ message-send-hook type method)
+ ;; We read the meta-information that says how and where
+ ;; this message is to be sent.
+ (save-restriction
+ (message-narrow-to-head)
+ (when (re-search-forward
+ (concat "^" (regexp-quote gnus-agent-meta-information-header) ":")
+ nil t)
+ (setq type (ignore-errors (read (current-buffer)))
+ method (ignore-errors (read (current-buffer))))
+ (message-remove-header gnus-agent-meta-information-header)))
+ ;; Then we send it. If we have no meta-information, we just send
+ ;; it and let Message figure out how.
+ (if type
+ (let ((message-this-is-news (eq type 'news))
+ (message-this-is-mail (eq type 'mail))
+ (gnus-post-method method)
+ (message-post-method method))
+ (message-send-and-exit))
+ (message-send-and-exit))))
(defun gnus-draft-send-all-messages ()
"Send all the sendable drafts."
(cons (or gnus-last-posting-server "") 0))))
method-alist))))
;; Override normal method.
- ((eq gnus-post-method 'current)
+ ((and (eq gnus-post-method 'current)
+ (not arg))
group-method)
(gnus-post-method
gnus-post-method)
;; If we use dummy roots, then we have to remove the
;; dummy root as well.
(when (eq gnus-summary-make-false-root 'dummy)
+ ;; We go to the dummy root by going to
+ ;; the first sub-"thread", and then one line up.
+ (gnus-summary-goto-article
+ (mail-header-number (caadr thread)))
+ (forward-line -1)
(gnus-delete-line)
(gnus-data-compute-positions))
(setq thread (cdr thread))