-
<c       s  d  Z  d Z d k Z d k Z d k Z d k Z d k Z d k Z d d d d d g Z d Z	 d	 Z
 d
 Z d d f Z h  d d f d <d f d <d d d d f d <d f d <d f d <d f d <d d f d <d d f d <d d f d <d f d <d f d <d d f d <d d f d <d f d <d d d d f d <d d f d <d d f d <d d d d f d  <d f d! <d d f d" <d f d# <d d f d$ <d d f d% <d f d& <d d f d' <d f d( <d d f d) <d f d* <d d f d+ <Z e i d,  Z e i d-  Z e i d.  Z e i d/  Z e i d0  Z e i d1  Z e i d2  Z d f  d3     YZ d4 f  d5     YZ h  d6 d7 <d8 d9 <d: d; <d< d= <d> d? <d@ dA <dB dC <dD dE <dF dG <dH dI <dJ dK <dL dM <Z dN   Z dO   Z dP   Z dQ   Z e dR j od k Z d k Z y# e i e i  d6 dS  \ Z! Z" Wn e i# j
 o	 Z$ n Xx1 e! D]) \ Z% Z$ e% dT j o e& e$  Z
 n qWe" o dU f Z" n e" d	 Z' e i(   Z) e i dV e) e' p dW f  Z* dX h  e) dY <e	 dZ <Z+ d[ e) e* f f d\ d] f f d^ d] d_ f f d d` f f da d` e, e, e+ f f db dc dd f f de d` f f df e, dg dh f f di dj dk d6 dl f f dm dj dn do f f dp f  f dq f  f dr f  f ds f  f f Z- de f  f dt du f f dv d# dw f f dt dx f f da e, e, e, e+ f f dr f  f dy f  f f Z. dz   Z/ yQe e'  Z0 e1 d{ e0 i2  e1 d| e0 i3  x! e- D] \ Z4 Z" e/ e4 e"  qWxi e/ db d} d~ f  D]R Z5 e i6 d e5  Z7 e7 o e7 i8 d6  Z9 n e5 i:   d Z9 e/ d e9 f  qWx e. D]~ \ Z4 Z" e/ e4 e"  Z; e4 e" f dv d# dw f f j o q1n e; d i:   Z< e< o q1n e/ dv d d e< d d f  q1Wd GHWn+ d GHe
 o d e i  d	 GHn   n Xn d S(   s   IMAP4 client.

Based on RFC 2060.

Public class:           IMAP4
Public variable:        Debug
Public functions:       Internaldate2tuple
                        Int2AP
                        ParseFlags
                        Time2Internaldate
s   2.49Ns   IMAP4s   Internaldate2tuples   Int2APs
   ParseFlagss   Time2Internaldates   
i    i   s	   IMAP4REV1s   AUTHs   SELECTEDs   APPENDs   NONAUTHs   AUTHENTICATEs   LOGOUTs
   CAPABILITYs   CHECKs   CLOSEs   COPYs   CREATEs   DELETEs   EXAMINEs   EXPUNGEs   FETCHs   GETACLs   LISTs   LOGINs   LSUBs	   NAMESPACEs   NOOPs   PARTIALs   RENAMEs   SEARCHs   SELECTs   SETACLs   SORTs   STATUSs   STOREs	   SUBSCRIBEs   UIDs   UNSUBSCRIBEs   \+( (?P<data>.*))?s   .*FLAGS \((?P<flags>[^\)]*)\)s   .*INTERNALDATE "(?P<day>[ 123][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)   \[(?P<type>[A-Z-]+)( (?P<data>[^\]]*))?\]s$   \* (?P<type>[A-Z-]+)( (?P<data>.*))?s3   \* (?P<data>\d+) (?P<type>[A-Z-]+)( (?P<data2>.*))?c      sB  t  Z d  Z d e f d     YZ d e f d     YZ d e f d     YZ e i d  Z	 d e
 d	  Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d d d  Z d    Z  d!   Z! d d d"  Z" d#   Z# d$   Z$ d%   Z% d&   Z& d'   Z' d( e( d)  Z) d*   Z* d+   Z+ d,   Z, d-   Z- d.   Z. d/   Z/ d0   Z0 d1   Z1 d2   Z2 d3   Z3 d4   Z4 d5   Z5 d6   Z6 d7   Z7 d8   Z8 d9   Z9 d:   Z: d;   Z; d<   Z< d=   Z= d>   Z> RS(?   s  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.

    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.
    s   errorc      s   t  Z RS(   N(   s   __name__s
   __module__(    (    (    s   /usr/lib/python2.2/imaplib.pys   error s    s   abortc      s   t  Z RS(   N(   s   __name__s
   __module__(    (    (    s   /usr/lib/python2.2/imaplib.pys   abort s    s   readonlyc      s   t  Z RS(   N(   s   __name__s
   __module__(    (    (    s   /usr/lib/python2.2/imaplib.pys   readonly s    s   [^\w!#$%&'*+,.:;<=>?^`|~-]s    c    s  | |  _  | |  _ t |  _ d |  _ t |  _ h  |  _ h  |  _	 d |  _
 t |  _ d |  _ |  i | |  t t i d d   |  _ t i d |  i d  |  _ |  i   |  _ |  i	 i d  o d |  _ n3 |  i	 i d	  o d
 |  _ n |  i |  i   d } |  i |  |  i	 i |  o |  i d   n t |  i	 | d i   i    |  _ x3 t D]+ } | |  i j o qjn | |  _! d  SqjW|  i d   d  S(   Ns   LOGOUTs    i    i|  s   (?P<tag>s"   \d+) (?P<type>[A-Z]+) (?P<data>.*)s   PREAUTHs   AUTHs   OKs   NONAUTHs
   CAPABILITYs"   no CAPABILITY response from serveris   server not IMAP4 compliant("   s   hosts   selfs   ports   Debugs   debugs   states   Nones   literals   tagged_commandss   untagged_responsess   continuation_responses   is_readonlys   tagnums   opens   Int2APs   randoms   randints   tagpres   res   compiles   tagres   _get_responses   welcomes   has_keys   errors   caps   _simple_commands   tuples   uppers   splits   capabilitiess   AllowedVersionss   versions   PROTOCOL_VERSION(   s   selfs   hosts   ports   caps   version(    (    s   /usr/lib/python2.2/imaplib.pys   __init__ sB    										 &  	c    s;   t  i |  o t |  | i    Sn t d |   d  S(   Ns   Unknown IMAP4 command: '%s'(   s   Commandss   has_keys   attrs   getattrs   selfs   lowers   AttributeError(   s   selfs   attr(    (    s   /usr/lib/python2.2/imaplib.pys   __getattr__ s    c    sP   t  i  t  i t  i  |  _ |  i i |  i |  i f  |  i i d  |  _	 d S(   s   Setup connection to remote server on "host:port".
        This connection will be used by the routines:
            read, readline, send, shutdown.
        s   rbN(
   s   sockets   AF_INETs   SOCK_STREAMs   selfs   socks   connects   hosts   ports   makefiles   file(   s   selfs   hosts   port(    (    s   /usr/lib/python2.2/imaplib.pys   open s     c    s   |  i i |  Sd S(   s   Read 'size' bytes from remote.N(   s   selfs   files   reads   size(   s   selfs   size(    (    s   /usr/lib/python2.2/imaplib.pys   read s     c    s   |  i i   Sd S(   s   Read line from remote.N(   s   selfs   files   readline(   s   self(    (    s   /usr/lib/python2.2/imaplib.pys   readline s     c    s   |  i i |  d S(   s   Send data to remote.N(   s   selfs   socks   sendalls   data(   s   selfs   data(    (    s   /usr/lib/python2.2/imaplib.pys   send s     c    s   |  i i   |  i i   d S(   s    Close I/O established in "open".N(   s   selfs   files   closes   sock(   s   self(    (    s   /usr/lib/python2.2/imaplib.pys   shutdown s     c    s   |  i Sd S(   sf   Return socket instance used to connect to IMAP4 server.

        socket = <instance>.socket()
        N(   s   selfs   sock(   s   self(    (    s   /usr/lib/python2.2/imaplib.pys   socket s     c    sf   d } |  i d t g |  \ } } | d o | | f Sn |  i   \ } } |  i | | |  Sd S(   s  Return 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.
        s   RECENTs   OKiN(   s   names   selfs   _untagged_responses   Nones   typs   dats   noop(   s   selfs   dats   typs   name(    (    s   /usr/lib/python2.2/imaplib.pys   recent s     c    s    |  i | t g | i    Sd S(   s   Return data for response 'code' if received, or None.

        Old value for response 'code' is cleared.

        (code, [data]) = <instance>.response(code)
        N(   s   selfs   _untagged_responses   codes   Nones   upper(   s   selfs   code(    (    s   /usr/lib/python2.2/imaplib.pys   responses     c    s   d } | o
 d } n | o3 | d | d f d d f j o d | } n n t } | o t |  } n t } | |  _ |  i	 | | | |  Sd S(	   s   Append message to named mailbox.

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

                All args except `message' can be None.
        s   APPENDs   INBOXi    is   (s   )s   (%s)N(
   s   names   mailboxs   flagss   Nones	   date_times   Time2Internaldates   messages   selfs   literals   _simple_command(   s   selfs   mailboxs   flagss	   date_times   messages   name(    (    s   /usr/lib/python2.2/imaplib.pys   appends     
!	c    s   | i   } d | } | |  i j o |  i d |   n t |  i	 |  _
 |  i d |  \ } } | d j o |  i | d   n d |  _ | | f Sd S(   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.
        s   AUTH=%ss'   Server doesn't allow %s authentication.s   AUTHENTICATEs   OKis   AUTHN(   s	   mechanisms   uppers   mechs   caps   selfs   capabilitiess   errors   _Authenticators
   authobjects   processs   literals   _simple_commands   typs   dats   state(   s   selfs	   mechanisms
   authobjects   dats   mechs   caps   typ(    (    s   /usr/lib/python2.2/imaplib.pys   authenticate+s     
	c    s   |  i d  Sd S(   sR   Checkpoint mailbox on server.

        (typ, [data]) = <instance>.check()
        s   CHECKN(   s   selfs   _simple_command(   s   self(    (    s   /usr/lib/python2.2/imaplib.pys   checkGs     c    s4   z |  i d  \ } } Wd d |  _ X| | f Sd S(   s   Close currently selected mailbox.

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

        (typ, [data]) = <instance>.close()
        s   CLOSENs   AUTH(   s   selfs   _simple_commands   typs   dats   state(   s   selfs   dats   typ(    (    s   /usr/lib/python2.2/imaplib.pys   closeOs      
c    s   |  i d | |  Sd S(   s   Copy 'message_set' messages onto end of 'new_mailbox'.

        (typ, [data]) = <instance>.copy(message_set, new_mailbox)
        s   COPYN(   s   selfs   _simple_commands   message_sets   new_mailbox(   s   selfs   message_sets   new_mailbox(    (    s   /usr/lib/python2.2/imaplib.pys   copy^s     c    s   |  i d |  Sd S(   sP   Create new mailbox.

        (typ, [data]) = <instance>.create(mailbox)
        s   CREATEN(   s   selfs   _simple_commands   mailbox(   s   selfs   mailbox(    (    s   /usr/lib/python2.2/imaplib.pys   createfs     c    s   |  i d |  Sd S(   sP   Delete old mailbox.

        (typ, [data]) = <instance>.delete(mailbox)
        s   DELETEN(   s   selfs   _simple_commands   mailbox(   s   selfs   mailbox(    (    s   /usr/lib/python2.2/imaplib.pys   deletens     c    s2   d } |  i |  \ } } |  i | | |  Sd 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.
        s   EXPUNGEN(   s   names   selfs   _simple_commands   typs   dats   _untagged_response(   s   selfs   dats   typs   name(    (    s   /usr/lib/python2.2/imaplib.pys   expungevs     c    s8   d } |  i | | |  \ } } |  i | | |  Sd 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.
        s   FETCHN(   s   names   selfs   _simple_commands   message_sets   message_partss   typs   dats   _untagged_response(   s   selfs   message_sets   message_partss   dats   names   typ(    (    s   /usr/lib/python2.2/imaplib.pys   fetchs    	 c    s/   |  i d |  \ } } |  i | | d  Sd S(   sX   Get the ACLs for a mailbox.

        (typ, [data]) = <instance>.getacl(mailbox)
        s   GETACLs   ACLN(   s   selfs   _simple_commands   mailboxs   typs   dats   _untagged_response(   s   selfs   mailboxs   dats   typ(    (    s   /usr/lib/python2.2/imaplib.pys   getacls     s   ""s   *c    s8   d } |  i | | |  \ } } |  i | | |  Sd S(   s   List mailbox names in directory matching pattern.

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

        'data' is list of LIST responses.
        s   LISTN(   s   names   selfs   _simple_commands	   directorys   patterns   typs   dats   _untagged_response(   s   selfs	   directorys   patterns   dats   names   typ(    (    s   /usr/lib/python2.2/imaplib.pys   lists     c    s_   |  i d | |  i |   \ } } | d j o |  i | d   n d |  _ | | f Sd S(   s   Identify client using plaintext password.

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

        NB: 'password' will be quoted.
        s   LOGINs   OKis   AUTHN(	   s   selfs   _simple_commands   users   _quotes   passwords   typs   dats   errors   state(   s   selfs   users   passwords   dats   typ(    (    s   /usr/lib/python2.2/imaplib.pys   logins     $	c    s   d |  _ y |  i d  \ } } Wn* d d t i   d  g f \ } } n X|  i   |  i i	 d  o d |  i d f Sn | | f Sd S(   s|   Shutdown connection to server.

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

        Returns server 'BYE' response.
        s   LOGOUTs   NOs   %s: %si   s   BYEN(
   s   selfs   states   _simple_commands   typs   dats   syss   exc_infos   shutdowns   untagged_responsess   has_key(   s   selfs   dats   typ(    (    s   /usr/lib/python2.2/imaplib.pys   logouts     	  '
c    s8   d } |  i | | |  \ } } |  i | | |  Sd 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.
        s   LSUBN(   s   names   selfs   _simple_commands	   directorys   patterns   typs   dats   _untagged_response(   s   selfs	   directorys   patterns   dats   names   typ(    (    s   /usr/lib/python2.2/imaplib.pys   lsubs     c    s2   d } |  i |  \ } } |  i | | |  Sd S(   sb    Returns IMAP namespaces ala rfc2342

        (typ, [data, ...]) = <instance>.namespace()
        s	   NAMESPACEN(   s   names   selfs   _simple_commands   typs   dats   _untagged_response(   s   selfs   dats   typs   name(    (    s   /usr/lib/python2.2/imaplib.pys	   namespaces     c    s   |  i d  Sd S(   sD   Send NOOP command.

        (typ, data) = <instance>.noop()
        s   NOOPN(   s   selfs   _simple_command(   s   self(    (    s   /usr/lib/python2.2/imaplib.pys   noops      c    s>   d } |  i | | | | |  \ } } |  i	 | | d  Sd 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.
        s   PARTIALs   FETCHN(
   s   names   selfs   _simple_commands   message_nums   message_parts   starts   lengths   typs   dats   _untagged_response(   s   selfs   message_nums   message_parts   starts   lengths   dats   names   typ(    (    s   /usr/lib/python2.2/imaplib.pys   partials     !c    s   |  i d | |  Sd S(   si   Rename old mailbox name to new.

        (typ, data) = <instance>.rename(oldmailbox, newmailbox)
        s   RENAMEN(   s   selfs   _simple_commands
   oldmailboxs
   newmailbox(   s   selfs
   oldmailboxs
   newmailbox(    (    s   /usr/lib/python2.2/imaplib.pys   renames     c    sl   d } | o) t |  i | d | f |  \ } } n  t |  i | f |  \ } } |  i | | |  Sd S(   s   Search mailbox for matching messages.

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

        'data' is space separated list of matching message numbers.
        s   SEARCHs   CHARSETN(	   s   names   charsets   applys   selfs   _simple_commands   criterias   typs   dats   _untagged_response(   s   selfs   charsets   criterias   dats   names   typ(    (    s   /usr/lib/python2.2/imaplib.pys   searchs     )s   INBOXc    s   h  |  _ | |  _ | o
 d } n d } |  i | |  \ } } | d j o d |  _	 | | f Sn d |  _	 |  i i
 d  o | o |  i d |   n | |  i i d t g  f Sd	 S(
   s   Select a mailbox.

        Flush all untagged responses.

        (typ, [data]) = <instance>.select(mailbox='INBOX', readonly=None)

        'data' is count of messages in mailbox ('EXISTS' response).
        s   EXAMINEs   SELECTs   OKs   AUTHs   SELECTEDs	   READ-ONLYs   %s is not writables   EXISTSN(   s   selfs   untagged_responsess   readonlys   is_readonlys   names   _simple_commands   mailboxs   typs   dats   states   has_keys   gets   None(   s   selfs   mailboxs   readonlys   dats   names   typ(    (    s   /usr/lib/python2.2/imaplib.pys   selects     		
		 c    s   |  i d | | |  Sd S(   sZ   Set a mailbox acl.

        (typ, [data]) = <instance>.create(mailbox, who, what)
        s   SETACLN(   s   selfs   _simple_commands   mailboxs   whos   what(   s   selfs   mailboxs   whos   what(    (    s   /usr/lib/python2.2/imaplib.pys   setacl*s     c    sq   d } | d | d f d d f j o d | } n t |  i | | | f |  \ } } |  i	 | | |  Sd S(   s   IMAP4rev1 extension SORT command.

        (typ, [data]) = <instance>.sort(sort_criteria, charset, search_criteria, ...)
        s   SORTi    is   (s   )s   (%s)N(
   s   names   sort_criterias   applys   selfs   _simple_commands   charsets   search_criterias   typs   dats   _untagged_response(   s   selfs   sort_criterias   charsets   search_criterias   dats   names   typ(    (    s   /usr/lib/python2.2/imaplib.pys   sort2s     !%c    s8   d } |  i | | |  \ } } |  i | | |  Sd S(   sp   Request named status conditions for mailbox.

        (typ, [data]) = <instance>.status(mailbox, names)
        s   STATUSN(   s   names   selfs   _simple_commands   mailboxs   namess   typs   dats   _untagged_response(   s   selfs   mailboxs   namess   dats   typs   name(    (    s   /usr/lib/python2.2/imaplib.pys   status@s     c    sd   | d | d f d d f j o d | } n |  i d | | |  \ } } |  i | | d  Sd S(	   s   Alters flag dispositions for messages in mailbox.

        (typ, [data]) = <instance>.store(message_set, command, flags)
        i    is   (s   )s   (%s)s   STOREs   FETCHN(   s   flagss   selfs   _simple_commands   message_sets   commands   typs   dats   _untagged_response(   s   selfs   message_sets   commands   flagss   dats   typ(    (    s   /usr/lib/python2.2/imaplib.pys   storeLs
     !c    s   |  i d |  Sd S(   sY   Subscribe to new mailbox.

        (typ, [data]) = <instance>.subscribe(mailbox)
        s	   SUBSCRIBEN(   s   selfs   _simple_commands   mailbox(   s   selfs   mailbox(    (    s   /usr/lib/python2.2/imaplib.pys	   subscribeWs     c    s   | i   } t i |  o |  i d |   n |  i t | j o  |  i d | |  i f   n d } t |  i	 | | f |  \ } } | d d f j o
 | } n d } |  i | | |  Sd 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'.
        s   Unknown IMAP4 UID command: %ss   command %s illegal in state %ss   UIDs   SEARCHs   SORTs   FETCHN(   s   commands   uppers   Commandss   has_keys   selfs   errors   states   names   applys   _simple_commands   argss   typs   dats   _untagged_response(   s   selfs   commands   argss   dats   names   typ(    (    s   /usr/lib/python2.2/imaplib.pys   uid_s      "
c    s   |  i d |  Sd S(   s_   Unsubscribe from old mailbox.

        (typ, [data]) = <instance>.unsubscribe(mailbox)
        s   UNSUBSCRIBEN(   s   selfs   _simple_commands   mailbox(   s   selfs   mailbox(    (    s   /usr/lib/python2.2/imaplib.pys   unsubscribevs     c    sL   | i   } t i |  o |  i f t | <n t |  i | f |  Sd S(   s  Allow 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'.
        N(	   s   names   uppers   Commandss   has_keys   selfs   states   applys   _simple_commands   args(   s   selfs   names   args(    (    s   /usr/lib/python2.2/imaplib.pys   xatom~s
    	 c    sV   | t j o
 d } n |  i } | i |  o | | i |  n | g | | <d  S(   Ns    (   s   dats   Nones   selfs   untagged_responsess   urs   has_keys   typs   append(   s   selfs   typs   dats   ur(    (    s   /usr/lib/python2.2/imaplib.pys   _append_untaggeds     
	 c    s4   |  i i d  } | o |  i | d   n d  S(   Ns   BYEi(   s   selfs   untagged_responsess   gets   byes   abort(   s   selfs   bye(    (    s   /usr/lib/python2.2/imaplib.pys
   _check_byes    c 
   s  |  i t | j o) t |  _ |  i d | |  i f   n x8 d d d f D]' } |  i i	 |  o |  i | =n qM W|  i i	 d  o |  i
 o |  i d   n |  i   } d | | f } x; | D]3 }	 |	 t j o q n d | |  i |	  f } q W|  i } | t j	 oO t |  _ t |  t |  i  j o
 | } n t } d | t |  f } n y |  i d	 | t f  Wn1 t i t f j
 o } |  i d
 |   n X| t j o | Sn x d o x( |  i   o |  i | o | Sn qW| o | |  i  } n y |  i |  |  i t  Wn1 t i t f j
 o } |  i d
 |   n X| o Pn qW| Sd  S(   Ns   command %s illegal in state %ss   OKs   NOs   BADs	   READ-ONLYs#   mailbox status changed to READ-ONLYs   %s %ss   %s {%s}s   %s%ss   socket error: %si   (   s   selfs   states   Commandss   names   Nones   literals   errors   typs   untagged_responsess   has_keys   is_readonlys   readonlys   _new_tags   tags   datas   argss   args   _checkquotes   types   _commands	   literators   lens   sends   CRLFs   sockets   OSErrors   vals   aborts   _get_responses   tagged_commandss   continuation_response(
   s   selfs   names   argss	   literators   vals   datas   typs   literals   tags   arg(    (    s   /usr/lib/python2.2/imaplib.pys   _commands^    	    		
    
c    s   |  i   y |  i |  \ } } Wna |  i j
 o" } |  i d | | f   n2 |  i	 j
 o" } |  i	 d | | f   n X|  i   | d j o  |  i	 d | | | f   n | | f Sd  S(   Ns   command: %s => %ss   BADs   %s command error: %s %s(
   s   selfs
   _check_byes   _get_tagged_responses   tags   typs   datas   aborts   vals   names   error(   s   selfs   names   tags   vals   typs   data(    (    s   /usr/lib/python2.2/imaplib.pys   _command_completes    

 c    s`  |  i   } |  i |  i |  o{ |  i i d  } |  i i	 |  o |  i
 d |   n |  i i d  } |  i i d  } | | g f |  i | <ngt } |  i t |  o- |  i t |  o |  i i d  } n n |  i t j oG |  i t |  o |  i i d  |  _ t Sn |  i
 d |   n |  i i d  } |  i i d  } | t j o
 d } n | o | d | } n xa |  i t |  oM t |  i i d	   } |  i |  } |  i | | | f  |  i   } qW|  i | |  | d
 d d f j o |  i t |  o, |  i |  i i d  |  i i d   n | Sd  S(   Ns   tags   unexpected tagged response: %ss   types   datas   data2s   unexpected response: '%s's    s    s   sizes   OKs   NOs   BAD(   s   selfs	   _get_lines   resps   _matchs   tagres   mos   groups   tags   tagged_commandss   has_keys   aborts   typs   dats   Nones   dat2s   Untagged_responses   Untagged_statuss   Continuations   continuation_responses   Literals   ints   sizes   reads   datas   _append_untaggeds   Response_code(   s   selfs   dat2s   dats   tags   datas   typs   resps   size(    (    s   /usr/lib/python2.2/imaplib.pys   _get_responsesF     
   ), c    sk   xd d o\ |  i | } | t j	 o |  i | =| Sn y |  i   Wn |  i j
 o }   n Xq Wd  S(   Ni   (   s   selfs   tagged_commandss   tags   results   Nones   _get_responses   aborts   val(   s   selfs   tags   results   val(    (    s   /usr/lib/python2.2/imaplib.pys   _get_tagged_responseJs     
 c    s9   |  i   } | o |  i d   n | d  } | Sd  S(   Ns   socket error: EOFi(   s   selfs   readlines   lines   abort(   s   selfs   line(    (    s   /usr/lib/python2.2/imaplib.pys	   _get_line`s    
 c    s#   | i |  |  _ |  i t j	 Sd  S(   N(   s   cres   matchs   ss   selfs   mos   None(   s   selfs   cres   s(    (    s   /usr/lib/python2.2/imaplib.pys   _matchqs     c    s;   d |  i |  i f } |  i d |  _ t |  i | <| Sd  S(   Ns   %s%si   (   s   selfs   tagpres   tagnums   tags   Nones   tagged_commands(   s   selfs   tag(    (    s   /usr/lib/python2.2/imaplib.pys   _new_tag}s    c    s   t  |  t  d  j	 o | Sn | d | d f d d f d d f f j o | Sn |  i i |  t j o | Sn |  i |  Sd  S(   Ns    i    is   (s   )s   "(   s   types   args   selfs	   mustquotes   searchs   Nones   _quote(   s   selfs   arg(    (    s   /usr/lib/python2.2/imaplib.pys   _checkquotes    -c    s0   | i d d  } | i d d  } d | Sd  S(   Ns   \s   \\s   "s   \"s   "%s"(   s   args   replace(   s   selfs   arg(    (    s   /usr/lib/python2.2/imaplib.pys   _quotes    c    s'   |  i | t |  i | f |   Sd  S(   N(   s   selfs   _command_completes   names   applys   _commands   args(   s   selfs   names   args(    (    s   /usr/lib/python2.2/imaplib.pys   _simple_commands    c    se   | d j o | | f Sn |  i i |  o | t g f Sn |  i | } |  i | =| | f Sd  S(   Ns   NO(   s   typs   dats   selfs   untagged_responsess   has_keys   names   Nones   data(   s   selfs   typs   dats   names   data(    (    s   /usr/lib/python2.2/imaplib.pys   _untagged_responses     
(?   s   __name__s
   __module__s   __doc__s	   Exceptions   errors   aborts   readonlys   res   compiles	   mustquotes
   IMAP4_PORTs   __init__s   __getattr__s   opens   reads   readlines   sends   shutdowns   sockets   recents   responses   appends   authenticates   checks   closes   copys   creates   deletes   expunges   fetchs   getacls   lists   logins   logouts   lsubs	   namespaces   noops   partials   renames   searchs   Nones   selects   setacls   sorts   statuss   stores	   subscribes   uids   unsubscribes   xatoms   _append_untaggeds
   _check_byes   _commands   _command_completes   _get_responses   _get_tagged_responses	   _get_lines   _matchs   _new_tags   _checkquotes   _quotes   _simple_commands   _untagged_response(    (    (    s   /usr/lib/python2.2/imaplib.pys   IMAP4T sp   ) ;		
																					
															H		L							s   _Authenticatorc      s2   t  Z d  Z d   Z d   Z d   Z d   Z RS(   sc   Private class to provide en/decoding
            for base64-based authentication conversation.
    c    s   | |  _ d  S(   N(   s   mechinsts   selfs   mech(   s   selfs   mechinst(    (    s   /usr/lib/python2.2/imaplib.pys   __init__s    c    s>   |  i |  i |   } | t j o d Sn |  i |  Sd  S(   Ns   *(   s   selfs   mechs   decodes   datas   rets   Nones   encode(   s   selfs   datas   ret(    (    s   /usr/lib/python2.2/imaplib.pys   processs    c    s|   d } xk | oc t |  d j o | d  } | d } n | } d } t i |  } | o | | d  } n q	 W| Sd  S(   Ns    i0   i(   s   oups   inps   lens   ts   binasciis
   b2a_base64s   e(   s   selfs   inps   es   ts   oup(    (    s   /usr/lib/python2.2/imaplib.pys   encodes    	 
c    s!   | o d Sn t i |  Sd  S(   Ns    (   s   inps   binasciis
   a2b_base64(   s   selfs   inp(    (    s   /usr/lib/python2.2/imaplib.pys   decodes    (   s   __name__s
   __module__s   __doc__s   __init__s   processs   encodes   decode(    (    (    s   /usr/lib/python2.2/imaplib.pys   _Authenticators
    			i   s   Jani   s   Febi   s   Mari   s   Apri   s   Mayi   s   Juni   s   Juli   s   Augi	   s   Sepi
   s   Octi   s   Novi   s   Decc  	  s  t  i |   } | o t Sn t | i d  } | i d  } t	 | i d   } t	 | i d   } t	 | i d   } t	 | i d   } t	 | i d   }
 t	 | i d   } t	 | i d	   } | d
 | d
 } | d j o | } n | | | | | |
 d d d f	 }	 t i |	  } t i |  } t i o | d o | t i } n | t i } t i | |  Sd S(   sM   Convert IMAP4 INTERNALDATE to UT.

    Returns Python time module tuple.
    s   mons   zonens   days   years   hours   mins   secs   zonehs   zonemi<   s   -iN(   s   InternalDates   matchs   resps   mos   Nones   Mon2nums   groups   mons   zonens   ints   days   years   hours   mins   secs   zonehs   zonems   zones   tts   times   mktimes   utcs	   localtimes   lts   daylights   altzones   timezone(   s   resps   utcs   zones   hours   mins   zonens   zonems   days   lts   tts   secs   mons   zonehs   years   mo(    (    s   /usr/lib/python2.2/imaplib.pys   Internaldate2tuples.     !c    sX   d } d } t t |    }  x/ |  o' t |  d  \ }  } | | | } q! W| Sd S(   s-   Convert integer to A-P string representation.s    s   ABCDEFGHIJKLMNOPi   N(   s   vals   APs   ints   abss   nums   divmods   mod(   s   nums   APs   vals   mod(    (    s   /usr/lib/python2.2/imaplib.pys   Int2AP
s      c    s<   t  i |   } | o f  Sn t | i d  i    Sd S(   s-   Convert IMAP4 flags response to python tuple.s   flagsN(   s   Flagss   matchs   resps   mos   tuples   groups   split(   s   resps   mo(    (    s   /usr/lib/python2.2/imaplib.pys
   ParseFlagss
     c    s   t  |  t t f  o t i |   } nH t  |  t t i f  o
 |  } n% t  |  t	  o |  Sn t
 d   t i d |  } | d d j o d | d } n t i o | d o t i } n t i } d | d	 t | d
 d
  d Sd S(   sy   Convert 'date_time' to IMAP4 INTERNALDATE representation.

    Return string in form: '"DD-Mmm-YYYY HH:MM:SS +HHMM"'
    s   date_time not of a known types   %d-%b-%Y %H:%M:%Si    s   0s    i   is   "s
    %+03d%02di<   N(   s
   isinstances	   date_times   ints   floats   times	   localtimes   tts   tuples   struct_times   strs
   ValueErrors   strftimes   dts   daylights   altzones   zones   timezones   divmod(   s	   date_times   zones   tts   dt(    (    s   /usr/lib/python2.2/imaplib.pys   Time2Internaldate"s     

s   __main__s   d:s   -ds    s   IMAP password for %s on %s: s	   localhostsJ   From: %(user)s@localhost%(lf)sSubject: IMAP4 test%(lf)s%(lf)sdata...%(lf)ss   users   lfs   logins   creates
   /tmp/xxx 1s   renames   /tmp/yyys
   /tmp/yyz 2s   appends   lists   /tmps   yy*s   selects   searchs   SUBJECTs   tests   partials   1s   RFC822i   s   stores   FLAGSs
   (\Deleted)s	   namespaces   expunges   recents   closes   responses   UIDVALIDITYs   uids   ALLs   EXISTSs   logoutc    sQ   t  d |  | f  t t t |   |  \ } } t  d |  | | f  | Sd  S(   Ns   %s %ss   %s => %s %s(   s   _mesgs   cmds   argss   applys   getattrs   Ms   typs   dat(   s   cmds   argss   dats   typ(    (    s   /usr/lib/python2.2/imaplib.pys   runs    s   PROTOCOL_VERSION = %ss   CAPABILITIES = %ss   /tmp/s   yy%s   .*"([^"]+)"$is   deletes   %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
(=   s   __doc__s   __version__s   binasciis   res   sockets   times   randoms   syss   __all__s   CRLFs   Debugs
   IMAP4_PORTs   AllowedVersionss   Commandss   compiles   Continuations   Flagss   InternalDates   Literals   Response_codes   Untagged_responses   Untagged_statuss   IMAP4s   _Authenticators   Mon2nums   Internaldate2tuples   Int2APs
   ParseFlagss   Time2Internaldates   __name__s   getopts   getpasss   argvs   optlists   argss   errors   vals   opts   ints   hosts   getusers   USERs   PASSWDs	   test_mesgs   Nones	   test_seq1s	   test_seq2s   runs   Ms   _mesgs   PROTOCOL_VERSIONs   capabilitiess   cmds   mls   matchs   mos   groups   paths   splits   dats   uid(/   s	   test_seq1s   uids   Response_codes   randoms   getpasss   Literals   mls   USERs   paths   Int2APs   Time2Internaldates   InternalDates   Untagged_statuss   __all__s   res   binasciis   PASSWDs	   test_mesgs   dats   getopts   __version__s   _Authenticators   opts   Commandss	   test_seq2s   runs
   IMAP4_PORTs   argss   Ms   syss   Internaldate2tuples   hosts   Flagss   CRLFs   Debugs   Untagged_responses   optlists   sockets   Mon2nums
   ParseFlagss   Continuations   mos   cmds   AllowedVersionss   vals   times   IMAP4(    (    s   /usr/lib/python2.2/imaplib.pys   ? s   6 #   ^,r	,			 !#  
 ]
	     "	