* mixi.el (mixi-search-bbs-list-page): New macro.
authorbg66 <bg66>
Mon, 11 Dec 2006 04:00:26 +0000 (04:00 +0000)
committerbg66 <bg66>
Mon, 11 Dec 2006 04:00:26 +0000 (04:00 +0000)
(mixi-search-bbs-list-regexp): New regexp.
(mixi-search-bbses): New function.

ChangeLog
mixi.el

index ded4967..4cdb26e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2006-12-11  OHASHI Akira  <bg66@koka-in.org>
 
+       * mixi.el (mixi-search-bbs-list-page): New macro.
+       (mixi-search-bbs-list-regexp): New regexp.
+       (mixi-search-bbses): New function.
+
+2006-12-11  OHASHI Akira  <bg66@koka-in.org>
+
        * mixi.el (mixi-search-community-list-page): New macro.
        (mixi-search-community-list-regexp): New regexp.
        (mixi-search-communities): New function.
diff --git a/mixi.el b/mixi.el
index c637213..5598500 100644 (file)
--- a/mixi.el
+++ b/mixi.el
@@ -36,6 +36,7 @@
 ;;  * mixi-search-communities
 ;;  * mixi-get-bbses
 ;;  * mixi-get-new-bbses
+;;  * mixi-search-bbses
 ;;  * mixi-get-comments
 ;;  * mixi-get-new-comments
 ;;  * mixi-get-messages
@@ -1753,6 +1754,28 @@ Increase this value when unexpected error frequently occurs."
                           (nth 1 item)))))
            items)))
 
+(defmacro mixi-search-bbs-list-page (keyword)
+  `(concat "/search_topic.pl?page=%d&type=top&submit=search"
+          "&keyword=" (mixi-url-encode-and-quote-percent-string keyword)
+          "&community_id=0&category_id=0"))
+
+(defconst mixi-search-bbs-list-regexp
+  "<a href=\"view_\\(bbs\\|event\\)\\.pl\\?id=\\([0-9]+\\)&comm_id=\\([0-9]+\\)\"><img src=http://img\\.mixi\\.jp/img/shbtn\\.gif ALT=¾ÜºÙ¤ò¸«¤ë BORDER=0 WIDTH=104 HEIGHT=19></a>")
+
+;; FIXME: Support community and category.
+(defun mixi-search-bbses (keyword &optional range)
+  (let ((items (mixi-get-matched-items (mixi-search-bbs-list-page keyword)
+                                      mixi-search-bbs-list-regexp
+                                      range)))
+    (mapcar (lambda (item)
+             (let ((name (nth 0 item)))
+               (when (string= name "bbs")
+                 (setq name "topic"))
+               (let ((func (intern (concat "mixi-make-" name))))
+                 (funcall func (mixi-make-community (nth 2 item))
+                          (nth 1 item)))))
+           items)))
+
 ;; Comment object.
 (defun mixi-make-comment (parent owner time content)
   "Return a comment object."