* webmail.el: Hotmail fix. Add a debug function.
authorShengHuo ZHU <zsh@cs.rochester.edu>
Sun, 23 Apr 2000 02:53:49 +0000 (02:53 +0000)
committerShengHuo ZHU <zsh@cs.rochester.edu>
Sun, 23 Apr 2000 02:53:49 +0000 (02:53 +0000)
lisp/ChangeLog
lisp/webmail.el

index 532efde..c0b6529 100644 (file)
@@ -1,3 +1,7 @@
+2000-04-22 22:51:46  Shenghuo ZHU  <zsh@cs.rochester.edu>
+
+       * webmail.el: Hotmail fix. Add a debug function.
+
 2000-04-23 00:32:32  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * gnus-sum.el (t): M-down and M-up.
index 4d09396..7924bbf 100644 (file)
@@ -74,6 +74,8 @@
      (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)
      (list-snarf . webmail-hotmail-list)
      (article-snarf . webmail-hotmail-article)
      (trash-url 
 
 (defvar webmail-type nil)
 
+(defvar webmail-error-function nil)
+
+(defvar webmail-debug-file "~/.emacs-webmail-debug")
+
 ;;; Interface functions
 
+(defun webmail-debug (str)
+  (with-temp-buffer
+    (insert "\n---------------- A bug at " str " ------------------\n")
+    (mapcar #'(lambda (sym) 
+               (if (boundp sym)
+                   (pp `(setq ,sym ',(eval sym)) (current-buffer))))
+           '(webmail-type user))
+    (insert "---------------- webmail buffer ------------------\n\n")
+    (insert-buffer-substring webmail-buffer)
+    (insert "\n---------------- end of buffer ------------------\n\n")
+    (append-to-file (point-min) (point-max) webmail-debug-file)))
+
 (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)"
           webmail-type str)
   (error "%s HTML has changed; please get a new version of webmail (%s)"
       (setq webmail-aux (match-string 1))
     (webmail-error "open@1")))
 
+(defun webmail-hotmail-login ()
+  (let (site)
+    (goto-char (point-min))
+    (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)
+       (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))
       (webmail-error "maybe your w3 version is too old"))
     (goto-char (point-min))
     (if (re-search-forward 
-        "action=\"https?://\\([^/]+\\)/cgi-bin/HoTMaiL" nil t)
+        "https?://\\([^/]+hotmail\\.msn\\.com\\)/cgi-bin/" nil t)
        (setq site (match-string 1))
       (webmail-error "list@1"))
     (goto-char (point-min))