X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=mixi-utils.el;h=82b996bb85c005abeb3796004e99e00d032079f1;hb=f20f165560bce2a6fc8f130ba3dc686f39e37753;hp=58f76d7d0561402379dbaf84f293e3ec2a67039c;hpb=1cb706d7fc9dfca40b5c795178cf25a201b0153e;p=elisp%2Fmixi.git diff --git a/mixi-utils.el b/mixi-utils.el index 58f76d7..82b996b 100644 --- a/mixi-utils.el +++ b/mixi-utils.el @@ -1,4 +1,4 @@ -;; mixi-utils.el --- Utilities for mixi object +;; mixi-utils.el --- Utilities for mixi object -*- coding: euc-jp -*- ;; Copyright (C) 2007 OHASHI Akira @@ -67,11 +67,14 @@ (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)))))) @@ -231,6 +234,33 @@ (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