-;; mixi-utils.el --- Utilities for mixi object
+;; mixi-utils.el --- Utilities for mixi object -*- coding: euc-jp -*-
;; Copyright (C) 2007 OHASHI Akira
(subject (mixi-object-title object))
(suffix (when add-parent
(concat " ("
- (if (eq class 'mixi-diary)
- (mixi-friend-nick
- (mixi-diary-owner object))
- (mixi-community-name
- (mixi-bbs-community object)))
+ (cond ((eq class 'mixi-diary)
+ (mixi-friend-nick
+ (mixi-diary-owner object)))
+ ((eq class 'mixi-news)
+ (mixi-news-media object))
+ (t
+ (mixi-community-name
+ (mixi-bbs-community object))))
")"))))
(concat prefix subject suffix))))))
(concat mixi-reply-to "message;"
(mixi-friend-id object))))))))
+(defconst mixi-to-regexp
+ "^mixi;\\([a-z]+\\);?\\([a-z0-9]+\\)?;?\\([0-9]+\\)?;?\\([0-9]+\\)?")
+
+(defun mixi-send-mail (to title content)
+ (when (string-match 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 'mixi-utils)
;;; mixi-utils.el ends here