grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026ž ÷ f¿Ãc&@s‘dZdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z m Z m Z ddlmZyddlZeZWnek rÔeZYnXdddd d d gZd ZdZd ZdZddfZdZi'ddfd6dfd6ddddfd6dfd6dfd6dfd6ddfd6ddfd6ddfd6ddfd6dfd6dfd 6ddfd!6ddfd"6ddfd#6ddfd$6ddfd%6ddfd&6dfd'6ddddfd6ddfd(6ddfd)6ddddfd*6dfd+6dfd,6ddfd-6dfd.6ddfd/6ddfd06ddfd16ddfd26dfd36dfd46ddfd56dfd66ddfd76dfd86dfd96ddfd:6Zejd;ƒZejd<ƒZejd=ƒZ ejd>ej!ƒZ"ejd?ƒZ#ejd@ƒZ$ejdAƒZ%ejdBej!ƒZ&GdCd„dƒZ'erÀGdDdE„dEe'ƒZ(ej)dEƒnGdFd„de'ƒZ*GdGdH„dHƒZ+dIj,dJƒZ-dKdL„e.e-dMd…ƒDƒZ/dNd„Z0dOd „Z1dPd „Z2dQd „Z3e4dRkr�ddl5Z5ddl6Z6y)e5j5ej7dMd…dSƒ\Z8Z9Wn:e5j:k rÔZ;zfff\Z8Z9WYddZ;[;XnXe<Z=xWe8D]O\Z>Z;e>dTkr e?e;ƒZn(e>dUkr1e;Z=e9 r.e=fZ9nnqâWe9 rHdVfZ9ne9dZ@e6jAƒZBe6j6dWeBe@psdXfƒZCdYieBdZ6d[d\6ZDd]eBeCffd^d_ffd`d_daffddbffdcdbe<e<eDffdddedfffdgdbffdhe<didjffdkdldmffdndldodpffdqffdrffdsffdtfffZEdgffdudvffdwd.dxffdudyffdce<e<e<eDffdsffdzfffZFd{d|„ZGy’e=rÙe*e=ƒZHn e'e@ƒZHeHjIdkreEdMd…ZEneHjJd}eHjKƒeHjJd~eHjLfƒx!eED]\ZMZ9eGeMe9ƒq9WxheGdddd€fƒD]QZNejOd�eNƒZPePrœePjQdMƒZRneNj,ƒdM ZReGd‚eRfƒqlWx„eFD]|\ZMZ9eGeMe9ƒZSeMe9fdwd.dxffkrqÈneSdM j,ƒZTeT r%qÈneGdwd dƒeTdM d„fƒqÈWeUd…ƒWn4eUd†ƒe r‚eUd‡ej7dƒn‚YnXndS(ˆuöIMAP4 client. Based on RFC 2060. Public class: IMAP4 Public variable: Debug Public functions: Internaldate2tuple Int2AP ParseFlags Time2Internaldate u2.58iN(udatetimeutimezoneu timedelta(uDEFAULT_BUFFER_SIZEuIMAP4u IMAP4_streamuInternaldate2tupleuInt2APu ParseFlagsuTime2Internaldates i�iáu IMAP4REV1i'uAUTHuSELECTEDuAPPENDuNONAUTHu AUTHENTICATEuLOGOUTu CAPABILITYuCHECKuCLOSEuCOPYuCREATEuDELETEu DELETEACLuEXAMINEuEXPUNGEuFETCHuGETACLu GETANNOTATIONuGETQUOTAu GETQUOTAROOTuMYRIGHTSuLISTuLOGINuLSUBu NAMESPACEuNOOPuPARTIALu PROXYAUTHuRENAMEuSEARCHuSELECTuSETACLu SETANNOTATIONuSETQUOTAuSORTuSTARTTLSuSTATUSuSTOREu SUBSCRIBEuTHREADuUIDu UNSUBSCRIBEs\+( (?P.*))?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.*))?cBs•|EeZdZdZGdd„deƒZGdd„deƒZGdd„deƒZded d „Z d d „Z d d„Z dd„Z dedd„Z dd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd „Zd!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„Zd+d,„Zd-d.„Zd/d0„Zd1d2„Zd3d4„Zd5d6„Zd7d8„Z d9d:„Z!d;d<„Z"d=d>„Z#d?d@dAdB„Z$dCdD„Z%dEdF„Z&dGdH„Z'dIdJ„Z(d?d@dKdL„Z)dMdN„Z*dOdP„Z+dQdR„Z,dSdT„Z-dUdV„Z.dWdX„Z/dYdZ„Z0d[d‘d\d]„Z2d^d_„Z3d`da„Z4dbdc„Z5ddde„Z6d�dfdg„Z8dhdi„Z9djdk„Z:dldm„Z;dndo„Z<dpdq„Z=drds„Z>dtdu„Z?dvdw„Z@dxdy„ZAdzd{„ZBd|d}„ZCd~d„ZDd€d�„ZEd‚dƒ„ZFd„d…„ZGd†d‡„ZHdˆd‰„ZIdŠd‹„ZJdŒd�„ZKdŽd�„ZLd�S(’uIMAP4uëIMAP4 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 .error(""). IMAP4 server errors raise .abort(""), which is a sub-class of 'error'. Mailbox status changes from READ-WRITE to READ-ONLY raise the exception class .readonly(""), 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. Also, most IMAP servers implement a sub-set of the commands available here. cBs|EeZdZdS(u IMAP4.errorN(u__name__u __module__u __qualname__(u __locals__((u,/opt/alt/python33/lib64/python3.3/imaplib.pyuerror¤suerrorcBs|EeZdZdS(u IMAP4.abortN(u__name__u __module__u __qualname__(u __locals__((u,/opt/alt/python33/lib64/python3.3/imaplib.pyuabort¥suabortcBs|EeZdZdS(uIMAP4.readonlyN(u__name__u __module__u __qualname__(u __locals__((u,/opt/alt/python33/lib64/python3.3/imaplib.pyureadonly¦sureadonlyucCs±t|_d|_d|_i|_i|_d|_d|_ d|_ d|_ |j ||ƒy|j ƒWn;tk r¬y|jƒWntjk r¤YnX‚YnXdS(NuLOGOUTuiF(uDebugudebugustateuNoneuliteralutagged_commandsuuntagged_responsesucontinuation_responseuFalseu is_readonlyutagnumu_tls_establisheduopenu_connectu Exceptionushutdownusocketuerror(uselfuhostuport((u,/opt/alt/python33/lib64/python3.3/imaplib.pyu__init__¨s$          uIMAP4.__init__cCsâttjddƒƒ|_tjd|jdtjƒ|_|jƒ|_ d|j krhd|_ n-d|j krƒd|_ n|j |j ƒ‚|j ƒx-tD]%}||jkrÁq¦n||_dSW|j d ƒ‚dS( Niiÿÿs(?Ps"\d+) (?P[A-Z]+) (?P.*)uPREAUTHuAUTHuOKuNONAUTHuserver not IMAP4 compliant(uInt2APurandomurandintutagpreureucompileuASCIIutagreu _get_responseuwelcomeuuntagged_responsesustateuerroru_get_capabilitiesuAllowedVersionsu capabilitiesuPROTOCOL_VERSION(uselfuversion((u,/opt/alt/python33/lib64/python3.3/imaplib.pyu_connectÁs       uIMAP4._connectcCs3|tkrt||jƒƒStd|ƒ‚dS(NuUnknown IMAP4 command: '%s'(uCommandsugetattruloweruAttributeError(uselfuattr((u,/opt/alt/python33/lib64/python3.3/imaplib.pyu __getattr__ës uIMAP4.__getattr__cCstj|j|jfƒS(N(usocketucreate_connectionuhostuport(uself((u,/opt/alt/python33/lib64/python3.3/imaplib.pyu_create_socketösuIMAP4._create_socketcCs:||_||_|jƒ|_|jjdƒ|_dS(uÑSetup connection to remote server on "host:port" (default: localhost:standard IMAP4 port). This connection will be used by the routines: read, readline, send, shutdown. urbN(uhostuportu_create_socketusockumakefileufile(uselfuhostuport((u,/opt/alt/python33/lib64/python3.3/imaplib.pyuopenùs  u IMAP4.opencCs|jj|ƒS(uRead 'size' bytes from remote.(ufileuread(uselfusize((u,/opt/alt/python33/lib64/python3.3/imaplib.pyureadsu IMAP4.readcCsB|jjtdƒ}t|ƒtkr>|jdtƒ‚n|S(uRead line from remote.iugot more than %d bytes(ufileureadlineu_MAXLINEulenuerror(uselfuline((u,/opt/alt/python33/lib64/python3.3/imaplib.pyureadline suIMAP4.readlinecCs|jj|ƒdS(uSend data to remote.N(usockusendall(uselfudata((u,/opt/alt/python33/lib64/python3.3/imaplib.pyusendsu IMAP4.sendcCs€|jjƒz^y|jjtjƒWn@tjk ri}z|jtjkrW‚nWYdd}~XnXWd|jjƒXdS(u Close I/O established in "open".N( ufileucloseusockushutdownusocketu SHUT_RDWRuerroruerrnouENOTCONN(uselfue((u,/opt/alt/python33/lib64/python3.3/imaplib.pyushutdowns uIMAP4.shutdowncCs|jS(ufReturn socket instance used to connect to IMAP4 server. socket = .socket() (usock(uself((u,/opt/alt/python33/lib64/python3.3/imaplib.pyusocket$su IMAP4.socketcCs]d}|jddg|ƒ\}}|dr8||fS|jƒ\}}|j|||ƒS(uReturn most recent 'RECENT' responses if any exist, else prompt server for an update using the 'NOOP' command. (typ, [data]) = .recent() 'data' is None if no new messages, else list of RECENT responses, most recent last. uRECENTuOKiNiÿÿÿÿ(u_untagged_responseuNoneunoop(uselfunameutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyurecent0s   u IMAP4.recentcCs|j|dg|jƒƒS(u¥Return data for response 'code' if received, or None. Old value for response 'code' is cleared. (code, [data]) = .response(code) N(u_untagged_responseuNoneuupper(uselfucode((u,/opt/alt/python33/lib64/python3.3/imaplib.pyuresponseAsuIMAP4.responsecCs‘d}|sd}n|rE|d|dfd krKd|}qKnd }|r`t|ƒ}nd }tjt|ƒ|_|j||||ƒS( u°Append message to named mailbox. (typ, [data]) = .append(mailbox, flags, date_time, message) All args except `message' can be None. uAPPENDuINBOXiiu(u)u(%s)iÿÿÿÿ(u(u)N(uNoneuTime2InternaldateuMapCRLFusubuCRLFuliteralu_simple_command(uselfumailboxuflagsu date_timeumessageuname((u,/opt/alt/python33/lib64/python3.3/imaplib.pyuappendOs u IMAP4.appendcCsk|jƒ}t|ƒj|_|jd|ƒ\}}|dkrX|j|dƒ‚nd|_||fS(usAuthenticate command - requires response processing. 'mechanism' specifies which authentication mechanism is to be used - it must appear in .capabilities in the form AUTH=. 'authobject' must be a callable object: data = authobject(response) It will be called to process server continuation responses; the response argument it is passed will be a bytes. It should return bytes data that will be base64 encoded and sent to the server. It should return None if the client abort response '*' should be sent instead. u AUTHENTICATEuOKiuAUTHiÿÿÿÿ(uupperu_Authenticatoruprocessuliteralu_simple_commanduerrorustate(uselfu mechanismu authobjectumechutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyu authenticatefs   uIMAP4.authenticatecCs.d}|j|ƒ\}}|j|||ƒS(uT(typ, [data]) = .capability() Fetch capabilities list from server.u CAPABILITY(u_simple_commandu_untagged_response(uselfunameutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyu capabilityƒsuIMAP4.capabilitycCs |jdƒS(uRCheckpoint mailbox on server. (typ, [data]) = .check() uCHECK(u_simple_command(uself((u,/opt/alt/python33/lib64/python3.3/imaplib.pyucheckŒsu IMAP4.checkc Cs0z|jdƒ\}}Wdd|_X||fS(uÌClose currently selected mailbox. Deleted messages are removed from writable mailbox. This is the recommended command before 'LOGOUT'. (typ, [data]) = .close() uCLOSENuAUTH(u_simple_commandustate(uselfutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyuclose”s u IMAP4.closecCs|jd||ƒS(u‚Copy 'message_set' messages onto end of 'new_mailbox'. (typ, [data]) = .copy(message_set, new_mailbox) uCOPY(u_simple_command(uselfu message_setu new_mailbox((u,/opt/alt/python33/lib64/python3.3/imaplib.pyucopy£su IMAP4.copycCs|jd|ƒS(uPCreate new mailbox. (typ, [data]) = .create(mailbox) uCREATE(u_simple_command(uselfumailbox((u,/opt/alt/python33/lib64/python3.3/imaplib.pyucreate«su IMAP4.createcCs|jd|ƒS(uPDelete old mailbox. (typ, [data]) = .delete(mailbox) uDELETE(u_simple_command(uselfumailbox((u,/opt/alt/python33/lib64/python3.3/imaplib.pyudelete³su IMAP4.deletecCs|jd||ƒS(u€Delete the ACLs (remove any rights) set for who on mailbox. (typ, [data]) = .deleteacl(mailbox, who) u DELETEACL(u_simple_command(uselfumailboxuwho((u,/opt/alt/python33/lib64/python3.3/imaplib.pyu deleteaclºsuIMAP4.deleteaclcCs.d}|j|ƒ\}}|j|||ƒS(u÷Permanently remove deleted items from selected mailbox. Generates 'EXPUNGE' response for each deleted message. (typ, [data]) = .expunge() 'data' is list of 'EXPUNGE'd message numbers in order received. uEXPUNGE(u_simple_commandu_untagged_response(uselfunameutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyuexpungeÁs u IMAP4.expungecCs4d}|j|||ƒ\}}|j|||ƒS(u#Fetch (parts of) messages. (typ, [data, ...]) = .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. uFETCH(u_simple_commandu_untagged_response(uselfu message_setu message_partsunameutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyufetchÏs u IMAP4.fetchcCs+|jd|ƒ\}}|j||dƒS(uXGet the ACLs for a mailbox. (typ, [data]) = .getacl(mailbox) uGETACLuACL(u_simple_commandu_untagged_response(uselfumailboxutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyugetaclÞsu IMAP4.getaclcCs1|jd|||ƒ\}}|j||dƒS(ua(typ, [data]) = .getannotation(mailbox, entry, attribute) Retrieve ANNOTATIONs.u GETANNOTATIONu ANNOTATION(u_simple_commandu_untagged_response(uselfumailboxuentryu attributeutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyu getannotationçsuIMAP4.getannotationcCs+|jd|ƒ\}}|j||dƒS(uªGet the quota root's resource usage and limits. Part of the IMAP4 QUOTA extension defined in rfc2087. (typ, [data]) = .getquota(root) uGETQUOTAuQUOTA(u_simple_commandu_untagged_response(uselfurootutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyugetquotaïsuIMAP4.getquotacCs^|jd|ƒ\}}|j||dƒ\}}|j||dƒ\}}|||gfS(uœGet the list of quota roots for the named mailbox. (typ, [[QUOTAROOT responses...], [QUOTA responses]]) = .getquotaroot(mailbox) u GETQUOTAROOTuQUOTAu QUOTAROOT(u_simple_commandu_untagged_response(uselfumailboxutypudatuquotau quotaroot((u,/opt/alt/python33/lib64/python3.3/imaplib.pyu getquotarootúsuIMAP4.getquotarootu""u*cCs4d}|j|||ƒ\}}|j|||ƒS(u«List mailbox names in directory matching pattern. (typ, [data]) = .list(directory='""', pattern='*') 'data' is list of LIST responses. uLIST(u_simple_commandu_untagged_response(uselfu directoryupatternunameutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyulistsu IMAP4.listcCsY|jd||j|ƒƒ\}}|dkrF|j|dƒ‚nd|_||fS(u”Identify client using plaintext password. (typ, [data]) = .login(user, password) NB: 'password' will be quoted. uLOGINuOKiuAUTHiÿÿÿÿ(u_simple_commandu_quoteuerrorustate(uselfuuserupasswordutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyulogins $  u IMAP4.logincCs&|||_|_|jd|jƒS(ur Force use of CRAM-MD5 authentication. (typ, [data]) = .login_cram_md5(user, password) uCRAM-MD5(uuserupasswordu authenticateu_CRAM_MD5_AUTH(uselfuuserupassword((u,/opt/alt/python33/lib64/python3.3/imaplib.pyulogin_cram_md5suIMAP4.login_cram_md5cCsZddl}t|jtƒr0|jjdƒn|j}|jd|j||ƒjƒS(u1 Authobject to use with CRAM-MD5 authentication. iNuASCIIu (uhmacu isinstanceupasswordustruencodeuuseruHMACu hexdigest(uselfu challengeuhmacupwd((u,/opt/alt/python33/lib64/python3.3/imaplib.pyu_CRAM_MD5_AUTH(s $ uIMAP4._CRAM_MD5_AUTHc Cs…d|_y|jdƒ\}}Wn,ddtjƒdd…g}}YnX|jƒd|jkr{d|jdfS||fS(u|Shutdown connection to server. (typ, [data]) = .logout() Returns server 'BYE' response. uLOGOUTuNOu%s: %sNiuBYE(ustateu_simple_commandusysuexc_infoushutdownuuntagged_responses(uselfutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyulogout0s ) u IMAP4.logoutcCs4d}|j|||ƒ\}}|j|||ƒS(uÐList 'subscribed' mailbox names in directory matching pattern. (typ, [data, ...]) = .lsub(directory='""', pattern='*') 'data' are tuples of message part envelope and data. uLSUB(u_simple_commandu_untagged_response(uselfu directoryupatternunameutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyulsub@su IMAP4.lsubcCs+|jd|ƒ\}}|j||dƒS(uƒShow my ACLs for a mailbox (i.e. the rights that I have on mailbox). (typ, [data]) = .myrights(mailbox) uMYRIGHTS(u_simple_commandu_untagged_response(uselfumailboxutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyumyrightsKsuIMAP4.myrightscCs.d}|j|ƒ\}}|j|||ƒS(ub Returns IMAP namespaces ala rfc2342 (typ, [data, ...]) = .namespace() u NAMESPACE(u_simple_commandu_untagged_response(uselfunameutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyu namespaceSsuIMAP4.namespacecCs |jdƒS(uFSend NOOP command. (typ, [data]) = .noop() uNOOP(u_simple_command(uself((u,/opt/alt/python33/lib64/python3.3/imaplib.pyunoop]su IMAP4.noopcCs:d}|j|||||ƒ\}}|j||dƒS(uÂFetch truncated part of a message. (typ, [data, ...]) = .partial(message_num, message_part, start, length) 'data' is tuple of message part envelope and data. uPARTIALuFETCH(u_simple_commandu_untagged_response(uselfu message_numu message_partustartulengthunameutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyupartialhs!u IMAP4.partialcCsd}|jd|ƒS(u³Assume authentication as "user". Allows an authorised administrator to proxy into any user's mailbox. (typ, [data]) = .proxyauth(user) u PROXYAUTH(u_simple_command(uselfuuseruname((u,/opt/alt/python33/lib64/python3.3/imaplib.pyu proxyauthts uIMAP4.proxyauthcCs|jd||ƒS(ukRename old mailbox name to new. (typ, [data]) = .rename(oldmailbox, newmailbox) uRENAME(u_simple_command(uselfu oldmailboxu newmailbox((u,/opt/alt/python33/lib64/python3.3/imaplib.pyurename�su IMAP4.renamecGsXd}|r-|j|d||Œ\}}n|j||Œ\}}|j|||ƒS(u·Search mailbox for matching messages. (typ, [data]) = .search(charset, criterion, ...) 'data' is space separated list of matching message numbers. uSEARCHuCHARSET(u_simple_commandu_untagged_response(uselfucharsetucriteriaunameutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyusearch‰s !u IMAP4.searchuINBOXcCs¯i|_||_|r!d}nd}|j||ƒ\}}|dkr^d|_||fSd|_d|jkr“| r“|jd|ƒ‚n||jjdd gƒfS( utSelect a mailbox. Flush all untagged responses. (typ, [data]) = .select(mailbox='INBOX', readonly=False) 'data' is count of messages in mailbox ('EXISTS' response). Mandated responses are ('FLAGS', 'EXISTS', 'RECENT', 'UIDVALIDITY'), so other responses should be obtained via .response('FLAGS') etc. uEXAMINEuSELECTuOKuAUTHuSELECTEDu READ-ONLYu%s is not writableuEXISTSN(uuntagged_responsesu is_readonlyu_simple_commandustateureadonlyugetuNone(uselfumailboxureadonlyunameutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyuselect˜s       u IMAP4.selectcCs|jd|||ƒS(uZSet a mailbox acl. (typ, [data]) = .setacl(mailbox, who, what) uSETACL(u_simple_command(uselfumailboxuwhouwhat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyusetacl¸su IMAP4.setaclcGs+|jd|Œ\}}|j||dƒS(u_(typ, [data]) = .setannotation(mailbox[, entry, attribute]+) Set ANNOTATIONs.u SETANNOTATIONu ANNOTATION(u_simple_commandu_untagged_response(uselfuargsutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyu setannotationÀsuIMAP4.setannotationcCs.|jd||ƒ\}}|j||dƒS(uiSet the quota root's resource limits. (typ, [data]) = .setquota(root, limits) uSETQUOTAuQUOTA(u_simple_commandu_untagged_response(uselfurootulimitsutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyusetquotaÈsuIMAP4.setquotacGs^d}|d|dfdkr-d|}n|j||||Œ\}}|j|||ƒS( u�IMAP4rev1 extension SORT command. (typ, [data]) = .sort(sort_criteria, charset, search_criteria, ...) uSORTiiu(u)u(%s)iÿÿÿÿ(u(u)(u_simple_commandu_untagged_response(uselfu sort_criteriaucharsetusearch_criteriaunameutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyusortÑs  u IMAP4.sortcCsd}ts|jdƒ‚n|jr9|jdƒ‚n||jkrZ|jdƒ‚n|dkr�tjtjƒ}|j tj O_ n|j |ƒ\}}|dkrî|j |j ƒ|_ |j jdƒ|_d|_|jƒn|jdƒ‚|j|||ƒS( NuSTARTTLSuSSL support missinguTLS session already establisheduTLS not supported by serveruOKurbuCouldn't establish TLS sessionT(uHAVE_SSLuerroru_tls_establisheduabortu capabilitiesuNoneusslu SSLContextuPROTOCOL_SSLv23uoptionsu OP_NO_SSLv2u_simple_commandu wrap_socketusockumakefileufileuTrueu_get_capabilitiesu_untagged_response(uselfu ssl_contextunameutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyustarttlsßs$     uIMAP4.starttlscCs4d}|j|||ƒ\}}|j|||ƒS(upRequest named status conditions for mailbox. (typ, [data]) = .status(mailbox, names) uSTATUS(u_simple_commandu_untagged_response(uselfumailboxunamesunameutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyustatus÷su IMAP4.statuscCsX|d|dfd kr'd|}n|jd|||ƒ\}}|j||dƒS( u�Alters flag dispositions for messages in mailbox. (typ, [data]) = .store(message_set, command, flags) iiu(u)u(%s)uSTOREuFETCHiÿÿÿÿ(u(u)(u_simple_commandu_untagged_response(uselfu message_setucommanduflagsutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyustores u IMAP4.storecCs|jd|ƒS(uYSubscribe to new mailbox. (typ, [data]) = .subscribe(mailbox) u SUBSCRIBE(u_simple_command(uselfumailbox((u,/opt/alt/python33/lib64/python3.3/imaplib.pyu subscribesuIMAP4.subscribecGs7d}|j||||Œ\}}|j|||ƒS(u‹IMAPrev1 extension THREAD command. (type, [data]) = .thread(threading_algorithm, charset, search_criteria, ...) uTHREAD(u_simple_commandu_untagged_response(uselfuthreading_algorithmucharsetusearch_criteriaunameutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyuthreadsu IMAP4.threadcGs¿|jƒ}|tkr.|jd|ƒ‚n|jt|krp|jd||jdjt|ƒfƒ‚nd}|j|||Œ\}}|d kr¦|}nd}|j|||ƒS( uåExecute "command arg ..." with messages identified by UID, rather than message number. (typ, [data]) = .uid(command, arg1, arg2, ...) Returns response appropriate to 'command'. uUnknown IMAP4 UID command: %su9command %s illegal in state %s, only allowed in states %su, uUIDuSEARCHuSORTuTHREADuFETCH(uSEARCHuSORTuTHREAD(uupperuCommandsuerrorustateujoinu_simple_commandu_untagged_response(uselfucommanduargsunameutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyuuid s      u IMAP4.uidcCs|jd|ƒS(u_Unsubscribe from old mailbox. (typ, [data]) = .unsubscribe(mailbox) u UNSUBSCRIBE(u_simple_command(uselfumailbox((u,/opt/alt/python33/lib64/python3.3/imaplib.pyu unsubscribe9suIMAP4.unsubscribecGs;|jƒ}|tkr+|jft|.xatom(name, arg, ...) Returns response appropriate to extension command `name'. (uupperuCommandsustateu_simple_command(uselfunameuargs((u,/opt/alt/python33/lib64/python3.3/imaplib.pyuxatomAs  u IMAP4.xatomcCsO|dkrd}n|j}||kr>||j|ƒn |g|||jjdƒ}|r:|j|djddƒƒ‚ndS(NuBYEiuasciiureplaceiÿÿÿÿ(uuntagged_responsesugetuabortudecode(uselfubye((u,/opt/alt/python33/lib64/python3.3/imaplib.pyu _check_byeesuIMAP4._check_byec Gs¡|jt|krKd|_|jd||jdjt|ƒfƒ‚nx*d D]"}||jkrR|j|=qRqRWd|jkr£|j r£|jdƒ‚n|j ƒ}t |dƒ}|d |}xO|D]G}|dkrëqÓnt |t ƒr t |dƒ}n|d |}qÓW|j}|dk r†d|_t |ƒt |jƒkr`|}q†d}|t d t|ƒdƒ}ny|j|tƒWnAtjtfk rÞ} z|jd | ƒ‚WYdd} ~ XnX|dkrï|Sx«x!|jƒr|j|rõ|SqõW|r.||jƒ}ny|j|ƒ|jtƒWnAtjtfk r�} z|jd | ƒ‚WYdd} ~ XnX|sòPqòqò|S( Nu9command %s illegal in state %s, only allowed in states %su, uOKuNOuBADu READ-ONLYu#mailbox status changed to READ-ONLYuASCIIs u {%s}usocket error: %s(uOKuNOuBAD(ustateuCommandsuNoneuliteraluerrorujoinuuntagged_responsesu is_readonlyureadonlyu_new_tagubytesu isinstanceustrutypeu_commandulenusenduCRLFusocketuOSErroruabortu _get_responseutagged_commandsucontinuation_response( uselfunameuargsutyputagudatauarguliteralu literatoruval((u,/opt/alt/python33/lib64/python3.3/imaplib.pyu_commandks^             &   &uIMAP4._commandcCs|dkr|jƒny|j|ƒ\}}Wn�|jk ru}z|jd||fƒ‚WYdd}~XnA|jk rµ}z|jd||fƒ‚WYdd}~XnX|dkrÏ|jƒn|dkrú|jd|||fƒ‚n||fS(NuLOGOUTucommand: %s => %suBADu%s command error: %s %s(u _check_byeu_get_tagged_responseuabortuerror(uselfunameutagutypudatauval((u,/opt/alt/python33/lib64/python3.3/imaplib.pyu_command_complete¸s  +,   uIMAP4._command_completecCsk|jƒ\}}|dgkr3|jdƒ‚nt|ddƒ}|jƒ}t|jƒƒ|_dS(Nu"no CAPABILITY response from serveriuASCIIiÿÿÿÿ(u capabilityuNoneuerrorustruupperutupleusplitu capabilities(uselfutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyu_get_capabilitiesÉs  uIMAP4._get_capabilitiescCsi|jƒ}|j|j|ƒr¤|jjdƒ}||jkrX|jd|ƒ‚n|jjdƒ}t|dƒ}|jjdƒ}||gf|j|=s u ic Cs7tj|ƒ}|sd St|jdƒ}|jdƒ}t|jdƒƒ}t|jdƒƒ}t|jdƒƒ}t|jdƒƒ}t|jdƒƒ}t|jdƒƒ} t|jd ƒƒ} | d | d } |d krö| } n||||||dddf } tj| ƒ| } tj | ƒS(u¨Parse an IMAP4 INTERNALDATE string. Return corresponding local time. The return value is a time.struct_time tuple or None if the string has wrong format. umonuzonenudayuyearuhouruminusecuzonehuzonemi<s-iNiÿÿÿÿiÿÿÿÿiÿÿÿÿ( u InternalDateumatchuNoneuMon2numugroupuintucalendarutimegmutimeu localtime(urespumoumonuzonenudayuyearuhouruminusecuzonehuzonemuzoneuttuutc((u,/opt/alt/python33/lib64/python3.3/imaplib.pyuInternaldate2tuple?s$  !cCs\d}d}tt|ƒƒ}x7|rWt|dƒ\}}|||d…|}q!W|S(u-Convert integer to A-P string representation.ssABCDEFGHIJKLMNOPii(uintuabsudivmod(unumuvaluAPumod((u,/opt/alt/python33/lib64/python3.3/imaplib.pyuInt2APbs cCs2tj|ƒ}|sfSt|jdƒjƒƒS(u-Convert IMAP4 flags response to python tuple.uflags(uFlagsumatchutupleugroupusplit(urespumo((u,/opt/alt/python33/lib64/python3.3/imaplib.pyu ParseFlagsoscCsŒt|ttfƒr3tj|tjƒjƒ}n6t|tƒrúy |j }Wntt k rÅt j r·|d}|d kr�t j t j|ƒƒd}nt jt jf| }n t j }YnXtd|ƒ}tdt|ƒ|dd…Œ}not|tƒr0|jdkr'tdƒ‚n|}n9t|tƒr]|d|d fdkr]|Std ƒ‚d jt|jƒ}|j|ƒS(uèConvert date_time to IMAP4 INTERNALDATE representation. Return string in form: '"DD-Mmm-YYYY HH:MM:SS +HHMM"'. The date_time argument can be a number (int or float) representing seconds since epoch (as returned by time.time()), a 9-tuple representing local time, an instance of time.struct_time (as returned by time.localtime()), an aware datetime instance or a double-quoted string. In the last case, it is assumed to already be in the correct format. iiusecondsutzinfoNiudate_time must be awareiu"udate_time not of a known typeu"%d-{}-%Y %H:%M:%S %z"iÿÿÿÿiÿÿÿÿ(u"u"(u isinstanceuintufloatudatetimeu fromtimestamputimezoneuutcu astimezoneutupleu tm_gmtoffuAttributeErrorutimeudaylightu localtimeumktimeualtzoneu timedeltautzinfouNoneu ValueErrorustruformatuMonthsumonthustrftime(u date_timeudtugmtoffudstudeltaufmt((u,/opt/alt/python33/lib64/python3.3/imaplib.pyuTime2Internaldatezs0       % ) u__main__ud:s:u-du-suuIMAP password for %s on %s: u localhostuJFrom: %(user)s@localhost%(lf)sSubject: IMAP4 test%(lf)s%(lf)sdata...%(lf)suuseru ulfuloginucreateu /tmp/xxx 1urenameu/tmp/yyyu /tmp/yyz 2uappendulistu/tmpuyy*uselectusearchuSUBJECTutestufetchu1u(FLAGS INTERNALDATE RFC822)ustoreuFLAGSu (\Deleted)u namespaceuexpungeurecentucloseuresponseu UIDVALIDITYuuiduALLuEXISTSulogoutcCsitjd||fƒtt|ƒ|Œ\}}tjd|||fƒ|dkre|d‚n|S(Nu%s %su %s => %s %suNOi(uMu_mesgugetattr(ucmduargsutypudat((u,/opt/alt/python33/lib64/python3.3/imaplib.pyurunÛs  urunuPROTOCOL_VERSION = %suCAPABILITIES = %ru/tmp/uyy%u .*"([^"]+)"$udeleteu%su:(FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822.TEXT)u All tests OK.u Tests failed.u8 If you would like to see debugging output, try: %s -d5 (Vu__doc__u __version__ubinasciiuerrnourandomureusocketu subprocessusysutimeucalendarudatetimeutimezoneu timedeltauiouDEFAULT_BUFFER_SIZEussluTrueuHAVE_SSLu ImportErroruFalseu__all__uCRLFuDebugu IMAP4_PORTuIMAP4_SSL_PORTuAllowedVersionsu_MAXLINEuCommandsucompileu ContinuationuFlagsu InternalDateuASCIIuLiteraluMapCRLFu Response_codeuUntagged_responseuUntagged_statusuIMAP4u IMAP4_SSLuappendu IMAP4_streamu_AuthenticatorusplituMonthsu enumerateuMon2numuInternaldate2tupleuInt2APu ParseFlagsuTime2Internaldateu__name__ugetoptugetpassuargvuoptlistuargsuerroruvaluNoneustream_commanduoptuintuhostugetuseruUSERuPASSWDu test_mesgu test_seq1u test_seq2urunuMustateu_mesguPROTOCOL_VERSIONu capabilitiesucmdumlumatchumougroupupathudatuuiduprint(((u,/opt/alt/python33/lib64/python3.3/imaplib.pyu s8 l                                         ÿÿÿÿ1/9,# # ) )%