X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=mixi.el;h=8d52aa33ac43a575cffe7197d386185f112528d7;hb=1b6c1fb55da90b146674304d55e01f591c2a6bbf;hp=898059c55d7ae6c58a09c20e8a88abb0087cb2fc;hpb=447606fad7ca51dfb6a09373a275925eb6822408;p=elisp%2Fmixi.git diff --git a/mixi.el b/mixi.el index 898059c..8d52aa3 100644 --- a/mixi.el +++ b/mixi.el @@ -41,6 +41,7 @@ ;; * mixi-get-new-comments ;; * mixi-get-messages ;; * mixi-get-introductions +;; * mixi-get-news ;; ;; API for posting: ;; @@ -118,6 +119,17 @@ (eval-when-compile (require 'cl)) +;; Functions and variables which should be defined in the other module +;; at run-time. +(eval-when-compile + (defvar w3m-use-cookies) + (defvar url-request-method) + (defvar url-request-data) + (defvar url-request-extra-headers) + (autoload 'w3m-decode-buffer "w3m") + (autoload 'w3m-retrieve "w3m") + (autoload 'url-retrieve-synchronously "url")) + (defgroup mixi nil "API library for accessing to mixi." :group 'hypermedia) @@ -171,6 +183,11 @@ (symbol :tag "The other backend")) :group 'mixi) +(defcustom mixi-login-use-ssl nil + "*If non-ni, login using SSL." + :type 'boolean + :group 'mixi) + (defcustom mixi-default-email nil "*Default E-mail address that is used to login automatically." :type '(radio (string :tag "E-mail address") @@ -224,14 +241,13 @@ Increase this value when unexpected error frequently occurs." 'error-conditions '(mixi-post-error error)) (defmacro mixi-realization-error (type object) - `(let ((data (if (and (boundp 'buffer) debug-on-error) - (list ,type ,object buffer) + `(let ((data (if debug-on-error + (list ,type ,object (buffer-string)) (list ,type ,object)))) (signal 'mixi-realization-error data))) (defmacro mixi-post-error (type &optional object) - `(let ((data (when (and (boundp 'buffer) debug-on-error) - (list buffer)))) + `(let ((data (when debug-on-error (list (buffer-string))))) (if ,object (setq data (cons ,type (cons ,object data))) (setq data (cons ,type data))) @@ -272,7 +288,7 @@ Increase this value when unexpected error frequently occurs." (mixi-retrieve url post-data))) (defmacro mixi-expand-url (url) - `(if (string-match (concat "^" mixi-url) ,url) + `(if (string-match "^http" ,url) ,url (concat mixi-url ,url))) @@ -380,65 +396,76 @@ Increase this value when unexpected error frequently occurs." (read-from-minibuffer (mixi-message "Login Email: ")))) (password (or password mixi-default-password (read-passwd (mixi-message "Login Password: "))))) - (let ((buffer (mixi-retrieve "/login.pl" - (concat "email=" email - "&password=" password - "&next_url=/home.pl" - "&sticky=on")))) - (unless (string-match "url=/check\\.pl\\?n=" buffer) - (error (mixi-message "Cannot login"))) - (setq buffer (mixi-retrieve "/check.pl?n=home.pl")) - (if (string-match mixi-my-id-regexp buffer) - (setq mixi-me (mixi-make-friend (match-string 1 buffer))) - (error (mixi-message "Cannot login")))))) + (let ((url "/login.pl")) + (when mixi-login-use-ssl + (setq url (concat "https://mixi.jp" url))) + (let ((buffer (mixi-retrieve url + (concat "email=" email + "&password=" password + "&next_url=/home.pl" + "&sticky=on")))) + (unless (string-match "url=/check\\.pl\\?n=" buffer) + (error (mixi-message "Cannot login"))) + (setq buffer (mixi-retrieve "/check.pl?n=home.pl")) + (if (string-match mixi-my-id-regexp buffer) + (setq mixi-me (mixi-make-friend (match-string 1 buffer))) + (error (mixi-message "Cannot login"))))))) (defun mixi-logout () (mixi-retrieve "/logout.pl")) (defmacro with-mixi-retrieve (url &rest body) - `(let (buffer) - (when ,url - (setq buffer (mixi-retrieve ,url)) - (when (string-match "