ó
Nü½cc           @   sU   d  Z  d d l Z d d l Z d d d d d d d	 g Z e j d
 ƒ Z d „  Z d S(   sÔ   Parse bounce messages generated by qmail.

Qmail actually has a standard, called QSBMF (qmail-send bounce message
format), as described in

    http://cr.yp.to/proto/qsbmf.txt

This module should be conformant.

iÿÿÿÿNs   Hi. This is thes   Hi. The MTA program ats   We're sorry. There's a problems   Check your send e-mail address.s"   This is the mail delivery agent ats*   Unfortunately, your mail was not delivereds"   Your mail message to the followings   <(?P<addr>[^>]*)>:c         C   sÞ   g  } d } xË t  j j |  ƒ D]· } | j ƒ  } | d k rj x– t D] } | j | ƒ rD d } PqD qD Wq | d k r† | r† d } q | d k r | j d ƒ r¥ Pn  t j | ƒ } | rÖ | j | j	 d ƒ ƒ qÖ q q W| S(   Ni    i   i   t   -t   addr(
   t   emailt	   Iteratorst   body_line_iteratort   stript	   introtagst
   startswitht   acret   matcht   appendt   group(   t   msgt   addrst   statet   linet   introtagt   mo(    (    s5   /export/web/mailman/mailman/Mailman/Bouncers/Qmail.pyt   process.   s$    	 (   t   __doc__t   ret   email.IteratorsR   R   t   compileR   R   (    (    (    s5   /export/web/mailman/mailman/Mailman/Bouncers/Qmail.pyt   <module>   s   	