B &=™'×¼þã*@sªdZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z m Z m Z ddl mZyddlZdZWnek r”dZYnXddd d d d gZd ZdZdZdZdZdZddddddddddddddddddddddddddddddddddddddddddœ)Ze d¡Ze d¡Ze d¡Ze dej¡Ze d¡Z e d¡Z!e d¡Z"e dej¡Z#dZ$dZ%Gd d„dƒZ&er¤Gd!d"„d"e&ƒZ'e (d"¡Gd#d„de&ƒZ)Gd$d%„d%ƒZ*d& +d'¡Z,d(d)„e-e,d*d…ƒDƒZ.d+d „Z/d,d „Z0d-d „Z1d.d „Z2e3d/kr¦ddl4Z4ddl5Z5ye4 4ej6d*d…d0¡\Z7Z8Wn.e4j9k rlZ:z d1\Z7Z8WddZ:[:XYnXdZ;x@e7D]8\Ze5 ?¡Z@e5 5d5e@e>pÞd6f¡ZAd7e@d8d9œZBd:e@eAffd;dd?ddeBffd@dAdBdCdDdEdFdGdHfZCdIdJdKdLd>dddeBffdGdMfZDdNdO„ZEy&e;rbe)e;ƒZFne&e>ƒZFeFjGdPkr‚eCd*d…ZCeF HdQeFjI¡eF HdReFjJf¡xeCD]\ZKZ8eEeKe8ƒqªWxJeEdSdTƒD].*))?s.*FLAGS \((?P[^\)]*)\)sÕ.*INTERNALDATE "(?P[ 0123][0-9])-(?P[A-Z][a-z][a-z])-(?P[0-9][0-9][0-9][0-9]) (?P[0-9][0-9]):(?P[0-9][0-9]):(?P[0-9][0-9]) (?P[-+])(?P[0-9][0-9])(?P[0-9][0-9])"s.*{(?P\d+)}$s \r\n|\r|\ns%\[(?P[A-Z-]+)( (?P.*))?\]s$\* (?P[A-Z-]+)( (?P.*))?s3\* (?P\d+) (?P[A-Z-]+)( (?P.*))?c@sˆeZdZGdd„deƒZGdd„deƒZGdd„deƒZdefdd „Zd d „Z d d „Z dd„Z dd„Z dd„Z dd„Zdd„Zdefdd„Zdd„Zdd„Zdd„Zd d!„Zd"d#„Zd$d%„Zd&d'„Zd(d)„Zd*d+„Zd,d-„Zd.d/„Zd0d1„Zd2d3„Zd4d5„Zd6d7„Zd8d9„Z d:d;„Z!dd?„Z#d@dA„Z$dBdC„Z%dDdE„Z&dFdG„Z'd›dJdK„Z(dLdM„Z)dNdO„Z*dPdQ„Z+dRdS„Z,dœdTdU„Z-dVdW„Z.dXdY„Z/dZd[„Z0d\d]„Z1d^d_„Z2d`da„Z3dbdc„Z4ddfdg„Z5dhdi„Z6djdk„Z7dldm„Z8dndo„Z9dždqdr„Z:dsdt„Z;dudv„Zd{d|„Z?d}d~„Z@dd€„ZAdd‚„ZBdƒd„„ZCd…d†„ZDd‡dˆ„ZEd‰dŠ„ZFd‹dŒ„ZGddŽ„ZHdd„ZId‘d’„ZJd“d”„ZKd•d–„ZLd—d˜„ZMd™dš„ZNdpS)Ÿrc@s eZdZdS)z IMAP4.errorN)Ú__name__Ú __module__Ú __qualname__©r;r;ú*/opt/alt/python37/lib/python3.7/imaplib.pyÚerror´sr=c@s eZdZdS)z IMAP4.abortN)r8r9r:r;r;r;r<Úabortµsr>c@s eZdZdS)zIMAP4.readonlyN)r8r9r:r;r;r;r<Úreadonly¶sr?Úc Cs”t|_d|_d|_i|_i|_d|_d|_d|_d|_ |  ¡|  ||¡y |  ¡Wn8t k rŽy | ¡Wntk r†YnX‚YnXdS)Nrr@Fr)ÚDebugÚdebugÚstateÚliteralÚtagged_commandsÚuntagged_responsesÚcontinuation_responseÚ is_readonlyÚtagnumÚ_tls_establishedÚ _mode_asciiÚopenÚ_connectÚ ExceptionÚshutdownÚOSError)ÚselfÚhostÚportr;r;r<Ú__init__¸s&   zIMAP4.__init__cCs0d|_d|_t ttj¡|_t ttj¡|_dS)NFÚascii) Ú utf8_enabledÚ _encodingÚreÚcompileÚ_LiteralÚASCIIÚLiteralÚ_Untagged_statusÚUntagged_status)rQr;r;r<rKÑszIMAP4._mode_asciicCs(d|_d|_t t¡|_t t¡|_dS)NTzutf-8)rVrWrXrYrZr\r]r^)rQr;r;r<Ú _mode_utf8Øs zIMAP4._mode_utf8cCsžtt dd¡ƒ|_t d|jdtj¡|_| ¡|_ d|j krHd|_ nd|j krZd|_ n |  |j ¡‚|  ¡x tD]}||jkr„qt||_dSW|  d ¡‚dS) Niiÿÿs(?Ps"\d+) (?P[A-Z]+) (?P.*)ZPREAUTHr ÚOKrzserver not IMAP4 compliant)r ÚrandomZrandintÚtagprerXrYr[ÚtagreÚ _get_responseZwelcomerFrCr=Ú_get_capabilitiesÚAllowedVersionsÚ capabilitiesÚPROTOCOL_VERSION)rQÚversionr;r;r<rMßs       zIMAP4._connectcCs&|tkrt|| ¡ƒStd|ƒ‚dS)NzUnknown IMAP4 command: '%s')ÚCommandsÚgetattrÚlowerÚAttributeError)rQÚattrr;r;r<Ú __getattr__ szIMAP4.__getattr__cCs|S)Nr;)rQr;r;r<Ú __enter__szIMAP4.__enter__cGs&y | ¡Wntk r YnXdS)N)ÚlogoutrP)rQÚargsr;r;r<Ú__exit__s zIMAP4.__exit__cCs |js dn|j}t ||jf¡S)N)rRÚsocketZcreate_connectionrS)rQrRr;r;r<Ú_create_socketszIMAP4._create_socketcCs(||_||_| ¡|_|j d¡|_dS)NÚrb)rRrSruÚsockÚmakefileÚfile)rQrRrSr;r;r<rL#s z IMAP4.opencCs |j |¡S)N)ryÚread)rQÚsizer;r;r<rz/sz IMAP4.readcCs.|j td¡}t|ƒtkr*| dt¡‚|S)Nézgot more than %d bytes)ryÚreadlineÚ_MAXLINEÚlenr=)rQÚliner;r;r<r}4s zIMAP4.readlinecCs|j |¡dS)N)rwZsendall)rQÚdatar;r;r<Úsend<sz IMAP4.sendc Cst|j ¡zXy|j tj¡Wn@tk r^}z"|jtjkrNt |ddƒdkrN‚Wdd}~XYnXWd|j ¡XdS)NZwinerrorri&') ryÚcloserwrOrtZ SHUT_RDWRrPÚerrnoZENOTCONNrk)rQÚexcr;r;r<rOAs  zIMAP4.shutdowncCs|jS)N)rw)rQr;r;r<rtQsz IMAP4.socketcCsBd}| ddg|¡\}}|dr(||fS| ¡\}}| |||¡S)NZRECENTr`éÿÿÿÿ)Ú_untagged_responseÚnoop)rQÚnameÚtypÚdatr;r;r<Úrecent]s  z IMAP4.recentcCs| |dg| ¡¡S)N)r‡Úupper)rQÚcoder;r;r<ÚresponsenszIMAP4.responsecCsxd}|s d}|r.|d|dfdkr2d|}nd}|r@t|ƒ}nd}t t|¡}|jrbd|d}||_| ||||¡S) NrÚINBOXrr†)ú(ú)z(%s)sUTF8 (ó))r ÚMapCRLFÚsubÚCRLFrVrDÚ_simple_command)rQÚmailboxÚflagsÚ date_timeÚmessager‰rDr;r;r<Úappend|s    z IMAP4.appendcCsP| ¡}t|ƒj|_| d|¡\}}|dkrB| |d dd¡¡‚d|_||fS)Nrr`r†zutf-8Úreplacer )rÚ_AuthenticatorÚprocessrDr—r=ÚdecoderC)rQZ mechanismZ authobjectÚmechrŠr‹r;r;r<Ú authenticate–s zIMAP4.authenticatecCs d}| |¡\}}| |||¡S)Nr)r—r‡)rQr‰rŠr‹r;r;r<Ú capability³szIMAP4.capabilitycCs | d¡S)Nr)r—)rQr;r;r<Úcheck¼sz IMAP4.checkcCs$z| d¡\}}Wdd|_X||fS)Nrr )r—rC)rQrŠr‹r;r;r<rƒÄsz IMAP4.closecCs| d||¡S)Nr)r—)rQÚ message_setZ new_mailboxr;r;r<ÚcopyÓsz IMAP4.copycCs | d|¡S)Nr)r—)rQr˜r;r;r<ÚcreateÛsz IMAP4.createcCs | d|¡S)Nr)r—)rQr˜r;r;r<Údeleteãsz IMAP4.deletecCs| d||¡S)Nr)r—)rQr˜Úwhor;r;r<Ú deleteaclêszIMAP4.deleteaclcCsHd|jkrt d¡‚| d|¡\}}|dkr@d| ¡kr@| ¡||fS)NrzServer does not support ENABLEr`z UTF8=ACCEPT)rgrr=r—rr_)rQr£rŠrr;r;r<Úenableñs   z IMAP4.enablecCs d}| |¡\}}| |||¡S)Nr)r—r‡)rQr‰rŠr‹r;r;r<Úexpungeýs z IMAP4.expungecCs$d}| |||¡\}}| |||¡S)Nr)r—r‡)rQr¥Z message_partsr‰rŠr‹r;r;r<Úfetch s z IMAP4.fetchcCs| d|¡\}}| ||d¡S)NrZACL)r—r‡)rQr˜rŠr‹r;r;r<Úgetaclsz IMAP4.getaclcCs"| d|||¡\}}| ||d¡S)NrÚ ANNOTATION)r—r‡)rQr˜ÚentryZ attributerŠr‹r;r;r<Ú getannotation#szIMAP4.getannotationcCs| d|¡\}}| ||d¡S)Nr ÚQUOTA)r—r‡)rQÚrootrŠr‹r;r;r<Úgetquota+szIMAP4.getquotacCs@| d|¡\}}| ||d¡\}}| ||d¡\}}|||gfS)Nr!r²Z QUOTAROOT)r—r‡)rQr˜rŠr‹ZquotaZ quotarootr;r;r<Ú getquotaroot6szIMAP4.getquotarootú""Ú*cCs$d}| |||¡\}}| |||¡S)Nr#)r—r‡)rQÚ directoryÚpatternr‰rŠr‹r;r;r<ÚlistAsz IMAP4.listcCs<| d|| |¡¡\}}|dkr.| |d¡‚d|_||fS)Nr$r`r†r )r—Ú_quoter=rC)rQÚuserÚpasswordrŠr‹r;r;r<ÚloginMs z IMAP4.logincCs|||_|_| d|j¡S)NzCRAM-MD5)r¼r½r¢Ú_CRAM_MD5_AUTH)rQr¼r½r;r;r<Úlogin_cram_md5[szIMAP4.login_cram_md5cCsBddl}t|jtƒr |j d¡n|j}|jd| ||d¡ ¡S)Nrzutf-8ú Zmd5)ÚhmacÚ isinstancer½ÚstrÚencoder¼ZHMACZ hexdigest)rQZ challengerÂÚpwdr;r;r<r¿dszIMAP4._CRAM_MD5_AUTHcCsjd|_y| d¡\}}Wn(ddt ¡dd…g}}YnX| ¡d|jkrbd|jdfS||fS)NrÚNOz%s: %séÚBYE)rCr—ÚsysÚexc_inforOrF)rQrŠr‹r;r;r<rqls" z IMAP4.logoutcCs$d}| |||¡\}}| |||¡S)Nr%)r—r‡)rQr¸r¹r‰rŠr‹r;r;r<Úlsub|sz IMAP4.lsubcCs| d|¡\}}| ||d¡S)Nr")r—r‡)rQr˜rŠr‹r;r;r<Úmyrights‡szIMAP4.myrightscCs d}| |¡\}}| |||¡S)Nr&)r—r‡)rQr‰rŠr‹r;r;r<Ú namespaceszIMAP4.namespacecCs | d¡S)Nr')r—)rQr;r;r<rˆ™sz IMAP4.noopcCs(d}| |||||¡\}}| ||d¡S)Nr(r)r—r‡)rQZ message_numZ message_partÚstartÚlengthr‰rŠr‹r;r;r<Úpartial¤sz IMAP4.partialcCsd}| d|¡S)Nr))r—)rQr¼r‰r;r;r<Ú proxyauth°s zIMAP4.proxyauthcCs| d||¡S)Nr*)r—)rQZ oldmailboxZ newmailboxr;r;r<Úrename½sz IMAP4.renamecGsTd}|r2|jrt d¡‚|j|d|f|žŽ\}}n|j|f|žŽ\}}| |||¡S)Nr+z'Non-None charset not valid in UTF8 modeÚCHARSET)rVrr=r—r‡)rQÚcharsetZcriteriar‰rŠr‹r;r;r<ÚsearchÅs z IMAP4.searchrFcCsvi|_||_|rd}nd}| ||¡\}}|dkr@d|_||fSd|_d|jkrb|sb| d|¡‚||j ddg¡fS) Nrr,r`r rz READ-ONLYz%s is not writableÚEXISTS)rFrHr—rCr?Úget)rQr˜r?r‰rŠr‹r;r;r<Úselect×s  z IMAP4.selectcCs| d|||¡S)Nr-)r—)rQr˜r©Zwhatr;r;r<Úsetacl÷sz IMAP4.setaclcGs |jd|žŽ\}}| ||d¡S)Nr.r¯)r.)r—r‡)rQrrrŠr‹r;r;r<Ú setannotationÿszIMAP4.setannotationcCs | d||¡\}}| ||d¡S)Nr/r²)r—r‡)rQr³ZlimitsrŠr‹r;r;r<ÚsetquotaszIMAP4.setquotacGsFd}|d|dfdkr d|}|j|||f|žŽ\}}| |||¡S)Nr0rr†)r‘r’z(%s))r—r‡)rQZ sort_criteriarÕÚsearch_criteriar‰rŠr‹r;r;r<Úsorts z IMAP4.sortNcCs¦d}ts| d¡‚|jr"| d¡‚||jkr6| d¡‚|dkrFt ¡}| |¡\}}|dkrŽ|j|j |j d|_ |j   d¡|_ d|_|  ¡n | d ¡‚| |||¡S) Nr1zSSL support missingzTLS session already establishedzTLS not supported by serverr`)Úserver_hostnamervTzCouldn't establish TLS session)ÚHAVE_SSLr=rJr>rgÚsslÚ_create_stdlib_contextr—Ú wrap_socketrwrRrxryrer‡)rQÚ ssl_contextr‰rŠr‹r;r;r<Ústarttlss$       zIMAP4.starttlscCs$d}| |||¡\}}| |||¡S)Nr2)r—r‡)rQr˜Únamesr‰rŠr‹r;r;r<Ústatus5sz IMAP4.statuscCs>|d|dfdkrd|}| d|||¡\}}| ||d¡S)Nrr†)r‘r’z(%s)r3r)r—r‡)rQr¥Úcommandr™rŠr‹r;r;r<ÚstoreAsz IMAP4.storecCs | d|¡S)Nr4)r—)rQr˜r;r;r<Ú subscribeLszIMAP4.subscribecGs*d}|j|||f|žŽ\}}| |||¡S)Nr5)r—r‡)rQZthreading_algorithmrÕrÝr‰rŠr‹r;r;r<ÚthreadTsz IMAP4.threadc Gs†| ¡}|tkr| d|¡‚|jt|krL| d||jd t|¡f¡‚d}|j||f|žŽ\}}|dkrt|}nd}| |||¡S)NzUnknown IMAP4 UID command: %sz9command %s illegal in state %s, only allowed in states %sz, r6)r+r0r5r)rrjr=rCÚjoinr—r‡)rQrèrrr‰rŠr‹r;r;r<Úuid^sz IMAP4.uidcCs | d|¡S)Nr7)r—)rQr˜r;r;r<Ú unsubscribewszIMAP4.unsubscribecGs,| ¡}|tkr|jft|<|j|f|žŽS)N)rrjrCr—)rQr‰rrr;r;r<Úxatoms  z IMAP4.xatomcCs8|dkr d}|j}||kr*|| |¡n |g||<dS)Nó)rFrœ)rQrŠr‹Úurr;r;r<Ú_append_untagged•s zIMAP4._append_untaggedcCs,|j d¡}|r(| |d |jd¡¡‚dS)NrÉr†r)rFrØr>r rW)rQZbyer;r;r<Ú _check_bye£s zIMAP4._check_byec Gsø|jt|kr4d|_| d||jd t|¡f¡‚xdD]}||jkr:|j|=q:Wd|jkrn|jsn| d¡‚| ¡}t ||j ƒ}|d|}x8|D]0}|dkr¢q”t |t ƒr¸t ||j ƒ}|d|}q”W|j}|dk rd|_t |ƒt |jƒkrö|}nd}|t dt|ƒ|j ƒ}y| |t¡Wn2tk rV} z| d| ¡‚Wdd} ~ XYnX|dkrf|SxŒx | ¡rˆ|j|rj|SqjW|rš||jƒ}y| |¡| t¡Wn2tk rä} z| d| ¡‚Wdd} ~ XYnX|shPqhW|S) Nz9command %s illegal in state %s, only allowed in states %sz, )r`rÇÚBADz READ-ONLYz#mailbox status changed to READ-ONLYó z {%s}zsocket error: %s)rCrjrDr=rìrFrHr?Ú_new_tagÚbytesrWrÃrÄÚtypeÚ_commandrr‚r–rPr>rdrErG) rQr‰rrrŠÚtagrÚargrDZ literatorÚvalr;r;r<rù©s^                   zIMAP4._commandc CsÂ|dkr| ¡y| |¡\}}Wnj|jk rX}z| d||f¡‚Wdd}~XYn6|jk rŒ}z| d||f¡‚Wdd}~XYnX|dkrž| ¡|dkrº| d|||f¡‚||fS)Nrzcommand: %s => %srôz%s command error: %s %s)róÚ_get_tagged_responser>r=)rQr‰rúrŠrrür;r;r<Ú_command_completeös"$zIMAP4._command_completecCsJ| ¡\}}|dgkr | d¡‚t|d|jƒ}| ¡}t| ¡ƒ|_dS)Nz"no CAPABILITY response from serverr†)r£r=rÄrWrÚtupleÚsplitrg)rQrŠr‹r;r;r<res    zIMAP4._get_capabilitiescCs²| ¡}| |j|¡rp|j d¡}||jkr:| d|¡‚|j d¡}t||jƒ}|j d¡}||gf|j|<núd}| t |¡sš| |j |¡rš|j d¡}|jdkrÐ| t |¡rÂ|j d¡|_ dS| d|¡‚|j d¡}t||jƒ}|j d¡}|dkrd}|r|d|}xH| |j |¡r\t|j d ¡ƒ}| |¡}| |||f¡| ¡}qW| ||¡|d kr®| t|¡r®|j d¡}t||jƒ}| ||j d¡¡|S) Nrúzunexpected tagged response: %rrørZdata2zunexpected response: %rrðrõr{)r`rÇrô)Ú _get_lineÚ_matchrcÚmoÚgrouprEr>rÄrWÚUntagged_responser^Ú ContinuationrGr\ÚintrzròÚ Response_code)rQÚresprúrŠr‹Zdat2r{rr;r;r<rdsH                  zIMAP4._get_responsec Csdx^|j|}|dk r |j|=|S| ¡y | ¡Wq|jk rZ}z‚Wdd}~XYqXqWdS)N)rErórdr>)rQrúÚresultrür;r;r<rý`s  zIMAP4._get_tagged_responsecCs>| ¡}|s| d¡‚| d¡s.| d|¡‚|dd…}|S)Nzsocket error: EOFs z#socket error: unterminated line: %réþÿÿÿ)r}r>Úendswith)rQr€r;r;r<r{s   zIMAP4._get_linecCs| |¡|_|jdk S)N)Úmatchr)rQZcreÚsr;r;r<rŽs z IMAP4._matchcCs2|jtt|jƒ|jƒ}|jd|_d|j|<|S)Nr|)rbr÷rÄrIrWrE)rQrúr;r;r<röšs  zIMAP4._new_tagcCs$| dd¡}| dd¡}d|dS)Nú\z\\ú"z\")r)rQrûr;r;r<r»¢s  z IMAP4._quotecGs| ||j|f|žŽ¡S)N)rþrù)rQr‰rrr;r;r<r—ªszIMAP4._simple_commandcCs8|dkr||fS||jkr$|dgfS|j |¡}||fS)NrÇ)rFÚpop)rQrŠr‹r‰rr;r;r<r‡¯s    zIMAP4._untagged_response)r¶r·)r¶r·)rF)N)Or8r9r:rNr=r>r?Ú IMAP4_PORTrTrKr_rMrorprsrurLrzr}r‚rOrtrŒrrœr¢r£r¤rƒr¦r§r¨rªr«r¬r­r®r±r´rµrºr¾rÀr¿rqrÌrÍrÎrˆrÑrÒrÓrÖrÙrÚrÛrÜrÞrårçrérêrërírîrïròrórùrþrerdrýrrrör»r—r‡r;r;r;r<r†s–.*                    M P  c@s6eZdZdedddfdd„Zdd„Zdefdd„ZdS) Ú IMAP4_SSLr@NcCs|dk r|dk rtdƒ‚|dk r0|dk r0tdƒ‚|dk s@|dk rVddl}| dtd¡||_||_|dkrxtj||d}||_t   |||¡dS)Nz8ssl_context and keyfile arguments are mutually exclusivez9ssl_context and certfile arguments are mutually exclusiverzEkeyfile and certfile are deprecated, use a custom ssl_context insteadrÈ)ÚcertfileÚkeyfile) Ú ValueErrorÚwarningsÚwarnÚDeprecationWarningrrrárârärrT)rQrRrSrrrärr;r;r<rTöszIMAP4_SSL.__init__cCst |¡}|jj||jdS)N)rß)rrurärãrR)rQrwr;r;r<ru s zIMAP4_SSL._create_socketcCst |||¡dS)N)rrL)rQrRrSr;r;r<rLszIMAP4_SSL.open)r8r9r:ÚIMAP4_SSL_PORTrTrurLr;r;r;r<rãsrc@s>eZdZdd„Zddd„Zdd„Zdd „Zd d „Zd d „ZdS)rcCs||_t |¡dS)N)rèrrT)rQrèr;r;r<rT&szIMAP4_stream.__init__NcCsNd|_d|_d|_d|_tj|jttjtjddd|_ |j j |_ |j j |_ dS)NT)ÚbufsizeÚstdinÚstdoutÚshellZ close_fds)rRrSrwryÚ subprocessÚPopenrèrÚPIPErŸrÚ writefilerÚreadfile)rQrRrSr;r;r<rL+s  zIMAP4_stream.opencCs |j |¡S)N)r#rz)rQr{r;r;r<rz;szIMAP4_stream.readcCs |j ¡S)N)r#r})rQr;r;r<r}@szIMAP4_stream.readlinecCs|j |¡|j ¡dS)N)r"ÚwriteÚflush)rQrr;r;r<r‚Es zIMAP4_stream.sendcCs"|j ¡|j ¡|j ¡dS)N)r#rƒr"rŸÚwait)rQr;r;r<rOKs  zIMAP4_stream.shutdown)NN) r8r9r:rTrLrzr}r‚rOr;r;r;r<rs   c@s,eZdZdd„Zdd„Zdd„Zdd„Zd S) ržcCs ||_dS)N)r¡)rQZmechinstr;r;r<rTYsz_Authenticator.__init__cCs&| | |¡¡}|dkrdS| |¡S)Nó*)r¡r rÅ)rQrÚretr;r;r<rŸ\sz_Authenticator.processcCsrd}t|tƒr| d¡}xT|rlt|ƒdkrD|dd…}|dd…}n|}d}t |¡}|r||dd…}qW|S)Nrðzutf-8é0r†)rÃrÄrÅrÚbinasciiZ b2a_base64)rQÚinpZoupÚtÚer;r;r<rÅbs      z_Authenticator.encodecCs|sdSt |¡S)Nrð)r*Z a2b_base64)rQr+r;r;r<r zsz_Authenticator.decodeN)r8r9r:rTrŸrÅr r;r;r;r<ržSsržz0 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov DecrÁcCsi|]\}}|d| ¡“qS)r|)rÅ)Ú.0Únrr;r;r<ú €sr0r|c CsØt |¡}|sdSt| d¡}| d¡}t| d¡ƒ}t| d¡ƒ}t| d¡ƒ}t| d¡ƒ}t| d¡ƒ}t| d¡ƒ} t| d ¡ƒ} | d | d } |d krª| } ||||||d d d f } t | ¡| } t | ¡S) NÚmonÚzonenÚdayÚyearÚhourÚminÚsecÚzonehÚzonemé<ó-r†) Ú InternalDater ÚMon2numrrÚcalendarZtimegmÚtimeÚ localtime)r rr1r2r3r4r5r6r7r8r9ZzoneÚttÚutcr;r;r<r‚s$  cCsDd}d}tt|ƒƒ}x*|r>t|dƒ\}}|||d…|}qW|S)NrðsABCDEFGHIJKLMNOPér|)rÚabsÚdivmod)ZnumrüZAPÚmodr;r;r<r ¥s cCs$t |¡}|sdSt| d¡ ¡ƒS)Nr;r™)ÚFlagsr rÿrr)r rr;r;r<r ²s cCst|ttfƒr"t |tj¡ ¡}nât|tƒr¸y |j }WnZt k rt j r„|d}|dkrpt   t  |¡¡d}t jt jf| }nt j }YnXt|d}t|dd…dt|ƒiŽ}nLt|tƒrÚ|jdkrÔtdƒ‚|}n*t|tƒrü|d|dfdkrü|Std ƒ‚d  t|j¡}| |¡S) Nér†)ZsecondséÚtzinfozdate_time must be awarer)rrzdate_time not of a known typez"%d-{}-%Y %H:%M:%S %z")rÃrÚfloatrZ fromtimestamprrBZ astimezonerÿZ tm_gmtoffrmr?Zdaylightr@ZmktimeZaltzonerrJrrÄÚformatÚMonthsZmonthZstrftime)ršZdtZgmtoffÚdstZdeltaZfmtr;r;r<r ½s0      Ú__main__zd:s:)r;r;z-dz-s)r@zIMAP password for %s on %s: Z localhostzJFrom: %(user)s@localhost%(lf)sSubject: IMAP4 test%(lf)s%(lf)sdata...%(lf)sÚ )r¼Zlfr¾)r§)z /tmp/xxx 1)rÓ)z /tmp/xxx 1z/tmp/yyy)r)z /tmp/yyz 2rœz /tmp/yyz 2)rº)z/tmpzyy*)rÙ)z /tmp/yyz 2)rÖ)NZSUBJECTZtest)r­)Ú1z(FLAGS INTERNALDATE RFC822))ré)rQÚFLAGSz (\Deleted))rÎr;)r¬r;)rŒr;)rƒr;)rÙr;)r)Z UIDVALIDITY)rí)r+ZALL)r)r×)rqr;cCsLt d||f¡tt|ƒ|Ž\}}t d|||f¡|dkrH|d‚|S)Nz%s %sz %s => %s %srÇr)ÚMÚ_mesgrk)ÚcmdrrrŠr‹r;r;r<Úruns rVr zPROTOCOL_VERSION = %szCAPABILITIES = %rrº)z/tmp/zyy%z .*"([^"]+)"$r†r¨rírz%sz:(FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822.TEXT)z All tests OK.z Tests failed.z8 If you would like to see debugging output, try: %s -d5 )TÚ __version__r*r„rarXrtrrÊr?r>rrrÚiorráràÚ ImportErrorÚ__all__r–rArrrfr~rjrYrrGr<r[r\r”rrr^rZr]rrrœrržrrMÚ enumerater=rr r r r8ZgetoptZgetpassÚargvZoptlistrrr=rüZstream_commandÚoptrrRZgetuserZUSERZPASSWDZ test_mesgZ test_seq1Z test_seq2rVrSrCrTrhrgrUÚmlr rrÚpathr‹ríÚprintr;r;r;r<ÚsDH          c4 9, #  )