
+Fc           @   s*  d  Z  d d k Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k	 Z	 d d k
 Z
 d d k Z d d k Te i Z e i Z d Z d Z d e f d     YZ d e f d	     YZ d
 e f d     YZ d e f d     YZ d e f d     YZ d e d  Z d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e  f d     YZ! d  e  f d!     YZ" d" e# f d#     YZ$ d$ e f d%     YZ% d&   Z& d'   Z' d(   Z( d S()   s)   networked spam-signature detection clientiN(   t   *s6   $Id: client.py,v 1.48 2003/02/01 10:29:42 ftobin Exp $s   /dev/randomt   Clientc           B   s   e  Z d  d d g 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 d  Z d   Z RS(   t   sockett   outputt   accountsi   i    c         C   s6   t  i  t  i t  | |  _ t   |  _ |  i   d  S(   N(   t   signalt   SIGALRMt   handle_timeoutR   t   OutputR   t   build_socket(   t   selfR   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyt   __init__   s    	c         C   s,   t    } |  i | |  |  i | i    S(   N(   t   PingRequestt   sendt   read_responset
   get_thread(   R
   t   addresst   msg(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyt   ping#   s    	c         C   s/   t  |  } |  i | |  |  i | i    S(   N(   t   InfoRequestR   R   R   (   R
   t   digestR   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyt   info(   s    c         C   s2   t  | |  } |  i | |  |  i | i    S(   N(   t   ReportRequestR   R   R   (   R
   R   t   specR   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyt   report-   s    c         C   s2   t  | |  } |  i | |  |  i | i    S(   N(   t   WhitelistRequestR   R   R   (   R
   R   R   R   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyt	   whitelist2   s    c         C   s/   t  |  } |  i | |  |  i | i    S(   N(   t   CheckRequestR   R   R   (   R
   R   R   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyt   check7   s    c         C   s   t  i  t  i t  i  |  _  d  S(   N(   R   t   AF_INETt
   SOCK_DGRAM(   R
   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR	   <   s    c         C   so   | i    |  i | } t t i | i | i i |   } |  i i	 d t
 |   |  i i | d |  d  S(   Ns   sending: %si    (   t   init_for_sendingR   t   strt   MacEnvelopet   wrapt   usernamet   keystufft   keyR   t   debugt   reprR   t   sendto(   R
   R   R   t   accountt   mac_msg_str(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR   ?   s    
	c         C   s   |  i  |  i i |  i f  S(   N(   t	   time_callR   t   recvfromt   max_packet_size(   R
   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyt   recvI   s    c         C   sP   | d  j o
 h  } n t i |  i  z t | | |  SWd  t i d  Xd  S(   Ni    (   t   NoneR   t   alarmt   timeoutt   apply(   R
   t   callt   varargst   kwargs(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR+   M   s     
c         C   s   |  i    \ } } |  i i d t |   t t i |   } | i   y_ | i   } | | j oB | i	   o t
 d | | f  q |  i i d | | f  n Wn# t j
 o |  i i d  n X| S(   Ns   received: %ss.   received unexpected thread id %d (expected %d)s)   received error thread id %d (expected %d)s   no thread id received(   R.   R   R&   R'   t   Responset	   cStringIOt   StringIOt   ensure_completeR   t   in_ok_ranget   ProtocolErrort   warnt   KeyError(   R
   t	   expect_idt   packetR   R   t	   thread_id(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR   U   s     
(    N(   t   __name__t
   __module__t	   __slots__R1   R-   R   R   R   R   R   R   R	   R   R.   R/   R+   R   (    (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR      s   								
	t
   ServerListc           B   s   e  Z d  Z d   Z RS(   s9   http://pyzor.sourceforge.net/cgi-bin/inform-servers-0-3-xc         C   s\   xU | D]M } | } | i    } | o. | i d  o |  i t i i |   q q Wd  S(   Nt   #(   t   stript
   startswitht   appendt   pyzort   Addresst   from_str(   R
   t
   serverfilet   linet	   orig_line(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyt   readp   s     (   RA   RB   t
   inform_urlRO   (    (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyRD   m   s   t   ExecCallc           B   s  e  Z d  d d g Z e d d g  Z d   Z d d  Z d   Z d	   Z	 d
   Z
 d   Z d   Z d   Z d   Z d   Z d   Z d   Z e e  Z d   Z e e  Z h  e
 d <e d <e d <e d <e	 d <e d <e d <e d <d d <Z RS(   t   clientt   serversR   i   i   i<   c         C   sr  d } d  } d  } d  } y, t i t i d d d d g  \ } } Wn  t i j
 o |  i   n Xt |  d j  o |  i   n xY | D]Q \ } } | d j o
 d } q | d j o
 | } q | d j o
 d } q q Wt d	 |  |  _ t	 i
 |  } | o> t | d
 d  t _ t i i d t t i    d  n t	 i |  }	 |	 i d  h  d d <t i d <d d <t t i  d <}
 x- |
 i   D] \ } } |	 i d | |  qW|	 i t i i | d   |	 i d d  } |	 i d d  t _ t i i |  p t i  |  n | d } t i i |  p | d j o= t i i d |	 i! d d   t" |	 i! d d  |  n |  i# |  |  _$ t |  i% |	 i d d    |  _& |  i' i( |  p |  i   n |  i' | } | d  j	 ob y+ t) | |  | f  p t i* d  n Wqnt+ j
 o$ t i i d  t i* d  qnXn d  S(   Ni    i   t   ds   homedir=t   logs   -ds	   --homedirs   --logR&   s
   /pyzor.logt   as   
pyzor[s   ]:
RR   RS   t   ServersFilet   DiscoverServersURLR   t   AccountsFilet   Timeoutt   configt   discovers   downloading servers from %s
s   timeout from server
(,   R/   t   getoptt   syst   argvt   GetoptErrort   usaget   lenR   R   RI   t   get_homedirt   opent   stderrt   writeR'   t   ost   getpidt   Configt   add_sectionRD   RP   R    R   R1   t   itemst   setRO   t   patht   joint   get_filenamet   getintt   existst   mkdirt   gett   downloadt   get_serversRS   t   get_accountsRR   t
   dispatchest   has_keyR2   t   exitt   TimeoutError(   R
   R&   t   specified_homedirt   optionsRU   t   argst   ot   vt   homedirR[   t   defaultst   kt
   servers_fnt   commandt   dispatch(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyt   run   sn    , 

(	 
!c         C   sQ   | d  j	 o t i i d |  n t i i d t i d  t i d  d  S(   Ns   %s
s   
usage: %s [-d] [--homedir dir] command [cmd_opts]
command is one of: check, report, discover, ping, digest, predigest,
                   genkey

Data is read on standard input (stdin).

i    i   (   R/   R^   Re   Rf   R_   Ry   (   R
   t   s(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyRa      s    	c         C   s   y t  i  | d d  Wn+ t  i j
 o |  i d | d  n Xt |  i i  } x$ |  i D] } | i | | f  qb W| i S(   Ni   t    s)   %s does not take any non-option argumentsi    (	   R]   R`   Ra   t   ClientRunnerRR   R   RS   R   t   all_ok(   R
   R}   t   runnert   server(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR      s    
 c         C   s  y& t  i  | d d d g  \ } } Wn+ t  i j
 o |  i d | d  n Xd } x+ | D]# \ } } | d j o
 d } qa qa Wt |  i i  } x` t t i |  i	 |  D]F } | d  j o q n x) |  i D] }	 | i |	 | |	 f  }
 q Wq Wt S(   Ni   R   t   mboxs)   %s does not take any non-option argumentsi    R   s   --mbox(   R]   R`   Ra   t   InfoClientRunnerRR   R   t   get_input_handlerR^   t   stdint   digest_specR/   RS   R   t   True(   R
   R}   R|   t   args2t   do_mboxR~   R   R   R   R   t   response(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR      s$    &  
  c   
      C   s  y& t  i  | d d d g  \ } } Wn+ t  i j
 o |  i d | d  n Xd } x+ | D]# \ } } | d j o
 d } qa qa Wt |  i i  } x^ t t i |  i	 |  D]D } | d  j o q n x' |  i D] }	 | i |	 | |	 f  q Wq W| i o | i S(   Ni   R   R   s)   %s does not take any non-option argumentsi    R   s   --mbox(   R]   R`   Ra   t   CheckClientRunnerRR   R   R   R^   R   R   R/   RS   R   t	   found_hitt   whitelisted(
   R
   R}   R|   R   R   R~   R   R   R   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR      s$    &  
 c   	      C   s   y& t  i  | d d d g  \ } } Wn+ t  i j
 o |  i d | d  n Xd } x+ | D]# \ } } | d j o
 d } qa qa Wt } x] t t i |  i |  D]C } | d  j o q n |  i	 | |  i |  i
 i  p
 t } q q W| S(   Ni   R   R   s)   %s does not take any non-option argumentsi    R   s   --mbox(   R]   R`   Ra   R   R   R^   R   R   R/   t   send_digestRR   R   t   False(	   R
   R}   R|   R   R   R~   R   R   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s$    &  c         C   sb   | d j o d Sn t | t  t |  } x* |  i D] } | i | | | | f  q8 W| i S(   s*   digest can be none; if so, nothing is sentN(   R/   t	   typecheckt
   DataDigestR   RS   R   R   (   R
   R   R   t   client_methodR   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR   /  s    
 c   	      C   s   y& t  i  | d d d g  \ } } Wn+ t  i j
 o |  i d | d  n Xd } x+ | D]# \ } } | d j o
 d } qa qa Wt } x] t t i |  i |  D]C } | d  j o q n |  i	 | |  i |  i
 i  p
 t } q q W| S(   Ni   R   R   s)   %s does not take any non-option argumentsi    R   s   --mbox(   R]   R`   Ra   R   R   R^   R   R   R/   R   RR   R   R   (	   R
   R}   R|   R   R   R~   R   R   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR   =  s$    &  c      
   C   s   y& t  i  | d d d g  \ } } Wn+ t  i j
 o |  i d | d  n Xd } x+ | D]# \ } } | d j o
 d } qa qa WxH t t i |  i |  D]. } | d  j o q n t i i	 d |  q Wt
 S(	   Ni   R   R   s)   %s does not take any non-option argumentsi    R   s   --mboxs   %s
(   R]   R`   Ra   R   R^   R   R   R/   t   stdoutRf   R   (   R
   R}   R|   R   R   R~   R   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR   U  s    &  c            s~   y t  i  | d d  Wn+ t  i j
 o   i d | d  n Xd     f d   } t t   h  t d <|  t S(   Ni   R   s)   %s does not take any non-option argumentsi    R   c             s'   x  t  t i  i    D] }  q Wd  S(   N(   R   R^   R   R   (   R   (   R   R
   (    s1   /var/lib/python-support/python2.5/pyzor/client.pyt   loopq  s     t   DataDigester(   R]   R`   Ra   t   modglobal_applyt   globalst   PrintingDataDigesterR   (   R
   R}   R   (    (   R
   R   s1   /var/lib/python-support/python2.5/pyzor/client.pyt   print_digestedi  s    c   	   	   C   s4  y t  i  | d d  Wn+ t  i j
 o |  i d | d  n Xd d  k } | i d d  } | i d d  } | | j o t i i d	  d Sn ~ t t  } | i	 t
 i  } ~ t
 i |  } t
 i   } | i | i    | i |  t i i d
  t i i d | i   | i   f  t S(   Ni   R   s)   %s does not take any non-option argumentsi    it   prompts   Enter passphrase: s   Enter passphrase again: s   Passwords do not match.
s
   salt,key:
s   %s,%s
(   R]   R`   Ra   t   getpassR^   Re   Rf   Rd   t   randfileRO   t   shat   digest_sizet   newt   updateR   R   t	   hexdigestR   (	   R
   R}   R   t   p1t   p2t   saltfilet   saltt   salt_digestt   pass_digest(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyt   genkeyz  s,    c         C   sT   t    } | i t |    t |  d j o! t i i d  t i d  n | S(   Ni    s8   No servers available!  Maybe try the 'discover' command
i   (   RD   RO   Rd   Rb   R^   Re   Rf   Ry   (   R   RS   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyRu     s    	c         C   sQ   t    } t i i |   o1 x. t t |    D] \ } } | | | <q/ Wn | S(   N(   t   AccountsDictRg   Rm   Rq   RY   Rd   (   t   accounts_fnR   R   R)   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyRv     s    	 R   R   R   R   R   R   R   t	   predigestR\   (   i   i   (   i<   i   N(   RA   RB   RC   t   DataDigestSpecR   R   R/   Ra   R   R   R   R   R   R   R   R   R   Ru   t   staticmethodRv   Rw   (    (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyRQ   y   s4   	L																			R   c           B   s   e  Z d  Z d d d d d g Z d Z d Z e i d  Z e i d	 e i	  Z
 e i d
  Z e i d  Z e i d  Z d Z e d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z e e  Z d   Z e e  Z RS(   s   The major workhouse classt   _atomict   _valuet
   _used_linet   _digestt   seekablei   i   s   \S+@\S+s
   [a-z]+:\S+s   \S{10,}s   <.*?>s   \sR   c         C   s   d  |  _ d  |  _ d  |  _ | |  _ |  i |  \ } } t |  d j o d  Sn t i   |  _	 t |  |  i
 j o |  i |  n |  i | | |  t |  i	 i    |  _ |  i d  j	 p t  |  i d  j	 p t  d  S(   Ni    (   R/   R   R   R   R   t   get_line_offsetsRb   R   R   R   t   atomic_num_linest   handle_atomict   handle_piecedR   R   t   AssertionError(   R
   t   fpR   R   t   offsets(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s    				c         C   sF   t  |  _ y/ | i d  x | D] } |  i |  q  WWn n Xd S(   s   we digest everythingi    N(   R   R   t   seekt   handle_line(   R
   R   RM   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s    	 c   	      C   s   t  |  _ x | D] \ } } d | j o
 d j  n p t  | t | t |  d  } | i |  x9 t |  D]+ } | i   } | p Pn |  i |  qy Wq Wd  S(   Ni    id   g      Y@(	   R   R   R   t   intRb   R   t   ranget   readlineR   (	   R
   R   R   R   t   perc_offsett   lengtht   offsett   iRM   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s    	 % c   	      C   s   |  i  o | i   } d } n d } t i   } g  } x | D] } |  i |  } |  i |  } | o | i |  n d } |  i  o t |  } n/ | o' | d 7} t |  } | i	 |  n | | 7} q? W|  i  p
 | } n | | f S(   s   return tuple of (fp2, line offsets)
        If we are not seekable, fp will be copied into a tempfile,
        and fp2 is hence re-usable.
        If we are not seekable, we also normalize the lines while
        copying them into the tempfile.
        i    s   
N(
   R   t   tellR/   t   tempfilet   TemporaryFilet	   normalizet   should_handle_lineRH   Rb   Rf   (	   R
   R   t
   cur_offsett   newfpR   RM   t   normt   should_handlet   moved(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s.    

 	



c         C   s:   |  i  o |  i |  } n | i   } |  i |  d  S(   N(   R   R   t   rstript   _really_handle_buf(   R
   RM   t   buf(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR   E  s    
c         C   s   |  i  i |  d  S(   N(   R   R   (   R
   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR   P  s    c         C   s*   |  i  d  j o t d  n t |  i   S(   Ns   digest not calculated yet(   R   R/   t   RuntimeErrort   bool(   R
   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyt	   is_atomicS  s    c         C   s   |  i  S(   N(   R   (   R
   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyt
   get_digestX  s    c         C   s|   |  i  } | } |  i i | |  } |  i i | |  } |  i i | |  } |  i i | |  } |  i i d |  } | S(   NR   (   t   unwanted_txt_replt
   email_ptrnt   subt   url_ptrnt   longstr_ptrnt   html_tag_ptrnt   ws_ptrn(   R
   R   t   replt   s2(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR   [  s    	c         C   s   t  |  i t |  j  S(   N(   R   t   min_line_lengthRb   (   R
   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR   h  s    (   RA   RB   t   __doc__RC   R   R   t   ret   compileR   t
   IGNORECASER   R   R   R   R   R   R   R   R   R   R   R   R   R   R   t   classmethodR   (    (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s.   				2						R   c           B   s   e  Z d  Z d   Z RS(   s5   extends DataDigester: prints out what we're digestingc         C   s.   t  i i d |  t t |   i |  d  S(   Ns   %s
(   R^   R   Rf   t   superR   R   (   R
   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR   q  s    (   RA   RB   R   R   (    (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR   n  s   R   c         C   s   | d j o/ t  d   t t |   | |  i   f  Sn: | d j o t |  |  Sn | d j o t |   Sn t d  d S(   sv   Return an object that can be iterated over
    to get all the digests from fp according to spec.
    mbox is a booleanR   c         S   s
   |  d  j	 S(   N(   R/   (   t   x(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyt   <lambda>|  s    R   t   digestss   unknown input styleN(   t   filterR   t   rfc822BodyCleanerR   t   MailboxDigestert   JustDigestsIteratort
   ValueError(   R   R   t   styleR   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR   w  s    	R   c           B   s#   e  Z d  g Z d   Z d   Z RS(   R   c         C   s   | |  _  d  S(   N(   R   (   R
   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s    c         C   s'   t  i   } | p
 t  n | i   S(   N(   R   R   t   StopIterationR   (   R
   t   l(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyt   next  s    
(   RA   RB   RC   R   R   (    (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s   		R   c           B   s,   e  Z d  d d g Z e d  Z d   Z RS(   R   R   R   c         C   s7   d d  k  } | i | t  |  _ | |  _ | |  _ d  S(   Ni(   t   mailboxt   PortableUnixMailboxR   R   R   R   (   R
   R   R   R   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s
    		c         C   so   y |  i  i   } Wn# t j
 o d GHd GHd  } n X| d  j o
 t  n t | |  i d |  i i   S(   Ns2   Error: Please feed mailbox files in on stdin, i.e.s&       pyzor digest --mbox < my_mbox_fileR   (	   R   R   t   IOErrorR/   R   R   R   R   R   (   R
   t   next_msg(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s    
(   RA   RB   RC   R   R   R   (    (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s   R   c           B   s5   e  Z d  d d d g Z d   Z d   Z d   Z RS(   R   t	   multifilet   curfilet   typec         C   s  t  i | d d } | i   |  _ d  |  _ d  |  _ | i d  o@ |  i d j o0 | i d j o  | i	   d j o d |  _ n |  i d j o d |  _ n |  i d j o| i	   } | i
 |  _ | d j o | d	 j o
 d
 } n d d  k } t i   |  _ y t  i | i
 |  i |  Wnd | i j
 o5 } t i i d | i | f  t i   |  _ n" t j
 o } | i
 |  _ n Xy |  i i d  WqqXqZn |  i d j o yZ t i | i
 d t |  _ |  i i | i d   |  i i   |  i |  i  |  _ WqZt t t i f j
 o | i
 |  _ d |  _ qZXn |  i d j p |  i d j o |  i d  j	 p t  nP |  i d j o( y | i d  Wn n X| |  _ n |  i d  j p t  d  S(   NR   i    t   Fromt   textt   plaint   7bitt   binaryR   t   8bitst   8bitis   %s: %s
t	   multipartt   boundary(    t	   mimetoolst   Messaget   getmaintypeR  R/   R   R   Rx   t   subtypet   getencodingR   t   binasciiR   R   t   decodet   ErrorR^   Re   Rf   t	   __class__R7   R8   R   R   t	   MultiFileR   t   pusht   getparamR   t	   TypeErrort   AttributeErrorR   (   R
   R   R   t   encodingR  t   e(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     sZ    		D
 c         C   s   d } yt |  i  d j o |  i i   } n |  i  d j o= | o5 |  i i   o% |  i |  i  |  _ |  i   } n Wn t t t i f j
 o n X| S(   NR   R  R	  R  (   s   texts	   multiparts   binary(	   R  R   R   R   R   R  R  R  R  (   R
   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s    (c         C   sc   y |  i    } Wn; t i j
 o, } t i i d | i | f  t  n X| p
 t  n | S(   Ns   %s: %s
(   R   R   R  R^   Re   Rf   R  R   (   R
   R   R  (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR      s    
(   RA   RB   RC   R   R   R   (    (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s   	?	R   c           B   s;   e  Z d  d g Z d   Z d   Z d d  Z d   Z RS(   t   routineR   c         C   s   | |  _  |  i   d  S(   N(   R  t   setup(   R
   R  (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s    	c         C   s   t  |  _ d  S(   N(   R   R   (   R
   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR    s    c         C   s   | d  j o
 h  } n d t |  } d  } y) t |  i | |  } |  i | |  WnK t t t f j
 o6 } t i	 i
 | d | i i | f  t |  _ n Xd  S(   Ns   %s	s   %s: %s
(   R/   R    R2   R  t   handle_responset	   CommErrorR=   R   R^   Re   Rf   R  RA   R   R   (   R
   R   R4   R5   t   messageR   R  (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s    
c         C   sB   | i    p t |  _ n t i i | t | i    d  d S(   s)   mesaage is a string we've built up so fars   
N(   t   is_okR   R   R^   R   Rf   R    t
   head_tuple(   R
   R   R  (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR  $  s    	N(   RA   RB   RC   R   R  R/   R   R  (    (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s
   		R   c           B   s,   e  Z d  d g Z d Z d   Z d   Z RS(   R   R   i   c         C   s)   t  |  _ t  |  _ t t |   i   d  S(   N(   R   R   R   R   R   R  (   R
   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR  4  s    		c         C   s   | d t  | i    7} | i   o t | d  } | d j o d } t |  _ n+ t | d  } | d j o t |  _ n | d | | f 7} t i i	 | d  n t i
 i	 |  d  S(   Ns   %s	s   WL-Counti    t   Counts   %d	%ds   
(   R    R!  R   R   R   R   R   R^   R   Rf   Re   (   R
   R   R  t   wl_countt   count(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR  9  s    (   RA   RB   RC   t   wl_count_clearsR  R  (    (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR   -  s   	R   c           B   s   e  Z d    Z RS(   c         C   s  | d t  | i    7} | i   o t | d  } | d | 7} | d j o x d D] } | i |  ow t | |  } | d	 j o
 d
 } n t i |  } | d j o | d t | d  7} n | d | | f 7} qY qY Wn t i i	 |  n t i
 i	 |  d  S(   Ns   %s
R"  s   	Count: %d
i    t   Enteredt   Updateds
   WL-Entereds
   WL-Updatedit   Nevers   	WhiteList Count: %d
s   WL-Counts   	%s: %s
(   R&  R'  s
   WL-Entereds
   WL-Updated(   R    R!  R   R   Rx   t   timet   ctimeR^   R   Rf   Re   (   R
   R   R  R$  t   ft   valt   stringed(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR  N  s$     
 (   RA   RB   R  (    (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR   M  s   t   Accountc           B   sD   e  Z d    Z d   Z d   Z e e  Z d   Z e e  Z RS(   c         C   s   |  i    d  S(   N(   t   validate(   R
   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR   o  s    c         C   s'   t  |  i t i  t  |  i t  d  S(   N(   R   R#   RI   t   UsernameR$   t   Keystuff(   R
   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR/  r  s    c         C   s   |  d S(   Ni    (    (   R
   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR#   v  s    c         C   s   |  d S(   Ni   (    (   R
   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR$   z  s    (   RA   RB   R   R/  R#   t   propertyR$   (    (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR.  n  s   				R1  c           B   st   e  Z d  Z d   Z d   Z d   Z e e  Z d   Z e e  Z d   Z	 e
 e	  Z	 d   Z e
 e  Z RS(   sV   tuple of (salt, key).  Each is a long.
    One or the other may be None, but not both.c         C   s   |  i    d  S(   N(   R/  (   R
   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s    c         C   s}   |  d d  j o t d  n x8 |  D]0 } t | t  p
 | d  j p t d  q% q% Wt d   |   p t d  n d  S(   Ni   s   no key informations!   Keystuff must be long's or None'sc         S   s
   |  d  j	 S(   N(   R/   (   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s    s   keystuff can't be all None's(   R/   R   t
   isinstancet   longR   (   R
   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR/    s     c         C   sE   | i  d  } t |  d j o t d  n |  t |  i |   S(   Nt   ,i   s]   invalid number of parts for keystuff; perhaps you forgot comma at beginning for salt divider?(   t   splitRb   R   t   mapt   hex_to_long(   R
   R   t   parts(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyt   from_hexstr  s    c         C   s"   |  d j o d Sn t |  d  S(   s)   Allows the argument to be an empty stringR   i   N(   R/   R4  (   t   h(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR8    s    c         C   s   |  d S(   Ni    (    (   R
   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s    c         C   s   |  d S(   Ni   (    (   R
   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR%     s    (   RA   RB   R   R   R/  R:  R   R8  R   R   R2  R%   (    (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR1    s   						R   c           B   s;   e  Z d  Z e e i e d  f  Z d   Z	 d   Z
 RS(   sV   Key is pyzor.Address, value is Account
    When getting, defaults to anonymous_accountl    c         C   s:   t  | t i  t  | t  t t |   i | |  d  S(   N(   R   RI   RJ   R.  R   R   t   __setitem__(   R
   R   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR<    s    c         C   s;   y t  t |   i |  SWn t j
 o |  i Sn Xd  S(   N(   R   R   t   __getitem__R=   t   anonymous_account(   R
   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR=    s    N(   Nl    (   RA   RB   R   R.  RI   t   anonymous_userR1  R/   R>  R<  R=  (    (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s
   		RY   c           B   s8   e  Z d  Z d d d g Z d   Z d   Z d   Z RS(   sp   Iteration gives a tuple of (Address, Account)

    Layout of file is:
    host : port ; username : keystuff
    R   t   linenoR   c         C   s%   | |  _  d |  _ t i   |  _ d  S(   Ni    (   R   R@  RI   R   R   (   R
   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s    		c         C   s   |  S(   N(    (   R
   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyt   __iter__  s    c      	   C   s9  x2|  i  i   } |  i d 7_ | p
 t  n | i   } | p | i d  o q n | i d  } t d   |  } t |  d j o |  i	 i
 d |  i  q n yN t i | d t | d  f  t t | d  t i | d	  f  f SWq t j
 o& } |  i	 i
 d
 |  i | f  q Xq d  S(   Ni   RE   t   :c         S   s
   |  i    S(    (   RF   (   R   (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s    i   s4   account file: invalid line %d: wrong number of partsi    i   i   s!   account file: invalid line %d: %s(   R   R   R@  R   RF   RG   R6  R7  Rb   R   R<   RI   RJ   R   R.  R0  R1  R:  R   (   R
   RN   RM   t   fieldsR  (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s*    
 (   RA   RB   R   RC   R   RA  R   (    (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyRY     s
   		c           C   s   t    i   d  S(   N(   RQ   R   (    (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s    c         C   s
   t   d  S(   N(   Rz   (   t   signumt   frame(    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyR     s    c         C   s    d d  k  } | i |  |  d  S(   Ni(   t   urllibt   urlretrieve(   t   urlt   outfileRF  (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pyRt     s    ()   R   Rg   t   os.pathR   R7   R]   R   R  R   R   R   RI   t
   __author__t   __version__t   __revision__R   t   objectR   t   listRD   RQ   R   R   R   R   t   BasicIteratorR   R   R   R   R   R   t   tupleR.  R1  t   dictR   RY   R   R   Rt   (    (    (    s1   /var/lib/python-support/python2.5/pyzor/client.pys   <module>   sH   
		U D	]! !,,		