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KO}ӽmSşذqsOy?\[,d@'73'j%kOe`1.g2"e =YIzS2|zŐƄa\U,dP;jhhhaxǶ?КZ՚.q SE+XrbOu%\GتX(H,N^~]JyEZQKceTQ]VGYqnah;y$cQahT&QPZ*iZ8UQQM.qo/T\7X"u?Mttl2Xq(IoW{R^ ux*SYJ! 4S.Jy~ BROS[V|žKNɛP(L6V^|cR7i7nZW1Fd@ Ara{詑|(T*dN]Ko?s=@ |_EvF]׍kR)eBJc" MUUbY6`~V޴dJKß&~'d3i WWWWWW
Current Directory: /usr/lib64/python3.6/__pycache__
Viewing File: /usr/lib64/python3.6/__pycache__/imaplib.cpython-36.pyc
3 \/��2@s�dZdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z m Z m Z ddlmZyddlZdZWnek r�dZYnXdd d d d d gZdZdZdZdZdgZdZdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�)Zejd�Zejd�Zejd�Zejdej�Z ejd�Z!ejd�Z"ejd�Z#ejdej�Z$dZ%dZ&Gd d�d�Z'e�r�Gd!d"�d"e'�Z(ej)d"�Gd#d �d e'�Z*Gd$d%�d%�Z+d&j,d'�Z-d(d)�e.e-d*d��D�Z/d+d �Z0d,d �Z1d-d �Z2d.d �Z3e4d/k�r�ddl5Z5ddl6Z6ye5j5ej7d*d�d0�\Z8Z9Wn0e5j:k �rrZ;zffZ8Z9WYddZ;[;XnXdZ<x@e8D]8\Z=Z;e=d1k�r�e>e;�Zne=d2k�r~e;Z<e9�s~e<fZ9�q~We9�s�d�Z9e9dZ?e6j@�ZAe6j6d4eAe?�p�d5f�ZBd6eAd7d8�ZCd9eAeBffd�d�d�d@d?ddeCffd�d�d�d�d�dNffdOffdPffdQfffZDdDffd�d�d�d@dddeCffdPffdXfffZEdYdZ�ZF�y&e<�r�e*e<�ZGne'e?�ZGeGjHdk�r�eDd*d�ZDeGjId[eGjJ�eGjId\eGjKf�xeDD]\ZLZ9eFeLe9��q�WxJeFdAd��D]<ZMejNd_eM�ZOeO�reOjPd*�ZQn eMj,�d�ZQeFd`eQf��q�Wx\eED]T\ZLZ9eFeLe9�ZReLe9fd�k�rZ�q6eRd�j,�ZSeS�sp�q6eFdTdadbeSd�dcf��q6WeTdd�Wn.eTde�e�s�eTdfej7d��YnXdS)�z�IMAP4 client. Based on RFC 2060. Public class: IMAP4 Public variable: Debug Public functions: Internaldate2tuple Int2AP ParseFlags Time2Internaldate z2.58�N)�datetime�timezone� timedelta)�DEFAULT_BUFFER_SIZETF�IMAP4� IMAP4_stream�Internaldate2tuple�Int2AP� ParseFlags�Time2Internaldates �i�� IMAP4REV1i@B�AUTH�SELECTED�NONAUTH�LOGOUT))�APPEND� AUTHENTICATE� CAPABILITY�CHECK�CLOSE�COPY�CREATE�DELETE� DELETEACL�ENABLE�EXAMINE�EXPUNGE�FETCH�GETACL� GETANNOTATION�GETQUOTA� GETQUOTAROOT�MYRIGHTS�LIST�LOGINr�LSUBZMOVE� NAMESPACE�NOOP�PARTIAL� PROXYAUTH�RENAME�SEARCH�SELECT�SETACL� SETANNOTATION�SETQUOTA�SORT�STARTTLS�STATUS�STORE� SUBSCRIBE�THREAD�UID� UNSUBSCRIBEs\+( (?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>.*))?c@s�eZdZdZGdd�de�ZGdd�de�ZGdd�de�Zdefd d �Z d d �Z d d�Z dd�Z dd�Z dd�Zdd�Zdd�Zdefdd�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@�Z$dAdB�Z%dCdD�Z&dEdF�Z'dGdH�Z(d�dKdL�Z)dMdN�Z*dOdP�Z+dQdR�Z,dSdT�Z-d�dUdV�Z.dWdX�Z/dYdZ�Z0d[d\�Z1d]d^�Z2d_d`�Z3dadb�Z4dcdd�Z5d�dgdh�Z6didj�Z7dkdl�Z8dmdn�Z9dodp�Z:d�drds�Z;dtdu�Z<dvdw�Z=dxdy�Z>dzd{�Z?d|d}�Z@d~d�ZAd�d��ZBd�d��ZCd�d��ZDd�d��ZEd�d��ZFd�d��ZGd�d��ZHd�d��ZId�d��ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZNd�d��ZOd�d�d��ZPd�d��ZQd�d��ZRd�d��ZSdqS)�ra�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 <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. Also, most IMAP servers implement a sub-set of the commands available here. c@s eZdZdS)z IMAP4.errorN)�__name__� __module__� __qualname__�r<r<�/usr/lib64/python3.6/imaplib.py�error�sr>c@s eZdZdS)z IMAP4.abortN)r9r:r;r<r<r<r=�abort�sr?c@s eZdZdS)zIMAP4.readonlyN)r9r:r;r<r<r<r=�readonly�sr@�cCs�t|_d|_d|_i|_i|_d|_d|_d|_d|_ |j �|j ||�y |j �Wn8t k r�y |j�Wntk r�YnX�YnXdS)NrrAFr)�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|_tjttj�|_tjttj�|_dS)NF�ascii) � utf8_enabled� _encoding�re�compile�_Literal�ASCII�Literal�_Untagged_status�Untagged_status)rRr<r<r=rL�szIMAP4._mode_asciicCs(d|_d|_tjt�|_tjt�|_dS)NTzutf-8)rWrXrYrZr[r]r^r_)rRr<r<r=� _mode_utf8�s zIMAP4._mode_utf8cCs�ttjdd��|_tjd|jdtj�|_d|_d|_ i|_ |j dkrf|j dt �|j d |j�|j�|_d |jkr�d |_nd |jkr�d |_n |j|j��|j�|j dkr�|j d|jf�x tD]}||jkr�q�||_dSW|jd��dS)Nii��s(?P<tag>s"\d+) (?P<type>[A-Z]+) (?P<data>.*)� r�zimaplib version %sznew IMAP4 connection, tag=%sZPREAUTHr�OKr�zCAPABILITIES: %rzserver not IMAP4 compliant)r �randomZrandint�tagprerYrZr\�tagre� _cmd_log_len� _cmd_log_idx�_cmd_logrC�_mesg� __version__� _get_responseZwelcomerGrDr>�_get_capabilities� capabilities�AllowedVersions�PROTOCOL_VERSION)rR�versionr<r<r=rN�s0        zIMAP4._connectcCs&|tkrt||j��Std|��dS)NzUnknown IMAP4 command: '%s')�Commands�getattr�lower�AttributeError)rR�attrr<r<r=� __getattr__ szIMAP4.__getattr__cCs|S)Nr<)rRr<r<r=� __enter__szIMAP4.__enter__c Gs&y |j�Wntk r YnXdS)N)�logoutrQ)rR�argsr<r<r=�__exit__s zIMAP4.__exit__cCs |js dn|j}tj||jf�S)N)rS�socketZcreate_connectionrT)rRrSr<r<r=�_create_socketszIMAP4._create_socketcCs(||_||_|j�|_|jjd�|_dS)z�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. �rbN)rSrTr~�sock�makefile�file)rRrSrTr<r<r=rM#s z IMAP4.opencCs |jj|�S)zRead 'size' bytes from remote.)r��read)rR�sizer<r<r=r�/sz IMAP4.readcCs.|jjtd�}t|�tkr*|jdt��|S)zRead line from remote.rbzgot more than %d bytes)r��readline�_MAXLINE�lenr>)rR�liner<r<r=r�4s zIMAP4.readlinecCs|jj|�dS)zSend data to remote.N)r�Zsendall)rR�datar<r<r=�send<sz IMAP4.sendcCst|jj�zXy|jjtj�Wn@tk r^}z$|jtjkrNt |dd�dkrN�WYdd}~XnXWd|jj�XdS)z Close I/O established in "open".Zwinerrorri&'N) r��closer�rPr}Z SHUT_RDWRrQ�errnoZENOTCONNrt)rR�excr<r<r=rPAs  zIMAP4.shutdowncCs|jS)zfReturn socket instance used to connect to IMAP4 server. socket = <instance>.socket() )r�)rRr<r<r=r}Qsz IMAP4.socketcCsBd}|jddg|�\}}|dr(||fS|j�\}}|j|||�S)aReturn 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. ZRECENTrcNrb���)�_untagged_response�noop)rR�name�typ�datr<r<r=�recent]s  z IMAP4.recentcCs|j|dg|j��S)z�Return data for response 'code' if received, or None. Old value for response 'code' is cleared. (code, [data]) = <instance>.response(code) N)r��upper)rR�coder<r<r=�responsenszIMAP4.responsecCsxd}|s d}|r.|d|d fd kr2d|}nd}|r@t|�}nd}tjt|�}|jrbd |d }||_|j||||�S) z�Append message to named mailbox. (typ, [data]) = <instance>.append(mailbox, flags, date_time, message) All args except `message' can be None. r�INBOXrrb�(�)z(%s)NsUTF8 (�)r�)r�r�)r �MapCRLF�sub�CRLFrWrE�_simple_command)rR�mailbox�flags� date_time�messager�rEr<r<r=�append|s    z IMAP4.appendcCsP|j�}t|�j|_|jd|�\}}|dkrB|j|djdd���d|_||fS)asAuthenticate 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; 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. rrcrbzutf-8�replacerr�)r��_Authenticator�processrEr�r>�decoderD)rRZ mechanismZ authobject�mechr�r�r<r<r=� authenticate�s zIMAP4.authenticatecCs d}|j|�\}}|j|||�S)zT(typ, [data]) = <instance>.capability() Fetch capabilities list from server.r)r�r�)rRr�r�r�r<r<r=� capability�szIMAP4.capabilitycCs |jd�S)zRCheckpoint mailbox on server. (typ, [data]) = <instance>.check() r)r�)rRr<r<r=�check�sz IMAP4.checkc Cs$z|jd�\}}Wdd|_X||fS)z�Close currently selected mailbox. Deleted messages are removed from writable mailbox. This is the recommended command before 'LOGOUT'. (typ, [data]) = <instance>.close() rNr)r�rD)rRr�r�r<r<r=r��sz IMAP4.closecCs|jd||�S)z�Copy 'message_set' messages onto end of 'new_mailbox'. (typ, [data]) = <instance>.copy(message_set, new_mailbox) r)r�)rR� message_setZ new_mailboxr<r<r=�copy�sz IMAP4.copycCs |jd|�S)zPCreate new mailbox. (typ, [data]) = <instance>.create(mailbox) r)r�)rRr�r<r<r=�create�sz IMAP4.createcCs |jd|�S)zPDelete old mailbox. (typ, [data]) = <instance>.delete(mailbox) r)r�)rRr�r<r<r=�delete�sz IMAP4.deletecCs|jd||�S)z�Delete the ACLs (remove any rights) set for who on mailbox. (typ, [data]) = <instance>.deleteacl(mailbox, who) r)r�)rRr��whor<r<r=� deleteacl�szIMAP4.deleteaclcCsHd|jkrtjd��|jd|�\}}|dkr@d|j�kr@|j�||fS)zkSend an RFC5161 enable string to the server. (typ, [data]) = <intance>.enable(capability) rzServer does not support ENABLErcz UTF8=ACCEPT)rorr>r�r�r`)rRr�r�r�r<r<r=�enable�s   z IMAP4.enablecCs d}|j|�\}}|j|||�S)z�Permanently 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. r)r�r�)rRr�r�r�r<r<r=�expunge�s z IMAP4.expungecCs$d}|j|||�\}}|j|||�S)a#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. r)r�r�)rRr�Z message_partsr�r�r�r<r<r=�fetch s z IMAP4.fetchcCs|jd|�\}}|j||d�S)zXGet the ACLs for a mailbox. (typ, [data]) = <instance>.getacl(mailbox) rZACL)r�r�)rRr�r�r�r<r<r=�getaclsz IMAP4.getaclcCs"|jd|||�\}}|j||d�S)za(typ, [data]) = <instance>.getannotation(mailbox, entry, attribute) Retrieve ANNOTATIONs.r � ANNOTATION)r�r�)rRr��entryZ attributer�r�r<r<r=� getannotation#szIMAP4.getannotationcCs|jd|�\}}|j||d�S)z�Get the quota root's resource usage and limits. Part of the IMAP4 QUOTA extension defined in rfc2087. (typ, [data]) = <instance>.getquota(root) r!�QUOTA)r�r�)rR�rootr�r�r<r<r=�getquota+szIMAP4.getquotacCs@|jd|�\}}|j||d�\}}|j||d�\}}|||gfS)z�Get the list of quota roots for the named mailbox. (typ, [[QUOTAROOT responses...], [QUOTA responses]]) = <instance>.getquotaroot(mailbox) r"r�Z QUOTAROOT)r�r�)rRr�r�r�ZquotaZ quotarootr<r<r=� getquotaroot6szIMAP4.getquotaroot�""�*cCs$d}|j|||�\}}|j|||�S)z�List mailbox names in directory matching pattern. (typ, [data]) = <instance>.list(directory='""', pattern='*') 'data' is list of LIST responses. r$)r�r�)rR� directory�patternr�r�r�r<r<r=�listAsz IMAP4.listcCs<|jd||j|��\}}|dkr.|j|d��d|_||fS)z�Identify client using plaintext password. (typ, [data]) = <instance>.login(user, password) NB: 'password' will be quoted. r%rcrbrr�)r��_quoter>rD)rR�user�passwordr�r�r<r<r=�loginMs z IMAP4.logincCs|||_|_|jd|j�S)zr Force use of CRAM-MD5 authentication. (typ, [data]) = <instance>.login_cram_md5(user, password) zCRAM-MD5)r�r�r��_CRAM_MD5_AUTH)rRr�r�r<r<r=�login_cram_md5[szIMAP4.login_cram_md5cCsBddl}t|jt�r |jjd�n|j}|jd|j||d�j�S)z1 Authobject to use with CRAM-MD5 authentication. rNzutf-8� Zmd5)�hmac� isinstancer��str�encoder�ZHMACZ hexdigest)rRZ challenger��pwdr<r<r=r�dszIMAP4._CRAM_MD5_AUTHc Csjd|_y|jd�\}}Wn(ddtj�dd�g}}YnX|j�d|jkrbd|jdfS||fS)z|Shutdown connection to server. (typ, [data]) = <instance>.logout() Returns server 'BYE' response. r�NOz%s: %sN��BYE)rDr��sys�exc_inforPrG)rRr�r�r<r<r=rzls" z IMAP4.logoutcCs$d}|j|||�\}}|j|||�S)z�List 'subscribed' mailbox names in directory matching pattern. (typ, [data, ...]) = <instance>.lsub(directory='""', pattern='*') 'data' are tuples of message part envelope and data. r&)r�r�)rRr�r�r�r�r�r<r<r=�lsub|sz IMAP4.lsubcCs|jd|�\}}|j||d�S)z�Show my ACLs for a mailbox (i.e. the rights that I have on mailbox). (typ, [data]) = <instance>.myrights(mailbox) r#)r�r�)rRr�r�r�r<r<r=�myrights�szIMAP4.myrightscCs d}|j|�\}}|j|||�S)zb Returns IMAP namespaces ala rfc2342 (typ, [data, ...]) = <instance>.namespace() r')r�r�)rRr�r�r�r<r<r=� namespace�szIMAP4.namespacecCs |jdkr|j|j�|jd�S)zFSend NOOP command. (typ, [data]) = <instance>.noop() rdr()rC�_dump_urrGr�)rRr<r<r=r��s  z IMAP4.noopcCs(d}|j|||||�\}}|j||d�S)z�Fetch 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)r)r�r�)rRZ message_numZ message_part�startZlengthr�r�r�r<r<r=�partial�sz IMAP4.partialcCsd}|jd|�S)z�Assume authentication as "user". Allows an authorised administrator to proxy into any user's mailbox. (typ, [data]) = <instance>.proxyauth(user) r*)r�)rRr�r�r<r<r=� proxyauth�s zIMAP4.proxyauthcCs|jd||�S)zkRename old mailbox name to new. (typ, [data]) = <instance>.rename(oldmailbox, newmailbox) r+)r�)rRZ oldmailboxZ newmailboxr<r<r=�rename�sz IMAP4.renamecGsTd}|r2|jrtjd��|j|d|f|��\}}n|j|f|��\}}|j|||�S)z�Search mailbox for matching messages. (typ, [data]) = <instance>.search(charset, criterion, ...) 'data' is space separated list of matching message numbers. If UTF8 is enabled, charset MUST be None. r,z'Non-None charset not valid in UTF8 mode�CHARSET)rWrr>r�r�)rR�charsetZcriteriar�r�r�r<r<r=�search�s z IMAP4.searchr�FcCs�i|_||_|rd}nd}|j||�\}}|dkr@d|_||fSd|_d|jkrz| rz|jdkrl|j|j�|jd|��||jjd d g�fS) atSelect a mailbox. Flush all untagged responses. (typ, [data]) = <instance>.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 <instance>.response('FLAGS') etc. rr-rcrrz READ-ONLYrbz%s is not writable�EXISTSN)rGrIr�rDrCr�r@�get)rRr�r@r�r�r�r<r<r=�select�s    z IMAP4.selectcCs|jd|||�S)zZSet a mailbox acl. (typ, [data]) = <instance>.setacl(mailbox, who, what) r.)r�)rRr�r�Zwhatr<r<r=�setacl�sz IMAP4.setaclcGs |jd|��\}}|j||d�S)z_(typ, [data]) = <instance>.setannotation(mailbox[, entry, attribute]+) Set ANNOTATIONs.r/r�)r/)r�r�)rRr{r�r�r<r<r=� setannotation�szIMAP4.setannotationcCs |jd||�\}}|j||d�S)ziSet the quota root's resource limits. (typ, [data]) = <instance>.setquota(root, limits) r0r�)r�r�)rRr�Zlimitsr�r�r<r<r=�setquotaszIMAP4.setquotacGsFd}|d|dfdkr d|}|j|||f|��\}}|j|||�S) z�IMAP4rev1 extension SORT command. (typ, [data]) = <instance>.sort(sort_criteria, charset, search_criteria, ...) r1rrbr�r�z(%s)r�)r�r�)r�r�)rRZ sort_criteriar��search_criteriar�r�r�r<r<r=�sorts z IMAP4.sortNcCs�d}ts|jd��|jr"|jd��||jkr6|jd��|dkrFtj�}|j|�\}}|dkr�|j|j |j d�|_ |j j d�|_ d|_|j �n |jd ��|j|||�S) Nr2zSSL support missingzTLS session already establishedzTLS not supported by serverrc)�server_hostnamerTzCouldn't establish TLS session)�HAVE_SSLr>rKr?ro�ssl�_create_stdlib_contextr�� wrap_socketr�rSr�r�rnr�)rR� ssl_contextr�r�r�r<r<r=�starttlss$       zIMAP4.starttlscCs$d}|j|||�\}}|j|||�S)zpRequest named status conditions for mailbox. (typ, [data]) = <instance>.status(mailbox, names) r3)r�r�)rRr��namesr�r�r�r<r<r=�status5sz IMAP4.statuscCs>|d|dfd krd|}|jd|||�\}}|j||d�S) z�Alters flag dispositions for messages in mailbox. (typ, [data]) = <instance>.store(message_set, command, flags) rrbr�r�z(%s)r4rr�)r�r�)r�r�)rRr��commandr�r�r�r<r<r=�storeAsz IMAP4.storecCs |jd|�S)zYSubscribe to new mailbox. (typ, [data]) = <instance>.subscribe(mailbox) r5)r�)rRr�r<r<r=� subscribeLszIMAP4.subscribecGs*d}|j|||f|��\}}|j|||�S)z�IMAPrev1 extension THREAD command. (type, [data]) = <instance>.thread(threading_algorithm, charset, search_criteria, ...) r6)r�r�)rRZthreading_algorithmr�r�r�r�r�r<r<r=�threadTsz IMAP4.threadcGs�|j�}|tkr|jd|��|jt|krL|jd||jdjt|�f��d}|j||f|��\}}|d krt|}nd}|j|||�S) z�Execute "command arg ..." with messages identified by UID, rather than message number. (typ, [data]) = <instance>.uid(command, arg1, arg2, ...) Returns response appropriate to 'command'. zUnknown IMAP4 UID command: %sz9command %s illegal in state %s, only allowed in states %sz, r7r,r1r6r)r,r1r6)r�rsr>rD�joinr�r�)rRr�r{r�r�r�r<r<r=�uid^sz IMAP4.uidcCs |jd|�S)z_Unsubscribe from old mailbox. (typ, [data]) = <instance>.unsubscribe(mailbox) r8)r�)rRr�r<r<r=� unsubscribewszIMAP4.unsubscribecGs,|j�}|tkr|jft|<|j|f|��S)aAllow 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'. )r�rsrDr�)rRr�r{r<r<r=�xatoms  z IMAP4.xatomcCsb|dkr d}|j}|jdkr<|jd|t|j|d��|f�||krT||j|�n |g||<dS)N��z#untagged_responses[%s] %s += ["%r"]rA)rGrCrkr�r�r�)rRr�r�Zurr<r<r=�_append_untagged�s zIMAP4._append_untaggedcCs,|jjd�}|r(|j|dj|jd���dS)Nr�rbr�r�)rGr�r?r�rX)rRZbyer<r<r=� _check_bye�s zIMAP4._check_byec GsB|jt|kr4d|_|jd||jdjt|�f��xdD]}||jkr:|j|=q:Wd|jkrp|j rp|jd��|j�}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 d t|�|j �}|jd k�r0|jd |�n|jd |�y|j|t�Wn2tk �r�} z|jd | ��WYdd} ~ XnX|dk�r�|Sx�x |j��r�|j|�r�|S�q�W|�r�||j�}|jd k�r�|jd t|��y|j|�|jt�Wn2tk �r.} z|jd | ��WYdd} ~ XnX|�s�P�q�W|S)Nz9command %s illegal in state %s, only allowed in states %sz, rcr��BADz READ-ONLYz#mailbox status changed to READ-ONLY� z {%s}�z> %rzsocket error: %szwrite literal size %s)rcr�r�)rDrsrEr>r�rGrIr@�_new_tag�bytesrXr�r��type�_commandr�rCrk�_logr�r�rQr?rmrFrH) rRr�r{r��tagr��argrEZ literator�valr<r<r=r�sh                     zIMAP4._commandcCs�|dkr|j�y|j|�\}}Wnj|jk rX}z|jd||f��WYdd}~Xn6|jk r�}z|jd||f��WYdd}~XnX|dkr�|j�|dkr�|jd|||f��||fS)Nrzcommand: %s => %sr�z%s command error: %s %s)r��_get_tagged_responser?r>)rRr�rr�r�rr<r<r=�_command_complete�s"$zIMAP4._command_completecCsJ|j�\}}|dgkr |jd��t|d|j�}|j�}t|j��|_dS)Nz"no CAPABILITY response from serverrbr�)r�r>r�rXr��tuple�splitro)rRr�r�r<r<r=rns    zIMAP4._get_capabilitiescCs�|j�}|j|j|�rr|jjd�}||jkr:|jd|��|jjd�}t||j�}|jjd�}||gf|j|<�nd}|jt |�s�|j|j |�r�|jjd�}|jdkr�|jt |�r�|jjd�|_ dS|jd|��|jjd�}t||j�}|jjd�}|dk�rd}|�r|d|}xb|j|j |��rxt|jjd ��}|jd k�rR|jd |�|j|�}|j|||f�|j�}�qW|j||�|dk�r�|jt|��r�|jjd�}t||j�}|j||jjd��|jdk�r�|dk�r�|jd||f�|S)Nrzunexpected tagged response: %rrr�Zdata2zunexpected response: %rr�r�r�r�zread literal size %srcr�r�rbr�z%s response: %r)rcr�r�)r�r�r�)� _get_line�_matchrg�mo�grouprFr?r�rX�Untagged_responser_� ContinuationrHr]�intrCrkr�r�� Response_code)rR�resprr�r�Zdat2r�r�r<r<r=rmsP                   zIMAP4._get_responsecCsvxp|j|}|dk r |j|=|S|j�y |j�Wq|jk rl}z|jdkrZ|j��WYdd}~XqXqWdS)Nrb)rFr�rmr?rC� print_log)rRr�resultrr<r<r=r`s   zIMAP4._get_tagged_responsecCsf|j�}|s|jd��|jd�s.|jd|��|dd�}|jdkrT|jd|�n|jd|�|S)Nzsocket error: EOFs z#socket error: unterminated line: %rr�r�z< %r���)r�r?�endswithrCrkr)rRr�r<r<r=r {s    zIMAP4._get_linecCsD|j|�|_|jdk r:|jdkr:|jd|j|jj�f�|jdk S)Nr�z matched r'%r' => %r)�matchr rCrkr��groups)rRZcre�sr<r<r=r �s z IMAP4._matchcCs2|jtt|j�|j�}|jd|_d|j|<|S)Nrb)rfrr�rJrXrF)rRrr<r<r=r��s  zIMAP4._new_tagcCs$|jdd�}|jdd�}d|dS)N�\z\\�"z\")r�)rRrr<r<r=r��s  z IMAP4._quotecGs|j||j|f|���S)N)rr)rRr�r{r<r<r=r��szIMAP4._simple_commandcCsT|dkr||fS||jkr$|dgfS|jj|�}|jdkrL|jd||f�||fS)Nr�r�zuntagged_responses[%s] => %s)rG�poprCrk)rRr�r�r�r�r<r<r=r��s    zIMAP4._untagged_responsecCsN|dkrtj�}tjdtj|��}tjjd||dd|f�tjj�dS)Nz%M:%Sz %s.%02d %s �d)�time�strftime� localtimer��stderr�write�flush)rRrZsecsZtmr<r<r=rk�s z IMAP4._mesgcCs>|j�}|sdSd}tdd�|�}|jd||j|�f�dS)Nz cSs*d|d|ddr"dj|d�p$dfS)Nz%s: "%s"rrbz" "rA)r�)�xr<r<r=�<lambda>�sz IMAP4._dump_ur.<locals>.<lambda>zuntagged responses dump:%s%s)�items�maprkr�)rR�dict�l�tr<r<r=r��s zIMAP4._dump_urcCs8|tj�f|j|j<|jd7_|j|jkr4d|_dS)Nrbr)rrjrirh)rRr�r<r<r=r�s z IMAP4._logc Csp|jdt|j��|j|j}}xH|rjy|j|j|�Wn YnX|d7}||jkr`d}|d8}q$WdS)Nzlast %d IMAP4 interactions:rbr)rkr�rjrirh)rR�i�nr<r<r=r�s zIMAP4.print_log)r�r�)r�r�)r�F)N)N)Tr9r:r;�__doc__rOr>r?r@� IMAP4_PORTrUrLr`rNrxryr|r~rMr�r�r�rPr}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rzr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrnrmrr r r�r�r�r�rkr�rrr<r<r<r=r�s�,*                    M P  c@s:eZdZdZdedddfdd�Zdd�Zdefdd �ZdS) � IMAP4_SSLa3IMAP4 client class over SSL connection Instantiate with: IMAP4_SSL([host[, port[, keyfile[, certfile[, ssl_context]]]]]) 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); ssl_context - a SSLContext object that contains your certificate chain and private key (default: None) Note: if ssl_context is provided, then parameters keyfile or certfile should not be set otherwise ValueError is raised. for more documentation see the docstring of the parent class IMAP4. rANcCs�|dk r|dk rtd��|dk r0|dk r0td��|dk s@|dk rVddl}|jdtd�||_||_|dkrxtj||d�}||_t j |||�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�DeprecationWarningr2r1r�r�r�rrU)rRrSrTr2r1r�r4r<r<r=rU�szIMAP4_SSL.__init__cCstj|�}|jj||jd�S)N)r�)rr~r�r�rS)rRr�r<r<r=r~ s zIMAP4_SSL._create_socketcCstj|||�dS)z�Setup 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)rrM)rRrSrTr<r<r=rMszIMAP4_SSL.open)r9r:r;r.�IMAP4_SSL_PORTrUr~rMr<r<r<r=r0�s r0c@sBeZdZdZdd�Zddd�Zdd�Zd d �Zd d �Zd d�Z dS)rz�IMAP4 client class over a stream Instantiate with: IMAP4_stream(command) "command" - a string that can be passed to subprocess.Popen() for more documentation see the docstring of the parent class IMAP4. cCs||_tj|�dS)N)r�rrU)rRr�r<r<r=rU&szIMAP4_stream.__init__NcCsNd|_d|_d|_d|_tj|jttjtjddd�|_ |j j |_ |j j |_ dS)z�Setup a stream connection. This connection will be used by the routines: read, readline, send, shutdown. NT)�bufsize�stdin�stdout�shellZ close_fds)rSrTr�r�� subprocess�Popenr�r�PIPEr�r9� writefiler:�readfile)rRrSrTr<r<r=rM+s  zIMAP4_stream.opencCs |jj|�S)zRead 'size' bytes from remote.)r@r�)rRr�r<r<r=r�;szIMAP4_stream.readcCs |jj�S)zRead line from remote.)r@r�)rRr<r<r=r�@szIMAP4_stream.readlinecCs|jj|�|jj�dS)zSend data to remote.N)r?r#r$)rRr�r<r<r=r�Es zIMAP4_stream.sendcCs"|jj�|jj�|jj�dS)z Close I/O established in "open".N)r@r�r?r��wait)rRr<r<r=rPKs  zIMAP4_stream.shutdown)NN) r9r:r;r.rUrMr�r�r�rPr<r<r<r=rs  c@s0eZdZdZdd�Zdd�Zdd�Zdd �Zd S) r�zcPrivate class to provide en/decoding for base64-based authentication conversation. cCs ||_dS)N)r�)rRZmechinstr<r<r=rUYsz_Authenticator.__init__cCs&|j|j|��}|dkrdS|j|�S)N�*)r�r�r�)rRr�Zretr<r<r=r�\sz_Authenticator.processcCsrd}t|t�r|jd�}xT|rlt|�dkrD|dd�}|dd�}n|}d}tj|�}|r||dd�}qW|S)Nr�zutf-8�0rbr�)r�r�r�r��binasciiZ b2a_base64)rR�inpZoupr+�er<r<r=r�bs      z_Authenticator.encodecCs|sdStj|�S)Nr�)rDZ a2b_base64)rRrEr<r<r=r�zsz_Authenticator.decodeN)r9r:r;r.rUr�r�r�r<r<r<r=r�Ss r�z0 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Decr�cCsi|]\}}|d|j��qS)rb)r�)�.0r-rr<r<r=� <dictcomp>�srHrbc Cs�tj|�}|sdSt|jd�}|jd�}t|jd��}t|jd��}t|jd��}t|jd��}t|jd��}t|jd ��} t|jd ��} | d | d } |d kr�| } ||||||dddf } tj| �| } tj| �S)z�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. N�mon�zonen�day�year�hour�min�sec�zoneh�zonem�<�-rbr�r�r�) � InternalDater�Mon2numrr�calendarZtimegmrr!)rr rIrJrKrLrMrNrOrPrQZzoneZtt�utcr<r<r=r�s$  cCsDd}d}tt|��}x*|r>t|d�\}}|||d�|}qW|S)z-Convert integer to A-P string representation.r�sABCDEFGHIJKLMNOP�rb)r�abs�divmod)ZnumrZAP�modr<r<r=r �s cCs$tj|�}|sfSt|jd�j��S)z-Convert IMAP4 flags response to python tuple.r�)�Flagsrr rr )rr r<r<r=r �s c Cs t|ttf�r"tj|tj�j�}n�t|t�r�y |j }WnZt k r�t j r�|d}|d krpt j t j|��d}t jt jf| }nt j }YnXt|d�}t|dd�dt|�i�}nNt|t�r�|jdkr�td��|}n,t|t�o�|d|d fdk�r�|Std ��d jt|j�}|j|�S)a�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. �rb)ZsecondsN��tzinfozdate_time must be awarerrzdate_time not of a known typez"%d-{}-%Y %H:%M:%S %z"r�r�)rr)r�r�floatrZ fromtimestamprrWZ astimezoner Z tm_gmtoffrvrZdaylightr!ZmktimeZaltzonerr_r3r��format�MonthsZmonthr )r�ZdtZgmtoff�dstZdeltaZfmtr<r<r=r �s0       �__main__zd:s:z-dz-srAzIMAP password for %s on %s: Z localhostzJFrom: %(user)s@localhost%(lf)sSubject: IMAP4 test%(lf)s%(lf)sdata...%(lf)s� )r�Zlfr�r�� /tmp/xxx 1r��/tmp/yyyr� /tmp/yyz 2r�r��/tmp�yy*r�r��SUBJECT�testr��1�(FLAGS INTERNALDATE RFC822)r��FLAGS� (\Deleted)r�r�r�r�r�� UIDVALIDITYr�r,�ALLr�rzcCsLtjd||f�tt|�|�\}}tjd|||f�|dkrH|d�|S)Nz%s %sz %s => %s %sr�r)�Mrkrt)�cmdr{r�r�r<r<r=�runs ruzPROTOCOL_VERSION = %szCAPABILITIES = %r�/tmp/�yy%z .*"([^"]+)"$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 )r r)rr)r)rrrr)r)r)r)rr)rr)rr)r)rr)r)r)rr)rr)rr)rr)rr)rr)r)rrrr)rr)r)rr)rrrr)r)r)rr)r)rr)rr)rr)rr)r)r)rr)r)rr)r)r)rr)rA�rf)r�rx�rfrg)r�ry�rh)rrz�rirj)r�r{�rh)r�r|�Nrkrl)r�r}�rmrn)r�r~�rmrorp)r�r�rq)r�r��r,rr)r�r��r�)r�r�)rvrwr��r,rr)r�r�r�r�)Ur.rlrDr�rerYr}r<r�rrVrrr�iorr�r�� ImportError�__all__r�rBr/r7rpr�rsrZrr\rTr\r]r�rrr_r[r^rr0r�rr�r rb� enumeraterUrr r r r9ZgetoptZgetpass�argvZoptlistr{r>rZstream_command�optrrSZgetuserZUSERZPASSWDZ test_mesgZ test_seq1Z test_seq2rursrDrkrqrortZmlrr r�pathr�r��printr<r<r<r=�<module> sF H          c4 9, #  )