Gnus development mailing list
 help / color / mirror / Atom feed
From: Rich Pieri <rich.pieri@PrescientTech.com>
Subject: Re: OffGnus
Date: 20 Jan 1997 10:17:39 -0500	[thread overview]
Message-ID: <x7vi8sml4c.fsf@gkar.asds.com> (raw)
In-Reply-To: Lars Magne Ingebrigtsen's message of 16 Jan 1997 02:10:57 +0100

-----BEGIN PGP SIGNED MESSAGE-----

>>>>> "LMI" == Lars Magne Ingebrigtsen <larsi@ifi.uio.no> writes:

LMI> 1)  inn+suck (or whatever) and pop.  That is, we set things up
LMI> properly and let other programs deal with how to shuffle things
LMI> to/from the net.

This also does not necessarilly work all that well on non-Unix machines
(Windows 95 and NT).

LMI> 2)  Using the cache.  This doesn't really work as well as it should,
LMI> since Gnus insists on trying to connect to the real server even most
LMI> of the articles are present in the cache.

Right now there are two or three mail queueing schemes out there.  The
one I am currently using, a wrapper for smtpmail, was recently posted to
gnu.emacs.sources.  It would be *really* nice to have something like
this for news.

LMI> 3)  nnsoup.  Using soup is quite fiddly, but it basically seems to
LMI> work.

Like #1, yes on Unix.  I have been demonstrably unsuccessful in getting
nnsoup to work on my Windows 95 machine, most probably due to the poor
handling of I/O streams in the console mode API.

[...]

LMI> So -- I propose writing a new backend for Gnus provide similar
LMI> functionality.  I don't know what to call it (nnoff?  nnoffline?  I
LMI> don't really like the word "offline".), but I'm sure that someone will
LMI> come up with a good name.  Right?

nntpol, since this will basically be nntp with off-line extensions.

I suggest a merger between nntp.el and nnml.el.  This "new" backend will
use nntp's code to slurp news from the server and nnml's code to store
and read it locally.  For outgoing mail we need smtpmail.el (which is
distributed with GNU Emacs, now) and smtpmail_delay (or smtpmailq, as I
prefer), which is a simpler setup than feedmail.  For outgoing news,
message-post-method (or whatever) should be pointed at a queueing
function, and then a "foo-post-queued-news-now" function (which can be
added to whatever desired exit hooks or invoked manually) which
processes the queue.

Here is a slightly modified version of smtpmailq.el:

; $Id: smtpmail_delay.el,v 1.3 1997/01/11 15:13:17 gko Exp $
; Georges KO gko@mail.net.tw

(require 'smtpmail)
(require 'mailalias)
(require 'time-stamp)

(defvar smtpmail-delay-popout-dir "~/Mail/queue/")
(defvar smtpmail-delay-popout-index-file "index")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar smtpmail-delay-popout-index (concat smtpmail-delay-popout-dir
					    smtpmail-delay-popout-index-file))

(defun smtpmail-queue-it ()
  "Hacked version of smtpmail-send-it: stores the message in a file in 
smtpmail-delay-popout-dir and updates smtpmail-delay-popout-index."
  (require 'mail-utils)
  (let ((errbuf (if mail-interactive
		    (generate-new-buffer " smtpmail errors")
		  0))
	(tembuf (generate-new-buffer " smtpmail temp"))
	(case-fold-search nil)
	resend-to-addresses
	delimline
	(mailbuf (current-buffer)))
    (unwind-protect
	(save-excursion
	  (set-buffer tembuf)
	  (erase-buffer)
	  (insert-buffer-substring mailbuf)
	  (goto-char (point-max))
	  ;; require one newline at the end.
	  (or (= (preceding-char) ?\n)
	      (insert ?\n))
	  ;; Change header-delimiter to be what sendmail expects.
	  (goto-char (point-min))
	  (re-search-forward
	    (concat "^" (regexp-quote mail-header-separator) "\n"))
	  (replace-match "\n")
	  (backward-char 1)
	  (setq delimline (point-marker))
;;	  (sendmail-synch-aliases)
	  (if mail-aliases
	      (expand-mail-aliases (point-min) delimline))
	  (goto-char (point-min))
	  ;; ignore any blank lines in the header
	  (while (and (re-search-forward "\n\n\n*" delimline t)
		      (< (point) delimline))
	    (replace-match "\n"))
	  (let ((case-fold-search t))
	    (goto-char (point-min))
	    (goto-char (point-min))
	    (while (re-search-forward "^Resent-to:" delimline t)
	      (setq resend-to-addresses
		    (save-restriction
		      (narrow-to-region (point)
					(save-excursion
					  (end-of-line)
					  (point)))
		      (append (mail-parse-comma-list)
			      resend-to-addresses))))
	    ;; Don't send out a blank subject line
	    (goto-char (point-min))
	    (if (re-search-forward "^Subject:[ \t]*\n" delimline t)
		(replace-match ""))
	    ;; Put the "From:" field in unless for some odd reason
	    ;; they put one in themselves.
	    (goto-char (point-min))
	    (if (not (re-search-forward "^From:" delimline t))
		(let* ((login user-mail-address)
		       (fullname (user-full-name)))
		  (cond ((eq mail-from-style 'angles)
			 (insert "From: " fullname)
			 (let ((fullname-start (+ (point-min) 6))
			       (fullname-end (point-marker)))
			   (goto-char fullname-start)
			   ;; Look for a character that cannot appear unquoted
			   ;; according to RFC 822.
			   (if (re-search-forward "[^- !#-'*+/-9=?A-Z^-~]"
						  fullname-end 1)
			       (progn
				 ;; Quote fullname, escaping specials.
				 (goto-char fullname-start)
				 (insert "\"")
				 (while (re-search-forward "[\"\\]"
							   fullname-end 1)
				   (replace-match "\\\\\\&" t))
				 (insert "\""))))
			 (insert " <" login ">\n"))
			((eq mail-from-style 'parens)
			 (insert "From: " login " (")
			 (let ((fullname-start (point)))
			   (insert fullname)
			   (let ((fullname-end (point-marker)))
			     (goto-char fullname-start)
			     ;; RFC 822 says \ and nonmatching parentheses
			     ;; must be escaped in comments.
			     ;; Escape every instance of ()\ ...
			     (while (re-search-forward "[()\\]" fullname-end 1)
			       (replace-match "\\\\\\&" t))
			     ;; ... then undo escaping of matching parentheses,
			     ;; including matching nested parentheses.
			     (goto-char fullname-start)
			     (while (re-search-forward 
				     "\\(\\=\\|[^\\]\\(\\\\\\\\\\)*\\)\\\\(\\(\\([^\\]\\|\\\\\\\\\\)*\\)\\\\)"
				     fullname-end 1)
			       (replace-match "\\1(\\3)" t)
			       (goto-char fullname-start))))
			 (insert ")\n"))
			((null mail-from-style)
			 (insert "From: " login "\n")))))
	    ;; Insert an extra newline if we need it to work around
	    ;; Sun's bug that swallows newlines.
	    (goto-char (1+ delimline))
	    (if (eval mail-mailer-swallows-blank-line)
		(newline))
	    ;; Find and handle any FCC fields.
	    (goto-char (point-min))
	    (if (re-search-forward "^FCC:" delimline t)
		(mail-do-fcc delimline))
	    (if mail-interactive
		(save-excursion
		  (set-buffer errbuf)
		  (erase-buffer))))
	  ;;
	  ;;
	  ;;
	  (setq smtpmail-address-buffer (generate-new-buffer "*smtp-mail*"))
	  (setq smtpmail-recipient-address-list
		(or resend-to-addresses
		    (smtpmail-deduce-address-list tembuf (point-min) delimline)))
	  (kill-buffer smtpmail-address-buffer)

	  (smtpmail-do-bcc delimline)
	  
	  ;;;;;;;;;;; Above is the same as smtpmail-send-it ;;;;;;;;;;;;;;;;

	  ;;; Put everything in queue
	  (let* ((file-data (concat 
			      smtpmail-delay-popout-dir
			      (time-stamp-strftime 
			       "%02y%02m%02d-%02H%02M%02S")))
		(file-elisp (concat file-data ".el"))
		(buffer-data (create-file-buffer file-data))
		(buffer-elisp (create-file-buffer file-elisp)))
	    (save-excursion
	      (set-buffer buffer-data)
	      (erase-buffer)
	      (insert-buffer tembuf)
	      (write-file file-data)
	      (set-buffer buffer-elisp)
	      (erase-buffer)
	      (insert (concat
		       "(setq smtpmail-recipient-address-list '"
		       (prin1-to-string smtpmail-recipient-address-list)
		       ")\n"))	    	    
	      (write-file file-elisp)
	      (set-buffer (generate-new-buffer "*popout*"))
	      (insert (concat file-data "\n"))
	      (append-to-file (point-min) 
			      (point-max) 
			      smtpmail-delay-popout-index)
	      ))))))

(defun smtpmail-send-queued-mail-now ()
  "Sends messages queued by smtpmail-queue-it."
  (interactive)
  ;;; Get index, take first file, send message, take second file, etc...
  (let ((buffer-index (find-file-noselect smtpmail-delay-popout-index))
	(file-msg "")
	(tembuf nil))
    (save-excursion
      (set-buffer buffer-index)
      (beginning-of-buffer)
      (while (not (eobp))
	(setq file-msg (buffer-substring (point) (save-excursion
						   (end-of-line)
						   (point))))
	(load file-msg)
	(setq tembuf (find-file-noselect file-msg))
	(if (not (null smtpmail-recipient-address-list))
	    (if (not (smtpmail-via-smtp smtpmail-recipient-address-list 
					tembuf))
		(error "Sending failed; SMTP protocol error"))
	  (error "Sending failed; no recipients"))  
	(delete-file file-msg)
	(delete-file (concat file-msg ".el"))
	(kill-buffer tembuf)
	(kill-line 1))      
      (set-buffer buffer-index)
      (save-buffer smtpmail-delay-popout-index)
      )))

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3a
Charset: noconv

iQCVAwUBMuOMmJ6VRH7BJMxHAQEt6QP/SIU6b5bxNiUQlExiLNJhcNQjl/tc2oPy
fxLuFuPqmbxBJ5NB2tIPCaNTjKwLP63XSdzxbwxPyInObgom9ydZ5h6ufu9yHWCl
a8VIowD+g6aUeR4Ie17ULYHOqtTD1NPOFl+gwIRS1mAoxWsM9NtOg2yIa2VFpXOp
/oahHisP5mw=
=+InJ
-----END PGP SIGNATURE-----
-- 
Rich Pieri <rich.pieri@prescienttech.com> | Do not taunt Happy Fun Ball.
Prescient Technologies, Inc.              | 
A Stone & Webster Company                 | 
I speak for myself, not PTI or SWEC       | 


  reply	other threads:[~1997-01-20 15:17 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-01-16  1:10 OffGnus Lars Magne Ingebrigtsen
1997-01-20 15:17 ` Rich Pieri [this message]
1997-01-20 19:24   ` OffGnus Rich Pieri
1997-01-21  8:38     ` OffGnus Lars Magne Ingebrigtsen
1997-01-20 19:29   ` OffGnus Rich Pieri
1997-01-21  8:39     ` OffGnus Lars Magne Ingebrigtsen
1997-01-21 15:07       ` OffGnus Rich Pieri
1997-01-21 20:27         ` OffGnus Lars Magne Ingebrigtsen
1997-01-21 22:47           ` OffGnus Rich Pieri
1997-01-21 23:14             ` OffGnus Lars Magne Ingebrigtsen
1997-01-22 15:12               ` OffGnus Rich Pieri
1997-01-23  2:50                 ` OffGnus Lars Magne Ingebrigtsen
1997-01-23  5:29                   ` OffGnus David Moore
1997-01-23  9:19                     ` OffGnus Lars Magne Ingebrigtsen
1997-01-23 17:03                   ` OffGnus Rich Pieri
1997-01-24  9:25                     ` OffGnus Lars Magne Ingebrigtsen
1997-01-24 13:57                       ` OffGnus Rich Pieri
1997-01-24 21:03                         ` OffGnus Per Abrahamsen
1997-01-21 10:21     ` OffGnus dave edmondson
1997-01-21  8:37   ` OffGnus Lars Magne Ingebrigtsen
1997-01-21 15:26     ` OffGnus Rich Pieri
1997-01-21 22:52       ` OffGnus Lars Magne Ingebrigtsen
1997-01-22 15:24         ` OffGnus Rich Pieri
1997-01-22 16:44           ` OffGnus Justin Sheehy
1997-01-22 20:28             ` OffGnus Rich Pieri
1997-01-23  2:53           ` OffGnus Lars Magne Ingebrigtsen
1997-01-23 17:12             ` OffGnus Rich Pieri
1997-01-24  9:28               ` OffGnus Lars Magne Ingebrigtsen
1997-01-22 12:59 ` OffGnus Kai Grossjohann
1997-01-23  0:46   ` OffGnus Patrick Audley
1997-01-23  2:45   ` OffGnus Lars Magne Ingebrigtsen
1997-01-25 10:17     ` OffGnus Darren/Torin/Who Ever...
1997-01-23  5:14 OffGnus St. Suika Fenderson Roberts
1997-01-23 17:19 ` OffGnus Rich Pieri

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=x7vi8sml4c.fsf@gkar.asds.com \
    --to=rich.pieri@prescienttech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).