X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fwebmail.el;h=b98bb696dd64e01993716f6c437d3f5ae70211c0;hb=1a6d3c2c61e683afe1a993fc82fb0e824968433f;hp=21106245b1a35ab867c6ebbfa6e5e219e71f06e6;hpb=3c19a9d1054e341f806d39714ddf1d70b03ef142;p=elisp%2Fgnus.git- diff --git a/lisp/webmail.el b/lisp/webmail.el index 2110624..b98bb69 100644 --- a/lisp/webmail.el +++ b/lisp/webmail.el @@ -1,5 +1,5 @@ -;;; webmail.el --- interfacing with web mail -;; Copyright (C) 1999, 2000 Free Software Foundation, Inc. +;;; webmail.el --- interface of web mail +;; Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. ;; Author: Shenghuo Zhu ;; Keywords: hotmail netaddress my-deja netscape @@ -32,7 +32,7 @@ ;; Todo: To support more web mail servers. -;; Known bugs: +;; Known bugs: ;; 1. Net@ddress may corrupt `X-Face'. ;; Warning: @@ -48,21 +48,16 @@ (require 'gnus) (require 'nnmail) (require 'mm-util) +(require 'mm-url) (require 'mml) (eval-when-compile (ignore-errors - (require 'w3) (require 'url) - (require 'url-cookie) - (require 'w3-forms) - (require 'nnweb))) + (require 'url-cookie))) ;; Report failure to find w3 at load time if appropriate. (eval '(progn - (require 'w3) (require 'url) - (require 'url-cookie) - (require 'w3-forms) - (require 'nnweb))) + (require 'url-cookie))) ;;; @@ -77,12 +72,12 @@ (login-url "http://%s/cgi-bin/dologin?login=%s&passwd=%s&enter=Sign+in&sec=no&curmbox=ACTIVE&_lang=&js=yes&id=2&tw=-10000&beta=" webmail-aux user password) - (login-snarf . webmail-hotmail-login) - (list-url "%s" webmail-aux) + ;;(login-snarf . webmail-hotmail-login) + ;;(list-url "%s" webmail-aux) (list-snarf . webmail-hotmail-list) (article-snarf . webmail-hotmail-article) - (trash-url - "%s&login=%s&f=33792&curmbox=ACTIVE&_lang=&foo=inbox&js=&page=&%s=on&_HMaction=MoveTo&tobox=trAsH&nullbox=" + (trash-url + "%s&login=%s&f=33792&curmbox=ACTIVE&_lang=&foo=inbox&js=&page=&%s=on&_HMaction=MoveTo&tobox=trAsH&nullbox=" webmail-aux user id)) (yahoo (paranoid agent cookie post) @@ -90,7 +85,7 @@ (open-url "http://mail.yahoo.com/") (open-snarf . webmail-yahoo-open) (login-url;; yahoo will not accept GET - content + content ("%s" webmail-aux) ".tries=&.src=ym&.last=&promo=&.intl=&.bypass=&.partner=&.chkP=Y&.done=&login=%s&passwd=%s" user password) @@ -98,7 +93,7 @@ (list-url "%s&rb=Inbox&YN=1" webmail-aux) (list-snarf . webmail-yahoo-list) (article-snarf . webmail-yahoo-article) - (trash-url + (trash-url "%s/ym/ShowFolder?YY=52107&inc=50&order=down&sort=date&pos=0&box=Inbox&DEL=Delete&destBox=&Mid=%s&destBox2=" webmail-aux id)) (netaddress @@ -107,18 +102,18 @@ (open-url "http://www.netaddress.com/") (open-snarf . webmail-netaddress-open) (login-url - content + content ("%s" webmail-aux) - "LoginState=2&SuccessfulLogin=%%2Ftpl&NewServerName=www.netaddress.com&JavaScript=JavaScript1.2&DomainID=4&NA31site=classic.netaddress.com&NA31port=80&UserID=%s&passwd=%s" + "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" user password) (login-snarf . webmail-netaddress-login) - (list-url + (list-url "http://www.netaddress.com/tpl/Mail/%s/List?FolderID=-4&SortUseCase=True" webmail-session) (list-snarf . webmail-netaddress-list) (article-url "http://www.netaddress.com/") (article-snarf . webmail-netaddress-article) - (trash-url + (trash-url "http://www.netaddress.com/tpl/Message/%s/Move?FolderID=-4&Q=%s&N=&Sort=Date&F=-1" webmail-session id)) (netscape @@ -127,39 +122,35 @@ (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") (open-snarf . webmail-netscape-open) (login-url - content + content ("http://ureg.netscape.com/iiop/UReg2/login/loginform") - "%s&U2_USERNAME=%s&U2_PASSWORD=%s" - webmail-aux user password) + "U2_USERNAME=%s&U2_PASSWORD=%s%s" + user password webmail-aux) (login-snarf . webmail-netaddress-login) - (list-url + (list-url "http://webmail.netscape.com/tpl/Mail/%s/List?FolderID=-4&SortUseCase=True" webmail-session) (list-snarf . webmail-netaddress-list) (article-url "http://webmail.netscape.com/") (article-snarf . webmail-netscape-article) - (trash-url + (trash-url "http://webmail.netscape.com/tpl/Message/%s/Move?FolderID=-4&Q=%s&N=&Sort=Date&F=-1" webmail-session id)) (my-deja (paranoid cookie post) (address . "www.my-deja.com") - (open-url "http://www.my-deja.com/") - (open-snarf . webmail-my-deja-open) + ;;(open-snarf . webmail-my-deja-open) (login-url - content - ("%s" webmail-aux) - "member_name=%s&pw=%s&go=&priv_opt_MyDeja99=" + content + ("http://mydeja.google.com/cgi-bin/deja/maillogin.py") + "userid=%s&password=%s" user password) - (list-url "http://www.deja.com/rg_gotomail.xp") (list-snarf . webmail-my-deja-list) (article-snarf . webmail-my-deja-article) - (trash-url - "%s/gmm_multiplex.femail?%%2Fgmm_domovemesg_top.femail=Move+to%%3A&folder_top=%s%%3Azzz%%3A%%7E6trash%%3AF%%3A0&docid=%s" - webmail-aux user id)))) + (trash-url webmail-aux id)))) (defvar webmail-variables - '(address article-snarf article-url list-snarf list-url + '(address article-snarf article-url list-snarf list-url login-url login-snarf open-url open-snarf site articles post-process paranoid trash-url)) @@ -203,7 +194,7 @@ (defun webmail-debug (str) (with-temp-buffer (insert "\n---------------- A bug at " str " ------------------\n") - (mapcar #'(lambda (sym) + (mapcar #'(lambda (sym) (if (boundp sym) (pp `(setq ,sym ',(eval sym)) (current-buffer)))) '(webmail-type user)) @@ -215,9 +206,9 @@ (defun webmail-error (str) (if webmail-error-function (funcall webmail-error-function str)) - (message "%s HTML has changed; please get a new version of webmail (%s)" + (message "%s HTML has changed or your w3 package is too old.(%s)" webmail-type str) - (error "%s HTML has changed; please get a new version of webmail (%s)" + (error "%s HTML has changed or your w3 package is too old.(%s)" webmail-type str)) (defun webmail-setdefault (type) @@ -230,31 +221,6 @@ (set (intern (concat "webmail-" (symbol-name var))) (cdr pair)) (set (intern (concat "webmail-" (symbol-name var))) nil))))) -(defun webmail-encode-www-form-urlencoded (pairs) - "Return PAIRS encoded for forms." - (mapconcat - (function - (lambda (data) - (concat (w3-form-encode-xwfu (car data)) "=" - (w3-form-encode-xwfu (cdr data))))) - pairs "&")) - -(defun webmail-fetch-simple (url content) - (let ((url-request-data content) - (url-request-method "POST") - (url-request-extra-headers - '(("Content-type" . "application/x-www-form-urlencoded")))) - (nnweb-insert url)) - t) - -(defun webmail-fetch-form (url pairs) - (let ((url-request-data (webmail-encode-www-form-urlencoded pairs)) - (url-request-method "POST") - (url-request-extra-headers - '(("Content-type" . "application/x-www-form-urlencoded")))) - (nnweb-insert url)) - t) - (defun webmail-eval (expr) (cond ((consp expr) @@ -266,26 +232,26 @@ (defun webmail-url (xurl) (mm-with-unibyte-current-buffer - (cond + (cond ((eq (car xurl) 'content) (pop xurl) - (webmail-fetch-simple (if (stringp (car xurl)) + (mm-url-fetch-simple (if (stringp (car xurl)) (car xurl) (apply 'format (webmail-eval (car xurl)))) (apply 'format (webmail-eval (cdr xurl))))) ((eq (car xurl) 'post) (pop xurl) - (webmail-fetch-form (car xurl) (webmail-eval (cdr xurl)))) + (mm-url-fetch-form (car xurl) (webmail-eval (cdr xurl)))) (t - (nnweb-insert (apply 'format (webmail-eval xurl))))))) - + (mm-url-insert (apply 'format (webmail-eval xurl))))))) + (defun webmail-init () "Initialize buffers and such." (if (gnus-buffer-live-p webmail-buffer) (set-buffer webmail-buffer) (setq webmail-buffer - (mm-with-unibyte - (nnheader-set-temp-buffer " *webmail*"))))) + (nnheader-set-temp-buffer " *webmail*")) + (mm-disable-multibyte))) (defvar url-package-name) (defvar url-package-version) @@ -302,7 +268,7 @@ ;; instead of 303, though they mean 303. (defun webmail-url-confirmation-func (prompt) - (cond + (cond ((equal prompt (concat "Honor redirection with non-GET method " "(possible security risks)? ")) nil) @@ -313,13 +279,13 @@ (defun webmail-refresh-redirect () "Redirect refresh url in META." (goto-char (point-min)) - (while (re-search-forward - "HTTP-EQUIV=\"Refresh\"[^>]*URL=\\([^\"]+\\)\"" + (while (re-search-forward + "]*URL=\\([^\"]+\\)\"" nil t) (let ((url (match-string 1))) (erase-buffer) (mm-with-unibyte-current-buffer - (nnweb-insert url))) + (mm-url-insert url))) (goto-char (point-min)))) (defun webmail-fetch (file subtype user password) @@ -337,32 +303,33 @@ (url-confirmation-func (if (memq 'post webmail-paranoid) 'webmail-url-confirmation-func url-confirmation-func)) + (url-http-silence-on-insecure-redirection t) url-cookie-storage url-cookie-secure-storage url-cookie-confirmation item id (n 0)) (webmail-init) (setq webmail-articles nil) - (when webmail-open-url + (when webmail-open-url (erase-buffer) (webmail-url webmail-open-url)) (if webmail-open-snarf (funcall webmail-open-snarf)) - (when webmail-login-url + (when webmail-login-url (erase-buffer) (webmail-url webmail-login-url)) - (if webmail-login-snarf + (if webmail-login-snarf (funcall webmail-login-snarf)) - (when webmail-list-url + (when webmail-list-url (erase-buffer) (webmail-url webmail-list-url)) - (if webmail-list-snarf + (if webmail-list-snarf (funcall webmail-list-snarf)) (while (setq item (pop webmail-articles)) (message "Fetching mail #%d..." (setq n (1+ n))) (erase-buffer) (mm-with-unibyte-current-buffer - (nnweb-insert (cdr item))) + (mm-url-insert (cdr item))) (setq id (car item)) - (if webmail-article-snarf + (if webmail-article-snarf (funcall webmail-article-snarf file id)) (when (and webmail-trash-url webmail-move-to-trash-can) (message "Move mail #%d to trash can..." n) @@ -372,7 +339,7 @@ (let (buf) (while (setq buf (pop webmail-buffer-list)) (kill-buffer buf)))) - (error + (error (let (buf) (while (setq buf (pop webmail-buffer-list)) (kill-buffer buf))) @@ -392,7 +359,7 @@ (defun webmail-hotmail-open () (goto-char (point-min)) - (if (re-search-forward + (if (re-search-forward "action=\"https?://\\([^/]+\\)/cgi-bin/dologin" nil t) (setq webmail-aux (match-string 1)) (webmail-error "open@1"))) @@ -400,70 +367,81 @@ (defun webmail-hotmail-login () (let (site) (goto-char (point-min)) - (if (re-search-forward + (if (re-search-forward "https?://\\([^/]+hotmail\\.msn\\.com\\)/cgi-bin/" nil t) (setq site (match-string 1)) (webmail-error "login@1")) (goto-char (point-min)) - (if (re-search-forward - "\\(/cgi-bin/HoTMaiL\\?[^\"]*curmbox=ACTIVE[^\"]*\\)" nil t) + (if (re-search-forward + "\\(/cgi-bin/HoTMaiL\\?[^\"]*a=b[^\"]*\\)" nil t) (setq webmail-aux (concat "http://" site (match-string 1))) (webmail-error "login@2")))) (defun webmail-hotmail-list () - (let (site url newp) - (goto-char (point-min)) - (if (re-search-forward "[0-9]+ new" nil t) - (message "Found %s" (match-string 0)) - (webmail-error "maybe your w3 version is too old")) - (goto-char (point-min)) - (if (re-search-forward + (goto-char (point-min)) + (skip-chars-forward " \t\n\r") + (let (site url newp (total "0")) + (if (eobp) + (setq total "0") + (if (re-search-forward "\\([0-9]+\\) *(\\([0-9]+\\) new)" nil t) + (message "Found %s (%s new)" (setq total (match-string 1)) + (match-string 2)) + (if (re-search-forward "\\([0-9]+\\) new" nil t) + (message "Found %s new" (setq total (match-string 1))) + (webmail-error "list@0")))) + (unless (equal total "0") + (goto-char (point-min)) + (if (re-search-forward "https?://\\([^/]+hotmail\\.msn\\.com\\)/cgi-bin/" nil t) - (setq site (match-string 1)) - (webmail-error "list@1")) - (goto-char (point-min)) - (if (re-search-forward "disk=\\([^&]+\\)&" nil t) - (setq webmail-aux - (concat "http://" site "/cgi-bin/HoTMaiL?disk=" - (match-string 1))) - (webmail-error "list@2")) - (goto-char (point-max)) - (while (re-search-backward - "newmail\\.gif\\|href=\"\\(/cgi-bin/getmsg\\?[^\"]+\\)\"" - nil t) - (if (setq url (match-string 1)) - (progn - (if (or newp (not webmail-newmail-only)) - (let (id) - (if (string-match "msg=\\([^&]+\\)" url) - (setq id (match-string 1 url))) - (push (cons id (concat "http://" site url "&raw=0")) - webmail-articles))) - (setq newp nil)) - (setq newp t))))) + (setq site (match-string 1)) + (webmail-error "list@1")) + (goto-char (point-min)) + (if (re-search-forward "disk=\\([^&]*\\)&" nil t) + (setq webmail-aux + (concat "http://" site "/cgi-bin/HoTMaiL?disk=" + (match-string 1))) + (webmail-error "list@2")) + (goto-char (point-max)) + (while (re-search-backward + "newmail\\.gif\\|href=\"\\(/cgi-bin/getmsg\\?[^\"]+\\)\"" + nil t) + (if (setq url (match-string 1)) + (progn + (if (or newp (not webmail-newmail-only)) + (let (id) + (if (string-match "msg=\\([^&]+\\)" url) + (setq id (match-string 1 url))) + (push (cons id (concat "http://" site url "&raw=0")) + webmail-articles))) + (setq newp nil)) + (setq newp t)))))) ;; Thank victor@idaccr.org (Victor S. Miller) for raw=0 (defun webmail-hotmail-article (file id) (goto-char (point-min)) - (if (not (search-forward "
" nil t))
-      (webmail-error "article@3"))
-  (skip-chars-forward "\n\r\t ")
-  (delete-region (point-min) (point))
-  (if (not (search-forward "
" nil t)) - (webmail-error "article@3.1")) - (delete-region (match-beginning 0) (point-max)) - (nnweb-remove-markup) - (let ((w3-html-entities (cons '(nbsp . 32) w3-html-entities))) - (nnweb-decode-entities)) - (goto-char (point-min)) - (while (re-search-forward "\r\n?" nil t) - (replace-match "\n")) - (goto-char (point-min)) - (insert "\n\n") - (if (not (looking-at "\n*From ")) - (insert "From nobody " (current-time-string) "\n")) - (mm-append-to-file (point-min) (point-max) file)) + (skip-chars-forward " \t\n\r") + (unless (eobp) + (if (not (search-forward "
" nil t))
+	(webmail-error "article@3"))
+    (skip-chars-forward "\n\r\t ")
+    (delete-region (point-min) (point))
+    (if (not (search-forward "
" nil t)) + (webmail-error "article@3.1")) + (delete-region (match-beginning 0) (point-max)) + (mm-url-remove-markup) + (mm-url-decode-entities-nbsp) + (goto-char (point-min)) + (while (re-search-forward "\r\n?" nil t) + (replace-match "\n")) + (goto-char (point-min)) + (insert "\n\n") + (if (not (looking-at "\n*From ")) + (insert "From nobody " (current-time-string) "\n") + (forward-line)) + (insert "X-Gnus-Webmail: " (symbol-value 'user) + "@" (symbol-name webmail-type) "\n") + (mm-append-to-file (point-min) (point-max) file))) (defun webmail-hotmail-article-old (file id) (let (p attachment count mime hotmail-direct) @@ -478,14 +456,13 @@ (narrow-to-region (point-min) (point)) (if (not (search-backward "" nil t) (delete-region p (match-end 0))) - (nnweb-remove-markup) - (let ((w3-html-entities (cons '(nbsp . 32) w3-html-entities))) - (nnweb-decode-entities)) + (mm-url-remove-markup) + (mm-url-decode-entities-nbsp) (goto-char (point-min)) (delete-blank-lines) (goto-char (point-min)) @@ -496,8 +473,8 @@ (widen) (insert "\n") (setq p (point)) - (while (re-search-forward - "\\|
\\|\\(http://[^/]+/cgi-bin/getmsg/\\([^\?]+\\)\?[^\"]*\\)\"" + (while (re-search-forward + "\\|
\\|\\(http://[^/]+/cgi-bin/getmsg/\\([^\?]+\\)\?[^\"]*\\)\"" nil t) (if (setq attachment (match-string 1)) (let ((filename (match-string 2)) @@ -505,11 +482,11 @@ (delete-region p (match-end 0)) (save-excursion (set-buffer (generate-new-buffer " *webmail-att*")) - (nnweb-insert attachment) + (mm-url-insert attachment) (push (current-buffer) webmail-buffer-list) (setq bufname (buffer-name))) (setq mime t) - (insert "<#part type=" + (insert "<#part type=" (or (and filename (string-match "\\.[^\\.]+$" filename) (mailcap-extension-to-mime @@ -526,7 +503,7 @@ (webmail-error "article@1.2") (delete-region (match-beginning 0) (match-end 0))) (setq count 1) - (while (and (> count 0) + (while (and (> count 0) (re-search-forward "
\\|\\(
\\)" nil t)) (if (match-string 1) (setq count (1+ count)) @@ -535,14 +512,13 @@ (match-end 0)))))) (narrow-to-region p (point)) (goto-char (point-min)) - (cond + (cond ((looking-at "
")
 	    (goto-char (match-end 0))
 	    (if (looking-at "$") (forward-char))
 	    (delete-region (point-min) (point))
-	    (nnweb-remove-markup)
-	    (let ((w3-html-entities (cons '(nbsp . 32) w3-html-entities)))
-	      (nnweb-decode-entities))
+	    (mm-url-remove-markup)
+	    (mm-url-decode-entities-nbsp)
 	    nil)
 	   (t
 	    (setq mime t)
@@ -556,9 +532,11 @@
       (goto-char (point-min))
       ;; Some blank line to seperate mails.
       (insert "\n\nFrom nobody " (current-time-string) "\n")
+      (insert "X-Gnus-Webmail: " (symbol-value 'user)
+	      "@" (symbol-name webmail-type) "\n")
       (if id
-	  (insert (format "Message-ID: <%s@hotmail.com>\n" id)))
-      (unless (looking-at "$") 
+	  (insert (format "X-Message-ID: <%s@hotmail.com>\n" id)))
+      (unless (looking-at "$")
 	(if (search-forward "\n\n" nil t)
 	    (forward-line -1)
 	  (webmail-error "article@2")))
@@ -597,21 +575,21 @@
 (defun webmail-yahoo-list ()
   (let (url (newp t) (tofetch 0))
     (goto-char (point-min))
-    (when (re-search-forward 
-	   "showing [0-9]+-\\([0-9]+\\) of \\([0-9]+\\)" nil t) 
+    (when (re-search-forward
+	   "showing [0-9]+-\\([0-9]+\\) of \\([0-9]+\\)" nil t)
       ;;(setq listed (match-string 1))
       (message "Found %s mail(s)" (match-string 2)))
     (if (string-match "http://[^/]+" webmail-aux)
 	(setq webmail-aux (match-string 0 webmail-aux))
       (webmail-error "list@1"))
     (goto-char (point-min))
-    (while (re-search-forward 
+    (while (re-search-forward
 	    "bgcolor=\"#eeeeee\"\\|href=\"\\(/ym/ShowLetter\\?MsgId=\\([^&]+\\)&[^\"]*\\)\""
 	    nil t)
       (if (setq url (match-string 1))
 	  (progn
 	    (when (or newp (not webmail-newmail-only))
-	      (push (cons (match-string 2) (concat webmail-aux url "&toc=1")) 
+	      (push (cons (match-string 2) (concat webmail-aux url "&toc=1"))
 		    webmail-articles)
 	      (setq tofetch (1+ tofetch)))
 	    (setq newp t))
@@ -627,7 +605,7 @@
 	  (webmail-error "article@1"))
       (if (not (search-forward "" nil t))
 	  (webmail-error "article@3"))
       (narrow-to-region (point-min) (match-end 0))
@@ -635,9 +613,8 @@
 	(setq p (match-beginning 0))
 	(search-forward "" nil t)
 	(delete-region p (match-end 0)))
-      (nnweb-remove-markup)
-      (let ((w3-html-entities (cons '(nbsp . 32) w3-html-entities)))
-	(nnweb-decode-entities))
+      (mm-url-remove-markup)
+      (mm-url-decode-entities-nbsp)
       (goto-char (point-min))
       (delete-blank-lines)
       (goto-char (point-max))
@@ -653,9 +630,8 @@
 	  (if (not (search-forward "" nil t))
 	      (webmail-error "article@5"))
 	  (narrow-to-region p (match-end 0))
-	  (nnweb-remove-markup)
-	  (let ((w3-html-entities (cons '(nbsp . 32) w3-html-entities)))
-	    (nnweb-decode-entities))
+	  (mm-url-remove-markup)
+	  (mm-url-decode-entities-nbsp)
 	  (goto-char (point-min))
 	  (delete-blank-lines)
 	  (setq ct (mail-fetch-field "content-type")
@@ -668,7 +644,7 @@
 	  (widen)
 	  (save-excursion
 	    (set-buffer (generate-new-buffer " *webmail-att*"))
-	    (nnweb-insert (concat webmail-aux attachment))
+	    (mm-url-insert (concat webmail-aux attachment))
 	    (push (current-buffer) webmail-buffer-list)
 	    (setq bufname (buffer-name)))
 	  (insert "<#part")
@@ -685,9 +661,11 @@
       (goto-char (point-min))
       ;; Some blank line to seperate mails.
       (insert "\n\nFrom nobody " (current-time-string) "\n")
+      (insert "X-Gnus-Webmail: " (symbol-value 'user)
+	      "@" (symbol-name webmail-type) "\n")
       (if id
-	  (insert (format "Message-ID: <%s@yahoo.com>\n" id)))
-      (unless (looking-at "$") 
+	  (insert (format "X-Message-ID: <%s@yahoo.com>\n" id)))
+      (unless (looking-at "$")
 	(if (search-forward "\n\n" nil t)
 	    (forward-line -1)
 	  (webmail-error "article@2")))
@@ -708,9 +686,12 @@
 
 (defun webmail-netscape-open ()
   (goto-char (point-min))
-  (if (re-search-forward "login/hint\\?\\([^\"]+\\)\"" nil t)
-      (setq webmail-aux (match-string 1))
-    (webmail-error "open@1")))
+  (setq webmail-aux "")
+  (while (re-search-forward
+	  "TYPE=hidden *NAME=\\([^ ]+\\) *VALUE=\"\\([^\"]+\\)"
+	  nil t)
+    (setq webmail-aux (concat webmail-aux "&" (match-string 1) "="
+			      (match-string 2)))))
 
 (defun webmail-netaddress-open ()
   (goto-char (point-min))
@@ -729,16 +710,16 @@
   (webmail-refresh-redirect)
   (let (item id)
     (goto-char (point-min))
-    (when (re-search-forward 
-	   "(\\([0-9]+\\) unread, \\([0-9]+\\) total)" nil t) 
-      (message "Found %s mail(s), %s unread" 
+    (when (re-search-forward
+	   "(\\([0-9]+\\) unread, \\([0-9]+\\) total)" nil t)
+      (message "Found %s mail(s), %s unread"
 	       (match-string 2) (match-string 1)))
     (goto-char (point-min))
-    (while (re-search-forward 
+    (while (re-search-forward
 	    "MR\\[i\\]\\.R='\\([^']*\\)'\\|MR\\[i\\]\\.Q='\\([^']+\\)'" nil t)
       (if (setq id (match-string 2))
-	  (setq item 
-		(cons id 
+	  (setq item
+		(cons id
 		      (format "%s/tpl/Message/%s/Read?Q=%s&FolderID=-4&SortUseCase=True&Sort=Date&Headers=True"
 			      (car webmail-article-url)
 			      webmail-session id)))
@@ -749,7 +730,7 @@
 
 (defun webmail-netaddress-single-part ()
   (goto-char (point-min))
-  (cond 
+  (cond
    ((looking-at "[\t\040\r\n]*]+>[\t\040\r\n]*")
     ;; text/plain
     (replace-match "")
@@ -758,9 +739,8 @@
     (goto-char (point-min))
     (while (re-search-forward "
" nil t) (replace-match "\n")) - (nnweb-remove-markup) - (let ((w3-html-entities (cons '(nbsp . 32) w3-html-entities))) - (nnweb-decode-entities)) + (mm-url-remove-markup) + (mm-url-decode-entities-nbsp) nil) (t (insert "<#part type=\"text/html\" disposition=inline>") @@ -778,7 +758,7 @@ (webmail-error "article@1")) (if (not (search-forward "
" nil t)) (webmail-error "article@2")) - (delete-region (point-min) (match-beginning 0)) + (delete-region (point-min) (match-beginning 0)) (if (not (search-forward "
" nil t)) (webmail-error "article@3")) (narrow-to-region (point-min) (match-end 0)) @@ -788,9 +768,8 @@ (goto-char (point-min)) (while (search-forward "" nil t) (replace-match "\n")) - (nnweb-remove-markup) - (let ((w3-html-entities (cons '(nbsp . 32) w3-html-entities))) - (nnweb-decode-entities)) + (mm-url-remove-markup) + (mm-url-decode-entities-nbsp) (goto-char (point-min)) (delete-blank-lines) (goto-char (point-min)) @@ -808,7 +787,7 @@ (forward-line 14) (delete-region p (point)) (goto-char (point-max)) - (unless (re-search-backward + (unless (re-search-backward "[\040\t]*
[\040\t\r\n]*
[\040\t\r\n]*<#/part>\n") (setq p (point)))) (delete-region p p1) - (narrow-to-region + (narrow-to-region p - (if (search-forward + (if (search-forward "" nil t) (match-beginning 0) @@ -859,9 +838,11 @@ (goto-char (point-min)) ;; Some blank line to seperate mails. (insert "\n\nFrom nobody " (current-time-string) "\n") + (insert "X-Gnus-Webmail: " (symbol-value 'user) + "@" (symbol-name webmail-type) "\n") (if id - (insert (format "Message-ID: <%s@%s>\n" id webmail-address))) - (unless (looking-at "$") + (insert (format "X-Message-ID: <%s@%s>\n" id webmail-address))) + (unless (looking-at "$") (if (search-forward "\n\n" nil t) (forward-line -1) (webmail-error "article@2"))) @@ -870,7 +851,7 @@ (goto-char (point-min)) (while (not (eobp)) (if (looking-at "MIME-Version\\|Content-Type") - (delete-region (point) + (delete-region (point) (progn (forward-line 1) (if (re-search-forward "^[^ \t]" nil t) @@ -901,7 +882,7 @@ (webmail-error "article@1")) (if (not (search-forward "" nil t)) (webmail-error "article@2")) - (delete-region (point-min) (match-beginning 0)) + (delete-region (point-min) (match-beginning 0)) (if (not (search-forward "" nil t)) (webmail-error "article@3")) (narrow-to-region (point-min) (match-end 0)) @@ -914,9 +895,8 @@ (goto-char (point-min)) (while (search-forward "" nil t) (replace-match "\n")) - (nnweb-remove-markup) - (let ((w3-html-entities (cons '(nbsp . 32) w3-html-entities))) - (nnweb-decode-entities)) + (mm-url-remove-markup) + (mm-url-decode-entities-nbsp) (goto-char (point-min)) (delete-blank-lines) (goto-char (point-min)) @@ -934,7 +914,7 @@ (forward-line 14) (delete-region p (point)) (goto-char (point-max)) - (unless (re-search-backward + (unless (re-search-backward "
<#/part>\n") (setq p (point)))) (delete-region p p1) - (narrow-to-region + (narrow-to-region p - (if (search-forward + (if (search-forward "
" nil t) (match-beginning 0) @@ -985,9 +965,11 @@ (goto-char (point-min)) ;; Some blank line to seperate mails. (insert "\n\nFrom nobody " (current-time-string) "\n") + (insert "X-Gnus-Webmail: " (symbol-value 'user) + "@" (symbol-name webmail-type) "\n") (if id - (insert (format "Message-ID: <%s@%s>\n" id webmail-address))) - (unless (looking-at "$") + (insert (format "X-Message-ID: <%s@%s>\n" id webmail-address))) + (unless (looking-at "$") (if (search-forward "\n\n" nil t) (forward-line -1) (webmail-error "article@2"))) @@ -996,7 +978,7 @@ (goto-char (point-min)) (while (not (eobp)) (if (looking-at "MIME-Version\\|Content-Type") - (delete-region (point) + (delete-region (point) (progn (forward-line 1) (if (re-search-forward "^[^ \t]" nil t) @@ -1023,48 +1005,146 @@ (defun webmail-my-deja-open () (webmail-refresh-redirect) (goto-char (point-min)) - (if (re-search-forward "action=\"\\([^\"]+login_confirm\\.xp[^\"]*\\)\"" + (if (re-search-forward "action=\"\\([^\"]+maillogin\\.py[^\"]*\\)\"" nil t) (setq webmail-aux (match-string 1)) (webmail-error "open@1"))) (defun webmail-my-deja-list () - (let (item id newp) + (let (item id newp base) + (goto-char (point-min)) + (when (re-search-forward "href=\"\\(\\([^\"]*\\)/mailnf\\.[^\"]*\\)\"" + nil t) + (let ((url (match-string 1))) + (setq base (match-string 2)) + (erase-buffer) + (mm-url-insert url))) (goto-char (point-min)) - (when (re-search-forward - "(\\([0-9]+\\) message(s), \\([0-9]+\\) new, \\([0-9]+\\) k )" - nil t) - (message "Found %s mail(s), %s unread, total size %s K" - (match-string 1) (match-string 2) (match-string 3))) + (when (re-search-forward + "(\\([0-9]+\\) Message.?-[^>]*\\([0-9]+\\) New" + nil t) + (message "Found %s mail(s), %s unread" + (match-string 1) (match-string 2))) (goto-char (point-min)) - (while (re-search-forward - "•   \\|\\(http:[^\"]+\\)/display_seemesg\\.femail\\?docid=\\([^&\"]+\\)" + (while (re-search-forward + "newmail\\.gif\\|href=\"[^\"]*\\(mailnf\\.[^\"]+act=view[^\"]+mid=\\([^\"&]+\\)[^\"]+\\)\"" nil t) (if (setq id (match-string 2)) - (when (or newp (not webmail-newmail-only)) - (push - (cons id (format "%s/gmm_multiplex.femail?docid=%s&femail_page_name=display_page&bool_next_on_disp_pg=true&bool_prev_on_disp_pg=false&display_all_headers=false&%%2Fgmm_save.femail=Download&femail_page_name=display_page&bool_next_on_disp_pg=true&bool_prev_on_disp_pg=false&display_all_headers=false" - (match-string 1) id)) - webmail-articles) - (setq webmail-aux (match-string 1)) + (when (and (or newp (not webmail-newmail-only)) + (not (assoc id webmail-articles))) + (push (cons id (setq webmail-aux + (concat base "/" (match-string 1)))) + webmail-articles) (setq newp nil)) (setq newp t))) (setq webmail-articles (nreverse webmail-articles)))) +(defun webmail-my-deja-article-part (base) + (let (p) + (cond + ((looking-at "[\t\040\r\n]*