* mixi.el (mixi-url-retrieve): Simplify.
authorbg66 <bg66>
Tue, 12 Dec 2006 05:38:43 +0000 (05:38 +0000)
committerbg66 <bg66>
Tue, 12 Dec 2006 05:38:43 +0000 (05:38 +0000)
ChangeLog
mixi.el

index d54eff8..cc32084 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-12-12  OHASHI Akira  <bg66@koka-in.org>
+
+       * mixi.el (mixi-url-retrieve): Simplify.
+
 2006-12-11  OHASHI Akira  <bg66@koka-in.org>
 
        * mixi.el (mixi-diary-time-regexp): Follow the change of mixi;
diff --git a/mixi.el b/mixi.el
index a274a2c..de696d0 100644 (file)
--- a/mixi.el
+++ b/mixi.el
@@ -254,20 +254,14 @@ Increase this value when unexpected error frequently occurs."
       (error (mixi-message "Cannot retrieve")))
     (with-current-buffer buffer
       (goto-char (point-min))
-      (if (re-search-forward "HTTP/[0-9.]+ 302 Moved" nil t)
-         (if (re-search-forward
-              (concat "Location: " mixi-url "\\(.+\\)") nil t)
-             (setq ret (mixi-url-retrieve (match-string 1) post-data))
-           (setq ret (mixi-url-retrieve "/home.pl" post-data)))
-       (unless (re-search-forward "HTTP/[0-9.]+ 200 OK" nil t)
-         (error (mixi-message "Cannot retrieve")))
-       (search-forward "\n\n")
-       (setq ret (decode-coding-string
-                  (buffer-substring-no-properties (point) (point-max))
-                  mixi-coding-system))
-       (kill-buffer buffer)
-       (setq ret (mixi-parse-buffer url ret post-data))))
-    ret))
+      (while (looking-at "HTTP/[0-9]+\\.[0-9]+ [13][0-9][0-9]")
+       (delete-region (point) (re-search-forward "\r?\n\r?\n")))
+      (unless (looking-at "HTTP/[0-9]+\\.[0-9]+ 200")
+       (error (mixi-message "Cannot retrieve")))
+      (delete-region (point) (re-search-forward "\r?\n\r?\n"))
+      (setq ret (decode-coding-string (buffer-string) mixi-coding-system))
+      (kill-buffer buffer)
+      (mixi-parse-buffer url ret post-data))))
 
 (defun mixi-w3m-retrieve (url &optional post-data)
   "Retrieve the URL and return gotten strings."