:type 'boolean
:group 'mixi)
-(defvar mixi-buffer-name " *mixi temp*")
+(defvar mixi-temp-buffer-name " *mixi temp*")
(defvar mixi-me nil)
;; Utilities.
(mixi-retrieve "/logout.pl"))
(defmacro with-mixi-retrieve (url &rest body)
- `(with-current-buffer (get-buffer-create mixi-buffer-name)
+ `(with-current-buffer (get-buffer-create mixi-temp-buffer-name)
(when ,url
(erase-buffer)
(insert (mixi-retrieve ,url))
(put 'with-mixi-retrieve 'edebug-form-spec '(body))
(defmacro with-mixi-post-form (url fields &rest body)
- `(with-current-buffer (get-buffer-create mixi-buffer-name)
+ `(with-current-buffer (get-buffer-create mixi-temp-buffer-name)
(when ,url
(erase-buffer)
(insert (mixi-post-form ,url ,fields))
(defconst mixi-diary-content-regexp
"<td \\(class\\|CLASS\\)=\"?h12\"?>\\(.*\\)</td>")
-(defun mixi-realize-diary (diary)
+(defun mixi-realize-diary (diary &optional page)
"Realize a DIARY."
;; FIXME: Check a expiration of cache?
(unless (mixi-object-realized-p diary)
- (with-mixi-retrieve (mixi-diary-page diary)
+ (with-mixi-retrieve (or page (mixi-diary-page diary))
(unless (re-search-forward mixi-diary-closed-regexp nil t)
(if (re-search-forward mixi-diary-owner-nick-regexp nil t)
(mixi-friend-set-nick (mixi-diary-owner diary) (match-string 1))
"<td WIDTH=345>\\(.*\\)</td></tr>")
(defconst mixi-community-birthday-regexp
"<td BGCOLOR=#F2DDB7 WIDTH=80><font COLOR=#996600>³«ÀßÆü</font></td>\r
-<td WIDTH=345>\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü</td>")
+<td WIDTH=345>\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü")
;; FIXME: Care when the owner has seceded.
(defconst mixi-community-owner-regexp
"<td BGCOLOR=#F2DDB7 WIDTH=80><font COLOR=#996600>´ÉÍý¿Í</font></td>\r
(defconst mixi-topic-content-regexp
"<table width=\"500\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\"><tr><td class=\"h120\"><table><tr>\\(<td width=\"130\" height=\"140\" align=\"center\" valign=\"middle\"><a href=\"javascript:void(0)\" onClick=\"MM_openBrWindow('show_bbs_picture\\.pl\\?id=[0-9]+&comm_id=[0-9]+&number=[0-9]+','pict','width=680,height=660,toolbar=no,scrollbars=yes,left=5,top=5')\"><img src=\"http://ic[0-9]+\\.mixi\\.jp/[^.]+\\.jpg\" border=\"0\"></a></td>\n\\)*</tr></table>\\(.+\\)</td></tr></table>")
-(defun mixi-realize-topic (topic)
+(defun mixi-realize-topic (topic &optional page)
"Realize a TOPIC."
;; FIXME: Check a expiration of cache?
(unless (mixi-object-realized-p topic)
- (with-mixi-retrieve (mixi-topic-page topic)
+ (with-mixi-retrieve (or page (mixi-topic-page topic))
(if (re-search-forward mixi-topic-community-regexp nil t)
(mixi-community-set-name (mixi-topic-community topic)
(match-string 1))
?<td> \\(.+\\)</td>")
-(defun mixi-realize-event (event)
+(defun mixi-realize-event (event &optional page)
"Realize a EVENT."
;; FIXME: Check a expiration of cache?
(unless (mixi-object-realized-p event)
- (with-mixi-retrieve (mixi-event-page event)
+ (with-mixi-retrieve (or page (mixi-event-page event))
(if (re-search-forward mixi-event-community-regexp nil t)
(mixi-community-set-name (mixi-event-community event)
(match-string 1))
(nth 1 item)))))
items)))
+;; Parent object.
+(defmacro mixi-parent-p (object)
+ `(or (eq (mixi-object-class ,object) 'mixi-diary)
+ (mixi-bbs-p object)))
+
+(defun mixi-realize-parent (parent &optional page)
+ "Realize a PARENT."
+ (unless (mixi-parent-p parent)
+ (signal 'wrong-type-argument (list 'mixi-parent-p parent)))
+ (let ((func (intern (concat mixi-object-prefix "realize-"
+ (mixi-object-name parent)))))
+ (funcall func parent page)))
+
;; Comment object.
(defun mixi-make-comment (parent owner time content)
"Return a comment object."
(defun mixi-get-comments (parent &optional range)
"Get comments of PARENT."
- (unless (mixi-object-p parent)
- (signal 'wrong-type-argument (list 'mixi-object-p parent)))
+ (unless (mixi-parent-p parent)
+ (signal 'wrong-type-argument (list 'mixi-parent-p parent)))
(let* ((name (mixi-object-name parent))
(list-page (intern (concat mixi-object-prefix name
"-comment-list-page")))
(regexp (eval (intern (concat mixi-object-prefix name
- "-comment-list-regexp")))))
- (let ((items (mixi-get-matched-items
- (funcall list-page parent) regexp range t)))
+ "-comment-list-regexp"))))
+ (page (funcall list-page parent)))
+ (unless (mixi-object-realized-p parent)
+ (mixi-realize-parent parent page)
+ (setq page nil))
+ (let ((items (mixi-get-matched-items page regexp range t)))
(mapcar (lambda (item)
(mixi-make-comment parent (mixi-make-friend
(nth 7 item) (nth 8 item))
"&media_id=" (mixi-news-media-id ,news)))
(defconst mixi-news-title-regexp
- "<td HEIGHT=\"46\" STYLE=\"font-weight: bold;font-size: 14px;\" CLASS=\"h130\">\\(.+\\)</td>")
+ "<td HEIGHT=\"46\" STYLE=\"font-weight: bold;font-size: 14px;\" CLASS=\"h130\">\\(.+\\)\\(\r
+\\)?</td>")
(defconst mixi-news-media-time-regexp
"<td COLSPAN=\"2\" ALIGN=\"right\">(\\(.+\\) - \\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\):\\([0-9]+\\))</td></tr>")
(defconst mixi-news-content-regexp
"<td CLASS=\"h150\">
\\(.+\\)
-
-?
+<br>
+\\(.*
+\\)?
\\(</td>\\|<br>\\)")