KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/21573/task/21573/root/proc/21572/root/usr/lib64/python2.4/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21573/task/21573/root/proc/21572/root/usr/lib64/python2.4/imaplib.pyo
m
=5Dc@sdZdZdkZdkZdkZdkZdkZdkZdkZddddddd	gZ	d
Z
dZdZd
Z
ddfZhdddf<ddf<dddddf<ddf<ddf<ddf<dddf<dddf<dddf<dddf<ddf<ddf<dddf<d ddf<d!ddf<d"ddf<d#ddf<d$df<dddddf<d%ddf<d&ddf<d'ddddf<d(df<d)df<d*ddf<d+df<d,ddf<d-ddf<d.ddf<d/df<d0ddf<d1df<d2ddf<d3df<d4df<d5ddf<Zeid6Zeid7Zeid8Zeid9Zeid:Zeid;Zeid<Zeid=Zdfd>YZdefd?YZdefd@YZdAfdBYZhdCdD<dEdF<dGdH<dIdJ<dKdL<dMdN<dOdP<dQdR<dSdT<dUdV<dWdX<dYdZ<Zd[Zd\Zd]Z d^Z!e"d_jodk#Z#dk$Z$y#e#i#ei%dDd`\Z&Z'Wn*e#i(j
oZ)fff\Z&Z'nXe*Z+x]e&D]U\Z,Z)e,dajoe-e)Zn-e,dbjoe)Z+e'o
e+fZ'nnqpWe'o
dcfZ'ne'dZ.e$i/Z0e$i$dde0e.pdefZ1dfhdge0<dhdi<Z2dje0e1ffdkdlffdmdldnffddoffdpdoe*e*e2ffdqdrdsffdtdoffdue*dvdwffdxdydzffd{dyd|d}ffd~ffdffdffdfffZ3dtffddffdd+dffddffdpe*e*e*e2ffdffdfffZ4dZ5ye+oee+Z6n
ee.Z6e6i7djoe3dDZ3ne6i8de6i9e6i8de6i:fx!e3D]\Z;Z'e5e;e'qWxie5dqddfD]RZ<ei=de<Z>e>oe>i?dDZ@ne<iAdZ@e5de@fqWxe4D]~\Z;Z'e5e;e'ZBe;e'fdd+dffjoq_neBdiAZCeCoq_ne5dddeCddfq_WdGHWn+dGHeodei%dGHnnXndS(sIMAP4 client.

Based on RFC 2060.

Public class:           IMAP4
Public variable:        Debug
Public functions:       Internaldate2tuple
                        Int2AP
                        ParseFlags
                        Time2Internaldate
s2.55NtIMAP4t	IMAP4_SSLtIMAP4_streamtInternaldate2tupletInt2APt
ParseFlagstTime2Internaldates
iiit	IMAP4REV1tAPPENDtAUTHtSELECTEDtAUTHENTICATEtNONAUTHt
CAPABILITYtLOGOUTtCHECKtCLOSEtCOPYtCREATEtDELETEt	DELETEACLtEXAMINEtEXPUNGEtFETCHtGETACLtGETQUOTAtGETQUOTAROOTtMYRIGHTStLISTtLOGINtLSUBt	NAMESPACEtNOOPtPARTIALt	PROXYAUTHtRENAMEtSEARCHtSELECTtSETACLtSETQUOTAtSORTtSTATUStSTOREt	SUBSCRIBEtTHREADtUIDtUNSUBSCRIBEs\+( (?P<data>.*))?s.*FLAGS \((?P<flags>[^\)]*)\)s.*INTERNALDATE "(?P<day>[ 0123][0-9])-(?P<mon>[A-Z][a-z][a-z])-(?P<year>[0-9][0-9][0-9][0-9]) (?P<hour>[0-9][0-9]):(?P<min>[0-9][0-9]):(?P<sec>[0-9][0-9]) (?P<zonen>[-+])(?P<zoneh>[0-9][0-9])(?P<zonem>[0-9][0-9])"s.*{(?P<size>\d+)}$s
\r\n|\r|\ns)\[(?P<type>[A-Z-]+)( (?P<data>[^\]]*))?\]s$\* (?P<type>[A-Z-]+)( (?P<data>.*))?s3\* (?P<data>\d+) (?P<type>[A-Z-]+)( (?P<data2>.*))?cBstZdZdefdYZdefdYZdefdYZeidZ	de
d	Zd
Zde
dZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d d!d"Z"d#Z#d$Z$d%Z%d&Z&d d!d'Z'd(Z(d)Z)d*Z*d+Z+d,Z,d-Z-d.Z.d/e/d0Z0d1Z1d2Z2d3Z3d4Z4d5Z5d6Z6d7Z7d8Z8d9Z9d:Z:d;Z;d<Z<d=Z=d>Z>d?Z?d@Z@dAZAdBZBdCZCdDZDdEZEdFZFdGZGRS(HsIMAP4 client class.

    Instantiate with: IMAP4([host[, port]])

            host - host's name (default: localhost);
            port - port number (default: standard IMAP4 port).

    All IMAP4rev1 commands are supported by methods of the same
    name (in lower-case).

    All arguments to commands are converted to strings, except for
    AUTHENTICATE, and the last argument to APPEND which is passed as
    an IMAP4 literal.  If necessary (the string contains any
    non-printing characters or white-space and isn't enclosed with
    either parentheses or double quotes) each string is quoted.
    However, the 'password' argument to the LOGIN command is always
    quoted.  If you want to avoid having an argument string quoted
    (eg: the 'flags' argument to STORE) then enclose the string in
    parentheses (eg: "(\Deleted)").

    Each command returns a tuple: (type, [data, ...]) where 'type'
    is usually 'OK' or 'NO', and 'data' is either the text from the
    tagged response, or untagged results from command. Each 'data'
    is either a string, or a tuple. If a tuple, then the first part
    is the header of the response, and the second part contains
    the data (ie: 'literal' value).

    Errors raise the exception class <instance>.error("<reason>").
    IMAP4 server errors raise <instance>.abort("<reason>"),
    which is a sub-class of 'error'. Mailbox status changes
    from READ-WRITE to READ-ONLY raise the exception class
    <instance>.readonly("<reason>"), which is a sub-class of 'abort'.

    "error" exceptions imply a program error.
    "abort" exceptions imply the connection should be reset, and
            the command re-tried.
    "readonly" exceptions imply the command should be re-tried.

    Note: to use this module, you must read the RFCs pertaining
    to the IMAP4 protocol, as the semantics of the arguments to
    each IMAP4 command are left to the invoker, not to mention
    the results.
    terrorcBstZRS(N(t__name__t
__module__(((t/usr/lib64/python2.4/imaplib.pyR/stabortcBstZRS(N(R0R1(((R2R3streadonlycBstZRS(N(R0R1(((R2R4ss[^\w!#$%&'*+,.:;<=>?^`|~-]tcCst|_d|_d|_h|_h|_d|_d|_	d|_
|i||ttidd|_tid|id|_|i|_d|ijo
d|_n0d	|ijo
d
|_n|i|id}|i|||ijo|idnt|i|d
ii|_x2tD]*}||ijoqNn||_ dSqNW|iddS(NRR5ii|s(?P<tag>s"\d+) (?P<type>[A-Z]+) (?P<data>.*)tPREAUTHR	tOKRR
s"no CAPABILITY response from serverisserver not IMAP4 compliant(!tDebugtselftdebugtstatetNonetliteralttagged_commandstuntagged_responsestcontinuation_responsetis_readonlyttagnumtopenthosttportRtrandomtrandintttagpretretcompilettagret
_get_responsetwelcomeR/tcapt_simple_commandttupletuppertsplittcapabilitiestAllowedVersionstversiontPROTOCOL_VERSION(R9RDRERNRU((R2t__init__s>								


&	cCs8|tjot||iSntd|dS(NsUnknown IMAP4 command: '%s'(tattrtCommandstgetattrR9tlowertAttributeError(R9RX((R2t__getattr__s
cCs\||_||_tititi|_|ii||f|iid|_	dS(sSetup connection to remote server on "host:port"
            (default: localhost:standard IMAP4 port).
        This connection will be used by the routines:
            read, readline, send, shutdown.
        trbN(
RDR9REtsockettAF_INETtSOCK_STREAMtsocktconnecttmakefiletfile(R9RDRE((R2RCs		cCs|ii|S(sRead 'size' bytes from remote.N(R9Retreadtsize(R9Rg((R2RfscCs
|iiS(sRead line from remote.N(R9Retreadline(R9((R2RhscCs|ii|dS(sSend data to remote.N(R9Rbtsendalltdata(R9Rj((R2tsendscCs|ii|iidS(s Close I/O established in "open".N(R9RetcloseRb(R9((R2tshutdowns
cCs|iS(sfReturn socket instance used to connect to IMAP4 server.

        socket = <instance>.socket()
        N(R9Rb(R9((R2R_scCsbd}|iddg|\}}|do||fSn|i\}}|i|||S(sReturn most recent 'RECENT' responses if any exist,
        else prompt server for an update using the 'NOOP' command.

        (typ, [data]) = <instance>.recent()

        'data' is None if no new messages,
        else list of RECENT responses, most recent last.
        tRECENTR7iN(tnameR9t_untagged_responseR<ttyptdattnoop(R9RrRqRo((R2trecent	scCs|i|dg|iS(sReturn data for response 'code' if received, or None.

        Old value for response 'code' is cleared.

        (code, [data]) = <instance>.response(code)
        N(R9RptcodeR<RQ(R9Ru((R2tresponsescCsd}|p
d}n|o-|d|dfd	jod|}qQnd}|ot|}nd}tit||_|i||||S(
sAppend message to named mailbox.

        (typ, [data]) = <instance>.append(mailbox, flags, date_time, message)

                All args except `message' can be None.
        RtINBOXiit(t)s(%s)N(RxRy(
RotmailboxtflagsR<t	date_timeRtMapCRLFtsubtCRLFtmessageR9R=RO(R9RzR{R|RRo((R2tappend(s
cCsm|i}t|i|_|id|\}}|djo|i|dnd|_||fS(s,Authenticate command - requires response processing.

        'mechanism' specifies which authentication mechanism is to
        be used - it must appear in <instance>.capabilities in the
        form AUTH=<mechanism>.

        'authobject' must be a callable object:

                data = authobject(response)

        It will be called to process server continuation responses.
        It should return data that will be encoded and sent to server.
        It should return None if the client abort response '*' should
        be sent instead.
        RR7iR	N(
t	mechanismRQtmecht_Authenticatort
authobjecttprocessR9R=RORqRrR/R;(R9RRRRrRq((R2tauthenticate?s
	cCs
|idS(sRCheckpoint mailbox on server.

        (typ, [data]) = <instance>.check()
        RN(R9RO(R9((R2tcheck\scCs0z|id\}}Wdd|_X||fS(sClose currently selected mailbox.

        Deleted messages are removed from writable mailbox.
        This is the recommended command before 'LOGOUT'.

        (typ, [data]) = <instance>.close()
        RNR	(R9RORqRrR;(R9RrRq((R2Rlds
cCs|id||S(sCopy 'message_set' messages onto end of 'new_mailbox'.

        (typ, [data]) = <instance>.copy(message_set, new_mailbox)
        RN(R9ROtmessage_settnew_mailbox(R9RR((R2tcopysscCs|id|S(sPCreate new mailbox.

        (typ, [data]) = <instance>.create(mailbox)
        RN(R9RORz(R9Rz((R2tcreate{scCs|id|S(sPDelete old mailbox.

        (typ, [data]) = <instance>.delete(mailbox)
        RN(R9RORz(R9Rz((R2tdeletescCs|id||S(sDelete the ACLs (remove any rights) set for who on mailbox.

        (typ, [data]) = <instance>.deleteacl(mailbox, who)
        RN(R9RORztwho(R9RzR((R2t	deleteaclscCs.d}|i|\}}|i|||S(sPermanently remove deleted items from selected mailbox.

        Generates 'EXPUNGE' response for each deleted message.

        (typ, [data]) = <instance>.expunge()

        'data' is list of 'EXPUNGE'd message numbers in order received.
        RN(RoR9RORqRrRp(R9RrRqRo((R2texpungescCs4d}|i|||\}}|i|||S(s#Fetch (parts of) messages.

        (typ, [data, ...]) = <instance>.fetch(message_set, message_parts)

        'message_parts' should be a string of selected parts
        enclosed in parentheses, eg: "(UID BODY[TEXT])".

        'data' are tuples of message part envelope and data.
        RN(RoR9RORt
message_partsRqRrRp(R9RRRoRrRq((R2tfetchs	cCs+|id|\}}|i||dS(sXGet the ACLs for a mailbox.

        (typ, [data]) = <instance>.getacl(mailbox)
        RtACLN(R9RORzRqRrRp(R9RzRrRq((R2tgetaclscCs+|id|\}}|i||dS(sGet the quota root's resource usage and limits.

        Part of the IMAP4 QUOTA extension defined in rfc2087.

        (typ, [data]) = <instance>.getquota(root)
        RtQUOTAN(R9ROtrootRqRrRp(R9RRrRq((R2tgetquotascCs^|id|\}}|i||d\}}|i||d\}}|||gfS(sGet the list of quota roots for the named mailbox.

        (typ, [[QUOTAROOT responses...], [QUOTA responses]]) = <instance>.getquotaroot(mailbox)
        RRt	QUOTAROOTN(R9RORzRqRrRptquotat	quotaroot(R9RzRRRrRq((R2tgetquotaroots
s""t*cCs4d}|i|||\}}|i|||S(sList mailbox names in directory matching pattern.

        (typ, [data]) = <instance>.list(directory='""', pattern='*')

        'data' is list of LIST responses.
        RN(RoR9ROt	directorytpatternRqRrRp(R9RRRoRrRq((R2tlistscCs[|id||i|\}}|djo|i|dnd|_||fS(sIdentify client using plaintext password.

        (typ, [data]) = <instance>.login(user, password)

        NB: 'password' will be quoted.
        RR7iR	N(	R9ROtusert_quotetpasswordRqRrR/R;(R9RRRrRq((R2tlogins$
	cCs&|||_|_|id|iS(sr Force use of CRAM-MD5 authentication.

        (typ, [data]) = <instance>.login_cram_md5(user, password)
        sCRAM-MD5N(RRR9Rt_CRAM_MD5_AUTH(R9RR((R2tlogin_cram_md5scCs-dk}|id|i|i|iS(s1 Authobject to use with CRAM-MD5 authentication. Nt (thmacR9RtHMACRt	challenget	hexdigest(R9RR((R2Rs	cCsd|_y|id\}}Wn%ddtid g}}nX|id|ijod|idfSn||fS(s|Shutdown connection to server.

        (typ, [data]) = <instance>.logout()

        Returns server 'BYE' response.
        RtNOs%s: %sitBYEN(	R9R;RORqRrtsystexc_infoRmR?(R9RrRq((R2tlogouts	"
cCs4d}|i|||\}}|i|||S(sList 'subscribed' mailbox names in directory matching pattern.

        (typ, [data, ...]) = <instance>.lsub(directory='""', pattern='*')

        'data' are tuples of message part envelope and data.
        RN(RoR9RORRRqRrRp(R9RRRoRrRq((R2tlsubscCs+|id|\}}|i||dS(sShow my ACLs for a mailbox (i.e. the rights that I have on mailbox).

        (typ, [data]) = <instance>.myrights(mailbox)
        RN(R9RORzRqRrRp(R9RzRrRq((R2tmyrightsscCs.d}|i|\}}|i|||S(sb Returns IMAP namespaces ala rfc2342

        (typ, [data, ...]) = <instance>.namespace()
        RN(RoR9RORqRrRp(R9RrRqRo((R2t	namespacescCs
|idS(sFSend NOOP command.

        (typ, [data]) = <instance>.noop()
        R N(R9RO(R9((R2Rs#scCs:d}|i|||||\}}|i	||dS(sFetch truncated part of a message.

        (typ, [data, ...]) = <instance>.partial(message_num, message_part, start, length)

        'data' is tuple of message part envelope and data.
        R!RN(
RoR9ROtmessage_numtmessage_parttstarttlengthRqRrRp(R9RRRRRoRrRq((R2tpartial.s!cCsd}|id|S(sAssume authentication as "user".

        Allows an authorised administrator to proxy into any user's
        mailbox.

        (typ, [data]) = <instance>.proxyauth(user)
        R"N(RoR9ROR(R9RRo((R2t	proxyauth:scCs|id||S(skRename old mailbox name to new.

        (typ, [data]) = <instance>.rename(oldmailbox, newmailbox)
        R#N(R9ROt
oldmailboxt
newmailbox(R9RR((R2trenameGscGsZd}|o"|i|d||\}}n|i||\}}|i|||S(sSearch mailbox for matching messages.

        (typ, [data]) = <instance>.search(charset, criterion, ...)

        'data' is space separated list of matching message numbers.
        R$tCHARSETN(RotcharsetR9ROtcriteriaRqRrRp(R9RRRoRrRq((R2tsearchOs"RwcCsh|_||_|d	j	o
d}nd}|i||\}}|djod|_
||fSnd|_
d|ijo|o|id|n||iidd	gfS(
ssSelect a mailbox.

        Flush all untagged responses.

        (typ, [data]) = <instance>.select(mailbox='INBOX', readonly=None)

        'data' is count of messages in mailbox ('EXISTS' response).

        Mandated responses are ('FLAGS', 'EXISTS', 'RECENT', 'UIDVALIDITY'), so
        other responses should be obtained via <instance>.response('FLAGS') etc.
        RR%R7R	R
s	READ-ONLYs%s is not writabletEXISTSN(R9R?R4RAR<RoRORzRqRrR;tget(R9RzR4RoRrRq((R2tselect^s		


		cCs|id|||S(sZSet a mailbox acl.

        (typ, [data]) = <instance>.setacl(mailbox, who, what)
        R&N(R9RORzRtwhat(R9RzRR((R2tsetacl~scCs.|id||\}}|i||dS(siSet the quota root's resource limits.

        (typ, [data]) = <instance>.setquota(root, limits)
        R'RN(R9RORtlimitsRqRrRp(R9RRRrRq((R2tsetquotascGs`d}|d|dfdjod|}n|i||||\}}|i|||S(	sIMAP4rev1 extension SORT command.

        (typ, [data]) = <instance>.sort(sort_criteria, charset, search_criteria, ...)
        R(iiRxRys(%s)N(RxRy(	Rot
sort_criteriaR9RORtsearch_criteriaRqRrRp(R9RRRRoRrRq((R2tsortscCs4d}|i|||\}}|i|||S(spRequest named status conditions for mailbox.

        (typ, [data]) = <instance>.status(mailbox, names)
        R)N(RoR9RORztnamesRqRrRp(R9RzRRoRrRq((R2tstatusscCsZ|d|dfd	jod|}n|id|||\}}|i||dS(
sAlters flag dispositions for messages in mailbox.

        (typ, [data]) = <instance>.store(message_set, command, flags)
        iiRxRys(%s)R*RN(RxRy(R{R9RORtcommandRqRrRp(R9RRR{RrRq((R2tstores
cCs|id|S(sYSubscribe to new mailbox.

        (typ, [data]) = <instance>.subscribe(mailbox)
        R+N(R9RORz(R9Rz((R2t	subscribescGs7d}|i||||\}}|i|||S(sIMAPrev1 extension THREAD command.

        (type, [data]) = <instance>.thread(threading_alogrithm, charset, search_criteria, ...)
        R,N(	RoR9ROtthreading_algorithmRRRqRrRp(R9RRRRoRrRq((R2tthreadscGs|i}|tjo|id|n|it|jo |id||ifnd}|i|||\}}|djo
|}nd}|i|||S(	sExecute "command arg ..." with messages identified by UID,
                rather than message number.

        (typ, [data]) = <instance>.uid(command, arg1, arg2, ...)

        Returns response appropriate to 'command'.
        sUnknown IMAP4 UID command: %sscommand %s illegal in state %sR-R$R(RN(sSEARCHsSORT(RRQRYR9R/R;RoROtargsRqRrRp(R9RRRoRrRq((R2tuids
 

cCs|id|S(s_Unsubscribe from old mailbox.

        (typ, [data]) = <instance>.unsubscribe(mailbox)
        R.N(R9RORz(R9Rz((R2tunsubscribescGs=|i}|tjo|ift|<n|i||S(sAllow simple extension commands
                notified by server in CAPABILITY response.

        Assumes command is legal in current state.

        (typ, [data]) = <instance>.xatom(name, arg, ...)

        Returns response appropriate to extension command `name'.
        N(RoRQRYR9R;ROR(R9RoR((R2txatoms
	
cCsS|djo
d}n|i}||jo||i|n|g||<dS(NR5(RrR<R9R?turRqR(R9RqRrR((R2t_append_untaggeds

	
cCs4|iid}|o|i|dndS(NRi(R9R?RtbyeR3(R9R((R2t
_check_bye	sc
Gsl|it|jo)d|_|id||ifnx,dD]$}	|	|ijo|i|	=qDqDWd|ijo|i	o|i
dn|i}d||f}x;|D]3}|djoqnd||i|f}qW|i}|dj	oOd|_t|t|ijo
|}qYd}d|t|f}ny|id	|tfWn1titfj
o}|id
|nX|djo|Snxx(|io|i|o|SqqW|o||i}ny|i||itWn1titfj
o}|id
|nX|pPqqW|S(
Nscommand %s illegal in state %sR7RtBADs	READ-ONLYs#mailbox status changed to READ-ONLYs%s %ss%s {%s}s%s%sssocket error: %si(sOKsNOR(R9R;RYRoR<R=R/RqR?RAR4t_new_tagttagRjRtargt_checkquotettypet_commandt	literatortlenRkRR_tOSErrortvalR3RLR>R@(
R9RoRRRRjR=RRRq((R2Rs^	 
	
	





cCs|iy|i|\}}Wna|ij
o"}|id||fn2|i	j
o"}|i	d||fnX|i|djo |i	d|||fn||fS(Nscommand: %s => %sRs%s command error: %s %s(
R9Rt_get_tagged_responseRRqRjR3RRoR/(R9RoRRRqRj((R2t_command_completeWs


 cCsN|i}|i|i|ow|iid}||ijo|i	d|n|iid}|iid}||gf|i|<nfd}|it|p-|it|o|iid}qn|idjoG|it|o|iid|_dSn|i	d|n|iid}|iid}|djo
d}n|o|d|}nxa|it|oMt|iid	}|i|}|i|||f|i}qW|i|||d
jo?|it|o,|i|iid|iidn|S(NRsunexpected tagged response: %sRRjtdata2sunexpected response: '%s'R5RRgR7RR(sOKsNOsBAD(R9t	_get_linetrespt_matchRKtmotgroupRR>R3RqRrR<tdat2tUntagged_responsetUntagged_statustContinuationR@tLiteraltintRgRfRjRt
Response_code(R9RRrRRjRqRRg((R2RLesF

 ,cCsdx]|i|}|dj	o|i|=|Sny|iWq|ij
o}qXqWdS(Ni(R9R>RtresultR<RLR3R(R9RRR((R2Rs


cCs4|i}|p|idn|d }|S(Nssocket error: EOFi(R9RhtlineR3(R9R((R2Rs
cCs|i||_|idj	S(N(tcretmatchtsR9RR<(R9RR((R2RscCs7d|i|if}|id|_d|i|<|S(Ns%s%si(R9RHRBRR<R>(R9R((R2Rs
cCst|tdj	o|Snt|djo)|d|dfdd	fjo|Sn|o!|ii|djo|Sn|i|S(
NR5iiiRxRyt"(RxRy(RR(RRRR9t	mustquoteRR<R(R9R((R2Rs4 cCs,|idd}|idd}d|S(Ns\s\\Rs\"s"%s"(Rtreplace(R9R((R2RscGs|i||i||S(N(R9RRoRR(R9RoR((R2ROscCsX|djo||fSn||ijo|dgfSn|ii|}||fS(NR(RqRrRoR9R?R<tpopRj(R9RqRrRoRj((R2Rps
(HR0R1t__doc__t	ExceptionR/R3R4RIRJRt
IMAP4_PORTRWR]RCRfRhRkRmR_RtRvRRRRlRRRRRRRRRRRRRRRRRRsRRRRR<RRRRRRRRRRRRRRRRLRRRRRRRORp(((R2R`s,<	
																												
			
		 								
						H		L							cBshtZdZdeeedZdedZdZdZdZ	dZ
dZd	ZRS(
sIMAP4 client class over SSL connection

    Instantiate with: IMAP4_SSL([host[, port[, keyfile[, certfile]]]])

            host - host's name (default: localhost);
            port - port number (default: standard IMAP4 SSL port).
            keyfile - PEM formatted file that contains your private key (default: None);
            certfile - PEM formatted certificate chain file (default: None);

    for more documentation see the docstring of the parent class IMAP4.
    R5cCs)||_||_ti|||dS(N(tkeyfileR9tcertfileRRWRDRE(R9RDRERR((R2RWJs		cCsh||_||_tititi|_|ii||fti|i|i	|i
|_dS(sSetup connection to remote server on "host:port".
            (default: localhost:standard IMAP4 SSL port).
        This connection will be used by the routines:
            read, readline, send, shutdown.
        N(RDR9RER_R`RaRbRctsslRRtsslobj(R9RDRE((R2RCPs		cCsag}d}xE||jo7|ii||}|t|7}|i|qWdi|S(sRead 'size' bytes from remote.iR5N(	tchunksRfRgR9RRjRRtjoin(R9RgRfRRj((R2Rf]s
cCsOg}xB|iid}|i||djodi|Sq	q	WdS(sRead line from remote.is
R5N(RR9RRftcharRR(R9RR((R2Rhjs

cCs]t|}xJ|djo<|ii|}||joPn||}||}qWdS(sSend data to remote.iN(RRjtbytesR9Rtwritetsent(R9RjRR((R2Rkts


cCs|iidS(s Close I/O established in "open".N(R9RbRl(R9((R2RmscCs|iS(sfReturn socket instance used to connect to IMAP4 server.

        socket = <instance>.socket()
        N(R9Rb(R9((R2R_scCs|iS(stReturn SSLObject instance used to communicate with the IMAP4 server.

        ssl = <instance>.socket.ssl()
        N(R9R(R9((R2Rs(
R0R1RtIMAP4_SSL_PORTR<RWRCRfRhRkRmR_R(((R2R;s
	
	
			cBsJtZdZdZeedZdZdZdZdZ	RS(sIMAP4 client class over a stream

    Instantiate with: IMAP4_stream(command)

            where "command" is a string that can be passed to os.popen2()

    for more documentation see the docstring of the parent class IMAP4.
    cCs||_ti|dS(N(RR9RRW(R9R((R2RWs	cCsFd|_d|_d|_d|_ti|i\|_	|_
dS(sSetup a stream connection.
        This connection will be used by the routines:
            read, readline, send, shutdown.
        N(R<R9RDRERbRetostpopen2Rt	writefiletreadfile(R9RDRE((R2RCs				cCs|ii|S(sRead 'size' bytes from remote.N(R9R
RfRg(R9Rg((R2RfscCs
|iiS(sRead line from remote.N(R9R
Rh(R9((R2RhscCs!|ii||iidS(sSend data to remote.N(R9RRRjtflush(R9Rj((R2RkscCs|ii|iidS(s Close I/O established in "open".N(R9R
RlR(R9((R2Rms
(
R0R1RRWR<RCRfRhRkRm(((R2Rs					RcBs2tZdZdZdZdZdZRS(scPrivate class to provide en/decoding
            for base64-based authentication conversation.
    cCs
||_dS(N(tmechinstR9R(R9R((R2RWscCs:|i|i|}|djodSn|i|S(NR(R9RtdecodeRjtretR<tencode(R9RjR((R2Rs
cCsxd}xk|oct|djo|d }|d}n
|}d}ti|}|o||d }q	q	W|S(NR5i0i(touptinpRtttbinasciit
b2a_base64te(R9RRRR((R2Rs	
cCs|pdSnti|S(NR5(RRt
a2b_base64(R9R((R2Rs(R0R1RRWRRR(((R2Rs
			tJanitFebitMaritApritMayitJunitJulitAugitSepi	tOcti
tNovitDecic	Csti|}|pd
Snt|id}|id}t	|id}t	|id}
t	|id}t	|id}t	|id}
t	|id}t	|id	}|d
|d
}|djo|}n|
|||||
dddf	}	ti|	}ti|}tio|do|ti}n|ti}ti||S(sMConvert IMAP4 INTERNALDATE to UT.

    Returns Python time module tuple.
    tmontzonentdaytyearthourtmintsectzonehtzonemi<t-iN(tInternalDateRRRR<tMon2numRR&R'RR(R)R*R+R,R-R.tzonetttttimetmktimetutct	localtimetlttdaylighttaltzonettimezone(RR6R2R*R+R'R.R(R8R3R,R&R-R)R((R2Rs.
!
cCsTd}d}tt|}x/|o't|d\}}|||}q!W|S(s-Convert integer to A-P string representation.R5tABCDEFGHIJKLMNOPiN(RtAPRtabstnumtdivmodtmod(R?RR=RA((R2R%scCs7ti|}|pfSnt|idiS(s-Convert IMAP4 flags response to python tuple.R{N(tFlagsRRRRPRRR(RR((R2R2s
cCst|ttfoti|}nct|ttifo
|}n@t|t	o#|d|dfdjo|Sn
t
dtid|}|ddjod|d}nti
o|doti}nti}d|d	t|d
d
dS(
syConvert 'date_time' to IMAP4 INTERNALDATE representation.

    Return string in form: '"DD-Mmm-YYYY HH:MM:SS +HHMM"'
    iiRsdate_time not of a known types%d-%b-%Y %H:%M:%St0Ris
 %+03d%02di<N(RR(t
isinstanceR|RtfloatR4R7R3RPtstruct_timetstrt
ValueErrortstrftimetdtR9R:R2R;R@(R|R2R3RJ((R2R=s
+
t__main__sd:s:s-ds-sR5sIMAP password for %s on %s: t	localhostsJFrom: %(user)s@localhost%(lf)sSubject: IMAP4 test%(lf)s%(lf)sdata...%(lf)sRtlfs
RRs
/tmp/xxx 1Rs/tmp/yyys
/tmp/yyz 2RRs/tmpsyy*RRtSUBJECTttestRt1s(FLAGS INTERNALDATE RFC822)RtFLAGSs
(\Deleted)RRRtRlRvtUIDVALIDITYRtALLRRcCsktid||ftt||\}}tid|||f|djo|dn|S(Ns%s %ss%s => %s %sRi(tMt_mesgtcmdRRZRqRr(RVRRrRq((R2truns
sPROTOCOL_VERSION = %ssCAPABILITIES = %rs/tmp/syy%s.*"([^"]+)"$iRs%ss:(FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822.TEXT)s
All tests OK.s
Tests failed.s8
If you would like to see debugging output,
try: %s -d5
(DRt__version__RR
RFRIR_RR4t__all__RR8RR	RTRYRJRRBR0RR}RRRRRRRR1RRRRR0tgetopttgetpasstargvtoptlistRR/RR<tstream_commandtoptRRDtgetusertUSERtPASSWDt	test_mesgt	test_seq1t	test_seq2RWRTR;RURVRSRVtmlRRRtpathRRRrR(5R_RRRFRRRaRgRRR0RRYRRbRIRcRrRZRXRR^RYReRWRRTRR	RRRDRBRR8R}RRdRfR[R_R1RRRRVRTRR4R]RR
R((R2t?s?*[4,r	,	
		
#



 ]
	"	

Anon7 - 2021