;ς
’)?Bc           @   sΒ  d  Z  d k Z d k l Z d k l Z d k Z d k l Z d k	 l
 Z
 d k	 l Z d k	 l Z d k	 l Z d	 k	 l Z d
 k	 l Z d k l Z d   Z d e i f d     YZ d e i f d     YZ d e i f d     YZ d e i f d     YZ d e i f d     YZ d e i f d     YZ d e i f d     YZ d e i f d     YZ d e i f d     YZ d e f d      YZ e i Z d!   Z d"   Z d#   Z  d S($   sT  Determine whether this message should be held for approval.

This modules tests only for hold situations, such as messages that are too
large, messages that have potential administrivia, etc.  Definitive approvals
or denials are handled by a different module.

If no determination can be made (i.e. none of the hold criteria matches), then
we do nothing.  If the message must be held for approval, then the hold
database is updated and any administrator notification messages are sent.
Finally an exception is raised to let the pipeline machinery know that further
message handling should stop.

N(   s   MIMEText(   s   MIMEMessage(   s	   ClassType(   s   mm_cfg(   s   Utils(   s   Errors(   s   Message(   s   i18n(   s   Pending(   s   syslogc         C   s   |  Sd  S(   N(   s   s(   s   s(    (    s%   /var/mailman/Mailman/Handlers/Hold.pys   _/   s    s   ForbiddenPosterc           B   s    t  Z e d  Z e d  Z RS(   Ns   Sender is explicitly forbiddens5   You are forbidden from posting messages to this list.(   s   __name__s
   __module__s   _s   reasons	   rejection(    (    (    s%   /var/mailman/Mailman/Handlers/Hold.pys   ForbiddenPoster4   s   s   ModeratedPostc           B   s    t  Z e d  Z e d  Z RS(   Ns   Post to moderated lists7   Your message was deemed inappropriate by the moderator.(   s   __name__s
   __module__s   _s   reasons	   rejection(    (    (    s%   /var/mailman/Mailman/Handlers/Hold.pys   ModeratedPost8   s   s   NonMemberPostc           B   s    t  Z e d  Z e d  Z RS(   Ns)   Post by non-member to a members-only lists:   Non-members are not allowed to post messages to this list.(   s   __name__s
   __module__s   _s   reasons	   rejection(    (    (    s%   /var/mailman/Mailman/Handlers/Hold.pys   NonMemberPost<   s   s   NotExplicitlyAllowedc           B   s    t  Z e d  Z e d  Z RS(   Ns8   Posting to a restricted list by sender requires approvals7   This list is restricted; your message was not approved.(   s   __name__s
   __module__s   _s   reasons	   rejection(    (    (    s%   /var/mailman/Mailman/Handlers/Hold.pys   NotExplicitlyAllowed@   s   s   TooManyRecipientsc           B   s    t  Z e d  Z e d  Z RS(   Ns"   Too many recipients to the messages/   Please trim the recipient list; it is too long.(   s   __name__s
   __module__s   _s   reasons	   rejection(    (    (    s%   /var/mailman/Mailman/Handlers/Hold.pys   TooManyRecipientsD   s   s   ImplicitDestinationc           B   s    t  Z e d  Z e d  Z RS(   Ns    Message has implicit destinations’   Blind carbon copies or other implicit destinations are
not allowed.  Try reposting your message by explicitly including the list
address in the To: or Cc: fields.(   s   __name__s
   __module__s   _s   reasons	   rejection(    (    (    s%   /var/mailman/Mailman/Handlers/Hold.pys   ImplicitDestinationH   s   s   Administriviac           B   s   t  Z e d  Z d   Z RS(   Ns!   Message may contain administriviac         C   s/   | i d d d } | i   } t d  Sd  S(   Ns   listinfos   absolutei   sΪ   Please do *not* post administrative requests to the mailing
list.  If you wish to subscribe, visit %(listurl)s or send a message with the
word `help' in it to the request address, %(request)s, for further
instructions.(   s   mlists   GetScriptURLs   listurls   GetRequestEmails   requests   _(   s   selfs   mlists   requests   listurl(    (    s%   /var/mailman/Mailman/Handlers/Hold.pys   rejection_noticeQ   s    (   s   __name__s
   __module__s   _s   reasons   rejection_notice(    (    (    s%   /var/mailman/Mailman/Handlers/Hold.pys   AdministriviaN   s   s   SuspiciousHeadersc           B   s    t  Z e d  Z e d  Z RS(   Ns   Message has a suspicious headers%   Your message had a suspicious header.(   s   __name__s
   __module__s   _s   reasons	   rejection(    (    (    s%   /var/mailman/Mailman/Handlers/Hold.pys   SuspiciousHeadersY   s   s   MessageTooBigc           B   s#   t  Z d   Z d   Z d   Z RS(   Nc         C   s   | |  _ | |  _ d  S(   N(   s   msgsizes   selfs   _MessageTooBig__msgsizes   limits   _MessageTooBig__limit(   s   selfs   msgsizes   limit(    (    s%   /var/mailman/Mailman/Handlers/Hold.pys   __init__^   s    	c         C   s    |  i } |  i } t d  Sd  S(   NsD   Message body is too big: %(size)d bytes with a limit of
%(limit)d KB(   s   selfs   _MessageTooBig__msgsizes   sizes   _MessageTooBig__limits   limits   _(   s   selfs   limits   size(    (    s%   /var/mailman/Mailman/Handlers/Hold.pys   reason_noticeb   s    		c         C   s   |  i } t d  Sd  S(   NsH   Your message was too big; please trim it to less than
%(kb)d KB in size.(   s   selfs   _MessageTooBig__limits   kbs   _(   s   selfs   mlists   kb(    (    s%   /var/mailman/Mailman/Handlers/Hold.pys   rejection_noticeh   s    	(   s   __name__s
   __module__s   __init__s   reason_notices   rejection_notice(    (    (    s%   /var/mailman/Mailman/Handlers/Hold.pys   MessageTooBig]   s   		s   ModeratedNewsgroupc           B   s   t  Z e d  Z RS(   Ns    Posting to a moderated newsgroup(   s   __name__s
   __module__s   _s   reason(    (    (    s%   /var/mailman/Mailman/Handlers/Hold.pys   ModeratedNewsgroupm   s   c         C   sc   |  i d d  i   } |  i d d  i   } | d j o | d d d f j o d Sn d	 Sd  S(
   Ns   x-acks    s
   precedences   yess   bulks   junks   listi    i   (   s   msgs   gets   lowers   acks
   precedence(   s   msgs   acks
   precedence(    (    s%   /var/mailman/Mailman/Handlers/Hold.pys   ackpw   s
    #c   
      C   s:  | i d  o d  Sn |  i   } | d } | i   } | p | t	 |  d  | j o | i d d  } n |  i
 o t i |  o t |  | | t  n |  i d j o_ t i i | i d g   | i d g    }	 t	 |	  |  i j o t |  | | t  qn |  i o |  i |  o | i d  o t |  | | t  n |  i o1 |  i |  } | o t |  | | t  qn |  i d j on d } x* t i i |  D] } | t	 |  7} qΊW| d	 |  i j o# t |  | | t! | |  i   qn |  i" d
 j o t |  | | t#  n d  S(   Ns   approveds   -admini   s   use_envelopei    s   tos   ccs
   fromusenetf1024.0i   ($   s   msgdatas   gets   mlists   internal_names   listnames	   adminaddrs   msgs
   get_senders   senders   lens   administrivias   Utilss   is_administrivias   hold_for_approvals   Administrivias   max_num_recipientss   emails   getaddressess   get_alls   recipss   TooManyRecipientss   require_explicit_destinations   HasExplicitDests   ImplicitDestinations   bounce_matching_headerss   hasMatchingHeaders	   triggereds   SuspiciousHeaderss   max_message_sizes   bodylens	   Iteratorss   body_line_iterators   lines   MessageTooBigs   news_moderations   ModeratedNewsgroup(
   s   mlists   msgs   msgdatas   listnames   lines   senders	   triggereds	   adminaddrs   bodylens   recips(    (    s%   /var/mailman/Mailman/Handlers/Hold.pys   process   s:    
#.,
 c         C   sΜ  t  |  t j o |   } n |  i } | i d | i	    } | i d  }
 t i |  i  } |
 o t i |
 |  }
 n t d  }
 | i d d  } |  i   } |  i   } |  i   } t i | i    } t i | i |    | d <|  i | | |  } h  d | <d |  i <d	 t |  <d | <d |
 <d
 |  i  d d d <} | i d  } |  i# t$ i% |  } | o$ t' |  o |  i( o |  i) |  o d |  i  d d d | f | d <| i d |  i* |   } t d  }	 t i- d | d | d |  } t/ i0 | | |	 | |  } | i2 |   n |  i3 o]t4 i5   } t4 i7 |  i  z,|  i } t i |  } t |  | d	 <|
 | d <t d  }	 t/ i0 | | |	 d | } | i8 d  t9 t i- d | d d d |  d | } t9 t i t d   d t i |  } d | | d <| | d <| | d <| i; |  | i; t< |   | i; t< |   | i2 |  h  d  d < Wd  t4 i= |  Xn t> d! d" | | | |  |  d  S(#   Ns   senders   subjects   (no subject)s
   message-ids   n/as   rejection_notices   listnames   hostnames   reasons   admindb_urls   admindbs   absolutei   s
   fromusenets   %s/%ss   confirms
   confirmurls   langs6   Your message to %(listname)s awaits moderator approvals   postheld.txts   mlists3   %(listname)s post from %(sender)s requires approvals   multipart/mixeds   postauth.txts   raws   _charsetsm  If you reply to this message, keeping the Subject: header intact, Mailman will
discard the held message.  Do this if the message is spam.  If you reply to
this message and include an Approved: header with the list password in it, the
message will be approved for posting to the list.  The Approved: header can
also appear in the first line of the body of the reply.s   confirm s   Subjects   Senders   Froms   tomoderatorss   vettes'   %s post from %s held, message-id=%s: %s(?   s   types   excs	   ClassTypes   mlists	   real_names   listnames   msgdatas   gets   msgs
   get_senders   senders   usersubjects   Utilss
   GetCharSets   preferred_languages   charsets   onelines   _s
   message_ids   GetOwnerEmails	   owneraddrs   GetBouncesEmails	   adminaddrs   GetRequestEmails   requestaddrs   wraps   reason_notices   reasons   rejection_notices   HoldMessages   ids	   host_names   GetScriptURLs   ds
   fromusenets   pend_news   Pendings   HELD_MESSAGEs   cookies   ackps   respond_to_post_requestss   autorespondToSenders   getMemberLanguages   langs   subjects   maketexts   texts   Messages   UserNotifications   nmsgs   sends   admin_immed_notifys   i18ns   get_translations   otranslations   set_languages   set_types   MIMETexts   dmsgs   attachs   MIMEMessages   set_translations   syslog(   s   mlists   msgs   msgdatas   excs   otranslations   requestaddrs   texts	   owneraddrs   ids   subjects   usersubjects   charsets   nmsgs   dmsgs
   message_ids	   adminaddrs   reasons   cookies
   fromusenets   ds   langs   listnames   sender(    (    s%   /var/mailman/Mailman/Handlers/Hold.pys   hold_for_approvalΏ   sl    	T/#
	


 	(!   s   __doc__s   emails   email.MIMETexts   MIMETexts   email.MIMEMessages   MIMEMessages   email.Utilss   typess	   ClassTypes   Mailmans   mm_cfgs   Utilss   Errorss   Messages   i18ns   Pendings   Mailman.Logging.Syslogs   syslogs   _s   HoldMessages   ForbiddenPosters   ModeratedPosts   NonMemberPosts   NotExplicitlyAlloweds   TooManyRecipientss   ImplicitDestinations   Administrivias   SuspiciousHeaderss   MessageTooBigs   ModeratedNewsgroups   ackps   processs   hold_for_approval(   s   SuspiciousHeaderss   Errorss   ForbiddenPosters   MessageTooBigs   syslogs   MIMETexts   NonMemberPosts   Pendings   ModeratedNewsgroups   hold_for_approvals   processs   emails   ImplicitDestinations   mm_cfgs   i18ns   TooManyRecipientss   _s   MIMEMessages	   ClassTypes   Utilss   ModeratedPosts   NotExplicitlyAlloweds   ackps   Administrivias   Message(    (    s%   /var/mailman/Mailman/Handlers/Hold.pys   ?   s6   							?