Mercurial > emacs
annotate lisp/gnus/webmail.el @ 108062:abf744801e5f
(message-generate-headers): Record insertion of optional headers as well.
Otherwise the check to prevent repeated insertion of optional headers
is a no-op. By Andreas Seltenreich <seltenreich@gmx.de>.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Thu, 22 Apr 2010 08:24:25 +0000 |
parents | 855f55740303 |
children | 8d09094063d0 376148b31b5e |
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, |
106815 | 4 ;; 2005, 2006, 2007, 2008, 2009, 2010 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 | |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
14 ;; (at your option) any later version. |
31717 | 15 |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
19 ;; GNU General Public License for more details. |
31717 | 20 |
21 ;; You should have received a copy of the GNU General Public License | |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
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") | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
197 (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
|
198 (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
|
199 (gnus-pp `(setq ,sym ',(eval sym))))) |
31717 | 200 (insert "---------------- webmail buffer ------------------\n\n") |
201 (insert-buffer-substring webmail-buffer) | |
202 (insert "\n---------------- end of buffer ------------------\n\n") | |
203 (append-to-file (point-min) (point-max) webmail-debug-file))) | |
204 | |
205 (defun webmail-error (str) | |
206 (if webmail-error-function | |
207 (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
|
208 (message "%s HTML has changed or your w3 package is too old.(%s)" |
31717 | 209 webmail-type str) |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
210 (error "%s HTML has changed or your w3 package is too old.(%s)" |
31717 | 211 webmail-type str)) |
212 | |
213 (defun webmail-setdefault (type) | |
214 (let ((type-def (cdr (assq type webmail-type-definition))) | |
215 (vars webmail-variables) | |
216 pair) | |
217 (setq webmail-type type) | |
218 (dolist (var vars) | |
219 (if (setq pair (assq var type-def)) | |
220 (set (intern (concat "webmail-" (symbol-name var))) (cdr pair)) | |
221 (set (intern (concat "webmail-" (symbol-name var))) nil))))) | |
222 | |
223 (defun webmail-eval (expr) | |
224 (cond | |
225 ((consp expr) | |
226 (cons (webmail-eval (car expr)) (webmail-eval (cdr expr)))) | |
227 ((symbolp expr) | |
228 (eval expr)) | |
229 (t | |
230 expr))) | |
231 | |
232 (defun webmail-url (xurl) | |
233 (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
|
234 (cond |
31717 | 235 ((eq (car xurl) 'content) |
236 (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
|
237 (mm-url-fetch-simple (if (stringp (car xurl)) |
31717 | 238 (car xurl) |
239 (apply 'format (webmail-eval (car xurl)))) | |
240 (apply 'format (webmail-eval (cdr xurl))))) | |
241 ((eq (car xurl) 'post) | |
242 (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
|
243 (mm-url-fetch-form (car xurl) (webmail-eval (cdr xurl)))) |
31717 | 244 (t |
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-insert (apply 'format (webmail-eval xurl))))))) |
31717 | 246 |
247 (defun webmail-init () | |
248 "Initialize buffers and such." | |
249 (if (gnus-buffer-live-p webmail-buffer) | |
250 (set-buffer webmail-buffer) | |
251 (setq webmail-buffer | |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
252 (nnheader-set-temp-buffer " *webmail*")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
253 (mm-disable-multibyte))) |
31717 | 254 |
255 (defvar url-package-name) | |
256 (defvar url-package-version) | |
257 (defvar url-cookie-multiple-line) | |
258 (defvar url-confirmation-func) | |
259 | |
260 ;; Hack W3 POST redirect. See `url-parse-mime-headers'. | |
261 ;; | |
262 ;; Netscape uses "GET" as redirect method when orignal method is POST | |
263 ;; and status is 302, .i.e no security risks by default without | |
264 ;; confirmation. | |
265 ;; | |
266 ;; Some web servers (at least Apache used by yahoo) return status 302 | |
267 ;; instead of 303, though they mean 303. | |
268 | |
269 (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
|
270 (cond |
31717 | 271 ((equal prompt (concat "Honor redirection with non-GET method " |
272 "(possible security risks)? ")) | |
273 nil) | |
274 ((equal prompt "Continue (with method of GET)? ") | |
275 t) | |
276 (t (error prompt)))) | |
277 | |
278 (defun webmail-refresh-redirect () | |
279 "Redirect refresh url in META." | |
280 (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
|
281 (while (re-search-forward |
31717 | 282 "<meta[ \t\r\n]*http-equiv=\"Refresh\"[^>]*URL=\\([^\"]+\\)\"" |
283 nil t) | |
284 (let ((url (match-string 1))) | |
285 (erase-buffer) | |
286 (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
|
287 (mm-url-insert url))) |
31717 | 288 (goto-char (point-min)))) |
289 | |
290 (defun webmail-fetch (file subtype user password) | |
291 (save-excursion | |
292 (webmail-setdefault subtype) | |
293 (let ((url-package-name (if (memq 'agent webmail-paranoid) | |
294 "Mozilla" | |
295 url-package-name)) | |
296 (url-package-version (if (memq 'agent webmail-paranoid) | |
297 "4.0" | |
298 url-package-version)) | |
299 (url-cookie-multiple-line (if (memq 'cookie webmail-paranoid) | |
300 nil | |
301 url-cookie-multiple-line)) | |
302 (url-confirmation-func (if (memq 'post webmail-paranoid) | |
303 'webmail-url-confirmation-func | |
304 url-confirmation-func)) | |
305 (url-http-silence-on-insecure-redirection t) | |
306 url-cookie-storage url-cookie-secure-storage | |
307 url-cookie-confirmation | |
308 item id (n 0)) | |
309 (webmail-init) | |
310 (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
|
311 (when webmail-open-url |
31717 | 312 (erase-buffer) |
313 (webmail-url webmail-open-url)) | |
314 (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
|
315 (when webmail-login-url |
31717 | 316 (erase-buffer) |
317 (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
|
318 (if webmail-login-snarf |
31717 | 319 (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
|
320 (when webmail-list-url |
31717 | 321 (erase-buffer) |
322 (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
|
323 (if webmail-list-snarf |
31717 | 324 (funcall webmail-list-snarf)) |
325 (while (setq item (pop webmail-articles)) | |
326 (message "Fetching mail #%d..." (setq n (1+ n))) | |
327 (erase-buffer) | |
328 (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
|
329 (mm-url-insert (cdr item))) |
31717 | 330 (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
|
331 (if webmail-article-snarf |
31717 | 332 (funcall webmail-article-snarf file id)) |
333 (when (and webmail-trash-url webmail-move-to-trash-can) | |
334 (message "Move mail #%d to trash can..." n) | |
335 (condition-case err | |
336 (progn | |
337 (webmail-url webmail-trash-url) | |
338 (let (buf) | |
339 (while (setq buf (pop webmail-buffer-list)) | |
340 (kill-buffer buf)))) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
341 (error |
31717 | 342 (let (buf) |
343 (while (setq buf (pop webmail-buffer-list)) | |
344 (kill-buffer buf))) | |
345 (error err)))))) | |
346 (if webmail-post-process | |
347 (funcall webmail-post-process)))) | |
348 | |
349 (defun webmail-encode-8bit () | |
350 (goto-char (point-min)) | |
351 (skip-chars-forward "^\200-\377") | |
352 (while (not (eobp)) | |
353 (insert (format "&%d;" (mm-char-int (char-after)))) | |
354 (delete-char 1) | |
355 (skip-chars-forward "^\200-\377"))) | |
356 | |
357 ;;; hotmail | |
358 | |
359 (defun webmail-hotmail-open () | |
360 (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
|
361 (if (re-search-forward |
31717 | 362 "action=\"https?://\\([^/]+\\)/cgi-bin/dologin" nil t) |
363 (setq webmail-aux (match-string 1)) | |
364 (webmail-error "open@1"))) | |
365 | |
366 (defun webmail-hotmail-login () | |
367 (let (site) | |
368 (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
|
369 (if (re-search-forward |
31717 | 370 "https?://\\([^/]+hotmail\\.msn\\.com\\)/cgi-bin/" nil t) |
371 (setq site (match-string 1)) | |
372 (webmail-error "login@1")) | |
373 (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
|
374 (if (re-search-forward |
31717 | 375 "\\(/cgi-bin/HoTMaiL\\?[^\"]*a=b[^\"]*\\)" nil t) |
376 (setq webmail-aux (concat "http://" site (match-string 1))) | |
377 (webmail-error "login@2")))) | |
378 | |
379 (defun webmail-hotmail-list () | |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
380 (goto-char (point-min)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
381 (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
|
382 (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
|
383 (if (eobp) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
384 (setq total "0") |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
385 (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
|
386 (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
|
387 (match-string 2)) |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
388 (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
|
389 (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
|
390 (webmail-error "list@0")))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
391 (unless (equal total "0") |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
392 (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
|
393 (if (re-search-forward |
31717 | 394 "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
|
395 (setq site (match-string 1)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
396 (webmail-error "list@1")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
397 (goto-char (point-min)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
398 (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
|
399 (setq webmail-aux |
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
400 (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
|
401 (match-string 1))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
402 (webmail-error "list@2")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
403 (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
|
404 (while (re-search-backward |
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
405 "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
|
406 nil t) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
407 (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
|
408 (progn |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
409 (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
|
410 (let (id) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
411 (if (string-match "msg=\\([^&]+\\)" url) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
412 (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
|
413 (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
|
414 webmail-articles))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
415 (setq newp nil)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
416 (setq newp t)))))) |
31717 | 417 |
418 ;; Thank victor@idaccr.org (Victor S. Miller) for raw=0 | |
419 | |
420 (defun webmail-hotmail-article (file id) | |
421 (goto-char (point-min)) | |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
422 (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
|
423 (unless (eobp) |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
424 (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
|
425 (webmail-error "article@3")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
426 (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
|
427 (delete-region (point-min) (point)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
428 (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
|
429 (webmail-error "article@3.1")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
430 (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
|
431 (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
|
432 (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
|
433 (goto-char (point-min)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
434 (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
|
435 (replace-match "\n")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
436 (goto-char (point-min)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
437 (insert "\n\n") |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
438 (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
|
439 (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
|
440 (forward-line)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
441 (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
|
442 "@" (symbol-name webmail-type) "\n") |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
443 (mm-append-to-file (point-min) (point-max) file))) |
31717 | 444 |
445 (defun webmail-hotmail-article-old (file id) | |
446 (let (p attachment count mime hotmail-direct) | |
447 (save-restriction | |
448 (webmail-encode-8bit) | |
449 (goto-char (point-min)) | |
450 (if (not (search-forward "<DIV>" nil t)) | |
451 (if (not (search-forward "Reply All" nil t)) | |
452 (webmail-error "article@1") | |
453 (setq hotmail-direct t)) | |
454 (goto-char (match-beginning 0))) | |
455 (narrow-to-region (point-min) (point)) | |
456 (if (not (search-backward "<table" nil t 2)) | |
457 (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
|
458 (delete-region (point-min) (match-beginning 0)) |
31717 | 459 (while (search-forward "<a href=" nil t) |
460 (setq p (match-beginning 0)) | |
461 (search-forward "</a>" nil t) | |
462 (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
|
463 (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
|
464 (mm-url-decode-entities-nbsp) |
31717 | 465 (goto-char (point-min)) |
466 (delete-blank-lines) | |
467 (goto-char (point-min)) | |
468 (when (search-forward "\n\n" nil t) | |
469 (backward-char) | |
470 (delete-region (point) (point-max))) | |
471 (goto-char (point-max)) | |
472 (widen) | |
473 (insert "\n") | |
474 (setq p (point)) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
475 (while (re-search-forward |
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
476 "<tt>\\|<div>\\|\\(http://[^/]+/cgi-bin/getmsg/\\([^\?]+\\)\?[^\"]*\\)\"" |
31717 | 477 nil t) |
478 (if (setq attachment (match-string 1)) | |
479 (let ((filename (match-string 2)) | |
480 bufname);; Attachment | |
481 (delete-region p (match-end 0)) | |
482 (save-excursion | |
483 (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
|
484 (mm-url-insert attachment) |
31717 | 485 (push (current-buffer) webmail-buffer-list) |
486 (setq bufname (buffer-name))) | |
487 (setq mime t) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
488 (insert "<#part type=" |
31717 | 489 (or (and filename |
490 (string-match "\\.[^\\.]+$" filename) | |
491 (mailcap-extension-to-mime | |
492 (match-string 0 filename))) | |
493 "application/octet-stream")) | |
494 (insert " buffer=\"" bufname "\"") | |
495 (insert " filename=\"" filename "\"") | |
496 (insert " disposition=\"inline\"") | |
497 (insert "><#/part>\n") | |
498 (setq p (point))) | |
499 (delete-region p (match-end 0)) | |
500 (if hotmail-direct | |
501 (if (not (search-forward "</tt>" nil t)) | |
502 (webmail-error "article@1.2") | |
503 (delete-region (match-beginning 0) (match-end 0))) | |
504 (setq count 1) | |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
505 (while (and (> count 0) |
31717 | 506 (re-search-forward "</div>\\|\\(<div>\\)" nil t)) |
507 (if (match-string 1) | |
508 (setq count (1+ count)) | |
509 (if (= (setq count (1- count)) 0) | |
510 (delete-region (match-beginning 0) | |
511 (match-end 0)))))) | |
512 (narrow-to-region p (point)) | |
513 (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
|
514 (cond |
31717 | 515 ((looking-at "<pre>") |
516 (goto-char (match-end 0)) | |
517 (if (looking-at "$") (forward-char)) | |
518 (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
|
519 (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
|
520 (mm-url-decode-entities-nbsp) |
31717 | 521 nil) |
522 (t | |
523 (setq mime t) | |
524 (insert "<#part type=\"text/html\" disposition=inline>") | |
525 (goto-char (point-max)) | |
526 (insert "<#/part>"))) | |
527 (goto-char (point-max)) | |
528 (setq p (point)) | |
529 (widen))) | |
530 (delete-region p (point-max)) | |
531 (goto-char (point-min)) | |
106837
855f55740303
Fix typos in comments.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
532 ;; Some blank line to separate mails. |
31717 | 533 (insert "\n\nFrom nobody " (current-time-string) "\n") |
534 (insert "X-Gnus-Webmail: " (symbol-value 'user) | |
535 "@" (symbol-name webmail-type) "\n") | |
536 (if id | |
537 (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
|
538 (unless (looking-at "$") |
31717 | 539 (if (search-forward "\n\n" nil t) |
540 (forward-line -1) | |
541 (webmail-error "article@2"))) | |
542 (narrow-to-region (point) (point-max)) | |
543 (if mime | |
544 (insert "MIME-Version: 1.0\n" | |
545 (prog1 | |
546 (mml-generate-mime) | |
547 (delete-region (point-min) (point-max))))) | |
548 (goto-char (point-min)) | |
549 (widen) | |
550 (let (case-fold-search) | |
551 (while (re-search-forward "^From " nil t) | |
552 (beginning-of-line) | |
553 (insert ">")))) | |
554 (mm-append-to-file (point-min) (point-max) file))) | |
555 | |
556 ;;; yahoo | |
557 | |
558 (defun webmail-yahoo-open () | |
559 (goto-char (point-min)) | |
560 (if (re-search-forward "action=\"\\([^\"]+\\)\"" nil t) | |
561 (setq webmail-aux (match-string 1)) | |
562 (webmail-error "open@1"))) | |
563 | |
564 (defun webmail-yahoo-login () | |
565 (goto-char (point-min)) | |
566 (if (re-search-forward "http://[^/]+[0-9]\\.mail\\.yahoo\\.com/" nil t) | |
567 (setq webmail-aux (match-string 0)) | |
568 (webmail-error "login@1")) | |
569 (if (re-search-forward "YY=[0-9]+" nil t) | |
570 (setq webmail-aux (concat webmail-aux "ym/ShowFolder?" | |
571 (match-string 0))) | |
572 (webmail-error "login@2"))) | |
573 | |
574 (defun webmail-yahoo-list () | |
575 (let (url (newp t) (tofetch 0)) | |
576 (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
|
577 (when (re-search-forward |
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
578 "showing [0-9]+-\\([0-9]+\\) of \\([0-9]+\\)" nil t) |
31717 | 579 ;;(setq listed (match-string 1)) |
580 (message "Found %s mail(s)" (match-string 2))) | |
581 (if (string-match "http://[^/]+" webmail-aux) | |
582 (setq webmail-aux (match-string 0 webmail-aux)) | |
583 (webmail-error "list@1")) | |
584 (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
|
585 (while (re-search-forward |
31717 | 586 "bgcolor=\"#eeeeee\"\\|href=\"\\(/ym/ShowLetter\\?MsgId=\\([^&]+\\)&[^\"]*\\)\"" |
587 nil t) | |
588 (if (setq url (match-string 1)) | |
589 (progn | |
590 (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
|
591 (push (cons (match-string 2) (concat webmail-aux url "&toc=1")) |
31717 | 592 webmail-articles) |
593 (setq tofetch (1+ tofetch))) | |
594 (setq newp t)) | |
595 (setq newp nil))) | |
596 (setq webmail-articles (nreverse webmail-articles)) | |
597 (message "Fetching %d mail(s)" tofetch))) | |
598 | |
599 (defun webmail-yahoo-article (file id) | |
600 (let (p attachment) | |
601 (save-restriction | |
602 (goto-char (point-min)) | |
603 (if (not (search-forward "value=\"Done\"" nil t)) | |
604 (webmail-error "article@1")) | |
605 (if (not (search-forward "<table" nil t)) | |
606 (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
|
607 (delete-region (point-min) (match-beginning 0)) |
31717 | 608 (if (not (search-forward "</table>" nil t)) |
609 (webmail-error "article@3")) | |
610 (narrow-to-region (point-min) (match-end 0)) | |
611 (while (search-forward "<a href=" nil t) | |
612 (setq p (match-beginning 0)) | |
613 (search-forward "</a>" nil t) | |
614 (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
|
615 (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
|
616 (mm-url-decode-entities-nbsp) |
31717 | 617 (goto-char (point-min)) |
618 (delete-blank-lines) | |
619 (goto-char (point-max)) | |
620 (widen) | |
621 (insert "\n") | |
622 (setq p (point)) | |
623 (while (re-search-forward "[^\"]*/ShowLetter/[^\?]+\?[^\"]*" nil t) | |
624 (setq attachment (match-string 0)) | |
625 (let (bufname ct ctl cd description) | |
626 (if (not (search-forward "<table" nil t)) | |
627 (webmail-error "article@4")) | |
628 (delete-region p (match-beginning 0)) | |
629 (if (not (search-forward "</table>" nil t)) | |
630 (webmail-error "article@5")) | |
631 (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
|
632 (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
|
633 (mm-url-decode-entities-nbsp) |
31717 | 634 (goto-char (point-min)) |
635 (delete-blank-lines) | |
636 (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
|
637 ctl (and ct (mail-header-parse-content-type ct)) |
31717 | 638 ;;cte (mail-fetch-field "content-transfer-encoding") |
639 cd (mail-fetch-field "content-disposition") | |
640 description (mail-fetch-field "content-description") | |
641 id (mail-fetch-field "content-id")) | |
642 (delete-region (point-min) (point-max)) | |
643 (widen) | |
644 (save-excursion | |
645 (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
|
646 (mm-url-insert (concat webmail-aux attachment)) |
31717 | 647 (push (current-buffer) webmail-buffer-list) |
648 (setq bufname (buffer-name))) | |
649 (insert "<#part") | |
650 (if (and ctl (not (equal (car ctl) "text/"))) | |
651 (insert " type=\"" (car ctl) "\"")) | |
652 (insert " buffer=\"" bufname "\"") | |
653 (if cd | |
654 (insert " disposition=\"" cd "\"")) | |
655 (if description | |
656 (insert " description=\"" description "\"")) | |
657 (insert "><#/part>\n") | |
658 (setq p (point)))) | |
659 (delete-region p (point-max)) | |
660 (goto-char (point-min)) | |
106837
855f55740303
Fix typos in comments.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
661 ;; Some blank line to separate mails. |
31717 | 662 (insert "\n\nFrom nobody " (current-time-string) "\n") |
663 (insert "X-Gnus-Webmail: " (symbol-value 'user) | |
664 "@" (symbol-name webmail-type) "\n") | |
665 (if id | |
666 (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
|
667 (unless (looking-at "$") |
31717 | 668 (if (search-forward "\n\n" nil t) |
669 (forward-line -1) | |
670 (webmail-error "article@2"))) | |
671 (narrow-to-region (point) (point-max)) | |
672 (insert "MIME-Version: 1.0\n" | |
673 (prog1 | |
674 (mml-generate-mime) | |
675 (delete-region (point-min) (point-max)))) | |
676 (goto-char (point-min)) | |
677 (widen) | |
678 (let (case-fold-search) | |
679 (while (re-search-forward "^From " nil t) | |
680 (beginning-of-line) | |
681 (insert ">")))) | |
682 (mm-append-to-file (point-min) (point-max) file))) | |
683 | |
684 ;;; netaddress | |
685 | |
686 (defun webmail-netscape-open () | |
687 (goto-char (point-min)) | |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
688 (setq webmail-aux "") |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
689 (while (re-search-forward |
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
690 "TYPE=hidden *NAME=\\([^ ]+\\) *VALUE=\"\\([^\"]+\\)" |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
691 nil t) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
692 (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
|
693 (match-string 2))))) |
31717 | 694 |
695 (defun webmail-netaddress-open () | |
696 (goto-char (point-min)) | |
697 (if (re-search-forward "action=\"\\([^\"]+\\)\"" nil t) | |
698 (setq webmail-aux (concat (car webmail-open-url) (match-string 1))) | |
699 (webmail-error "open@1"))) | |
700 | |
701 (defun webmail-netaddress-login () | |
702 (webmail-refresh-redirect) | |
703 (goto-char (point-min)) | |
704 (if (re-search-forward "tpl/[^/]+/\\([^/]+\\)" nil t) | |
705 (setq webmail-session (match-string 1)) | |
706 (webmail-error "login@1"))) | |
707 | |
708 (defun webmail-netaddress-list () | |
709 (webmail-refresh-redirect) | |
710 (let (item id) | |
711 (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
|
712 (when (re-search-forward |
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
713 "(\\([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
|
714 (message "Found %s mail(s), %s unread" |
31717 | 715 (match-string 2) (match-string 1))) |
716 (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
|
717 (while (re-search-forward |
31717 | 718 "MR\\[i\\]\\.R='\\([^']*\\)'\\|MR\\[i\\]\\.Q='\\([^']+\\)'" nil t) |
719 (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
|
720 (setq item |
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
721 (cons id |
31717 | 722 (format "%s/tpl/Message/%s/Read?Q=%s&FolderID=-4&SortUseCase=True&Sort=Date&Headers=True" |
723 (car webmail-article-url) | |
724 webmail-session id))) | |
725 (if (or (not webmail-newmail-only) | |
726 (equal (match-string 1) "True")) | |
727 (push item webmail-articles)))) | |
728 (setq webmail-articles (nreverse webmail-articles)))) | |
729 | |
730 (defun webmail-netaddress-single-part () | |
731 (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
|
732 (cond |
31717 | 733 ((looking-at "[\t\040\r\n]*<font face=[^>]+>[\t\040\r\n]*") |
734 ;; text/plain | |
735 (replace-match "") | |
736 (while (re-search-forward "[\t\040\r\n]+" nil t) | |
737 (replace-match " ")) | |
738 (goto-char (point-min)) | |
739 (while (re-search-forward "<br>" nil t) | |
740 (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
|
741 (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
|
742 (mm-url-decode-entities-nbsp) |
31717 | 743 nil) |
744 (t | |
745 (insert "<#part type=\"text/html\" disposition=inline>") | |
746 (goto-char (point-max)) | |
747 (insert "<#/part>") | |
748 t))) | |
749 | |
750 (defun webmail-netaddress-article (file id) | |
751 (webmail-refresh-redirect) | |
752 (let (p p1 attachment count mime type) | |
753 (save-restriction | |
754 (webmail-encode-8bit) | |
755 (goto-char (point-min)) | |
756 (if (not (search-forward "Trash" nil t)) | |
757 (webmail-error "article@1")) | |
758 (if (not (search-forward "<form>" nil t)) | |
759 (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
|
760 (delete-region (point-min) (match-beginning 0)) |
31717 | 761 (if (not (search-forward "</form>" nil t)) |
762 (webmail-error "article@3")) | |
763 (narrow-to-region (point-min) (match-end 0)) | |
764 (goto-char (point-min)) | |
765 (while (re-search-forward "[\040\t\r\n]+" nil t) | |
766 (replace-match " ")) | |
767 (goto-char (point-min)) | |
768 (while (search-forward "<b>" nil t) | |
769 (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
|
770 (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
|
771 (mm-url-decode-entities-nbsp) |
31717 | 772 (goto-char (point-min)) |
773 (delete-blank-lines) | |
774 (goto-char (point-min)) | |
775 (while (re-search-forward "^\040+\\|\040+$" nil t) | |
776 (replace-match "")) | |
777 (goto-char (point-min)) | |
778 (while (re-search-forward "\040+" nil t) | |
779 (replace-match " ")) | |
780 (goto-char (point-max)) | |
781 (widen) | |
782 (insert "\n\n") | |
783 (setq p (point)) | |
784 (unless (search-forward "<!-- Data -->" nil t) | |
785 (webmail-error "article@4")) | |
786 (forward-line 14) | |
787 (delete-region p (point)) | |
788 (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
|
789 (unless (re-search-backward |
31717 | 790 "[\040\t]*<br>[\040\t\r\n]*<br>[\040\t\r\n]*<form" p t) |
791 (webmail-error "article@5")) | |
792 (delete-region (point) (point-max)) | |
793 (goto-char p) | |
794 (while (search-forward | |
795 "<TABLE border=\"0\" WIDTH=\"98%\" cellpadding=0 cellspacing=0>" | |
796 nil t 2) | |
797 (setq mime t) | |
798 (unless (search-forward "</TABLE>" nil t) | |
799 (webmail-error "article@6")) | |
800 (setq p1 (point)) | |
801 (if (search-backward "<IMG " p t) | |
802 (progn | |
803 (unless (re-search-forward "HREF=\"\\(/tpl/Attachment/[^/]+/\\([^/]+/[^\?]+\\)[^\"]+\\)\"" p1 t) | |
804 (webmail-error "article@7")) | |
805 (setq attachment (match-string 1)) | |
806 (setq type (match-string 2)) | |
807 (unless (search-forward "</TABLE>" nil t) | |
808 (webmail-error "article@8")) | |
809 (delete-region p (point)) | |
810 (let (bufname);; Attachment | |
811 (save-excursion | |
812 (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
|
813 (mm-url-insert (concat (car webmail-open-url) attachment)) |
31717 | 814 (push (current-buffer) webmail-buffer-list) |
815 (setq bufname (buffer-name))) | |
816 (insert "<#part type=" type) | |
817 (insert " buffer=\"" bufname "\"") | |
818 (insert " disposition=\"inline\"") | |
819 (insert "><#/part>\n") | |
820 (setq p (point)))) | |
821 (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
|
822 (narrow-to-region |
31717 | 823 p |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
824 (if (search-forward |
31717 | 825 "<TABLE border=\"0\" WIDTH=\"98%\" cellpadding=0 cellspacing=0>" |
826 nil t) | |
827 (match-beginning 0) | |
828 (point-max))) | |
829 (webmail-netaddress-single-part) | |
830 (goto-char (point-max)) | |
831 (setq p (point)) | |
832 (widen))) | |
833 (unless mime | |
834 (narrow-to-region p (point-max)) | |
835 (setq mime (webmail-netaddress-single-part)) | |
836 (widen)) | |
837 (goto-char (point-min)) | |
106837
855f55740303
Fix typos in comments.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
838 ;; Some blank line to separate mails. |
31717 | 839 (insert "\n\nFrom nobody " (current-time-string) "\n") |
840 (insert "X-Gnus-Webmail: " (symbol-value 'user) | |
841 "@" (symbol-name webmail-type) "\n") | |
842 (if id | |
843 (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
|
844 (unless (looking-at "$") |
31717 | 845 (if (search-forward "\n\n" nil t) |
846 (forward-line -1) | |
847 (webmail-error "article@2"))) | |
848 (when mime | |
849 (narrow-to-region (point-min) (point)) | |
850 (goto-char (point-min)) | |
851 (while (not (eobp)) | |
852 (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
|
853 (delete-region (point) |
31717 | 854 (progn |
855 (forward-line 1) | |
856 (if (re-search-forward "^[^ \t]" nil t) | |
857 (goto-char (match-beginning 0)) | |
858 (point-max)))) | |
859 (forward-line 1))) | |
860 (goto-char (point-max)) | |
861 (widen) | |
862 (narrow-to-region (point) (point-max)) | |
863 (insert "MIME-Version: 1.0\n" | |
864 (prog1 | |
865 (mml-generate-mime) | |
866 (delete-region (point-min) (point-max)))) | |
867 (goto-char (point-min)) | |
868 (widen)) | |
869 (let (case-fold-search) | |
870 (while (re-search-forward "^From " nil t) | |
871 (beginning-of-line) | |
872 (insert ">")))) | |
873 (mm-append-to-file (point-min) (point-max) file))) | |
874 | |
875 (defun webmail-netscape-article (file id) | |
876 (let (p p1 attachment count mime type) | |
877 (save-restriction | |
878 (webmail-encode-8bit) | |
879 (goto-char (point-min)) | |
880 (if (not (search-forward "Trash" nil t)) | |
881 (webmail-error "article@1")) | |
882 (if (not (search-forward "<form>" nil t)) | |
883 (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
|
884 (delete-region (point-min) (match-beginning 0)) |
31717 | 885 (if (not (search-forward "</form>" nil t)) |
886 (webmail-error "article@3")) | |
887 (narrow-to-region (point-min) (match-end 0)) | |
888 (goto-char (point-min)) | |
889 (while (re-search-forward "[\040\t\r\n]+" nil t) | |
890 (replace-match " ")) | |
891 (goto-char (point-min)) | |
892 (while (re-search-forward "<a href=[^>]*>[^<]*</a>" nil t) | |
893 (replace-match "")) | |
894 (goto-char (point-min)) | |
895 (while (search-forward "<b>" nil t) | |
896 (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
|
897 (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
|
898 (mm-url-decode-entities-nbsp) |
31717 | 899 (goto-char (point-min)) |
900 (delete-blank-lines) | |
901 (goto-char (point-min)) | |
902 (while (re-search-forward "^\040+\\|\040+$" nil t) | |
903 (replace-match "")) | |
904 (goto-char (point-min)) | |
905 (while (re-search-forward "\040+" nil t) | |
906 (replace-match " ")) | |
907 (goto-char (point-max)) | |
908 (widen) | |
909 (insert "\n\n") | |
910 (setq p (point)) | |
911 (unless (search-forward "<!-- Data -->" nil t) | |
912 (webmail-error "article@4")) | |
913 (forward-line 14) | |
914 (delete-region p (point)) | |
915 (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
|
916 (unless (re-search-backward |
31717 | 917 "<form name=\"Transfer2\"" p t) |
918 (webmail-error "article@5")) | |
919 (delete-region (point) (point-max)) | |
920 (goto-char p) | |
921 (while (search-forward | |
922 "<TABLE border=\"0\" WIDTH=\"98%\" cellpadding=0 cellspacing=0>" | |
923 nil t 2) | |
924 (setq mime t) | |
925 (unless (search-forward "</TABLE>" nil t) | |
926 (webmail-error "article@6")) | |
927 (setq p1 (point)) | |
928 (if (search-backward "<IMG " p t) | |
929 (progn | |
930 (unless (re-search-forward "HREF=\"\\(/tpl/Attachment/[^/]+/\\([^/]+/[^\?]+\\)[^\"]+\\)\"" p1 t) | |
931 (webmail-error "article@7")) | |
932 (setq attachment (match-string 1)) | |
933 (setq type (match-string 2)) | |
934 (unless (search-forward "</TABLE>" nil t) | |
935 (webmail-error "article@8")) | |
936 (delete-region p (point)) | |
937 (let (bufname);; Attachment | |
938 (save-excursion | |
939 (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
|
940 (mm-url-insert (concat (car webmail-open-url) attachment)) |
31717 | 941 (push (current-buffer) webmail-buffer-list) |
942 (setq bufname (buffer-name))) | |
943 (insert "<#part type=" type) | |
944 (insert " buffer=\"" bufname "\"") | |
945 (insert " disposition=\"inline\"") | |
946 (insert "><#/part>\n") | |
947 (setq p (point)))) | |
948 (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
|
949 (narrow-to-region |
31717 | 950 p |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
951 (if (search-forward |
31717 | 952 "<TABLE border=\"0\" WIDTH=\"98%\" cellpadding=0 cellspacing=0>" |
953 nil t) | |
954 (match-beginning 0) | |
955 (point-max))) | |
956 (webmail-netaddress-single-part) | |
957 (goto-char (point-max)) | |
958 (setq p (point)) | |
959 (widen))) | |
960 (unless mime | |
961 (narrow-to-region p (point-max)) | |
962 (setq mime (webmail-netaddress-single-part)) | |
963 (widen)) | |
964 (goto-char (point-min)) | |
106837
855f55740303
Fix typos in comments.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
965 ;; Some blank line to separate mails. |
31717 | 966 (insert "\n\nFrom nobody " (current-time-string) "\n") |
967 (insert "X-Gnus-Webmail: " (symbol-value 'user) | |
968 "@" (symbol-name webmail-type) "\n") | |
969 (if id | |
970 (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
|
971 (unless (looking-at "$") |
31717 | 972 (if (search-forward "\n\n" nil t) |
973 (forward-line -1) | |
974 (webmail-error "article@2"))) | |
975 (when mime | |
976 (narrow-to-region (point-min) (point)) | |
977 (goto-char (point-min)) | |
978 (while (not (eobp)) | |
979 (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
|
980 (delete-region (point) |
31717 | 981 (progn |
982 (forward-line 1) | |
983 (if (re-search-forward "^[^ \t]" nil t) | |
984 (goto-char (match-beginning 0)) | |
985 (point-max)))) | |
986 (forward-line 1))) | |
987 (goto-char (point-max)) | |
988 (widen) | |
989 (narrow-to-region (point) (point-max)) | |
990 (insert "MIME-Version: 1.0\n" | |
991 (prog1 | |
992 (mml-generate-mime) | |
993 (delete-region (point-min) (point-max)))) | |
994 (goto-char (point-min)) | |
995 (widen)) | |
996 (let (case-fold-search) | |
997 (while (re-search-forward "^From " nil t) | |
998 (beginning-of-line) | |
999 (insert ">")))) | |
1000 (mm-append-to-file (point-min) (point-max) file))) | |
1001 | |
1002 ;;; my-deja | |
1003 | |
1004 (defun webmail-my-deja-open () | |
1005 (webmail-refresh-redirect) | |
1006 (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
|
1007 (if (re-search-forward "action=\"\\([^\"]+maillogin\\.py[^\"]*\\)\"" |
31717 | 1008 nil t) |
1009 (setq webmail-aux (match-string 1)) | |
1010 (webmail-error "open@1"))) | |
1011 | |
1012 (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
|
1013 (let (item id newp base) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1014 (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
|
1015 (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
|
1016 nil t) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1017 (let ((url (match-string 1))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1018 (setq base (match-string 2)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1019 (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
|
1020 (mm-url-insert url))) |
31717 | 1021 (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
|
1022 (when (re-search-forward |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1023 "(\\([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
|
1024 nil t) |
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
1025 (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
|
1026 (match-string 1) (match-string 2))) |
31717 | 1027 (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
|
1028 (while (re-search-forward |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1029 "newmail\\.gif\\|href=\"[^\"]*\\(mailnf\\.[^\"]+act=view[^\"]+mid=\\([^\"&]+\\)[^\"]+\\)\"" |
31717 | 1030 nil t) |
1031 (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
|
1032 (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
|
1033 (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
|
1034 (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
|
1035 (concat base "/" (match-string 1)))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1036 webmail-articles) |
31717 | 1037 (setq newp nil)) |
1038 (setq newp t))) | |
1039 (setq webmail-articles (nreverse webmail-articles)))) | |
1040 | |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1041 (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
|
1042 (let (p) |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
1043 (cond |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1044 ((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
|
1045 (replace-match "")) |
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]*</PRE>") |
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 ;; text/plain |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1050 (replace-match "") |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1051 (save-restriction |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1052 (narrow-to-region (point) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1053 (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
|
1054 (match-beginning 0) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1055 (point-max))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1056 (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
|
1057 (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
|
1058 (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
|
1059 (goto-char (point-max)))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1060 ((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
|
1061 (save-restriction |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1062 (narrow-to-region (point) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1063 (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
|
1064 (point) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1065 (point-max))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1066 (goto-char (point-min)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1067 (let (name type url bufname) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1068 (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
|
1069 (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
|
1070 (setq name (match-string 1))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1071 (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
|
1072 (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
|
1073 (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
|
1074 (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
|
1075 nil t) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1076 (webmail-error "article@5")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1077 (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
|
1078 "?sm=Download")) |
35838
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
1079 (while (re-search-forward |
53eebdb81828
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
32979
diff
changeset
|
1080 "type=hidden name=\"\\([^\"]+\\)\" value=\"\\([^\"]+\\)" |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1081 nil t) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1082 (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
|
1083 (match-string 2)))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1084 (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
|
1085 (save-excursion |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1086 (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
|
1087 (mm-url-insert url) |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1088 (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
|
1089 (setq bufname (buffer-name))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1090 (insert "<#part type=\"" type "\"") |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1091 (if name (insert " filename=\"" name "\"")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1092 (insert " buffer=\"" bufname "\"") |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1093 (insert " disposition=inline><#/part>")))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1094 (t |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1095 (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
|
1096 (goto-char (point-max)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1097 (insert "<#/part>"))))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1098 |
31717 | 1099 (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
|
1100 (let (base) |
31717 | 1101 (goto-char (point-min)) |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1102 (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
|
1103 (webmail-error "article@0")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1104 (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
|
1105 (when (re-search-forward |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1106 "href=\"[^\"]*\\(mailnf\\.[^\"]+act=move[^\"]+mid=\\([^\"&]+\\)[^\"]+\\)\"" |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1107 nil t) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1108 (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
|
1109 (string-match "mid=[^\"&]+" webmail-aux) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1110 (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
|
1111 (unless (search-forward "<HR noshade>" nil t) |
31717 | 1112 (webmail-error "article@1")) |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1113 (delete-region (point-min) (point)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1114 (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
|
1115 (webmail-error "article@2")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1116 (save-restriction |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1117 (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
|
1118 (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
|
1119 (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
|
1120 (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
|
1121 (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
|
1122 (goto-char (point-min)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1123 (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
|
1124 (replace-match "\n")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1125 (goto-char (point-max))) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1126 (save-restriction |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1127 (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
|
1128 (goto-char (point-max)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1129 (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
|
1130 (webmail-error "article@3")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1131 (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
|
1132 (webmail-error "article@4")) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1133 (delete-region (point) (point-max)) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1134 (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
|
1135 (while (not (eobp)) |
32979
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1136 (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
|
1137 (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
|
1138 (prog1 |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1139 (mml-generate-mime) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1140 (delete-region (point-min) (point-max))))) |
31717 | 1141 (goto-char (point-min)) |
1142 (insert "\n\nFrom nobody " (current-time-string) "\n") | |
1143 (insert "X-Gnus-Webmail: " (symbol-value 'user) | |
1144 "@" (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
|
1145 (if (eq (char-after) ?\n) |
ddc33cf6b78c
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
1146 (delete-char 1)) |
31717 | 1147 (mm-append-to-file (point-min) (point-max) file))) |
1148 | |
1149 (provide 'webmail) | |
1150 | |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
1151 ;; arch-tag: f75a4558-a8f6-46ec-b1c3-7a6434b3dd71 |
31717 | 1152 ;;; webmail.el ends here |