X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=mixi.el;h=bf82c9ae182585f0c34879b62430bb8151b96936;hb=dc5810970e2ef1656afd3f207c4cc8e1573f4413;hp=80491ea7ba7aea3d2243b3cf9981e88cdcdd1cc1;hpb=4c230c5dedc62813b765026d381e37f88802952c;p=elisp%2Fmixi.git diff --git a/mixi.el b/mixi.el index 80491ea..bf82c9a 100644 --- a/mixi.el +++ b/mixi.el @@ -134,15 +134,11 @@ ;; at run-time. (eval-when-compile (defvar w3m-use-cookies) - (defvar url-request-method) - (defvar url-request-data) - (defvar url-request-extra-headers) - (defvar url-show-status) (autoload 'w3m-decode-buffer "w3m") (autoload 'w3m-retrieve "w3m") (autoload 'url-retrieve-synchronously "url")) -(defconst mixi-revision "$Revision: 1.191 $") +(defconst mixi-revision "$Revision: 1.200 $") (defgroup mixi nil "API library for accessing to mixi." @@ -276,9 +272,7 @@ Increase this value when unexpected error frequently occurs." ¿·¤ÏÀ©¸Â¤µ¤»¤Æ¤¤¤¿¤À¤¤¤Æ¤ª¤ê¤Þ¤¹¡£¤´ÌÂÏǤò¤ª¤«¤±¤¤¤¿¤·¤Þ¤¹¤¬¡¢¤·¤Ð¤é¤¯¤ª
ÂÔ¤Á¤¤¤¿¤À¤¤¤Æ¤«¤éÁàºî¤ò¤ª¤³¤Ê¤Ã¤Æ¤¯¤À¤µ¤¤¡£") (defconst mixi-warning-continuously-accessing - "´Ö³Ö¤ò¶õ¤±¤Ê¤¤Ï¢Â³Åª¤Ê¥Ú¡¼¥¸¤ÎÁ«°Ü¡¦¹¹¿·¤òÉÑÈˤˤª¤³¤Ê¤ï¤ì¤Æ¤¤¤ë¤³¤È¤¬¸«
-¼õ¤±¤é¤ì¤Þ¤·¤¿¤Î¤Ç¡¢°ì»þŪ¤ËÁàºî¤òÄä»ß¤µ¤»¤Æ¤¤¤¿¤À¤­¤Þ¤¹¡£¿½¤·Ìõ¤´¤¶¤¤¤Þ
-¤»¤ó¤¬¡¢¤·¤Ð¤é¤¯¤Î´Ö¤ªÂÔ¤Á¤¯¤À¤µ¤¤¡£") + "´Ö³Ö¤ò¶õ¤±¤Ê¤¤Ï¢Â³Åª¤Ê¥Ú¡¼¥¸¤ÎÁ«°Ü¡¦¹¹¿·¤òÉÑÈˤˤª¤³¤Ê¤ï¤ì¤Æ¤¤¤ë¤³¤È¤¬¸«¼õ¤±¤é¤ì¤Þ¤·¤¿¤Î¤Ç¡¢°ì»þŪ¤ËÁàºî¤òÄä»ß¤µ¤»¤Æ¤¤¤¿¤À¤­¤Þ¤¹¡£¿½¤·Ìõ¤´¤¶¤¤¤Þ¤»¤ó¤¬¡¢¤·¤Ð¤é¤¯¤Î´Ö¤ªÂÔ¤Á¤¯¤À¤µ¤¤¡£") (defmacro mixi-retrieve (url &optional post-data) `(funcall (intern (concat "mixi-" (symbol-name mixi-backend) "-retrieve")) @@ -1058,12 +1052,16 @@ Increase this value when unexpected error frequently occurs." (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 "\\(.+\\)([0-9]+)

") (defconst mixi-friend-list-nick-regexp "\\(.+\\)¤µ¤ó([0-9]+)") @@ -1080,19 +1078,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))) - (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 () @@ -1200,7 +1204,7 @@ Increase this value when unexpected error frequently occurs." "&owner_id=" (mixi-friend-id (mixi-diary-owner ,diary)))) (defconst mixi-diary-closed-regexp - "ͧ¿Í\\(¤Îͧ¿Í\\)?¤Þ¤Ç¸ø³«¤Î¤¿¤áÆɤळ¤È¤¬½ÐÍè¤Þ¤»¤ó¡£") + "¤³¤ÎÆüµ­¤Ë¥¢¥¯¥»¥¹¤Ç¤­¤Þ¤»¤ó¡£°Ê²¼¤Î²ÄǽÀ­¤¬¹Í¤¨¤é¤ì¤Þ¤¹¡£
") (defconst mixi-diary-owner-nick-regexp "

\\(.+?\\)\\(¤µ¤ó\\)?¤ÎÆüµ­

") @@ -2329,10 +2333,10 @@ Increase this value when unexpected error frequently occurs." \\( |
¼«Ê¬¤Î¥³¥á¥ó¥È¤òºï½ü¤¹¤ë \\|\\) - +* \\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\):\\([0-9]+\\) -+ +*
\\(\\(.\\|\r?\n\\)*?\\)
@@ -2525,7 +2529,8 @@ Increase this value when unexpected error frequently occurs." (mixi-post-error 'cannot-find-succeed parent))))) ;; Message object. -(defconst mixi-message-box-list '(inbox outbox savebox thrash)) ; thrash? +(defconst mixi-message-box-list + '(inbox outbox savebox thrash noticebox)) ; thrash? (defmacro mixi-message-box-p (box) `(memq ,box mixi-message-box-list)) @@ -2561,35 +2566,40 @@ Increase this value when unexpected error frequently occurs." `(concat "/view_message.pl?id=" (mixi-message-id ,message) "&box=" (mixi-message-box ,message))) -(defconst mixi-message-owner-regexp - "\\(º¹½Ð¿Í\\|°¸ Àè\\) : \\(.*\\)\\(\\|\\)") -(defconst mixi-message-time-regexp -"Æü\\(¡¡\\| \\)ÉÕ : \\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\)»þ\\([0-9]+\\)ʬ  ") (defconst mixi-message-title-regexp -"·ï\\(¡¡\\| \\)̾ : \\(.*\\)\n?") +"
+

\\(.*\\)

") +(defconst mixi-message-time-regexp +"
ÆüÉÕ
+
\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\)»þ\\([0-9]+\\)ʬ
") +(defconst mixi-message-owner-regexp + "
º¹½Ð¿Í
+
\\( +\\(.*\\)\\|mixi
\\)") (defconst mixi-message-content-regexp - "\\(.*\\)") + "
\\(\\(.\\|\r?\n\\)*?\\)
") (defun mixi-realize-message (message) "Realize a MESSAGE." (unless (mixi-object-realized-p message) (with-mixi-retrieve (mixi-message-page message) - (if (re-search-forward mixi-message-owner-regexp nil t) - (mixi-message-set-owner message - (mixi-make-friend (match-string 2) - (match-string 3))) - (mixi-realization-error 'cannot-find-owner message)) + (if (re-search-forward mixi-message-title-regexp nil t) + (mixi-message-set-title message (match-string 1)) + (mixi-realization-error 'cannot-find-title message)) (if (re-search-forward mixi-message-time-regexp nil t) (mixi-message-set-time - message (encode-time 0 (string-to-number (match-string 6)) - (string-to-number (match-string 5)) + message (encode-time 0 (string-to-number (match-string 5)) (string-to-number (match-string 4)) (string-to-number (match-string 3)) - (string-to-number (match-string 2)))) + (string-to-number (match-string 2)) + (string-to-number (match-string 1)))) (mixi-realization-error 'cannot-find-time message)) - (if (re-search-forward mixi-message-title-regexp nil t) - (mixi-message-set-title message (match-string 2)) - (mixi-realization-error 'cannot-find-title message)) + (if (re-search-forward mixi-message-owner-regexp nil t) + (unless (string= (match-string 1) "mixi") + (mixi-message-set-owner message + (mixi-make-friend (match-string 2) + (match-string 3)))) + (mixi-realization-error 'cannot-find-owner message)) (if (re-search-forward mixi-message-content-regexp nil t) (mixi-message-set-content message (match-string 1)) (mixi-realization-error 'cannot-find-content message))) @@ -2664,7 +2674,7 @@ Increase this value when unexpected error frequently occurs." (when ,box (concat "&box=" ,box)))) (defconst mixi-message-list-regexp - "") + "") ;;;###autoload (defun mixi-get-messages (&rest box-or-range) @@ -2828,13 +2838,13 @@ Increase this value when unexpected error frequently occurs." mixi-news-cache)) (defconst mixi-news-url-regexp - "/view_news\\.pl\\?id=\\([0-9]+\\)&media_id=\\([0-9]+\\)") + "/view_news\\.pl\\?\\(id=\\([0-9]+\\)&media_id=\\([0-9]+\\)\\|media_id=\\([0-9]+\\)&id=\\([0-9]+\\)\\)") (defun mixi-make-news-from-url (url) "Return a news object from URL." (when (string-match mixi-news-url-regexp url) - (let ((id (match-string 1 url)) - (media-id (match-string 2 url))) + (let ((id (or (match-string 2 url) (match-string 5 url))) + (media-id (or (match-string 3 url) (match-string 4 url)))) (mixi-make-news media-id id)))) (defmacro mixi-news-p (news) @@ -2853,8 +2863,7 @@ Increase this value when unexpected error frequently occurs." "

¡Ê\\(.+\\) - \\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\):\\([0-9]+\\)¡Ë

") (defconst mixi-news-content-regexp "
-\\(.+\\) -+ +\\(\\(.\\|\r?\n\\)*?\\) \\(
\\|
\\)")