(mixi-get-friends): Follow the change of mixi.
authorbg66 <bg66>
Thu, 7 Aug 2008 14:26:50 +0000 (14:26 +0000)
committerbg66 <bg66>
Thu, 7 Aug 2008 14:26:50 +0000 (14:26 +0000)
(mixi-my-friend-list-page): New function.
(mixi-friend-list-page): Change from macro to function.
(mixi-my-friend-list-nick-regexp): New constant.
(mixi-friend-list-nick-regexp): Fix regexp.

ChangeLog
mixi.el

index 8b13054..6971cd7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-08-07  OHASHI Akira  <bg66@koka-in.org>
+
+       * mixi.el (mixi-get-friends): Follow the change of mixi.
+       (mixi-my-friend-list-page): New function.
+       (mixi-friend-list-page): Change from macro to function.
+       (mixi-my-friend-list-nick-regexp): New constant.
+       (mixi-friend-list-nick-regexp): Fix regexp.
+
 2008-08-05  OHASHI Akira  <bg66@koka-in.org>
 
        * sb-mixi.el (shimbun-mixi-default-group-alist): Add echo group.
 2008-08-05  OHASHI Akira  <bg66@koka-in.org>
 
        * sb-mixi.el (shimbun-mixi-default-group-alist): Add echo group.
diff --git a/mixi.el b/mixi.el
index 80491ea..a9e04ff 100644 (file)
--- a/mixi.el
+++ b/mixi.el
   (autoload 'w3m-retrieve "w3m")
   (autoload 'url-retrieve-synchronously "url"))
 
   (autoload 'w3m-retrieve "w3m")
   (autoload 'url-retrieve-synchronously "url"))
 
-(defconst mixi-revision "$Revision: 1.191 $")
+(defconst mixi-revision "$Revision: 1.192 $")
 
 (defgroup mixi nil
   "API library for accessing to mixi."
 
 (defgroup mixi nil
   "API library for accessing to mixi."
@@ -1058,12 +1058,16 @@ Increase this value when unexpected error frequently occurs."
     (signal 'wrong-type-argument (list 'mixi-friend-p friend)))
   (aset (cdr friend) 13 profile))
 
     (signal 'wrong-type-argument (list 'mixi-friend-p friend)))
   (aset (cdr friend) 13 profile))
 
-(defmacro mixi-friend-list-page (&optional friend)
-  `(concat "/list_friend.pl?page=%d"
-          (when ,friend (concat "&id=" (mixi-friend-id ,friend)))))
+(defun mixi-my-friend-list-page (&optional dummy)
+  (concat "/list_friend_simple.pl?page=%d"))
+
+(defun mixi-friend-list-page (friend)
+  (concat "/list_friend.pl?page=%d&id=" (mixi-friend-id friend)))
 
 (defconst mixi-friend-list-id-regexp
   "<a href=\"?show_friend\\.pl\\?id=\\([0-9]+\\)\"?")
 
 (defconst mixi-friend-list-id-regexp
   "<a href=\"?show_friend\\.pl\\?id=\\([0-9]+\\)\"?")
+(defconst mixi-my-friend-list-nick-regexp
+  "<p>\\(.+\\)([0-9]+)</p>")
 (defconst mixi-friend-list-nick-regexp
   "<span>\\(.+\\)¤µ¤ó([0-9]+)</span>")
 
 (defconst mixi-friend-list-nick-regexp
   "<span>\\(.+\\)¤µ¤ó([0-9]+)</span>")
 
@@ -1080,19 +1084,25 @@ Increase this value when unexpected error frequently occurs."
       (setq range (nth 0 friend-or-range)))
     (unless (or (null friend) (mixi-friend-p friend))
       (signal 'wrong-type-argument (list 'mixi-friend-p friend)))
       (setq range (nth 0 friend-or-range)))
     (unless (or (null friend) (mixi-friend-p friend))
       (signal 'wrong-type-argument (list 'mixi-friend-p friend)))
-    (let ((ids (mixi-get-matched-items (mixi-friend-list-page friend)
-                                      mixi-friend-list-id-regexp
-                                      range))
-         (nicks (mixi-get-matched-items (mixi-friend-list-page friend)
-                                        mixi-friend-list-nick-regexp
-                                        range)))
-      (let ((index 0)
-           ret)
-       (while (< index (length ids))
-         (setq ret (cons (mixi-make-friend (nth 0 (nth index ids))
-                                           (nth 0 (nth index nicks))) ret))
-         (incf index))
-       (reverse ret)))))
+    (let (list-page list-nick-regexp)
+      (if (or (null friend) (equal friend mixi-me))
+         (setq list-page 'mixi-my-friend-list-page
+               list-nick-regexp mixi-my-friend-list-nick-regexp)
+         (setq list-page 'mixi-friend-list-page
+               list-nick-regexp mixi-friend-list-nick-regexp))
+      (let ((ids (mixi-get-matched-items (funcall list-page friend)
+                                        mixi-friend-list-id-regexp
+                                        range))
+           (nicks (mixi-get-matched-items (funcall list-page friend)
+                                          list-nick-regexp
+                                          range)))
+       (let ((index 0)
+             ret)
+         (while (< index (length ids))
+           (setq ret (cons (mixi-make-friend (nth 0 (nth index ids))
+                                             (nth 0 (nth index nicks))) ret))
+           (incf index))
+         (reverse ret))))))
 
 ;; Favorite.
 (defmacro mixi-favorite-list-page ()
 
 ;; Favorite.
 (defmacro mixi-favorite-list-page ()