annotate lisp/gnus/nngateway.el @ 164:4e0740e5aab2

Added tag r20-3b8 for changeset 0132846995bd
author cvs
date Mon, 13 Aug 2007 09:43:39 +0200
parents ec9a17fef872
children 15872534500d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
1 ;;; nngateway.el --- posting news via mail gateways
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
2 ;; Copyright (C) 1996,97 Free Software Foundation, Inc.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
3
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
5 ;; Keywords: news, mail
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
6
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
8
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
12 ;; any later version.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
13
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
17 ;; GNU General Public License for more details.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
18
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
22 ;; Boston, MA 02111-1307, USA.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
23
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
24 ;;; Commentary:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
25
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
26 ;;; Code:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
27
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
28 (require 'nnoo)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
29 (require 'message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
30
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
31 (nnoo-declare nngateway)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
32
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
33 (defvoo nngateway-address nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
34 "Address of the mail-to-news gateway.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
35
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
36 (defvoo nngateway-header-transformation 'nngateway-simple-header-transformation
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
37 "Function to be called to rewrite the news headers into mail headers.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
38 It is called narrowed to the headers to be transformed with one
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
39 parameter -- the gateway address.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
40
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
41 ;;; Interface functions
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
42
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
43 (nnoo-define-basics nngateway)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
44
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
45 (deffoo nngateway-open-server (server &optional defs)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
46 (if (nngateway-server-opened server)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
47 t
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
48 (unless (assq 'nngateway-address defs)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
49 (setq defs (append defs (list (list 'nngateway-address server)))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
50 (nnoo-change-server 'nngateway server defs)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
51
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
52 (deffoo nngateway-request-post (&optional server)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
53 (when (or (nngateway-server-opened server)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
54 (nngateway-open-server server))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
55 ;; Rewrite the header.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
56 (let ((buf (current-buffer)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
57 (nnheader-temp-write nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
58 (insert-buffer-substring buf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
59 (message-narrow-to-head)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
60 (funcall nngateway-header-transformation nngateway-address)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
61 (widen)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
62 (let (message-required-mail-headers)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
63 (message-send-mail))))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
64
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
65 ;;; Internal functions
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
66
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
67 (defun nngateway-simple-header-transformation (gateway)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
68 "Transform the headers to use GATEWAY."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
69 (let ((newsgroups (mail-fetch-field "newsgroups")))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
70 (message-remove-header "to")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
71 (message-remove-header "cc")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
72 (goto-char (point-min))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
73 (insert "To: " (nnheader-replace-chars-in-string newsgroups ?. ?-)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
74 "@" gateway "\n")))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
75
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
76 (nnoo-define-skeleton nngateway)
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
77
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
78 (provide 'nngateway)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
79
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
80 ;;; nngateway.el ends here