Mailman

From Chickenfoot Script Repository

Mailman is a popular mailing list manager, with a web-based user interface.

Password Management

I administer over 10 mailing lists on the same Mailman list server (lists.csail.mit.edu). Each list has a different password, so Firefox's builtin password manager doesn't help, because it only remembers one password per web site.

This script manages my Mailman passwords for me. Whenever it sees a Mailman login form, it tries to find a password for the list using an internal table, and submits it automatically.

Note that the passwords are clearly visible in this script. Chickenfoot needs a way to easily access Firefox's secure storage, so that passwords don't have to appear in the trigger script, and so that their use can be controlled by a master password if the user has one.

// ==UserScript==
// @name Password Management
// @when Pages Match
// @description manages Mailman passwords using an internal table, and submits them automatically
// @include http://lists.csail.mit.edu
// ==/UserScript==

 // Fill in Mailman list adminstrator passwords automatically.
 // Assign to trigger */mailman/admin*
 pwds = {
   "chickenfoot-developers": "***",
   "chickenfoot-users": "***",
   // put names and passwords for other mailing lists here
 };
 
 if (find("let me in button").hasMatch) {
   url = document.location.toString();
   list = url.match(/admin(|db)\/([^\/]*)(\/|$)/)[2];
   if (pwds[list]) {
     enter("password", pwds[list]);
     click("let me in");
   }
 }

Clearing Bounces

I forwarded a mail to one of my mailing lists which caused many recipients to bounce it back. Mailman reacts to this by setting a bounce flag for each affected user, so they stop receiving mail from the list. I wanted to clear all the bounce flags.

To make things harder, however, Mailman splits the membership list into multiple pages, A-Z. So I have to iterate through all these pages.

// ==UserScript==
// @name Clearing Bounces
// @when Pages Match
// @description clears all bounce flags for a Mailman list
// @include http://lists.csail.mit.edu
// ==/UserScript==
 for (c = "A"; c <= "Z"; c = String.fromCharCode(c.charCodeAt(0)+1)) {
  try {
    click(c);
    clearBounces();
    output("cleared bounce flags for " + c);
  } catch (e) {
    output("nobody found for " + c);
  }
 }
 
 function clearBounces() {
  for (m = find("[b] checkbox"); m.hasMatch; m = m.next) {
    uncheck(m.element);
  }
  click("submit your changes")
 }