gnus-art.el (gnus-mime-delete-part): Fix mm-handle-filename usage.
[gnus] / lisp / nngateway.el
1 ;;; nngateway.el --- posting news via mail gateways
2
3 ;; Copyright (C) 1996-2011 Free Software Foundation, Inc.
4
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6 ;; Keywords: news, mail
7
8 ;; This file is part of GNU Emacs.
9
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
14
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
22
23 ;;; Commentary:
24
25 ;;; Code:
26
27 (eval-when-compile (require 'cl))
28 (require 'nnoo)
29 (require 'message)
30
31 (nnoo-declare nngateway)
32
33 (defvoo nngateway-address nil
34   "Address of the mail-to-news gateway.")
35
36 (defvoo nngateway-header-transformation 'nngateway-simple-header-transformation
37   "Function to be called to rewrite the news headers into mail headers.
38 It is called narrowed to the headers to be transformed with one
39 parameter -- the gateway address.")
40
41 ;;; Interface functions
42
43 (nnoo-define-basics nngateway)
44
45 (deffoo nngateway-open-server (server &optional defs)
46   (if (nngateway-server-opened server)
47       t
48     (unless (assq 'nngateway-address defs)
49       (setq defs (append defs (list (list 'nngateway-address server)))))
50     (nnoo-change-server 'nngateway server defs)))
51
52 (deffoo nngateway-request-post (&optional server)
53   (when (or (nngateway-server-opened server)
54             (nngateway-open-server server))
55     ;; Rewrite the header.
56     (let ((buf (current-buffer)))
57       (with-temp-buffer
58         (insert-buffer-substring buf)
59         (message-narrow-to-head)
60        &nb