- (gnus-activate-group "nndraft:queue")
- (save-excursion
- (let ((articles (nndraft-articles))
- (unsendable (gnus-uncompress-range
- (cdr (assq 'unsend
- (gnus-info-marks
- (gnus-get-info "nndraft:queue"))))))
- article)
- (while (setq article (pop articles))
- (unless (memq article unsendable)
- (gnus-draft-send article))))))
+ (when (or gnus-plugged
+ (not gnus-agent-prompt-send-queue)
+ (gnus-y-or-n-p "Gnus is unplugged; really send queue? "))
+ (gnus-activate-group "nndraft:queue")
+ (save-excursion
+ (let* ((articles (nndraft-articles))
+ (unsendable (gnus-uncompress-range
+ (cdr (assq 'unsend
+ (gnus-info-marks
+ (gnus-get-info "nndraft:queue"))))))
+ (gnus-posting-styles nil)
+ message-send-mail-partially-limit
+ (total (length articles))
+ article)
+ (while (setq article (pop articles))
+ (unless (memq article unsendable)
+ (let ((message-sending-message
+ (format "Sending message %d of %d..."
+ (- total (length articles)) total)))
+ (gnus-draft-send article))))))))
+
+;;;###autoload
+(defun gnus-draft-reminder ()
+ "Reminder user if there are unsent drafts."
+ (interactive)
+ (if (gnus-alive-p)
+ (let (active)
+ (catch 'continue
+ (dolist (group '("nndraft:drafts" "nndraft:queue"))
+ (setq active (gnus-activate-group group))
+ (if (and active (>= (cdr active) (car active)))
+ (if (y-or-n-p "There are unsent drafts. Confirm to exit? ")
+ (throw 'continue t)
+ (error "Stop!"))))))))
+
+(defcustom gnus-draft-setup-hook nil
+ "Hook run after setting up a draft buffer."
+ :group 'gnus-message
+ :version "23.1" ;; No Gnus
+ :type 'hook)