summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authormailman1998-02-23 18:28:01 +0000
committermailman1998-02-23 18:28:01 +0000
commit200ed4b61f74957ffd765da0e4bfe65c5aa769e8 (patch)
tree9a2c8a4d0affd6c8bc4a08bb9014d366f45cb654 /bin
parentbe01a1d3e864d43bf968d895f711485daf2d96ea (diff)
downloadmailman-200ed4b61f74957ffd765da0e4bfe65c5aa769e8.tar.gz
mailman-200ed4b61f74957ffd765da0e4bfe65c5aa769e8.tar.zst
mailman-200ed4b61f74957ffd765da0e4bfe65c5aa769e8.zip
Initial revision
Diffstat (limited to 'bin')
-rwxr-xr-xbin/convert_list100
1 files changed, 100 insertions, 0 deletions
diff --git a/bin/convert_list b/bin/convert_list
new file mode 100755
index 000000000..461f9b9d2
--- /dev/null
+++ b/bin/convert_list
@@ -0,0 +1,100 @@
+#!/usr/local/bin/python
+#
+# argv[1] should be the name of the list.
+# argv[2] should be the list of non-digested users.
+# argv[3] should be the list of digested users.
+
+# Make sure that the list of email addresses doesn't contain any comments,
+# like majordomo may throw in. For now, you just have to remove them manually.
+
+import sys, os, crypt, string
+
+sys.path.append('/home/mailman/mailman/modules')
+
+import maillist, mm_utils, mm_message, mm_cfg
+
+
+
+def GetRandomPassword():
+ return "%s%s" % (mm_utils.GetRandomSeed(), mm_utils.GetRandomSeed())
+
+def SendExplanation(users):
+ msg = mm_message.OutgoingMessage()
+ msg.SetSender(list.GetAdminEmail())
+ msg.SetHeader('subject', 'Big change in %s mailing list' % list.real_name)
+ # Yuck, a quick macro, undo this soon.
+ ma = msg.AppendToBody
+ ma('The %s mailing list has just undergone a big change.\n' % list.real_name)
+ ma('It is running on a new mailing list package called "Mailman".\n')
+ ma('This will hopefully solve a lot of problems that administering\n')
+ ma('this list has presented.\n\n')
+ ma('How does this affect you??\n')
+ ma('1) Mail intended for the whole list should be sent to:\n')
+ ma('\t%s\n\n' % list.GetListEmail())
+ ma('2) You have been given an arbitrary password to prevent others\n')
+ ma(' from unsubscribing you from this mailing list. It will be\n')
+ ma(' mailed to you in a separate mail, which you may have already\n')
+ ma(' received. YOU DON\'T HAVE TO REMEMBER THIS PASSWORD.\n')
+ ma(' A reminder will be sent to you via email every month.\n')
+ ma('3) If you have World Wide Web access, you can use it at any time\n')
+ ma(' to unsubscribe at any time, to switch to and from digest mode,\n')
+ ma(' to check back issues of the list (which will be available after\n')
+ ma(' the list has been getting posts for a day or so).\n')
+ ma(' The Web address for these resources is:\n')
+ ma('\t\t%s\n\n' % list.GetScriptURL('listinfo'))
+ ma('4) If you do not have WWW access, you can do these same things via\n')
+ ma(' email. Send mail to:\n')
+ ma('\t\t%s\n\n' % list.GetRequestEmail())
+ ma(' With a subject or body of:\n')
+ ma('\t\thelp\n\n')
+ ma(' You will receive an automated reply giving you further directions.')
+ ma('\n\nPlease address any questions or problems with this new setup to:\n')
+ ma('\t%s\n\n' % list.GetAdminEmail())
+ ma('(This mail was auto-generated by Mailman %s)\n' % mm_cfg.VERSION)
+
+ list.DeliverToList(msg, users, None, None)
+
+
+if len(sys.argv) <> 4:
+ print 'Usage: convert_list <list name> <non-digest-members-file> <digest-members-file>'
+ sys.exit(0)
+
+try:
+ list = maillist.MailList(sys.argv[1])
+except:
+ print 'run newlist first...'
+ sys.exit(0)
+
+
+try:
+ non_digest_members = string.split(open(sys.argv[2]).read(), '\n')
+except:
+ non_digest_members = []
+ print 'file for non-digest members could not be opened. Ignoring.'
+try:
+ digest_members = string.split(open(sys.argv[3]).read(), '\n')
+except:
+ digest_members = []
+ print 'file for digest members could not be opened. Ignoring.'
+
+def FormatMembers(mbrs):
+ def NotNull(str):
+ return str
+ return filter(NotNull, map(string.strip, mbrs))
+
+non_digest_members = FormatMembers(non_digest_members)
+digest_members = FormatMembers(digest_members)
+
+
+SendExplanation(non_digest_members + digest_members)
+
+for member in non_digest_members:
+ pw = GetRandomPassword()
+ list.ApprovedAddMember(member, pw, 0)
+
+for member in digest_members:
+ pw = GetRandomPassword()
+ list.ApprovedAddMember(member, pw, 1)
+
+
+