ó
[ü½cc           @   sR   d  Z  d d l m Z d d l m Z d d l m Z d Z d   Z d   Z	 d S(	   sż  
    unsubscribe [password] [address=<address>]
        Unsubscribe from the mailing list.  If given, your password must match
        your current password.  If omitted, a confirmation email will be sent
        to the unsubscribing address. If you wish to unsubscribe an address
        other than the address you sent this request from, you may specify
        `address=<address>' (no brackets around the email address, and no
        quotes!)
i˙˙˙˙(   t	   parseaddr(   t   Errors(   t   _i   c         C   s
   t  t  S(   N(   R   t   __doc__(   t   mlist(    (    s?   /export/web/mailman/mailman/Mailman/Commands/cmd_unsubscribe.pyt   gethelp$   s    c         C   s  |  j  } d  } d  } d } xy | D]q } | j d  rD | d } nE | d k rY | } n0 |  j j t d   |  j j t |   t S| d 7} q" W| d  k rż t |  j	 d  \ } } n  | j
 |  sñ | j } |  j j t d   t S| j r>y | j | d  Wqŝt j k
 r:|  j j t d	   qŝXnÀ | d  k r£| j |  }	 y | j |	  Wn* t j k
 r|  j j t d
   qŝXd |  _ n[ | j |  }
 |
 | k rĜ|  j j t d   t S| j | d  |  j j t d   d  S(   Ni    s   address=i   s   Usage:i   t   froms<   %(address)s is not a member of the %(listname)s mailing listt   mailcmdsV   Your unsubscription request has been forwarded to the list administrator for
approval.s4   You already have a subscription pending confirmations   You gave the wrong passwords!   Unsubscription request succeeded.(   R   t   Nonet
   startswitht   resultst   appendR   R   t   STOPR    t   msgt   isMembert	   real_namet   unsubscribe_policyt   DeleteMemberR   t   MMNeedApprovalt   getMemberCPAddresst   ConfirmUnsubscriptiont   MMAlreadyPendingt   respondt   getMemberPasswordt   ApprovedDeleteMember(   t   rest   argsR   t   passwordt   addresst   argnumt   argt   realnamet   listnamet   cpaddrt   oldpw(    (    s?   /export/web/mailman/mailman/Mailman/Commands/cmd_unsubscribe.pyt   process)   sP    						N(
   R   t   email.UtilsR    t   MailmanR   t   Mailman.i18nR   R   R   R#   (    (    (    s?   /export/web/mailman/mailman/Mailman/Commands/cmd_unsubscribe.pyt   <module>   s   	