;ELC
;;; Compiled by LTX@Xue-LingTaos-MacBook-Pro.local on Wed Mar 16 23:15:19 2011
;;; from file /Users/LTX/Projects/Emacs/emacs/lisp/gnus/proto-stream.el
;;; in Emacs version 24.0.50.1
;;; with all optimizations.

;;; This file uses dynamic docstrings, first added in Emacs 19.29.

;;; This file does not contain utf-8 non-ASCII characters,
;;; and so can be loaded in Emacs versions earlier than 23.

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


(byte-code "\300\301!\210\300\302!\210\300\303!\207" [require tls starttls format-spec] 2)
#@70 If non-nil, always try to upgrade network connections with STARTTLS.
(custom-declare-variable 'proto-stream-always-use-starttls '(fboundp 'open-gnutls-stream) '(#$ . 642) :version "24.1" :type 'boolean :group 'comm)
#@1706 Open a network stream to HOST, upgrading to STARTTLS if possible.
The first four parameters have the same meaning as in
`open-network-stream'.  The function returns a list where the
first element is the stream, the second element is the greeting
the server replied with after connecting, and the third element
is a string representing the capabilities of the server (if any).

The PARAMETERS is a keyword list that can have the following
values:

:type -- either `network', `network-only, `tls', `shell' or
`starttls'.  If omitted, the default is `network'.  `network'
will be opportunistically upgraded to STARTTLS if both the server
and Emacs supports it.  If you don't want STARTTLS upgrades, use
`network-only'.

:end-of-command -- a regexp saying what the end of a command is.
This defaults to "\n".

:success -- a regexp saying whether the STARTTLS command was
successful or not.  For instance, for NNTP this is "^3".

:capability-command -- a string representing the command used to
query server for capabilities.  For instance, for IMAP this is
"1 CAPABILITY\r\n".

:starttls-function -- a function that takes one parameter, which
is the response to the capaibility command.  It should return nil
if it turns out that the server doesn't support STARTTLS, or the
command to switch on STARTTLS otherwise.

The return value from this function is a four-element list, where
the first element is the stream (if connection was successful);
the second element is the "greeting", i. e., the string the
server sent over on initial contact; the third element is the
capability string; and the fourth element is either `network' or
`tls', depending on whether the connection ended up being
encrypted or not.
(defalias 'open-protocol-stream #[(name buffer host service &rest parameters) "\306>\211A@)\206\f\307\211\310=\203\307\202 \n\311=\203 \312\313\314\315\n\"\"\f
%\211\204=\316\211\211\nF\202_@\211\205Q\317!\320>\205QA@\3218\3228F)*\207" [parameters x type obarray name buffer :type network starttls ssl tls intern format "proto-stream-open-%s" nil process-status (open run) 2 3 host service open-result stream] 7 (#$ . 866)])
(defalias 'proto-stream-open-network-only #[(name buffer host service parameters) "rq\210`)\306	\n$\f\307\f
\310!#\311\312F*\207" [buffer name host service stream start open-network-stream proto-stream-get-response proto-stream-eoc nil network parameters] 6])
(defalias 'proto-stream-open-network #[(name buffer host service parameters) "rq\210`)\306\n\f$\307>\211 A@)!\310!\"\311>\211 A@)#\312
	\"#$\313%!\204E
$\313\314F\202X\315
!\"#&\316>\211 A@)&!\211'\203m#\317=\204\206(\204\206#\317=\203|\320
!\210\313\202W
$&\314F\202W\321\322!\204\222\323\324!\2039\321\322!\204\307\320
!\210rq\210d)\325)#\317=\204\264\326*B\202\266**\327\n\f$*\312
	\"#\210\330\331>\211 A@)\315
'\"#\"\204\366#\317=\203\354\320
!\210\313\202W
$&\314F\202W\321\322!\203\332
\313\"\210\202\333
!\204\320
!\210\313
\203\334
!\335>\204*\306\n\f$\312
	\"#\210
$\315
!\"#\336F\202W\311>\211 A@)\317=\203P\320
!\210\313\202W
$&\314F*.\207" [buffer start name host service stream open-network-stream :capability-command proto-stream-eoc :type proto-stream-get-response nil network proto-stream-command :starttls-function starttls delete-process fboundp open-gnutls-stream executable-find "gnutls-cli" t "--insecure" starttls-open-stream string-match :success gnutls-negotiate starttls-negotiate process-status (open run) tls parameters x capability-command eoc type greeting success capabilities starttls-command proto-stream-always-use-starttls starttls-use-gnutls starttls-extra-arguments] 7])
(defalias 'proto-stream-command #[(stream command eoc) "r\304!q\210d)\305\n\"\210\306	#)\207" [stream start command eoc process-buffer process-send-string proto-stream-get-response] 4])
(defalias 'proto-stream-get-response #[(stream start end-of-command) "r\303!q\210\212	b\210\304!\305>\203&\306\n\307\310#\204&\311\312\313#\210	b\210\202\n	`U?\2050	`{*\207" [stream start end-of-command process-buffer process-status (open run) re-search-forward nil t accept-process-output 0 50] 4])
(defalias 'proto-stream-open-tls #[(name buffer host service parameters) "rq\210d\306\307!\203\307\202\310	\n$\f\205H\306\307!\204A\311\f
\312!#\210eb\210\313\312!\314\315#\203A\316\224b\210e\317 |\210\320
\f\321$+\207" [buffer name host service stream start fboundp open-gnutls-stream open-tls-stream proto-stream-get-response proto-stream-eoc re-search-forward nil t 0 line-beginning-position proto-stream-capability-open tls parameters] 6])
(defalias 'proto-stream-open-shell #[(name buffer host service parameters) "\306rq\210`)\307\310\n\f\311\312
>\211A@)\313\314\315$\"%)
\316$\207" [buffer process-connection-type name shell-file-name shell-command-switch parameters proto-stream-capability-open nil start-process format-spec :shell-command format-spec-make 115 112 network x host service] 15])
(defalias 'proto-stream-capability-open #[(start stream parameters stream-type) "\306>\211A@)\307\n\310!#\n\f
\205\311\n
\310!#\nF*\207" [parameters x stream start greeting capability-command :capability-command proto-stream-get-response proto-stream-eoc proto-stream-command stream-type] 8])
(defalias 'proto-stream-eoc #[(parameters) "\302>\211A@)\206\f\303\207" [parameters x :end-of-command "
\n"] 3])
(provide 'proto-stream)
