Your IP : 3.12.165.68
a
R�fx� � + @ s� d Z dZddlZddlZddlZddlZddlZddlZddlZddl Z ddl
Z
ddlmZmZm
Z
ddlmZ zddlZdZW n ey� dZY n0 g d�Zd ZdZd
ZdZdZd
Zddddddddddddddddddddddddddddddddddddddddddd�*Ze�d�Ze�d�Ze�d�Ze�dej�Z e�d�Z!e�d�Z"e�d�Z#e�dej�Z$dZ%dZ&G dd� d�Z'e�r�G dd� de'�Z(e�)d� G d d!� d!e'�Z*G d"d#� d#�Z+d$�,d%�Z-d&d'� e.e-d(d� �D �Z/d)d*� Z0d+d,� Z1d-d.� Z2d/d0� Z3e4d1k�r�ddl5Z5ddl6Z6ze5�5ej7d(d� d2�\Z8Z9W n0 e5j:�yj Z; zd3\Z8Z9W Y dZ;[;n
dZ;[;0 0 dZ<e8D ]8\Z=Z;e=d4k�r�e>e;�Zne=d5k�rte;Z<e9�ste<fZ9�qte9�s�d6Z9e9d Z?e6�@� ZAe6�6d7eAe?�p�d8f �ZBd9eAd:d;� ZCd<eAeBffd=d>d?d@dAddeCffdBdCdDdEdFdGdHdIdJfZDdKdLdMdNd@dddeCffdIdOfZEdPdQ� ZF�ze<�r\e*e<�ZGne'e?�ZGeGjHdRk�r|eDd(d� ZDeG�IdSeGjJ � eG�IdTeGjKf � eDD ]\ZLZ9eFeLe9� �q�eFdUdV�D ]<ZMe�NdWeM�ZOeO�r�eO�Pd(�ZQneM�,� dX ZQeFdYeQf� �q�eED ]T\ZLZ9eFeLe9�ZReLe9fdMk�r(�qeRdX �,� ZSeS�s>�qeFdZd[d\eSdX d]f� �qeTd^� W n. eTd_� e�s�eTd`ej7d � � Y n0 dS )az�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�Time2Internaldate�
� i� )Z IMAP4REV1r i@B )�AUTH�SELECTED)�NONAUTH)r r r �LOGOUT)r )r )*�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�UNSUBSCRIBE�UNSELECTs \+( (?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� e Zd ZdZG dd� de�ZG dd� de�ZG dd� de�Zded fd
d�Z dd
� Z
dd� Zdd� Zdd� Z
dd� Zdd� Zdd� Zded fdd�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!d<d=� Z"d>d?� Z#d@dA� Z$dBdC� Z%dDdE� Z&dFdG� Z'dHdI� Z(d�dLdM�Z)dNdO� Z*dPdQ� Z+dRdS� Z,dTdU� Z-d�dVdW�Z.dXdY� Z/dZd[� Z0d\d]� Z1d^d_� Z2d`da� Z3dbdc� Z4ddde� Z5d�dhdi�Z6djdk� Z7dldm� Z8dndo� Z9dpdq� 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�d��ZJd�d�� ZKd�d�� ZLd�d�� ZMd�d�� ZNd�d�� ZOd�d�� ZPd S )�r a� IMAP4 client class.
Instantiate with: IMAP4([host[, port[, timeout=None]]])
host - host's name (default: localhost);
port - port number (default: standard IMAP4 port).
timeout - socket timeout (default: None)
If timeout is not given or is None,
the global default socket timeout is used
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 e Zd ZdS )zIMAP4.errorN��__name__�
__module__�__qualname__� r>