* mixi.el (mixi-log-list-regexp): Fix regexp.
[elisp/mixi.git] / sb-mixi.el
index cf775b1..5ca6bcd 100644 (file)
@@ -58,6 +58,11 @@ FUNCTION is the function for getting articles."
   :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))
 
@@ -132,8 +137,9 @@ FUNCTION is the function for getting articles."
                      0 0
                      (shimbun-mixi-make-xref object))
                     headers)
-                   (when (or (eq class 'mixi-diary)
-                             (eq class 'mixi-topic))
+                   (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))
@@ -166,19 +172,14 @@ FUNCTION is the function for getting articles."
 (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?