changes to mailpasswd to support multiple domains
Attached is a patch to cron/mailpasswds and templates/cronpass.txt to support multiple domains in the monthly password reminder.
Patch is against latest CVS sources (1.0b11)
WARNING: Apply with care! I'm just getting familiar with Python and Mailman so I could have made some really idiotic mistakes, but it works here...
To Apply:
cd /usr/src/mailman ("main" source directory)
patch -p1 -b <password.dif
Primary reason the patch file is so large is that I "de-tabbed" the source file (removed leading tabs and replaced with spaces). The original source was about half tabs and half spaces for indents. I'm not sure what the "official" position is on indenting for mailman. Let me know if this isn't necessary in the future.
-Jeff
diff -c -r MM.orig/cron/mailpasswds MM/cron/mailpasswds *** MM.orig/cron/mailpasswds Sat Apr 3 09:18:19 1999 --- MM/cron/mailpasswds Sun Apr 4 10:00:24 1999
*** 51,79 ****
The list can be any random one - it is only used for the message
delivery mechanism."""
! subj = '%s maillist memberships reminder\n' % list.host_name count = PAUSE_FREQUENCY for user, data in users.items(): ! table = [] ! for l, p, u in data: ! if len(l) > 9: ! table.append("%s\n %-10s\n%s\n" % (l, p, u)) ! else: ! table.append("%-10s %-10s\n%s\n" % (l, p, u)) ! header = ("%-10s %-10s\n%-10s %-10s" ! % ("List", "Password // URL", "----", "--------")) text = Utils.maketext( 'cronpass.txt', ! {'hostname': list.host_name, 'user' : user, ! 'one_list': l, }) # add this to the end so it doesn't get wrapped/filled text = text + header + '\n' + string.join(table, '\n') ! list.SendTextToUser(subject = subj, ! recipient = user, ! text = text, ! sender = mm_cfg.MAILMAN_OWNER, add_headers = ["X-No-Archive: yes", "Precedence: bulk"]) count = count - 1 --- 51,82 ----
The list can be any random one - it is only used for the message
delivery mechanism."""
! default_host = mm_cfg.DEFAULT_HOST_NAME ! mailman_owner = mm_cfg.MAILMAN_OWNER ! subj = '%s maillist memberships reminder\n' % default_host count = PAUSE_FREQUENCY for user, data in users.items(): ! table = [] ! for l, r, p, u in data: ! if len(l) > 39: ! table.append("%s\n %-10s\n%s\n" % (l, p, u)) ! else: ! table.append("%-40s %-10s\n%s\n" % (l, p, u)) ! header = ("%-40s %-10s\n%-40s %-10s" ! % ("List", "Password // URL", "----", "--------")) text = Utils.maketext( 'cronpass.txt', ! {'def_host': default_host, 'user' : user, ! 'ex_req' : r, ! 'mm_owner': mailman_owner, }) # add this to the end so it doesn't get wrapped/filled text = text + header + '\n' + string.join(table, '\n') ! list.SendTextToUser(subject = subj, ! recipient = user, ! text = text, ! sender = mailman_owner, add_headers = ["X-No-Archive: yes", "Precedence: bulk"]) count = count - 1
*** 87,119 **** the user a single message with the info for all their lists on this site.""" list = None ! users = {} # user: (listname, password, url) # Constrain to specified users, if any. confined_to = args[1:] a_public_list = None for name in Utils.list_names(): ! list = MailList.MailList(name, lock = 0) if not a_public_list and list.advertised: a_public_list = list ! list_name = list.real_name ! umbrella_list = list.umbrella_list ! if not list.send_reminders: ! continue ! for user, password in list.passwords.items(): if confined_to: if user not in confined_to: continue else: # We're a bit verbose when operating "confined_to": print "%s in %s" % (user, list.real_name) ! url = list.GetAbsoluteOptionsURL(user) recipient = list.GetMemberAdminEmail(user) ! if users.has_key(recipient): ! users[recipient].append(list_name, password, url) ! else: ! users[recipient] = [(list_name, password, url)] if list: ! MailAllPasswords(a_public_list or list, users)
def waitall(): """Return only when there are no forked subprocesses running.""" --- 90,125 ---- the user a single message with the info for all their lists on this site.""" list = None ! users = {} # user: (list address, request address, password, url) # Constrain to specified users, if any. confined_to = args[1:] a_public_list = None for name in Utils.list_names(): ! list = MailList.MailList(name, lock = 0) if not a_public_list and list.advertised: a_public_list = list ! list_address = list.GetListEmail() ! list_request = list.GetRequestEmail() ! umbrella_list = list.umbrella_list ! if not list.send_reminders: ! continue ! for user, password in list.passwords.items(): if confined_to: if user not in confined_to: continue else: # We're a bit verbose when operating "confined_to": print "%s in %s" % (user, list.real_name) ! url = list.GetAbsoluteOptionsURL(user) recipient = list.GetMemberAdminEmail(user) ! if users.has_key(recipient): ! users[recipient].append(list_address, list_request, ! password, url) ! else: ! users[recipient] = [(list_address, list_request, ! password, url)] if list: ! MailAllPasswords(a_public_list or list, users)
def waitall(): """Return only when there are no forked subprocesses running.""" diff -c -r MM.orig/templates/cronpass.txt MM/templates/cronpass.txt *** MM.orig/templates/cronpass.txt Sat Apr 3 09:18:28 1999 --- MM/templates/cronpass.txt Sun Apr 4 08:07:38 1999
*** 1,4 **** ! This is a reminder, sent out once a month, about your %(hostname)s mailing list memberships. It includes your subscription info and how to use it to change it or unsubscribe from a list.
--- 1,4 ---- ! This is a reminder, sent out once a month, about your %(def_host)s mailing list memberships. It includes your subscription info and how to use it to change it or unsubscribe from a list.
*** 8,18 ****
In addition to the URL interfaces, you can also use email to make such changes. For more info, send a message to the '-request' address of ! the list (for example, %(one_list)s-request@%(hostname)s) containing just the word 'help' in the message body, and an email message will be sent to you with instructions.
If you have questions, problems, comments, etc, send them to ! mailman-owner@%(hostname)s. Thanks!
Passwords for %(user)s: --- 8,19 ----
In addition to the URL interfaces, you can also use email to make such changes. For more info, send a message to the '-request' address of ! the list (for example, %(ex_req)s) containing just the word 'help' in the message body, and an email message will be sent to you with instructions.
If you have questions, problems, comments, etc, send them to ! %(mm_owner)s. Thanks!
Passwords for %(user)s: +
participants (1)
-
Jeff Hahn