b374k
m1n1 1.01
Apache/2.2.15 (CentOS)
Linux obd60-6c49958d75-2q7cw 5.4.0-174-generic #193-Ubuntu SMP Thu Mar 7 14:29:28 UTC 2024 x86_64
uid=48(apache) gid=48(apache) groups=48(apache)
server ip : 104.21.65.202 | your ip : 10.244.126.0
safemode OFF
 >  / usr / lib64 / python2.6 /
Filename/usr/lib64/python2.6/imaplib.pyc
Size44.17 kb
Permissionrw-r--r--
Ownerapache
Create time23-Dec-2025 17:41
Last modified20-Jun-2019 19:45
Last accessed22-Apr-2026 05:29
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
Ñò
§ÚêLc"@s$dZdZddkZddkZddkZddkZddkZddkZddkZdddddd gZ d
Z
d Z d Z d
Z
ddfZdZh&ddfd6dfd6ddddfd6dfd6dfd6dfd6ddfd6ddfd6ddfd6ddfd6dfd6dfd6ddfd 6ddfd!6ddfd"6ddfd#6ddfd$6ddfd%6dfd&6ddddfd6ddfd'6ddfd(6ddddfd)6dfd*6dfd+6ddfd,6dfd-6ddfd.6ddfd/6ddfd06ddfd16dfd26ddfd36dfd46ddfd56dfd66dfd76ddfd86Zeid9�Zeid:�Zeid;�Zeid<�Zeid=�Zeid>�Zeid?�Zeid@�ZdfdA��YZyddkZWnej
on%XdBefdC��YZe idB�defdD��YZdEfdF��YZ h dGdH6dIdJ6dKdL6dMdN6dOdP6dQdR6dSdT6dUdV6dWdX6dYdZ6d[d\6d]d^6Z!d_�Z"d`�Z#da�Z$db�Z%e&dcjoddk'Z'ddk(Z(y#e'i'ei)dGdd�\Z*Z+Wn*e'i,j
oZ-fff\Z*Z+nXe.Z/x]e*D]U\Z0Z-e0dejoe1e-�Z n-e0dfjoe-Z/e+ o
e/fZ+nnq{We+ o
dgfZ+ne+d Z2e(i3�Z4e(i(dhe4e2pdif�Z5djhe4dk6dldm6Z6dne4e5ffdodpffdqdpdrffddsffdtdse.e.e6ffdudvdwffdxdsffdye.dzd{ffd|d}d~ffdd}d�d�ffd�ffd�ffd�ffd�fffZ7dxffd�d�ffd�d-d�ffd�d�ffdte.e.e.e6ffd�ffd�fffZ8d��Z9y�e/oee/�Z:n
ee2�Z:e:i;djoe7dGZ7ne:i<d�e:i=�e:i<d�e:i>f�x!e7D]\Z?Z+e9e?e+�qÖWxie9dud�d�f�D]RZ@eiAd�e@�ZBeBoeBiCdG�ZDne@iE�dZDe9d�eDf�q Wx�e8D]~\Z?Z+e9e?e+�ZFe?e+fd�d-d�ffjoqfneFdiE�ZGeG oqfne9d�dd�eGdd�f�qfWd�GHWn+d�GHe od�ei)d GHn�nXndS(�söIMAP4 client.

Based on RFC 2060.

Public class: IMAP4
Public variable: Debug
Public functions: Internaldate2tuple
Int2AP
ParseFlags
Time2Internaldate
s2.58iÿÿÿÿNtIMAP4t IMAP4_streamtInternaldate2tupletInt2APt
ParseFlagstTime2Internaldates
ii�iát IMAP4REV1i'tAUTHtSELECTEDtAPPENDtNONAUTHt AUTHENTICATEtLOGOUTt
CAPABILITYtCHECKtCLOSEtCOPYtCREATEtDELETEt DELETEACLtEXAMINEtEXPUNGEtFETCHtGETACLt
GETANNOTATIONtGETQUOTAt GETQUOTAROOTtMYRIGHTStLISTtLOGINtLSUBt NAMESPACEtNOOPtPARTIALt PROXYAUTHtRENAMEtSEARCHtSELECTtSETACLt
SETANNOTATIONtSETQUOTAtSORTtSTATUStSTOREt SUBSCRIBEtTHREADtUIDt 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>.*))?cBsÛeZdZdefd��YZdefd��YZdefd��YZeid�Z de
d �Z d
�Z de
d �Z
d �Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#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/d0�Z0d1e1d2�Z2d3�Z3d4�Z4d5�Z5d6�Z6d7�Z7d8�Z8d9�Z9d:�Z:d;�Z;d<�Z<d=�Z=d>�Z>d?�Z?d@�Z@dA�ZAdB�ZBdC�ZCdD�ZDdE�ZEdF�ZFdG�ZGdH�ZHdI�ZIdJ�ZJdOdK�ZLdL�ZMdM�ZNdN�ZORS(Psë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.
terrorcBseZRS((t__name__t
__module__(((s/usr/lib64/python2.6/imaplib.pyR0�stabortcBseZRS((R1R2(((s/usr/lib64/python2.6/imaplib.pyR3�streadonlycBseZRS((R1R2(((s/usr/lib64/python2.6/imaplib.pyR4�ss[^\w!#$%&'*+,.:;<=>?^`|~-]tcCst|_d|_d|_h|_h|_d|_t|_ d|_
|i ||�t t
idd��|_tid|id�|_d|_d|_h|_|id jo)|id
t�|id |i�n|i�|_d |ijo
d
|_n0d|ijo
d|_n|i|i��|i�\}}|dgjo|id��nt|di�i��|_|idjo|id|if�nx/t D]'}||ijoqÅn||_!dSW|id��dS(NR R5iiiÿÿs(?P<tag>s"\d+) (?P<type>[A-Z]+) (?P<data>.*)i
isimaplib version %ssnew IMAP4 connection, tag=%stPREAUTHRtOKR
s"no CAPABILITY response from serveriÿÿÿÿisCAPABILITIES: %rsserver not IMAP4 compliant("tDebugtdebugtstatetNonetliteralttagged_commandstuntagged_responsestcontinuation_responsetFalset is_readonlyttagnumtopenRtrandomtrandintttagpretretcompilettagret _cmd_log_lent _cmd_log_idxt_cmd_logt_mesgt __version__t
_get_responsetwelcomeR0t
capabilityttupletuppertsplitt capabilitiestAllowedVersionstPROTOCOL_VERSION(tselfthosttportttyptdattversion((s/usr/lib64/python2.6/imaplib.pyt__init__ sJ           

 cCs5|tjot||i��Std|��dS(NsUnknown IMAP4 command: '%s'(tCommandstgetattrtlowertAttributeError(RXtattr((s/usr/lib64/python2.6/imaplib.pyt __getattr__Ûs
cCsC||_||_ti||f�|_|iid�|_dS(sÑ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.
trbN(RYRZtsockettcreate_connectiontsocktmakefiletfile(RXRYRZ((s/usr/lib64/python2.6/imaplib.pyRCæs  cCs|ii|�S(sRead 'size' bytes from remote.(Rjtread(RXtsize((s/usr/lib64/python2.6/imaplib.pyRkòscCsD|iitd�}t|�tjo|idt��n|S(sRead line from remote.isgot more than %d bytes(Rjtreadlinet_MAXLINEtlenR0(RXtline((s/usr/lib64/python2.6/imaplib.pyRm÷scCs|ii|�dS(sSend data to remote.N(Rhtsendall(RXtdata((s/usr/lib64/python2.6/imaplib.pytsendÿscCs|ii�|ii�dS(s Close I/O established in "open".N(RjtcloseRh(RX((s/usr/lib64/python2.6/imaplib.pytshutdowns
cCs|iS(sfReturn socket instance used to connect to IMAP4 server.

socket = <instance>.socket()
(Rh(RX((s/usr/lib64/python2.6/imaplib.pyRf
scCs_d}|iddg|�\}}|do ||fS|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.
tRECENTR7iÿÿÿÿN(t_untagged_responseR;tnoop(RXtnameR[R\((s/usr/lib64/python2.6/imaplib.pytrecents   cCs|i|dg|i��S(s¥Return data for response 'code' if received, or None.

Old value for response 'code' is cleared.

(code, [data]) = <instance>.response(code)
N(RwR;RS(RXtcode((s/usr/lib64/python2.6/imaplib.pytresponse'scCs�d}|p
d}n|o-|d|dfdjod|}qQnd }|ot|�}nd }tit|�|_|i||||�S(
s°Append message to named mailbox.

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

All args except `message' can be None.
R tINBOXiiÿÿÿÿt(t)s(%s)(R~RN(R;RtMapCRLFtsubtCRLFR<t_simple_command(RXtmailboxtflagst date_timetmessageRy((s/usr/lib64/python2.6/imaplib.pytappend5s
cCsm|i�}t|�i|_|id|�\}}|djo|i|d��nd|_||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.
R R7iÿÿÿÿR(RSt_AuthenticatortprocessR<R�R0R:(RXt mechanismt
authobjecttmechR[R\((s/usr/lib64/python2.6/imaplib.pyt authenticateLs 
 cCs.d}|i|�\}}|i|||�S(sT(typ, [data]) = <instance>.capability()
Fetch capabilities list from server.R
(R�Rw(RXRyR[R\((s/usr/lib64/python2.6/imaplib.pyRQiscCs
|id�S(sRCheckpoint mailbox on server.

(typ, [data]) = <instance>.check()
R(R�(RX((s/usr/lib64/python2.6/imaplib.pytcheckrscCs0z|id�\}}Wdd|_X||fS(sÌClose currently selected mailbox.

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

(typ, [data]) = <instance>.close()
RNR(R�R:(RXR[R\((s/usr/lib64/python2.6/imaplib.pyRtzs
cCs|id||�S(s�Copy 'message_set' messages onto end of 'new_mailbox'.

(typ, [data]) = <instance>.copy(message_set, new_mailbox)
R(R�(RXt message_sett new_mailbox((s/usr/lib64/python2.6/imaplib.pytcopy�scCs|id|�S(sPCreate new mailbox.

(typ, [data]) = <instance>.create(mailbox)
R(R�(RXR�((s/usr/lib64/python2.6/imaplib.pytcreate�scCs|id|�S(sPDelete old mailbox.

(typ, [data]) = <instance>.delete(mailbox)
R(R�(RXR�((s/usr/lib64/python2.6/imaplib.pytdelete�scCs|id||�S(s�Delete the ACLs (remove any rights) set for who on mailbox.

(typ, [data]) = <instance>.deleteacl(mailbox, who)
R(R�(RXR�twho((s/usr/lib64/python2.6/imaplib.pyt deleteacl scCs.d}|i|�\}}|i|||�S(s÷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�Rw(RXRyR[R\((s/usr/lib64/python2.6/imaplib.pytexpunge§s cCs4d}|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.
R(R�Rw(RXR�t
message_partsRyR[R\((s/usr/lib64/python2.6/imaplib.pytfetchµs
cCs+|id|�\}}|i||d�S(sXGet the ACLs for a mailbox.

(typ, [data]) = <instance>.getacl(mailbox)
RtACL(R�Rw(RXR�R[R\((s/usr/lib64/python2.6/imaplib.pytgetaclÄscCs1|id|||�\}}|i||d�S(sa(typ, [data]) = <instance>.getannotation(mailbox, entry, attribute)
Retrieve ANNOTATIONs.Rt
ANNOTATION(R�Rw(RXR�tentryt attributeR[R\((s/usr/lib64/python2.6/imaplib.pyt
getannotationÍscCs+|id|�\}}|i||d�S(sªGet the quota root's resource usage and limits.

Part of the IMAP4 QUOTA extension defined in rfc2087.

(typ, [data]) = <instance>.getquota(root)
RtQUOTA(R�Rw(RXtrootR[R\((s/usr/lib64/python2.6/imaplib.pytgetquotaÕscCs^|id|�\}}|i||d�\}}|i||d�\}}|||gfS(s�Get the list of quota roots for the named mailbox.

(typ, [[QUOTAROOT responses...], [QUOTA responses]]) = <instance>.getquotaroot(mailbox)
RR t QUOTAROOT(R�Rw(RXR�R[R\tquotat quotaroot((s/usr/lib64/python2.6/imaplib.pyt getquotarootàss""t*cCs4d}|i|||�\}}|i|||�S(s«List mailbox names in directory matching pattern.

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

'data' is list of LIST responses.
R(R�Rw(RXt directorytpatternRyR[R\((s/usr/lib64/python2.6/imaplib.pytlistëscCs[|id||i|��\}}|djo|i|d��nd|_||fS(s�Identify client using plaintext password.

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

NB: 'password' will be quoted.
RR7iÿÿÿÿR(R�t_quoteR0R:(RXtusertpasswordR[R\((s/usr/lib64/python2.6/imaplib.pytlogin÷s
$
 cCs&|||_|_|id|i�S(sr Force use of CRAM-MD5 authentication.

(typ, [data]) = <instance>.login_cram_md5(user, password)
sCRAM-MD5(R¬R­R�t_CRAM_MD5_AUTH(RXR¬R­((s/usr/lib64/python2.6/imaplib.pytlogin_cram_md5scCs0ddk}|id|i|i|�i�S(s1 Authobject to use with CRAM-MD5 authentication. iÿÿÿÿNt (thmacR¬tHMACR­t hexdigest(RXt challengeR²((s/usr/lib64/python2.6/imaplib.pyR¯s cCs�d|_y|id�\}}Wn%ddti�d g}}nX|i�d|ijod|idfS||fS(s|Shutdown connection to server.

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

Returns server 'BYE' response.
R tNOs%s: %sitBYE(R:R�tsystexc_infoRuR>(RXR[R\((s/usr/lib64/python2.6/imaplib.pytlogouts "
cCs4d}|i|||�\}}|i|||�S(sÐ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�Rw(RXR¨R©RyR[R\((s/usr/lib64/python2.6/imaplib.pytlsub$scCs+|id|�\}}|i||d�S(s�Show my ACLs for a mailbox (i.e. the rights that I have on mailbox).

(typ, [data]) = <instance>.myrights(mailbox)
R(R�Rw(RXR�R[R\((s/usr/lib64/python2.6/imaplib.pytmyrights/scCs.d}|i|�\}}|i|||�S(sb Returns IMAP namespaces ala rfc2342

(typ, [data, ...]) = <instance>.namespace()
R(R�Rw(RXRyR[R\((s/usr/lib64/python2.6/imaplib.pyt namespace7scCs1|idjo|i|i�n|id�S(sFSend NOOP command.

(typ, [data]) = <instance>.noop()
iR (R9t_dump_urR>R�(RX((s/usr/lib64/python2.6/imaplib.pyRxAscCs:d}|i|||||�\}}|i||d�S(sÂ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�Rw(RXt message_numt message_parttstarttlengthRyR[R\((s/usr/lib64/python2.6/imaplib.pytpartialLs!cCsd}|id|�S(s³Assume authentication as "user".

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

(typ, [data]) = <instance>.proxyauth(user)
R"(R�(RXR¬Ry((s/usr/lib64/python2.6/imaplib.pyt proxyauthXs cCs|id||�S(skRename old mailbox name to new.

(typ, [data]) = <instance>.rename(oldmailbox, newmailbox)
R#(R�(RXt
oldmailboxt
newmailbox((s/usr/lib64/python2.6/imaplib.pytrenameescGsZd}|o"|i|d||�\}}n|i||�\}}|i|||�S(s·Search mailbox for matching messages.

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

'data' is space separated list of matching message numbers.
R$tCHARSET(R�Rw(RXtcharsettcriteriaRyR[R\((s/usr/lib64/python2.6/imaplib.pytsearchms
"R}cCsÚh|_||_|o
d}nd}|i||�\}}|djod|_||fSd|_d|ijoC| o;|idjo|i|i�n|id|��n||iid d
g�fS( stSelect 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%R7RRs READ-ONLYis%s is not writabletEXISTSN( R>RAR�R:R9R¾R4tgetR;(RXR�R4RyR[R\((s/usr/lib64/python2.6/imaplib.pytselect|s  

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

(typ, [data]) = <instance>.setacl(mailbox, who, what)
R&(R�(RXR�R�twhat((s/usr/lib64/python2.6/imaplib.pytsetacl�scGs+|id|�\}}|i||d�S(s_(typ, [data]) = <instance>.setannotation(mailbox[, entry, attribute]+)
Set ANNOTATIONs.R'R�(R�Rw(RXtargsR[R\((s/usr/lib64/python2.6/imaplib.pyt
setannotation¤scCs.|id||�\}}|i||d�S(siSet the quota root's resource limits.

(typ, [data]) = <instance>.setquota(root, limits)
R(R (R�Rw(RXR¡tlimitsR[R\((s/usr/lib64/python2.6/imaplib.pytsetquota¬scGs`d}|d|dfdjod|}n|i||||�\}}|i|||�S(s�IMAP4rev1 extension SORT command.

(typ, [data]) = <instance>.sort(sort_criteria, charset, search_criteria, ...)
R)iiÿÿÿÿR~Rs(%s)(R~R(R�Rw(RXt
sort_criteriaRÉtsearch_criteriaRyR[R\((s/usr/lib64/python2.6/imaplib.pytsortµs
cCs4d}|i|||�\}}|i|||�S(spRequest named status conditions for mailbox.

(typ, [data]) = <instance>.status(mailbox, names)
R*(R�Rw(RXR�tnamesRyR[R\((s/usr/lib64/python2.6/imaplib.pytstatusÃscCsZ|d|dfdjod|}n|id|||�\}}|i||d�S( s�Alters flag dispositions for messages in mailbox.

(typ, [data]) = <instance>.store(message_set, command, flags)
iiÿÿÿÿR~Rs(%s)R+R(R~R(R�Rw(RXR�tcommandR�R[R\((s/usr/lib64/python2.6/imaplib.pytstoreÏscCs|id|�S(sYSubscribe to new mailbox.

(typ, [data]) = <instance>.subscribe(mailbox)
R,(R�(RXR�((s/usr/lib64/python2.6/imaplib.pyt subscribeÚscGs7d}|i||||�\}}|i|||�S(s�IMAPrev1 extension THREAD command.

(type, [data]) = <instance>.thread(threading_algorithm, charset, search_criteria, ...)
R-(R�Rw(RXtthreading_algorithmRÉRÖRyR[R\((s/usr/lib64/python2.6/imaplib.pytthreadâscGsÅ|i�}|tjo|id|��n|it|jo0|id||idit|�f��nd}|i|||�\}}|d jo
|}nd}|i|||�S(
såExecute "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: %ss9command %s illegal in state %s, only allowed in states %ss, R.R$R)R-R(sSEARCHsSORTsTHREAD(RSR_R0R:tjoinR�Rw(RXRÚRÑRyR[R\((s/usr/lib64/python2.6/imaplib.pytuidìs 
  

cCs|id|�S(s_Unsubscribe from old mailbox.

(typ, [data]) = <instance>.unsubscribe(mailbox)
R/(R�(RXR�((s/usr/lib64/python2.6/imaplib.pyt unsubscribescGs=|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'.
(RSR_R:R�(RXRyRÑ((s/usr/lib64/python2.6/imaplib.pytxatom
s

cCs�|djo
d}n|i}|idjo0|id|t|i|d��|f�n||jo||i|�n|g||<dS(NR5is#untagged_responses[%s] %s += ["%s"](R;R>R9RMRoRÍR�(RXR[R\tur((s/usr/lib64/python2.6/imaplib.pyt_append_untagged#s

  '
cCs4|iid�}|o|i|d��ndS(NR·iÿÿÿÿ(R>RÍR3(RXtbye((s/usr/lib64/python2.6/imaplib.pyt
_check_bye1sc

GsÕ|it|jo9d|_|id||idit|�f��nx,dD]$}||ijo|i|=qTqTWd|ijo|i o|id��n|i �}d||f}x;|D]3}|djoqÍnd||i
|�f}qÍW|i}|dj oOd|_t |�t |i �jo
|}qid}d |t
|�f}n|id
jo|id |�n|id |�y|id |tf�Wn1titfj
o} |id
| ��nX|djo|SxÎx%|i�o|i|o|SqW|o||i�}n|id
jo|idt
|��ny|i|�|it�Wn1titfj
o} |id
| ��nX|pPqq|S(Ns9command %s illegal in state %s, only allowed in states %ss, R7R¶tBADs READ-ONLYs#mailbox status changed to READ-ONLYs%s %ss%s {%s}is> %ss%s%sssocket error: %sswrite literal size %s(sOKsNORç(R:R_R;R<R0RßR>RAR4t_new_tagt _checkquotettypet_commandRoR9RMt_logRsR�RftOSErrorR3ROR=R?(
RXRyRÑR[ttagRrtargR<t literatortval((s/usr/lib64/python2.6/imaplib.pyRë7sh     
 
 




cCsÈ|i�y|i|�\}}Wna|ij
o"}|id||f��n2|ij
o"}|id||f��nX|i�|djo |id|||f��n||fS(Nscommand: %s => %sRçs%s command error: %s %s(Ræt_get_tagged_responseR3R0(RXRyRîR[RrRñ((s/usr/lib64/python2.6/imaplib.pyt_command_complete�s


 cCs¨|i�}|i|i|�ow|iid�}||ijo|id|��n|iid�}|iid�}||gf|i|<n�d}|it|�p-|it |�o|iid�}qßn|idjoD|it
|�o|iid�|_ dS|id|��n|iid�}|iid�}|djo
d}n|o|d|}nx�|it |�ort
|iid ��}|id
jo|id |�n|i|�}|i|||f�|i�}q�W|i||�|djo?|it|�o,|i|iid�|iid��n|idjo(|djo|id||f�n|S(NRîsunexpected tagged response: %sRêRrtdata2sunexpected response: '%s'R5R±Rlisread literal size %sR7R¶RçiR·s%s response: %s(sOKsNOsBAD(sNOsBADsBYE(t _get_linet_matchRItmotgroupR=R3R;tUntagged_responsetUntagged_statust ContinuationR?tLiteraltintR9RMRkRät
Response_code(RXtrespRîR[R\tdat2RlRr((s/usr/lib64/python2.6/imaplib.pyRO�sJ 

 ,cCs}xv|i|}|dj o|i|=|Sy|i�Wq|ij
o*}|idjo|i�n�qXqdS(Ni(R=R;ROR3R9t print_log(RXRîtresultRñ((s/usr/lib64/python2.6/imaplib.pyRòÛs


cCs�|i�}|p|id��n|id�p|id��n|d }|idjo|id|�n|id|�|S(Nssocket error: EOFs
ssocket error: unterminated lineiþÿÿÿis< %s(RmR3tendswithR9RMRì(RXRp((s/usr/lib64/python2.6/imaplib.pyRõñs 
cCsf|i|�|_|idj o7|idjo'|id|i|ii�f�n|idj S(Nis matched r'%s' => %r(tmatchR÷R;R9RMR©tgroups(RXtcrets((s/usr/lib64/python2.6/imaplib.pyRös 'cCs7d|i|if}|id|_d|i|<|S(Ns%s%si(RFRBR;R=(RXRî((s/usr/lib64/python2.6/imaplib.pyRès
cCs�t|�td�j o|St|�djo&|d|dfdd fjo|S|o|ii|�djo|S|i|�S(
NR5iiiÿÿÿÿR~Rt"(R~R(RR(RêRot mustquoteRËR;R«(RXRï((s/usr/lib64/python2.6/imaplib.pyRés4 cCs,|idd�}|idd�}d|S(Ns\s\\Rs\"s"%s"(treplace(RXRï((s/usr/lib64/python2.6/imaplib.pyR«&scGs|i||i||��S(N(RóRë(RXRyRÑ((s/usr/lib64/python2.6/imaplib.pyR�.scCs}|djo ||fS||ijo|dgfS|ii|�}|idjo|id||f�n||fS(NR¶isuntagged_responses[%s] => %s(R>R;tpopR9RM(RXR[R\RyRr((s/usr/lib64/python2.6/imaplib.pyRw3s
 cCsn|djoti�}ntidti|��}tiid||dd|f�tii�dS(Ns%M:%Ss
%s.%02d %s
id(R;ttimetstrftimet localtimeR¸tstderrtwritetflush(RXRtsecsttm((s/usr/lib64/python2.6/imaplib.pyRMBs

%cCsT|i�}|pdSd}td�|�}|id||i|�f�dS(Ns
cSs5d|d|ddodi|d�pdfS(s%s: "%s"iis" "R5(Rß(tx((s/usr/lib64/python2.6/imaplib.pyt<lambda>Nssuntagged responses dump:%s%s(titemstmapRMRß(RXtdicttltt((s/usr/lib64/python2.6/imaplib.pyR¾Is  cCsO|ti�f|i|i<|id7_|i|ijo
d|_ndS(Nii(R RLRKRJ(RXRp((s/usr/lib64/python2.6/imaplib.pyRìQscCs�|idt|i��|i|i}}x\|oTy|i|i|�WnnX|d7}||ijo
d}n|d8}q0WdS(Nslast %d IMAP4 interactions:ii(RMRoRLRKRJ(RXtitn((s/usr/lib64/python2.6/imaplib.pyRXs

N(PR1R2t__doc__t ExceptionR0R3R4RGRHR t
IMAP4_PORTR^RdRCRkRmRsRuRfRzR|R�R�RQR�RtR�R�R�R�R�R�R�R�R¢R¦RªR®R°R¯RºR»R¼R½RxRÃRÄRÇRËR@RÎRÐRÒRÔR×RÙRÛRÜRÞRàRáRâRäRæRëRóRORòRõRöRèRéR«R�RwR;RMR¾RìR(((s/usr/lib64/python2.6/imaplib.pyRls�,;                       

     
     J  L          t IMAP4_SSLcBsheZdZded
d
d�Zded�Zd�Zd�Zd�Z d�Z
d�Z d �Z RS( s÷IMAP4 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(tkeyfiletcertfileRR^(RXRYRZR!R"((s/usr/lib64/python2.6/imaplib.pyR^{s  cCsO||_||_ti||f�|_ti|i|i|i�|_ dS(sæ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(
RYRZRfRgRhtsslt wrap_socketR!R"tsslobj(RXRYRZ((s/usr/lib64/python2.6/imaplib.pyRC�s  cCsjg}d}xN||jo@|iit||d��}|t|�7}|i|�qWdi|�S(sRead 'size' bytes from remote.ii@R5(R%RktminRoR�Rß(RXRltchunksRkRr((s/usr/lib64/python2.6/imaplib.pyRk�s
cCsJg}x=|iid�}|i|�|djodi|�Sq dS(sRead line from remote.is
R5N(s
R5(R%RkR�Rß(RXRptchar((s/usr/lib64/python2.6/imaplib.pyRm�s 

cCs]t|�}xJ|djo<|ii|�}||joPn||}||}qWdS(sSend data to remote.iN(RoR%R(RXRrtbytestsent((s/usr/lib64/python2.6/imaplib.pyRs£s 


cCs|ii�dS(s Close I/O established in "open".N(RhRt(RX((s/usr/lib64/python2.6/imaplib.pyRu®scCs|iS(snReturn socket instance used to connect to IMAP4 server.

socket = <instance>.socket()
(Rh(RX((s/usr/lib64/python2.6/imaplib.pyRf³scCs|iS(s�Return SSLObject instance used to communicate with the IMAP4 server.

ssl = ssl.wrap_socket(<instance>.socket)
(R%(RX((s/usr/lib64/python2.6/imaplib.pyR#»sN(
R1R2RtIMAP4_SSL_PORTR;R^RCRkRmRsRuRfR#(((s/usr/lib64/python2.6/imaplib.pyR ls 
 cBsJeZdZd�Zddd�Zd�Zd�Zd�Zd�Z RS(síIMAP4 client class over a stream

Instantiate with: IMAP4_stream(command)

where "command" is a string that can be passed to subprocess.Popen()

for more documentation see the docstring of the parent class IMAP4.
cCs||_ti|�dS(N(RÚRR^(RXRÚ((s/usr/lib64/python2.6/imaplib.pyR^Ñs c
Csyd|_d|_d|_d|_ti|idtidtidt dt �|_
|i
i |_ |i
i
|_dS(s�Setup a stream connection.
This connection will be used by the routines:
read, readline, send, shutdown.
tstdintstdouttshellt close_fdsN(R;RYRZRhRjt
subprocesstPopenRÚtPIPEtTrueR�R,t writefileR-treadfile(RXRYRZ((s/usr/lib64/python2.6/imaplib.pyRCÖs    cCs|ii|�S(sRead 'size' bytes from remote.(R5Rk(RXRl((s/usr/lib64/python2.6/imaplib.pyRkæscCs
|ii�S(sRead line from remote.(R5Rm(RX((s/usr/lib64/python2.6/imaplib.pyRmëscCs!|ii|�|ii�dS(sSend data to remote.N(R4RR(RXRr((s/usr/lib64/python2.6/imaplib.pyRsðscCs+|ii�|ii�|ii�dS(s Close I/O established in "open".N(R5RtR4R�twait(RX((s/usr/lib64/python2.6/imaplib.pyRuös

N(
R1R2RR^R;RCRkRmRsRu(((s/usr/lib64/python2.6/imaplib.pyRÅs     R�cBs2eZdZd�Zd�Zd�Zd�ZRS(scPrivate class to provide en/decoding
for base64-based authentication conversation.
cCs
||_dS(N(R�(RXtmechinst((s/usr/lib64/python2.6/imaplib.pyR^scCs7|i|i|��}|djodS|i|�S(NR§(R�tdecodeR;tencode(RXRrtret((s/usr/lib64/python2.6/imaplib.pyR�s
cCsxd}xk|oct|�djo|d }|d}n
|}d}ti|�}|o||d }q q W|S(NR5i0iÿÿÿÿ(Rotbinasciit
b2a_base64(RXtinptoupRte((s/usr/lib64/python2.6/imaplib.pyR9
s 
cCs|pdSti|�S(NR5(R;t
a2b_base64(RXR=((s/usr/lib64/python2.6/imaplib.pyR8#s(R1R2RR^R�R9R8(((s/usr/lib64/python2.6/imaplib.pyR�þs
   itJanitFebitMaritApritMayitJunitJulitAugi tSepi
tOcti tNovi tDecc Cs}ti|�}|pd
St|id�}|id�}t|id��}t|id��}t|id��}t|id��}t|id��}t|id��} t|id ��}
| d
|
d
} |d jo | } n||||||d d d f } ti| �}
ti|
�}ti o|d o| ti
} n| ti } ti|
| �S(sMConvert IMAP4 INTERNALDATE to UT.

Returns Python time module tuple.
tmontzonentdaytyearthourR&tsectzonehtzonemi<t-iÿÿÿÿN( t InternalDateRR;tMon2numRøRýR tmktimeRtdaylighttaltzonettimezone(RÿR÷RMRNRORPRQR&RRRSRTtzonettttutctlt((s/usr/lib64/python2.6/imaplib.pyR-s,
 !
cCsTd}d}tt|��}x/|o't|d�\}}|||}q!W|S(s-Convert integer to A-P string representation.R5tABCDEFGHIJKLMNOPi(Rýtabstdivmod(tnumRñtAPtmod((s/usr/lib64/python2.6/imaplib.pyRYscCs4ti|�}|pdSt|id�i��S(s-Convert IMAP4 flags response to python tuple.R�((tFlagsRRRRøRT(RÿR÷((s/usr/lib64/python2.6/imaplib.pyRfscCs t|ttf�oti|�}n`t|ttif�o
|}n=t|t�o |d|dfd jo|Std��ti d|�}|ddjod|d}nti
o|doti }n ti }d|d t
|d
d
�dS( syConvert 'date_time' to IMAP4 INTERNALDATE representation.

Return string in form: '"DD-Mmm-YYYY HH:MM:SS +HHMM"'
iiÿÿÿÿRsdate_time not of a known types%d-%b-%Y %H:%M:%St0R±is
%+03d%02di<(RR(t
isinstanceRýtfloatR RRRt struct_timetstrt
ValueErrorR
RYRZR[Rb(R�R]tdtR\((s/usr/lib64/python2.6/imaplib.pyRqs
+ 
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)sR¬s
tlfR®R�s
/tmp/xxx 1RÇs/tmp/yyys
/tmp/yyz 2R�Rªs/tmpsyy*RÎRËtSUBJECTttestR�t1s(FLAGS INTERNALDATE RFC822)RÛtFLAGSs
(\Deleted)R½R�RzRtR|t UIDVALIDITYRàtALLRÌRºcCsktid||f�tt|�|�\}}tid|||f�|djo|d�n|S(Ns%s %ss %s => %s %sR¶i(tMRMR`(tcmdRÑR[R\((s/usr/lib64/python2.6/imaplib.pytrunÄs 
sPROTOCOL_VERSION = %ssCAPABILITIES = %rs/tmp/syy%s .*"([^"]+)"$R�s%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
(HRRNR;RDRGRfR0R¸R t__all__R�R8RR+RVRnR_RHRûRfRVRüR�RþRùRúRR#t ImportErrorR R�RR�RWRRRRR1tgetopttgetpasstargvtoptlistRÑR0RñR;tstream_commandtoptRýRYtgetusertUSERtPASSWDt test_mesgt test_seq1t test_seq2RyRwR:RMRWRURxtmlRR÷RøtpathRTR\Rà(((s/usr/lib64/python2.6/imaplib.pyt<module> s0 T  

































ÿÿÿþV
9,-- ,

#