ó
Oü½cc           @   s’   d  Z  d d l Z d d l Z d d l m Z e j d e j ƒ e j d e j ƒ f Z e j d ƒ Z e j d ƒ e j d ƒ f Z	 d	 „  Z
 d S(
   s,   Yahoo! has its own weird format for bounces.iÿÿÿÿN(   t	   parseaddrs   message\s+from\s+yahoo\.\S+sQ   Sorry, we were unable to deliver your message to the following address(\(es\))?\.s   <(?P<addr>[^>]*)>:s   --- Original message followss,   --- Below this line is a copy of the messagec         C   s-  t  |  j d d ƒ j ƒ  ƒ d p% d } | j d ƒ s; d  Sg  } d } xß t j j |  ƒ D]Ë } | j ƒ  } | d k r¥ xª t	 D] } | j
 | ƒ r d } Pq q WqZ | d k rt j
 | ƒ } | râ | j | j d ƒ ƒ qZ n  x@ t D]% } | j
 | ƒ } | ré d } Pqé qé WqZ | d k rZ PqZ qZ W| S(   Nt   fromt    i   s   mailer-daemon@yahooi    t   addri   (   R    t   gett   lowert
   startswitht   Nonet   emailt	   Iteratorst   body_line_iteratort   stript   tcret   matcht   acret   appendt   groupt   ecre(   t   msgt   sendert   addrst   statet   linet   cret   mo(    (    s5   /export/web/mailman/mailman/Mailman/Bouncers/Yahoo.pyt   process$   s2    ((   t   __doc__t   reR   t   email.UtilsR    t   compilet
   IGNORECASER   R   R   R   (    (    (    s5   /export/web/mailman/mailman/Mailman/Bouncers/Yahoo.pyt   <module>   s   	