Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Commands/Reject.mmCommand
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = 'Reject';
uuid = 'BF23BD82-6EE9-4298-9B52-03A6B9CE6E80';
conditions = 'list-id exists';
environment = 'MM_TO=${to}\n';
environment = 'MM_DEBUG=yes\nMM_TO=${to}\n';
output = 'actions';
command = '#!/bin/bash\n"${MM_BUNDLE_SUPPORT}/bin/reject"\n';
keyEquivalent = '^m';
Expand Down
24 changes: 23 additions & 1 deletion README.mdown
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
# Features
# Enhancements

This "Enhanced MailMan Bundle" is a fork of the MailMan bundle
included with MailMate. It is as the original, however, in order to
handle lists whose delivery includes address rewriting, it allows the
user to save a `.mailman-addresses` file in their home directory,
which is (for now) a perl hash mapping delivery addresses to sender
addresses. That way, when one receives email addressed to
`foobar-list-owner@hosting.com` one can rewrite the address to an
address the mailman instance will accept.

Currently this is only implemented for the "Reject" messages, since as
a moderator, I have found my task is almost solely rejection.

## To do:

* Replace the use of a perl literal with a config file, which will be
safer, but needs to be handled without forcing dependencies on the
user.

* Extend the address rewriting to acceptance emails.

# Original Features

This bundle groks the `List-*` headers used by MailMan based systems.

Expand Down
14 changes: 14 additions & 0 deletions Support/bin/approve
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,26 @@ ACTION=`defaults read com.freron.MailMate MmMailManCommandAction 2>/dev/null`
if [ -z "${ACTION}" ]; then
ACTION="openMessage"
fi
if [ ! -z ${MM_DEBUG+x} ] && [ $MM_DEBUG ]
then
echo "MailMan accept command";
echo "MM_TO is ${MM_TO}, PASSWORD before request is ${PASSWORD}, MM_IDENTIFIER is ${MM_IDENTIFIER}" >> /tmp/MailMan.log
fi


# If no password then ask for one
if [ -z "${PASSWORD}" ]; then
PASSWORD=`"${MM_BUNDLE_SUPPORT}/bin/set_password"`
fi

export MM_ADDRESS=`${MM_BUNDLE_SUPPORT}/bin/table_lookup ${MM_TO}`
if [ ! -z ${MM_DEBUG+x} ] && [ $MM_DEBUG ]
then
echo "MM_ADDRESS is ${MM_ADDRESS}" >> /tmp/MailMan.log
echo "After request, PASSWORD = ${PASSWORD}." >> /tmp/MailMan.log
fi


# If password has been found then create the reply
if [ -n "${PASSWORD}" ]; then

Expand Down
19 changes: 17 additions & 2 deletions Support/bin/reject
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
#!/bin/bash

echo "Attempting to run reject command" >> /tmp/MailMan.log

ACTION=`defaults read com.freron.MailMate MmMailManCommandAction 2>/dev/null`
if [ -z "${ACTION}" ]; then
ACTION="openMessage"
#ACTION="openMessage"
ACTION="sendMessage" # we don't need to do anything to the message
fi
if [ ! -z ${MM_DEBUG+x} ] && [ $MM_DEBUG ]
then
echo "MM_TO is ${MM_TO}" >> /tmp/MailMan.log
fi
export MM_ADDRESS=`${MM_BUNDLE_SUPPORT}/bin/table_lookup ${MM_TO}`
if [ ! -z ${MM_DEBUG+x} ] && [ $MM_DEBUG ]
then
echo "MM_ADDRESS is ${MM_ADDRESS}" >> /tmp/MailMan.log
echo "ACTION = ${ACTION}" >> /tmp/MailMan.log
fi


cat << END
{ actions = (
{
Expand All @@ -13,7 +27,7 @@ cat << END
headers = {
"#posting-style" = "top";
"#signature" = "";
"from" = "${MM_TO}";
"from" = "${MM_ADDRESS}";
};
resultActions = (
{
Expand All @@ -24,3 +38,4 @@ cat << END
);
}
END

49 changes: 49 additions & 0 deletions Support/bin/table_lookup
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#! /usr/local/bin/perl

use JSON;

my $tableFilename = "$ENV{HOME}/.mailman-addresses";
my $logfile;
if ( $ENV{"DEBUG_MM"} || $ENV{"MM_DEBUG"}) {
$logfile = "/tmp/MailMan.log";
} else {
$logfile = "/dev/null";
}
open(LOG, ">>$logfile");
local $SIG{__DIE__} = sub {
my ($message) = @_;
print LOG "$message\n";
};
my %table;
{
local $/; # enable "slurp" mode
open(FH, "< $tableFilename") or die "Unable to open table file $tableFilename $!";
local $raw = <FH>;
close FH;
print LOG "Have read:\n$raw\n";
%table = %{decode_json($raw)};
}

{
my @keys = keys(%table);
print LOG "Keys are: @keys\n";

# if ( $ARGV[0] eq $keys[0] ) {
# print LOG "$ARGV[0] matches a key."
# } elsif ( $ARGV[0] ne $keys[0] ) {
# print LOG "Surprisingly $ARGV[0] is not equal to $keys[0]\n";
# }

foreach my $key (@keys) {
print LOG "$key\t$table{$key}\n";
}
}

my $INPUT_ADDRESS = $ARGV[0];
chomp $INPUT_ADDRESS;
#print "$INPUT_ADDRESS\n";
my $entry = $table{"$INPUT_ADDRESS"};
die "Unable to find entry for $INPUT_ADDRESS in $tableFilename" unless $entry;
print LOG "Translating to $entry\n";
close FH;
print "$entry\n";
4 changes: 2 additions & 2 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<key>description</key>
<string>Commands for the MailMan mailing list software.</string>
<key>name</key>
<string>MailMan</string>
<string>Enhanced MailMan</string>
<key>uuid</key>
<string>5ED82AEE-926C-476F-A4D6-FA6E1E89F246</string>
<string>EC81B9E9-4AAF-4342-8A15-761027EA5E57</string>
</dict>
</plist>