(mixi-message-box-p): Ditto.
(mixi-news-category-p): Ditto.
(mixi-news-sort-list): New constant.
(mixi-news-sort-p): New macro.
(mixi-news-sort-id): New function.
(mixi-news-list-page): Add SORT argument.
(mixi-get-news): Ditto.
* sb-mixi.el (shimbun-mixi-group-alist): Follow the change above.
+2007-01-15 OHASHI Akira <bg66@koka-in.org>
+
+ * mixi.el (mixi-bbs-p): Simplify.
+ (mixi-message-box-p): Ditto.
+ (mixi-news-category-p): Ditto.
+ (mixi-news-sort-list): New constant.
+ (mixi-news-sort-p): New macro.
+ (mixi-news-sort-id): New function.
+ (mixi-news-list-page): Add SORT argument.
+ (mixi-get-news): Ditto.
+
+ * sb-mixi.el (shimbun-mixi-group-alist): Follow the change above.
+
2007-01-14 OHASHI Akira <bg66@koka-in.org>
* sb-mixi.el (shimbun-mixi-group-alist): Add news groups.
(defconst mixi-bbs-list '(mixi-topic mixi-event))
(defmacro mixi-bbs-p (object)
- `(when (memq (mixi-object-class ,object) mixi-bbs-list)
- t))
+ `(memq (mixi-object-class ,object) mixi-bbs-list))
(defun mixi-bbs-community (object)
"Return the community of 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))
+ `(memq ,box mixi-message-box-list))
(defun mixi-message-box-name (box)
"Return the name of BOX."
sports entertainment IT))
(defmacro mixi-news-category-p (category)
- `(when (memq ,category mixi-news-category-list)
- t))
+ `(memq ,category mixi-news-category-list))
(defun mixi-news-category-id (category)
"Return the id of CATEGORY."
(1+ (- (length mixi-news-category-list)
(length (memq category mixi-news-category-list))))))
-(defmacro mixi-news-list-page (category)
- `(concat "http://news.mixi.jp/list_news_category.pl?page=%d&sort=1"
- (concat "&id=" (mixi-news-category-id category) "&type=bn")))
+(defconst mixi-news-sort-list '(newest pickup))
+
+(defmacro mixi-news-sort-p (sort)
+ `(memq ,sort mixi-news-sort-list))
+
+(defun mixi-news-sort-id (sort)
+ "Return the id of SORT."
+ (unless (mixi-news-sort-p sort)
+ (signal 'wrong-type-argument (list 'mixi-news-sort-p sort)))
+ (number-to-string
+ (- (length mixi-news-sort-list)
+ (length (memq sort mixi-news-sort-list)))))
+
+(defmacro mixi-news-list-page (category sort)
+ `(concat "http://news.mixi.jp/list_news_category.pl?page=%d"
+ "&sort=" (mixi-news-sort-id ,sort)
+ "&id=" (mixi-news-category-id ,category)
+ "&type=bn"))
(defconst mixi-news-list-regexp
"<tr bgcolor=\"\\(#FCF5EB\\|#FFFFFF\\)\">
<td WIDTH=\"1%\" nowrap CLASS=\"f08\"><A HREF=\"list_news_media\\.pl\\?id=[0-9]+\">\\(.+\\)</A></td>
<td WIDTH=\"1%\" nowrap CLASS=\"f08\">\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\):\\([0-9]+\\)</td></tr>")
-(defun mixi-get-news (category &optional range)
- "Get news of CATEGORY."
+(defun mixi-get-news (category sort &optional range)
+ "Get news of CATEGORY and SORT."
(unless (mixi-news-category-p category)
(signal 'wrong-type-argument (list 'mixi-news-category-p category)))
- (let ((items (mixi-get-matched-items (mixi-news-list-page category)
+ (unless (mixi-news-sort-p sort)
+ (signal 'wrong-type-argument (list 'mixi-news-sort-p sort)))
+ (let ((items (mixi-get-matched-items (mixi-news-list-page category sort)
mixi-news-list-regexp
range))
(year (nth 5 (decode-time (current-time))))
(luna-define-class shimbun-mixi (shimbun) (comment-cache))
(luna-define-internal-accessors 'shimbun-mixi))
-(defcustom shimbun-mixi-group-alist '(("new-diaries" . mixi-get-new-diaries)
- ("new-comments" . mixi-get-new-comments)
- ("new-bbses" . mixi-get-new-bbses)
- ("messages" . mixi-get-messages)
- ("my-diaries" . "/home.pl")
- ("news.domestic" .
- (lambda (range)
- (mixi-get-news 'domestic range)))
- ("news.politics" .
- (lambda (range)
- (mixi-get-news 'politics range)))
- ("news.economy" .
- (lambda (range)
- (mixi-get-news 'economy range)))
- ("news.area" .
- (lambda (range)
- (mixi-get-news 'area range)))
- ("news.abroad" .
- (lambda (range)
- (mixi-get-news 'abroad range)))
- ("news.sports" .
- (lambda (range)
- (mixi-get-news 'sports range)))
- ("news.entertainment" .
- (lambda (range)
- (mixi-get-news 'entertainment range)))
- ("news.it" .
- (lambda (range)
- (mixi-get-news 'IT range))))
+(defcustom shimbun-mixi-group-alist
+ '(("new-diaries" . mixi-get-new-diaries)
+ ("new-comments" . mixi-get-new-comments)
+ ("new-bbses" . mixi-get-new-bbses)
+ ("messages" . mixi-get-messages)
+ ("my-diaries" . "/home.pl")
+ ("news.newest.domestic" .
+ (lambda (range)
+ (mixi-get-news 'domestic 'newest range)))
+ ("news.newest.politics" .
+ (lambda (range)
+ (mixi-get-news 'politics 'newest range)))
+ ("news.newest.economy" .
+ (lambda (range)
+ (mixi-get-news 'economy 'newest range)))
+ ("news.newest.area" .
+ (lambda (range)
+ (mixi-get-news 'area 'newest range)))
+ ("news.newest.abroad" .
+ (lambda (range)
+ (mixi-get-news 'abroad 'newest range)))
+ ("news.newest.sports" .
+ (lambda (range)
+ (mixi-get-news 'sports 'newest range)))
+ ("news.newest.entertainment" .
+ (lambda (range)
+ (mixi-get-news 'entertainment 'newest range)))
+ ("news.newest.it" .
+ (lambda (range)
+ (mixi-get-news 'IT 'newest range)))
+ ("news.pickup.domestic" .
+ (lambda (range)
+ (mixi-get-news 'domestic 'pickup range)))
+ ("news.pickup.politics" .
+ (lambda (range)
+ (mixi-get-news 'politics 'pickup range)))
+ ("news.pickup.economy" .
+ (lambda (range)
+ (mixi-get-news 'economy 'pickup range)))
+ ("news.pickup.area" .
+ (lambda (range)
+ (mixi-get-news 'area 'pickup range)))
+ ("news.pickup.abroad" .
+ (lambda (range)
+ (mixi-get-news 'abroad 'pickup range)))
+ ("news.pickup.sports" .
+ (lambda (range)
+ (mixi-get-news 'sports 'pickup range)))
+ ("news.pickup.entertainment" .
+ (lambda (range)
+ (mixi-get-news 'entertainment 'pickup range)))
+ ("news.pickup.it" .
+ (lambda (range)
+ (mixi-get-news 'IT 'pickup range))))
"*An alist of mixi shimbun group definition.
Each element looks like (NAME . URL) or (NAME . FUNCTION).
NAME is a shimbun group name.