From: bg66 Date: Wed, 27 Dec 2006 07:25:34 +0000 (+0000) Subject: * mixi.el (mixi-post-diary-id-regexp): Abolish. X-Git-Tag: mixi-el-1_0_0~137 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=17551c5244f6c174627f0a573fbbd680de9d1e50;p=elisp%2Fmixi.git * mixi.el (mixi-post-diary-id-regexp): Abolish. (mixi-post-diary-title-regexp): Ditto. (mixi-post-diary-body-regexp): Ditto. (mixi-post-key-regexp): Rename from `mixi-post-diary-key-regex'. (mixi-post-succeed-regexp): Rename from `mixi-post-diary-succeed-regexp'. (mixi-post-diary): Follow the change above. (mixi-post-topic-title-regexp): Abolish. (mixi-post-topic-body-regexp): Ditto. (mixi-post-topic-key-regexp): Ditto. (mixi-post-topic-succeed-regexp): Ditto. (mixi-post-topic): Follow the change above. (mixi-post-diary-comment-page): New function. (mixi-post-topic-comment-page): Ditto. (mixi-post-event-comment-page): Ditto. (mixi-post-comment): Ditto. --- diff --git a/ChangeLog b/ChangeLog index 4bbc2ef..0af3916 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,24 @@ 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. + (mixi-post-key-regexp): Rename from `mixi-post-diary-key-regex'. + (mixi-post-succeed-regexp): Rename from + `mixi-post-diary-succeed-regexp'. + (mixi-post-diary): Follow the change above. + (mixi-post-topic-title-regexp): Abolish. + (mixi-post-topic-body-regexp): Ditto. + (mixi-post-topic-key-regexp): Ditto. + (mixi-post-topic-succeed-regexp): Ditto. + (mixi-post-topic): Follow the change above. + (mixi-post-diary-comment-page): New function. + (mixi-post-topic-comment-page): Ditto. + (mixi-post-event-comment-page): Ditto. + (mixi-post-comment): Ditto. + +2006-12-27 OHASHI Akira + * mixi.el (mixi-post-diary-page): New macro. (mixi-post-diary): Use it and fix typo. (mixi-post-error): Add optional argument `object'. diff --git a/mixi.el b/mixi.el index 14e5f90..81ac4a7 100644 --- a/mixi.el +++ b/mixi.el @@ -46,6 +46,7 @@ ;; ;; * mixi-post-diary ;; * mixi-post-topic +;; * mixi-post-comment ;; ;; Utilities: ;; @@ -1262,16 +1263,10 @@ Increase this value when unexpected error frequently occurs." (defmacro mixi-post-diary-page () `(concat "/add_diary.pl")) -(defconst mixi-post-diary-key-regexp - "") -(defconst mixi-post-diary-id-regexp - "") -(defconst mixi-post-diary-title-regexp - "") -(defconst mixi-post-diary-body-regexp - "") -(defconst mixi-post-diary-succeed-regexp - "ºîÀ®¤¬´°Î»¤·¤Þ¤·¤¿¡£È¿±Ç¤Ë»þ´Ö¤¬¤«¤«¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹¤Î¤Ç¡¢É½¼¨¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¾¯¡¹¤ªÂÔ¤Á¤¯¤À¤µ¤¤¡£") +(defconst mixi-post-key-regexp + "") +(defconst mixi-post-succeed-regexp + "\\(ºîÀ®\\|½ñ¤­¹þ¤ß\\)¤¬´°Î»¤·¤Þ¤·¤¿¡£È¿±Ç¤Ë»þ´Ö¤¬¤«¤«¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹¤Î¤Ç¡¢É½¼¨¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¾¯¡¹¤ªÂÔ¤Á¤¯¤À¤µ¤¤¡£") ;; FIXME: Support photos. (defun mixi-post-diary (title content) @@ -1284,27 +1279,18 @@ Increase this value when unexpected error frequently occurs." ("diary_title" . ,title) ("diary_body" . ,content) ("submit" . "main"))) - post-key id diary-title diary-body) - (with-mixi-post-form mixi-post-diary-page fields - (if (string-match mixi-post-diary-key-regexp buffer) + post-key) + (with-mixi-post-form (mixi-post-diary-page) fields + (if (string-match mixi-post-key-regexp buffer) (setq post-key (match-string 1 buffer)) - (mixi-post-error 'cannot-find-key)) - (if (string-match mixi-post-diary-id-regexp buffer) - (setq id (match-string 1 buffer)) - (mixi-post-error 'cannot-find-id)) - (if (string-match mixi-post-diary-title-regexp buffer) - (setq diary-title (match-string 1 buffer)) - (mixi-post-error 'cannot-find-title)) - (if (string-match mixi-post-diary-body-regexp buffer) - (setq diary-body (match-string 1 buffer)) - (mixi-post-error 'cannot-find-body))) + (mixi-post-error 'cannot-find-key))) (setq fields `(("post_key" . ,post-key) - ("id" . ,id) - ("diary_title" . ,diary-title) - ("diary_body" . ,diary-body) + ("id" . ,(mixi-friend-id (mixi-make-me))) + ("diary_title" . ,title) + ("diary_body" . ,content) ("submit" . "confirm"))) - (with-mixi-post-form mixi-post-diary-page fields - (unless (string-match mixi-post-diary-succeed-regexp buffer) + (with-mixi-post-form (mixi-post-diary-page) fields + (unless (string-match mixi-post-succeed-regexp buffer) (mixi-post-error 'cannot-find-succeed))))) ;; Community object. @@ -1710,15 +1696,6 @@ Increase this value when unexpected error frequently occurs." (defmacro mixi-post-topic-page (community) `(concat "/add_bbs.pl?id=" (mixi-community-id community))) -(defconst mixi-post-topic-title-regexp - "") -(defconst mixi-post-topic-body-regexp - "") -(defconst mixi-post-topic-key-regexp - "") -(defconst mixi-post-topic-succeed-regexp - "ºîÀ®¤¬´°Î»¤·¤Þ¤·¤¿¡£È¿±Ç¤Ë»þ´Ö¤¬¤«¤«¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹¤Î¤Ç¡¢É½¼¨¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¾¯¡¹¤ªÂÔ¤Á¤¯¤À¤µ¤¤¡£") - ;; FIXME: Support photos. (defun mixi-post-topic (community title content) "Post a topic to COMMUNITY." @@ -1731,23 +1708,17 @@ Increase this value when unexpected error frequently occurs." (let ((fields `(("bbs_title" . ,title) ("bbs_body" . ,content) ("submit" . "main"))) - post-key topic-title topic-body) + post-key) (with-mixi-post-form (mixi-post-topic-page community) fields - (if (string-match mixi-post-topic-title-regexp buffer) - (setq topic-title (match-string 1 buffer)) - (mixi-post-error 'cannot-find-title community)) - (if (string-match mixi-post-topic-body-regexp buffer) - (setq topic-body (match-string 1 buffer)) - (mixi-post-error 'cannot-find-body community)) - (if (string-match mixi-post-topic-key-regexp buffer) + (if (string-match mixi-post-key-regexp buffer) (setq post-key (match-string 1 buffer)) (mixi-post-error 'cannot-find-key community))) (setq fields `(("post_key" . ,post-key) - ("bbs_title" . ,topic-title) - ("bbs_body" . ,topic-body) + ("bbs_title" . ,title) + ("bbs_body" . ,content) ("submit" . "confirm"))) (with-mixi-post-form (mixi-post-topic-page community) fields - (unless (string-match mixi-post-topic-succeed-regexp buffer) + (unless (string-match mixi-post-succeed-regexp buffer) (mixi-post-error 'cannot-find-succeed community))))) ;; Event object. @@ -2236,6 +2207,50 @@ Increase this value when unexpected error frequently occurs." (mixi-make-diary (mixi-make-friend (nth 1 item)) (nth 0 item))) items))) +(defun mixi-post-diary-comment-page (diary) + (concat "/add_comment.pl?&diary_id=" (mixi-diary-id diary))) + +(defun mixi-post-topic-comment-page (topic) + (concat "/add_bbs_comment.pl?id=" (mixi-topic-id topic) + "&comm_id=" (mixi-community-id (mixi-topic-community topic)))) + +(defun mixi-post-event-comment-page (event) + (concat "/add_event_comment.pl?id=" (mixi-event-id event) + "&comm_id=" (mixi-community-id (mixi-event-community event)))) + +;; FIXME: Support photos. +(defun mixi-post-comment (parent content) + "Post a comment to PARENT." + (unless (mixi-object-p parent) + (signal 'wrong-type-argument (list 'mixi-object-p parent))) + (unless (stringp content) + (signal 'wrong-type-argument (list 'stringp content))) + (let* ((name (mixi-object-name bbs)) + (page (intern (concat mixi-object-prefix "-post" name + "-comment-page"))) + fields post-key) + (if (mixi-diary-p parent) + (setq fields + `(("owner_id" . ,(mixi-friend-id (mixi-diary-owner diary))) + ("comment_body" . ,content))) + (setq fields `(("comment" . ,content)))) + (with-mixi-post-form (funcall page parent) fields + (if (string-match mixi-post-key-regexp buffer) + (setq post-key (match-string 1 buffer)) + (mixi-post-error 'cannot-find-key bbs))) + (if (mixi-diary-p parent) + (setq fields + `(("post_key" . ,post-key) + ("owner_id" . ,(mixi-friend-id (mixi-diary-owner diary))) + ("comment_body" . ,content) + ("submit" . "confirm"))) + (setq fields `(("post_key" . ,post-key) + ("comment" . ,content) + ("submit" . "confirm")))) + (with-mixi-post-form (funcall page parent) fields + (unless (string-match mixi-post-succeed-regexp buffer) + (mixi-post-error 'cannot-find-succeed bbs))))) + ;; Message object. (defconst mixi-message-box-list '(inbox outbox savebox thrash)) ; thrash?