+
     wi9  c                   s   R t ^ RIt^ RIt^ RIt^ RIt ^ RItRtRR.t ! R R]	4      t
^ntRtRtR	t]],           tR
t ! R R4      t]'       d    ! R R]4      t]P'                  R4       ]R8X  Ed   ]! ]P*                  ^,          4      t]! ]P1                  4       4       ]P3                  ]P*                  ^,          4       ]P5                  ]P*                  ^,          4       ]P7                  4        ]P9                  4       w  tt]! ^]^,           4       FG  t ]PC                  ] 4      w  t"t#t$]! R] ,          4       ]# F  t%]! R]%,           4       K  	  ]! R4       KI  	  ]PM                  4        R# R#   ] d    Rt ELii ; i)z@A POP3 client class.

Based on the J. Myers POP3 draft, Jan. 96
NTFPOP3error_protoc                   s    ] tR t^tRtR# )r    N)__name__
__module____qualname____firstlineno____static_attributes__r       /usr/lib64/python3.14/poplib.pyr   r      s    dr   i  s   s   
i   c                   s  a  ] tR t^3t o RtRt]]P                  3R lt	R t
R tR tR tR tR	 tR
 tR tR tR tR tR tR tR"R ltR tR tR tR tR tR tR t]P@                  ! R4      t!R t"R t#R"R lt$R t%R t&R"R  lt'R!t(V t)R# )#r    a  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)
        CAPA                    capa()
        STLS                    stls()
        UTF8                    utf8()

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.
zUTF-8c                s    Wn         W n        R V n        \        P                  ! RWV4       V P                  V4      V n        V P                  P                  R4      V n        ^ V n	        V P                  4       V n        R# )Fzpoplib.connectrbN)hostport_tls_establishedsysaudit_create_socketsockmakefilefile
_debugging_getrespwelcome)selfr   r   timeouts   &&&&r	   __init__ZPOP3.__init__b   sa    		 %		"D5''0	II&&t,	}}r   c                s    Ve   V'       g   \        R4      h\        P                  ! V P                  V P                  3V4      # )Nz0Non-blocking socket (timeout=0) is not supported)
ValueErrorsocketZcreate_connectionr   r   )r   r      &&r	   r   ZPOP3._create_socketm   s6    wOPP''DII(>HHr   c                s    V P                   ^8  d   \        R\        V4      4       \        P                  ! RW4       V P
                  P                  V\        ,           4       R# )   z*put*zpoplib.putlineN)r   printreprr   r   r   ZsendallCRLFr   liner   r	   _putlineZPOP3._putliner   s@    ??QgtDz :		"D/		$+&r   c                s    V P                   '       d   \        R \        V4      4       \        WP                  4      p\
        P                  ! RV4      '       d   \        R4      hV P                  V4       R# )z*cmd*s   [ -]z*Control characters not allowed in commandsN)	r   r   r   bytesencodingreZsearchr   r#   r!   r   r	   _putcmdZPOP3._putcmdz   sP    ???E'4:6T==)99'..IJJdr   c                s~   V P                   P                  \        ^,           4      p\        V4      \        8  d   \	        R4      hV P
                  ^8  d   \        R\        V4      4       V'       g   \	        R4      h\        V4      pVRR \        8X  d   VRR V3# VR,          \        8X  d   V^R V3# VRR V3# )r   zline too longz*get*z-ERR EOFN:Nr   Nii)
r   Zreadline_MAXLINElenr   r   r   r   r    CR)r   r"   octets   &  r	   _getlineZPOP3._getline   s    yy!!(Q,/t9xo..??QgtDz :;z22T 99f$$8r>":v%%CRy&  r   c                s    V P                  4       w  rV P                  ^8  d   \        R\        V4      4       VP	                  R4      '       g   \        V4      hV# )r   z*resp*s   +)r-   r   r   r   
startswithr   )r   respor,   r	   r   ZPOP3._getresp   sG    --/??QhT
 ;t$$d##r   c                s   V P                  4       p. p^ pV P                  4       w  rEVR8w  dW   VP                  R4      '       d   V^,
          pVR,          pW5,           pVP                  V4       V P                  4       w  rEK]  WV3# )i    s   .s   ..r   NN)r   r-   r.   append)r   r/   listr+   r"   r0   s   &     r	   _getlongrespZPOP3._getlongresp   sx    }}A6--/dlu%%aCBxZFKKmmoGD!6!!r   c                D    V P                  V4       V P                  4       # N)r'   r   r!   r   r	   	_shortcmdZPOP3._shortcmd   s    T}}r   c                r5   r6   )r'   r4   r!   r   r	   _longcmdZPOP3._longcmd   s    T  ""r   c                s    V P                   # r6   )r   r      &r	   
getwelcomeZPOP3.getwelcome   s    ||r   c                s    Wn         R # r6   )r   )r   Zlevelr   r	   set_debuglevelZPOP3.set_debuglevel   s    r   c                2    V P                  RV,          4      # )zFSend user name, return response

(should indicate password required).
zUSER %sr7   r   userr   r	   r@   Z	POP3.user   s    
 ~~i$.//r   c                r=   )zSend password, return response

(response includes message count, mailbox size).

NB: mailbox is locked by server from here to 'quit()'
zPASS %sr>   )r   Zpswdr   r	   pass_Z
POP3.pass_   s     ~~i$.//r   c                sL   V P                  R4      pVP                  4       pV P                  '       d   \        R\	        V4      4       \        V4      ^8  d   \        R4      h \        V^,          4      p\        V^,          4      pW43#   \         d    \        R4      hi ; i)zMGet mailbox status.

Result is tuple of 2 ints (message count, mailbox size)
ZSTATz*stat*zInvalid STAT response formatz.Invalid STAT response data: non-numeric values)	r7   splitr   r   r   r)   r   Zintr   )r   ZretvalZretsZnumMessagesZsizeMessagess   &    r	   statZ	POP3.stat   s    
 '||~???E(DJ7
 t9q=<==	Pd1g,KtAw<L **  	PNOO	Ps   %$B B#Nc                \    Ve   V P                  RV,          4      # V P                  R4      # )zRequest 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.
zLIST %sZLISTr7   r8   r   whichr   r	   r3   Z	POP3.list   s-     >>)e"344}}V$$r   c                r=   )z_Retrieve whole message number 'which'.

Result is in form ['response', ['line', ...], octets].
zRETR %sr8   rF   r   r	   retrZ	POP3.retr  s    
 }}Y.//r   c                r=   )z6Delete message number 'which'.

Result is 'response'.
zDELE %sr>   rF   r   r	   deleZ	POP3.dele  s    
 ~~i%/00r   c                $    V P                  R4      # )zHDoes nothing.

One supposes the response indicates the server is alive.
ZNOOPr>   r9   r:   r	   noopZ	POP3.noop  s    
 ~~f%%r   c                rK   )z(Unmark all messages marked for deletion.ZRSETr>   r9   r:   r	   rsetZ	POP3.rset  s    ~~f%%r   c                sH    V P                  R4      pV P                  4        V# )zDSignoff: commit changes on server, unlock mailbox, close connection.ZQUIT)r7   close)r   r/      & r	   quitZ	POP3.quit"  s    ~~f%

r   c                s     V P                   pRV n         Ve   VP                  4        V P                  pRV n        Ve3    VP                  \        P
                  4       VP                  4        R# R#   \         d=   pTP                  \        P                  8w  d   \        TR^ 4      R8w  d   h  Rp?LVRp?ii ; i  TP                  4        i ; i  T P                  pRT n        Te    TP                  \        P
                  4       MJ  \         d=   pTP                  \        P                  8w  d   \        TR^ 4      R8w  d   h  Rp?MRp?ii ; iTP                  4        i   TP                  4        i ; ii ; i)z8Close the connection without assuming anything about it.NZwinerrori&'  )
r   rN   r   Zshutdownr   Z	SHUT_RDWRZOSErrorerrnoZENOTCONNZgetattr)r   r   r   Zexcs   &   r	   rN   Z
POP3.close(  s)   	!99DDI

99DDI
!MM&"2"23 JJL     		U^^3"3
A6%? JJL 99DDI
!MM&"2"23  		U^^3"3
A6%? JJLDJJL  sq   'C A4 4B;?2B61B> 6B;;B> >CE=,DE'E2E	E'EE'E='E99E=c                r=   )z?Send RPOP command to access the mailbox with an alternate user.zRPOP %sr>   r?   r   r	   rpopZ	POP3.rpopD  s    ~~i$.//r   s   \+OK.[^<]*(<.*>)c                sD   \        W P                  4      pV P                  P                  V P                  4      pV'       g   \        R4      h^ RIpVP                  ^4      V,           pVP                  V4      P                  4       pV P                  RV: RV: 24      # )zAuthorisation

- 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()'
z!-ERR APOP not supported by serverNzAPOP  )r$   r%   	timestampZmatchr   r   hashlibZgroupZmd5Z	hexdigestr7   )r   r@   ZpasswordZsecretZmrU   Zdigests   &&&    r	   apopZ	POP3.apopK  sy     x/NN  .ABBF"V$..0~~dF;<<r   c                s4    V P                  RV: RV: 24      # )zRetrieve message header of message number 'which'
and first 'howmuch' lines of message body.

Result is in form ['response', ['line', ...], octets].
zTOP rS   rH   )r   rG   Zhowmuchs   &&&r	   topZPOP3.top`  s     }}E7;<<r   c                rD   )zReturn 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]
zUIDL %sZUIDLrE   rF   r   r	   uidlZ	POP3.uidli  s-     >>)e"344}}V$$r   c                rK   )zITry to enter UTF-8 mode (see RFC 6856). Returns server response.
        ZUTF8r>   r9   r:   r	   utf8Z	POP3.utf8u  s     ~~f%%r   c                s    R p/ p V P                  R4      pV^,          pV F  pV! V4      w  rgWrV&   K  	  V#   \         d    \        R4      hi ; i)a  Return server capabilities (RFC 2449) as a dictionary
>>> c=poplib.POP3('localhost')
>>> c.capa()
{'IMPLEMENTATION': ['Cyrus', 'POP3', 'server', 'v2.2.12'],
 'TOP': [], 'LOGIN-DELAY': ['0'], 'AUTH-RESP-CODE': [],
 'EXPIRE': ['NEVER'], 'USER': [], 'STLS': [], 'PIPELINING': [],
 'UIDL': [], 'RESP-CODES': []}
>>>

Really, according to RFC 2449, the cyrus folks should avoid
having the implementation split into multiple arguments...
c                 sd    V P                  R 4      P                  4       pV^ ,          VR,          3# )Zasciir1   )ZdecoderB   )r"   ZlstrO   r	   	_parsecapZPOP3.capa.<locals>._parsecap  s+    ++g&,,.Cq63r7?"r   ZCAPAz!-ERR CAPA not supported by server)r8   r   )r   rZ   capsr/   ZrawcapsZcaplineZcapnmZcapargss   &       r	   capaZ	POP3.capa{  sn    	# 	C==(D1gG"!*7!3%U #
   	CABB	Cs	   1: Ac                s   \         '       g   \        R4      hV P                  '       d   \        R4      hV P                  4       pRV9   g   \        R4      hVf   \        P
                  ! 4       pV P                  R4      pVP                  V P                  V P                  R7      V n        V P                  P                  R4      V n        RV n        V# )zcStart a TLS session on the active connection as specified in RFC 2595.

context - a ssl.SSLContext
z-ERR TLS support missing$-ERR TLS session already establishedZSTLSz!-ERR STLS not supported by serverZserver_hostnamer
   T)HAVE_SSLr   r   r\   ssl_create_stdlib_contextr7   wrap_socketr   r   r   r   )r   contextr[   r/   s   &&  r	   stlsZ	POP3.stls  s    
 x899   DEEyy{~ABB?002G~~f%''		8<		 ( C	II&&t,	 $r   )r   r   r   r   r   r   r   r6   )*r   r   r   r   __doc__r%   	POP3_PORTr   _GLOBAL_DEFAULT_TIMEOUTr   r   r#   r'   r-   r   r4   r7   r8   r;   r<   r@   rA   rC   r3   rI   rJ   rL   rM   rP   rN   rR   r&   ZcompilerT   rV   rW   rX   rY   r\   rd   r   __classdictcell__Z__classdict__   @r	   r    r    3   s     )V H"+77	'I
'!*" # 00+0%01&&
!80
 

/0I=*=	%&: r   c                   s`   a  ] tR tRt o Rt]3R]P                  RR/R lltR t	R
R lt
R	tV tR# )POP3_SSLi  a  POP3 client class over SSL connection

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

       hostname - the hostname of the pop3 over ssl server
       port - port number
       context - a ssl.SSLContext

See the methods of the parent class POP3 for more documentation.
r   rc   Nc               sp    Vf   \         P                  ! 4       pW@n        \        P	                  WW#4       R # r6   )r`   ra   rc   r    r   )r   r   r   r   rc   s   &&&$$r	   r   ZPOP3_SSL.__init__  s(    446"LMM$d4r   c                s~    \         P                  W4      pV P                  P                  VV P                  R 7      pV# )r^   )r    r   rc   rb   r   )r   r   r   s   && r	   r   ZPOP3_SSL._create_socket  s:    &&t5D<<++D<@II , GDKr   c                s    \        R4      h)zThe method unconditionally raises an exception since the
STLS command doesn't make any sense on an already established
SSL/TLS session.
r]   )r   )r   rc   r   r	   rd   ZPOP3_SSL.stls  s    
 DEEr   )rc   r6   )r   r   r   r   re   POP3_SSL_PORTr   rg   r   r   rd   r   rh   ri   rj   r	   rk   rk     s;     		 '4 	5 & > >	5HL	5		F 	Fr   rk   Z__main__zMessage %d:z   z-----------------------)'re   rQ   r&   r   r   r`   r_   ZImportErrorZ__all__Z	Exceptionr   rf   rl   r*   ZLFr    r(   r    rk   r2   r   ZargvZar   r;   r@   rA   r3   rC   ZnumMsgsZ	totalSizeZrangeZirI   ZheaderZmsgr+   r"   rP   r   r   r	   <module>rm      sy    	  
H -
  #) " 	  
	"u x xv F4 F@ NN:zSXXa[A	!,,.FF388A;GGCHHQKFFH668Wi1gk" !q	fma D%$, '( # FFH u  Hs   E7 7	FF