From: richard@harlqn.co.uk (Richard Brooksby)
Subject: Re: Posting via inews-program
Organization: Harlequin Ltd. Cambridge, England
Date: Wed, 11 Nov 1992 10:37:29 GMT

mahue@linguistik.uni-erlangen.de (Marc Huesken) wrote:

> Because our nntp-news-server only accepts articles posted with a
> special version of the inews-program (our news-admin says it has
> additional security-checks ???) I'd like to tell GNUS to pass the
> article to this program instead of using its own nntp-connection.
> Is this possible?

For some reason posting via NNTP at our site is extremely slow.  I
hacked up this little piece of Emacs to help solve this problem.  It
fires up an inews sub-process and then pipes the article to it without
waiting for it to exit.  When the process does exit it pops up a
window with the output in it.

It's nasty, but you may be able to do something with it.  I don't
really have time to write a proper version at the moment.  You may be
able to make something of it.

;; Append a number to a buffer name to make it unique.  Optional
;; second parameter means always attach a number.
(defun new-buffer-name (name &optional always)
  (let ((numbered-name (if always (format "%s<1>" name) name))
	(number 1))
    (while (get-buffer numbered-name)
      (setq numbered-name
	    (format "%s<%d>" name (setq number (1+ number)))))
    numbered-name))

;; Post an article the quick way.
(defun news-inews-offline ()
  (interactive)
  (require 'mail-utils)
  (save-restriction
    (save-excursion
      (let* ((newsgroups (mail-fetch-field "newsgroups" nil t))
	     (subject (mail-fetch-field "subject" nil t))
	     (desc (concat "Newsgroups: " (or newsgroups "?")
			   "\nSubject: " (or subject "?")
			   "\n"))
	     (buffer (get-buffer-create "*prepared article*"))
	     (inews  (start-process "inews" nil "rsh" "piaget" "/usr/lib/news/inews" "-h")))
; *** You'll need to change this, certainly      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	(rename-buffer (if (or (null newsgroups) (string= newsgroups ""))
			   (new-buffer-name "*post*" t)
			 (new-buffer-name (format "*post to %s*" newsgroups))))
	(set-process-filter inews
	  (eval (` (function (lambda (inews string)
			       (switch-to-buffer-other-window (get-buffer-create "*inews report*"))
			       (insert (, desc) string "---\n")
			       (other-window 1))))))
	(set-process-sentinel inews
	  (eval (` (function (lambda (inews msg)
			       (switch-to-buffer-other-window (get-buffer-create "*inews report*"))
			       (insert (, desc) msg "---\n")
			       (other-window 1))))))
	(widen)
	(copy-to-buffer buffer (point-min) (point-max))
	(set-buffer-modified-p nil)
	(switch-to-buffer buffer)
	(goto-char (point-min))
	(run-hooks 'news-inews-hook)
	(search-forward (concat "\n" mail-header-separator "\n"))
	(replace-match (format "\nLines: %d\n\n" (count-lines (point) (point-max))))
	(goto-char (point-max))
	(if (not (looking-at "^$")) (insert ?\n))
	(process-send-region inews (point-min) (point-max))
	(process-send-eof inews)
	(message "Article sent to inews.")
	(kill-buffer buffer))))
  (if (fboundp 'bury-buffer) (bury-buffer))
  (and gnus-winconf-post-news
       (set-window-configuration gnus-winconf-post-news))
  (setq gnus-winconf-post-news nil))

(setq news-setup-hook
      (cons '(lambda ()
	       (define-key news-reply-mode-map "\C-c\C-c" 'news-inews-offline))
	    news-setup-hook))
---
richard@harlqn.co.uk              (Internet)
RPTB1@UK.AC.CAMBRIDGE.PHOENIX     (JANET)
Newsgroups: gnu.emacs.gnus