???<!-- GIF89;a -->
123123123123
.....................................................................................................................................???<!-- GIF89;a -->
123123123123
.....................................................................................................................................
Ľ˙fl,  c               @   sŔ  d  Z  d d l Z d d l Z d d g Z Gd d   d e  Z d Z d Z d Z d	 Z	 e e	 Z
 d
 Z Gd d   d  Z y d d l Z Wn e k
 r Yn$ XGd d   d e  Z e j d  e d k rźd d l Z e e j d  Z e e j    e j e j d  e j e j d  e j   e j   \ Z Z xj e d e d  D]U Z e j e  \ Z  Z! Z" e d e  x e! D] Z# e d e#  qWe d  qVWe j$   n  d S(   u@   A POP3 client class.

Based on the J. Myers POP3 draft, Jan. 96
i    Nu   POP3u   error_protoc             B   s   |  Ee  Z d  Z d S(   u   error_protoN(   u   __name__u
   __module__u   __qualname__(   u
   __locals__(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   error_proto   s    in   iă  s   s   
i   c             B   sj  |  Ee  Z d  Z d Z d Z e e j d d  Z d d   Z	 d d   Z
 d	 d
   Z d d   Z d d   Z d d   Z d d   Z d d   Z d d   Z d d   Z d d   Z d d   Z d d   Z d6 d d   Z d! d"   Z d# d$   Z d% d&   Z d' d(   Z d) d*   Z d+ d,   Z d- d.   Z e j  d/  Z! d0 d1   Z" d2 d3   Z# d6 d4 d5  Z$ d6 S(7   u   POP3uĎ  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.
    u   UTF-8c             C   sU   | |  _  | |  _ |  j |  |  _ |  j j d  |  _ d |  _ |  j   |  _ d  S(   Nu   rbi    (	   u   hostu   portu   _create_socketu   socku   makefileu   fileu
   _debuggingu   _getrespu   welcome(   u   selfu   hostu   portu   timeout(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   __init__V   s    			u   POP3.__init__c             C   s   t  j |  j |  j f |  S(   N(   u   socketu   create_connectionu   hostu   port(   u   selfu   timeout(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   _create_socket_   s    u   POP3._create_socketc             C   s=   |  j  d k r% t d t |   n  |  j j | t  d  S(   Ni   u   *put*(   u
   _debuggingu   printu   repru   socku   sendallu   CRLF(   u   selfu   line(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   _putlineb   s     u   POP3._putlinec             C   sB   |  j  r t d t |   n  t | |  j  } |  j |  d  S(   Nu   *cmd*(   u
   _debuggingu   printu   repru   bytesu   encodingu   _putline(   u   selfu   line(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   _putcmdi   s    	 u   POP3._putcmdc             C   sß   |  j  j t d  } t |  t k r7 t d   n  |  j d k r\ t d t |   n  | sq t d   n  t |  } | d d   t k r§ | d  d  | f S| d t	 k rË | d d	  | f S| d  d
  | f S(   Ni   u   line too longu   *get*u   -ERR EOFi   i    iţ˙˙˙iţ˙˙˙i˙˙˙˙i˙˙˙˙(
   u   fileu   readlineu   _MAXLINEu   lenu   error_protou
   _debuggingu   printu   repru   CRLFu   CR(   u   selfu   lineu   octets(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   _getlines   s      u   POP3._getlinec             C   sY   |  j    \ } } |  j d k r7 t d t |   n  | j d  sU t |   n  | S(   Ni   u   *resp*s   +(   u   _getlineu
   _debuggingu   printu   repru
   startswithu   error_proto(   u   selfu   respu   o(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   _getresp   s     u   POP3._getrespc             C   s   |  j    } g  } d } |  j   \ } } xe | d k r | j d  re | d } | d d   } n  | | } | j |  |  j   \ } } q- W| | | f S(   Ni    s   .s   ..i   (   u   _getrespu   _getlineu
   startswithu   append(   u   selfu   respu   listu   octetsu   lineu   o(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   _getlongresp   s     

u   POP3._getlongrespc             C   s   |  j  |  |  j   S(   N(   u   _putcmdu   _getresp(   u   selfu   line(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu	   _shortcmd˘   s    u   POP3._shortcmdc             C   s   |  j  |  |  j   S(   N(   u   _putcmdu   _getlongresp(   u   selfu   line(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   _longcmdŠ   s    u   POP3._longcmdc             C   s   |  j  S(   N(   u   welcome(   u   self(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu
   getwelcome°   s    u   POP3.getwelcomec             C   s   | |  _  d  S(   N(   u
   _debugging(   u   selfu   level(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   set_debuglevel´   s    u   POP3.set_debuglevelc             C   s   |  j  d |  S(   uV   Send user name, return response

        (should indicate password required).
        u   USER %s(   u	   _shortcmd(   u   selfu   user(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   userş   s    u	   POP3.userc             C   s   |  j  d |  S(   u    Send password, return response

        (response includes message count, mailbox size).

        NB: mailbox is locked by server from here to 'quit()'
        u   PASS %s(   u	   _shortcmd(   u   selfu   pswd(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   pass_Â   s    u
   POP3.pass_c             C   sd   |  j  d  } | j   } |  j r: t d t |   n  t | d  } t | d  } | | f S(   u]   Get mailbox status.

        Result is tuple of 2 ints (message count, mailbox size)
        u   STATu   *stat*i   i   (   u	   _shortcmdu   splitu
   _debuggingu   printu   repru   int(   u   selfu   retvalu   retsu   numMessagesu   sizeMessages(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   statĚ   s    	 u	   POP3.statc             C   s*   | d k	 r |  j d |  S|  j d  S(   u  Request listing, return result.

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

        Result when a message number argument is given is a
        single response: the "scan listing" for that message.
        u   LIST %su   LISTN(   u   Noneu	   _shortcmdu   _longcmd(   u   selfu   which(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   listŮ   s    	u	   POP3.listc             C   s   |  j  d |  S(   uo   Retrieve whole message number 'which'.

        Result is in form ['response', ['line', ...], octets].
        u   RETR %s(   u   _longcmd(   u   selfu   which(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   retrç   s    u	   POP3.retrc             C   s   |  j  d |  S(   uF   Delete message number 'which'.

        Result is 'response'.
        u   DELE %s(   u	   _shortcmd(   u   selfu   which(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   deleď   s    u	   POP3.delec             C   s   |  j  d  S(   uX   Does nothing.

        One supposes the response indicates the server is alive.
        u   NOOP(   u	   _shortcmd(   u   self(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   noop÷   s    u	   POP3.noopc             C   s   |  j  d  S(   u(   Unmark all messages marked for deletion.u   RSET(   u	   _shortcmd(   u   self(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   rset˙   s    u	   POP3.rsetc             C   s   |  j  d  } |  j   | S(   uD   Signoff: commit changes on server, unlock mailbox, close connection.u   QUIT(   u	   _shortcmdu   close(   u   selfu   resp(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   quit  s    
u	   POP3.quitc             C   sR   |  j  d k	 r |  j  j   n  |  j d k	 r> |  j j   n  d |  _  |  _ d S(   u8   Close the connection without assuming anything about it.N(   u   fileu   Noneu   closeu   sock(   u   self(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   close
  s
    u
   POP3.closec             C   s   |  j  d |  S(   u   Not sure what this does.u   RPOP %s(   u	   _shortcmd(   u   selfu   user(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   rpop  s    u	   POP3.rpops   \+OK.*(<[^>]+>)c             C   s   t  | |  j  } |  j j |  j  } | s< t d   n  d d l } | j d  | } | j |  j	   } |  j
 d | | f  S(   u  Authorisation

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

        Args:
                user     - mailbox user;
                password - mailbox password.

        NB: mailbox is locked by server from here to 'quit()'
        u!   -ERR APOP not supported by serveri    Ni   u
   APOP %s %s(   u   bytesu   encodingu	   timestampu   matchu   welcomeu   error_protou   hashlibu   groupu   md5u	   hexdigestu	   _shortcmd(   u   selfu   useru   passwordu   secretu   mu   hashlibu   digest(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   apop  s    u	   POP3.apopc             C   s   |  j  d | | f  S(   u­   Retrieve message header of message number 'which'
        and first 'howmuch' lines of message body.

        Result is in form ['response', ['line', ...], octets].
        u	   TOP %s %s(   u   _longcmd(   u   selfu   whichu   howmuch(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   top3  s    u   POP3.topc             C   s*   | d k	 r |  j d |  S|  j d  S(   uě   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]
        u   UIDL %su   UIDLN(   u   Noneu	   _shortcmdu   _longcmd(   u   selfu   which(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   uidl<  s    u	   POP3.uidlN(%   u   __name__u
   __module__u   __qualname__u   __doc__u   encodingu	   POP3_PORTu   socketu   _GLOBAL_DEFAULT_TIMEOUTu   __init__u   _create_socketu   _putlineu   _putcmdu   _getlineu   _getrespu   _getlongrespu	   _shortcmdu   _longcmdu
   getwelcomeu   set_debuglevelu   useru   pass_u   statu   Noneu   listu   retru   deleu   noopu   rsetu   quitu   closeu   rpopu   reu   compileu	   timestampu   apopu   topu   uidl(   u
   __locals__(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   POP3*   s:   (


	c             B   sD   |  Ee  Z d  Z d Z e d d e j d d d  Z d d   Z	 d S(   u   POP3_SSLu˝  POP3 client class over SSL connection

        Instantiate with: POP3_SSL(hostname, port=995, keyfile=None, certfile=None)

               hostname - the hostname of the pop3 over ssl server
               port - port number
               keyfile - PEM formatted file that contains your private key
               certfile - PEM formatted certificate chain file

        See the methods of the parent class POP3 for more documentation.
        c             C   s   | d  k	 r' | d  k	 r' t d   n  | d  k	 rN | d  k	 rN t d   n  | |  _ | |  _ | |  _ t j |  | | |  d  S(   Nu4   context and keyfile arguments are mutually exclusiveu5   context and certfile arguments are mutually exclusive(   u   Noneu
   ValueErroru   keyfileu   certfileu   contextu   POP3u   __init__(   u   selfu   hostu   portu   keyfileu   certfileu   timeoutu   context(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   __init__Z  s    			u   POP3_SSL.__init__c             C   sU   t  j |  |  } |  j d  k	 r6 |  j j |  } n t j | |  j |  j  } | S(   N(   u   POP3u   _create_socketu   contextu   Noneu   wrap_socketu   sslu   keyfileu   certfile(   u   selfu   timeoutu   sock(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   _create_socketg  s
    u   POP3_SSL._create_socketN(
   u   __name__u
   __module__u   __qualname__u   __doc__u   POP3_SSL_PORTu   Noneu   socketu   _GLOBAL_DEFAULT_TIMEOUTu   __init__u   _create_socket(   u
   __locals__(    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   POP3_SSLM  s   	u   POP3_SSLu   __main__i   i   i   u   Message %d:u      u   -----------------------(%   u   __doc__u   reu   socketu   __all__u	   Exceptionu   error_protou	   POP3_PORTu   POP3_SSL_PORTu   CRu   LFu   CRLFu   _MAXLINEu   POP3u   sslu   ImportErroru   POP3_SSLu   appendu   __name__u   sysu   argvu   au   printu
   getwelcomeu   useru   pass_u   listu   statu   numMsgsu	   totalSizeu   rangeu   iu   retru   headeru   msgu   octetsu   lineu   quit(    (    (    u+   /opt/alt/python33/lib64/python3.3/poplib.pyu   <module>   s@   
˙ "
