-í
ç¶<c       sV  d  Z  d k Z d k Z d d g Z d e f d „  ƒ  YZ d Z d Z d Z e e Z	 d f  d „  ƒ  YZ
 e d	 j oÜ d k Z e
 e i d
 ƒ Z e i ƒ  GHe i e i d ƒ e i e i d ƒ e i ƒ  e i ƒ  \ Z Z x` e d
 e d
 ƒ D]K Z e i e ƒ \ Z Z Z d Ge Gd GHx e D] Z d e GHq(Wd GHqõ We i ƒ  n d S(   s@   A POP3 client class.

Based on the J. Myers POP3 draft, Jan. 96
Ns   POP3s   error_protoc      s   t  Z RS(   N(   s   __name__s
   __module__(    (    (    s   /usr/lib/python2.2/poplib.pys   error_proto s    in   s   s   
c      sõ   t  Z d  Z 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 e d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z e i d ƒ Z d „  Z d „  Z e d „ Z RS(   sÏ  This class supports both the minimal and optional command sets.
    Arguments can be strings or integers (where appropriate)
    (e.g.: retr(1) and retr('1') both work equally well.

    Minimal Command Set:
            USER name               user(name)
            PASS string             pass_(string)
            STAT                    stat()
            LIST [msg]              list(msg = None)
            RETR msg                retr(msg)
            DELE msg                dele(msg)
            NOOP                    noop()
            RSET                    rset()
            QUIT                    quit()

    Optional Commands (some servers support these):
            RPOP name               rpop(name)
            APOP name digest        apop(name, digest)
            TOP msg n               top(msg, n)
            UIDL [msg]              uidl(msg = None)

    Raises one exception: 'error_proto'.

    Instantiate with:
            POP3(hostname, port=110)

    NB:     the POP protocol locks the mailbox from user
            authorization until QUIT, so be sure to get in, suck
            the messages, and quit, each time you access the
            mailbox.

            POP is a line-based protocol, which means large mail
            messages consume lots of python cycles reading them
            line-by-line.

            If it's available on your mail server, use IMAP4
            instead, it doesn't suffer from the two problems
            above.
    c 
   s  | |  _  | |  _ d } t |  _ x­ t i |  i  |  i d t i ƒ D]Š } | \ } } } } }	 y, t i | | | ƒ |  _ |  i i |	 ƒ Wn? t i j
 o0 } |  i o |  i i ƒ  n t |  _ qC n XPqC W|  i o t i | ‚ n |  i i d ƒ |  _ d |  _ |  i ƒ  |  _ d  S(   Ns!   getaddrinfo returns an empty listi    s   rb(   s   hosts   selfs   ports   msgs   Nones   socks   sockets   getaddrinfos   SOCK_STREAMs   ress   afs   socktypes   protos	   canonnames   sas   connects   errors   closes   makefiles   files
   _debuggings   _getresps   welcome(
   s   selfs   hosts   ports   afs	   canonnames   protos   msgs   ress   socktypes   sa(    (    s   /usr/lib/python2.2/poplib.pys   __init__K s*    			" 
		c    s<   |  i d j o d G| GHn |  i i d | t f ƒ d  S(   Ni   s   *put*s   %s%s(   s   selfs
   _debuggings   lines   socks   sendalls   CRLF(   s   selfs   line(    (    s   /usr/lib/python2.2/poplib.pys   _putlineb s     c    s)   |  i o d G| GHn |  i | ƒ d  S(   Ns   *cmd*(   s   selfs
   _debuggings   lines   _putline(   s   selfs   line(    (    s   /usr/lib/python2.2/poplib.pys   _putcmdi s    
 c    s¬   |  i i ƒ  } |  i d j o d G| GHn | o t d ƒ ‚ n t | ƒ } | d t j o | d  | f Sn | d t	 j o | d d !| f Sn | d  | f Sd  S(   Ni   s   *get*s   -ERR EOFiþÿÿÿi    iÿÿÿÿ(
   s   selfs   files   readlines   lines
   _debuggings   error_protos   lens   octetss   CRLFs   CR(   s   selfs   octetss   line(    (    s   /usr/lib/python2.2/poplib.pys   _getliner s      c    s_   |  i ƒ  \ } } |  i d j o d G| GHn | d  } | d j o t | ƒ ‚ n | Sd  S(   Ni   s   *resp*s   +(   s   selfs   _getlines   resps   os
   _debuggings   cs   error_proto(   s   selfs   cs   resps   o(    (    s   /usr/lib/python2.2/poplib.pys   _getresp„ s     
c    s¢   |  i ƒ  } g  } d } |  i ƒ  \ } } xd | d j oV | d  d j o | d } | d } n | | } | i | ƒ |  i ƒ  \ } } q- W| | | f Sd  S(   Ni    s   .i   s   ..i   (	   s   selfs   _getresps   resps   lists   octetss   _getlines   lines   os   append(   s   selfs   resps   octetss   lines   lists   o(    (    s   /usr/lib/python2.2/poplib.pys   _getlongresp s     

c    s   |  i | ƒ |  i ƒ  Sd  S(   N(   s   selfs   _putcmds   lines   _getresp(   s   selfs   line(    (    s   /usr/lib/python2.2/poplib.pys	   _shortcmdŸ s    c    s   |  i | ƒ |  i ƒ  Sd  S(   N(   s   selfs   _putcmds   lines   _getlongresp(   s   selfs   line(    (    s   /usr/lib/python2.2/poplib.pys   _longcmd¦ s    c    s   |  i Sd  S(   N(   s   selfs   welcome(   s   self(    (    s   /usr/lib/python2.2/poplib.pys
   getwelcome­ s    c    s   | |  _ d  S(   N(   s   levels   selfs
   _debugging(   s   selfs   level(    (    s   /usr/lib/python2.2/poplib.pys   set_debuglevel± s    c    s   |  i d | ƒ Sd S(   sV   Send user name, return response

        (should indicate password required).
        s   USER %sN(   s   selfs	   _shortcmds   user(   s   selfs   user(    (    s   /usr/lib/python2.2/poplib.pys   user· s     c    s   |  i d | ƒ Sd S(   s    Send password, return response

        (response includes message count, mailbox size).

        NB: mailbox is locked by server from here to 'quit()'
        s   PASS %sN(   s   selfs	   _shortcmds   pswd(   s   selfs   pswd(    (    s   /usr/lib/python2.2/poplib.pys   pass_¿ s     c    sa   |  i d ƒ } | i ƒ  } |  i o d G| GHn t | d ƒ } t | d ƒ } | | f Sd S(   s]   Get mailbox status.

        Result is tuple of 2 ints (message count, mailbox size)
        s   STATs   *stat*i   i   N(	   s   selfs	   _shortcmds   retvals   splits   retss
   _debuggings   ints   numMessagess   sizeMessages(   s   selfs   retss   sizeMessagess   retvals   numMessages(    (    s   /usr/lib/python2.2/poplib.pys   statÉ s     
 c    s-   | o |  i d | ƒ Sn |  i d ƒ Sd S(   s  Request listing, return result.

        Result without a message number argument is in form
        ['response', ['mesg_num octets', ...]].

        Result when a message number argument is given is a
        single response: the "scan listing" for that message.
        s   LIST %ss   LISTN(   s   whichs   selfs	   _shortcmds   _longcmd(   s   selfs   which(    (    s   /usr/lib/python2.2/poplib.pys   listÖ s     c    s   |  i d | ƒ Sd S(   so   Retrieve whole message number 'which'.

        Result is in form ['response', ['line', ...], octets].
        s   RETR %sN(   s   selfs   _longcmds   which(   s   selfs   which(    (    s   /usr/lib/python2.2/poplib.pys   reträ s     c    s   |  i d | ƒ Sd S(   sF   Delete message number 'which'.

        Result is 'response'.
        s   DELE %sN(   s   selfs	   _shortcmds   which(   s   selfs   which(    (    s   /usr/lib/python2.2/poplib.pys   deleì s     c    s   |  i d ƒ Sd S(   sX   Does nothing.

        One supposes the response indicates the server is alive.
        s   NOOPN(   s   selfs	   _shortcmd(   s   self(    (    s   /usr/lib/python2.2/poplib.pys   noopô s     c    s   |  i d ƒ Sd S(   s   Not sure what this does.s   RSETN(   s   selfs	   _shortcmd(   s   self(    (    s   /usr/lib/python2.2/poplib.pys   rsetü s     c    s_   y |  i d ƒ } Wn t j
 o } | } n X|  i i ƒ  |  i i ƒ  |  ` |  ` | Sd S(   sD   Signoff: commit changes on server, unlock mailbox, close connection.s   QUITN(   s   selfs	   _shortcmds   resps   error_protos   vals   files   closes   sock(   s   selfs   resps   val(    (    s   /usr/lib/python2.2/poplib.pys   quits     c    s   |  i d | ƒ Sd S(   s   Not sure what this does.s   RPOP %sN(   s   selfs	   _shortcmds   user(   s   selfs   user(    (    s   /usr/lib/python2.2/poplib.pys   rpops     s   \+OK.*(<[^>]+>)c    sŽ   |  i i |  i ƒ } | o t d ƒ ‚ n d k } | i | i d ƒ | ƒ i
 ƒ  } d i t d „  | ƒ ƒ } |  i d | | f ƒ Sd S(   s   Authorisation

        - only possible if server has supplied a timestamp in initial greeting.

        Args:
                user    - mailbox user;
                secret  - secret shared between client and server.

        NB: mailbox is locked by server from here to 'quit()'
        s!   -ERR APOP not supported by serverNi   s    c    s   d t  |  ƒ S(   Ns   %02x(   s   ords   x(   s   x(    (    s   /usr/lib/python2.2/poplib.pys   <lambda>(s    s
   APOP %s %s(   s   selfs	   timestamps   matchs   welcomes   ms   error_protos   md5s   news   groups   secrets   digests   joins   maps	   _shortcmds   user(   s   selfs   users   secrets   ms   digests   md5(    (    s   /usr/lib/python2.2/poplib.pys   apops    
 	"c    s   |  i d | | f ƒ Sd S(   s­   Retrieve message header of message number 'which'
        and first 'howmuch' lines of message body.

        Result is in form ['response', ['line', ...], octets].
        s	   TOP %s %sN(   s   selfs   _longcmds   whichs   howmuch(   s   selfs   whichs   howmuch(    (    s   /usr/lib/python2.2/poplib.pys   top,s     c    s-   | o |  i d | ƒ Sn |  i d ƒ Sd S(   sì   Return message digest (unique id) list.

        If 'which', result contains unique id for that message
        in the form 'response mesgnum uid', otherwise result is
        the list ['response', ['mesgnum uid', ...], octets]
        s   UIDL %ss   UIDLN(   s   whichs   selfs	   _shortcmds   _longcmd(   s   selfs   which(    (    s   /usr/lib/python2.2/poplib.pys   uidl5s     (   s   __name__s
   __module__s   __doc__s	   POP3_PORTs   __init__s   _putlines   _putcmds   _getlines   _getresps   _getlongresps	   _shortcmds   _longcmds
   getwelcomes   set_debuglevels   users   pass_s   stats   Nones   lists   retrs   deles   noops   rsets   quits   rpops   res   compiles	   timestamps   apops   tops   uidl(    (    (    s   /usr/lib/python2.2/poplib.pys   POP3  s2   ( 												
										s   __main__i   i   i   s   Message s   :s      s   -----------------------(   s   __doc__s   res   sockets   __all__s	   Exceptions   error_protos	   POP3_PORTs   CRs   LFs   CRLFs   POP3s   __name__s   syss   argvs   as
   getwelcomes   users   pass_s   lists   stats   numMsgss	   totalSizes   ranges   is   retrs   headers   msgs   octetss   lines   quit(   s   LFs   syss   sockets   error_protos	   POP3_PORTs	   totalSizes   is   headers   octetss   POP3s   res   CRLFs   as   msgs   CRs   lines   numMsgss   __all__(    (    s   /usr/lib/python2.2/poplib.pys   ? s4   
ÿ "	
  	