From ed2a8dea9cb227130a2cdfd0aaecababac680442 Mon Sep 17 00:00:00 2001 From: bg66 Date: Wed, 27 Dec 2006 09:31:25 +0000 Subject: [PATCH] * mixi.el (mixi-post-message-page): New macro. (mixi-post-message-key-regexp): New constant. (mixi-post-message-succeed-regexp): Ditto. (mixi-post-message): New function. --- ChangeLog | 7 +++++++ mixi.el | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0af3916..41eaa79 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2006-12-27 OHASHI Akira + * mixi.el (mixi-post-message-page): New macro. + (mixi-post-message-key-regexp): New constant. + (mixi-post-message-succeed-regexp): Ditto. + (mixi-post-message): New function. + +2006-12-27 OHASHI Akira + * mixi.el (mixi-post-diary-id-regexp): Abolish. (mixi-post-diary-title-regexp): Ditto. (mixi-post-diary-body-regexp): Ditto. diff --git a/mixi.el b/mixi.el index 81ac4a7..587def2 100644 --- a/mixi.el +++ b/mixi.el @@ -47,6 +47,7 @@ ;; * mixi-post-diary ;; * mixi-post-topic ;; * mixi-post-comment +;; * mixi-post-message ;; ;; Utilities: ;; @@ -2414,6 +2415,40 @@ Increase this value when unexpected error frequently occurs." (mixi-make-message (nth 0 item) (nth 1 item))) items)))) +(defmacro mixi-post-message-page (friend) + `(concat "/send_message.pl?id=" (mixi-friend-id friend))) + +(defconst mixi-post-message-key-regexp + "") + +(defconst mixi-post-message-succeed-regexp + "Á÷¿®´°Î»¤·¤Þ¤·¤¿¡£") + +(defun mixi-post-message (friend title content) + "Post a message to FRIEND." + (unless (mixi-friend-p friend) + (signal 'wrong-type-argument (list 'mixi-friend-p friend))) + (unless (stringp title) + (signal 'wrong-type-argument (list 'stringp title))) + (unless (stringp content) + (signal 'wrong-type-argument (list 'stringp content))) + (let ((fields `(("subject" . ,title) + ("body" . ,content) + ("submit" . "main"))) + post-key) + (with-mixi-post-form (mixi-post-message-page friend) fields + (if (string-match mixi-post-message-key-regexp buffer) + (setq post-key (match-string 1 buffer)) + (mixi-post-error 'cannot-find-key friend))) + (setq fields `(("post_key" . ,post-key) + ("subject" . ,title) + ("body" . ,content) + ("yes" . "¡¡Á÷¡¡¿®¡¡") + ("submit" . "confirm"))) + (with-mixi-post-form (mixi-post-message-page friend) fields + (unless (string-match mixi-post-message-succeed-regexp buffer) + (mixi-post-error 'cannot-find-succeed friend))))) + ;; Introduction object. (defun mixi-make-introduction (parent owner content) "Return a introduction object." -- 1.7.10.4