2006-12-18 OHASHI Akira <bg66@koka-in.org>
+ * 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 <bg66@koka-in.org>
+
* mixi.el (mixi-curl-cookie-file): Change the default value to
~/.mixi/cookies.txt.
`(concat "/view_bbs.pl?id=" (mixi-topic-id ,topic)
"&comm_id=" (mixi-community-id (mixi-topic-community ,topic))))
+(defconst mixi-topic-community-regexp
+ "<td width=\"595\" background=\"http://img\\.mixi\\.jp/img/bg_w\\.gif\"><b>\\[\\(.+\\)\\] ¥È¥Ô¥Ã¥¯</b></td>")
(defconst mixi-topic-time-regexp
"<td rowspan=\"3\" width=\"110\" bgcolor=\"#ffd8b0\" align=\"center\" valign=\"top\" nowrap>\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü<br>\\([0-9]+\\):\\([0-9]+\\)</td>")
(defconst mixi-topic-title-regexp
;; 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))
`(concat "/view_event.pl?id=" (mixi-event-id ,event)
"&comm_id=" (mixi-community-id (mixi-event-community ,event))))
+(defconst mixi-event-community-regexp
+ "<td WIDTH=595 background=http://img\\.mixi\\.jp/img/bg_w\\.gif><b>\\[\\(.+\\)\\] ¥¤¥Ù¥ó¥È</b></td>")
(defconst mixi-event-time-regexp
"<td ROWSPAN=11 BGCOLOR=#FFD8B0 ALIGN=center VALIGN=top WIDTH=110>
\\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü<br>
;; 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))
(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)
: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)
(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)))
(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