[CrackMonkey] NO MIME, buttfuck!
Mike Goldman
whig at debian.org
Fri Feb 11 17:49:06 PST 2000
Nick Moffitt wrote:
> Sorry folks. Still hacking on mailman.
Here. This is diff'ed against Debian mailman_1.1-2. I haven't tested it
yet, but it should work.
Thus I refute the Slashdot SpamMonkeys.
--- mailman-1.1.orig/Mailman/HTMLFormatter.py
+++ mailman-1.1/Mailman/HTMLFormatter.py
@@ -315,6 +315,9 @@
def FormatBox(self, name, size=20):
return '<INPUT type="Text" name="%s" size="%d">' % (name, size)
+ def FormatTextArea(self, name, rows=10, cols=60, wrap="off", value=""):
+ return '<TEXTAREA name="%s" rows="%d" cols="%d" wrap="%s">%s</TEXTAREA>' % (name, rows, cols, wrap, value)
+
def FormatSecureBox(self, name):
return '<INPUT type="Password" name="%s" size="15">' % name
--- mailman-1.1.orig/Mailman/MailList.py
+++ mailman-1.1/Mailman/MailList.py
@@ -216,6 +216,34 @@
if save_list:
self.Save()
+ def GetUserKillFile(self, user):
+ """Return user's personal killfile list, defaulting to []."""
+ user = self.GetUserCanonicalAddress(user)
+ if not self.killfile.has_key(user):
+ return []
+ return self.killfile[user]
+
+ def SetUserKillFile(self, user, killfile):
+ """Assign list to user's personal killfile."""
+ user = self.GetUserCanonicalAddress(user)
+ self.killfile[user] = []
+ for addr in killfile:
+ addr = string.lower(string.strip(addr))
+ if addr: self.killfile[user].append(addr)
+ if not self.killfile[user]:
+ del self.killfile[user]
+ else:
+ self.killfile[user].sort()
+ self.Save()
+
+ def CheckUserKillFile(self, user, email):
+ """Return whether email is killfiled."""
+ user = self.GetUserCanonicalAddress(user)
+ if self.killfile.has_key(user):
+ for addr in self.killfile[user]: # should bsearch
+ if email == addr: return 1
+ return 0
+
# Here are the rules for the three dictionaries self.members,
# self.digest_members, and self.passwords:
#
@@ -285,6 +313,7 @@
self.post_id = 1. # A float so it never has a chance to overflow.
self.user_options = {}
+ self.killfile = {}
# This stuff is configurable
self.filter_prog = mm_cfg.DEFAULT_FILTER_PROG
@@ -1344,7 +1373,8 @@
recipients = []
for m in members:
if not self.GetUserOption(m, mm_cfg.DisableDelivery):
- recipients.append(m)
+ if not self.CheckUserKillFile(m, sender):
+ recipients.append(m)
if dont_send_to_sender:
try:
recipients.remove(self.GetUserSubscribedAddress(sender))
--- mailman-1.1.orig/Mailman/Cgi/handle_opts.py
+++ mailman-1.1/Mailman/Cgi/handle_opts.py
@@ -183,6 +183,25 @@
PrintResults("You must specify your old password,"
" and your new password twice.")
+ elif form.has_key("killfileupd"):
+ if not form.has_key('killfilepw'):
+ PrintResults("You must specify your password.")
+ else:
+ try:
+ list.ConfirmUserPassword(user, form['killfilepw'].value)
+ ktxt = form['killfile'].value
+ ktxt = string.replace(ktxt, '\r', '')
+ klst = map(string.strip, string.split(ktxt, '\n'))
+ list.SetUserKillFile(user, klst)
+ except Errors.MMListNotReady:
+ PrintResults("The list is currently not functional.")
+ except Errors.MMNotAMemberError:
+ PrintResults("You seem to no longer be a list member.")
+ except Errors.MMBadPasswordError:
+ PrintResults("Incorrect password.")
+
+ PrintResults("Your personal killfile has been updated.")
+
else:
# if key doesn't exist, or its value can't be int()'ified, return the
# current value (essentially a noop)
--- mailman-1.1.orig/Mailman/Cgi/options.py
+++ mailman-1.1/Mailman/Cgi/options.py
@@ -135,6 +135,14 @@
replacements['<mm-email-my-pw>'] = mlist.FormatButton('emailpw',
('Email My Password'
' To Me'))
+ replacements['<mm-killfile-list>'] = (
+ mlist.FormatTextArea('killfile',
+ value=string.join(mlist.GetUserKillFile(user), "\r\n")))
+ replacements['<mm-killfile-pw-box>'] = (
+ mlist.FormatSecureBox('killfilepw'))
+ replacements['<mm-killfile-submit>'] = (
+ mlist.FormatButton('killfileupd',
+ 'Edit my killfile'))
replacements['<mm-umbrella-notice>'] = (
mlist.FormatUmbrellaNotice(user, "password"))
if cpuser is not None:
--- mailman-1.1.orig/templates/options.html
+++ mailman-1.1/templates/options.html
@@ -144,6 +144,19 @@
</center>
<p>
+
+<a name=killfile>
+ <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="5">
+ <TR><TD WIDTH="100%" BGCOLOR="#FFF0D0"><FONT COLOR="#000000">
+<B>Your <MM-List-Name> Personal Killfile</B>
+ </FONT></TD></TR> </table>
+<p>
+You can add or remove addresses below, one entry per line:<br>
+<MM-Killfile-List><p>
+Enter your password to update your personal killfile for this list.<br>
+Password: <MM-Killfile-Pw-Box> <MM-Killfile-Submit>
+
+<p>
<MM-Form-End>
<MM-Mailman-Footer>
More information about the Crackmonkey
mailing list