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

RevLine 
[2208]1--- mailman/bin/newlist.orig    2007-02-28 16:35:57.000000000 -0500
2+++ mailman/bin/newlist 2007-10-04 04:44:01.000000000 -0400
3@@ -164,7 +164,7 @@
4 
5     if '@' in listname:
6         # note that --urlhost and --emailhost have precedence
7-        listname, domain = listname.split('@', 1)
8+        firstname, domain = listname.split('@', 1)
9         urlhost = urlhost or domain
10         emailhost = emailhost or mm_cfg.VIRTUAL_HOSTS.get(domain, domain)
11 
12--- mailman/Mailman/Gui/General.py.orig 2007-02-28 16:35:58.000000000 -0500
13+++ mailman/Mailman/Gui/General.py      2007-10-04 02:42:44.000000000 -0400
14@@ -420,7 +420,7 @@
15 
16     def _setValue(self, mlist, property, val, doc):
17         if property == 'real_name' and \
18-               val.lower() <> mlist.internal_name().lower():
19+               val.lower() <> mlist.real_name.lower():
20             # These values can't differ by other than case
21             doc.addError(_("""<b>real_name</b> attribute not
22             changed!  It must differ from the list's name by case
23--- mailman/Mailman/Handlers/CookHeaders.py.orig        2007-02-28 16:35:58.000000000 -0500
24+++ mailman/Mailman/Handlers/CookHeaders.py     2007-10-04 02:46:39.000000000 -0400
25@@ -180,7 +180,9 @@
26     if msgdata.get('_nolist') or not mlist.include_rfc2369_headers:
27         return
28     # This will act like an email address for purposes of formataddr()
29-    listid = '%s.%s' % (mlist.internal_name(), mlist.host_name)
30+    #listid = '%s.%s' % (mlist.internal_name(), mlist.host_name)
31+    # internal_name already contains the hostname with the vhost patch
32+    listid = mlist.internal_name()
33     cset = Utils.GetCharSet(mlist.preferred_language)
34     if mlist.description:
35         # Don't wrap the header since here we just want to get it properly RFC
36--- mailman/Mailman/MailList.py.orig    2007-02-28 16:35:58.000000000 -0500
37+++ mailman/Mailman/MailList.py 2007-10-04 04:29:08.000000000 -0400
38@@ -185,9 +185,14 @@
39         return self._full_path
40 
41     def getListAddress(self, extra=None):
42+        posting_addr = self.internal_name()
43+        try:
44+            posting_addr = self.real_name.lower()
45+        except:
46+            pass
47         if extra is None:
48-            return '%s@%s' % (self.internal_name(), self.host_name)
49-        return '%s-%s@%s' % (self.internal_name(), extra, self.host_name)
50+            return '%s@%s' % (posting_addr, self.host_name)
51+        return '%s-%s@%s' % (posting_addr, extra, self.host_name)
52 
53     # For backwards compatibility
54     def GetBouncesEmail(self):
55@@ -470,8 +475,6 @@
56     #
57     def Create(self, name, admin, crypted_password,
58                langs=None, emailhost=None):
59-        if Utils.list_exists(name):
60-            raise Errors.MMListAlreadyExistsError, name
61         # Validate what will be the list's posting address.  If that's
62         # invalid, we don't want to create the mailing list.  The hostname
63         # part doesn't really matter, since that better already be valid.
64@@ -479,19 +482,32 @@
65         # the admin's email address, so transform the exception.
66         if emailhost is None:
67             emailhost = mm_cfg.DEFAULT_EMAIL_HOST
68-        postingaddr = '%s@%s' % (name, emailhost)
69+        # default, for when no domain is given
70+        firstname = name
71+        # we set a special name for virtual hosted lists
72+        if '@' in name:
73+            firstname, emailhost = name.split('@', 1)
74+            name = "%s-%s" % (firstname, emailhost)
75+        # but we keep a sensible posting address
76+        postingaddr = '%s@%s' % (firstname, emailhost)
77         try:
78             Utils.ValidateEmail(postingaddr)
79         except Errors.MMBadEmailError:
80             raise Errors.BadListNameError, postingaddr
81         # Validate the admin's email address
82         Utils.ValidateEmail(admin)
83+        if Utils.list_exists(name):
84+            raise Errors.MMListAlreadyExistsError, name
85         self._internal_name = name
86         self._full_path = Site.get_listpath(name, create=1)
87         # Don't use Lock() since that tries to load the non-existant config.pck
88         self.__lock.lock()
89         self.InitVars(name, admin, crypted_password)
90         self.CheckValues()
91+        # this is for getListAddress
92+        self.list_address = postingaddr
93+        self.real_name = firstname
94+        self.subject_prefix = mm_cfg.DEFAULT_SUBJECT_PREFIX % self.__dict__
95         if langs is None:
96             self.available_languages = [self.preferred_language]
97         else:
98@@ -1322,7 +1338,7 @@
99         addresses in the recipient headers.
100         """
101         # This is the list's full address.
102-        listfullname = '%s@%s' % (self.internal_name(), self.host_name)
103+        listfullname = self.getListAddress()
104         recips = []
105         # Check all recipient addresses against the list's explicit addresses,
106         # specifically To: Cc: and Resent-to:
107@@ -1337,7 +1353,7 @@
108             addr = addr.lower()
109             localpart = addr.split('@')[0]
110             if (# TBD: backwards compatibility: deprecated
111-                    localpart == self.internal_name() or
112+                    localpart == self.real_name.lower() or
113                     # exact match against the complete list address
114                     addr == listfullname):
115                 return True
116--- mailman/bin/rmlist.orig 2007-12-20 00:33:30.000000000 -0500
117+++ mailman/bin/rmlist      2007-12-20 00:33:37.000000000 -0500
[2215]118@@ -92,6 +92,11 @@
[2208]119         usage(1)
120     listname = args[0].lower().strip()
121 
[2215]122+    if '@' in listname:
123+        # note that --urlhost and --emailhost have precedence
124+        firstname, domain = listname.split('@', 1)
125+        listname = '%s-%s' % ( firstname, domain )
126+
[2208]127     removeArchives = False
128     for opt, arg in opts:
129         if opt in ('-a', '--archives'):
Note: See TracBrowser for help on using the repository browser.