;ELC   
;;; Compiled by nelhage@mit.edu on Wed Mar  7 14:36:37 2007
;;; from file /home/nelhage/.elisp/site/g-client/g-auth.el
;;; in Emacs version 23.0.0.2
;;; with all optimizations.
;;; Function definitions are lazy-loaded.

;;; This file uses dynamic docstrings, first added in Emacs 19.29.
(if (and (boundp 'emacs-version)
	 (< (aref emacs-version (1- (length emacs-version))) ?A)
	 (or (and (boundp 'epoch::version) epoch::version)
	     (string-lessp emacs-version "19.29")))
    (error "`g-auth.el' was compiled for Emacs 19.29 or later"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(byte-code "\300\301!\210\302\303!\210\300\304!\210\305\306\307\310\311\312%\207" [require cl proclaim (optimize (safety 0) (speed 3)) g-utils custom-declare-group g-auth nil "Google Authentication" :group g] 6)
#@26 Google account  address.
(custom-declare-variable 'g-user-email 'nil '(#$ . 837) :type '(choice (const :tag "none" nil) (string :tag "username@gmail.com" "")) :group 'g)
#@73 Lifetime of authentication token as a list suitable for
`current-time'.
(custom-declare-variable 'g-auth-lifetime ''(0 1800 0) '(#$ . 1013) :type 'sexp :group 'g-auth)
#@43 Scratch buffer we do authentication work.
(defvar g-auth-scratch-buffer " *g auth*" (#$ . 1187))
#@34 URL to login to Google services.
(defvar g-auth-url-pattern "https://www.google.com/accounts/ClientLogin?service=%s" (#$ . 1290))
#@41 Return auth URL  for specified service.
(defalias 'g-auth-url #[(service) #@291 ("\303	\304\305\n\306#)\"\207" . [g-auth-url-pattern service str format mapconcat #[(c) "\301U\2030\302\207\303Y\2030\304X\204,0\305Y\203 0\306X\204,0\307Y\20300\310X\20300\311!\207\312\313\"\226\207" [c 32 "+" 97 122 65 90 48 57 char-to-string format "%%%02x"] 3] ""])(#$ . 1507) nil 6 (#$ . 1426)])
(byte-code "\300\301\302\303#\210\300\304\305\306#\210\304\307N\204 \300\304\307\310#\210\300\207" [put g-auth-url byte-optimizer byte-compile-inline-expand g-auth-username cl-compiler-macro #[(--cl-whole-arg-- cl-x) "\301\302\303\304\305\211&\207" [cl-x cl-defsubst-expand (cl-x) (block g-auth-username (aref cl-x 1)) t nil] 7] byte-compile cl-byte-compile-compiler-macro] 4)
(defalias 'g-auth-username #[(cl-x) #@27 ("\301H\207" . [cl-x 1])(#$ . 2250) nil 2])
(byte-code "\300\301\302\303#\210\300\304\305\306#\210\304\307N\204 \300\304\307\310#\210\300\207" [put g-auth-username setf-method #[(cl-x) "\301\302\303\304\305%\207" [cl-x cl-struct-setf-expander g-auth g-auth-username nil 1] 6] g-auth-email cl-compiler-macro #[(--cl-whole-arg-- cl-x) "\301\302\303\304\305\211&\207" [cl-x cl-defsubst-expand (cl-x) (block g-auth-email (aref cl-x 2)) t nil] 7] byte-compile cl-byte-compile-compiler-macro] 4)
(defalias 'g-auth-email #[(cl-x) #@27 ("\301H\207" . [cl-x 2])(#$ . 2784) nil 2])
(byte-code "\300\301\302\303#\210\300\304\305\306#\210\304\307N\204 \300\304\307\310#\210\300\207" [put g-auth-email setf-method #[(cl-x) "\301\302\303\304\305%\207" [cl-x cl-struct-setf-expander g-auth g-auth-email nil 2] 6] g-auth-password cl-compiler-macro #[(--cl-whole-arg-- cl-x) "\301\302\303\304\305\211&\207" [cl-x cl-defsubst-expand (cl-x) (block g-auth-password (aref cl-x 3)) t nil] 7] byte-compile cl-byte-compile-compiler-macro] 4)
(defalias 'g-auth-password #[(cl-x) #@27 ("\301H\207" . [cl-x 3])(#$ . 3321) nil 2])
(byte-code "\300\301\302\303#\210\300\304\305\306#\210\304\307N\204 \300\304\307\310#\210\300\207" [put g-auth-password setf-method #[(cl-x) "\301\302\303\304\305%\207" [cl-x cl-struct-setf-expander g-auth g-auth-password nil 3] 6] g-auth-token cl-compiler-macro #[(--cl-whole-arg-- cl-x) "\301\302\303\304\305\211&\207" [cl-x cl-defsubst-expand (cl-x) (block g-auth-token (aref cl-x 4)) t nil] 7] byte-compile cl-byte-compile-compiler-macro] 4)
(defalias 'g-auth-token #[(cl-x) #@27 ("\301H\207" . [cl-x 4])(#$ . 3855) nil 2])
(byte-code "\300\301\302\303#\210\300\304\305\306#\210\304\307N\204 \300\304\307\310#\210\300\207" [put g-auth-token setf-method #[(cl-x) "\301\302\303\304\305%\207" [cl-x cl-struct-setf-expander g-auth g-auth-token nil 4] 6] g-auth-session-id cl-compiler-macro #[(--cl-whole-arg-- cl-x) "\301\302\303\304\305\211&\207" [cl-x cl-defsubst-expand (cl-x) (block g-auth-session-id (aref cl-x 5)) t nil] 7] byte-compile cl-byte-compile-compiler-macro] 4)
(defalias 'g-auth-session-id #[(cl-x) #@27 ("\301H\207" . [cl-x 5])(#$ . 4398) nil 2])
(byte-code "\300\301\302\303#\210\300\304\305\306#\210\304\307N\204 \300\304\307\310#\210\300\207" [put g-auth-session-id setf-method #[(cl-x) "\301\302\303\304\305%\207" [cl-x cl-struct-setf-expander g-auth g-auth-session-id nil 5] 6] g-auth-cookie-alist cl-compiler-macro #[(--cl-whole-arg-- cl-x) "\301\302\303\304\305\211&\207" [cl-x cl-defsubst-expand (cl-x) (block g-auth-cookie-alist (aref cl-x 6)) t nil] 7] byte-compile cl-byte-compile-compiler-macro] 4)
(defalias 'g-auth-cookie-alist #[(cl-x) #@27 ("\301H\207" . [cl-x 6])(#$ . 4957) nil 2])
(byte-code "\300\301\302\303#\210\300\304\305\306#\210\304\307N\204 \300\304\307\310#\210\300\207" [put g-auth-cookie-alist setf-method #[(cl-x) "\301\302\303\304\305%\207" [cl-x cl-struct-setf-expander g-auth g-auth-cookie-alist nil 6] 6] g-auth-service cl-compiler-macro #[(--cl-whole-arg-- cl-x) "\301\302\303\304\305\211&\207" [cl-x cl-defsubst-expand (cl-x) (block g-auth-service (aref cl-x 7)) t nil] 7] byte-compile cl-byte-compile-compiler-macro] 4)
(defalias 'g-auth-service #[(cl-x) #@27 ("\301H\207" . [cl-x 7])(#$ . 5505) nil 2])
(byte-code "\300\301\302\303#\210\300\304\305\306#\210\304\307N\204 \300\304\307\310#\210\300\207" [put g-auth-service setf-method #[(cl-x) "\301\302\303\304\305%\207" [cl-x cl-struct-setf-expander g-auth g-auth-service nil 7] 6] g-auth-lifetime cl-compiler-macro #[(--cl-whole-arg-- cl-x) "\301\302\303\304\305\211&\207" [cl-x cl-defsubst-expand (cl-x) (block g-auth-lifetime (aref cl-x 8)) t nil] 7] byte-compile cl-byte-compile-compiler-macro] 4)
(defalias 'g-auth-lifetime #[(cl-x) #@27 ("\301H\207" . [cl-x 8])(#$ . 6046) nil 2])
(byte-code "\300\301\302\303#\210\300\304\305\306#\210\304\307N\204 \300\304\307\310#\210\300\207" [put g-auth-lifetime setf-method #[(cl-x) "\301\302\303\304\305%\207" [cl-x cl-struct-setf-expander g-auth g-auth-lifetime nil 8] 6] g-auth-timestamp cl-compiler-macro #[(--cl-whole-arg-- cl-x) "\301\302\303\304\305\211&\207" [cl-x cl-defsubst-expand (cl-x) (block g-auth-timestamp (aref cl-x 9)) t nil] 7] byte-compile cl-byte-compile-compiler-macro] 4)
(defalias 'g-auth-timestamp #[(cl-x) #@27 ("\301H\207" . [cl-x 9])(#$ . 6592) nil 2])
(byte-code "\300\301\302\303#\210\300\304\305\306#\210\304\307N\204 \300\304\307\310#\210\300\207" [put g-auth-timestamp setf-method #[(cl-x) "\301\302\303\304\305%\207" [cl-x cl-struct-setf-expander g-auth g-auth-timestamp nil 9] 6] g-auth-post-auth-action cl-compiler-macro #[(--cl-whole-arg-- cl-x) "\301\302\303\304\305\211&\207" [cl-x cl-defsubst-expand (cl-x) (block g-auth-post-auth-action (aref cl-x 10)) t nil] 7] byte-compile cl-byte-compile-compiler-macro] 4)
(defalias 'g-auth-post-auth-action #[(cl-x) #@28 ("\301H\207" . [cl-x 10])(#$ . 7162) nil 2])
(byte-code "\300\301\302\303#\210\300\304\305\306#\210\304\307N\204 \300\304\307\310#\210\300\207" [put g-auth-post-auth-action setf-method #[(cl-x) "\301\302\303\304\305%\207" [cl-x cl-struct-setf-expander g-auth g-auth-post-auth-action nil 10] 6] g-auth-p cl-compiler-macro #[(--cl-whole-arg-- cl-x) "\301\302\303\304\211\211&\207" [cl-x cl-defsubst-expand (cl-x) (block g-auth-p (and (vectorp cl-x) (>= (length cl-x) 11) (memq (aref cl-x 0) cl-struct-g-auth-tags) t)) nil] 7] byte-compile cl-byte-compile-compiler-macro] 4)
(defalias 'g-auth-p #[(cl-x) #@102 ("\302!\2050G\303Y\2050\304H	>\2050\305\207" . [cl-x cl-struct-g-auth-tags vectorp 11 0 t])(#$ . 7775) nil 2])
(defalias 'copy-g-auth #[(x) #@36 ("\301!\207" . [x copy-sequence])(#$ . 7930) nil 2])
(byte-code "\300\301\302\303#\210\301\304N\204 \300\301\304\305#\210\300\207" [put make-g-auth cl-compiler-macro #[(cl-whole &rest #1=#:--cl-rest--) "\306>\206 \307A@\310>A@\311>A@\312>A@\313>A@\314>A@\315>A@\316>\2067 \317A@\320>A@\321>A@\322\323\324\325\326	\n\f&.\n\207" [#1# username email password token session-id :username (nil (user-login-name)) :email :password :token :session-id :cookie-alist :service :lifetime (nil g-auth-lifetime) :timestamp :post-auth-action cl-defsubst-expand (username email password token session-id cookie-alist service lifetime timestamp post-auth-action) (block make-g-auth (vector 'cl-struct-g-auth username email password token session-id cookie-alist service lifetime timestamp post-auth-action)) t nil cookie-alist service lifetime timestamp post-auth-action cl-whole] 16 "Not documented\n\n(fn CL-WHOLE &cl-quote &key USERNAME EMAIL PASSWORD TOKEN SESSION-ID COOKIE-ALIST SERVICE LIFETIME TIMESTAMP POST-AUTH-ACTION)"] byte-compile cl-byte-compile-compiler-macro] 4)
#@125 Not documented

(fn &key USERNAME EMAIL PASSWORD TOKEN SESSION-ID COOKIE-ALIST SERVICE LIFETIME TIMESTAMP POST-AUTH-ACTION)
(defalias 'make-g-auth #[(&rest #1=#:--cl-rest--) "\306>\206\n \307\310 DA@\311>A@\312>A@\313>A@\314>A@\315>A@\316>A@\317>\206= \307DA@\320>A@\321>A@\322\323	\n\f&.\n\207" [#1# username email password token session-id :username nil user-login-name :email :password :token :session-id :cookie-alist :service :lifetime :timestamp :post-auth-action vector cl-struct-g-auth cookie-alist service g-auth-lifetime lifetime timestamp post-auth-action] 12 (#$ . 9043)])
(byte-code "\302B\303C\304\305\306\307#\210\304\305\310\311#\210\304\305\312\313#\210\304\305\314\315#\210\304\316\317\315#\210\304\320\317\315#\210\304\321\317\322#\210\304\323\317\315#\210\304\324\317\315#\210\304\325\317\315#\210\304\326\317\315#\210\304\327\317\315#\210\304\330\317\315#\210\304\331\317\315#\210\304\332\317\315#\210\304\333\317\315#\210\304\334\317\315#\207" [custom-print-functions cl-struct-g-auth-tags #[(cl-x cl-s cl-n) "\303!\205\230 G\304Y\205\230 \305H	>\205\230 \306\307\n\"\210\306\310\n\"\210\311\312H\n\"\210\306\313\n\"\210\311\314H\n\"\210\306\315\n\"\210\311\316H\n\"\210\306\317\n\"\210\311\320H\n\"\210\306\321\n\"\210\311\322H\n\"\210\306\323\n\"\210\311\324H\n\"\210\306\325\n\"\210\311\326H\n\"\210\306\327\n\"\210\311\330H\n\"\210\306\331\n\"\210\311\332H\n\"\210\306\333\n\"\210\311\334H\n\"\210\306\335\n\"\210\336\207" [cl-x cl-struct-g-auth-tags cl-s vectorp 11 0 princ "#S(g-auth" " username" prin1 1 " email" 2 " password" 3 " token" 4 " session-id" 5 " cookie-alist" 6 " service" 7 " lifetime" 8 " timestamp" 9 " post-auth-action" 10 ")" t] 3] cl-struct-g-auth put g-auth cl-struct-slots ((cl-tag-slot) (username (user-login-name)) (email) (password) (token) (session-id) (cookie-alist) (service) (lifetime g-auth-lifetime) (timestamp) (post-auth-action)) cl-struct-type (vector nil) cl-struct-include nil cl-struct-print t make-g-auth side-effect-free copy-g-auth g-auth-p error-free g-auth-post-auth-action g-auth-timestamp g-auth-lifetime g-auth-service g-auth-cookie-alist g-auth-session-id g-auth-token g-auth-password g-auth-email g-auth-username] 4)
#@55 Return cookie for `name' from auth-handle if present.
(defalias 'g-cookie #[(name auth-handle) #@73 ("\303	\304H\"\211\2050\nA)\207" . [name auth-handle pair assoc 6])(#$ . 11397) nil 5 (#$ . 11296)])
(put 'g-cookie 'byte-optimizer 'byte-compile-inline-expand)
#@23 HTTP headers to send.
(defconst g-authorization-header-format "--header 'Authorization: GoogleLogin auth=%s'  --header 'Content-Type: application/atom+xml' " (#$ . 11568))
#@30 Return authorization header.
(defalias 'g-authorization #[(auth-handle) #@131 ("\304\305	\306\n	\307H\"\211\2050A+\"\207" . [g-authorization-header-format auth-handle name pair format "Auth" assoc 6])(#$ . 11825) nil 7 (#$ . 11746)])
(put 'g-authorization 'byte-optimizer 'byte-compile-inline-expand)
#@52 Check if  token for specified service has expired.
(defalias 'g-auth-expired-p #[(auth-handle) #@139 ("\301H\2040\302H\2040\303\207\304\305H\306\307H!\"\2030\303\207\310\207" . [auth-handle 4 6 t time-less-p 8 time-since 9 nil])(#$ . 12163) nil 5 (#$ . 12061)])
(put 'g-auth-expired-p 'byte-optimizer 'byte-compile-inline-expand)
#@109 Authenticate    using credentials in auth-handle.
Populate auth-handle with the returned cookies and token.
(defalias 'g-authenticate #[(auth-handle) #@1171 ("\306H\307H\2060\n\2060\310\311!\312H\2060\313\314\315\"!\316!$\317%\307I\210\312\fI\210\320\317I\210\212$q\210\321 \210\314\322&\323\324&\325#)\f&\323\324&\325#)#c\210\326ed\314\327'(\330H)\314*)&\323\324&\325#)\")$p\331%\210eb\210m\204\2510\332\333!\210\334\335 \336 {\337\"%\320%@%\211+A@)B\320HBI\210\340y\210\202}0	\203\2670\341	!\203\2670	!\210\342\343 I\210.\207" . [auth-handle post-auth-action g-user-email email password g-auth-scratch-buffer 10 2 read-from-minibuffer "User Address: " 3 read-passwd format "Password for %s:" get-buffer-create nil 6 erase-buffer "Email=%s&Passwd=%s&source=g-emacs&accountType=hosted_or_google" mapconcat #[(c) "\301U\2030\302\207\303Y\2030\304X\204,0\305Y\203 0\306X\204,0\307Y\20300\310X\20300\311!\207\312\313\"\226\207" [c 32 "+" 97 122 65 90 48 57 char-to-string format "%%%02x"] 3] "" shell-command-on-region "%s %s -X POST --data-binary @- %s 2>/dev/null" 7 replace skip-syntax-forward " " split-string line-beginning-position line-end-position "=" 1 fboundp 9 current-time buff fields str g-curl-program g-cookie-options service g-auth-url-pattern x])(#$ . 12567) nil 14 (#$ . 12409)])
#@63 Ensure token is  still valid, re-authenticating if necessary.
(defalias 'g-auth-ensure-token #[(auth-handle) #@184 ("\211\301H\2040\302H\2040\303\202$0\304\305H\306\307H!\"\203#0\303\202$0\310)\203,0\311!\210\207" . [auth-handle 4 6 t time-less-p 8 time-since 9 nil g-authenticate])(#$ . 13893) nil 6 (#$ . 13777)])
(provide 'g-auth)
