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