comparison lisp/gnus/webmail.el @ 88155:d7ddb3e565de

sync with trunk
author Henrik Enberg <henrik.enberg@telia.com>
date Mon, 16 Jan 2006 00:03:54 +0000
parents 53eebdb81828
children
comparison
equal deleted inserted replaced
88154:8ce476d3ba36 88155:d7ddb3e565de
1 ;;; webmail.el --- interface of web mail 1 ;;; webmail.el --- interface of web mail
2 ;; Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. 2
3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005 Free Software Foundation, Inc.
3 5
4 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu> 6 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
5 ;; Keywords: hotmail netaddress my-deja netscape 7 ;; Keywords: hotmail netaddress my-deja netscape
6 8
7 ;; This file is part of GNU Emacs. 9 ;; This file is part of GNU Emacs.
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 ;; General Public License for more details. 19 ;; General Public License for more details.
18 20
19 ;; You should have received a copy of the GNU General Public License 21 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the 22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 ;; Boston, MA 02111-1307, USA. 24 ;; Boston, MA 02110-1301, USA.
23 25
24 ;;; Commentary: 26 ;;; Commentary:
25 27
26 ;; Note: Now mail.yahoo.com provides POP3 service, the webmail 28 ;; Note: Now mail.yahoo.com provides POP3 service, the webmail
27 ;; fetching is not going to be supported. 29 ;; fetching is not going to be supported.
46 (require 'message) 48 (require 'message)
47 (require 'gnus-util) 49 (require 'gnus-util)
48 (require 'gnus) 50 (require 'gnus)
49 (require 'nnmail) 51 (require 'nnmail)
50 (require 'mm-util) 52 (require 'mm-util)
53 (require 'mm-url)
51 (require 'mml) 54 (require 'mml)
52 (eval-when-compile 55 (eval-when-compile
53 (ignore-errors 56 (ignore-errors
54 (require 'w3)
55 (require 'url) 57 (require 'url)
56 (require 'url-cookie) 58 (require 'url-cookie)))
57 (require 'w3-forms)
58 (require 'nnweb)))
59 ;; Report failure to find w3 at load time if appropriate. 59 ;; Report failure to find w3 at load time if appropriate.
60 (eval '(progn 60 (eval '(progn
61 (require 'w3)
62 (require 'url) 61 (require 'url)
63 (require 'url-cookie) 62 (require 'url-cookie)))
64 (require 'w3-forms)
65 (require 'nnweb)))
66 63
67 ;;; 64 ;;;
68 65
69 (defvar webmail-type-definition 66 (defvar webmail-type-definition
70 '((hotmail 67 '((hotmail
142 "http://webmail.netscape.com/tpl/Message/%s/Move?FolderID=-4&Q=%s&N=&Sort=Date&F=-1" 139 "http://webmail.netscape.com/tpl/Message/%s/Move?FolderID=-4&Q=%s&N=&Sort=Date&F=-1"
143 webmail-session id)) 140 webmail-session id))
144 (my-deja 141 (my-deja
145 (paranoid cookie post) 142 (paranoid cookie post)
146 (address . "www.my-deja.com") 143 (address . "www.my-deja.com")
147 (open-url "http://www.deja.com/my/pr.xp") 144 ;;(open-snarf . webmail-my-deja-open)
148 (open-snarf . webmail-my-deja-open)
149 (login-url 145 (login-url
150 content 146 content
151 ("%s" webmail-aux) 147 ("http://mydeja.google.com/cgi-bin/deja/maillogin.py")
152 "member_name=%s&pw=%s&go=&priv_opt_MyDeja99=" 148 "userid=%s&password=%s"
153 user password) 149 user password)
154 (list-url "http://www.deja.com/rg_gotomail.xp")
155 (list-snarf . webmail-my-deja-list) 150 (list-snarf . webmail-my-deja-list)
156 (article-snarf . webmail-my-deja-article) 151 (article-snarf . webmail-my-deja-article)
157 (trash-url webmail-aux id)))) 152 (trash-url webmail-aux id))))
158 153
159 (defvar webmail-variables 154 (defvar webmail-variables
201 (defun webmail-debug (str) 196 (defun webmail-debug (str)
202 (with-temp-buffer 197 (with-temp-buffer
203 (insert "\n---------------- A bug at " str " ------------------\n") 198 (insert "\n---------------- A bug at " str " ------------------\n")
204 (mapcar #'(lambda (sym) 199 (mapcar #'(lambda (sym)
205 (if (boundp sym) 200 (if (boundp sym)
206 (pp `(setq ,sym ',(eval sym)) (current-buffer)))) 201 (gnus-pp `(setq ,sym ',(eval sym)))))
207 '(webmail-type user)) 202 '(webmail-type user))
208 (insert "---------------- webmail buffer ------------------\n\n") 203 (insert "---------------- webmail buffer ------------------\n\n")
209 (insert-buffer-substring webmail-buffer) 204 (insert-buffer-substring webmail-buffer)
210 (insert "\n---------------- end of buffer ------------------\n\n") 205 (insert "\n---------------- end of buffer ------------------\n\n")
211 (append-to-file (point-min) (point-max) webmail-debug-file))) 206 (append-to-file (point-min) (point-max) webmail-debug-file)))
226 (dolist (var vars) 221 (dolist (var vars)
227 (if (setq pair (assq var type-def)) 222 (if (setq pair (assq var type-def))
228 (set (intern (concat "webmail-" (symbol-name var))) (cdr pair)) 223 (set (intern (concat "webmail-" (symbol-name var))) (cdr pair))
229 (set (intern (concat "webmail-" (symbol-name var))) nil))))) 224 (set (intern (concat "webmail-" (symbol-name var))) nil)))))
230 225
231 (defun webmail-encode-www-form-urlencoded (pairs)
232 "Return PAIRS encoded for forms."
233 (mapconcat
234 (function
235 (lambda (data)
236 (concat (w3-form-encode-xwfu (car data)) "="
237 (w3-form-encode-xwfu (cdr data)))))
238 pairs "&"))
239
240 (defun webmail-fetch-simple (url content)
241 (let ((url-request-data content)
242 (url-request-method "POST")
243 (url-request-extra-headers
244 '(("Content-type" . "application/x-www-form-urlencoded"))))
245 (nnweb-insert url))
246 t)
247
248 (defun webmail-fetch-form (url pairs)
249 (let ((url-request-data (webmail-encode-www-form-urlencoded pairs))
250 (url-request-method "POST")
251 (url-request-extra-headers
252 '(("Content-type" . "application/x-www-form-urlencoded"))))
253 (nnweb-insert url))
254 t)
255
256 (defun webmail-eval (expr) 226 (defun webmail-eval (expr)
257 (cond 227 (cond
258 ((consp expr) 228 ((consp expr)
259 (cons (webmail-eval (car expr)) (webmail-eval (cdr expr)))) 229 (cons (webmail-eval (car expr)) (webmail-eval (cdr expr))))
260 ((symbolp expr) 230 ((symbolp expr)
265 (defun webmail-url (xurl) 235 (defun webmail-url (xurl)
266 (mm-with-unibyte-current-buffer 236 (mm-with-unibyte-current-buffer
267 (cond 237 (cond
268 ((eq (car xurl) 'content) 238 ((eq (car xurl) 'content)
269 (pop xurl) 239 (pop xurl)
270 (webmail-fetch-simple (if (stringp (car xurl)) 240 (mm-url-fetch-simple (if (stringp (car xurl))
271 (car xurl) 241 (car xurl)
272 (apply 'format (webmail-eval (car xurl)))) 242 (apply 'format (webmail-eval (car xurl))))
273 (apply 'format (webmail-eval (cdr xurl))))) 243 (apply 'format (webmail-eval (cdr xurl)))))
274 ((eq (car xurl) 'post) 244 ((eq (car xurl) 'post)
275 (pop xurl) 245 (pop xurl)
276 (webmail-fetch-form (car xurl) (webmail-eval (cdr xurl)))) 246 (mm-url-fetch-form (car xurl) (webmail-eval (cdr xurl))))
277 (t 247 (t
278 (nnweb-insert (apply 'format (webmail-eval xurl))))))) 248 (mm-url-insert (apply 'format (webmail-eval xurl)))))))
279 249
280 (defun webmail-init () 250 (defun webmail-init ()
281 "Initialize buffers and such." 251 "Initialize buffers and such."
282 (if (gnus-buffer-live-p webmail-buffer) 252 (if (gnus-buffer-live-p webmail-buffer)
283 (set-buffer webmail-buffer) 253 (set-buffer webmail-buffer)
315 "<meta[ \t\r\n]*http-equiv=\"Refresh\"[^>]*URL=\\([^\"]+\\)\"" 285 "<meta[ \t\r\n]*http-equiv=\"Refresh\"[^>]*URL=\\([^\"]+\\)\""
316 nil t) 286 nil t)
317 (let ((url (match-string 1))) 287 (let ((url (match-string 1)))
318 (erase-buffer) 288 (erase-buffer)
319 (mm-with-unibyte-current-buffer 289 (mm-with-unibyte-current-buffer
320 (nnweb-insert url))) 290 (mm-url-insert url)))
321 (goto-char (point-min)))) 291 (goto-char (point-min))))
322 292
323 (defun webmail-fetch (file subtype user password) 293 (defun webmail-fetch (file subtype user password)
324 (save-excursion 294 (save-excursion
325 (webmail-setdefault subtype) 295 (webmail-setdefault subtype)
357 (funcall webmail-list-snarf)) 327 (funcall webmail-list-snarf))
358 (while (setq item (pop webmail-articles)) 328 (while (setq item (pop webmail-articles))
359 (message "Fetching mail #%d..." (setq n (1+ n))) 329 (message "Fetching mail #%d..." (setq n (1+ n)))
360 (erase-buffer) 330 (erase-buffer)
361 (mm-with-unibyte-current-buffer 331 (mm-with-unibyte-current-buffer
362 (nnweb-insert (cdr item))) 332 (mm-url-insert (cdr item)))
363 (setq id (car item)) 333 (setq id (car item))
364 (if webmail-article-snarf 334 (if webmail-article-snarf
365 (funcall webmail-article-snarf file id)) 335 (funcall webmail-article-snarf file id))
366 (when (and webmail-trash-url webmail-move-to-trash-can) 336 (when (and webmail-trash-url webmail-move-to-trash-can)
367 (message "Move mail #%d to trash can..." n) 337 (message "Move mail #%d to trash can..." n)
459 (skip-chars-forward "\n\r\t ") 429 (skip-chars-forward "\n\r\t ")
460 (delete-region (point-min) (point)) 430 (delete-region (point-min) (point))
461 (if (not (search-forward "</pre>" nil t)) 431 (if (not (search-forward "</pre>" nil t))
462 (webmail-error "article@3.1")) 432 (webmail-error "article@3.1"))
463 (delete-region (match-beginning 0) (point-max)) 433 (delete-region (match-beginning 0) (point-max))
464 (nnweb-remove-markup) 434 (mm-url-remove-markup)
465 (let ((w3-html-entities (cons '(nbsp . 32) w3-html-entities))) 435 (mm-url-decode-entities-nbsp)
466 (nnweb-decode-entities))
467 (goto-char (point-min)) 436 (goto-char (point-min))
468 (while (re-search-forward "\r\n?" nil t) 437 (while (re-search-forward "\r\n?" nil t)
469 (replace-match "\n")) 438 (replace-match "\n"))
470 (goto-char (point-min)) 439 (goto-char (point-min))
471 (insert "\n\n") 440 (insert "\n\n")
492 (delete-region (point-min) (match-beginning 0)) 461 (delete-region (point-min) (match-beginning 0))
493 (while (search-forward "<a href=" nil t) 462 (while (search-forward "<a href=" nil t)
494 (setq p (match-beginning 0)) 463 (setq p (match-beginning 0))
495 (search-forward "</a>" nil t) 464 (search-forward "</a>" nil t)
496 (delete-region p (match-end 0))) 465 (delete-region p (match-end 0)))
497 (nnweb-remove-markup) 466 (mm-url-remove-markup)
498 (let ((w3-html-entities (cons '(nbsp . 32) w3-html-entities))) 467 (mm-url-decode-entities-nbsp)
499 (nnweb-decode-entities))
500 (goto-char (point-min)) 468 (goto-char (point-min))
501 (delete-blank-lines) 469 (delete-blank-lines)
502 (goto-char (point-min)) 470 (goto-char (point-min))
503 (when (search-forward "\n\n" nil t) 471 (when (search-forward "\n\n" nil t)
504 (backward-char) 472 (backward-char)
514 (let ((filename (match-string 2)) 482 (let ((filename (match-string 2))
515 bufname);; Attachment 483 bufname);; Attachment
516 (delete-region p (match-end 0)) 484 (delete-region p (match-end 0))
517 (save-excursion 485 (save-excursion
518 (set-buffer (generate-new-buffer " *webmail-att*")) 486 (set-buffer (generate-new-buffer " *webmail-att*"))
519 (nnweb-insert attachment) 487 (mm-url-insert attachment)
520 (push (current-buffer) webmail-buffer-list) 488 (push (current-buffer) webmail-buffer-list)
521 (setq bufname (buffer-name))) 489 (setq bufname (buffer-name)))
522 (setq mime t) 490 (setq mime t)
523 (insert "<#part type=" 491 (insert "<#part type="
524 (or (and filename 492 (or (and filename
549 (cond 517 (cond
550 ((looking-at "<pre>") 518 ((looking-at "<pre>")
551 (goto-char (match-end 0)) 519 (goto-char (match-end 0))
552 (if (looking-at "$") (forward-char)) 520 (if (looking-at "$") (forward-char))
553 (delete-region (point-min) (point)) 521 (delete-region (point-min) (point))
554 (nnweb-remove-markup) 522 (mm-url-remove-markup)
555 (let ((w3-html-entities (cons '(nbsp . 32) w3-html-entities))) 523 (mm-url-decode-entities-nbsp)
556 (nnweb-decode-entities))
557 nil) 524 nil)
558 (t 525 (t
559 (setq mime t) 526 (setq mime t)
560 (insert "<#part type=\"text/html\" disposition=inline>") 527 (insert "<#part type=\"text/html\" disposition=inline>")
561 (goto-char (point-max)) 528 (goto-char (point-max))
646 (narrow-to-region (point-min) (match-end 0)) 613 (narrow-to-region (point-min) (match-end 0))
647 (while (search-forward "<a href=" nil t) 614 (while (search-forward "<a href=" nil t)
648 (setq p (match-beginning 0)) 615 (setq p (match-beginning 0))
649 (search-forward "</a>" nil t) 616 (search-forward "</a>" nil t)
650 (delete-region p (match-end 0))) 617 (delete-region p (match-end 0)))
651 (nnweb-remove-markup) 618 (mm-url-remove-markup)
652 (let ((w3-html-entities (cons '(nbsp . 32) w3-html-entities))) 619 (mm-url-decode-entities-nbsp)
653 (nnweb-decode-entities))
654 (goto-char (point-min)) 620 (goto-char (point-min))
655 (delete-blank-lines) 621 (delete-blank-lines)
656 (goto-char (point-max)) 622 (goto-char (point-max))
657 (widen) 623 (widen)
658 (insert "\n") 624 (insert "\n")
664 (webmail-error "article@4")) 630 (webmail-error "article@4"))
665 (delete-region p (match-beginning 0)) 631 (delete-region p (match-beginning 0))
666 (if (not (search-forward "</table>" nil t)) 632 (if (not (search-forward "</table>" nil t))
667 (webmail-error "article@5")) 633 (webmail-error "article@5"))
668 (narrow-to-region p (match-end 0)) 634 (narrow-to-region p (match-end 0))
669 (nnweb-remove-markup) 635 (mm-url-remove-markup)
670 (let ((w3-html-entities (cons '(nbsp . 32) w3-html-entities))) 636 (mm-url-decode-entities-nbsp)
671 (nnweb-decode-entities))
672 (goto-char (point-min)) 637 (goto-char (point-min))
673 (delete-blank-lines) 638 (delete-blank-lines)
674 (setq ct (mail-fetch-field "content-type") 639 (setq ct (mail-fetch-field "content-type")
675 ctl (ignore-errors (mail-header-parse-content-type ct)) 640 ctl (ignore-errors (mail-header-parse-content-type ct))
676 ;;cte (mail-fetch-field "content-transfer-encoding") 641 ;;cte (mail-fetch-field "content-transfer-encoding")
679 id (mail-fetch-field "content-id")) 644 id (mail-fetch-field "content-id"))
680 (delete-region (point-min) (point-max)) 645 (delete-region (point-min) (point-max))
681 (widen) 646 (widen)
682 (save-excursion 647 (save-excursion
683 (set-buffer (generate-new-buffer " *webmail-att*")) 648 (set-buffer (generate-new-buffer " *webmail-att*"))
684 (nnweb-insert (concat webmail-aux attachment)) 649 (mm-url-insert (concat webmail-aux attachment))
685 (push (current-buffer) webmail-buffer-list) 650 (push (current-buffer) webmail-buffer-list)
686 (setq bufname (buffer-name))) 651 (setq bufname (buffer-name)))
687 (insert "<#part") 652 (insert "<#part")
688 (if (and ctl (not (equal (car ctl) "text/"))) 653 (if (and ctl (not (equal (car ctl) "text/")))
689 (insert " type=\"" (car ctl) "\"")) 654 (insert " type=\"" (car ctl) "\""))
774 (while (re-search-forward "[\t\040\r\n]+" nil t) 739 (while (re-search-forward "[\t\040\r\n]+" nil t)
775 (replace-match " ")) 740 (replace-match " "))
776 (goto-char (point-min)) 741 (goto-char (point-min))
777 (while (re-search-forward "<br>" nil t) 742 (while (re-search-forward "<br>" nil t)
778 (replace-match "\n")) 743 (replace-match "\n"))
779 (nnweb-remove-markup) 744 (mm-url-remove-markup)
780 (let ((w3-html-entities (cons '(nbsp . 32) w3-html-entities))) 745 (mm-url-decode-entities-nbsp)
781 (nnweb-decode-entities))
782 nil) 746 nil)
783 (t 747 (t
784 (insert "<#part type=\"text/html\" disposition=inline>") 748 (insert "<#part type=\"text/html\" disposition=inline>")
785 (goto-char (point-max)) 749 (goto-char (point-max))
786 (insert "<#/part>") 750 (insert "<#/part>")
804 (while (re-search-forward "[\040\t\r\n]+" nil t) 768 (while (re-search-forward "[\040\t\r\n]+" nil t)
805 (replace-match " ")) 769 (replace-match " "))
806 (goto-char (point-min)) 770 (goto-char (point-min))
807 (while (search-forward "<b>" nil t) 771 (while (search-forward "<b>" nil t)
808 (replace-match "\n")) 772 (replace-match "\n"))
809 (nnweb-remove-markup) 773 (mm-url-remove-markup)
810 (let ((w3-html-entities (cons '(nbsp . 32) w3-html-entities))) 774 (mm-url-decode-entities-nbsp)
811 (nnweb-decode-entities))
812 (goto-char (point-min)) 775 (goto-char (point-min))
813 (delete-blank-lines) 776 (delete-blank-lines)
814 (goto-char (point-min)) 777 (goto-char (point-min))
815 (while (re-search-forward "^\040+\\|\040+$" nil t) 778 (while (re-search-forward "^\040+\\|\040+$" nil t)
816 (replace-match "")) 779 (replace-match ""))
848 (webmail-error "article@8")) 811 (webmail-error "article@8"))
849 (delete-region p (point)) 812 (delete-region p (point))
850 (let (bufname);; Attachment 813 (let (bufname);; Attachment
851 (save-excursion 814 (save-excursion
852 (set-buffer (generate-new-buffer " *webmail-att*")) 815 (set-buffer (generate-new-buffer " *webmail-att*"))
853 (nnweb-insert (concat (car webmail-open-url) attachment)) 816 (mm-url-insert (concat (car webmail-open-url) attachment))
854 (push (current-buffer) webmail-buffer-list) 817 (push (current-buffer) webmail-buffer-list)
855 (setq bufname (buffer-name))) 818 (setq bufname (buffer-name)))
856 (insert "<#part type=" type) 819 (insert "<#part type=" type)
857 (insert " buffer=\"" bufname "\"") 820 (insert " buffer=\"" bufname "\"")
858 (insert " disposition=\"inline\"") 821 (insert " disposition=\"inline\"")
932 (while (re-search-forward "<a href=[^>]*>[^<]*</a>" nil t) 895 (while (re-search-forward "<a href=[^>]*>[^<]*</a>" nil t)
933 (replace-match "")) 896 (replace-match ""))
934 (goto-char (point-min)) 897 (goto-char (point-min))
935 (while (search-forward "<b>" nil t) 898 (while (search-forward "<b>" nil t)
936 (replace-match "\n")) 899 (replace-match "\n"))
937 (nnweb-remove-markup) 900 (mm-url-remove-markup)
938 (let ((w3-html-entities (cons '(nbsp . 32) w3-html-entities))) 901 (mm-url-decode-entities-nbsp)
939 (nnweb-decode-entities))
940 (goto-char (point-min)) 902 (goto-char (point-min))
941 (delete-blank-lines) 903 (delete-blank-lines)
942 (goto-char (point-min)) 904 (goto-char (point-min))
943 (while (re-search-forward "^\040+\\|\040+$" nil t) 905 (while (re-search-forward "^\040+\\|\040+$" nil t)
944 (replace-match "")) 906 (replace-match ""))
976 (webmail-error "article@8")) 938 (webmail-error "article@8"))
977 (delete-region p (point)) 939 (delete-region p (point))
978 (let (bufname);; Attachment 940 (let (bufname);; Attachment
979 (save-excursion 941 (save-excursion
980 (set-buffer (generate-new-buffer " *webmail-att*")) 942 (set-buffer (generate-new-buffer " *webmail-att*"))
981 (nnweb-insert (concat (car webmail-open-url) attachment)) 943 (mm-url-insert (concat (car webmail-open-url) attachment))
982 (push (current-buffer) webmail-buffer-list) 944 (push (current-buffer) webmail-buffer-list)
983 (setq bufname (buffer-name))) 945 (setq bufname (buffer-name)))
984 (insert "<#part type=" type) 946 (insert "<#part type=" type)
985 (insert " buffer=\"" bufname "\"") 947 (insert " buffer=\"" bufname "\"")
986 (insert " disposition=\"inline\"") 948 (insert " disposition=\"inline\"")
1043 ;;; my-deja 1005 ;;; my-deja
1044 1006
1045 (defun webmail-my-deja-open () 1007 (defun webmail-my-deja-open ()
1046 (webmail-refresh-redirect) 1008 (webmail-refresh-redirect)
1047 (goto-char (point-min)) 1009 (goto-char (point-min))
1048 (if (re-search-forward "action=\"\\([^\"]+login_confirm\\.xp[^\"]*\\)\"" 1010 (if (re-search-forward "action=\"\\([^\"]+maillogin\\.py[^\"]*\\)\""
1049 nil t) 1011 nil t)
1050 (setq webmail-aux (match-string 1)) 1012 (setq webmail-aux (match-string 1))
1051 (webmail-error "open@1"))) 1013 (webmail-error "open@1")))
1052 1014
1053 (defun webmail-my-deja-list () 1015 (defun webmail-my-deja-list ()
1056 (when (re-search-forward "href=\"\\(\\([^\"]*\\)/mailnf\\.[^\"]*\\)\"" 1018 (when (re-search-forward "href=\"\\(\\([^\"]*\\)/mailnf\\.[^\"]*\\)\""
1057 nil t) 1019 nil t)
1058 (let ((url (match-string 1))) 1020 (let ((url (match-string 1)))
1059 (setq base (match-string 2)) 1021 (setq base (match-string 2))
1060 (erase-buffer) 1022 (erase-buffer)
1061 (nnweb-insert url))) 1023 (mm-url-insert url)))
1062 (goto-char (point-min)) 1024 (goto-char (point-min))
1063 (when (re-search-forward 1025 (when (re-search-forward
1064 "(\\([0-9]+\\) Message.?-[^>]*\\([0-9]+\\) New" 1026 "(\\([0-9]+\\) Message.?-[^>]*\\([0-9]+\\) New"
1065 nil t) 1027 nil t)
1066 (message "Found %s mail(s), %s unread" 1028 (message "Found %s mail(s), %s unread"
1093 (narrow-to-region (point) 1055 (narrow-to-region (point)
1094 (if (re-search-forward "</?PRE>" nil t) 1056 (if (re-search-forward "</?PRE>" nil t)
1095 (match-beginning 0) 1057 (match-beginning 0)
1096 (point-max))) 1058 (point-max)))
1097 (goto-char (point-min)) 1059 (goto-char (point-min))
1098 (nnweb-remove-markup) 1060 (mm-url-remove-markup)
1099 (let ((w3-html-entities (cons '(nbsp . 32) w3-html-entities))) 1061 (mm-url-decode-entities-nbsp)
1100 (nnweb-decode-entities))
1101 (goto-char (point-max)))) 1062 (goto-char (point-max))))
1102 ((looking-at "[\t\040\r\n]*<TABLE") 1063 ((looking-at "[\t\040\r\n]*<TABLE")
1103 (save-restriction 1064 (save-restriction
1104 (narrow-to-region (point) 1065 (narrow-to-region (point)
1105 (if (search-forward "</TABLE>" nil t 2) 1066 (if (search-forward "</TABLE>" nil t 2)
1124 (setq url (concat url "&" (match-string 1) "=" 1085 (setq url (concat url "&" (match-string 1) "="
1125 (match-string 2)))) 1086 (match-string 2))))
1126 (delete-region (point-min) (point-max)) 1087 (delete-region (point-min) (point-max))
1127 (save-excursion 1088 (save-excursion
1128 (set-buffer (generate-new-buffer " *webmail-att*")) 1089 (set-buffer (generate-new-buffer " *webmail-att*"))
1129 (nnweb-insert url) 1090 (mm-url-insert url)
1130 (push (current-buffer) webmail-buffer-list) 1091 (push (current-buffer) webmail-buffer-list)
1131 (setq bufname (buffer-name))) 1092 (setq bufname (buffer-name)))
1132 (insert "<#part type=\"" type "\"") 1093 (insert "<#part type=\"" type "\"")
1133 (if name (insert " filename=\"" name "\"")) 1094 (if name (insert " filename=\"" name "\""))
1134 (insert " buffer=\"" bufname "\"") 1095 (insert " buffer=\"" bufname "\"")
1157 (webmail-error "article@2")) 1118 (webmail-error "article@2"))
1158 (save-restriction 1119 (save-restriction
1159 (narrow-to-region (point-min) (point)) 1120 (narrow-to-region (point-min) (point))
1160 (while (search-forward "\r\n" nil t) 1121 (while (search-forward "\r\n" nil t)
1161 (replace-match "\n")) 1122 (replace-match "\n"))
1162 (nnweb-remove-markup) 1123 (mm-url-remove-markup)
1163 (let ((w3-html-entities (cons '(nbsp . 32) w3-html-entities))) 1124 (mm-url-decode-entities-nbsp)
1164 (nnweb-decode-entities))
1165 (goto-char (point-min)) 1125 (goto-char (point-min))
1166 (while (re-search-forward "\n\n+" nil t) 1126 (while (re-search-forward "\n\n+" nil t)
1167 (replace-match "\n")) 1127 (replace-match "\n"))
1168 (goto-char (point-max))) 1128 (goto-char (point-max)))
1169 (save-restriction 1129 (save-restriction
1189 (delete-char 1)) 1149 (delete-char 1))
1190 (mm-append-to-file (point-min) (point-max) file))) 1150 (mm-append-to-file (point-min) (point-max) file)))
1191 1151
1192 (provide 'webmail) 1152 (provide 'webmail)
1193 1153
1154 ;;; arch-tag: f75a4558-a8f6-46ec-b1c3-7a6434b3dd71
1194 ;;; webmail.el ends here 1155 ;;; webmail.el ends here