Mercurial > emacs
annotate lisp/gnus/webmail.el @ 64321:18dde5f76662
(pitx): Fix output format. Print string charpos.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Thu, 14 Jul 2005 11:30:35 +0000 |
parents | 18a818a2ee7c |
children | fafd692d1e40 f9a65d7ebd29 |
rev | line source |
---|---|
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
1 ;;; webmail.el --- interface of web mail |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
2 ;; Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. |
31717 | 3 |
4 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu> | |
5 ;; Keywords: hotmail netaddress my-deja netscape | |
6 | |
7 ;; This file is part of GNU Emacs. | |
8 | |
9 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
10 ;; it under the terms of the GNU General Public License as published | |
11 ;; by the Free Software Foundation; either version 2, or (at your | |
12 ;; option) any later version. | |
13 | |
14 ;; GNU Emacs is distributed in the hope that it will be useful, but | |
15 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 ;; General Public License for more details. | |
18 | |
19 ;; You should have received a copy of the GNU General Public License | |
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64085 | 21 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
22 ;; Boston, MA 02110-1301, USA. | |
31717 | 23 |
24 ;;; Commentary: | |
25 | |
26 ;; Note: Now mail.yahoo.com provides POP3 service, the webmail | |
27 ;; fetching is not going to be supported. | |
28 | |
29 ;; Note: You need to have `url' and `w3' installed for this backend to | |
30 ;; work. `w3' must be 4.0pre46+one-line-cookie patch or standalone | |
31 ;; `url'. | |
32 | |
33 ;; Todo: To support more web mail servers. | |
34 | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
35 ;; Known bugs: |
31717 | 36 ;; 1. Net@ddress may corrupt `X-Face'. |
37 | |
38 ;; Warning: | |
39 ;; Webmail is an experimental function, which means NO WARRANTY. | |
40 | |
41 ;;; Code: | |
42 | |
43 (eval-when-compile (require 'cl)) | |
44 | |
45 (require 'nnoo) | |
46 (require 'message) | |
47 (require 'gnus-util) | |
48 (require 'gnus) | |
49 (require 'nnmail) | |
50 (require 'mm-util) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
51 (require 'mm-url) |
31717 | 52 (require 'mml) |
53 (eval-when-compile | |
54 (ignore-errors | |
55 (require 'url) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
56 (require 'url-cookie))) |
31717 | 57 ;; Report failure to find w3 at load time if appropriate. |
58 (eval '(progn | |
59 (require 'url) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
60 (require 'url-cookie))) |
31717 | 61 |
62 ;;; | |
63 | |
64 (defvar webmail-type-definition | |
65 '((hotmail | |
66 ;; Hotmail hate other HTTP user agents and use one line cookie | |
67 (paranoid agent cookie post) | |
68 (address . "www.hotmail.com") | |
69 (open-url "http://www.hotmail.com/") | |
70 (open-snarf . webmail-hotmail-open) | |
71 ;; W3 hate redirect POST | |
72 (login-url | |
73 "http://%s/cgi-bin/dologin?login=%s&passwd=%s&enter=Sign+in&sec=no&curmbox=ACTIVE&_lang=&js=yes&id=2&tw=-10000&beta=" | |
74 webmail-aux user password) | |
75 ;;(login-snarf . webmail-hotmail-login) | |
76 ;;(list-url "%s" webmail-aux) | |
77 (list-snarf . webmail-hotmail-list) | |
78 (article-snarf . webmail-hotmail-article) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
79 (trash-url |
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
80 "%s&login=%s&f=33792&curmbox=ACTIVE&_lang=&foo=inbox&js=&page=&%s=on&_HMaction=MoveTo&tobox=trAsH&nullbox=" |
31717 | 81 webmail-aux user id)) |
82 (yahoo | |
83 (paranoid agent cookie post) | |
84 (address . "mail.yahoo.com") | |
85 (open-url "http://mail.yahoo.com/") | |
86 (open-snarf . webmail-yahoo-open) | |
87 (login-url;; yahoo will not accept GET | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
88 content |
31717 | 89 ("%s" webmail-aux) |
90 ".tries=&.src=ym&.last=&promo=&.intl=&.bypass=&.partner=&.chkP=Y&.done=&login=%s&passwd=%s" | |
91 user password) | |
92 (login-snarf . webmail-yahoo-login) | |
93 (list-url "%s&rb=Inbox&YN=1" webmail-aux) | |
94 (list-snarf . webmail-yahoo-list) | |
95 (article-snarf . webmail-yahoo-article) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
96 (trash-url |
31717 | 97 "%s/ym/ShowFolder?YY=52107&inc=50&order=down&sort=date&pos=0&box=Inbox&DEL=Delete&destBox=&Mid=%s&destBox2=" |
98 webmail-aux id)) | |
99 (netaddress | |
100 (paranoid cookie post) | |
101 (address . "www.netaddress.com") | |
102 (open-url "http://www.netaddress.com/") | |
103 (open-snarf . webmail-netaddress-open) | |
104 (login-url | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
105 content |
31717 | 106 ("%s" webmail-aux) |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
107 "LoginState=2&SuccessfulLogin=%%2Ftpl&NewServerName=www.netaddress.com&JavaScript=JavaScript1.2&DomainID=4&Domain=usa.net&NA31site=classic.netaddress.com&NA31port=80&UserID=%s&passwd=%s" |
31717 | 108 user password) |
109 (login-snarf . webmail-netaddress-login) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
110 (list-url |
31717 | 111 "http://www.netaddress.com/tpl/Mail/%s/List?FolderID=-4&SortUseCase=True" |
112 webmail-session) | |
113 (list-snarf . webmail-netaddress-list) | |
114 (article-url "http://www.netaddress.com/") | |
115 (article-snarf . webmail-netaddress-article) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
116 (trash-url |
31717 | 117 "http://www.netaddress.com/tpl/Message/%s/Move?FolderID=-4&Q=%s&N=&Sort=Date&F=-1" |
118 webmail-session id)) | |
119 (netscape | |
120 (paranoid cookie post agent) | |
121 (address . "webmail.netscape.com") | |
122 (open-url "http://ureg.netscape.com/iiop/UReg2/login/login?U2_LA=en&U2_BACK_FROM_CJ=true&U2_CS=iso-8859-1&U2_ENDURL=http://webmail.netscape.com/tpl/Subscribe/Step1&U2_NEW_ENDURL=http://webmail.netscape.com/tpl/Subscribe/Step1&U2_EXITURL=http://home.netscape.com/&U2_SOURCE=Webmail") | |
123 (open-snarf . webmail-netscape-open) | |
124 (login-url | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
125 content |
31717 | 126 ("http://ureg.netscape.com/iiop/UReg2/login/loginform") |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
127 "U2_USERNAME=%s&U2_PASSWORD=%s%s" |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
128 user password webmail-aux) |
31717 | 129 (login-snarf . webmail-netaddress-login) |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
130 (list-url |
31717 | 131 "http://webmail.netscape.com/tpl/Mail/%s/List?FolderID=-4&SortUseCase=True" |
132 webmail-session) | |
133 (list-snarf . webmail-netaddress-list) | |
134 (article-url "http://webmail.netscape.com/") | |
135 (article-snarf . webmail-netscape-article) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
136 (trash-url |
31717 | 137 "http://webmail.netscape.com/tpl/Message/%s/Move?FolderID=-4&Q=%s&N=&Sort=Date&F=-1" |
138 webmail-session id)) | |
139 (my-deja | |
140 (paranoid cookie post) | |
141 (address . "www.my-deja.com") | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
142 ;;(open-snarf . webmail-my-deja-open) |
31717 | 143 (login-url |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
144 content |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
145 ("http://mydeja.google.com/cgi-bin/deja/maillogin.py") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
146 "userid=%s&password=%s" |
31717 | 147 user password) |
148 (list-snarf . webmail-my-deja-list) | |
149 (article-snarf . webmail-my-deja-article) | |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
150 (trash-url webmail-aux id)))) |
31717 | 151 |
152 (defvar webmail-variables | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
153 '(address article-snarf article-url list-snarf list-url |
31717 | 154 login-url login-snarf open-url open-snarf site articles |
155 post-process paranoid trash-url)) | |
156 | |
157 (defconst webmail-version "webmail 1.0") | |
158 | |
159 (defvar webmail-newmail-only nil | |
160 "Only fetch new mails.") | |
161 | |
162 (defvar webmail-move-to-trash-can t | |
163 "Move mail to trash can after fetch it.") | |
164 | |
165 ;;; Internal variables | |
166 | |
167 (defvar webmail-address nil) | |
168 (defvar webmail-paranoid nil) | |
169 (defvar webmail-aux nil) | |
170 (defvar webmail-session nil) | |
171 (defvar webmail-article-snarf nil) | |
172 (defvar webmail-article-url nil) | |
173 (defvar webmail-list-snarf nil) | |
174 (defvar webmail-list-url nil) | |
175 (defvar webmail-login-url nil) | |
176 (defvar webmail-login-snarf nil) | |
177 (defvar webmail-open-snarf nil) | |
178 (defvar webmail-open-url nil) | |
179 (defvar webmail-trash-url nil) | |
180 (defvar webmail-articles nil) | |
181 (defvar webmail-post-process nil) | |
182 | |
183 (defvar webmail-buffer nil) | |
184 (defvar webmail-buffer-list nil) | |
185 | |
186 (defvar webmail-type nil) | |
187 | |
188 (defvar webmail-error-function nil) | |
189 | |
190 (defvar webmail-debug-file "~/.emacs-webmail-debug") | |
191 | |
192 ;;; Interface functions | |
193 | |
194 (defun webmail-debug (str) | |
195 (with-temp-buffer | |
196 (insert "\n---------------- A bug at " str " ------------------\n") | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
197 (mapcar #'(lambda (sym) |
31717 | 198 (if (boundp sym) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
199 (gnus-pp `(setq ,sym ',(eval sym))))) |
31717 | 200 '(webmail-type user)) |
201 (insert "---------------- webmail buffer ------------------\n\n") | |
202 (insert-buffer-substring webmail-buffer) | |
203 (insert "\n---------------- end of buffer ------------------\n\n") | |
204 (append-to-file (point-min) (point-max) webmail-debug-file))) | |
205 | |
206 (defun webmail-error (str) | |
207 (if webmail-error-function | |
208 (funcall webmail-error-function str)) | |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
209 (message "%s HTML has changed or your w3 package is too old.(%s)" |
31717 | 210 webmail-type str) |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
211 (error "%s HTML has changed or your w3 package is too old.(%s)" |
31717 | 212 webmail-type str)) |
213 | |
214 (defun webmail-setdefault (type) | |
215 (let ((type-def (cdr (assq type webmail-type-definition))) | |
216 (vars webmail-variables) | |
217 pair) | |
218 (setq webmail-type type) | |
219 (dolist (var vars) | |
220 (if (setq pair (assq var type-def)) | |
221 (set (intern (concat "webmail-" (symbol-name var))) (cdr pair)) | |
222 (set (intern (concat "webmail-" (symbol-name var))) nil))))) | |
223 | |
224 (defun webmail-eval (expr) | |
225 (cond | |
226 ((consp expr) | |
227 (cons (webmail-eval (car expr)) (webmail-eval (cdr expr)))) | |
228 ((symbolp expr) | |
229 (eval expr)) | |
230 (t | |
231 expr))) | |
232 | |
233 (defun webmail-url (xurl) | |
234 (mm-with-unibyte-current-buffer | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
235 (cond |
31717 | 236 ((eq (car xurl) 'content) |
237 (pop xurl) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
238 (mm-url-fetch-simple (if (stringp (car xurl)) |
31717 | 239 (car xurl) |
240 (apply 'format (webmail-eval (car xurl)))) | |
241 (apply 'format (webmail-eval (cdr xurl))))) | |
242 ((eq (car xurl) 'post) | |
243 (pop xurl) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
244 (mm-url-fetch-form (car xurl) (webmail-eval (cdr xurl)))) |
31717 | 245 (t |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
246 (mm-url-insert (apply 'format (webmail-eval xurl))))))) |
31717 | 247 |
248 (defun webmail-init () | |
249 "Initialize buffers and such." | |
250 (if (gnus-buffer-live-p webmail-buffer) | |
251 (set-buffer webmail-buffer) | |
252 (setq webmail-buffer | |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
253 (nnheader-set-temp-buffer " *webmail*")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
254 (mm-disable-multibyte))) |
31717 | 255 |
256 (defvar url-package-name) | |
257 (defvar url-package-version) | |
258 (defvar url-cookie-multiple-line) | |
259 (defvar url-confirmation-func) | |
260 | |
261 ;; Hack W3 POST redirect. See `url-parse-mime-headers'. | |
262 ;; | |
263 ;; Netscape uses "GET" as redirect method when orignal method is POST | |
264 ;; and status is 302, .i.e no security risks by default without | |
265 ;; confirmation. | |
266 ;; | |
267 ;; Some web servers (at least Apache used by yahoo) return status 302 | |
268 ;; instead of 303, though they mean 303. | |
269 | |
270 (defun webmail-url-confirmation-func (prompt) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
271 (cond |
31717 | 272 ((equal prompt (concat "Honor redirection with non-GET method " |
273 "(possible security risks)? ")) | |
274 nil) | |
275 ((equal prompt "Continue (with method of GET)? ") | |
276 t) | |
277 (t (error prompt)))) | |
278 | |
279 (defun webmail-refresh-redirect () | |
280 "Redirect refresh url in META." | |
281 (goto-char (point-min)) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
282 (while (re-search-forward |
31717 | 283 "<meta[ \t\r\n]*http-equiv=\"Refresh\"[^>]*URL=\\([^\"]+\\)\"" |
284 nil t) | |
285 (let ((url (match-string 1))) | |
286 (erase-buffer) | |
287 (mm-with-unibyte-current-buffer | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
288 (mm-url-insert url))) |
31717 | 289 (goto-char (point-min)))) |
290 | |
291 (defun webmail-fetch (file subtype user password) | |
292 (save-excursion | |
293 (webmail-setdefault subtype) | |
294 (let ((url-package-name (if (memq 'agent webmail-paranoid) | |
295 "Mozilla" | |
296 url-package-name)) | |
297 (url-package-version (if (memq 'agent webmail-paranoid) | |
298 "4.0" | |
299 url-package-version)) | |
300 (url-cookie-multiple-line (if (memq 'cookie webmail-paranoid) | |
301 nil | |
302 url-cookie-multiple-line)) | |
303 (url-confirmation-func (if (memq 'post webmail-paranoid) | |
304 'webmail-url-confirmation-func | |
305 url-confirmation-func)) | |
306 (url-http-silence-on-insecure-redirection t) | |
307 url-cookie-storage url-cookie-secure-storage | |
308 url-cookie-confirmation | |
309 item id (n 0)) | |
310 (webmail-init) | |
311 (setq webmail-articles nil) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
312 (when webmail-open-url |
31717 | 313 (erase-buffer) |
314 (webmail-url webmail-open-url)) | |
315 (if webmail-open-snarf (funcall webmail-open-snarf)) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
316 (when webmail-login-url |
31717 | 317 (erase-buffer) |
318 (webmail-url webmail-login-url)) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
319 (if webmail-login-snarf |
31717 | 320 (funcall webmail-login-snarf)) |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
321 (when webmail-list-url |
31717 | 322 (erase-buffer) |
323 (webmail-url webmail-list-url)) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
324 (if webmail-list-snarf |
31717 | 325 (funcall webmail-list-snarf)) |
326 (while (setq item (pop webmail-articles)) | |
327 (message "Fetching mail #%d..." (setq n (1+ n))) | |
328 (erase-buffer) | |
329 (mm-with-unibyte-current-buffer | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
330 (mm-url-insert (cdr item))) |
31717 | 331 (setq id (car item)) |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
332 (if webmail-article-snarf |
31717 | 333 (funcall webmail-article-snarf file id)) |
334 (when (and webmail-trash-url webmail-move-to-trash-can) | |
335 (message "Move mail #%d to trash can..." n) | |
336 (condition-case err | |
337 (progn | |
338 (webmail-url webmail-trash-url) | |
339 (let (buf) | |
340 (while (setq buf (pop webmail-buffer-list)) | |
341 (kill-buffer buf)))) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
342 (error |
31717 | 343 (let (buf) |
344 (while (setq buf (pop webmail-buffer-list)) | |
345 (kill-buffer buf))) | |
346 (error err)))))) | |
347 (if webmail-post-process | |
348 (funcall webmail-post-process)))) | |
349 | |
350 (defun webmail-encode-8bit () | |
351 (goto-char (point-min)) | |
352 (skip-chars-forward "^\200-\377") | |
353 (while (not (eobp)) | |
354 (insert (format "&%d;" (mm-char-int (char-after)))) | |
355 (delete-char 1) | |
356 (skip-chars-forward "^\200-\377"))) | |
357 | |
358 ;;; hotmail | |
359 | |
360 (defun webmail-hotmail-open () | |
361 (goto-char (point-min)) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
362 (if (re-search-forward |
31717 | 363 "action=\"https?://\\([^/]+\\)/cgi-bin/dologin" nil t) |
364 (setq webmail-aux (match-string 1)) | |
365 (webmail-error "open@1"))) | |
366 | |
367 (defun webmail-hotmail-login () | |
368 (let (site) | |
369 (goto-char (point-min)) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
370 (if (re-search-forward |
31717 | 371 "https?://\\([^/]+hotmail\\.msn\\.com\\)/cgi-bin/" nil t) |
372 (setq site (match-string 1)) | |
373 (webmail-error "login@1")) | |
374 (goto-char (point-min)) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
375 (if (re-search-forward |
31717 | 376 "\\(/cgi-bin/HoTMaiL\\?[^\"]*a=b[^\"]*\\)" nil t) |
377 (setq webmail-aux (concat "http://" site (match-string 1))) | |
378 (webmail-error "login@2")))) | |
379 | |
380 (defun webmail-hotmail-list () | |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
381 (goto-char (point-min)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
382 (skip-chars-forward " \t\n\r") |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
383 (let (site url newp (total "0")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
384 (if (eobp) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
385 (setq total "0") |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
386 (if (re-search-forward "\\([0-9]+\\) *<b>(\\([0-9]+\\) new)" nil t) |
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
387 (message "Found %s (%s new)" (setq total (match-string 1)) |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
388 (match-string 2)) |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
389 (if (re-search-forward "\\([0-9]+\\) new" nil t) |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
390 (message "Found %s new" (setq total (match-string 1))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
391 (webmail-error "list@0")))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
392 (unless (equal total "0") |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
393 (goto-char (point-min)) |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
394 (if (re-search-forward |
31717 | 395 "https?://\\([^/]+hotmail\\.msn\\.com\\)/cgi-bin/" nil t) |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
396 (setq site (match-string 1)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
397 (webmail-error "list@1")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
398 (goto-char (point-min)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
399 (if (re-search-forward "disk=\\([^&]*\\)&" nil t) |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
400 (setq webmail-aux |
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
401 (concat "http://" site "/cgi-bin/HoTMaiL?disk=" |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
402 (match-string 1))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
403 (webmail-error "list@2")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
404 (goto-char (point-max)) |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
405 (while (re-search-backward |
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
406 "newmail\\.gif\\|href=\"\\(/cgi-bin/getmsg\\?[^\"]+\\)\"" |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
407 nil t) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
408 (if (setq url (match-string 1)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
409 (progn |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
410 (if (or newp (not webmail-newmail-only)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
411 (let (id) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
412 (if (string-match "msg=\\([^&]+\\)" url) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
413 (setq id (match-string 1 url))) |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
414 (push (cons id (concat "http://" site url "&raw=0")) |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
415 webmail-articles))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
416 (setq newp nil)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
417 (setq newp t)))))) |
31717 | 418 |
419 ;; Thank victor@idaccr.org (Victor S. Miller) for raw=0 | |
420 | |
421 (defun webmail-hotmail-article (file id) | |
422 (goto-char (point-min)) | |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
423 (skip-chars-forward " \t\n\r") |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
424 (unless (eobp) |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
425 (if (not (search-forward "<pre>" nil t)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
426 (webmail-error "article@3")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
427 (skip-chars-forward "\n\r\t ") |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
428 (delete-region (point-min) (point)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
429 (if (not (search-forward "</pre>" nil t)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
430 (webmail-error "article@3.1")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
431 (delete-region (match-beginning 0) (point-max)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
432 (mm-url-remove-markup) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
433 (mm-url-decode-entities-nbsp) |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
434 (goto-char (point-min)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
435 (while (re-search-forward "\r\n?" nil t) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
436 (replace-match "\n")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
437 (goto-char (point-min)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
438 (insert "\n\n") |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
439 (if (not (looking-at "\n*From ")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
440 (insert "From nobody " (current-time-string) "\n") |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
441 (forward-line)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
442 (insert "X-Gnus-Webmail: " (symbol-value 'user) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
443 "@" (symbol-name webmail-type) "\n") |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
444 (mm-append-to-file (point-min) (point-max) file))) |
31717 | 445 |
446 (defun webmail-hotmail-article-old (file id) | |
447 (let (p attachment count mime hotmail-direct) | |
448 (save-restriction | |
449 (webmail-encode-8bit) | |
450 (goto-char (point-min)) | |
451 (if (not (search-forward "<DIV>" nil t)) | |
452 (if (not (search-forward "Reply All" nil t)) | |
453 (webmail-error "article@1") | |
454 (setq hotmail-direct t)) | |
455 (goto-char (match-beginning 0))) | |
456 (narrow-to-region (point-min) (point)) | |
457 (if (not (search-backward "<table" nil t 2)) | |
458 (webmail-error "article@1.1")) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
459 (delete-region (point-min) (match-beginning 0)) |
31717 | 460 (while (search-forward "<a href=" nil t) |
461 (setq p (match-beginning 0)) | |
462 (search-forward "</a>" nil t) | |
463 (delete-region p (match-end 0))) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
464 (mm-url-remove-markup) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
465 (mm-url-decode-entities-nbsp) |
31717 | 466 (goto-char (point-min)) |
467 (delete-blank-lines) | |
468 (goto-char (point-min)) | |
469 (when (search-forward "\n\n" nil t) | |
470 (backward-char) | |
471 (delete-region (point) (point-max))) | |
472 (goto-char (point-max)) | |
473 (widen) | |
474 (insert "\n") | |
475 (setq p (point)) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
476 (while (re-search-forward |
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
477 "<tt>\\|<div>\\|\\(http://[^/]+/cgi-bin/getmsg/\\([^\?]+\\)\?[^\"]*\\)\"" |
31717 | 478 nil t) |
479 (if (setq attachment (match-string 1)) | |
480 (let ((filename (match-string 2)) | |
481 bufname);; Attachment | |
482 (delete-region p (match-end 0)) | |
483 (save-excursion | |
484 (set-buffer (generate-new-buffer " *webmail-att*")) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
485 (mm-url-insert attachment) |
31717 | 486 (push (current-buffer) webmail-buffer-list) |
487 (setq bufname (buffer-name))) | |
488 (setq mime t) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
489 (insert "<#part type=" |
31717 | 490 (or (and filename |
491 (string-match "\\.[^\\.]+$" filename) | |
492 (mailcap-extension-to-mime | |
493 (match-string 0 filename))) | |
494 "application/octet-stream")) | |
495 (insert " buffer=\"" bufname "\"") | |
496 (insert " filename=\"" filename "\"") | |
497 (insert " disposition=\"inline\"") | |
498 (insert "><#/part>\n") | |
499 (setq p (point))) | |
500 (delete-region p (match-end 0)) | |
501 (if hotmail-direct | |
502 (if (not (search-forward "</tt>" nil t)) | |
503 (webmail-error "article@1.2") | |
504 (delete-region (match-beginning 0) (match-end 0))) | |
505 (setq count 1) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
506 (while (and (> count 0) |
31717 | 507 (re-search-forward "</div>\\|\\(<div>\\)" nil t)) |
508 (if (match-string 1) | |
509 (setq count (1+ count)) | |
510 (if (= (setq count (1- count)) 0) | |
511 (delete-region (match-beginning 0) | |
512 (match-end 0)))))) | |
513 (narrow-to-region p (point)) | |
514 (goto-char (point-min)) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
515 (cond |
31717 | 516 ((looking-at "<pre>") |
517 (goto-char (match-end 0)) | |
518 (if (looking-at "$") (forward-char)) | |
519 (delete-region (point-min) (point)) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
520 (mm-url-remove-markup) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
521 (mm-url-decode-entities-nbsp) |
31717 | 522 nil) |
523 (t | |
524 (setq mime t) | |
525 (insert "<#part type=\"text/html\" disposition=inline>") | |
526 (goto-char (point-max)) | |
527 (insert "<#/part>"))) | |
528 (goto-char (point-max)) | |
529 (setq p (point)) | |
530 (widen))) | |
531 (delete-region p (point-max)) | |
532 (goto-char (point-min)) | |
533 ;; Some blank line to seperate mails. | |
534 (insert "\n\nFrom nobody " (current-time-string) "\n") | |
535 (insert "X-Gnus-Webmail: " (symbol-value 'user) | |
536 "@" (symbol-name webmail-type) "\n") | |
537 (if id | |
538 (insert (format "X-Message-ID: <%s@hotmail.com>\n" id))) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
539 (unless (looking-at "$") |
31717 | 540 (if (search-forward "\n\n" nil t) |
541 (forward-line -1) | |
542 (webmail-error "article@2"))) | |
543 (narrow-to-region (point) (point-max)) | |
544 (if mime | |
545 (insert "MIME-Version: 1.0\n" | |
546 (prog1 | |
547 (mml-generate-mime) | |
548 (delete-region (point-min) (point-max))))) | |
549 (goto-char (point-min)) | |
550 (widen) | |
551 (let (case-fold-search) | |
552 (while (re-search-forward "^From " nil t) | |
553 (beginning-of-line) | |
554 (insert ">")))) | |
555 (mm-append-to-file (point-min) (point-max) file))) | |
556 | |
557 ;;; yahoo | |
558 | |
559 (defun webmail-yahoo-open () | |
560 (goto-char (point-min)) | |
561 (if (re-search-forward "action=\"\\([^\"]+\\)\"" nil t) | |
562 (setq webmail-aux (match-string 1)) | |
563 (webmail-error "open@1"))) | |
564 | |
565 (defun webmail-yahoo-login () | |
566 (goto-char (point-min)) | |
567 (if (re-search-forward "http://[^/]+[0-9]\\.mail\\.yahoo\\.com/" nil t) | |
568 (setq webmail-aux (match-string 0)) | |
569 (webmail-error "login@1")) | |
570 (if (re-search-forward "YY=[0-9]+" nil t) | |
571 (setq webmail-aux (concat webmail-aux "ym/ShowFolder?" | |
572 (match-string 0))) | |
573 (webmail-error "login@2"))) | |
574 | |
575 (defun webmail-yahoo-list () | |
576 (let (url (newp t) (tofetch 0)) | |
577 (goto-char (point-min)) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
578 (when (re-search-forward |
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
579 "showing [0-9]+-\\([0-9]+\\) of \\([0-9]+\\)" nil t) |
31717 | 580 ;;(setq listed (match-string 1)) |
581 (message "Found %s mail(s)" (match-string 2))) | |
582 (if (string-match "http://[^/]+" webmail-aux) | |
583 (setq webmail-aux (match-string 0 webmail-aux)) | |
584 (webmail-error "list@1")) | |
585 (goto-char (point-min)) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
586 (while (re-search-forward |
31717 | 587 "bgcolor=\"#eeeeee\"\\|href=\"\\(/ym/ShowLetter\\?MsgId=\\([^&]+\\)&[^\"]*\\)\"" |
588 nil t) | |
589 (if (setq url (match-string 1)) | |
590 (progn | |
591 (when (or newp (not webmail-newmail-only)) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
592 (push (cons (match-string 2) (concat webmail-aux url "&toc=1")) |
31717 | 593 webmail-articles) |
594 (setq tofetch (1+ tofetch))) | |
595 (setq newp t)) | |
596 (setq newp nil))) | |
597 (setq webmail-articles (nreverse webmail-articles)) | |
598 (message "Fetching %d mail(s)" tofetch))) | |
599 | |
600 (defun webmail-yahoo-article (file id) | |
601 (let (p attachment) | |
602 (save-restriction | |
603 (goto-char (point-min)) | |
604 (if (not (search-forward "value=\"Done\"" nil t)) | |
605 (webmail-error "article@1")) | |
606 (if (not (search-forward "<table" nil t)) | |
607 (webmail-error "article@2")) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
608 (delete-region (point-min) (match-beginning 0)) |
31717 | 609 (if (not (search-forward "</table>" nil t)) |
610 (webmail-error "article@3")) | |
611 (narrow-to-region (point-min) (match-end 0)) | |
612 (while (search-forward "<a href=" nil t) | |
613 (setq p (match-beginning 0)) | |
614 (search-forward "</a>" nil t) | |
615 (delete-region p (match-end 0))) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
616 (mm-url-remove-markup) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
617 (mm-url-decode-entities-nbsp) |
31717 | 618 (goto-char (point-min)) |
619 (delete-blank-lines) | |
620 (goto-char (point-max)) | |
621 (widen) | |
622 (insert "\n") | |
623 (setq p (point)) | |
624 (while (re-search-forward "[^\"]*/ShowLetter/[^\?]+\?[^\"]*" nil t) | |
625 (setq attachment (match-string 0)) | |
626 (let (bufname ct ctl cd description) | |
627 (if (not (search-forward "<table" nil t)) | |
628 (webmail-error "article@4")) | |
629 (delete-region p (match-beginning 0)) | |
630 (if (not (search-forward "</table>" nil t)) | |
631 (webmail-error "article@5")) | |
632 (narrow-to-region p (match-end 0)) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
633 (mm-url-remove-markup) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
634 (mm-url-decode-entities-nbsp) |
31717 | 635 (goto-char (point-min)) |
636 (delete-blank-lines) | |
637 (setq ct (mail-fetch-field "content-type") | |
638 ctl (ignore-errors (mail-header-parse-content-type ct)) | |
639 ;;cte (mail-fetch-field "content-transfer-encoding") | |
640 cd (mail-fetch-field "content-disposition") | |
641 description (mail-fetch-field "content-description") | |
642 id (mail-fetch-field "content-id")) | |
643 (delete-region (point-min) (point-max)) | |
644 (widen) | |
645 (save-excursion | |
646 (set-buffer (generate-new-buffer " *webmail-att*")) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
647 (mm-url-insert (concat webmail-aux attachment)) |
31717 | 648 (push (current-buffer) webmail-buffer-list) |
649 (setq bufname (buffer-name))) | |
650 (insert "<#part") | |
651 (if (and ctl (not (equal (car ctl) "text/"))) | |
652 (insert " type=\"" (car ctl) "\"")) | |
653 (insert " buffer=\"" bufname "\"") | |
654 (if cd | |
655 (insert " disposition=\"" cd "\"")) | |
656 (if description | |
657 (insert " description=\"" description "\"")) | |
658 (insert "><#/part>\n") | |
659 (setq p (point)))) | |
660 (delete-region p (point-max)) | |
661 (goto-char (point-min)) | |
662 ;; Some blank line to seperate mails. | |
663 (insert "\n\nFrom nobody " (current-time-string) "\n") | |
664 (insert "X-Gnus-Webmail: " (symbol-value 'user) | |
665 "@" (symbol-name webmail-type) "\n") | |
666 (if id | |
667 (insert (format "X-Message-ID: <%s@yahoo.com>\n" id))) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
668 (unless (looking-at "$") |
31717 | 669 (if (search-forward "\n\n" nil t) |
670 (forward-line -1) | |
671 (webmail-error "article@2"))) | |
672 (narrow-to-region (point) (point-max)) | |
673 (insert "MIME-Version: 1.0\n" | |
674 (prog1 | |
675 (mml-generate-mime) | |
676 (delete-region (point-min) (point-max)))) | |
677 (goto-char (point-min)) | |
678 (widen) | |
679 (let (case-fold-search) | |
680 (while (re-search-forward "^From " nil t) | |
681 (beginning-of-line) | |
682 (insert ">")))) | |
683 (mm-append-to-file (point-min) (point-max) file))) | |
684 | |
685 ;;; netaddress | |
686 | |
687 (defun webmail-netscape-open () | |
688 (goto-char (point-min)) | |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
689 (setq webmail-aux "") |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
690 (while (re-search-forward |
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
691 "TYPE=hidden *NAME=\\([^ ]+\\) *VALUE=\"\\([^\"]+\\)" |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
692 nil t) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
693 (setq webmail-aux (concat webmail-aux "&" (match-string 1) "=" |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
694 (match-string 2))))) |
31717 | 695 |
696 (defun webmail-netaddress-open () | |
697 (goto-char (point-min)) | |
698 (if (re-search-forward "action=\"\\([^\"]+\\)\"" nil t) | |
699 (setq webmail-aux (concat (car webmail-open-url) (match-string 1))) | |
700 (webmail-error "open@1"))) | |
701 | |
702 (defun webmail-netaddress-login () | |
703 (webmail-refresh-redirect) | |
704 (goto-char (point-min)) | |
705 (if (re-search-forward "tpl/[^/]+/\\([^/]+\\)" nil t) | |
706 (setq webmail-session (match-string 1)) | |
707 (webmail-error "login@1"))) | |
708 | |
709 (defun webmail-netaddress-list () | |
710 (webmail-refresh-redirect) | |
711 (let (item id) | |
712 (goto-char (point-min)) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
713 (when (re-search-forward |
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
714 "(\\([0-9]+\\) unread, \\([0-9]+\\) total)" nil t) |
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
715 (message "Found %s mail(s), %s unread" |
31717 | 716 (match-string 2) (match-string 1))) |
717 (goto-char (point-min)) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
718 (while (re-search-forward |
31717 | 719 "MR\\[i\\]\\.R='\\([^']*\\)'\\|MR\\[i\\]\\.Q='\\([^']+\\)'" nil t) |
720 (if (setq id (match-string 2)) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
721 (setq item |
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
722 (cons id |
31717 | 723 (format "%s/tpl/Message/%s/Read?Q=%s&FolderID=-4&SortUseCase=True&Sort=Date&Headers=True" |
724 (car webmail-article-url) | |
725 webmail-session id))) | |
726 (if (or (not webmail-newmail-only) | |
727 (equal (match-string 1) "True")) | |
728 (push item webmail-articles)))) | |
729 (setq webmail-articles (nreverse webmail-articles)))) | |
730 | |
731 (defun webmail-netaddress-single-part () | |
732 (goto-char (point-min)) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
733 (cond |
31717 | 734 ((looking-at "[\t\040\r\n]*<font face=[^>]+>[\t\040\r\n]*") |
735 ;; text/plain | |
736 (replace-match "") | |
737 (while (re-search-forward "[\t\040\r\n]+" nil t) | |
738 (replace-match " ")) | |
739 (goto-char (point-min)) | |
740 (while (re-search-forward "<br>" nil t) | |
741 (replace-match "\n")) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
742 (mm-url-remove-markup) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
743 (mm-url-decode-entities-nbsp) |
31717 | 744 nil) |
745 (t | |
746 (insert "<#part type=\"text/html\" disposition=inline>") | |
747 (goto-char (point-max)) | |
748 (insert "<#/part>") | |
749 t))) | |
750 | |
751 (defun webmail-netaddress-article (file id) | |
752 (webmail-refresh-redirect) | |
753 (let (p p1 attachment count mime type) | |
754 (save-restriction | |
755 (webmail-encode-8bit) | |
756 (goto-char (point-min)) | |
757 (if (not (search-forward "Trash" nil t)) | |
758 (webmail-error "article@1")) | |
759 (if (not (search-forward "<form>" nil t)) | |
760 (webmail-error "article@2")) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
761 (delete-region (point-min) (match-beginning 0)) |
31717 | 762 (if (not (search-forward "</form>" nil t)) |
763 (webmail-error "article@3")) | |
764 (narrow-to-region (point-min) (match-end 0)) | |
765 (goto-char (point-min)) | |
766 (while (re-search-forward "[\040\t\r\n]+" nil t) | |
767 (replace-match " ")) | |
768 (goto-char (point-min)) | |
769 (while (search-forward "<b>" nil t) | |
770 (replace-match "\n")) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
771 (mm-url-remove-markup) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
772 (mm-url-decode-entities-nbsp) |
31717 | 773 (goto-char (point-min)) |
774 (delete-blank-lines) | |
775 (goto-char (point-min)) | |
776 (while (re-search-forward "^\040+\\|\040+$" nil t) | |
777 (replace-match "")) | |
778 (goto-char (point-min)) | |
779 (while (re-search-forward "\040+" nil t) | |
780 (replace-match " ")) | |
781 (goto-char (point-max)) | |
782 (widen) | |
783 (insert "\n\n") | |
784 (setq p (point)) | |
785 (unless (search-forward "<!-- Data -->" nil t) | |
786 (webmail-error "article@4")) | |
787 (forward-line 14) | |
788 (delete-region p (point)) | |
789 (goto-char (point-max)) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
790 (unless (re-search-backward |
31717 | 791 "[\040\t]*<br>[\040\t\r\n]*<br>[\040\t\r\n]*<form" p t) |
792 (webmail-error "article@5")) | |
793 (delete-region (point) (point-max)) | |
794 (goto-char p) | |
795 (while (search-forward | |
796 "<TABLE border=\"0\" WIDTH=\"98%\" cellpadding=0 cellspacing=0>" | |
797 nil t 2) | |
798 (setq mime t) | |
799 (unless (search-forward "</TABLE>" nil t) | |
800 (webmail-error "article@6")) | |
801 (setq p1 (point)) | |
802 (if (search-backward "<IMG " p t) | |
803 (progn | |
804 (unless (re-search-forward "HREF=\"\\(/tpl/Attachment/[^/]+/\\([^/]+/[^\?]+\\)[^\"]+\\)\"" p1 t) | |
805 (webmail-error "article@7")) | |
806 (setq attachment (match-string 1)) | |
807 (setq type (match-string 2)) | |
808 (unless (search-forward "</TABLE>" nil t) | |
809 (webmail-error "article@8")) | |
810 (delete-region p (point)) | |
811 (let (bufname);; Attachment | |
812 (save-excursion | |
813 (set-buffer (generate-new-buffer " *webmail-att*")) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
814 (mm-url-insert (concat (car webmail-open-url) attachment)) |
31717 | 815 (push (current-buffer) webmail-buffer-list) |
816 (setq bufname (buffer-name))) | |
817 (insert "<#part type=" type) | |
818 (insert " buffer=\"" bufname "\"") | |
819 (insert " disposition=\"inline\"") | |
820 (insert "><#/part>\n") | |
821 (setq p (point)))) | |
822 (delete-region p p1) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
823 (narrow-to-region |
31717 | 824 p |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
825 (if (search-forward |
31717 | 826 "<TABLE border=\"0\" WIDTH=\"98%\" cellpadding=0 cellspacing=0>" |
827 nil t) | |
828 (match-beginning 0) | |
829 (point-max))) | |
830 (webmail-netaddress-single-part) | |
831 (goto-char (point-max)) | |
832 (setq p (point)) | |
833 (widen))) | |
834 (unless mime | |
835 (narrow-to-region p (point-max)) | |
836 (setq mime (webmail-netaddress-single-part)) | |
837 (widen)) | |
838 (goto-char (point-min)) | |
839 ;; Some blank line to seperate mails. | |
840 (insert "\n\nFrom nobody " (current-time-string) "\n") | |
841 (insert "X-Gnus-Webmail: " (symbol-value 'user) | |
842 "@" (symbol-name webmail-type) "\n") | |
843 (if id | |
844 (insert (format "X-Message-ID: <%s@%s>\n" id webmail-address))) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
845 (unless (looking-at "$") |
31717 | 846 (if (search-forward "\n\n" nil t) |
847 (forward-line -1) | |
848 (webmail-error "article@2"))) | |
849 (when mime | |
850 (narrow-to-region (point-min) (point)) | |
851 (goto-char (point-min)) | |
852 (while (not (eobp)) | |
853 (if (looking-at "MIME-Version\\|Content-Type") | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
854 (delete-region (point) |
31717 | 855 (progn |
856 (forward-line 1) | |
857 (if (re-search-forward "^[^ \t]" nil t) | |
858 (goto-char (match-beginning 0)) | |
859 (point-max)))) | |
860 (forward-line 1))) | |
861 (goto-char (point-max)) | |
862 (widen) | |
863 (narrow-to-region (point) (point-max)) | |
864 (insert "MIME-Version: 1.0\n" | |
865 (prog1 | |
866 (mml-generate-mime) | |
867 (delete-region (point-min) (point-max)))) | |
868 (goto-char (point-min)) | |
869 (widen)) | |
870 (let (case-fold-search) | |
871 (while (re-search-forward "^From " nil t) | |
872 (beginning-of-line) | |
873 (insert ">")))) | |
874 (mm-append-to-file (point-min) (point-max) file))) | |
875 | |
876 (defun webmail-netscape-article (file id) | |
877 (let (p p1 attachment count mime type) | |
878 (save-restriction | |
879 (webmail-encode-8bit) | |
880 (goto-char (point-min)) | |
881 (if (not (search-forward "Trash" nil t)) | |
882 (webmail-error "article@1")) | |
883 (if (not (search-forward "<form>" nil t)) | |
884 (webmail-error "article@2")) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
885 (delete-region (point-min) (match-beginning 0)) |
31717 | 886 (if (not (search-forward "</form>" nil t)) |
887 (webmail-error "article@3")) | |
888 (narrow-to-region (point-min) (match-end 0)) | |
889 (goto-char (point-min)) | |
890 (while (re-search-forward "[\040\t\r\n]+" nil t) | |
891 (replace-match " ")) | |
892 (goto-char (point-min)) | |
893 (while (re-search-forward "<a href=[^>]*>[^<]*</a>" nil t) | |
894 (replace-match "")) | |
895 (goto-char (point-min)) | |
896 (while (search-forward "<b>" nil t) | |
897 (replace-match "\n")) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
898 (mm-url-remove-markup) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
899 (mm-url-decode-entities-nbsp) |
31717 | 900 (goto-char (point-min)) |
901 (delete-blank-lines) | |
902 (goto-char (point-min)) | |
903 (while (re-search-forward "^\040+\\|\040+$" nil t) | |
904 (replace-match "")) | |
905 (goto-char (point-min)) | |
906 (while (re-search-forward "\040+" nil t) | |
907 (replace-match " ")) | |
908 (goto-char (point-max)) | |
909 (widen) | |
910 (insert "\n\n") | |
911 (setq p (point)) | |
912 (unless (search-forward "<!-- Data -->" nil t) | |
913 (webmail-error "article@4")) | |
914 (forward-line 14) | |
915 (delete-region p (point)) | |
916 (goto-char (point-max)) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
917 (unless (re-search-backward |
31717 | 918 "<form name=\"Transfer2\"" p t) |
919 (webmail-error "article@5")) | |
920 (delete-region (point) (point-max)) | |
921 (goto-char p) | |
922 (while (search-forward | |
923 "<TABLE border=\"0\" WIDTH=\"98%\" cellpadding=0 cellspacing=0>" | |
924 nil t 2) | |
925 (setq mime t) | |
926 (unless (search-forward "</TABLE>" nil t) | |
927 (webmail-error "article@6")) | |
928 (setq p1 (point)) | |
929 (if (search-backward "<IMG " p t) | |
930 (progn | |
931 (unless (re-search-forward "HREF=\"\\(/tpl/Attachment/[^/]+/\\([^/]+/[^\?]+\\)[^\"]+\\)\"" p1 t) | |
932 (webmail-error "article@7")) | |
933 (setq attachment (match-string 1)) | |
934 (setq type (match-string 2)) | |
935 (unless (search-forward "</TABLE>" nil t) | |
936 (webmail-error "article@8")) | |
937 (delete-region p (point)) | |
938 (let (bufname);; Attachment | |
939 (save-excursion | |
940 (set-buffer (generate-new-buffer " *webmail-att*")) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
941 (mm-url-insert (concat (car webmail-open-url) attachment)) |
31717 | 942 (push (current-buffer) webmail-buffer-list) |
943 (setq bufname (buffer-name))) | |
944 (insert "<#part type=" type) | |
945 (insert " buffer=\"" bufname "\"") | |
946 (insert " disposition=\"inline\"") | |
947 (insert "><#/part>\n") | |
948 (setq p (point)))) | |
949 (delete-region p p1) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
950 (narrow-to-region |
31717 | 951 p |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
952 (if (search-forward |
31717 | 953 "<TABLE border=\"0\" WIDTH=\"98%\" cellpadding=0 cellspacing=0>" |
954 nil t) | |
955 (match-beginning 0) | |
956 (point-max))) | |
957 (webmail-netaddress-single-part) | |
958 (goto-char (point-max)) | |
959 (setq p (point)) | |
960 (widen))) | |
961 (unless mime | |
962 (narrow-to-region p (point-max)) | |
963 (setq mime (webmail-netaddress-single-part)) | |
964 (widen)) | |
965 (goto-char (point-min)) | |
966 ;; Some blank line to seperate mails. | |
967 (insert "\n\nFrom nobody " (current-time-string) "\n") | |
968 (insert "X-Gnus-Webmail: " (symbol-value 'user) | |
969 "@" (symbol-name webmail-type) "\n") | |
970 (if id | |
971 (insert (format "X-Message-ID: <%s@%s>\n" id webmail-address))) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
972 (unless (looking-at "$") |
31717 | 973 (if (search-forward "\n\n" nil t) |
974 (forward-line -1) | |
975 (webmail-error "article@2"))) | |
976 (when mime | |
977 (narrow-to-region (point-min) (point)) | |
978 (goto-char (point-min)) | |
979 (while (not (eobp)) | |
980 (if (looking-at "MIME-Version\\|Content-Type") | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
981 (delete-region (point) |
31717 | 982 (progn |
983 (forward-line 1) | |
984 (if (re-search-forward "^[^ \t]" nil t) | |
985 (goto-char (match-beginning 0)) | |
986 (point-max)))) | |
987 (forward-line 1))) | |
988 (goto-char (point-max)) | |
989 (widen) | |
990 (narrow-to-region (point) (point-max)) | |
991 (insert "MIME-Version: 1.0\n" | |
992 (prog1 | |
993 (mml-generate-mime) | |
994 (delete-region (point-min) (point-max)))) | |
995 (goto-char (point-min)) | |
996 (widen)) | |
997 (let (case-fold-search) | |
998 (while (re-search-forward "^From " nil t) | |
999 (beginning-of-line) | |
1000 (insert ">")))) | |
1001 (mm-append-to-file (point-min) (point-max) file))) | |
1002 | |
1003 ;;; my-deja | |
1004 | |
1005 (defun webmail-my-deja-open () | |
1006 (webmail-refresh-redirect) | |
1007 (goto-char (point-min)) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1008 (if (re-search-forward "action=\"\\([^\"]+maillogin\\.py[^\"]*\\)\"" |
31717 | 1009 nil t) |
1010 (setq webmail-aux (match-string 1)) | |
1011 (webmail-error "open@1"))) | |
1012 | |
1013 (defun webmail-my-deja-list () | |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1014 (let (item id newp base) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1015 (goto-char (point-min)) |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
1016 (when (re-search-forward "href=\"\\(\\([^\"]*\\)/mailnf\\.[^\"]*\\)\"" |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1017 nil t) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1018 (let ((url (match-string 1))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1019 (setq base (match-string 2)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1020 (erase-buffer) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1021 (mm-url-insert url))) |
31717 | 1022 (goto-char (point-min)) |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
1023 (when (re-search-forward |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1024 "(\\([0-9]+\\) Message.?-[^>]*\\([0-9]+\\) New" |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
1025 nil t) |
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
1026 (message "Found %s mail(s), %s unread" |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1027 (match-string 1) (match-string 2))) |
31717 | 1028 (goto-char (point-min)) |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
1029 (while (re-search-forward |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1030 "newmail\\.gif\\|href=\"[^\"]*\\(mailnf\\.[^\"]+act=view[^\"]+mid=\\([^\"&]+\\)[^\"]+\\)\"" |
31717 | 1031 nil t) |
1032 (if (setq id (match-string 2)) | |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1033 (when (and (or newp (not webmail-newmail-only)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1034 (not (assoc id webmail-articles))) |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
1035 (push (cons id (setq webmail-aux |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1036 (concat base "/" (match-string 1)))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1037 webmail-articles) |
31717 | 1038 (setq newp nil)) |
1039 (setq newp t))) | |
1040 (setq webmail-articles (nreverse webmail-articles)))) | |
1041 | |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1042 (defun webmail-my-deja-article-part (base) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1043 (let (p) |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
1044 (cond |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1045 ((looking-at "[\t\040\r\n]*<!--[^>]*>") |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1046 (replace-match "")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1047 ((looking-at "[\t\040\r\n]*</PRE>") |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1048 (replace-match "")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1049 ((looking-at "[\t\040\r\n]*<PRE>") |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1050 ;; text/plain |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1051 (replace-match "") |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1052 (save-restriction |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1053 (narrow-to-region (point) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1054 (if (re-search-forward "</?PRE>" nil t) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1055 (match-beginning 0) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1056 (point-max))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1057 (goto-char (point-min)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1058 (mm-url-remove-markup) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1059 (mm-url-decode-entities-nbsp) |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1060 (goto-char (point-max)))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1061 ((looking-at "[\t\040\r\n]*<TABLE") |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1062 (save-restriction |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1063 (narrow-to-region (point) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1064 (if (search-forward "</TABLE>" nil t 2) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1065 (point) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1066 (point-max))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1067 (goto-char (point-min)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1068 (let (name type url bufname) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1069 (if (and (search-forward "File Name:" nil t) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1070 (re-search-forward "<FONT[^>]+>\\([^<]+\\)" nil t)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1071 (setq name (match-string 1))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1072 (if (and (search-forward "File Type:" nil t) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1073 (re-search-forward "<FONT[^>]+>\\([^<]+\\)" nil t)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1074 (setq type (match-string 1))) |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
1075 (unless (re-search-forward "action=\"getattach\\.cgi/\\([^\"]+\\)" |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1076 nil t) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1077 (webmail-error "article@5")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1078 (setq url (concat base "/getattach.cgi/" (match-string 1) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1079 "?sm=Download")) |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
1080 (while (re-search-forward |
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
1081 "type=hidden name=\"\\([^\"]+\\)\" value=\"\\([^\"]+\\)" |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1082 nil t) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1083 (setq url (concat url "&" (match-string 1) "=" |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1084 (match-string 2)))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1085 (delete-region (point-min) (point-max)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1086 (save-excursion |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1087 (set-buffer (generate-new-buffer " *webmail-att*")) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1088 (mm-url-insert url) |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1089 (push (current-buffer) webmail-buffer-list) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1090 (setq bufname (buffer-name))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1091 (insert "<#part type=\"" type "\"") |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1092 (if name (insert " filename=\"" name "\"")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1093 (insert " buffer=\"" bufname "\"") |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1094 (insert " disposition=inline><#/part>")))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1095 (t |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1096 (insert "<#part type=\"text/html\" disposition=inline>") |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1097 (goto-char (point-max)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1098 (insert "<#/part>"))))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1099 |
31717 | 1100 (defun webmail-my-deja-article (file id) |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1101 (let (base) |
31717 | 1102 (goto-char (point-min)) |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1103 (unless (string-match "\\([^\"]+\\)/mail" webmail-aux) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1104 (webmail-error "article@0")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1105 (setq base (match-string 1 webmail-aux)) |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
1106 (when (re-search-forward |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1107 "href=\"[^\"]*\\(mailnf\\.[^\"]+act=move[^\"]+mid=\\([^\"&]+\\)[^\"]+\\)\"" |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1108 nil t) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1109 (setq webmail-aux (concat base "/" (match-string 1))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1110 (string-match "mid=[^\"&]+" webmail-aux) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1111 (setq webmail-aux (replace-match "mid=%s" nil nil webmail-aux))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1112 (unless (search-forward "<HR noshade>" nil t) |
31717 | 1113 (webmail-error "article@1")) |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1114 (delete-region (point-min) (point)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1115 (unless (search-forward "<HR noshade>" nil t) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1116 (webmail-error "article@2")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1117 (save-restriction |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1118 (narrow-to-region (point-min) (point)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1119 (while (search-forward "\r\n" nil t) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1120 (replace-match "\n")) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1121 (mm-url-remove-markup) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1122 (mm-url-decode-entities-nbsp) |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1123 (goto-char (point-min)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1124 (while (re-search-forward "\n\n+" nil t) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1125 (replace-match "\n")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1126 (goto-char (point-max))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1127 (save-restriction |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1128 (narrow-to-region (point) (point-max)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1129 (goto-char (point-max)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1130 (unless (search-backward "<HR noshade>" nil t) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1131 (webmail-error "article@3")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1132 (unless (search-backward "</TT>" nil t) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1133 (webmail-error "article@4")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1134 (delete-region (point) (point-max)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1135 (goto-char (point-min)) |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
1136 (while (not (eobp)) |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1137 (webmail-my-deja-article-part base)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1138 (insert "MIME-Version: 1.0\n" |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1139 (prog1 |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1140 (mml-generate-mime) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1141 (delete-region (point-min) (point-max))))) |
31717 | 1142 (goto-char (point-min)) |
1143 (insert "\n\nFrom nobody " (current-time-string) "\n") | |
1144 (insert "X-Gnus-Webmail: " (symbol-value 'user) | |
1145 "@" (symbol-name webmail-type) "\n") | |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1146 (if (eq (char-after) ?\n) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1147 (delete-char 1)) |
31717 | 1148 (mm-append-to-file (point-min) (point-max) file))) |
1149 | |
1150 (provide 'webmail) | |
1151 | |
52401 | 1152 ;;; arch-tag: f75a4558-a8f6-46ec-b1c3-7a6434b3dd71 |
31717 | 1153 ;;; webmail.el ends here |