From f20f165560bce2a6fc8f130ba3dc686f39e37753 Mon Sep 17 00:00:00 2001 From: bg66 Date: Thu, 19 Apr 2007 08:42:28 +0000 Subject: [PATCH] * sb-mixi.el (shimbun-mixi-to-regexp): Abolish. (shimbun-mixi-send-mail): Ditto. * mixi-utils.el (mixi-to-regexp): New constant. (mixi-send-mail): New function. * mixi-gnus.el (message-mixi-p): Follow the change above. (message-send-via-mixi): Ditto. * mixi-wl.el (wl-draft-send-mail-with-mixi): Ditto. (mixi-wl-setup-draft-buffer): Ditto. * acinclude.m4 (AC_EXAMINE_MODULES): Ditto. --- ChangeLog | 12 ++++++++++++ acinclude.m4 | 12 ++++++------ mixi-gnus.el | 13 ++++++------- mixi-utils.el | 27 +++++++++++++++++++++++++++ mixi-wl.el | 18 ++++++++---------- sb-mixi.el | 27 --------------------------- 6 files changed, 59 insertions(+), 50 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5fe242f..491be8b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2007-04-19 OHASHI Akira + + * sb-mixi.el (shimbun-mixi-to-regexp): Abolish. + (shimbun-mixi-send-mail): Ditto. + * mixi-utils.el (mixi-to-regexp): New constant. + (mixi-send-mail): New function. + * mixi-gnus.el (message-mixi-p): Follow the change above. + (message-send-via-mixi): Ditto. + * mixi-wl.el (wl-draft-send-mail-with-mixi): Ditto. + (mixi-wl-setup-draft-buffer): Ditto. + * acinclude.m4 (AC_EXAMINE_MODULES): Ditto. + 2007-04-16 OHASHI Akira * mixi-wl.el (wl-draft-send-mail-with-mixi): Check that title is not diff --git a/acinclude.m4 b/acinclude.m4 index 92d09ee..d3161fd 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -301,12 +301,12 @@ AC_DEFUN([AC_EXAMINE_MODULES], if test ${HAVE_SHIMBUN} = yes; then MODULES="${MODULES} ${MODULES_SHIMBUN}" - if test ${HAVE_GNUS} = yes; then - MODULES="${MODULES} ${MODULES_GNUS}" - fi - if test ${HAVE_WL} = yes; then - MODULES="${MODULES} ${MODULES_WL}" - fi + fi + if test ${HAVE_GNUS} = yes; then + MODULES="${MODULES} ${MODULES_GNUS}" + fi + if test ${HAVE_WL} = yes; then + MODULES="${MODULES} ${MODULES_WL}" fi if test ${HAVE_RIECE} = yes; then MODULES="${MODULES} ${MODULES_RIECE}" diff --git a/mixi-gnus.el b/mixi-gnus.el index 77b7312..009dd21 100644 --- a/mixi-gnus.el +++ b/mixi-gnus.el @@ -34,7 +34,7 @@ ;;; Code: -(require 'sb-mixi) +(require 'mixi-utils) (require 'message) (defun message-mixi-p () @@ -44,8 +44,7 @@ (save-restriction (message-narrow-to-headers) (or (message-fetch-field "mixi-to") - (string-match shimbun-mixi-to-regexp - (message-fetch-field "to"))))))) + (string-match mixi-to-regexp (message-fetch-field "to"))))))) (defun message-send-via-mixi (arg) "Send the current message via mixi." @@ -66,10 +65,10 @@ (insert (with-current-buffer mailbuf (mml-buffer-substring-no-properties-except-hard-newlines (point-min) (point-max)))) - (shimbun-mixi-send-mail (message-fetch-field "mixi-to") - (message-fetch-field "subject") - (buffer-substring (message-goto-body) - (point-max)))) + (mixi-send-mail (message-fetch-field "mixi-to") + (message-fetch-field "subject") + (buffer-substring (message-goto-body) + (point-max)))) (kill-buffer tembuf)) (set-buffer mailbuf) (push 'mixi message-sent-message-via))) diff --git a/mixi-utils.el b/mixi-utils.el index 8008f8e..82b996b 100644 --- a/mixi-utils.el +++ b/mixi-utils.el @@ -234,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 diff --git a/mixi-wl.el b/mixi-wl.el index db06074..7f404eb 100644 --- a/mixi-wl.el +++ b/mixi-wl.el @@ -34,7 +34,7 @@ ;;; Code: -(require 'sb-mixi) +(require 'mixi-utils) (require 'wl-draft) (defsubst mixi-wl-get-recipients-from-buffer () @@ -53,19 +53,17 @@ "$\\|^$") nil t) (point-marker))) (id (std11-field-body "message-id"))) - (shimbun-mixi-send-mail recipients - (eword-decode-string - (or (std11-field-body "subject") "")) - (decode-mime-charset-string - (buffer-substring (1+ delimline) - (point-max)) - wl-mime-charset)) + (mixi-send-mail recipients + (eword-decode-string (or (std11-field-body "subject") + "")) + (decode-mime-charset-string + (buffer-substring (1+ delimline) (point-max)) + wl-mime-charset)) (wl-draft-set-sent-message 'mail 'sent) (wl-draft-write-sendlog 'ok 'mixi nil (list recipients) id)))) (defun mixi-wl-setup-draft-buffer () - (when (string-match shimbun-mixi-to-regexp - (mixi-wl-get-recipients-from-buffer)) + (when (string-match mixi-to-regexp (mixi-wl-get-recipients-from-buffer)) (make-local-variable 'wl-draft-send-confirm-with-preview) (setq wl-draft-send-confirm-with-preview nil) (make-local-variable 'wl-draft-send-mail-function) diff --git a/sb-mixi.el b/sb-mixi.el index 22c9e4c..8a6234f 100644 --- a/sb-mixi.el +++ b/sb-mixi.el @@ -235,33 +235,6 @@ of mixi object." (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 -- 1.7.10.4