N
O5c       sB  d  Z  d Z d Z d Z k Z k Z k Z d e f d     YZ d Z	 d Z
 d Z e
 e Z d	 f  d
     YZ e d j o e e  Z e i   GHe i e  e i e  e i   e i   \ Z Z xd e d e d  d rM Z e i e  \ Z Z Z d Ge Gd GHx e d r 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

Author: David Ascher <david_ascher@brown.edu>
        [heavily stealing from nntplib.py]
Updated: Piers Lauder <piers@cs.su.oz.au> [Jul '97]
s	   localhosts   tests   _passwd_s   error_protoc      s   RS(   N(    (    s0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys   error_proto s    in   s   s   
s   POP3c      s   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
		authorisation 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    sw   | |  _  | |  _ t i t i t i  |  _ |  i i |  i  |  i  |  i i d  |  _	 d |  _
 |  i   |  _ d  S(   Ns   rbi    (   s   hosts   selfs   ports   sockets   AF_INETs   SOCK_STREAMs   socks   connects   makefiles   files
   _debuggings   _getresps   welcome(   s   selfs   hosts   ports0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys   __init__L s    			c    s   |  i i d | t f  d  S(   Ns   %s%s(   s   selfs   socks   sends   lines   CRLF(   s   selfs   lines0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys   _putlineV s    c    s   |  i |  d  S(   N(   s   selfs   _putlines   line(   s   selfs   lines0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys   _putcmd] s    c    s   |  i i   } | o t d   n t |  } | d t j o | d  | f Sn | d t j o | d d !| f Sn | d  | f Sd  S(   Ns   -ERR EOFi   i    i   (	   s   selfs   files   readlines   lines   error_protos   lens   octetss   CRLFs   CR(   s   selfs   lines   octetss0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys   _getlinef s     c    sA   |  i   \ } } | d  } | d j o t |   n | Sd  S(   Ni   s   +(   s   selfs   _getlines   resps   os   cs   error_proto(   s   selfs   resps   os   cs0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys   _getrespx s
    
c    sy   |  i   } g  } d } |  i   \ } } x; | d j o- | | } | i |  |  i   \ } } q- W| | | f Sd  S(   Ni    s   .(	   s   selfs   _getresps   resps   lists   octetss   _getlines   lines   os   append(   s   selfs   resps   lists   octetss   lines   os0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys   _getlongresp s     
c    s   |  i |  |  i   Sd  S(   N(   s   selfs   _putcmds   lines   _getresp(   s   selfs   lines0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys	   _shortcmd s    c    s   |  i |  |  i   Sd  S(   N(   s   selfs   _putcmds   lines   _getlongresp(   s   selfs   lines0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys   _longcmd s    c    s   |  i Sd  S(   N(   s   selfs   welcome(   s   selfs0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys
   getwelcome s    c    s   | |  _ d  S(   N(   s   levels   selfs
   _debugging(   s   selfs   levels0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys   set_debuglevel s    c    s   |  i d |  Sd S(   sL   Send user name, return response
		
		(should indicate password required).
		s   USER %sN(   s   selfs	   _shortcmds   user(   s   selfs   users0   /var/tmp/python-root/usr/lib/python1.5/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   pswds0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys   pass_ s     c    sR   |  i d  } t i |  } t i | d  } t i | d  } | | f Sd S(   sS   Get mailbox status.
		
		Result is tuple of 2 ints (message count, mailbox size)
		s   STATi   i   N(	   s   selfs	   _shortcmds   retvals   strings   splits   retss   atois   numMessagess   sizeMessages(   s   selfs   retvals   retss   numMessagess   sizeMessagess0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys   stat s     c    s-   | o |  i d |  Sn |  i d  Sd S(   s   Request listing, return result.
		Result is in form ['response', ['mesg_num octets', ...]].

		Unsure what the optional 'msg' arg does.
		s   LIST %ss   LISTN(   s   whichs   selfs   _longcmd(   s   selfs   whichs0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys   list s     c    s   |  i d |  Sd S(   sc   Retrieve whole message number 'which'.

		Result is in form ['response', ['line', ...], octets].
		s   RETR %sN(   s   selfs   _longcmds   which(   s   selfs   whichs0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys   retr s     c    s   |  i d |  Sd S(   s:   Delete message number 'which'.

		Result is 'response'.
		s   DELE %sN(   s   selfs	   _shortcmds   which(   s   selfs   whichs0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys   dele s     c    s   |  i d  Sd S(   sN   Does nothing.
		
		One supposes the response indicates the server is alive.
		s   NOOPN(   s   selfs	   _shortcmd(   s   selfs0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys   noop s     c    s   |  i d  Sd S(   s   Not sure what this does.s   RSETN(   s   selfs	   _shortcmd(   s   selfs0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys   rset s     c    sc   y |  i d  } Wn t t  j
 o t } 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   resps0   /var/tmp/python-root/usr/lib/python1.5/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   users0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys   rpop s     s   \+OK.*\(<[^>]+>\)c    s   |  i i |  i  d j o t d   n k } | i |  i i d  |  i	   } t
 i t d   |  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()'
		i    s!   -ERR APOP not supported by serveri   c    s   d t  |   S(   Ns   %02x(   s   ords   x(   s   xs0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys   <lambda>s    s    s
   APOP %s %sN(   s   selfs	   timestamps   matchs   welcomes   error_protos   md5s   news   groups   secrets   digests   strings   joins   maps	   _shortcmds   user(   s   selfs   users   secrets   md5s   digests0   /var/tmp/python-root/usr/lib/python1.5/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   howmuchs0   /var/tmp/python-root/usr/lib/python1.5/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,
		otherwise result is list ['response', ['mesgnum uid', ...], octets]
		s   UIDL %ss   UIDLN(   s   whichs   selfs	   _shortcmds   _longcmd(   s   selfs   whichs0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys   uidl"s     (   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   regexs   compiles	   timestamps   apops   tops   uidl(    s0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys   POP3! s2   ( 
												
										s   __main__i   i    s   Message s   :s      s   -----------------------N(   s   __doc__s
   TESTSERVERs   TESTACCOUNTs   TESTPASSWORDs   regexs   sockets   strings	   Exceptions   error_protos	   POP3_PORTs   CRs   LFs   CRLFs   POP3s   __name__s   as
   getwelcomes   users   pass_s   lists   stats   numMsgss	   totalSizes   ranges   is   retrs   headers   msgs   octetss   lines   quit(    s0   /var/tmp/python-root/usr/lib/python1.5/poplib.pys   ? s6   
 
 	 	