(defcustom shimbun-mixi-group-alist '(("new-diaries" . mixi-get-new-diaries)
("new-comments" . mixi-get-new-comments)
("new-topics" . mixi-get-new-topics)
+ ("messages" . mixi-get-messages)
("my-diaries" . "/home.pl"))
"*An alist of mixi shimbun group definition.
Each element looks like (NAME . URL) or (NAME . FUNCTION).
(const :tag "New diaries" mixi-get-new-diaries)
(const :tag "New comments" mixi-get-new-comments)
(const :tag "New topics" mixi-get-new-topics)
+ (const :tag "Messages" mixi-get-messages)
(function :tag "Other function")))))
(defcustom shimbun-mixi-page-articles 10
:group 'shimbun
:type 'integer)
+(defcustom shimbun-mixi-get-comment-p t
+ "*If non-nil, get diaries or topics together with its comments."
+ :group 'shimbun
+ :type 'boolean)
+
(luna-define-method shimbun-groups ((shimbun shimbun-mixi))
(mapcar 'car shimbun-mixi-group-alist))
(mixi-expand-url (mixi-topic-page object)))
((eq class 'mixi-comment)
(concat (shimbun-mixi-make-xref (mixi-comment-parent object))
- "#comment")))))
+ "#comment"))
+ ((eq class 'mixi-message)
+ (mixi-expand-url (mixi-message-page object))))))
-(defun shimbun-mixi-get-headers (objects &optional range)
+(defun shimbun-mixi-get-headers (shimbun objects &optional range)
(when objects
(let (headers)
- (mapc (lambda (object)
- (when (mixi-object-p object)
- (let ((class (mixi-object-class object)))
- (push
- (shimbun-create-header
- 0
- (shimbun-mixi-make-subject object)
- (shimbun-mixi-make-from object)
- (shimbun-mixi-make-date object)
- (shimbun-mixi-make-message-id object)
- (if (eq class 'mixi-comment)
- (shimbun-mixi-make-message-id
- (mixi-comment-parent object))
- "")
- 0 0
- (shimbun-mixi-make-xref object))
- headers)
- (when (or (eq class 'mixi-diary)
- (eq class 'mixi-topic))
- (let ((comments (mixi-get-comments object range)))
- (mapc (lambda (header)
- (push header headers))
- (shimbun-mixi-get-headers comments)))))))
- objects)
+ (catch 'stop
+ (mapc (lambda (object)
+ (when (mixi-object-p object)
+ (let ((class (mixi-object-class object))
+ (id (shimbun-mixi-make-message-id object)))
+ (when (and (eq class 'mixi-comment)
+ (shimbun-search-id shimbun id))
+ (throw 'stop nil))
+ (push
+ (shimbun-create-header
+ 0
+ (shimbun-mixi-make-subject object)
+ (shimbun-mixi-make-from object)
+ (shimbun-mixi-make-date object)
+ id
+ (if (eq class 'mixi-comment)
+ (shimbun-mixi-make-message-id
+ (mixi-comment-parent object))
+ "")
+ 0 0
+ (shimbun-mixi-make-xref object))
+ headers)
+ (when (and shimbun-mixi-get-comment-p
+ (or (eq class 'mixi-diary)
+ (eq class 'mixi-topic)))
+ (let ((comments (mixi-get-comments object range)))
+ (mapc (lambda (header)
+ (push header headers))
+ (shimbun-mixi-get-headers shimbun
+ comments)))))))
+ objects))
headers)))
(luna-define-method shimbun-get-headers ((shimbun shimbun-mixi)
&optional range)
(let ((url-or-function (cdr (assoc (shimbun-current-group-internal shimbun)
shimbun-mixi-group-alist)))
- ;; FIXME: Magic number.
(range (when (integerp range) (* range shimbun-mixi-page-articles)))
objects)
(if (stringp url-or-function)
" is not supported yet.")))))
(when (fboundp url-or-function)
(setq objects (funcall url-or-function range))))
- (shimbun-sort-headers (shimbun-mixi-get-headers objects range))))
+ (shimbun-sort-headers (shimbun-mixi-get-headers shimbun objects range))))
(defun shimbun-comment-article (url header)
(let ((parent (mixi-make-object-from-url url))
(date (shimbun-header-date header))
- (from (shimbun-header-from header)))
+ (message-id (shimbun-header-id header)))
(catch 'found
(mapc (lambda (comment)
- (let ((nick (mixi-friend-nick (mixi-comment-owner comment)))
- (time (shimbun-mixi-make-date comment))
- nick2)
- ;; FIXME: How tricky it is.
- (when (string-match "\\(.+\\)¤µ¤ó$" nick)
- (setq nick2 (match-string 1 nick)))
- (when (and
- (or (string= (shimbun-mime-encode-string nick) from)
- (string= (shimbun-mime-encode-string nick2) from))
- (string= time date))
+ (let ((id (mixi-friend-id (mixi-comment-owner comment)))
+ (time (shimbun-mixi-make-date comment)))
+ (when (and (string= time date)
+ (string-match (concat "^<[0-9]+\\." id "@")
+ message-id))
;; FIXME: Concat parent's information?
(throw 'found (mixi-comment-content comment)))))
;; FIXME: Limit range?