+2007-01-19 OHASHI Akira <bg66@koka-in.org>
+
+ * mixi.el (mixi-realize-parent): Rename from `mixi-realize-object'.
+ (mixi-parent-p): New macro.
+ (mixi-get-comments): Use them.
+
+ * sb-mixi.el (shimbun-mixi-get-headers): Ditto.
+ (shimbun-get-headers): Ditto.
+
2007-01-18 OHASHI Akira <bg66@koka-in.org>
* mixi.el (mixi-realize-object): New function.
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)
(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")))
"-comment-list-regexp"))))
(page (funcall list-page parent)))
(unless (mixi-object-realized-p parent)
- (mixi-realize-object parent page)
+ (mixi-realize-parent parent page)
(setq page nil))
(let ((items (mixi-get-matched-items page regexp range t)))
(mapcar (lambda (item)
(mapc (lambda (object)
(when (mixi-object-p object)
(let ((class (mixi-object-class object)))
- (when (or (eq class 'mixi-diary)
- (mixi-bbs-p object))
+ (when (mixi-parent-p object)
(let ((comments (mixi-get-comments object range)))
(mapc (lambda (header)
(push header headers))
(setq objects (mixi-get-diaries object range)))
((eq class 'mixi-community)
(setq objects (mixi-get-bbses object range)))
- ((or (eq class 'mixi-diary)
- (mixi-bbs-p object))
+ ((mixi-parent-p object)
(setq objects (mixi-get-comments object range)))
(t (error (concat (symbol-name class)
" is not supported yet.")))))