From edc89bcc7774e156eef33d8d04c3a2342c63875f Mon Sep 17 00:00:00 2001 From: bg66 Date: Thu, 18 Jan 2007 12:00:54 +0000 Subject: [PATCH] * mixi.el (mixi-realize-object): New function. (mixi-get-comments): Realize the parent before getting comments. (mixi-realize-diary): Follow the change above. (mixi-realize-topic): Ditto. (mixi-realize-event): Ditto. --- ChangeLog | 8 ++++++++ mixi.el | 31 ++++++++++++++++++++++--------- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 27a767e..ceac81c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2007-01-18 OHASHI Akira + * mixi.el (mixi-realize-object): New function. + (mixi-get-comments): Realize the parent before getting comments. + (mixi-realize-diary): Follow the change above. + (mixi-realize-topic): Ditto. + (mixi-realize-event): Ditto. + +2007-01-18 OHASHI Akira + * mixi.el (mixi-temp-buffer-name): Rename from `mixi-buffer-name'. (with-mixi-retrieve): Follow the change above. (with-mixi-post-form): Ditto. diff --git a/mixi.el b/mixi.el index de92026..271ff27 100644 --- a/mixi.el +++ b/mixi.el @@ -546,6 +546,16 @@ Increase this value when unexpected error frequently occurs." object)) exp)) +(defun mixi-realize-object (object &optional page) + "Realize a OBJECT." + (unless (mixi-object-p object) + (signal 'wrong-type-argument (list 'mixi-object-p object))) + (let ((func (intern (concat mixi-object-prefix "realize-" + (mixi-object-name object))))) + (if page + (funcall func object page) + (funcall func object)))) + (defun mixi-object-timestamp (object) "Return the timestamp of OJBECT." (unless (mixi-object-p object) @@ -1142,11 +1152,11 @@ Increase this value when unexpected error frequently occurs." (defconst mixi-diary-content-regexp "\\(.*\\)") -(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)) @@ -1667,11 +1677,11 @@ Increase this value when unexpected error frequently occurs." (defconst mixi-topic-content-regexp "
\\(\n\\)*
\\(.+\\)
") -(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)) @@ -1855,11 +1865,11 @@ Increase this value when unexpected error frequently occurs." ? \\(.+\\)") -(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)) @@ -2242,9 +2252,12 @@ Increase this value when unexpected error frequently occurs." (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-object 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)) -- 1.7.10.4