(luna-define-class shimbun-mixi (shimbun) (comment-cache))
(luna-define-internal-accessors 'shimbun-mixi))
-(defcustom shimbun-mixi-group-alist '(("new-diaries" . mixi-get-new-diaries)
- ("new-comments" . mixi-get-new-comments)
- ("new-bbses" . mixi-get-new-bbses)
- ("messages" . mixi-get-messages)
- ("my-diaries" . "/home.pl"))
+(defcustom shimbun-mixi-group-alist
+ '(("new-diaries" . mixi-get-new-diaries)
+ ("new-comments" . mixi-get-new-comments)
+ ("new-bbses" . mixi-get-new-bbses)
+ ("messages" . mixi-get-messages)
+ ("my-diaries" . "/home.pl")
+ ("news.newest.domestic" .
+ (lambda (range)
+ (mixi-get-news 'domestic 'newest range)))
+ ("news.newest.politics" .
+ (lambda (range)
+ (mixi-get-news 'politics 'newest range)))
+ ("news.newest.economy" .
+ (lambda (range)
+ (mixi-get-news 'economy 'newest range)))
+ ("news.newest.area" .
+ (lambda (range)
+ (mixi-get-news 'area 'newest range)))
+ ("news.newest.abroad" .
+ (lambda (range)
+ (mixi-get-news 'abroad 'newest range)))
+ ("news.newest.sports" .
+ (lambda (range)
+ (mixi-get-news 'sports 'newest range)))
+ ("news.newest.entertainment" .
+ (lambda (range)
+ (mixi-get-news 'entertainment 'newest range)))
+ ("news.newest.it" .
+ (lambda (range)
+ (mixi-get-news 'IT 'newest range)))
+ ("news.pickup.domestic" .
+ (lambda (range)
+ (mixi-get-news 'domestic 'pickup range)))
+ ("news.pickup.politics" .
+ (lambda (range)
+ (mixi-get-news 'politics 'pickup range)))
+ ("news.pickup.economy" .
+ (lambda (range)
+ (mixi-get-news 'economy 'pickup range)))
+ ("news.pickup.area" .
+ (lambda (range)
+ (mixi-get-news 'area 'pickup range)))
+ ("news.pickup.abroad" .
+ (lambda (range)
+ (mixi-get-news 'abroad 'pickup range)))
+ ("news.pickup.sports" .
+ (lambda (range)
+ (mixi-get-news 'sports 'pickup range)))
+ ("news.pickup.entertainment" .
+ (lambda (range)
+ (mixi-get-news 'entertainment 'pickup range)))
+ ("news.pickup.it" .
+ (lambda (range)
+ (mixi-get-news 'IT 'pickup range))))
"*An alist of mixi shimbun group definition.
Each element looks like (NAME . URL) or (NAME . FUNCTION).
NAME is a shimbun group name.
-URL is the URL for mixi access point of the group. When URL is friend's, get
-his/her diaries as article. When community's, get its BBSes. When diary's
-or BBS's, get its comments.
+URL is the URL for mixi access point of the group. If URL is friend's, get
+his/her diaries as article. If community's, get its BBSes. If diary's or
+BBS's, get its comments.
FUNCTION is the function which has one `range' argument and returns the list
of mixi object."
:group 'shimbun
:group 'shimbun
:type 'integer)
-(defcustom shimbun-mixi-logout-p nil
- "*If non-ni, logout from mixi when shimbun server was closed."
- :group 'shimbun
- :type 'boolean)
-
(defvar shimbun-mixi-x-face-alist
'(("default" . "X-Face: CY;j#FoBnpK^37`-IoJvN!J^u;GciiPmMQ@T)~RP1]t8iv?v)/bVI:I\"F!JfWJvhM5{zY!=
h.d+'g\\I{D>Ocy?Rc4uYUyOZj2%2Kl>,x-!MCSsyi3!L}psrrC1jlF,O?Ui>qf)X;sBz`/}\\066X%$
siG'|4K!2?==|oB&#E'5GGH\\#z[muyQ")))
+(defvar shimbun-mixi-reply-to nil)
+
(luna-define-method initialize-instance :after ((shimbun shimbun-mixi)
&rest init-args)
(shimbun-mixi-set-comment-cache-internal shimbun
(luna-define-method shimbun-close :after ((shimbun shimbun-mixi))
(shimbun-mixi-set-comment-cache-internal shimbun nil)
- (when shimbun-mixi-logout-p
- (mixi-logout)))
+ (mixi-logout))
(luna-define-method shimbun-groups ((shimbun shimbun-mixi))
(mapcar 'car shimbun-mixi-group-alist))
+(luna-define-method shimbun-reply-to ((shimbun shimbun-mixi))
+ shimbun-mixi-reply-to)
+
(defun shimbun-mixi-make-subject (shimbun object)
(let ((class (mixi-object-class object)))
(if (eq class 'mixi-comment)
(concat prefix subject suffix)))))
(defun shimbun-mixi-make-from (object)
- (let ((owner (mixi-object-owner object)))
- (mixi-friend-nick owner)))
+ (let ((class (mixi-object-class object)))
+ (if (eq class 'mixi-news)
+ (mixi-news-media object)
+ (let ((owner (mixi-object-owner object)))
+ (mixi-friend-nick owner)))))
(defun shimbun-mixi-make-date (object)
(let* ((time (mixi-object-time object))
(mixi-friend-id (mixi-object-owner
(mixi-comment-parent object))) ".")
(concat (mixi-object-id object) "@"
- (mixi-object-id (mixi-object-owner object)) "."))
+ (if (eq class 'mixi-news)
+ (mixi-news-media-id object)
+ (mixi-object-id (mixi-object-owner object))) "."))
(mixi-object-name object) ".mixi.jp"
">")))
(concat (shimbun-mixi-make-xref (mixi-comment-parent object))
"#comment"))
((eq class 'mixi-message)
- (mixi-expand-url (mixi-message-page object))))))
+ (mixi-expand-url (mixi-message-page object)))
+ ((eq class 'mixi-news)
+ (mixi-news-page object)))))
(defun shimbun-mixi-make-body (object)
(let ((class (mixi-object-class object)))
"<dd>" (mixi-event-members object) "</dd></dl>")))
(t (mixi-object-content object)))))
+(defun shimbun-mixi-make-reply-to (object)
+ (setq shimbun-mixi-reply-to "mixi;")
+ (let ((class (mixi-object-class object)))
+ (setq shimbun-mixi-reply-to
+ (concat
+ (cond ((eq class 'mixi-diary)
+ (concat shimbun-mixi-reply-to "comment;diary;"
+ (mixi-friend-id (mixi-diary-owner object)) ";"
+ (mixi-diary-id object)))
+ ((mixi-bbs-p object)
+ (concat shimbun-mixi-reply-to "comment;"
+ (mixi-object-name object) ";"
+ (mixi-community-id (mixi-bbs-community object)) ";"
+ (mixi-bbs-id object)))
+ ((eq class 'mixi-community)
+ (concat shimbun-mixi-reply-to "topic;"
+ (mixi-community-id object)))
+ ((or (eq class 'mixi-news) (eq object (mixi-make-me)))
+ (concat shimbun-mixi-reply-to "diary"))
+ ((eq class 'mixi-message)
+ (concat shimbun-mixi-reply-to "message;"
+ (mixi-friend-id (mixi-message-owner object))))
+ ((or (eq class 'mixi-friend) (eq class 'mixi-log))
+ (concat shimbun-mixi-reply-to "message;"
+ (mixi-friend-id object))))))))
+
(defun shimbun-mixi-get-headers (shimbun objects &optional range)
(when objects
(let (headers)
(w3m-insert-string
(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)
- (shimbun-mixi-make-body
- (mixi-make-object-from-url url)))))
+ (shimbun-mixi-make-body object))))
+ (shimbun-mixi-make-reply-to object)
(when (stringp article)
(insert article)))
(shimbun-message shimbun "shimbun: Make contents...")
(shimbun-message shimbun "shimbun: Make contents...done")))
"")))))
+(defconst shimbun-mixi-to-regexp
+ "^mixi;\\([a-z]+\\);?\\([a-z0-9]+\\)?;?\\([0-9]+\\)?;?\\([0-9]+\\)?")
+
+(defun shimbun-mixi-send-mail (to title content)
+ (when (string-match shimbun-mixi-to-regexp to)
+ (let ((method (match-string 1 to)))
+ (cond ((string= method "comment")
+ (let ((parent (match-string 2 to))
+ (owner-id (match-string 3 to))
+ (id (match-string 4 to)))
+ (if (string= parent "diary")
+ (mixi-post-comment
+ (mixi-make-diary (mixi-make-friend owner-id) id) content)
+ (let ((func (intern
+ (concat mixi-object-prefix "make-" parent))))
+ (mixi-post-comment
+ (funcall func (mixi-make-community owner-id) id)
+ content)))))
+ ((string= method "topic")
+ (mixi-post-topic (mixi-make-community (match-string 2 to))
+ title content))
+ ((string= method "diary")
+ (mixi-post-diary title content))
+ ((string= method "message")
+ (mixi-post-message (mixi-make-friend (match-string 2 to))
+ title content))))))
+
(provide 'sb-mixi)
;;; sb-mixi.el ends here