From: bg66 Date: Sat, 28 Oct 2006 01:02:15 +0000 (+0000) Subject: (mixi-message-box-list): New constant. X-Git-Tag: cache-file-branchpoint~27 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8d5a536b2e4dde5e08e98cef76d3d1f325a1342;p=elisp%2Fmixi.git (mixi-message-box-list): New constant. (mixi-message-box-p): New macro. (mixi-message-box-name): New function. (mixi-get-messages): Use them. --- diff --git a/ChangeLog b/ChangeLog index 45dbcf2..1b8a4b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-10-28 OHASHI Akira + + * mixi.el (mixi-message-box-list): New constant. + (mixi-message-box-p): New macro. + (mixi-message-box-name): New function. + (mixi-get-messages): Use them. + 2006-10-25 OHASHI Akira * mixi.el (mixi-remove-markup): When STRING is nil, insert a null diff --git a/mixi.el b/mixi.el index b6e4bcc..33d1f55 100644 --- a/mixi.el +++ b/mixi.el @@ -1486,6 +1486,18 @@ Increase this value when unexpected error frequently occurs." items))) ;; Message object. +(defconst mixi-message-box-list '(inbox outbox savebox thrash)) ; thrash? + +(defmacro mixi-message-box-p (box) + `(when (memq ,box mixi-message-box-list) + t)) + +(defun mixi-message-box-name (box) + "Return the name of BOX." + (unless (mixi-message-box-p box) + (signal 'wrong-type-argument (list 'mixi-message-box-p box))) + (symbol-name box)) + (defvar mixi-message-cache (make-hash-table :test 'equal)) (defun mixi-make-message (id box) "Return a message object." @@ -1614,12 +1626,15 @@ Increase this value when unexpected error frequently occurs." (list 'mixi-get-messages (length args)))) (let ((box (nth 0 args)) (max-numbers (nth 1 args))) - (when (or (not (stringp box)) (stringp max-numbers)) + (when (or (not (mixi-message-box-p box)) + (mixi-message-box-p max-numbers)) (setq box (nth 1 args)) (setq max-numbers (nth 0 args))) - (let ((items (mixi-get-matched-items (mixi-message-list-page box) - max-numbers - mixi-message-list-regexp))) + (let ((items (mixi-get-matched-items + (mixi-message-list-page + (when box (mixi-message-box-name box))) + max-numbers + mixi-message-list-regexp))) (mapcar (lambda (item) (mixi-make-message (nth 0 item) (nth 1 item))) items))))