* mixi.el (mixi-new-bbs-comment-list-page): New macro.
authorbg66 <bg66>
Tue, 16 Oct 2007 02:44:55 +0000 (02:44 +0000)
committerbg66 <bg66>
Tue, 16 Oct 2007 02:44:55 +0000 (02:44 +0000)
(mixi-new-bbs-comment-list-regexp): New constant.
(mixi-get-new-bbs-comments): New function.
* sb-mixi.el (shimbun-mixi-default-group-alist): Add it.
(shimbun-mixi-group-alist): Remove unnecessary constants.

ChangeLog
mixi.el
sb-mixi.el

index 9f85825..29856f4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-10-16  OHASHI Akira  <bg66@koka-in.org>
+
+       * mixi.el (mixi-new-bbs-comment-list-page): New macro.
+       (mixi-new-bbs-comment-list-regexp): New constant.
+       (mixi-get-new-bbs-comments): New function.
+       * sb-mixi.el (shimbun-mixi-default-group-alist): Add it.
+       (shimbun-mixi-group-alist): Remove unnecessary constants.
+
 2007-10-15  OHASHI Akira  <bg66@koka-in.org>
 
        * mixi.el (mixi-diary-comment-list-regexp): Follow the change of mixi.
diff --git a/mixi.el b/mixi.el
index abdf94b..708e4cb 100644 (file)
--- a/mixi.el
+++ b/mixi.el
@@ -39,6 +39,7 @@
 ;;  * mixi-search-bbses
 ;;  * mixi-get-comments
 ;;  * mixi-get-new-comments
+;;  * mixi-get-new-bbs-comments
 ;;  * mixi-get-messages
 ;;  * mixi-get-introductions (broken)
 ;;  * mixi-get-news
   (autoload 'w3m-retrieve "w3m")
   (autoload 'url-retrieve-synchronously "url"))
 
-(defconst mixi-revision "$Revision: 1.172 $")
+(defconst mixi-revision "$Revision: 1.173 $")
 
 (defgroup mixi nil
   "API library for accessing to mixi."
@@ -2391,6 +2392,40 @@ Increase this value when unexpected error frequently occurs."
                        diary)))
                  items))))
 
+(defmacro mixi-new-bbs-comment-list-page ()
+  `(concat "/new_bbs_comment.pl?page=%d"))
+
+(defconst mixi-new-bbs-comment-list-regexp
+  "<a href=\"?view_\\(bbs\\|event\\)\\.pl\\?id=\\([0-9]+\\)&comment_count=\\([0-9]+\\)&comm_id=\\([0-9]+\\)\"?>")
+
+;;;###autoload
+(defun mixi-get-new-bbs-comments (&optional range)
+  "Get new BBS comments."
+  (let ((items (mixi-get-matched-items (mixi-new-bbs-comment-list-page)
+                                      mixi-new-bbs-comment-list-regexp
+                                      range)))
+    (delq nil
+         (mapcar (lambda (item)
+                   (let ((name (nth 0 item)))
+                     (when (string= name "bbs")
+                       (setq name "topic"))
+                     (let ((make-func (intern (concat "mixi-make-" name)))
+                           (comment-count-func
+                            (intern (concat "mixi-" name "-comment-count")))
+                           (set-comment-count-func
+                            (intern (concat "mixi-" name
+                                            "-set-comment-count"))))
+                       (let* ((bbs (funcall make-func
+                                    (mixi-make-community (nth 3 item))
+                                    (nth 1 item)))
+                              (comment-count (funcall comment-count-func bbs))
+                              (count (string-to-number (nth 2 item))))
+                         (when (or (null comment-count)
+                                   (< comment-count count))
+                           (funcall set-comment-count-func bbs count)
+                           bbs)))))
+                 items))))
+
 (defun mixi-post-diary-comment-page (diary)
   (concat "/add_comment.pl?&diary_id=" (mixi-diary-id diary)))
 
index 691b010..248929b 100644 (file)
@@ -33,7 +33,7 @@
 (require 'mixi-utils)
 (require 'shimbun)
 
-(defconst shimbun-mixi-revision "$Revision: 1.57 $")
+(defconst shimbun-mixi-revision "$Revision: 1.58 $")
 
 (eval-and-compile
   (luna-define-class shimbun-mixi (shimbun) (comment-cache))
@@ -43,6 +43,7 @@
   '(("new-diaries" . mixi-get-new-diaries)
     ("new-comments" . mixi-get-new-comments)
     ("new-bbses" . mixi-get-new-bbses)
+    ("new-bbs-comments" . mixi-get-new-bbs-comments)
     ("messages" . mixi-get-messages)
     ("messages.sent" .
      (lambda (range)
@@ -113,12 +114,7 @@ of mixi object."
   :type '(repeat (cons :fromat "%v"
                       (string :tag "Group name")
                       (radio (string :tag "URL")
-                             (const :tag "New diaries" mixi-get-new-diaries)
-                             (const :tag "New comments" mixi-get-new-comments)
-                             (const :tag "New BBSes" mixi-get-new-bbses)
-                             (const :tag "Messages" mixi-get-messages)
-                             (const :tag "Logs" mixi-get-logs)
-                             (function :tag "Other function")))))
+                             (function :tag "Function")))))
 
 (defcustom shimbun-mixi-get-profile-with-diary t
   "*If non-nil, get his/her profile together with diaries."