+ (nth 2 item))))
+ items)))
+
+;; Release object.
+(defun mixi-make-release (title time content)
+ "Return a release object."
+ (cons 'mixi-release (vector title time content)))
+
+(defmacro mixi-release-p (release)
+ `(eq (mixi-object-class ,release) 'mixi-release))
+
+(defun mixi-release-title (release)
+ "Return the title of RELEASE."
+ (unless (mixi-release-p release)
+ (signal 'wrong-type-argument (list 'mixi-release-p release)))
+ (aref (cdr release) 0))
+
+(defun mixi-release-time (release)
+ "Return the time of RELEASE."
+ (unless (mixi-release-p release)
+ (signal 'wrong-type-argument (list 'mixi-release-p release)))
+ (aref (cdr release) 1))
+
+(defun mixi-release-content (release)
+ "Return the content of RELEASE."
+ (unless (mixi-release-p release)
+ (signal 'wrong-type-argument (list 'mixi-release-p release)))
+ (aref (cdr release) 2))
+
+(defmacro mixi-release-list-page ()
+ `(concat "/release_info.pl?page=%d"))
+
+(defconst mixi-release-list-regexp
+ "<td> <span STYLE=\"font-size:8pt;color:#DFB479\">¢£</span> <b><font COLOR=#605048>\\(.+\\)</font></b></td>
+<td ALIGN=right><font COLOR=#605048>\\([1-9][0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)</font></td>
+</tr>
+</table>
+</td>
+</tr>
+</table>
+
+<br>
+
+<table BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=450>
+<tr>
+<td CLASS=h130>
+\\(.+\\)
+</td>
+</tr>
+</table>")
+
+;;;###autoload
+(defun mixi-get-releases (&optional range)
+ "Get releases."
+ (let ((items (mixi-get-matched-items (mixi-release-list-page)
+ mixi-release-list-regexp
+ range)))
+ (mapcar (lambda (item)
+ (mixi-make-release (nth 0 item)
+ (encode-time 0 0 0
+ (string-to-number (nth 3 item))
+ (string-to-number (nth 2 item))
+ (string-to-number (nth 1 item)))
+ (nth 4 item)))
+ items)))
+
+;; Echo object.
+(defvar mixi-echo-cache (make-hash-table :test 'equal))
+;; FIXME: Support parent.
+(defun mixi-make-echo (owner post-time &optional content)
+ "Return an echo object."
+ (let ((owner (or owner (mixi-make-me))))
+ (mixi-make-cache (list (mixi-friend-id owner) post-time)
+ (cons 'mixi-echo (vector nil owner post-time content))
+ mixi-echo-cache)))
+
+(defconst mixi-echo-url-regexp
+ "view_echo\\.pl\\?id=\\([0-9]+\\)&post_time=\\([0-9]+\\)")
+
+(defun mixi-make-echo-from-url (url)
+ "Return an echo object from URL."
+ (when (string-match mixi-echo-url-regexp url)
+ (let ((owner-id (match-string 1 url))
+ (post-time (match-string 2 url)))
+ (mixi-make-echo (mixi-make-friend owner-id) post-time))))
+
+(defmacro mixi-echo-p (echo)
+ `(eq (mixi-object-class ,echo) 'mixi-echo))
+
+(defmacro mixi-echo-page (echo)
+ `(concat "/view_echo.pl?id=" (mixi-friend-id (mixi-echo-owner ,echo))
+ "&post_time=" (mixi-echo-post-time ,echo)))
+
+(defconst mixi-echo-owner-nick-regexp
+ "<div id=\"echo_nickname_[0-9]+\" style=\"display: none;\">\\(.*\\)</div>")
+(defconst mixi-echo-content-regexp
+ "<div id=\"echo_body_[0-9]+\" style=\"display: none;\">\\(.+\\)</div>")
+
+(defun mixi-realize-echo (echo)
+ "Realize an ECHO."
+ ;; FIXME: Check an expiration of cache?
+ (unless (mixi-object-realized-p echo)
+ (with-mixi-retrieve (mixi-echo-page echo)
+ (let ((case-fold-search t))
+ (if (re-search-forward mixi-echo-owner-nick-regexp nil t)
+ (mixi-friend-set-nick (mixi-echo-owner echo)
+ (match-string 1))
+ (mixi-realization-error 'cannot-find-owner-nick echo))
+ (if (re-search-forward mixi-echo-content-regexp nil t)
+ (mixi-echo-set-content echo (match-string 1))
+ (mixi-realization-error 'cannot-find-owner-nick echo))))
+ (mixi-object-touch echo)))
+
+(defun mixi-echo-owner (echo)
+ "Return the owner of ECHO."
+ (unless (mixi-echo-p echo)
+ (signal 'wrong-type-argument (list 'mixi-echo-p echo)))
+ (aref (cdr echo) 1))
+
+(defun mixi-echo-post-time (echo)
+ "Return the post-time of ECHO."
+ (unless (mixi-echo-p echo)
+ (signal 'wrong-type-argument (list 'mixi-echo-p echo)))
+ (aref (cdr echo) 2))
+
+(defun mixi-echo-content (echo)
+ "Return the content of ECHO."
+ (unless (mixi-echo-p echo)
+ (signal 'wrong-type-argument (list 'mixi-echo-p echo)))
+ (mixi-realize-echo echo)
+ (aref (cdr echo) 3))
+
+(defun mixi-echo-set-content (echo content)
+ "Set the content of ECHO."
+ (unless (mixi-echo-p echo)
+ (signal 'wrong-type-argument (list 'mixi-echo-p echo)))
+ (aset (cdr echo) 3 content))
+
+(defmacro mixi-echo-list-page (&optional friend)
+ `(concat "/list_echo.pl?page=%d"
+ (when ,friend (concat "&id=" (mixi-friend-id ,friend)))))
+
+(defconst mixi-echo-list-regexp
+ "<a href=\"view_echo\\.pl\\?id=\\([0-9]+\\)&post_time=\\([0-9]+\\)\">")
+
+;;;###autoload
+(defun mixi-get-echoes (&rest friend-or-range)
+ "Get echoes of FRIEND."
+ (when (> (length friend-or-range) 2)
+ (signal 'wrong-number-of-arguments
+ (list 'mixi-get-echoes (length friend-or-range))))
+ (let ((friend (nth 0 friend-or-range))
+ (range (nth 1 friend-or-range)))
+ (when (or (not (mixi-friend-p friend)) (mixi-friend-p range))
+ (setq friend (nth 1 friend-or-range))
+ (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 ((items (mixi-get-matched-items (mixi-echo-list-page friend)
+ mixi-echo-list-regexp
+ range)))
+ (mapcar (lambda (item)
+ (mixi-make-echo friend (nth 1 item)))
+ items))))
+
+(defmacro mixi-new-echo-list-page ()
+ `(concat "/recent_echo.pl?page=%d"))
+
+(defconst mixi-new-echo-list-regexp
+ "<a href=\"view_echo\\.pl\\?id=\\([0-9]+\\)&post_time=\\([0-9]+\\)\">")
+
+;;;###autoload
+(defun mixi-get-new-echoes (&optional range)
+ "Get new echoes."
+ (let ((items (mixi-get-matched-items (mixi-new-echo-list-page)
+ mixi-new-echo-list-regexp
+ range)))
+ (mapcar (lambda (item)
+ (mixi-make-echo (mixi-make-friend (nth 0 item)) (nth 1 item)))