Mercurial > emacs
comparison lisp/gnus/webmail.el @ 35838:53eebdb81828 zsh-sync-ognus-3
2001-02-01 ShengHuo ZHU <zsh@cs.rochester.edu>
* gnus-score.el (gnus-summary-score-entry): match may be an integer.
* gnus-art.el (gnus-summary-save-in-pipe): Prompt for saving
command if there is not last-saver.
* rfc2047.el (rfc2047-encode): MIME charset is not coding system.
(rfc2047-charset-encoding-alist): Add big5.
* mm-util.el (mm-mime-mule-charset-alist): Preferred MIME names
GB2312 and Big5.
* gnus-score.el (gnus-score-lower-thread): Fix a doc typo.
* gnus-sum.el (gnus-summary-print-article): Remove process mark.
* gnus-sum.el (gnus-summary-print-article): Take one prefix
argument. Allow to print several articles in one file.
* webmail.el (webmail-type-definition): netaddress changes.
author | ShengHuo ZHU <zsh@cs.rochester.edu> |
---|---|
date | Fri, 02 Feb 2001 03:15:52 +0000 |
parents | ddc33cf6b78c |
children | 695cf19ef79e d7ddb3e565de |
comparison
equal
deleted
inserted
replaced
35837:eda9214571fb | 35838:53eebdb81828 |
---|---|
1 ;;; webmail.el --- interfacing with web mail | 1 ;;; webmail.el --- interface of web mail |
2 ;; Copyright (C) 1999, 2000 Free Software Foundation, Inc. | 2 ;; Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. |
3 | 3 |
4 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu> | 4 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu> |
5 ;; Keywords: hotmail netaddress my-deja netscape | 5 ;; Keywords: hotmail netaddress my-deja netscape |
6 | 6 |
7 ;; This file is part of GNU Emacs. | 7 ;; This file is part of GNU Emacs. |
30 ;; work. `w3' must be 4.0pre46+one-line-cookie patch or standalone | 30 ;; work. `w3' must be 4.0pre46+one-line-cookie patch or standalone |
31 ;; `url'. | 31 ;; `url'. |
32 | 32 |
33 ;; Todo: To support more web mail servers. | 33 ;; Todo: To support more web mail servers. |
34 | 34 |
35 ;; Known bugs: | 35 ;; Known bugs: |
36 ;; 1. Net@ddress may corrupt `X-Face'. | 36 ;; 1. Net@ddress may corrupt `X-Face'. |
37 | 37 |
38 ;; Warning: | 38 ;; Warning: |
39 ;; Webmail is an experimental function, which means NO WARRANTY. | 39 ;; Webmail is an experimental function, which means NO WARRANTY. |
40 | 40 |
79 webmail-aux user password) | 79 webmail-aux user password) |
80 ;;(login-snarf . webmail-hotmail-login) | 80 ;;(login-snarf . webmail-hotmail-login) |
81 ;;(list-url "%s" webmail-aux) | 81 ;;(list-url "%s" webmail-aux) |
82 (list-snarf . webmail-hotmail-list) | 82 (list-snarf . webmail-hotmail-list) |
83 (article-snarf . webmail-hotmail-article) | 83 (article-snarf . webmail-hotmail-article) |
84 (trash-url | 84 (trash-url |
85 "%s&login=%s&f=33792&curmbox=ACTIVE&_lang=&foo=inbox&js=&page=&%s=on&_HMaction=MoveTo&tobox=trAsH&nullbox=" | 85 "%s&login=%s&f=33792&curmbox=ACTIVE&_lang=&foo=inbox&js=&page=&%s=on&_HMaction=MoveTo&tobox=trAsH&nullbox=" |
86 webmail-aux user id)) | 86 webmail-aux user id)) |
87 (yahoo | 87 (yahoo |
88 (paranoid agent cookie post) | 88 (paranoid agent cookie post) |
89 (address . "mail.yahoo.com") | 89 (address . "mail.yahoo.com") |
90 (open-url "http://mail.yahoo.com/") | 90 (open-url "http://mail.yahoo.com/") |
91 (open-snarf . webmail-yahoo-open) | 91 (open-snarf . webmail-yahoo-open) |
92 (login-url;; yahoo will not accept GET | 92 (login-url;; yahoo will not accept GET |
93 content | 93 content |
94 ("%s" webmail-aux) | 94 ("%s" webmail-aux) |
95 ".tries=&.src=ym&.last=&promo=&.intl=&.bypass=&.partner=&.chkP=Y&.done=&login=%s&passwd=%s" | 95 ".tries=&.src=ym&.last=&promo=&.intl=&.bypass=&.partner=&.chkP=Y&.done=&login=%s&passwd=%s" |
96 user password) | 96 user password) |
97 (login-snarf . webmail-yahoo-login) | 97 (login-snarf . webmail-yahoo-login) |
98 (list-url "%s&rb=Inbox&YN=1" webmail-aux) | 98 (list-url "%s&rb=Inbox&YN=1" webmail-aux) |
99 (list-snarf . webmail-yahoo-list) | 99 (list-snarf . webmail-yahoo-list) |
100 (article-snarf . webmail-yahoo-article) | 100 (article-snarf . webmail-yahoo-article) |
101 (trash-url | 101 (trash-url |
102 "%s/ym/ShowFolder?YY=52107&inc=50&order=down&sort=date&pos=0&box=Inbox&DEL=Delete&destBox=&Mid=%s&destBox2=" | 102 "%s/ym/ShowFolder?YY=52107&inc=50&order=down&sort=date&pos=0&box=Inbox&DEL=Delete&destBox=&Mid=%s&destBox2=" |
103 webmail-aux id)) | 103 webmail-aux id)) |
104 (netaddress | 104 (netaddress |
105 (paranoid cookie post) | 105 (paranoid cookie post) |
106 (address . "www.netaddress.com") | 106 (address . "www.netaddress.com") |
107 (open-url "http://www.netaddress.com/") | 107 (open-url "http://www.netaddress.com/") |
108 (open-snarf . webmail-netaddress-open) | 108 (open-snarf . webmail-netaddress-open) |
109 (login-url | 109 (login-url |
110 content | 110 content |
111 ("%s" webmail-aux) | 111 ("%s" webmail-aux) |
112 "LoginState=2&SuccessfulLogin=%%2Ftpl&NewServerName=www.netaddress.com&JavaScript=JavaScript1.2&DomainID=4&NA31site=classic.netaddress.com&NA31port=80&UserID=%s&passwd=%s" | 112 "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" |
113 user password) | 113 user password) |
114 (login-snarf . webmail-netaddress-login) | 114 (login-snarf . webmail-netaddress-login) |
115 (list-url | 115 (list-url |
116 "http://www.netaddress.com/tpl/Mail/%s/List?FolderID=-4&SortUseCase=True" | 116 "http://www.netaddress.com/tpl/Mail/%s/List?FolderID=-4&SortUseCase=True" |
117 webmail-session) | 117 webmail-session) |
118 (list-snarf . webmail-netaddress-list) | 118 (list-snarf . webmail-netaddress-list) |
119 (article-url "http://www.netaddress.com/") | 119 (article-url "http://www.netaddress.com/") |
120 (article-snarf . webmail-netaddress-article) | 120 (article-snarf . webmail-netaddress-article) |
121 (trash-url | 121 (trash-url |
122 "http://www.netaddress.com/tpl/Message/%s/Move?FolderID=-4&Q=%s&N=&Sort=Date&F=-1" | 122 "http://www.netaddress.com/tpl/Message/%s/Move?FolderID=-4&Q=%s&N=&Sort=Date&F=-1" |
123 webmail-session id)) | 123 webmail-session id)) |
124 (netscape | 124 (netscape |
125 (paranoid cookie post agent) | 125 (paranoid cookie post agent) |
126 (address . "webmail.netscape.com") | 126 (address . "webmail.netscape.com") |
127 (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") | 127 (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") |
128 (open-snarf . webmail-netscape-open) | 128 (open-snarf . webmail-netscape-open) |
129 (login-url | 129 (login-url |
130 content | 130 content |
131 ("http://ureg.netscape.com/iiop/UReg2/login/loginform") | 131 ("http://ureg.netscape.com/iiop/UReg2/login/loginform") |
132 "U2_USERNAME=%s&U2_PASSWORD=%s%s" | 132 "U2_USERNAME=%s&U2_PASSWORD=%s%s" |
133 user password webmail-aux) | 133 user password webmail-aux) |
134 (login-snarf . webmail-netaddress-login) | 134 (login-snarf . webmail-netaddress-login) |
135 (list-url | 135 (list-url |
136 "http://webmail.netscape.com/tpl/Mail/%s/List?FolderID=-4&SortUseCase=True" | 136 "http://webmail.netscape.com/tpl/Mail/%s/List?FolderID=-4&SortUseCase=True" |
137 webmail-session) | 137 webmail-session) |
138 (list-snarf . webmail-netaddress-list) | 138 (list-snarf . webmail-netaddress-list) |
139 (article-url "http://webmail.netscape.com/") | 139 (article-url "http://webmail.netscape.com/") |
140 (article-snarf . webmail-netscape-article) | 140 (article-snarf . webmail-netscape-article) |
141 (trash-url | 141 (trash-url |
142 "http://webmail.netscape.com/tpl/Message/%s/Move?FolderID=-4&Q=%s&N=&Sort=Date&F=-1" | 142 "http://webmail.netscape.com/tpl/Message/%s/Move?FolderID=-4&Q=%s&N=&Sort=Date&F=-1" |
143 webmail-session id)) | 143 webmail-session id)) |
144 (my-deja | 144 (my-deja |
145 (paranoid cookie post) | 145 (paranoid cookie post) |
146 (address . "www.my-deja.com") | 146 (address . "www.my-deja.com") |
147 (open-url "http://www.deja.com/my/pr.xp") | 147 (open-url "http://www.deja.com/my/pr.xp") |
148 (open-snarf . webmail-my-deja-open) | 148 (open-snarf . webmail-my-deja-open) |
149 (login-url | 149 (login-url |
150 content | 150 content |
151 ("%s" webmail-aux) | 151 ("%s" webmail-aux) |
152 "member_name=%s&pw=%s&go=&priv_opt_MyDeja99=" | 152 "member_name=%s&pw=%s&go=&priv_opt_MyDeja99=" |
153 user password) | 153 user password) |
154 (list-url "http://www.deja.com/rg_gotomail.xp") | 154 (list-url "http://www.deja.com/rg_gotomail.xp") |
155 (list-snarf . webmail-my-deja-list) | 155 (list-snarf . webmail-my-deja-list) |
156 (article-snarf . webmail-my-deja-article) | 156 (article-snarf . webmail-my-deja-article) |
157 (trash-url webmail-aux id)))) | 157 (trash-url webmail-aux id)))) |
158 | 158 |
159 (defvar webmail-variables | 159 (defvar webmail-variables |
160 '(address article-snarf article-url list-snarf list-url | 160 '(address article-snarf article-url list-snarf list-url |
161 login-url login-snarf open-url open-snarf site articles | 161 login-url login-snarf open-url open-snarf site articles |
162 post-process paranoid trash-url)) | 162 post-process paranoid trash-url)) |
163 | 163 |
164 (defconst webmail-version "webmail 1.0") | 164 (defconst webmail-version "webmail 1.0") |
165 | 165 |
199 ;;; Interface functions | 199 ;;; Interface functions |
200 | 200 |
201 (defun webmail-debug (str) | 201 (defun webmail-debug (str) |
202 (with-temp-buffer | 202 (with-temp-buffer |
203 (insert "\n---------------- A bug at " str " ------------------\n") | 203 (insert "\n---------------- A bug at " str " ------------------\n") |
204 (mapcar #'(lambda (sym) | 204 (mapcar #'(lambda (sym) |
205 (if (boundp sym) | 205 (if (boundp sym) |
206 (pp `(setq ,sym ',(eval sym)) (current-buffer)))) | 206 (pp `(setq ,sym ',(eval sym)) (current-buffer)))) |
207 '(webmail-type user)) | 207 '(webmail-type user)) |
208 (insert "---------------- webmail buffer ------------------\n\n") | 208 (insert "---------------- webmail buffer ------------------\n\n") |
209 (insert-buffer-substring webmail-buffer) | 209 (insert-buffer-substring webmail-buffer) |
262 (t | 262 (t |
263 expr))) | 263 expr))) |
264 | 264 |
265 (defun webmail-url (xurl) | 265 (defun webmail-url (xurl) |
266 (mm-with-unibyte-current-buffer | 266 (mm-with-unibyte-current-buffer |
267 (cond | 267 (cond |
268 ((eq (car xurl) 'content) | 268 ((eq (car xurl) 'content) |
269 (pop xurl) | 269 (pop xurl) |
270 (webmail-fetch-simple (if (stringp (car xurl)) | 270 (webmail-fetch-simple (if (stringp (car xurl)) |
271 (car xurl) | 271 (car xurl) |
272 (apply 'format (webmail-eval (car xurl)))) | 272 (apply 'format (webmail-eval (car xurl)))) |
298 ;; | 298 ;; |
299 ;; Some web servers (at least Apache used by yahoo) return status 302 | 299 ;; Some web servers (at least Apache used by yahoo) return status 302 |
300 ;; instead of 303, though they mean 303. | 300 ;; instead of 303, though they mean 303. |
301 | 301 |
302 (defun webmail-url-confirmation-func (prompt) | 302 (defun webmail-url-confirmation-func (prompt) |
303 (cond | 303 (cond |
304 ((equal prompt (concat "Honor redirection with non-GET method " | 304 ((equal prompt (concat "Honor redirection with non-GET method " |
305 "(possible security risks)? ")) | 305 "(possible security risks)? ")) |
306 nil) | 306 nil) |
307 ((equal prompt "Continue (with method of GET)? ") | 307 ((equal prompt "Continue (with method of GET)? ") |
308 t) | 308 t) |
309 (t (error prompt)))) | 309 (t (error prompt)))) |
310 | 310 |
311 (defun webmail-refresh-redirect () | 311 (defun webmail-refresh-redirect () |
312 "Redirect refresh url in META." | 312 "Redirect refresh url in META." |
313 (goto-char (point-min)) | 313 (goto-char (point-min)) |
314 (while (re-search-forward | 314 (while (re-search-forward |
315 "<meta[ \t\r\n]*http-equiv=\"Refresh\"[^>]*URL=\\([^\"]+\\)\"" | 315 "<meta[ \t\r\n]*http-equiv=\"Refresh\"[^>]*URL=\\([^\"]+\\)\"" |
316 nil t) | 316 nil t) |
317 (let ((url (match-string 1))) | 317 (let ((url (match-string 1))) |
318 (erase-buffer) | 318 (erase-buffer) |
319 (mm-with-unibyte-current-buffer | 319 (mm-with-unibyte-current-buffer |
339 url-cookie-storage url-cookie-secure-storage | 339 url-cookie-storage url-cookie-secure-storage |
340 url-cookie-confirmation | 340 url-cookie-confirmation |
341 item id (n 0)) | 341 item id (n 0)) |
342 (webmail-init) | 342 (webmail-init) |
343 (setq webmail-articles nil) | 343 (setq webmail-articles nil) |
344 (when webmail-open-url | 344 (when webmail-open-url |
345 (erase-buffer) | 345 (erase-buffer) |
346 (webmail-url webmail-open-url)) | 346 (webmail-url webmail-open-url)) |
347 (if webmail-open-snarf (funcall webmail-open-snarf)) | 347 (if webmail-open-snarf (funcall webmail-open-snarf)) |
348 (when webmail-login-url | 348 (when webmail-login-url |
349 (erase-buffer) | 349 (erase-buffer) |
350 (webmail-url webmail-login-url)) | 350 (webmail-url webmail-login-url)) |
351 (if webmail-login-snarf | 351 (if webmail-login-snarf |
352 (funcall webmail-login-snarf)) | 352 (funcall webmail-login-snarf)) |
353 (when webmail-list-url | 353 (when webmail-list-url |
354 (erase-buffer) | 354 (erase-buffer) |
355 (webmail-url webmail-list-url)) | 355 (webmail-url webmail-list-url)) |
356 (if webmail-list-snarf | 356 (if webmail-list-snarf |
357 (funcall webmail-list-snarf)) | 357 (funcall webmail-list-snarf)) |
358 (while (setq item (pop webmail-articles)) | 358 (while (setq item (pop webmail-articles)) |
359 (message "Fetching mail #%d..." (setq n (1+ n))) | 359 (message "Fetching mail #%d..." (setq n (1+ n))) |
360 (erase-buffer) | 360 (erase-buffer) |
361 (mm-with-unibyte-current-buffer | 361 (mm-with-unibyte-current-buffer |
362 (nnweb-insert (cdr item))) | 362 (nnweb-insert (cdr item))) |
363 (setq id (car item)) | 363 (setq id (car item)) |
364 (if webmail-article-snarf | 364 (if webmail-article-snarf |
365 (funcall webmail-article-snarf file id)) | 365 (funcall webmail-article-snarf file id)) |
366 (when (and webmail-trash-url webmail-move-to-trash-can) | 366 (when (and webmail-trash-url webmail-move-to-trash-can) |
367 (message "Move mail #%d to trash can..." n) | 367 (message "Move mail #%d to trash can..." n) |
368 (condition-case err | 368 (condition-case err |
369 (progn | 369 (progn |
370 (webmail-url webmail-trash-url) | 370 (webmail-url webmail-trash-url) |
371 (let (buf) | 371 (let (buf) |
372 (while (setq buf (pop webmail-buffer-list)) | 372 (while (setq buf (pop webmail-buffer-list)) |
373 (kill-buffer buf)))) | 373 (kill-buffer buf)))) |
374 (error | 374 (error |
375 (let (buf) | 375 (let (buf) |
376 (while (setq buf (pop webmail-buffer-list)) | 376 (while (setq buf (pop webmail-buffer-list)) |
377 (kill-buffer buf))) | 377 (kill-buffer buf))) |
378 (error err)))))) | 378 (error err)))))) |
379 (if webmail-post-process | 379 (if webmail-post-process |
389 | 389 |
390 ;;; hotmail | 390 ;;; hotmail |
391 | 391 |
392 (defun webmail-hotmail-open () | 392 (defun webmail-hotmail-open () |
393 (goto-char (point-min)) | 393 (goto-char (point-min)) |
394 (if (re-search-forward | 394 (if (re-search-forward |
395 "action=\"https?://\\([^/]+\\)/cgi-bin/dologin" nil t) | 395 "action=\"https?://\\([^/]+\\)/cgi-bin/dologin" nil t) |
396 (setq webmail-aux (match-string 1)) | 396 (setq webmail-aux (match-string 1)) |
397 (webmail-error "open@1"))) | 397 (webmail-error "open@1"))) |
398 | 398 |
399 (defun webmail-hotmail-login () | 399 (defun webmail-hotmail-login () |
400 (let (site) | 400 (let (site) |
401 (goto-char (point-min)) | 401 (goto-char (point-min)) |
402 (if (re-search-forward | 402 (if (re-search-forward |
403 "https?://\\([^/]+hotmail\\.msn\\.com\\)/cgi-bin/" nil t) | 403 "https?://\\([^/]+hotmail\\.msn\\.com\\)/cgi-bin/" nil t) |
404 (setq site (match-string 1)) | 404 (setq site (match-string 1)) |
405 (webmail-error "login@1")) | 405 (webmail-error "login@1")) |
406 (goto-char (point-min)) | 406 (goto-char (point-min)) |
407 (if (re-search-forward | 407 (if (re-search-forward |
408 "\\(/cgi-bin/HoTMaiL\\?[^\"]*a=b[^\"]*\\)" nil t) | 408 "\\(/cgi-bin/HoTMaiL\\?[^\"]*a=b[^\"]*\\)" nil t) |
409 (setq webmail-aux (concat "http://" site (match-string 1))) | 409 (setq webmail-aux (concat "http://" site (match-string 1))) |
410 (webmail-error "login@2")))) | 410 (webmail-error "login@2")))) |
411 | 411 |
412 (defun webmail-hotmail-list () | 412 (defun webmail-hotmail-list () |
413 (goto-char (point-min)) | 413 (goto-char (point-min)) |
414 (skip-chars-forward " \t\n\r") | 414 (skip-chars-forward " \t\n\r") |
415 (let (site url newp (total "0")) | 415 (let (site url newp (total "0")) |
416 (if (eobp) | 416 (if (eobp) |
417 (setq total "0") | 417 (setq total "0") |
418 (if (re-search-forward "\\([0-9]+\\) *<b>(\\([0-9]+\\) new)" nil t) | 418 (if (re-search-forward "\\([0-9]+\\) *<b>(\\([0-9]+\\) new)" nil t) |
419 (message "Found %s (%s new)" (setq total (match-string 1)) | 419 (message "Found %s (%s new)" (setq total (match-string 1)) |
420 (match-string 2)) | 420 (match-string 2)) |
421 (if (re-search-forward "\\([0-9]+\\) new" nil t) | 421 (if (re-search-forward "\\([0-9]+\\) new" nil t) |
422 (message "Found %s new" (setq total (match-string 1))) | 422 (message "Found %s new" (setq total (match-string 1))) |
423 (webmail-error "list@0")))) | 423 (webmail-error "list@0")))) |
424 (unless (equal total "0") | 424 (unless (equal total "0") |
425 (goto-char (point-min)) | 425 (goto-char (point-min)) |
426 (if (re-search-forward | 426 (if (re-search-forward |
427 "https?://\\([^/]+hotmail\\.msn\\.com\\)/cgi-bin/" nil t) | 427 "https?://\\([^/]+hotmail\\.msn\\.com\\)/cgi-bin/" nil t) |
428 (setq site (match-string 1)) | 428 (setq site (match-string 1)) |
429 (webmail-error "list@1")) | 429 (webmail-error "list@1")) |
430 (goto-char (point-min)) | 430 (goto-char (point-min)) |
431 (if (re-search-forward "disk=\\([^&]*\\)&" nil t) | 431 (if (re-search-forward "disk=\\([^&]*\\)&" nil t) |
432 (setq webmail-aux | 432 (setq webmail-aux |
433 (concat "http://" site "/cgi-bin/HoTMaiL?disk=" | 433 (concat "http://" site "/cgi-bin/HoTMaiL?disk=" |
434 (match-string 1))) | 434 (match-string 1))) |
435 (webmail-error "list@2")) | 435 (webmail-error "list@2")) |
436 (goto-char (point-max)) | 436 (goto-char (point-max)) |
437 (while (re-search-backward | 437 (while (re-search-backward |
438 "newmail\\.gif\\|href=\"\\(/cgi-bin/getmsg\\?[^\"]+\\)\"" | 438 "newmail\\.gif\\|href=\"\\(/cgi-bin/getmsg\\?[^\"]+\\)\"" |
439 nil t) | 439 nil t) |
440 (if (setq url (match-string 1)) | 440 (if (setq url (match-string 1)) |
441 (progn | 441 (progn |
442 (if (or newp (not webmail-newmail-only)) | 442 (if (or newp (not webmail-newmail-only)) |
443 (let (id) | 443 (let (id) |
444 (if (string-match "msg=\\([^&]+\\)" url) | 444 (if (string-match "msg=\\([^&]+\\)" url) |
445 (setq id (match-string 1 url))) | 445 (setq id (match-string 1 url))) |
446 (push (cons id (concat "http://" site url "&raw=0")) | 446 (push (cons id (concat "http://" site url "&raw=0")) |
447 webmail-articles))) | 447 webmail-articles))) |
448 (setq newp nil)) | 448 (setq newp nil)) |
449 (setq newp t)))))) | 449 (setq newp t)))))) |
450 | 450 |
451 ;; Thank victor@idaccr.org (Victor S. Miller) for raw=0 | 451 ;; Thank victor@idaccr.org (Victor S. Miller) for raw=0 |
452 | 452 |
453 (defun webmail-hotmail-article (file id) | 453 (defun webmail-hotmail-article (file id) |
454 (goto-char (point-min)) | 454 (goto-char (point-min)) |
455 (skip-chars-forward " \t\n\r") | 455 (skip-chars-forward " \t\n\r") |
456 (unless (eobp) | 456 (unless (eobp) |
457 (if (not (search-forward "<pre>" nil t)) | 457 (if (not (search-forward "<pre>" nil t)) |
458 (webmail-error "article@3")) | 458 (webmail-error "article@3")) |
459 (skip-chars-forward "\n\r\t ") | 459 (skip-chars-forward "\n\r\t ") |
460 (delete-region (point-min) (point)) | 460 (delete-region (point-min) (point)) |
461 (if (not (search-forward "</pre>" nil t)) | 461 (if (not (search-forward "</pre>" nil t)) |
487 (setq hotmail-direct t)) | 487 (setq hotmail-direct t)) |
488 (goto-char (match-beginning 0))) | 488 (goto-char (match-beginning 0))) |
489 (narrow-to-region (point-min) (point)) | 489 (narrow-to-region (point-min) (point)) |
490 (if (not (search-backward "<table" nil t 2)) | 490 (if (not (search-backward "<table" nil t 2)) |
491 (webmail-error "article@1.1")) | 491 (webmail-error "article@1.1")) |
492 (delete-region (point-min) (match-beginning 0)) | 492 (delete-region (point-min) (match-beginning 0)) |
493 (while (search-forward "<a href=" nil t) | 493 (while (search-forward "<a href=" nil t) |
494 (setq p (match-beginning 0)) | 494 (setq p (match-beginning 0)) |
495 (search-forward "</a>" nil t) | 495 (search-forward "</a>" nil t) |
496 (delete-region p (match-end 0))) | 496 (delete-region p (match-end 0))) |
497 (nnweb-remove-markup) | 497 (nnweb-remove-markup) |
505 (delete-region (point) (point-max))) | 505 (delete-region (point) (point-max))) |
506 (goto-char (point-max)) | 506 (goto-char (point-max)) |
507 (widen) | 507 (widen) |
508 (insert "\n") | 508 (insert "\n") |
509 (setq p (point)) | 509 (setq p (point)) |
510 (while (re-search-forward | 510 (while (re-search-forward |
511 "<tt>\\|<div>\\|\\(http://[^/]+/cgi-bin/getmsg/\\([^\?]+\\)\?[^\"]*\\)\"" | 511 "<tt>\\|<div>\\|\\(http://[^/]+/cgi-bin/getmsg/\\([^\?]+\\)\?[^\"]*\\)\"" |
512 nil t) | 512 nil t) |
513 (if (setq attachment (match-string 1)) | 513 (if (setq attachment (match-string 1)) |
514 (let ((filename (match-string 2)) | 514 (let ((filename (match-string 2)) |
515 bufname);; Attachment | 515 bufname);; Attachment |
516 (delete-region p (match-end 0)) | 516 (delete-region p (match-end 0)) |
518 (set-buffer (generate-new-buffer " *webmail-att*")) | 518 (set-buffer (generate-new-buffer " *webmail-att*")) |
519 (nnweb-insert attachment) | 519 (nnweb-insert attachment) |
520 (push (current-buffer) webmail-buffer-list) | 520 (push (current-buffer) webmail-buffer-list) |
521 (setq bufname (buffer-name))) | 521 (setq bufname (buffer-name))) |
522 (setq mime t) | 522 (setq mime t) |
523 (insert "<#part type=" | 523 (insert "<#part type=" |
524 (or (and filename | 524 (or (and filename |
525 (string-match "\\.[^\\.]+$" filename) | 525 (string-match "\\.[^\\.]+$" filename) |
526 (mailcap-extension-to-mime | 526 (mailcap-extension-to-mime |
527 (match-string 0 filename))) | 527 (match-string 0 filename))) |
528 "application/octet-stream")) | 528 "application/octet-stream")) |
535 (if hotmail-direct | 535 (if hotmail-direct |
536 (if (not (search-forward "</tt>" nil t)) | 536 (if (not (search-forward "</tt>" nil t)) |
537 (webmail-error "article@1.2") | 537 (webmail-error "article@1.2") |
538 (delete-region (match-beginning 0) (match-end 0))) | 538 (delete-region (match-beginning 0) (match-end 0))) |
539 (setq count 1) | 539 (setq count 1) |
540 (while (and (> count 0) | 540 (while (and (> count 0) |
541 (re-search-forward "</div>\\|\\(<div>\\)" nil t)) | 541 (re-search-forward "</div>\\|\\(<div>\\)" nil t)) |
542 (if (match-string 1) | 542 (if (match-string 1) |
543 (setq count (1+ count)) | 543 (setq count (1+ count)) |
544 (if (= (setq count (1- count)) 0) | 544 (if (= (setq count (1- count)) 0) |
545 (delete-region (match-beginning 0) | 545 (delete-region (match-beginning 0) |
546 (match-end 0)))))) | 546 (match-end 0)))))) |
547 (narrow-to-region p (point)) | 547 (narrow-to-region p (point)) |
548 (goto-char (point-min)) | 548 (goto-char (point-min)) |
549 (cond | 549 (cond |
550 ((looking-at "<pre>") | 550 ((looking-at "<pre>") |
551 (goto-char (match-end 0)) | 551 (goto-char (match-end 0)) |
552 (if (looking-at "$") (forward-char)) | 552 (if (looking-at "$") (forward-char)) |
553 (delete-region (point-min) (point)) | 553 (delete-region (point-min) (point)) |
554 (nnweb-remove-markup) | 554 (nnweb-remove-markup) |
569 (insert "\n\nFrom nobody " (current-time-string) "\n") | 569 (insert "\n\nFrom nobody " (current-time-string) "\n") |
570 (insert "X-Gnus-Webmail: " (symbol-value 'user) | 570 (insert "X-Gnus-Webmail: " (symbol-value 'user) |
571 "@" (symbol-name webmail-type) "\n") | 571 "@" (symbol-name webmail-type) "\n") |
572 (if id | 572 (if id |
573 (insert (format "X-Message-ID: <%s@hotmail.com>\n" id))) | 573 (insert (format "X-Message-ID: <%s@hotmail.com>\n" id))) |
574 (unless (looking-at "$") | 574 (unless (looking-at "$") |
575 (if (search-forward "\n\n" nil t) | 575 (if (search-forward "\n\n" nil t) |
576 (forward-line -1) | 576 (forward-line -1) |
577 (webmail-error "article@2"))) | 577 (webmail-error "article@2"))) |
578 (narrow-to-region (point) (point-max)) | 578 (narrow-to-region (point) (point-max)) |
579 (if mime | 579 (if mime |
608 (webmail-error "login@2"))) | 608 (webmail-error "login@2"))) |
609 | 609 |
610 (defun webmail-yahoo-list () | 610 (defun webmail-yahoo-list () |
611 (let (url (newp t) (tofetch 0)) | 611 (let (url (newp t) (tofetch 0)) |
612 (goto-char (point-min)) | 612 (goto-char (point-min)) |
613 (when (re-search-forward | 613 (when (re-search-forward |
614 "showing [0-9]+-\\([0-9]+\\) of \\([0-9]+\\)" nil t) | 614 "showing [0-9]+-\\([0-9]+\\) of \\([0-9]+\\)" nil t) |
615 ;;(setq listed (match-string 1)) | 615 ;;(setq listed (match-string 1)) |
616 (message "Found %s mail(s)" (match-string 2))) | 616 (message "Found %s mail(s)" (match-string 2))) |
617 (if (string-match "http://[^/]+" webmail-aux) | 617 (if (string-match "http://[^/]+" webmail-aux) |
618 (setq webmail-aux (match-string 0 webmail-aux)) | 618 (setq webmail-aux (match-string 0 webmail-aux)) |
619 (webmail-error "list@1")) | 619 (webmail-error "list@1")) |
620 (goto-char (point-min)) | 620 (goto-char (point-min)) |
621 (while (re-search-forward | 621 (while (re-search-forward |
622 "bgcolor=\"#eeeeee\"\\|href=\"\\(/ym/ShowLetter\\?MsgId=\\([^&]+\\)&[^\"]*\\)\"" | 622 "bgcolor=\"#eeeeee\"\\|href=\"\\(/ym/ShowLetter\\?MsgId=\\([^&]+\\)&[^\"]*\\)\"" |
623 nil t) | 623 nil t) |
624 (if (setq url (match-string 1)) | 624 (if (setq url (match-string 1)) |
625 (progn | 625 (progn |
626 (when (or newp (not webmail-newmail-only)) | 626 (when (or newp (not webmail-newmail-only)) |
627 (push (cons (match-string 2) (concat webmail-aux url "&toc=1")) | 627 (push (cons (match-string 2) (concat webmail-aux url "&toc=1")) |
628 webmail-articles) | 628 webmail-articles) |
629 (setq tofetch (1+ tofetch))) | 629 (setq tofetch (1+ tofetch))) |
630 (setq newp t)) | 630 (setq newp t)) |
631 (setq newp nil))) | 631 (setq newp nil))) |
632 (setq webmail-articles (nreverse webmail-articles)) | 632 (setq webmail-articles (nreverse webmail-articles)) |
638 (goto-char (point-min)) | 638 (goto-char (point-min)) |
639 (if (not (search-forward "value=\"Done\"" nil t)) | 639 (if (not (search-forward "value=\"Done\"" nil t)) |
640 (webmail-error "article@1")) | 640 (webmail-error "article@1")) |
641 (if (not (search-forward "<table" nil t)) | 641 (if (not (search-forward "<table" nil t)) |
642 (webmail-error "article@2")) | 642 (webmail-error "article@2")) |
643 (delete-region (point-min) (match-beginning 0)) | 643 (delete-region (point-min) (match-beginning 0)) |
644 (if (not (search-forward "</table>" nil t)) | 644 (if (not (search-forward "</table>" nil t)) |
645 (webmail-error "article@3")) | 645 (webmail-error "article@3")) |
646 (narrow-to-region (point-min) (match-end 0)) | 646 (narrow-to-region (point-min) (match-end 0)) |
647 (while (search-forward "<a href=" nil t) | 647 (while (search-forward "<a href=" nil t) |
648 (setq p (match-beginning 0)) | 648 (setq p (match-beginning 0)) |
700 (insert "\n\nFrom nobody " (current-time-string) "\n") | 700 (insert "\n\nFrom nobody " (current-time-string) "\n") |
701 (insert "X-Gnus-Webmail: " (symbol-value 'user) | 701 (insert "X-Gnus-Webmail: " (symbol-value 'user) |
702 "@" (symbol-name webmail-type) "\n") | 702 "@" (symbol-name webmail-type) "\n") |
703 (if id | 703 (if id |
704 (insert (format "X-Message-ID: <%s@yahoo.com>\n" id))) | 704 (insert (format "X-Message-ID: <%s@yahoo.com>\n" id))) |
705 (unless (looking-at "$") | 705 (unless (looking-at "$") |
706 (if (search-forward "\n\n" nil t) | 706 (if (search-forward "\n\n" nil t) |
707 (forward-line -1) | 707 (forward-line -1) |
708 (webmail-error "article@2"))) | 708 (webmail-error "article@2"))) |
709 (narrow-to-region (point) (point-max)) | 709 (narrow-to-region (point) (point-max)) |
710 (insert "MIME-Version: 1.0\n" | 710 (insert "MIME-Version: 1.0\n" |
722 ;;; netaddress | 722 ;;; netaddress |
723 | 723 |
724 (defun webmail-netscape-open () | 724 (defun webmail-netscape-open () |
725 (goto-char (point-min)) | 725 (goto-char (point-min)) |
726 (setq webmail-aux "") | 726 (setq webmail-aux "") |
727 (while (re-search-forward | 727 (while (re-search-forward |
728 "TYPE=hidden *NAME=\\([^ ]+\\) *VALUE=\"\\([^\"]+\\)" | 728 "TYPE=hidden *NAME=\\([^ ]+\\) *VALUE=\"\\([^\"]+\\)" |
729 nil t) | 729 nil t) |
730 (setq webmail-aux (concat webmail-aux "&" (match-string 1) "=" | 730 (setq webmail-aux (concat webmail-aux "&" (match-string 1) "=" |
731 (match-string 2))))) | 731 (match-string 2))))) |
732 | 732 |
733 (defun webmail-netaddress-open () | 733 (defun webmail-netaddress-open () |
745 | 745 |
746 (defun webmail-netaddress-list () | 746 (defun webmail-netaddress-list () |
747 (webmail-refresh-redirect) | 747 (webmail-refresh-redirect) |
748 (let (item id) | 748 (let (item id) |
749 (goto-char (point-min)) | 749 (goto-char (point-min)) |
750 (when (re-search-forward | 750 (when (re-search-forward |
751 "(\\([0-9]+\\) unread, \\([0-9]+\\) total)" nil t) | 751 "(\\([0-9]+\\) unread, \\([0-9]+\\) total)" nil t) |
752 (message "Found %s mail(s), %s unread" | 752 (message "Found %s mail(s), %s unread" |
753 (match-string 2) (match-string 1))) | 753 (match-string 2) (match-string 1))) |
754 (goto-char (point-min)) | 754 (goto-char (point-min)) |
755 (while (re-search-forward | 755 (while (re-search-forward |
756 "MR\\[i\\]\\.R='\\([^']*\\)'\\|MR\\[i\\]\\.Q='\\([^']+\\)'" nil t) | 756 "MR\\[i\\]\\.R='\\([^']*\\)'\\|MR\\[i\\]\\.Q='\\([^']+\\)'" nil t) |
757 (if (setq id (match-string 2)) | 757 (if (setq id (match-string 2)) |
758 (setq item | 758 (setq item |
759 (cons id | 759 (cons id |
760 (format "%s/tpl/Message/%s/Read?Q=%s&FolderID=-4&SortUseCase=True&Sort=Date&Headers=True" | 760 (format "%s/tpl/Message/%s/Read?Q=%s&FolderID=-4&SortUseCase=True&Sort=Date&Headers=True" |
761 (car webmail-article-url) | 761 (car webmail-article-url) |
762 webmail-session id))) | 762 webmail-session id))) |
763 (if (or (not webmail-newmail-only) | 763 (if (or (not webmail-newmail-only) |
764 (equal (match-string 1) "True")) | 764 (equal (match-string 1) "True")) |
765 (push item webmail-articles)))) | 765 (push item webmail-articles)))) |
766 (setq webmail-articles (nreverse webmail-articles)))) | 766 (setq webmail-articles (nreverse webmail-articles)))) |
767 | 767 |
768 (defun webmail-netaddress-single-part () | 768 (defun webmail-netaddress-single-part () |
769 (goto-char (point-min)) | 769 (goto-char (point-min)) |
770 (cond | 770 (cond |
771 ((looking-at "[\t\040\r\n]*<font face=[^>]+>[\t\040\r\n]*") | 771 ((looking-at "[\t\040\r\n]*<font face=[^>]+>[\t\040\r\n]*") |
772 ;; text/plain | 772 ;; text/plain |
773 (replace-match "") | 773 (replace-match "") |
774 (while (re-search-forward "[\t\040\r\n]+" nil t) | 774 (while (re-search-forward "[\t\040\r\n]+" nil t) |
775 (replace-match " ")) | 775 (replace-match " ")) |
794 (goto-char (point-min)) | 794 (goto-char (point-min)) |
795 (if (not (search-forward "Trash" nil t)) | 795 (if (not (search-forward "Trash" nil t)) |
796 (webmail-error "article@1")) | 796 (webmail-error "article@1")) |
797 (if (not (search-forward "<form>" nil t)) | 797 (if (not (search-forward "<form>" nil t)) |
798 (webmail-error "article@2")) | 798 (webmail-error "article@2")) |
799 (delete-region (point-min) (match-beginning 0)) | 799 (delete-region (point-min) (match-beginning 0)) |
800 (if (not (search-forward "</form>" nil t)) | 800 (if (not (search-forward "</form>" nil t)) |
801 (webmail-error "article@3")) | 801 (webmail-error "article@3")) |
802 (narrow-to-region (point-min) (match-end 0)) | 802 (narrow-to-region (point-min) (match-end 0)) |
803 (goto-char (point-min)) | 803 (goto-char (point-min)) |
804 (while (re-search-forward "[\040\t\r\n]+" nil t) | 804 (while (re-search-forward "[\040\t\r\n]+" nil t) |
824 (unless (search-forward "<!-- Data -->" nil t) | 824 (unless (search-forward "<!-- Data -->" nil t) |
825 (webmail-error "article@4")) | 825 (webmail-error "article@4")) |
826 (forward-line 14) | 826 (forward-line 14) |
827 (delete-region p (point)) | 827 (delete-region p (point)) |
828 (goto-char (point-max)) | 828 (goto-char (point-max)) |
829 (unless (re-search-backward | 829 (unless (re-search-backward |
830 "[\040\t]*<br>[\040\t\r\n]*<br>[\040\t\r\n]*<form" p t) | 830 "[\040\t]*<br>[\040\t\r\n]*<br>[\040\t\r\n]*<form" p t) |
831 (webmail-error "article@5")) | 831 (webmail-error "article@5")) |
832 (delete-region (point) (point-max)) | 832 (delete-region (point) (point-max)) |
833 (goto-char p) | 833 (goto-char p) |
834 (while (search-forward | 834 (while (search-forward |
857 (insert " buffer=\"" bufname "\"") | 857 (insert " buffer=\"" bufname "\"") |
858 (insert " disposition=\"inline\"") | 858 (insert " disposition=\"inline\"") |
859 (insert "><#/part>\n") | 859 (insert "><#/part>\n") |
860 (setq p (point)))) | 860 (setq p (point)))) |
861 (delete-region p p1) | 861 (delete-region p p1) |
862 (narrow-to-region | 862 (narrow-to-region |
863 p | 863 p |
864 (if (search-forward | 864 (if (search-forward |
865 "<TABLE border=\"0\" WIDTH=\"98%\" cellpadding=0 cellspacing=0>" | 865 "<TABLE border=\"0\" WIDTH=\"98%\" cellpadding=0 cellspacing=0>" |
866 nil t) | 866 nil t) |
867 (match-beginning 0) | 867 (match-beginning 0) |
868 (point-max))) | 868 (point-max))) |
869 (webmail-netaddress-single-part) | 869 (webmail-netaddress-single-part) |
879 (insert "\n\nFrom nobody " (current-time-string) "\n") | 879 (insert "\n\nFrom nobody " (current-time-string) "\n") |
880 (insert "X-Gnus-Webmail: " (symbol-value 'user) | 880 (insert "X-Gnus-Webmail: " (symbol-value 'user) |
881 "@" (symbol-name webmail-type) "\n") | 881 "@" (symbol-name webmail-type) "\n") |
882 (if id | 882 (if id |
883 (insert (format "X-Message-ID: <%s@%s>\n" id webmail-address))) | 883 (insert (format "X-Message-ID: <%s@%s>\n" id webmail-address))) |
884 (unless (looking-at "$") | 884 (unless (looking-at "$") |
885 (if (search-forward "\n\n" nil t) | 885 (if (search-forward "\n\n" nil t) |
886 (forward-line -1) | 886 (forward-line -1) |
887 (webmail-error "article@2"))) | 887 (webmail-error "article@2"))) |
888 (when mime | 888 (when mime |
889 (narrow-to-region (point-min) (point)) | 889 (narrow-to-region (point-min) (point)) |
890 (goto-char (point-min)) | 890 (goto-char (point-min)) |
891 (while (not (eobp)) | 891 (while (not (eobp)) |
892 (if (looking-at "MIME-Version\\|Content-Type") | 892 (if (looking-at "MIME-Version\\|Content-Type") |
893 (delete-region (point) | 893 (delete-region (point) |
894 (progn | 894 (progn |
895 (forward-line 1) | 895 (forward-line 1) |
896 (if (re-search-forward "^[^ \t]" nil t) | 896 (if (re-search-forward "^[^ \t]" nil t) |
897 (goto-char (match-beginning 0)) | 897 (goto-char (match-beginning 0)) |
898 (point-max)))) | 898 (point-max)))) |
919 (goto-char (point-min)) | 919 (goto-char (point-min)) |
920 (if (not (search-forward "Trash" nil t)) | 920 (if (not (search-forward "Trash" nil t)) |
921 (webmail-error "article@1")) | 921 (webmail-error "article@1")) |
922 (if (not (search-forward "<form>" nil t)) | 922 (if (not (search-forward "<form>" nil t)) |
923 (webmail-error "article@2")) | 923 (webmail-error "article@2")) |
924 (delete-region (point-min) (match-beginning 0)) | 924 (delete-region (point-min) (match-beginning 0)) |
925 (if (not (search-forward "</form>" nil t)) | 925 (if (not (search-forward "</form>" nil t)) |
926 (webmail-error "article@3")) | 926 (webmail-error "article@3")) |
927 (narrow-to-region (point-min) (match-end 0)) | 927 (narrow-to-region (point-min) (match-end 0)) |
928 (goto-char (point-min)) | 928 (goto-char (point-min)) |
929 (while (re-search-forward "[\040\t\r\n]+" nil t) | 929 (while (re-search-forward "[\040\t\r\n]+" nil t) |
952 (unless (search-forward "<!-- Data -->" nil t) | 952 (unless (search-forward "<!-- Data -->" nil t) |
953 (webmail-error "article@4")) | 953 (webmail-error "article@4")) |
954 (forward-line 14) | 954 (forward-line 14) |
955 (delete-region p (point)) | 955 (delete-region p (point)) |
956 (goto-char (point-max)) | 956 (goto-char (point-max)) |
957 (unless (re-search-backward | 957 (unless (re-search-backward |
958 "<form name=\"Transfer2\"" p t) | 958 "<form name=\"Transfer2\"" p t) |
959 (webmail-error "article@5")) | 959 (webmail-error "article@5")) |
960 (delete-region (point) (point-max)) | 960 (delete-region (point) (point-max)) |
961 (goto-char p) | 961 (goto-char p) |
962 (while (search-forward | 962 (while (search-forward |
985 (insert " buffer=\"" bufname "\"") | 985 (insert " buffer=\"" bufname "\"") |
986 (insert " disposition=\"inline\"") | 986 (insert " disposition=\"inline\"") |
987 (insert "><#/part>\n") | 987 (insert "><#/part>\n") |
988 (setq p (point)))) | 988 (setq p (point)))) |
989 (delete-region p p1) | 989 (delete-region p p1) |
990 (narrow-to-region | 990 (narrow-to-region |
991 p | 991 p |
992 (if (search-forward | 992 (if (search-forward |
993 "<TABLE border=\"0\" WIDTH=\"98%\" cellpadding=0 cellspacing=0>" | 993 "<TABLE border=\"0\" WIDTH=\"98%\" cellpadding=0 cellspacing=0>" |
994 nil t) | 994 nil t) |
995 (match-beginning 0) | 995 (match-beginning 0) |
996 (point-max))) | 996 (point-max))) |
997 (webmail-netaddress-single-part) | 997 (webmail-netaddress-single-part) |
1007 (insert "\n\nFrom nobody " (current-time-string) "\n") | 1007 (insert "\n\nFrom nobody " (current-time-string) "\n") |
1008 (insert "X-Gnus-Webmail: " (symbol-value 'user) | 1008 (insert "X-Gnus-Webmail: " (symbol-value 'user) |
1009 "@" (symbol-name webmail-type) "\n") | 1009 "@" (symbol-name webmail-type) "\n") |
1010 (if id | 1010 (if id |
1011 (insert (format "X-Message-ID: <%s@%s>\n" id webmail-address))) | 1011 (insert (format "X-Message-ID: <%s@%s>\n" id webmail-address))) |
1012 (unless (looking-at "$") | 1012 (unless (looking-at "$") |
1013 (if (search-forward "\n\n" nil t) | 1013 (if (search-forward "\n\n" nil t) |
1014 (forward-line -1) | 1014 (forward-line -1) |
1015 (webmail-error "article@2"))) | 1015 (webmail-error "article@2"))) |
1016 (when mime | 1016 (when mime |
1017 (narrow-to-region (point-min) (point)) | 1017 (narrow-to-region (point-min) (point)) |
1018 (goto-char (point-min)) | 1018 (goto-char (point-min)) |
1019 (while (not (eobp)) | 1019 (while (not (eobp)) |
1020 (if (looking-at "MIME-Version\\|Content-Type") | 1020 (if (looking-at "MIME-Version\\|Content-Type") |
1021 (delete-region (point) | 1021 (delete-region (point) |
1022 (progn | 1022 (progn |
1023 (forward-line 1) | 1023 (forward-line 1) |
1024 (if (re-search-forward "^[^ \t]" nil t) | 1024 (if (re-search-forward "^[^ \t]" nil t) |
1025 (goto-char (match-beginning 0)) | 1025 (goto-char (match-beginning 0)) |
1026 (point-max)))) | 1026 (point-max)))) |
1043 ;;; my-deja | 1043 ;;; my-deja |
1044 | 1044 |
1045 (defun webmail-my-deja-open () | 1045 (defun webmail-my-deja-open () |
1046 (webmail-refresh-redirect) | 1046 (webmail-refresh-redirect) |
1047 (goto-char (point-min)) | 1047 (goto-char (point-min)) |
1048 (if (re-search-forward "action=\"\\([^\"]+login_confirm\\.xp[^\"]*\\)\"" | 1048 (if (re-search-forward "action=\"\\([^\"]+login_confirm\\.xp[^\"]*\\)\"" |
1049 nil t) | 1049 nil t) |
1050 (setq webmail-aux (match-string 1)) | 1050 (setq webmail-aux (match-string 1)) |
1051 (webmail-error "open@1"))) | 1051 (webmail-error "open@1"))) |
1052 | 1052 |
1053 (defun webmail-my-deja-list () | 1053 (defun webmail-my-deja-list () |
1054 (let (item id newp base) | 1054 (let (item id newp base) |
1055 (goto-char (point-min)) | 1055 (goto-char (point-min)) |
1056 (when (re-search-forward "href=\"\\(\\([^\"]*\\)/mailnf\\.[^\"]*\\)\"" | 1056 (when (re-search-forward "href=\"\\(\\([^\"]*\\)/mailnf\\.[^\"]*\\)\"" |
1057 nil t) | 1057 nil t) |
1058 (let ((url (match-string 1))) | 1058 (let ((url (match-string 1))) |
1059 (setq base (match-string 2)) | 1059 (setq base (match-string 2)) |
1060 (erase-buffer) | 1060 (erase-buffer) |
1061 (nnweb-insert url))) | 1061 (nnweb-insert url))) |
1062 (goto-char (point-min)) | 1062 (goto-char (point-min)) |
1063 (when (re-search-forward | 1063 (when (re-search-forward |
1064 "(\\([0-9]+\\) Message.?-[^>]*\\([0-9]+\\) New" | 1064 "(\\([0-9]+\\) Message.?-[^>]*\\([0-9]+\\) New" |
1065 nil t) | 1065 nil t) |
1066 (message "Found %s mail(s), %s unread" | 1066 (message "Found %s mail(s), %s unread" |
1067 (match-string 1) (match-string 2))) | 1067 (match-string 1) (match-string 2))) |
1068 (goto-char (point-min)) | 1068 (goto-char (point-min)) |
1069 (while (re-search-forward | 1069 (while (re-search-forward |
1070 "newmail\\.gif\\|href=\"[^\"]*\\(mailnf\\.[^\"]+act=view[^\"]+mid=\\([^\"&]+\\)[^\"]+\\)\"" | 1070 "newmail\\.gif\\|href=\"[^\"]*\\(mailnf\\.[^\"]+act=view[^\"]+mid=\\([^\"&]+\\)[^\"]+\\)\"" |
1071 nil t) | 1071 nil t) |
1072 (if (setq id (match-string 2)) | 1072 (if (setq id (match-string 2)) |
1073 (when (and (or newp (not webmail-newmail-only)) | 1073 (when (and (or newp (not webmail-newmail-only)) |
1074 (not (assoc id webmail-articles))) | 1074 (not (assoc id webmail-articles))) |
1075 (push (cons id (setq webmail-aux | 1075 (push (cons id (setq webmail-aux |
1076 (concat base "/" (match-string 1)))) | 1076 (concat base "/" (match-string 1)))) |
1077 webmail-articles) | 1077 webmail-articles) |
1078 (setq newp nil)) | 1078 (setq newp nil)) |
1079 (setq newp t))) | 1079 (setq newp t))) |
1080 (setq webmail-articles (nreverse webmail-articles)))) | 1080 (setq webmail-articles (nreverse webmail-articles)))) |
1081 | 1081 |
1082 (defun webmail-my-deja-article-part (base) | 1082 (defun webmail-my-deja-article-part (base) |
1083 (let (p) | 1083 (let (p) |
1084 (cond | 1084 (cond |
1085 ((looking-at "[\t\040\r\n]*<!--[^>]*>") | 1085 ((looking-at "[\t\040\r\n]*<!--[^>]*>") |
1086 (replace-match "")) | 1086 (replace-match "")) |
1087 ((looking-at "[\t\040\r\n]*</PRE>") | 1087 ((looking-at "[\t\040\r\n]*</PRE>") |
1088 (replace-match "")) | 1088 (replace-match "")) |
1089 ((looking-at "[\t\040\r\n]*<PRE>") | 1089 ((looking-at "[\t\040\r\n]*<PRE>") |
1111 (re-search-forward "<FONT[^>]+>\\([^<]+\\)" nil t)) | 1111 (re-search-forward "<FONT[^>]+>\\([^<]+\\)" nil t)) |
1112 (setq name (match-string 1))) | 1112 (setq name (match-string 1))) |
1113 (if (and (search-forward "File Type:" nil t) | 1113 (if (and (search-forward "File Type:" nil t) |
1114 (re-search-forward "<FONT[^>]+>\\([^<]+\\)" nil t)) | 1114 (re-search-forward "<FONT[^>]+>\\([^<]+\\)" nil t)) |
1115 (setq type (match-string 1))) | 1115 (setq type (match-string 1))) |
1116 (unless (re-search-forward "action=\"getattach\\.cgi/\\([^\"]+\\)" | 1116 (unless (re-search-forward "action=\"getattach\\.cgi/\\([^\"]+\\)" |
1117 nil t) | 1117 nil t) |
1118 (webmail-error "article@5")) | 1118 (webmail-error "article@5")) |
1119 (setq url (concat base "/getattach.cgi/" (match-string 1) | 1119 (setq url (concat base "/getattach.cgi/" (match-string 1) |
1120 "?sm=Download")) | 1120 "?sm=Download")) |
1121 (while (re-search-forward | 1121 (while (re-search-forward |
1122 "type=hidden name=\"\\([^\"]+\\)\" value=\"\\([^\"]+\\)" | 1122 "type=hidden name=\"\\([^\"]+\\)\" value=\"\\([^\"]+\\)" |
1123 nil t) | 1123 nil t) |
1124 (setq url (concat url "&" (match-string 1) "=" | 1124 (setq url (concat url "&" (match-string 1) "=" |
1125 (match-string 2)))) | 1125 (match-string 2)))) |
1126 (delete-region (point-min) (point-max)) | 1126 (delete-region (point-min) (point-max)) |
1127 (save-excursion | 1127 (save-excursion |
1142 (let (base) | 1142 (let (base) |
1143 (goto-char (point-min)) | 1143 (goto-char (point-min)) |
1144 (unless (string-match "\\([^\"]+\\)/mail" webmail-aux) | 1144 (unless (string-match "\\([^\"]+\\)/mail" webmail-aux) |
1145 (webmail-error "article@0")) | 1145 (webmail-error "article@0")) |
1146 (setq base (match-string 1 webmail-aux)) | 1146 (setq base (match-string 1 webmail-aux)) |
1147 (when (re-search-forward | 1147 (when (re-search-forward |
1148 "href=\"[^\"]*\\(mailnf\\.[^\"]+act=move[^\"]+mid=\\([^\"&]+\\)[^\"]+\\)\"" | 1148 "href=\"[^\"]*\\(mailnf\\.[^\"]+act=move[^\"]+mid=\\([^\"&]+\\)[^\"]+\\)\"" |
1149 nil t) | 1149 nil t) |
1150 (setq webmail-aux (concat base "/" (match-string 1))) | 1150 (setq webmail-aux (concat base "/" (match-string 1))) |
1151 (string-match "mid=[^\"&]+" webmail-aux) | 1151 (string-match "mid=[^\"&]+" webmail-aux) |
1152 (setq webmail-aux (replace-match "mid=%s" nil nil webmail-aux))) | 1152 (setq webmail-aux (replace-match "mid=%s" nil nil webmail-aux))) |
1173 (webmail-error "article@3")) | 1173 (webmail-error "article@3")) |
1174 (unless (search-backward "</TT>" nil t) | 1174 (unless (search-backward "</TT>" nil t) |
1175 (webmail-error "article@4")) | 1175 (webmail-error "article@4")) |
1176 (delete-region (point) (point-max)) | 1176 (delete-region (point) (point-max)) |
1177 (goto-char (point-min)) | 1177 (goto-char (point-min)) |
1178 (while (not (eobp)) | 1178 (while (not (eobp)) |
1179 (webmail-my-deja-article-part base)) | 1179 (webmail-my-deja-article-part base)) |
1180 (insert "MIME-Version: 1.0\n" | 1180 (insert "MIME-Version: 1.0\n" |
1181 (prog1 | 1181 (prog1 |
1182 (mml-generate-mime) | 1182 (mml-generate-mime) |
1183 (delete-region (point-min) (point-max))))) | 1183 (delete-region (point-min) (point-max))))) |