From 62976ecf8c68b96ea3ba21bcd0d207fc4c4e25de Mon Sep 17 00:00:00 2001 From: bg66 Date: Mon, 5 Feb 2007 10:24:19 +0000 Subject: [PATCH] * 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. --- ChangeLog | 7 +++++++ mixi.el | 18 +++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) 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." -- 1.7.10.4