ó ÄAic @ sŤ d Z d d l Z d d l Z d d g Z d e f d YZ d Z d Z d Z d Z e e Z d Z d f d YZ y d d l Z Wn e k r n$ Xd e f d YZ e j d e d k r§d d l Z e e j d Z e j GHe j e j d e j e j d e j e j \ Z Z x[ e d e d D]F Z e j e \ Z Z Z! d e GHx e D] Z" d e" GHq~Wd GHqPWe j# n d S( s@ A POP3 client class. Based on the J. Myers POP3 draft, Jan. 96 i˙˙˙˙Nt POP3t error_protoc B s e Z RS( ( t __name__t __module__( ( ( s /usr/lib64/python2.7/poplib.pyR s in iă s s i c B sű e Z d Z e e j 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 Z d Z d Z d Z d Z d Z d Z e j d Z d Z d Z d 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 C s^ | | _ | | _ t j | | f | | _ | j j d | _ d | _ | j | _ d S( Nt rbi ( t hostt portt sockett create_connectiont sockt makefilet filet _debuggingt _getrespt welcome( t selfR R t timeout( ( s /usr/lib64/python2.7/poplib.pyt __init__U s c C s? | j d k r! d Gt | GHn | j j d | t f d S( Ni s *put*s %s%s( R t reprR t sendallt CRLF( R t line( ( s /usr/lib64/python2.7/poplib.pyt _putline_ s c C s, | j r d Gt | GHn | j | d S( Ns *cmd*( R R R ( R R ( ( s /usr/lib64/python2.7/poplib.pyt _putcmdf s c C sĆ | j j t d } t | t k r7 t d n | j d k rX d Gt | GHn | sm t d n t | } | d t k r | d | f S| d t k r¸ | d d !| f S| d | f S( Ni s line too longs *get*s -ERR EOFiţ˙˙˙i i˙˙˙˙( R t readlinet _MAXLINEt lenR R R R t CR( R R t octets( ( s /usr/lib64/python2.7/poplib.pyt _getlineo s c C s\ | j \ } } | j d k r3 d Gt | GHn | d } | d k rX t | n | S( Ni s *resp*t +( R R R R ( R t respt ot c( ( s /usr/lib64/python2.7/poplib.pyR s c C s | j } g } d } | j \ } } x` | d k r | d d k r` | d } | d } n | | } | j | | j \ } } q- W| | | f S( Ni t .i s ..i ( R R t append( R R t listR R R ( ( s /usr/lib64/python2.7/poplib.pyt _getlongresp s c C s | j | | j S( N( R R ( R R ( ( s /usr/lib64/python2.7/poplib.pyt _shortcmd s c C s | j | | j S( N( R R% ( R R ( ( s /usr/lib64/python2.7/poplib.pyt _longcmdĽ s c C s | j S( N( R ( R ( ( s /usr/lib64/python2.7/poplib.pyt getwelcomeŹ s c C s | | _ d S( N( R ( R t level( ( s /usr/lib64/python2.7/poplib.pyt set_debuglevel° s c C s | j d | S( sV Send user name, return response (should indicate password required). s USER %s( R&