From: bg66 Date: Mon, 5 Feb 2007 10:24:19 +0000 (+0000) Subject: * mixi.el (mixi-curl-post-form): New function. X-Git-Tag: mixi-el-1_0_0~75 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=62976ecf8c68b96ea3ba21bcd0d207fc4c4e25de;p=elisp%2Fmixi.git * mixi.el (mixi-curl-post-form): New function. (mixi-curl-retrieve): Add the FORM-DATA argument. (mixi-message-title-regexp): Fix regexp. (mixi-message-content-regexp): Ditto. --- diff --git a/ChangeLog b/ChangeLog index ca61fa0..199c9dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-02-05 OHASHI Akira + + * mixi.el (mixi-curl-post-form): New function. + (mixi-curl-retrieve): Add the FORM-DATA argument. + (mixi-message-title-regexp): Fix regexp. + (mixi-message-content-regexp): Ditto. + 2007-02-01 OHASHI Akira * mixi.el (mixi-friend-nick-regexp): Follow the change of mixi. diff --git a/mixi.el b/mixi.el index 646b996..2c2f862 100644 --- a/mixi.el +++ b/mixi.el @@ -349,7 +349,7 @@ Increase this value when unexpected error frequently occurs." (let ((form-data (mixi-make-form-data fields))) (mixi-w3m-retrieve url form-data))) -(defun mixi-curl-retrieve (url &optional post-data) +(defun mixi-curl-retrieve (url &optional post-data form-data) "Retrieve the URL and return gotten strings." (with-temp-buffer (if (fboundp 'set-buffer-multibyte) @@ -365,6 +365,7 @@ Increase this value when unexpected error frequently occurs." (apply #'start-process "curl" (current-buffer) mixi-curl-program (append (if post-data '("-d" "@-")) + form-data (list "-i" "-L" "-s" "-b" mixi-curl-cookie-file "-c" mixi-curl-cookie-file @@ -385,6 +386,17 @@ Increase this value when unexpected error frequently occurs." (setq ret (decode-coding-string (buffer-string) mixi-coding-system)) (mixi-parse-buffer url ret post-data)))) +(defun mixi-curl-post-form (url fields) + (let (form-data) + (mapcar (lambda (field) + (push "-F" form-data) + (push (concat (car field) "=" + (encode-coding-string (cdr field) + mixi-coding-system)) + form-data)) + fields) + (mixi-curl-retrieve url nil (reverse form-data)))) + (defconst mixi-my-id-regexp "Æü\\(¡¡\\| \\)ÉÕ : \\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü \\([0-9]+\\)»þ\\([0-9]+\\)ʬ  ") (defconst mixi-message-title-regexp -"·ï\\(¡¡\\| \\)̾ : \\(.+\\)\n?") +"·ï\\(¡¡\\| \\)̾ : \\(.*\\)\n?") (defconst mixi-message-content-regexp - "\\(.+\\)") + "\\(.*\\)") (defun mixi-realize-message (message) "Realize a MESSAGE."