source: alternc-mailman/trunk/patches/mailman-true-virtual-2.1.9.patch @ 2215

Revision 2215, 5.6 KB checked in by anarcat, 5 years ago (diff)

reverse rmlist patch direction

  • mailman/bin/newlist

    old new  
    164164 
    165165    if '@' in listname: 
    166166        # note that --urlhost and --emailhost have precedence 
    167         listname, domain = listname.split('@', 1) 
     167        firstname, domain = listname.split('@', 1) 
    168168        urlhost = urlhost or domain 
    169169        emailhost = emailhost or mm_cfg.VIRTUAL_HOSTS.get(domain, domain) 
    170170 
  • mailman/Mailman/Gui/General.py

    old new  
    420420 
    421421    def _setValue(self, mlist, property, val, doc): 
    422422        if property == 'real_name' and \ 
    423                val.lower() <> mlist.internal_name().lower(): 
     423               val.lower() <> mlist.real_name.lower(): 
    424424            # These values can't differ by other than case 
    425425            doc.addError(_("""<b>real_name</b> attribute not 
    426426            changed!  It must differ from the list's name by case 
  • mailman/Mailman/Handlers/CookHeaders.py

    old new  
    180180    if msgdata.get('_nolist') or not mlist.include_rfc2369_headers: 
    181181        return 
    182182    # This will act like an email address for purposes of formataddr() 
    183     listid = '%s.%s' % (mlist.internal_name(), mlist.host_name) 
     183    #listid = '%s.%s' % (mlist.internal_name(), mlist.host_name) 
     184    # internal_name already contains the hostname with the vhost patch 
     185    listid = mlist.internal_name() 
    184186    cset = Utils.GetCharSet(mlist.preferred_language) 
    185187    if mlist.description: 
    186188        # Don't wrap the header since here we just want to get it properly RFC 
  • mailman/Mailman/MailList.py

    old new  
    185185        return self._full_path 
    186186 
    187187    def getListAddress(self, extra=None): 
     188        posting_addr = self.internal_name() 
     189        try: 
     190            posting_addr = self.real_name.lower() 
     191        except: 
     192            pass 
    188193        if extra is None: 
    189             return '%s@%s' % (self.internal_name(), self.host_name) 
    190         return '%s-%s@%s' % (self.internal_name(), extra, self.host_name) 
     194            return '%s@%s' % (posting_addr, self.host_name) 
     195        return '%s-%s@%s' % (posting_addr, extra, self.host_name) 
    191196 
    192197    # For backwards compatibility 
    193198    def GetBouncesEmail(self): 
     
    470475    # 
    471476    def Create(self, name, admin, crypted_password, 
    472477               langs=None, emailhost=None): 
    473         if Utils.list_exists(name): 
    474             raise Errors.MMListAlreadyExistsError, name 
    475478        # Validate what will be the list's posting address.  If that's 
    476479        # invalid, we don't want to create the mailing list.  The hostname 
    477480        # part doesn't really matter, since that better already be valid. 
     
    479482        # the admin's email address, so transform the exception. 
    480483        if emailhost is None: 
    481484            emailhost = mm_cfg.DEFAULT_EMAIL_HOST 
    482         postingaddr = '%s@%s' % (name, emailhost) 
     485        # default, for when no domain is given 
     486        firstname = name 
     487        # we set a special name for virtual hosted lists 
     488        if '@' in name: 
     489            firstname, emailhost = name.split('@', 1) 
     490            name = "%s-%s" % (firstname, emailhost) 
     491        # but we keep a sensible posting address 
     492        postingaddr = '%s@%s' % (firstname, emailhost) 
    483493        try: 
    484494            Utils.ValidateEmail(postingaddr) 
    485495        except Errors.MMBadEmailError: 
    486496            raise Errors.BadListNameError, postingaddr 
    487497        # Validate the admin's email address 
    488498        Utils.ValidateEmail(admin) 
     499        if Utils.list_exists(name): 
     500            raise Errors.MMListAlreadyExistsError, name 
    489501        self._internal_name = name 
    490502        self._full_path = Site.get_listpath(name, create=1) 
    491503        # Don't use Lock() since that tries to load the non-existant config.pck 
    492504        self.__lock.lock() 
    493505        self.InitVars(name, admin, crypted_password) 
    494506        self.CheckValues() 
     507        # this is for getListAddress 
     508        self.list_address = postingaddr 
     509        self.real_name = firstname 
     510        self.subject_prefix = mm_cfg.DEFAULT_SUBJECT_PREFIX % self.__dict__ 
    495511        if langs is None: 
    496512            self.available_languages = [self.preferred_language] 
    497513        else: 
     
    13221338        addresses in the recipient headers. 
    13231339        """ 
    13241340        # This is the list's full address. 
    1325         listfullname = '%s@%s' % (self.internal_name(), self.host_name) 
     1341        listfullname = self.getListAddress() 
    13261342        recips = [] 
    13271343        # Check all recipient addresses against the list's explicit addresses, 
    13281344        # specifically To: Cc: and Resent-to: 
     
    13371353            addr = addr.lower() 
    13381354            localpart = addr.split('@')[0] 
    13391355            if (# TBD: backwards compatibility: deprecated 
    1340                     localpart == self.internal_name() or 
     1356                    localpart == self.real_name.lower() or 
    13411357                    # exact match against the complete list address 
    13421358                    addr == listfullname): 
    13431359                return True 
  • mailman/bin/rmlist

    old new  
    9292        usage(1) 
    9393    listname = args[0].lower().strip() 
    9494 
     95    if '@' in listname: 
     96        # note that --urlhost and --emailhost have precedence 
     97        firstname, domain = listname.split('@', 1) 
     98        listname = '%s-%s' % ( firstname, domain ) 
     99 
    95100    removeArchives = False 
    96101    for opt, arg in opts: 
    97102        if opt in ('-a', '--archives'): 
Note: See TracBrowser for help on using the repository browser.