X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=sb-mixi.el;h=259a31fc21f004742dba78539c2a2f7fd20e552c;hb=38b07099ad2519cbed3b2e929f09f5d24ae98c70;hp=248929b403445ad329bbd9bd4adb12d75888c65f;hpb=6f0347f9ea0b4a65df004ea48dd7c930a7e9e0cd;p=elisp%2Fmixi.git diff --git a/sb-mixi.el b/sb-mixi.el index 248929b..259a31f 100644 --- a/sb-mixi.el +++ b/sb-mixi.el @@ -1,6 +1,6 @@ ;;; sb-mixi.el --- shimbun backend for mixi -;; Copyright (C) 2006, 2007 OHASHI Akira +;; Copyright (C) 2006, 2007, 2008 OHASHI Akira ;; Author: OHASHI Akira ;; Keywords: news @@ -18,9 +18,9 @@ ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with this program; if not, you can either send email to this -;; program's maintainer or write to: The Free Software Foundation, -;; Inc.; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. ;;; Commentary: @@ -33,10 +33,10 @@ (require 'mixi-utils) (require 'shimbun) -(defconst shimbun-mixi-revision "$Revision: 1.58 $") +(defconst shimbun-mixi-revision "$Revision: 1.63 $") (eval-and-compile - (luna-define-class shimbun-mixi (shimbun) (comment-cache)) + (luna-define-class shimbun-mixi (shimbun) (comment-cache release-cache)) (luna-define-internal-accessors 'shimbun-mixi)) (defconst shimbun-mixi-default-group-alist @@ -75,6 +75,12 @@ ("news.newest.it" . (lambda (range) (mixi-get-news 'IT 'newest range))) + ("news.newest.game-anime" . + (lambda (range) + (mixi-get-news 'game-anime 'newest range))) + ("news.newest.column" . + (lambda (range) + (mixi-get-news 'column 'newest range))) ("news.pickup.domestic" . (lambda (range) (mixi-get-news 'domestic 'pickup range))) @@ -98,7 +104,14 @@ (mixi-get-news 'entertainment 'pickup range))) ("news.pickup.it" . (lambda (range) - (mixi-get-news 'IT 'pickup range)))) + (mixi-get-news 'IT 'pickup range))) + ("news.pickup.game-anime" . + (lambda (range) + (mixi-get-news 'game-anime 'pickup range))) + ("news.pickup.column" . + (lambda (range) + (mixi-get-news 'column 'pickup range))) + ("releases" . mixi-get-releases)) "An alist of mixi shimbun group default definition.") (defcustom shimbun-mixi-group-alist nil @@ -121,6 +134,11 @@ of mixi object." :group 'shimbun :type 'boolean) +(defcustom shimbun-mixi-add-comment-count-to-author t + "*If non-nil, add comment count to author." + :group 'shimbun + :type 'boolean) + ;; FIXME: Don't use this user option. (defcustom shimbun-mixi-page-articles 10 "*How many articles are there in one page." @@ -140,10 +158,13 @@ of mixi object." &rest init-args) (shimbun-mixi-set-comment-cache-internal shimbun (make-hash-table :test 'equal)) + (shimbun-mixi-set-release-cache-internal shimbun + (make-hash-table :test 'equal)) shimbun) (luna-define-method shimbun-close :after ((shimbun shimbun-mixi)) (shimbun-mixi-set-comment-cache-internal shimbun nil) + (shimbun-mixi-set-release-cache-internal shimbun nil) (mixi-logout)) (luna-define-method shimbun-groups ((shimbun shimbun-mixi)) @@ -181,7 +202,7 @@ of mixi object." "^new-" (shimbun-current-group-internal shimbun))) - (mixi-make-author object) + (mixi-make-author object shimbun-mixi-add-comment-count-to-author) (mixi-make-date object) id (if (eq class 'mixi-comment) @@ -224,6 +245,21 @@ of mixi object." (setq comments (cdr comments))))) article)) +(defun shimbun-mixi-release-article (shimbun header) + (let* ((message-id (shimbun-header-id header)) + (cache (shimbun-mixi-release-cache-internal shimbun)) + (article (gethash message-id cache))) + (unless (stringp article) + (let ((releases (mixi-get-releases))) + (while releases + (let ((id (mixi-make-message-id (car releases))) + (content (mixi-release-content (car releases)))) + (puthash id content cache) + (when (string= id message-id) + (setq article content))) + (setq releases (cdr releases))))) + article)) + (luna-define-method shimbun-article ((shimbun shimbun-mixi) header &optional outbuf) (when (shimbun-current-group-internal shimbun) @@ -232,10 +268,14 @@ of mixi object." (or (with-temp-buffer (let* ((url (shimbun-article-url shimbun header)) (object (mixi-make-object-from-url url)) - (article (if (string-match "#comment$" url) - (shimbun-mixi-comment-article - url shimbun header) - (mixi-make-content object)))) + (article (cond ((string-match "#comment$" url) + (shimbun-mixi-comment-article + url shimbun header)) + ((string-match "release_info.pl$" url) + (shimbun-mixi-release-article + shimbun header)) + (t + (mixi-make-content object))))) (mixi-make-reply-to object) (when (stringp article) (insert article)))