From: bg66 Date: Mon, 18 Dec 2006 09:33:26 +0000 (+0000) Subject: * sb-mixi.el (shimbun-mixi-make-subject): Add SHIMBUN argument. X-Git-Tag: mixi-el-1_0_0~158 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=096e7deafcf305bb6fc4b726581819136536543f;p=elisp%2Fmixi.git * sb-mixi.el (shimbun-mixi-make-subject): Add SHIMBUN argument. (shimbun-mixi-get-headers): Follow the change above. * mixi.el (mixi-topic-community-regexp): New regexp. (mixi-topic-realize): Use it. (mixi-event-community-regexp): New regexp. (mixi-event-realize): Use it. (mixi-bbs-list): New constant. (mixi-bbs-p): New macro. (mixi-bbs-community): New function. --- diff --git a/ChangeLog b/ChangeLog index e852d61..bbb0e29 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,18 @@ 2006-12-18 OHASHI Akira + * sb-mixi.el (shimbun-mixi-make-subject): Add SHIMBUN argument. + (shimbun-mixi-get-headers): Follow the change above. + + * mixi.el (mixi-topic-community-regexp): New regexp. + (mixi-topic-realize): Use it. + (mixi-event-community-regexp): New regexp. + (mixi-event-realize): Use it. + (mixi-bbs-list): New constant. + (mixi-bbs-p): New macro. + (mixi-bbs-community): New function. + +2006-12-18 OHASHI Akira + * mixi.el (mixi-curl-cookie-file): Change the default value to ~/.mixi/cookies.txt. diff --git a/mixi.el b/mixi.el index 18aa4dc..c3c5aa1 100644 --- a/mixi.el +++ b/mixi.el @@ -1460,6 +1460,8 @@ Increase this value when unexpected error frequently occurs." `(concat "/view_bbs.pl?id=" (mixi-topic-id ,topic) "&comm_id=" (mixi-community-id (mixi-topic-community ,topic)))) +(defconst mixi-topic-community-regexp + "\\[\\(.+\\)\\] ¥È¥Ô¥Ã¥¯") (defconst mixi-topic-time-regexp "\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü
\\([0-9]+\\):\\([0-9]+\\)") (defconst mixi-topic-title-regexp @@ -1474,6 +1476,10 @@ Increase this value when unexpected error frequently occurs." ;; FIXME: Check a expiration of cache? (unless (mixi-object-realize-p topic) (with-mixi-retrieve (mixi-topic-page topic) + (if (string-match mixi-topic-community-regexp buffer) + (mixi-community-set-name (mixi-topic-community topic) + (match-string 1 buffer)) + (signal 'error (list 'cannot-find-community topic))) (if (string-match mixi-topic-time-regexp buffer) (mixi-topic-set-time topic (encode-time 0 (string-to-number (match-string 5 buffer)) @@ -1588,6 +1594,8 @@ Increase this value when unexpected error frequently occurs." `(concat "/view_event.pl?id=" (mixi-event-id ,event) "&comm_id=" (mixi-community-id (mixi-event-community ,event)))) +(defconst mixi-event-community-regexp + "\\[\\(.+\\)\\] ¥¤¥Ù¥ó¥È") (defconst mixi-event-time-regexp " \\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü
@@ -1624,6 +1632,10 @@ Increase this value when unexpected error frequently occurs." ;; FIXME: Check a expiration of cache? (unless (mixi-object-realize-p event) (with-mixi-retrieve (mixi-event-page event) + (if (string-match mixi-event-community-regexp buffer) + (mixi-community-set-name (mixi-event-community event) + (match-string 1 buffer)) + (signal 'error (list 'cannot-find-title event))) (if (string-match mixi-event-time-regexp buffer) (mixi-event-set-time event (encode-time 0 (string-to-number (match-string 5 buffer)) @@ -1778,10 +1790,24 @@ Increase this value when unexpected error frequently occurs." (aset (cdr event) 10 members)) ;; Bbs object. -(defalias 'mixi-bbs-owner 'mixi-object-owner) +(defconst mixi-bbs-list '(mixi-topic mixi-event)) + +(defmacro mixi-bbs-p (object) + `(when (memq (mixi-object-class ,object) mixi-bbs-list) + t)) + +(defun mixi-bbs-community (object) + "Return the community of OBJECT." + (unless (mixi-bbs-p object) + (signal 'wrong-type-argument (list 'mixi-bbs-p object))) + (let ((func (intern (concat mixi-object-prefix + (mixi-object-name object) "-community")))) + (funcall func object))) + (defalias 'mixi-bbs-id 'mixi-object-id) (defalias 'mixi-bbs-time 'mixi-object-time) (defalias 'mixi-bbs-title 'mixi-object-title) +(defalias 'mixi-bbs-owner 'mixi-object-owner) (defalias 'mixi-bbs-content 'mixi-object-content) (defmacro mixi-bbs-list-page (community) diff --git a/sb-mixi.el b/sb-mixi.el index 227fda3..340450d 100644 --- a/sb-mixi.el +++ b/sb-mixi.el @@ -71,7 +71,7 @@ of mixi object." :type 'boolean) (defcustom shimbun-mixi-logout-p nil - "*If non-ni, Logout from mixi when shimbun server was closed." + "*If non-ni, logout from mixi when shimbun server was closed." :group 'shimbun :type 'boolean) @@ -94,14 +94,23 @@ of mixi object." (luna-define-method shimbun-groups ((shimbun shimbun-mixi)) (mapcar 'car shimbun-mixi-group-alist)) -(defun shimbun-mixi-make-subject (object) +(defun shimbun-mixi-make-subject (shimbun object) (let ((class (mixi-object-class object))) - (cond ((eq class 'mixi-comment) - (concat "Re: " (shimbun-mixi-make-subject - (mixi-comment-parent object)))) - ((eq class 'mixi-event) - (concat "[¥¤¥Ù¥ó¥È]" (mixi-event-title object))) - (t (mixi-object-title object))))) + (if (eq class 'mixi-comment) + (concat "Re: " (shimbun-mixi-make-subject + shimbun (mixi-comment-parent object))) + (let ((prefix (when (eq class 'mixi-event) "[¥¤¥Ù¥ó¥È]")) + (subject (mixi-object-title object)) + (suffix (when (string-match + "^new-" (shimbun-current-group-internal shimbun)) + (concat " (" + (if (eq class 'mixi-diary) + (mixi-friend-nick + (mixi-diary-friend object)) + (mixi-community-name + (mixi-bbs-community object))) + ")")))) + (concat prefix subject suffix))))) (defun shimbun-mixi-make-from (object) (let ((owner (mixi-object-owner object))) @@ -175,7 +184,7 @@ of mixi object." (push (shimbun-create-header 0 - (shimbun-mixi-make-subject object) + (shimbun-mixi-make-subject shimbun object) (shimbun-mixi-make-from object) (shimbun-mixi-make-date object) id