annotate lisp/nndb.el @ 19156:2bd381f7e297

(standard-display-cyrillic-translit): Set standard-display-table here, not when loading the file. Read argument properly with `interactive'.
author Richard M. Stallman <rms@gnu.org>
date Tue, 05 Aug 1997 05:00:55 +0000
parents 47d9b7a1dee3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15512
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1 ;;; nndb.el --- nndb access for Gnus
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
2 ;; Copyright (C) 1996 Free Software Foundation, Inc.
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
3
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
4 ;; Author: Kai Grossjohann <grossjohann@ls6.informatik.uni-dortmund.de>
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
5 ;; Keywords: news
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
6
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
8
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
12 ;; any later version.
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
13
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
17 ;; GNU General Public License for more details.
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
18
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
22 ;; Boston, MA 02111-1307, USA.
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
23
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
24 ;;; Commentary:
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
25
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
26 ;; I have shamelessly snarfed the code of nntp.el from sgnus.
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
27 ;; Kai
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
28
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
29
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
30 ;;-
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
31 ;; Register nndb with known select methods.
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
32
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
33 (setq gnus-valid-select-methods
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
34 (cons '("nndb" mail address respool prompt-address)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
35 gnus-valid-select-methods))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
36
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
37
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
38 ;;; Code:
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
39
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
40 (require 'nnheader)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
41 (require 'nntp)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
42 (eval-when-compile (require 'cl))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
43
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
44 (eval-and-compile
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
45 (unless (fboundp 'open-network-stream)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
46 (require 'tcp)))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
47
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
48 (eval-when-compile (require 'cl))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
49
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
50 (eval-and-compile
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
51 (autoload 'news-setup "rnewspost")
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
52 (autoload 'news-reply-mode "rnewspost")
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
53 (autoload 'cancel-timer "timer")
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
54 (autoload 'telnet "telnet" nil t)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
55 (autoload 'telnet-send-input "telnet" nil t)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
56 (autoload 'timezone-parse-date "timezone"))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
57
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
58 ;; Declare nndb as derived from nntp
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
59
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
60 (nnoo-declare nndb nntp)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
61
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
62 ;; Variables specific to nndb
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
63
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
64 ;;- currently not used but just in case...
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
65 (defvoo nndb-deliver-program "nndel"
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
66 "*The program used to put a message in an NNDB group.")
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
67
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
68 ;; Variables copied from nntp
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
69
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
70 (defvoo nndb-server-opened-hook '(nntp-send-authinfo-from-file)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
71 "Like nntp-server-opened-hook."
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
72 nntp-server-opened-hook)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
73
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
74 ;(defvoo nndb-rlogin-parameters '("telnet" "${NNDBSERVER:=localhost}" "9000")
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
75 ; "*Parameters to nndb-open-login. Like nntp-rlogin-parameters."
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
76 ; nntp-rlogin-parameters)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
77
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
78 ;(defvoo nndb-rlogin-user-name nil
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
79 ; "*User name for rlogin connect method."
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
80 ; nntp-rlogin-user-name)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
81
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
82 (defvoo nndb-address "localhost"
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
83 "*The name of the NNDB server."
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
84 nntp-address)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
85
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
86 (defvoo nndb-port-number 9000
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
87 "*Port number to connect to."
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
88 nntp-port-number)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
89
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
90 ;(defvoo nndb-current-group ""
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
91 ; "Like nntp-current-group."
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
92 ; nntp-current-group)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
93
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
94 (defvoo nndb-status-string nil "" nntp-status-string)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
95
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
96
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
97
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
98 (defconst nndb-version "nndb 0.3"
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
99 "Version numbers of this version of NNDB.")
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
100
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
101
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
102 ;;; Interface functions.
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
103
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
104 (nnoo-define-basics nndb)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
105
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
106 ;; Import other stuff from nntp as is.
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
107
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
108 (nnoo-import nndb
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
109 (nntp))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
110
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
111 ;;- maybe this should be mail??
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
112 ;;-(defun nndb-request-type (group &optional article)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
113 ;;- 'news)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
114
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
115 ;;------------------------------------------------------------------
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
116 ;;- only new stuff below
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
117
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
118 ; nndb-request-update-info does not exist and is not needed
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
119
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
120 ; nndb-request-update-mark does not exist and is not needed
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
121
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
122 ; nndb-request-scan does not exist
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
123 ; get new mail from somewhere -- maybe this is not needed?
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
124 ; --> todo
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
125
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
126 (deffoo nndb-request-create-group (group &optional server)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
127 "Creates a group if it doesn't exist yet."
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
128 (nntp-send-command "^[23].*\n" "MKGROUP" group))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
129
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
130 ; todo -- use some other time than the creation time of the article
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
131 ; best is time since article has been marked as expirable
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
132 (deffoo nndb-request-expire-articles
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
133 (articles &optional group server force)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
134 "Expires ARTICLES from GROUP on SERVER.
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
135 If FORCE, delete regardless of exiration date, otherwise use normal
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
136 expiry mechanism."
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
137 (let (msg art)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
138 (nntp-possibly-change-server group server) ;;-
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
139 (while articles
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
140 (setq art (pop articles))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
141 (nntp-send-command "^\\([23]\\|^423\\).*\n" "DATE" art)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
142 (setq msg (nndb-status-message))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
143 ;; CCC we shouldn't be using the variable nndb-status-string?
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
144 (if (string-match "^423" (nnheader-get-report 'nndb))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
145 ()
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
146 (or (string-match "\\([0-9]+\\) \\([0-9]+\\)$" msg)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
147 (error "Not a valid response for DATE command: %s"
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
148 msg))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
149 (if (nnmail-expired-article-p
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
150 group
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
151 (list (string-to-int
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
152 (substring msg (match-beginning 1) (match-end 1)))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
153 (string-to-int
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
154 (substring msg (match-beginning 2) (match-end 2))))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
155 force)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
156 (nnheader-message 5 "Deleting article %s in %s..."
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
157 art group)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
158 (nntp-send-command "^[23].*\n" "DELETE" art))))))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
159
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
160 (deffoo nndb-request-move-article
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
161 (article group server accept-form &optional last)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
162 "Move ARTICLE (a number) from GROUP on SERVER.
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
163 Evals ACCEPT-FORM in current buffer, where the article is.
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
164 Optional LAST is ignored."
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
165 (let ((artbuf (get-buffer-create " *nndb move*"))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
166 result)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
167 (and
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
168 (nndb-request-article article group server artbuf)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
169 (save-excursion
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
170 (set-buffer artbuf)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
171 (setq result (eval accept-form))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
172 (kill-buffer (current-buffer))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
173 result)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
174 (nndb-request-expire-articles (list article)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
175 group
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
176 server
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
177 t))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
178 result))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
179
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
180 (deffoo nndb-request-accept-article (group server &optional last)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
181 "The article in the current buffer is put into GROUP."
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
182 (nntp-possibly-change-server group server) ;;-
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
183 (let (art statmsg)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
184 (when (nntp-send-command "^[23].*\r?\n" "ACCEPT" group)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
185 (nnheader-insert "")
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
186 (nntp-encode-text)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
187 (nntp-send-region-to-server (point-min) (point-max))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
188 ;; 1.2a NNTP's post command is buggy. "^M" (\r) is not
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
189 ;; appended to end of the status message.
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
190 (nntp-wait-for-response "^[23].*\n")
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
191 (setq statmsg (nntp-status-message))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
192 (or (string-match "^\\([0-9]+\\)" statmsg)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
193 (error "nndb: %s" statmsg))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
194 (setq art (substring statmsg
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
195 (match-beginning 1)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
196 (match-end 1)))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
197 (message "nndb: accepted %s" art)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
198 (list art))))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
199
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
200 (deffoo nndb-request-replace-article (article group buffer)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
201 "ARTICLE is the number of the article in GROUP to be replaced
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
202 with the contents of the BUFFER."
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
203 (set-buffer buffer)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
204 (let (art statmsg)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
205 (when (nntp-send-command "^[23].*\r?\n" "REPLACE" (int-to-string article))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
206 (nnheader-insert "")
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
207 (nntp-encode-text)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
208 (nntp-send-region-to-server (point-min) (point-max))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
209 ;; 1.2a NNTP's post command is buggy. "^M" (\r) is not
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
210 ;; appended to end of the status message.
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
211 (nntp-wait-for-response "^[23].*\n")
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
212 ; (setq statmsg (nntp-status-message))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
213 ; (or (string-match "^\\([0-9]+\\)" statmsg)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
214 ; (error "nndb: %s" statmsg))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
215 ; (setq art (substring statmsg
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
216 ; (match-beginning 1)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
217 ; (match-end 1)))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
218 ; (message "nndb: replaced %s" art)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
219 (list (int-to-string article)))))
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
220
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
221 ; nndb-request-delete-group does not exist
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
222 ; todo -- maybe later
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
223
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
224 ; nndb-request-rename-group does not exist
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
225 ; todo -- maybe later
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
226
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
227 (provide 'nndb)
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
228
47d9b7a1dee3 Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
229