-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/mercurial/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/mercurial/mail.pyc

ó
Ì\,Tc@sÖddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
ZejjjZd„Zeejjjd<dejfd„ƒYZejejdƒrdejfd	„ƒYZnddd
„Zd„Zd„Zd
„Zdd„Zdd„Zd„Zded„Zd„Z d„Z!d„Z"ded„Z#dd„Z$ded„Z%ded„Z&ded„Z'dS(iÿÿÿÿ(t_NcOsd|d<t|||ŽdS(sÓ
    Python 2.7 introduces a backwards incompatible change
    (Python issue1974, r70772) in email.Generator.Generator code:
    pre-2.7 code passed "continuation_ws='	'" to the Header
    constructor, and 2.7 removed this parameter.

    Default argument is continuation_ws=' ', which means that the
    behaviour is different in <2.7 and 2.7

    We consider the 2.7 behaviour to be preferable, but need
    to have an unified behaviour for versions 2.4 to 2.7
    t tcontinuation_wsN(t_oldheaderinit(tselftargstkw((s2/usr/lib/python2.7/dist-packages/mercurial/mail.pyt_unifiedheaderinits
t__init__tSTARTTLScBs&eZdZd„Zddd„ZRS(sŒDerived class to verify the peer certificate for STARTTLS.

    This class allows to pass any keyword arguments to SSL socket creation.
    cKs tjj||||_dS(N(tsmtplibtSMTPRt
_sslkwargs(Rt	sslkwargstkwargs((s2/usr/lib/python2.7/dist-packages/mercurial/mail.pyR*scCsÙ|jdƒs'd}tj|ƒ‚n|jdƒ\}}|dkrÏtj|j|||j|_tj	|jdƒs“|jj
|j_ntj|jƒ|_
d|_d|_i|_d|_n||fS(Ntstarttlss*STARTTLS extension not supported by serverR	iÜtreadi(thas_extnR
t
SMTPExceptiontdocmdtsslutiltssl_wrap_sockettsockRtutiltsafehasattrtrecvRtSSLFakeFiletfiletNonet	helo_respt	ehlo_resptesmtp_featurest
does_esmtp(Rtkeyfiletcertfiletmsgtresptreply((s2/usr/lib/python2.7/dist-packages/mercurial/mail.pyR.s			N(t__name__t
__module__t__doc__RRR(((s2/usr/lib/python2.7/dist-packages/mercurial/mail.pyR	%s	t_get_sockettSMTPScBs&eZdZddd„Zd„ZRS(s‘Derived class to verify the peer certificate for SMTPS.

        This class allows to pass any keyword arguments to SSL socket creation.
        cKs>||_||_tjj||tj|_||_dS(N(R!R"R
RRt
SMTP_SSL_PORTtdefault_portR(RR
R!R"R((s2/usr/lib/python2.7/dist-packages/mercurial/mail.pyRFs
		cCsz|jdkr+tjdI||fIJntj||f|ƒ}tj||j|j|j	}t
j|ƒ|_|S(Nisconnect:(
t
debugleveltsyststderrtsockettcreate_connectionRRR!R"RR
RR(Rthosttportttimeoutt
new_socket((s2/usr/lib/python2.7/dist-packages/mercurial/mail.pyR)Ms	N(R&R'R(RRR)(((s2/usr/lib/python2.7/dist-packages/mercurial/mail.pyR*AscKstjtdƒƒ‚dS(Ns"SMTPS requires Python 2.6 or later(RtAbortR(R
R!R"R((s2/usr/lib/python2.7/dist-packages/mercurial/mail.pyR*Wscs1|jddƒ}|jdddƒ}|dkp?tj|ƒ}|dk}|sZ|r…tjtdƒr…tjtdƒƒ‚n|jdd	ƒ}|sµtjtd
ƒƒ‚n|jdddƒ}|dkr
tj|ƒtk	r
tjtdƒ|ƒ‚q
n|s|r1|r1tj	||ƒ}ni}|re|j
tdƒƒt|d|ƒ‰n-|r€t|d|ƒ‰nt
jd|ƒ‰|r¡d}nd}tj|jdd|ƒƒ}	|j
tdƒ||	fƒˆjd	|d|	ƒ|r2|j
tdƒƒˆjƒˆjƒˆjƒn|s>|r||r||j
tdƒƒtj||ƒˆj|dkƒn|jddƒ}
|jddƒ}|
r¼|r¼|jƒ}n|
r|r|j
tdƒ|
ƒyˆj|
|ƒWqt
jk
r}tj|ƒ‚qXn‡fd†}
|
S(s;build an smtp connection and return a function to send mailtsmtptlocal_hostnamettlstnoneRtsmtpstssls/can't use TLS: Python SSL support not installedR2s+smtp.host not configured - cannot send mailt
verifycerttstricttlooses)invalid smtp.verifycert configuration: %ss(using smtps)
iÑiR3s$sending mail: smtp host %s, port %s
s(using starttls)
s(verifying remote certificate)
tusernametpasswords&(authenticating to mail server as %s)
csšyˆj|||ƒSWn|tjk
rq}g|jjƒD]}|d^q<}tjddj|ƒƒ‚n%tjk
r•}tj|ƒ‚nXdS(Nis
(	tsendmailR
tSMTPRecipientsRefusedt
recipientstvaluesRR6tjoinR(tsenderRDR#tinsttr(ts(s2/usr/lib/python2.7/dist-packages/mercurial/mail.pytsend’s&(sstrictR?(tconfigRt	parseboolRR0R6RtFalseRR
tnoteR*R	R
RtgetporttconnecttehloRt	validatorRtgetpasstloginR(tuiR8R9RR;tmailhostR=R
tdefaultporttmailportR@RARHRK((RJs2/usr/lib/python2.7/dist-packages/mercurial/mail.pyt_smtpZsf	


%
	cCsÔ|jddƒ}d|tj|ƒdjttj|ƒƒf}|jtdƒ|ƒtj|dƒ}|j|ƒ|j	ƒ}|rÐtj
dtjj
|jd
dƒd	ƒtj|ƒd	fƒ‚nd
S(ssend mail using sendmail.temailtmethods%s -f %s %sRssending mail: %s
tws%s %siiN(RLRR[RFtmapRORtpopentwritetcloseR6tostpathtbasenametsplitRtexplainexit(RVRGRDR#tprogramtcmdlinetfptret((s2/usr/lib/python2.7/dist-packages/mercurial/mail.pyt	_sendmails
	cCsft|dƒ}tjdtjƒƒ}|jd||fƒ|j|ƒ|jdƒ|jƒdS(swrite mails to mboxsab+s%a %b %d %H:%M:%S %YsFrom %s %s
s

N(topenttimetstrftimet	localtimeR`Ra(tmboxRGRDR#Ritdate((s2/usr/lib/python2.7/dist-packages/mercurial/mail.pyt_mbox«s

csXˆr&tˆdƒjƒ‡fd†SˆjdddƒdkrKtˆƒS‡fd†S(snmake a mail connection. return a function to send mail.
    call as sendmail(sender, list-of-recipients, msg).twbcstˆ|||ƒS(N(Rr(RJRItm(Rp(s2/usr/lib/python2.7/dist-packages/mercurial/mail.pyt<lambda>»sR[R\R7cstˆ|||ƒS(N(Rk(RJRIRt(RV(s2/usr/lib/python2.7/dist-packages/mercurial/mail.pyRu¾s(RlRaRLRZ(RVRp((RpRVs2/usr/lib/python2.7/dist-packages/mercurial/mail.pyRQ¶s

cCs"t|d|ƒ}||||ƒS(NRp(RQ(RVRGRDR#RpRK((s2/usr/lib/python2.7/dist-packages/mercurial/mail.pyRBÀscCs}|jdddƒ}|dkrN|jddƒsytjtdƒƒ‚qyn+tj|ƒsytjtdƒ|ƒ‚ndS(s=determine if we have enough config data to try sending email.R[R\R7R2s>smtp specified as email transport, but no smtp host configureds0%r specified as email transport, but not in PATHN(RLRR6Rtfindexe(RVR\((s2/usr/lib/python2.7/dist-packages/mercurial/mail.pytvalidateconfigÄstplaincCsod}|s_y|jdƒWq_tk
r[y|jdƒd}Wq\tk
rWq\Xq_Xnt|||ƒS(sžReturn MIME message suitable for a patch.
    Charset will be detected as utf-8 or (possibly fake) us-ascii.
    Transfer encodings will be used if necessary.sus-asciisutf-8(tdecodetUnicodeDecodeErrort
mimetextqp(RJtsubtypetdisplaytcs((s2/usr/lib/python2.7/dist-packages/mercurial/mail.pyt
mimetextpatchÐs



cCs~d}x?|jƒD]1}t|ƒdkrtj|ƒ}d}PqqWtjj|||ƒ}|rz|d=||d<n|S(s[Return MIME message.
    Quoted-printable transfer encoding will be used if necessary.
    i¶squoted-printablesContent-Transfer-EncodingN(Rt
splitlinestlentquopritencodestringR[tMIMEText(tbodyR|tcharsettenctlineR#((s2/usr/lib/python2.7/dist-packages/mercurial/mail.pyR{ãs
cCsŸg|jddƒD]}|jƒ^q}tjjƒtjjƒdg}x*|D]"}||krS|j|ƒqSqSWg|D]}|jdƒs€|^q€S(s;Obtains charsets to send mail parts not containing patches.R[tcharsetssutf-8tascii(t
configlisttlowertencodingtfallbackencodingtappendtendswith(RVR~R‰t	fallbacks((s2/usr/lib/python2.7/dist-packages/mercurial/mail.pyt	_charsetsôs+
cCsëy|jdƒWnÍtk
rà|p0t|ƒ}x«tjtjfD]“}y|j|ƒ}Wntk
ruqFnXx`|D]X}y|j|ƒ|fSWq}tk
r­q}tk
rÔ|jt	dƒ|ƒq}Xq}WqFWnX|dfS(sReturns (converted) string, charset tuple.
    Finds out best charset by cycling through sendcharsets in descending
    order. Tries both encoding and fallbackencoding for input. Only as
    last resort send as is in fake ascii.
    Caveat: Do not use for mail parts containing patches!RŠs!ignoring invalid sendcharset: %s
sus-ascii(
RyRzR’RRŽtencodetUnicodeEncodeErrortLookupErrortwarnR(RVRJR‰tsendcharsetsticstutocs((s2/usr/lib/python2.7/dist-packages/mercurial/mail.pyt_encodeþs"




'cCs;|s7t|||ƒ\}}ttjj||ƒƒS|S(s4Returns RFC-2047 compliant header from given string.(R›tstrR[tHeader(RVRJR‰R}R~((s2/usr/lib/python2.7/dist-packages/mercurial/mail.pyt
headencodescCsøt|||ƒ}yS|jdƒ\}}|jdƒ}|jtjƒjdƒ}d||f}Wnztk
r‘tjtdƒ|ƒ‚nQt	k
ráy|jdƒ}Wqâtk
rÝtjtdƒ|ƒ‚qâXnXt
jj||fƒS(Nt@RŠtidnas%s@%ssinvalid email address: %ssinvalid local address: %s(
RžReR“RyRRzRR6Rt
ValueErrorR[tUtilst
formataddr(RVtnametaddrR‰tacctdom((s2/usr/lib/python2.7/dist-packages/mercurial/mail.pyt_addressencodes


!cCsB|s
|r|pdStjj|ƒ\}}t||||ƒS(s-Turns address into RFC-2047 compliant header.t(R[R¢t	parseaddrR¨(RVtaddressR‰R}R¤R¥((s2/usr/lib/python2.7/dist-packages/mercurial/mail.pyt
addressencode0s

cCs‡|r/g|D]}|jƒr
|jƒ^q
Sg}xKtjj|ƒD]7\}}|s`|rH|jt||||ƒƒqHqHW|S(s¶Turns a list of addresses into a list of RFC-2047 compliant headers.
    A single element of input list may contain multiple addresses, but output
    always has one address per item(tstripR[R¢tgetaddressesRR¨(RVtaddrsR‰R}tatresultR¤R¥((s2/usr/lib/python2.7/dist-packages/mercurial/mail.pytaddrlistencode7s)#cCs7d}|s't|||ƒ\}}nt|d|ƒS(sgcreates mime text object, encodes it if needed, and sets
    charset and transfer-encoding accordingly.sus-asciiRx(R›R{(RVRJR‰R}R~((s2/usr/lib/python2.7/dist-packages/mercurial/mail.pyt
mimeencodeDs((ti18nRRRRRbR
R0R‚RmR.R[temail.Headertemail.MIMETextRRRRt__dict__RR	RR*RRZRkRrRQRBRwRNRR{R’R›RžR¨R¬R²R³(((s2/usr/lib/python2.7/dist-packages/mercurial/mail.pyt<module>s6$H		C		
			
	

Copyright © 2017 || Recoded By Mr.Bumblebee