ó
9ü½cc           @   sç  d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l	 Z	 d d l
 Z
 d d l m Z d d l m Z d d l m Z d d l Td d l Z d d l m Z m Z m Z d d l m Z d d	 l m Z d d
 l m Z d d l m Z d d l m Z d d l m Z d d l m  Z  d d l! m" Z" d d l# m$ Z$ d d l% m& Z& d d l' m( Z( d d l) m* Z* d d l+ m, Z, d d l- m. Z. d d l/ m0 Z0 d d l1 m2 Z2 d d l m3 Z3 d d l m4 Z4 d d l m5 Z5 d d l6 m7 Z7 d d l m8 Z8 d d l m9 Z9 d d l m: Z: d d l; m< Z< e: j= a= d  „  Z> d! Z? d" Z@ y eA eB f Wn eC k
 r«d# ZA d$ ZB n Xd% e, e& e. e  e( e0 e$ e* e" e2 e3 j3 f d& „  ƒ  YZD d S('   sU   The class representing a Mailman mailing list.

Mixes in many task-specific classes.
iÿÿÿÿN(   t   StringIO(   t   UserDict(   t   urlparse(   t   *(   t   getaddressest
   formataddrt	   parseaddr(   t   Header(   t   mm_cfg(   t   Utils(   t   Errors(   t   LockFile(   t   UserDesc(   t   Archiver(   t   Autoresponder(   t   Bouncer(   t	   Deliverer(   t   Digester(   t   GatewayManager(   t   HTMLFormatter(   t	   ListAdmin(   t   SecurityManager(   t   TopicMgr(   t   Pending(   t   Gui(   t   MemberAdaptor(   t   OldStyleMemberships(   t   Message(   t   Site(   t   i18n(   t   syslogc         C   s   |  S(   N(    (   t   s(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   D_K   s    t    t   |i   i    t   MailListc           B   sT  e  Z d9 d  d „ Z d „  Z d „  Z d d „ Z d „  Z d „  Z d „  Z	 d	 „  Z
 d9 d
 „ Z d „  Z d „  Z d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d d „ Z d d d „ Z d9 d d „ Z d „  Z d9 d d d9 d „ Z d „  Z d „  Z d9 d „ Z d9 d9 d9 d „ Z d „  Z d „  Z d  „  Z e  d! „ Z! d" „  Z" d# „  Z# d$ „  Z$ e% d% „ Z& d d& „ Z' d9 d' „ Z( d9 d9 d d d( „ Z) d9 d9 e  d) „ Z* d9 d9 d9 d* „ Z+ d+ „  Z, d, „  Z- d- „  Z. d. „  Z/ d9 d/ „ Z0 d9 d9 d0 „ Z1 d1 „  Z2 d2 „  Z3 d3 „  Z4 d9 d4 „ Z5 d5 „  Z6 d6 „  Z7 d9 d7 „ Z8 d8 „  Z9 RS(:   i   c         C   s  x3 |  j  j D]% } t | d ƒ r | j |  ƒ q q W|  j | ƒ t |  ƒ |  _ | d  k rb d  St j	 j
 |  j ƒ  d ƒ } i  } y t | | ƒ Wn8 t k
 rÎ } | j t j k r» qñ t d d | ƒ n# X| j d ƒ } | rñ | |  ƒ n  | r|  j ƒ  n
 |  j ƒ  d  S(   Nt   __init__s	   extend.pyt   errors"   IOError reading list extension: %st   extend(   t	   __class__t	   __bases__t   hasattrR$   t   InitTempVarsR   t   _memberadaptort   Nonet   ost   patht   joint   fullpatht   execfilet   IOErrort   errnot   ENOENTR   t   gett   Lockt   Load(   t   selft   namet   lockt	   baseclasst   filenamet   dictt   et   func(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyR$   a   s*    c         C   sn   y t  |  j | ƒ SWnS t k
 ri xC |  j D]+ } y t  | | ƒ SWq. t k
 rX q. Xq. Wt | ‚ n Xd  S(   N(   t   getattrR+   t   AttributeErrort   _gui(   R8   R9   t   guicomponent(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   __getattr__‡   s    c         C   s8   |  j  ƒ  r d } n d } d |  j ƒ  | t |  ƒ f S(   Ns   (locked)s
   (unlocked)s   <mailing list "%s" %s at %x>(   t   Lockedt   internal_namet   id(   R8   t   status(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   __repr__—   s
    	i    c         C   sC   |  j  j | ƒ y |  j ƒ  Wn t k
 r> |  j ƒ  ‚  n Xd  S(   N(   t   _MailList__lockR:   R7   t	   Exceptiont   Unlock(   R8   t   timeout(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyR6   £   s    
c         C   s   |  j  j d d ƒ d  S(   Nt   unconditionallyi   (   RJ   t   unlock(   R8   (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyRL   ­   s    c         C   s   |  j  j ƒ  S(   N(   RJ   t   locked(   R8   (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyRE   °   s    c         C   s   |  j  S(   N(   t   _internal_name(   R8   (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyRF   ¸   s    c         C   s   |  j  S(   N(   t
   _full_path(   R8   (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyR0   »   s    c         C   s=   | d  k r# d |  j ƒ  |  j f Sd |  j ƒ  | |  j f S(   Ns   %s@%ss   %s-%s@%s(   R,   RF   t	   host_name(   R8   t   extra(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   getListAddress¾   s    c         C   s   |  j  d ƒ S(   Nt   bounces(   RU   (   R8   (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   GetBouncesEmailÄ   s    c         C   s   |  j  d ƒ S(   Nt   owner(   RU   (   R8   (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   GetOwnerEmailÇ   s    R!   c         C   s-   t  j r | r |  j | ƒ S|  j d ƒ Sd  S(   Nt   request(   R   t   VERP_CONFIRMATIONSt   GetConfirmEmailRU   (   R8   t   cookie(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   GetRequestEmailÊ   s    c         C   s.   t  j i d |  j ƒ  d 6| d 6d |  j S(   Ns
   %s-confirmt   addrR]   t   @(   R   t   VERP_CONFIRM_FORMATRF   RS   (   R8   R]   (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyR\   Ð   s    c         C   s^   t  j rR | rR t j ƒ  j ƒ  p0 t j |  j ƒ } t t	 d ƒ | d d ƒ} | Sd | Sd  S(   NsC   Your confirmation is required to join the %(listname)s mailing listt   header_namet   subjects   confirm (
   R   R[   R   t   get_translationt   charsetR	   t
   GetCharSett   preferred_languageR   t   _(   R8   t   listnameR]   t   csett   subj(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   GetConfirmJoinSubjectÖ   s    	c         C   s^   t  j rR | rR t j ƒ  j ƒ  p0 t j |  j ƒ } t t	 d ƒ | d d ƒ} | Sd | Sd  S(   NsD   Your confirmation is required to leave the %(listname)s mailing listRb   Rc   s   confirm (
   R   R[   R   Rd   Re   R	   Rf   Rg   R   Rh   (   R8   Ri   R]   Rj   Rk   (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   GetConfirmLeaveSubjectá   s    	c         C   s
   |  j  ƒ  S(   N(   RU   (   R8   (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   GetListEmailì   s    c         C   s@   |  j  s | St | j d ƒ ƒ \ } } d | |  j | f Sd S(   s¼  Usually the member addr, but modified for umbrella lists.

        Umbrella lists have other mailing lists as members, and so admin stuff
        like confirmation requests and passwords must not be sent to the
        member addresses - the sublists - but rather to the administrators of
        the sublists.  This routine picks the right address, considering
        regular member address to be their own administrative addresses.

        R`   s   %s%s@%sN(   t   umbrella_listt   tuplet   splitt   umbrella_member_suffix(   R8   t   membert   acctt   host(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   GetMemberAdminEmailï   s    
	c         C   s$   t  j | |  j | ƒ d |  j ƒ  S(   Nt   /(   R	   t	   ScriptURLt   web_page_urlRF   (   R8   t
   scriptnamet   absolute(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   GetScriptURLÿ   s    c         C   sG   |  j  d | ƒ } | r* t j | ƒ } n  d | t j | j ƒ  ƒ f S(   Nt   optionss   %s/%s(   R|   R	   t   ObscureEmailt   urllibt   quotet   lower(   R8   t   usert   obscureR{   t   url(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   GetOptionsURL  s    t   xmlcharrefreplacec         C   s·   t  j |  j ƒ } | d  k rZ t j ƒ  } | d  k r? d } q` t j ƒ  j ƒ  pT d } n | } t |  j t	 ƒ r… |  j j
 | | ƒ S| | k r˜ |  j St  j |  j | ƒ j
 | | ƒ S(   Ns   us-ascii(   R	   Rf   Rg   R,   R   Rd   Re   t
   isinstancet   descriptiont   unicodet   encodet   xml_to_unicode(   R8   Rj   t   errorst   mcsett   trnst   ccset(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   GetDescription	  s    	c         C   s  d |  _  t j t j j t j | p' d ƒ d d t j d t j ƒ|  _	 | |  _
 | rm t j | ƒ |  _ n	 d |  _ x3 |  j j D]% } t | d ƒ rƒ | j |  ƒ qƒ qƒ Wg  |  _ xE t t ƒ D]7 } | j d ƒ rÝ qÂ n  |  j j t t | ƒ ƒ  ƒ qÂ Wd	 S(
   s6   Set transient variables of this and inherited classes.i    s   <site>s   .lockt   lifetimet   withloggingR!   R*   Rh   N(   t   _MailList__timestampR   R-   R.   R/   R   t   LOCK_DIRt   LIST_LOCK_LIFETIMEt   LIST_LOCK_DEBUGGINGRJ   RQ   R   t   get_listpathRR   R'   R(   R)   R*   RB   t   dirR   t
   startswitht   appendR@   (   R8   R9   R;   t	   component(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyR*   "  s"    	"				c         C   sÂ  | r | |  _  n  t j ƒ  |  _ d |  _ i  |  _ t j |  _ d |  _ d |  _	 i  |  _
 i  |  _ i  |  _ i  |  _ t j |  _ t j |  _ t j |  _ t j |  _ t j |  _ t j pÀ t j |  _ t j pâ t j | pá t j |  _ | g |  _ g  |  _  t j! |  _" d |  _# t j$ |  _% t j& |  _' t j( |  _) t j* |  _+ t j, |  _- t j. |  _/ t j0 |  _1 t j2 |  _3 t j4 |  _5 t j6 |  _7 t j8 |  _9 t j: |  _; t j< |  _= t j> |  _? g  |  _@ t jA |  _B t jC |  _D |  jE ƒ  } | d jF ƒ  | d |  _G d |  _H d |  _I d |  _J d |  _K t jL |  _M t jN |  _O t jP |  _Q t jR |  _S t jT |  _U t jV |  _W t jX |  _Y t jZ |  _[ t j\ |  _] g  |  _^ d |  __ d |  _` d |  _a t jb |  _c t jd |  _e t jf |  _g t jh |  _i t jj |  _k t jl |  _m t jn |  _o t jp |  _q t jr |  _s d |  _t t ju |  _v d |  _w t jx |  _y t jz |  _{ d |  _| d |  _} t j~ |  _ t j€ |  _� t j‚ |  _ƒ d |  _„ g  |  _… t j† |  _‡ t jˆ |  _‰ g  |  _Š g  |  _‹ g  |  _Œ g  |  _� t jŽ |  _� t j� |  _‘ d |  _’ g  |  _“ | |  _” i  |  _• x3 |  j– j— D]% } t˜ | d ƒ r%| j™ |  ƒ q%q%Wt jš |  j› |  _œ t j� |  _ž t jŸ |  _  t¡ j¢ |  j] ƒ d k r�d |  _£ n	 d |  _£ t j¤ |  _¥ t j¦ |  _§ d S(	   s?   Assign default values - some will be overriden by stored state.i   i    g      ð?R!   t   InitVarss   us-asciii   N(¨   RQ   t   timet
   created_att   volumet   membersR   t   DATA_FILE_VERSIONt   data_versiont   last_post_timet   post_idt   user_optionst   languaget	   usernamest	   passwordst   DEFAULT_NEW_MEMBER_OPTIONSt   new_member_optionst    DEFAULT_RESPOND_TO_POST_REQUESTSt   respond_to_post_requestst   DEFAULT_LIST_ADVERTISEDt
   advertisedt   DEFAULT_MAX_NUM_RECIPIENTSt   max_num_recipientst   DEFAULT_MAX_MESSAGE_SIZEt   max_message_sizet   DEFAULT_HOST_NAMEt   DEFAULT_EMAIL_HOSTRS   t   DEFAULT_URLt   DEFAULT_URL_PATTERNt   DEFAULT_URL_HOSTRy   RX   t	   moderatort   DEFAULT_REPLY_GOES_TO_LISTt   reply_goes_to_listt   reply_to_addresst   DEFAULT_FIRST_STRIP_REPLY_TOt   first_strip_reply_tot   DEFAULT_ADMIN_IMMED_NOTIFYt   admin_immed_notifyt   DEFAULT_ADMIN_NOTIFY_MCHANGESt   admin_notify_mchangest$   DEFAULT_REQUIRE_EXPLICIT_DESTINATIONt   require_explicit_destinationt   DEFAULT_ACCEPTABLE_ALIASESt   acceptable_aliasest   DEFAULT_UMBRELLA_LISTRo   t$   DEFAULT_UMBRELLA_MEMBER_ADMIN_SUFFIXRr   t   DEFAULT_REGULAR_EXCLUDE_LISTSt   regular_exclude_listst   DEFAULT_REGULAR_EXCLUDE_IGNOREt   regular_exclude_ignoret   DEFAULT_REGULAR_INCLUDE_LISTSt   regular_include_listst   DEFAULT_SEND_REMINDERSt   send_reminderst   DEFAULT_SEND_WELCOME_MSGt   send_welcome_msgt   DEFAULT_SEND_GOODBYE_MSGt   send_goodbye_msgt   DEFAULT_BOUNCE_MATCHING_HEADERSt   bounce_matching_headerst   header_filter_rulest   DEFAULT_FROM_IS_LISTt   from_is_listt   DEFAULT_ANONYMOUS_LISTt   anonymous_listRF   t   uppert	   real_nameRˆ   t   infot   welcome_msgt   goodbye_msgt   DEFAULT_SUBSCRIBE_POLICYt   subscribe_policyt   DEFAULT_SUBSCRIBE_AUTO_APPROVALt   subscribe_auto_approvalt   DEFAULT_UNSUBSCRIBE_POLICYt   unsubscribe_policyt   DEFAULT_PRIVATE_ROSTERt   private_rostert   DEFAULT_OBSCURE_ADDRESSESt   obscure_addressest   DEFAULT_ADMIN_MEMBER_CHUNKSIZEt   admin_member_chunksizet   DEFAULT_ADMINISTRIVIAt   administriviat   DEFAULT_DROP_CCt   drop_cct   DEFAULT_SERVER_LANGUAGERg   t   available_languagest   include_rfc2369_headerst   include_list_post_headert   include_sender_headert   DEFAULT_FILTER_MIME_TYPESt   filter_mime_typest   DEFAULT_PASS_MIME_TYPESt   pass_mime_typest"   DEFAULT_FILTER_FILENAME_EXTENSIONSt   filter_filename_extensionst    DEFAULT_PASS_FILENAME_EXTENSIONSt   pass_filename_extensionst   DEFAULT_FILTER_CONTENTt   filter_contentt   DEFAULT_COLLAPSE_ALTERNATIVESt   collapse_alternativest!   DEFAULT_CONVERT_HTML_TO_PLAINTEXTt   convert_html_to_plaintextt   DEFAULT_FILTER_ACTIONt   filter_actiont   DEFAULT_NONDIGESTABLEt   nondigestablet   personalizet!   DEFAULT_DEFAULT_MEMBER_MODERATIONt   default_member_moderationt	   emergencyt"   DEFAULT_MEMBER_VERBOSITY_THRESHOLDt   member_verbosity_thresholdt!   DEFAULT_MEMBER_VERBOSITY_INTERVALt   member_verbosity_intervalt   member_moderation_actiont   member_moderation_noticet   DEFAULT_DMARC_MODERATION_ACTIONt   dmarc_moderation_actiont*   DEFAULT_DMARC_QUARANTINE_MODERATION_ACTIONt"   dmarc_quarantine_moderation_actiont$   DEFAULT_DMARC_NONE_MODERATION_ACTIONt   dmarc_none_moderation_actiont   dmarc_moderation_noticet   dmarc_moderation_addressest"   DEFAULT_DMARC_WRAPPED_MESSAGE_TEXTt   dmarc_wrapped_message_textt   DEFAULT_EQUIVALENT_DOMAINSt   equivalent_domainst   accept_these_nonmemberst   hold_these_nonmemberst   reject_these_nonmemberst   discard_these_nonmemberst   DEFAULT_FORWARD_AUTO_DISCARDSt   forward_auto_discardst    DEFAULT_GENERIC_NONMEMBER_ACTIONt   generic_nonmember_actiont   nonmember_rejection_noticet   ban_listt   passwordt   hold_and_cmd_autoresponsesR'   R(   R)   Rœ   t   DEFAULT_SUBJECT_PREFIXt   __dict__t   subject_prefixt   DEFAULT_MSG_HEADERt
   msg_headert   DEFAULT_MSG_FOOTERt
   msg_footerR	   Rf   t   encode_ascii_prefixest   DEFAULT_SCRUB_NONDIGESTt   scrub_nondigestt   DEFAULT_MAX_DAYS_TO_HOLDt   max_days_to_hold(   R8   R9   t   admint   crypted_passwordt   urlhostt   internalnameR;   (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyRœ   =  sÐ    																																			c         C   sY   d t  f d „  ƒ  Y} | ƒ  } x3 |  j D]( } | j ƒ  \ } } | | f | | <q) W| S(   Nt   CategoryDictc           B   s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         S   s   t  j |  ƒ t j |  _ d  S(   N(   R   R$   R   t   ADMIN_CATEGORIESt   keysinorder(   R8   (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyR$   Û  s    c         S   s   |  j  S(   N(   R;  (   R8   (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   keysÞ  s    c         S   s8   g  } x+ t  j D]  } | j | |  j | f ƒ q W| S(   N(   R   R:  Rš   t   data(   R8   t   itemst   k(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyR>  à  s    c         S   s2   g  } x% t  j D] } | j |  j | ƒ q W| S(   N(   R   R:  Rš   R=  (   R8   t   valuesR?  (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyR@  å  s    (   t   __name__t
   __module__R$   R<  R>  R@  (    (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyR9  Ú  s   			(   R   RB   t   GetConfigCategory(   R8   R9  t
   categoriest   guiR?  t   v(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   GetConfigCategoriesÙ  s    	c         C   sI   xB |  j  D]7 } t | d ƒ r
 | j | ƒ } | d  k	 rA | Sq
 q
 Wd  S(   Nt   GetConfigSubCategories(   RB   R)   RH  R,   (   R8   t   categoryRE  t   subcat(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyRH  ò  s    c         C   sI   xB |  j  D]7 } t | d ƒ r
 | j |  | | ƒ } | rA | Sq
 q
 Wd  S(   Nt   GetConfigInfo(   RB   R)   RK  (   R8   RI  RJ  RE  t   value(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyRK  û  s
    c         C   sT  | | j  ƒ  k s t d ƒ ‚ t j | ƒ r< t j | ‚ n  t t j t	 j
 d | ƒ ƒ d k ro t j | ‚ n  | d  k r‡ t	 j } n  d | | f } y t j | ƒ Wn  t j k
 rÊ t j | ‚ n Xt j | ƒ | |  _ t j | d d ƒ|  _ |  j j ƒ  |  j | | | d | ƒ|  j ƒ  | d  k rG|  j g |  _ n	 | |  _ d  S(   Ns!   List name must be all lower case.R!   i    s   %s@%st   createi   R7  (   R�   t   AssertionErrorR	   t   list_existsR
   t   MMListAlreadyExistsErrort   lent   ret   subR   t   ACCEPTABLE_LISTNAME_CHARACTERSt   BadListNameErrorR,   R´   t   ValidateEmailt   EmailAddressErrorRQ   R   R—   RR   RJ   R:   Rœ   t   CheckValuesRg   Rñ   (   R8   R9   R5  R6  t   langst	   emailhostR7  t   postingaddr(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   Create  s*    $	
c         C   s“  t  j j |  j ƒ  d ƒ } | d t j ƒ  t  j ƒ  f } | d } d  } yY t | d ƒ } t	 j
 | | d ƒ | j ƒ  t j r™ t  j | j ƒ  ƒ n  | j ƒ  WnB t k
 rè } t d d | ƒ | d  k	 râ t  j | ƒ n  ‚  n Xy t  j | ƒ Wn+ t k
 r'} | j t j k r(‚  q(n Xy t  j | | ƒ Wn+ t k
 ri} | j t j k rj‚  qjn Xt  j | | ƒ t  j j | ƒ |  _ d  S(   Ns
   config.pcks
   .tmp.%s.%ds   .lastt   wi   R%   s0   Failed config.pck write, retaining old state.
%s(   R-   R.   R/   R0   t   sockett   gethostnamet   getpidR,   t   opent   cPicklet   dumpt   flushR   t   SYNC_AFTER_WRITEt   fsynct   filenot   closeR2   R   t   unlinkt   OSErrorR3   R4   t   linkt   renamet   getmtimeR“   (   R8   R=   t   fnamet	   fname_tmpt
   fname_lastt   fpR>   (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   __save/  s:     

	
 
 
c         C   s®   |  j  j ƒ  i  } xO |  j j ƒ  D]> \ } } | d d k s# t | ƒ t k rW q# n  | | | <q# Wt j d ƒ } z |  j | ƒ Wd  t j | ƒ |  j	 ƒ  X|  j
 ƒ  d  S(   Ni    Rh   i   (   RJ   t   refreshR*  R>  t   typet
   MethodTypeR-   t   umaskt   _MailList__savet   SaveRequestsDbt   CheckHTMLArchiveDir(   R8   R=   t   keyRL  t   omask(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   SaveW  s    "c      
   C   sb  | j  d ƒ s | j  d ƒ r* t j } n< | j  d ƒ sH | j  d ƒ rT t j } n d sf t d ƒ ‚ y5 t j j | ƒ } | |  j k  rŽ d St
 | ƒ } Wn2 t k
 rÏ } | j t j k rÅ ‚  n  d  | f SXt t j ƒ  ƒ } z_ y& | | ƒ } t | ƒ t k r
d	 SWn2 t t t t t j t j f k
 r?} d  | f SXWd  | j ƒ  X| |  _ | d  f S(
   Ns   .dbs   .db.lasts   .pcks	   .pck.lasti    s   Bad database file names&   Load() expected to return a dictionary(   NN(   Ns&   Load() expected to return a dictionary(   t   endswitht   marshalt   loadRb  RN  R-   R.   Rm  R“   R,   Ra  t   EnvironmentErrorR3   R4   t   intR�   Rt  t   DictTypet   EOFErrort
   ValueErrort	   TypeErrort   MemoryErrort   PicklingErrort   UnpicklingErrorRh  (   R8   t   dbfilet   loadfunct   mtimeRq  R>   t   nowR=   (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   __loadm  s4     	c   
      C   s¿  t  j |  j ƒ  ƒ s! t j ‚ n  t j j |  j ƒ  d ƒ } | d } t j j |  j ƒ  d ƒ } | d } x‡ | | | | f D]Q } |  j	 | ƒ \ } } | d  k rÎ | d  k	 rÇ t d d | | ƒ qÏ d  Sq~ Pq~ Wt d d |  j ƒ  ƒ t j | ‚ | | k s| | k r‹t d d | ƒ t }	 zK y |  j j ƒ  Wn t j k
 rSt }	 n X|  j | | | | | ƒ Wd  |	 r‡|  j j ƒ  n  Xn  |  j j | ƒ | r»|  j | ƒ |  j ƒ  n  d  S(   Ns
   config.pcks   .lasts	   config.dbR%   s   couldn't load config file %s
%ss(   All %s fallbacks were corrupt, giving ups%   fixing corrupt config file, using: %s(   R	   RO  RF   R
   t   MMUnknownListErrorR-   R.   R/   R0   t   _MailList__loadR,   R   t   MMCorruptListDatabaseErrort   TrueRJ   R:   R   t   AlreadyLockedErrort   Falset   _MailList__fix_corrupt_pckfileRO   R*  t   updatet   CheckVersionRX  (
   R8   t   check_versiont   pfilet   plastt   dfilet   dlastt   fileR=   R>   RO   (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyR7   §  s@    

		
c         C   s|  | | k r¼ y t  j | | d ƒ Wn+ t k
 rQ } | j t j k rR ‚  qR n Xy t  j | d ƒ Wn+ t k
 r” } | j t j k r• ‚  q• n Xt j | | ƒ t j | | d ƒ n¼ | | k rxy t  j | | d ƒ Wn+ t k
 r} | j t j k r‚  qn Xy t  j | d ƒ Wn+ t k
 rP} | j t j k rQ‚  qQn Xt j | | ƒ t j | | d ƒ n  d  S(   Ns   .corrupts   .safety(   R-   Rl  Rj  R3   R4   t   removet   shutilt   copy(   R8   Rœ  R˜  R™  Rš  R›  R>   (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   __fix_corrupt_pckfileÝ  s4     
 
 
 
c         C   sª   |  j  t j k r d S|  j ƒ  d |  _ |  j d d ƒ |  j ƒ  } | sX |  j ƒ  n  z7 d d l m	 } | |  | ƒ t j |  _  |  j
 ƒ  Wd | s¥ |  j ƒ  n  Xd S(   s    Auto-update schema if necessary.Ni    R—  iÿÿÿÿ(   t   Update(   R¢   R   R¡   Rœ   R“   R7   RE   R6   t   versionsR¡  R|  RL   (   R8   t   stored_statet	   waslockedR¡  (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyR–  ÿ  s    
	c         C   s½  d t  |  j ƒ d  k r8 t j p/ t j t j |  _ n  |  j rg |  j d d k rg |  j d |  _ n  y/ |  j j ƒ  r• |  j r• t	 j
 |  j ƒ n  WnB t j k
 rÚ t d d |  j |  j ƒ  ƒ d |  _ d |  _ n Xg  } xÌ |  j D]Á } y | \ } } } } Wn- t k
 r6t d d | |  j ƒ  ƒ që n Xy& t j | j ƒ  ƒ } t j | ƒ Wn3 t j t f k
 r’t d d	 | |  j ƒ  ƒ që X| j | | | | f ƒ që W| |  _ d
 S(   s+   Normalize selected values to known formats.R!   i   iÿÿÿÿRw   R%   s.   Bad reply_to_address "%s" cleared for list: %si    s   Bad topic "%s" for list: %ss#   Bad topic pattern "%s" for list: %sN(   R   Ry   R   Rµ   R¶   R·   R»   t   stripRº   R	   RV  R
   RW  R   RF   t   topicsR„  t   ORR/   t
   splitlinesRR  t   compileR%   R…  Rš   (   R8   t
   goodtopicsRL  R9   t   patternt   desct	   emptyflagt	   orpattern(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyRX    s:    					c         C   s×   t  j s t S|  j ƒ  } |  j | ƒ |  j ƒ  } xž | j ƒ  D]� \ } } | d k r] q? n  | d  \ } } | t j k rž | rž | j j	 ƒ  | j	 ƒ  k sË | t j
 k r? | r? | j	 ƒ  | j	 ƒ  k r? t Sq? Wt S(   s`   Check if there is already an unexpired pending (un)subscription for
        this email.
        t	   evictionst   versioni   (   R¯  R°  (   R   t   REFUSE_SECOND_PENDINGR“  t   _Pending__loadt   _Pending__saveR>  R   t   SUBSCRIPTIONt   addressR�   t   UNSUBSCRIPTIONR‘  (   R8   t   emailt   unsubt   pendsR?  RF  t   opR=  (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   CheckPendingD  s    	c         C   sy  | j  } t j | ƒ |  j | ƒ } | rS t d d |  j | | ƒ t j | ‚ n  |  j ƒ  | _	 |  j
 t j | ƒ } |  j d ƒ } d |  j d d d ƒ| f } |  j } | t j d i | d	 6| d
 6|  j d 6| d 6| d 6| d 6|  j ƒ  d 6d |  ƒ7} |  j | ƒ }	 t j | |	 d | d |  j ƒ}
 |  j | | ƒ } |
 d =| |
 d <|
 d =d |
 d <|
 j |  ƒ d S(   sÄ   Invite a new member to the list.

        This is done by creating a subscription pending for the user, and then
        crafting a message to the member informing them of the invitation.
        t   vettes&   %s banned invitation: %s (matched: %s)RZ   s   %s/%st   confirmR{   i   s
   invite.txtR·  Ri   t   hostnamet
   confirmurlt   requestaddrR]   t	   listownert   mlistt   textt   langRc   t   Subjects   auto-submitteds   auto-generateds   Auto-SubmittedN(   Rµ  R	   RV  t   GetBannedPatternR   RÜ   R
   t   MembershipIsBannedRF   t
   invitationt   pend_newR   R´  RU   R|   t   maketextRS   RY   R^   R   t   UserNotificationRg   Rl   t   send(   R8   t   userdescRÃ  t   inviteeR«  R]   RÀ  R¿  Ri   t   sendert   msgRk   (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   InviteNewMemberY  sB    		
		


	

c         C   s¾  |  j  ƒ  s t ‚ t j | j ƒ } t | d d ƒ } t | d |  j ƒ } t | d d- ƒ } t | d t j ƒ  ƒ } | d- k rœ |  j	 r“ d } qœ d } n  t j
 | ƒ |  j | ƒ rÇ t j | ‚ n  |  j | ƒ rå t j | ‚ n  | j ƒ  |  j ƒ  j ƒ  k rt j ‚ n  |  j } |  j | ƒ }	 |	 rn| r@d | }
 n d }
 t d	 d
 | | |
 |	 ƒ t j |	 ‚ n  | r¾t j r¾t j | ƒ r¾d | }
 t d	 d | | |
 ƒ t j d ‚ q¾n  | rt j rt j | ƒ rt d	 d | | ƒ t j d ‚ qn  | r|  j rt j ‚ n | r:|  j	 r:t j ‚ n  | | _ | | _ | | _  | | _! | | _" |  j# d k r’|  j$ | d | p‹d ƒn(|  j# d k s°|  j# d k rp|  j% t& j' | ƒ } | d- k râd } } } n | } d | } t( d ƒ } |  j) | ƒ } d |  j* d d d ƒ| f } t j+ d i | d 6|  j ƒ  d 6| d 6| d 6|  j, d ƒ d 6| d 6|  j- ƒ  d 6| d 6d  | d! |  ƒ} t. j/ | |  j0 | ƒ d" | d  | ƒ} | d# =|  j1 | | ƒ | d$ <|  j0 | ƒ | d% <| j ƒ  j2 | j ƒ  ƒ rd& } n d' } | d( =| | d) <| j3 |  ƒ t4 | | f ƒ } t d* d+ |  j5 ƒ  | | ƒ t j6 ‚ nJ |  j7 | ƒ r�|  j$ | ƒ n+ |  j8 | | | | | ƒ t j9 t( d, ƒ ‚ d- S(.   sÒ  Front end to member subscription.

        This method enforces subscription policy, validates values, sends
        notifications, and any other grunt work involved in subscribing a
        user.  It eventually calls ApprovedAddMember() to do the actual work
        of subscribing the user.

        userdesc is an instance with the following public attributes:

            address  -- the unvalidated email address of the member
            fullname -- the member's full name (i.e. John Smith)
            digest   -- a flag indicating whether the user wants digests or not
            language -- the requested default language for the user
            password -- the user's password

        Other attributes may be defined later.  Only address is required; the
        others all have defaults (fullname='', digests=0, language=list's
        preferred language, password=generated).

        remote is a string which describes where this add request came from.
        t   fullnameR!   R¦   t   digestR'  i    i   s    from %sR¼  s*   %s banned subscription: %s%s (matched: %s)s*   %s banned subscription: %s%s (Spamhaus IP)s   Spamhaus IPs)   %s banned subscription: %s (Spamhaus DBL)s   Spamhaus DBLt   whencei   t    s    from %(remote)ss   %s/%sR½  R{   s
   verify.txtR·  t   listaddrRi   R]   RZ   RÀ  t   remotet	   listadminR¿  RÄ  RÂ  RÃ  Rc   RÅ  s   Reply-Tos   auto-replieds   auto-generateds   auto-submitteds   Auto-Submittedt	   subscribes   %s: pending %s %ss8   subscriptions to %(realname)s require moderator approvalN(:   RE   RN  R	   t   LCDomainRµ  R@   Rg   R,   t   MakeRandomPasswordR  RV  t   isMemberR
   t   MMAlreadyAMemberR»  t   MMAlreadyPendingR�   Rn   t   MMBadEmailErrorRÜ   RÆ  R   RÇ  R   t"   BLOCK_SPAMHAUS_LISTED_IP_SUBSCRIBEt	   banned_ipt#   BLOCK_SPAMHAUS_LISTED_DBL_SUBSCRIBEt   banned_domaint
   digestablet   MMCantDigestErrort   MMMustDigestErrorRÒ  RÓ  R¦   R'  Rá   t   ApprovedAddMemberRÉ  R   R´  Rh   Rv   R|   RÊ  RU   RY   R   RË  R^   Rl   R}  RÌ  R   RF   t   MMSubscribeNeedsConfirmationt   HasAutoApprovedSendert   HoldSubscriptiont   MMNeedApproval(   R8   RÍ  R×  R·  R9   RÄ  RÓ  R'  t   realnameR«  RÔ  R]   t   oremotet   byt	   recipientR¿  RÃ  RÐ  t   autosubt   who(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt	   AddMember‡  s´    					
		
					



	
		c      
   C   sQ  |  j  ƒ  s t ‚ | d k r* |  j } n  | d k rB |  j } n  t j | j ƒ } t | d d ƒ } t | d |  j	 ƒ } t | d d ƒ }	 t | d t j
 ƒ  ƒ }
 |	 d k rÌ |  j rÃ d }	 qÌ d }	 n  t j | ƒ |  j | ƒ r÷ t j | ‚ n  |  j | ƒ } | rP| rd | } n d } t d	 d
 |  j | | | ƒ t j | ‚ n  |  j | d | d |	 d |
 d | ƒ|  j | t j d |  j ƒ |  j | t j |  j ƒ |	 rºd } n d } t d d |  j ƒ  | t | | f ƒ | ƒ | rJ|  j	 } t j ƒ  } t j | ƒ z# |  j  | |  j! | ƒ |	 | ƒ Wd t j" | ƒ Xn  | rM|  j	 } t j ƒ  } t j | ƒ z? | d k r‡d n d t# | ƒ d } |  j } t# d ƒ } Wd t j" | ƒ Xt$ | t% ƒ rï| j& t j' | ƒ d ƒ } n  t j( d i | d 6t | | f ƒ d 6| d 6d |  ƒ} t) j* |  | | ƒ } | j+ |  ƒ n  d S(   s  Add a member right now.

        The member's subscription must be approved by what ever policy the
        list enforces.

        userdesc is as above in AddMember().

        ack is a flag that specifies whether the user should get an
        acknowledgement of their being subscribed.  Default is to use the
        list's default flag value.

        admin_notif is a flag that specifies whether the list owner should get
        an acknowledgement of this subscription.  Default is to use the list's
        default flag value.
        RÒ  R!   R¦   RÓ  R'  i    i   s    from %sR¼  s*   %s banned subscription: %s%s (matched: %s)Rì  s	    (digest)RÙ  s   %s: new%s %s, %sNt   (t   )s&   %(realname)s subscription notificationt   replaces   adminsubscribeack.txtRi   Rs   RÔ  RÂ  (,   RE   RN  R,   RÑ   RÁ   R	   RÚ  Rµ  R@   Rg   RÛ  R  RV  RÜ  R
   RÝ  RÆ  R   RÜ   RÇ  t   addNewMembert   setMemberOptionR   t   DisableMimet   mime_is_default_digestt   ModerateR	  RF   R   R   Rd   t   set_languaget   SendSubscribeAckt   getMemberPasswordt   set_translationRh   R‡   t   UnicodeTypeRŠ   Rf   RÊ  R   t   OwnerNotificationRÌ  (   R8   RÍ  t   ackt   admin_notifRÃ  RÔ  R·  R9   RÄ  RÓ  R'  R«  t   sourcet   kindt   otransRì  Rc   RÐ  (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyRç    s~    				
			&	

	c         C   s]   t  | ƒ \ } } |  j d k r: |  j | | | | ƒ n |  j | ƒ t j t d ƒ ‚ d  S(   Ni    s*   unsubscriptions require moderator approval(   R   Rå   t   ApprovedDeleteMembert   HoldUnsubscriptionR
   Rë  Rh   (   R8   R9   RÔ  R  t   userackRì  R·  (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   DeleteMembers  s    	c         C   sP  | d  k r |  j } n  | d  k r0 |  j } n  t | ƒ \ } } |  j | ƒ } |  j | ƒ | rw |  j | | ƒ n  t j |  j	 ƒ | r|  j
 } t d ƒ }	 t j d i | d 6|  j
 d 6| d  k rÑ d n d t | ƒ d d 6d	 |  ƒ}
 t j |  |	 |
 ƒ } | j |  ƒ n  | r*d
 | } n d } t d d |  j ƒ  | | ƒ d  S(   Ns%   %(realname)s unsubscribe notifications   adminunsubscribeack.txtRs   Ri   R!   Ró  Rô  RÔ  RÂ  s   ; %sRÙ  s   %s: deleted %s%s(   R,   RÓ   RÁ   R   t   getMemberLanguaget   removeMembert   SendUnsubscribeAckR   Rû  Rg   RÜ   Rh   R	   RÊ  R   R   RÌ  R   RF   (   R8   R9   RÔ  R  R  RÒ  t	   emailaddrt   userlangRì  Rc   RÃ  RÐ  (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyR  |  s4    	

*		c         C   sÂ   |  j  | | ƒ | s d  Sx¡ t j ƒ  D]“ } | |  j ƒ  k rE q' n  t | d d ƒ} | j |  j k ro q' n  | j | ƒ s„ q' n  | j ƒ  z | j  | | ƒ | j ƒ  Wd  | j	 ƒ  Xq' Wd  S(   NR:   i    (
   t   setMemberNameR	   t
   list_namesRF   R#   RS   RÜ  R6   R|  RL   (   R8   R_   R9   t   globallyRi   RÂ  (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   ChangeMemberNamež  s     
c         C   sÙ  t  j | ƒ } t  j | ƒ | rS |  j | ƒ rS | |  j | ƒ k rS t j ‚ n  | |  j ƒ  j ƒ  k rw t j	 ‚ n  |  j
 } |  j | ƒ } | r½ t d d | | | | ƒ t j | ‚ n  |  j t j | | | ƒ } d |  j d d d ƒ| f } |  j | ƒ } t  j d i | d 6|  j ƒ  d	 6| d
 6| d 6|  j d ƒ d 6d d 6|  j ƒ  d 6| d 6d | d |  ƒ}	 t j | |  j | ƒ d |	 d | ƒ}
 |
 d =|  j | | ƒ |
 d <|  j | ƒ |
 d <|
 j |  ƒ d  S(   NR¼  s0   %s banned address change: %s -> %s (matched: %s)s   %s/%sR½  R{   i   s
   verify.txtR·  RÖ  Ri   R]   RZ   RÀ  R!   R×  RØ  R¿  RÄ  RÂ  RÃ  Rc   RÅ  s   Reply-To(   R	   RÚ  RV  RÜ  t   getMemberCPAddressR
   RÝ  Rn   R�   Rß  RÜ   RÆ  R   RÇ  RÉ  R   t   CHANGE_OF_ADDRESSR|   R
  RÊ  RU   RY   R   RË  R^   Rl   RÌ  (   R8   t   oldaddrt   newaddrR  Rì  R«  R]   R¿  RÄ  RÃ  RÐ  (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   ChangeMemberAddress²  sJ    	


c         C   sÛ  |  j  | ƒ } | r@ t d d |  j | | | ƒ t j | ‚ n  |  j | ƒ } |  j | ƒ r’ |  j | ƒ | k r’ | | k r² |  j | ƒ q² n  |  j | | ƒ |  j	 | | ƒ | s¼ d  Sxt
 j ƒ  D]
} | |  j ƒ  k rç qÉ n  t | d d ƒ} | j |  j k rqÉ n  | j | ƒ s&qÉ n  | j  | ƒ r;qÉ n  | j ƒ  z€ | j | ƒ } | j | ƒ rš| j | ƒ | k rš| | k rº| j | ƒ qºn  | j | | ƒ | j	 | | ƒ | j ƒ  Wd  | j ƒ  XqÉ Wd  S(   NR¼  s0   %s banned address change: %s -> %s (matched: %s)R:   i    (   RÆ  R   RÜ   R
   RÇ  R  RÜ  R  t   changeMemberAddresst   log_and_notify_adminR	   R  RF   R#   RS   R6   R|  RL   (   R8   R  R  R  R«  t	   cpoldaddrRi   RÂ  (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   ApprovedChangeMemberAddressì  sH    		
c   
      C   s"  t  d d |  j ƒ  | | ƒ |  j r|  j } t j ƒ  } t j | ƒ z |  j } t d ƒ } Wd t j	 | ƒ X|  j
 | ƒ } | d k r• d } n  t | t ƒ rÂ | j t j | ƒ d ƒ } n  t j d i | d 6| d	 6| d
 6|  j d 6d |  ƒ} t j |  | | ƒ }	 |	 j |  ƒ n  d S(   s8   Log member address change and notify admin if requested.RÙ  s(   %s: changed member address from %s to %ss(   %(realname)s address change notificationNR!   Rõ  s   adminaddrchgack.txtR9   R  R  Ri   RÂ  (   R   RF   RÁ   Rg   R   Rd   Rû  RÜ   Rh   Rþ  t   getMemberNameR,   R‡   Rÿ  RŠ   R	   Rf   RÊ  R   R   RÌ  (
   R8   R  R  RÄ  R  Rì  Rc   R9   RÃ  RÐ  (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyR  &  s0    					
	c         C   sè  |  j  | ƒ } | d  k r. t j d | ‚ n  y | d } | d } Wn$ t k
 rl t j d | f ‚ n X| t j k ræt a t d ƒ } yc | d } t	 | t
 ƒ rÃ | | 7} t d ƒ } n  | j } | j }	 | j }
 | j } | j } Wn$ t k
 rt j d | f ‚ n Xt j a t | d t ƒ } | rj| |  j ƒ  k rÀ|  j | | ƒ t j ‚ qÀnV |  j d k rÀ|  j | ƒ rÀ|  j | |	 |
 | | ƒ |  j } t j t d ƒ ‚ n  |  j | d | ƒ| | |
 | | f S| t j k rX| d } t a t	 | t j ƒ r&t d ƒ } n t d ƒ } t j a |  j | d | ƒ| | f S| t j k r–| \ } } } |  j  | | | ƒ | | | f S| t j! k r˜| d } d  } t	 | t j ƒ rò| j" d | j" d ƒ ƒ } | sòy& t# t$ j% j& | d d ƒ ƒ d } Wn t' k
 r'd  } n X| rït( | j) d t* ƒ ƒ } x£ t* rè| j+ ƒ  } | sePn  | j, ƒ  swqIn  | j- d ƒ } | d k rä| |  j, ƒ  j. ƒ  d k sÊ| |  j, ƒ  j. ƒ  d k rä| | d j, ƒ  } qän  PqIWqïqòn  | d  k	 rM|  j/ t0 j1 t0 j2 g | ƒ t0 j3 k r1t0 j4 } qV|  j5 | | ƒ t j6 ‚ n	 t0 j7 } y |  j8 | | ƒ Wn! t9 k
 r�t: d d | ƒ n X| | f S| t j; k rÎ| d } |  j< | t= j> ƒ | | f Sd sät? d | ƒ ‚ d  S(   Ns   No cookie record for %si    i   s   op-less data %ss   via email confirmations   via web confirmations   bad subscr data %sRÈ  i   i   s8   subscriptions to %(name)s require administrator approvalRÔ  s   email confirmations   web confirmationt   Approvedt   ApproveRÃ  t   plaint   decodet   :t   approvet   approvedR%   s"   Could not process HELD_MESSAGE: %ss
   Bad op: %s(   i   i   (@   t   pend_confirmR,   R
   t   MMBadConfirmationR„  R   R´  R    Rh   R‡   R   Rµ  RÒ  R'  RÓ  R¦   R   R@   R“  RF   t   SendHostileSubscriptionNoticet   HostileSubscriptionErrorRá   Ré  Rê  RÜ   Rë  Rç  R¶  R   R  R  R  t   HELD_MESSAGER5   t   listR·  t	   Iteratorst   typed_subpart_iteratort
   IndexErrorR    t   get_payloadR‘  t   readlineR¥  t   findR�   t   AuthenticateR   t   AuthListAdmint   AuthListModeratort   UnAuthorizedt   APPROVEt   pend_rependt   MMBadPasswordErrort   DISCARDt   HandleRequestt   KeyErrorR   t	   RE_ENABLEt   setDeliveryStatusR   t   ENABLEDRN  (   R8   R]   t   contextt   recRº  R=  RÔ  RÍ  R_   RÒ  R'  RÓ  RÄ  RÈ  R9   R  R  R  RG   R#  t   subpartR   t   linet   it   actionRs   (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   ProcessConfirmationF  sº    


							
	


			


c   
      C   s”  |  j  | d t ƒr$ t j t ‚ n  | d  k rB |  j | ƒ } n  |  j t j	 | ƒ } d |  j
 d d d ƒ| f } |  j } | d  k	 r¤ d | } t d ƒ } n d } d } t j d	 i | d
 6|  j ƒ  d 6| d 6| d 6|  j d ƒ d 6| d 6|  j ƒ  d 6| d 6d | d |  ƒ} t j | |  j | ƒ d | d | ƒ}	 |	 d =|  j | | ƒ |	 d <|  j | ƒ |	 d <|	 d =d |	 d <|	 j |  ƒ d  S(   NR¸  s   %s/%sR½  R{   i   RÕ  s    from %(remote)sR!   s	   unsub.txtR·  RÖ  Ri   R]   RZ   RÀ  R×  RØ  R¿  RÄ  RÂ  RÃ  Rc   RÅ  s   Reply-Tos   auto-submitteds   auto-generateds   Auto-Submitted(   R»  R‘  R
   RÞ  R·  R,   R
  RÉ  R   R¶  R|   RÜ   Rh   R	   RÊ  Rn   RU   RY   R   RË  R^   Rm   RÌ  (
   R8   R_   RÄ  R×  R]   R¿  Rì  Rî  RÃ  RÐ  (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   ConfirmUnsubscriptionÉ  sB    
	



c         C   s`  d |  j  ƒ  |  j f } g  } g  } x- d	 D]% } | j t | j | g  ƒ ƒ ƒ q, Wxz | D]r \ } } | d
 k rz q\ n  | j ƒ  } | j d ƒ d } | |  j  ƒ  k s· | | k r» t S| j	 | | f ƒ q\ Wd „  }	 |  j
 j ƒ  }
 xo | D]g \ } } xX |
 D]P } | j ƒ  } | s"qn  d | k rA|	 | | ƒ rAt S|	 | | ƒ rt SqWqñ Wt S(   st   True if list name or any acceptable_alias is included among the
        addresses in the recipient headers.
        s   %s@%st   tot   ccs	   resent-tos	   resent-ccR`   i    c         S   s`   y  t  j |  | t  j ƒ r t SWn9 t  j k
 r[ t  j t  j |  ƒ | t  j ƒ r\ t Sn Xt S(   N(   RR  t   matcht
   IGNORECASER‘  R%   t   escapeR“  (   R«  R_   (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   domatch  s    !(   RE  RF  s	   resent-tos	   resent-ccN(   RF   RS   R&   R   t   get_allR,   R�   Rq   R‘  Rš   RÅ   R¨  R¥  R“  (   R8   RÐ  t   listfullnamet   recipsRE  t   headerRÒ  R_   t	   localpartRJ  t   aliasest   aliast   stripped(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   HasExplicitDestò  s4    #	c         C   s  g  } xö |  j  j d ƒ D]â } | j ƒ  } | s | d d k rH q n  | j d ƒ } | d k  r| t d d |  j | ƒ q | |  } | | d j ƒ  } y t j | t j	 ƒ } Wn/ t j
 k
 rä } t d d |  j | | ƒ q X| j | | | f ƒ q W| S(	   s:   Return a list of triples [(field name, regex, line), ...].s   
i    t   #R!  t   configs&   bad bounce_matching_header line: %s
%si   s=   bad regexp in bounce_matching_header line: %s

%s (cause: %s)(   RÕ   Rq   R¥  R/  R   RÜ   t   lstripRR  R©  RH  R%   Rš   (   R8   t   allR@  RA  RN  RL  t   creR>   (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   parse_matching_header_opt+  s$    	
c         C   sT   xM |  j  ƒ  D]? \ } } } x- | j | g  ƒ D] } | j | ƒ r/ | Sq/ Wq Wd S(   sÇ   Return true if named header field matches a regexp in the
        bounce_matching_header list variable.

        Returns constraint line which matches or empty string for no
        matches.
        i    (   RY  RK  t   search(   R8   RÐ  RN  RX  R@  RL  (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   hasMatchingHeaderK  s
    c   	      C   s‹  | d k r |  j } n  t j | ƒ t j d k r8 d St j ƒ  d  } |  j j	 | ƒ } | d k sv | d | k r� | d f |  j | <d S| \ } } | d k  r¹ t
 d d | ƒ d S| t j k rpt
 d d | ƒ | d f |  j | <t j d i | d	 6d
 |  j |  j f d 6| d 6|  j ƒ  d 6d | ƒ} t j | |  j ƒ  t d ƒ | d | ƒ} | j |  ƒ d S| | d f |  j | <d S(   s  Return true if Mailman should auto-respond to this sender.

        This is only consulted for messages sent to the -request address, or
        for posting hold notifications, and serves only as a safety value for
        mail loops with email 'bots.
        i    i   i   R¼  s,   -request/hold autoresponse discarded for: %ss,   -request/hold autoresponse limit hit for: %siÿÿÿÿs   nomoretoday.txtRÏ  s   %s@%sRi   t   numt
   owneremailRÄ  s(   Last autoresponse notification for todayN(   R,   Rg   R   Rû  R   t   MAX_AUTORESPONSES_PER_DAYR�   t	   localtimeR(  R5   R   R	   RÊ  RÜ   RS   RY   R   RË  Rh   RÌ  (	   R8   RÏ  RÄ  t   todayRÝ   t   datet   countRÃ  RÐ  (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   autorespondToSenderX  sD    		
		c         C   s(   |  j  | |  j ƒ p' |  j  | t j ƒ S(   s\   Returns matched entry in ban_list if email matches.
        Otherwise returns None.
        (   t
   GetPatternR&  R   t   GLOBAL_BAN_LIST(   R8   R·  (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyRÆ  ‰  s    c         C   sG   t  } |  j | |  j d d ƒrC t } t d d |  j ƒ  | ƒ n  | S(   s¬   Returns True and logs if sender matches address or pattern
        or is a member of a referenced list in subscribe_auto_approval.
        Otherwise returns False.
        t   at_listRã   R¼  s#   %s: auto approved subscribe from %s(   R“  Rd  Rã   R‘  R   RF   (   R8   RÏ  t   auto_approve(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyRé  ‘  s    				c      	   C   sß  d } g  | D]= } | j ƒ  r | j d ƒ p: | j d ƒ r | j ƒ  ^ q } t j | d d ƒ} | j | j ƒ  ƒ r~ | SxZ| D]R} | j d ƒ ry& t j | | t j	 ƒ r¿ | } Pn  Wq×t j
 k
 r	}	 | pÞ d }
 t d d |
 |  j ƒ  | t |	 ƒ ƒ q×Xq… | r… | j d ƒ r… | d j ƒ  j ƒ  } | |  j ƒ  k rit d d | |  j ƒ  ƒ q… n  y t | d	 t ƒ} Wn3 t j k
 r´t d d
 | |  j ƒ  | ƒ q… n X| j | j ƒ  ƒ r×| } Pq×q… q… W| S(   sò   Returns matched entry in pattern_list if email matches.
        Otherwise returns None.  The at_list argument, if "true",
        says process the @listname syntax and provides the name of
        the list attribute for log messages.
        t   ^R`   t   foldcasei   R&  R%   s    %s in %s has bad regexp "%s": %ss   %s in %s references own listR:   s(   %s in %s references non-existent list %sN(   R,   R¥  R™   R	   t	   List2Dictt   has_keyR�   RR  RZ  RH  R%   R   RF   t   strR#   R“  R
   RŽ  RÜ  (   R8   R·  t   pattern_listRf  t   matchedt   xt
   plainaddrst   addrdictR«  R>   t	   attr_namet   mnamet   mother(    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyRd     sR    1		c         C   sT   |  j  } t j | k r+ | j t j ƒ n  g  | D] } t j j | ƒ r2 | ^ q2 S(   N(   Rñ   R   Rð   Rš   t   LC_DESCRIPTIONSRk  (   R8   RY  RÄ  (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   GetAvailableLanguagesâ  s    	N(:   RA  RB  R,   R$   RD   RI   R6   RL   RE   RF   R0   RU   RW   RY   R^   R\   Rl   Rm   Rn   Rv   R|   R…   R�   R*   Rœ   RG  RH  RK  R\  Rw  R|  R�  R‘  R7   R”  R–  RX  R“  R»  RÑ  Rò  Rç  R	  R  R  R  R  R  RC  RD  RS  RY  R[  Rc  RÆ  Ré  Rd  Rv  (    (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyR#   Z   sp   &		
													›			(	(		:6	"		..�	\	!		:	:	 ƒ)	9	 	1		B(E   t   __doc__t   sysR-   R�   R~  R3   RR  Rž  R^  R   Rb  t	   cStringIOR    R   R   t   typest   email.IteratorsR·  t   email.UtilsR   R   R   t   email.HeaderR   t   MailmanR   R	   R
   R   t   Mailman.UserDescR   t   Mailman.ArchiverR   t   Mailman.AutoresponderR   t   Mailman.BouncerR   t   Mailman.DelivererR   t   Mailman.DigesterR   t   Mailman.GatewayManagerR   t   Mailman.HTMLFormatterR   t   Mailman.ListAdminR   t   Mailman.SecurityManagerR   t   Mailman.TopicMgrR   R   R   R   t   Mailman.OldStyleMembershipsR   R   R   R   t   Mailman.Logging.SyslogR   Rh   R    t   EMPTYSTRINGR§  R‘  R“  t	   NameErrorR#   (    (    (    s/   /export/web/mailman/mailman/Mailman/MailList.pyt   <module>   sh   
		
