- (gnus-activate-group group)
- (while (setq article (pop articles))
- (gnus-request-head article group)
- (set-buffer nntp-server-buffer)
- (goto-char (point-min))
- (if (re-search-forward
- (concat "^" (regexp-quote gnus-delay-header) ":\\s-+")
- nil t)
- (progn
- (setq deadline (nnheader-header-value))
- (setq deadline (apply 'encode-time (parse-time-string deadline)))
- (setq deadline (time-since deadline))
- (when (time-less-p (apply 'encode-time
- (parse-time-string deadline))
- (current-time))
- (message "Sending article %d" article)
- (gnus-draft-send article group)
- (message "Sending article %d...done" article)))
- (message "Delay header missing for article %d" article))))))
+ (when (gnus-group-entry group)
+ (gnus-activate-group group)
+ (add-hook 'message-send-hook
+ '(lambda ()
+ (message-remove-header gnus-delay-header)))
+ (setq articles (nndraft-articles))
+ (while (setq article (pop articles))
+ (gnus-request-head article group)
+ (set-buffer nntp-server-buffer)
+ (goto-char (point-min))
+ (if (re-search-forward
+ (concat "^" (regexp-quote gnus-delay-header) ":\\s-+")
+ nil t)
+ (progn
+ (setq deadline (nnheader-header-value))
+ (setq deadline (apply 'encode-time
+ (parse-time-string deadline)))
+ (setq deadline (time-since deadline))
+ (when (and (>= (nth 0 deadline) 0)
+ (>= (nth 1 deadline) 0))
+ (message "Sending delayed article %d" article)
+ (gnus-draft-send article group)
+ (message "Sending delayed article %d...done" article)))
+ (message "Delay header missing for article %d" article)))))))