rev 1264 - trunk/siesta/bin

[prev] [thread] [next] [lurker] [Date index for 2003/07/28]

From: simon
Subject: rev 1264 - trunk/siesta/bin
Date: 18:18 on 28 Jul 2003
Author: simon
Date: 2003-07-28 18:18:13 +0100 (Mon, 28 Jul 2003)
New Revision: 1264

Modified:
   trunk/siesta/bin/bandito
Log:
Add docs plus nomail and stuff


Modified: trunk/siesta/bin/bandito
==============================================================================
--- trunk/siesta/bin/bandito	2003-07-28 16:47:42 UTC (rev 1263)
+++ trunk/siesta/bin/bandito	2003-07-28 17:18:13 UTC (rev 1264)
@@ -1,31 +1,78 @@
 #!/usr/local/bin/perl -w
 
+use strict; 
+use Siesta; 
+use Siesta::List; 
+use Siesta::Member; 
+use Python::Serialise::Marshal; 
+use Data::Dumper; 
+use POSIX qw/strftime/;
 
-###
-#
-# bandito - a tool for stealing mailman configurations
-#
-# usage : bandito <path to a mailman list config db>
-#
-# (c)opyright 2003 - the siesta dev team
-#
-###
 
-use strict;
-use Siesta;
-use Siesta::List;
-use Siesta::User;
-use Python::Serialise::Marshal;
-use Data::Dumper;
-use POSIX qw/strftime/;
 
-## TODO
-# move archives across
-# no mail
-# sig munging
-# allowed posters
+=pod
 
+=head1 NAME
 
+bandito - a tool for stealing mailman configurations
+
+
+=head1 USAGE
+
+    bandito <path to a mailman list config db>
+
+
+=head1 DESCRIPTION
+
+Bandito is a tool for stealing configurations from mailing list managers and 
+importing them into Siesta. At the moment it only does Mailman but will 
+eventually also do Ezmlm and Majordomo and anything else people want.
+
+It handles most thing - however it won't be able to handle things like 
+digest members until Siesta gets digests.
+
+See the TODO section below.
+
+=head1 TODO
+
+=over 4
+
+=item move archives across
+
+=item sig gussying
+
+=item digest members
+
+=back 
+
+=head1 COPYRIGHT
+
+(c)opyright 2003 - the siesta dev team
+
+=head1 SEE ALSO
+
+L<Siesta>, L<Siesta::UserGuide>, L<nacho>
+
+=cut
+
+# Bitfield for member options.  
+# Taken from 
+# http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/mailman/mailman/Mailman/Defaults.py.in?content-type=text/vnd.viewcvs-markup
+
+my %flags = (
+    Digests                  => 0, # handled by other mechanism, doesn't need a flag.
+    DisableDelivery          => 1, # Obsolete; use set/getDeliveryStatus()
+    DontReceiveOwnPosts      => 2, # Non-digesters only
+    AcknowledgePosts         => 4,
+    DisableMime              => 8, # Digesters only
+    ConcealSubscription      => 16,
+    SuppressPasswordReminder => 32,
+    ReceiveNonmatchingTopics => 64,
+    Moderate                 => 128,
+    DontReceiveDuplicates    => 256,
+);
+
+
 my $file = shift || die "You must pass a mailman config.db\n";
 my $pr   = Python::Serialise::Marshal->new($file) || die "Couldn't open $file\n";
 
@@ -34,7 +81,7 @@
 
 
 (my $list_name   = $data->{private_archive_file_dir}) =~ s!.+/([^/]+).mbox$!$1!;
-my $owner        =  Siesta::User->find_or_create({ email => $data->{owner}->[0] });
+my $owner        = Siesta::Member->find_or_create({ email => $data->{owner}->[0] });
 my $post_address = $list_name.'@'.$data->{host_name};
 my $return_path  = $list_name.'-bounce@'.$data->{host_name};
 
@@ -50,14 +97,21 @@
     owner => $owner,
     post_address => $post_address,
     return_path  => $return_path, 
+
 ) or die "Failed to create a new list\n";
 
 
-# make the new users
-print "Adding new users : \n";
+# make the new members
+print "Adding new members : \n";
 foreach my $email (keys %{$data->{passwords}}) {
     print "$email ";
-    $list->add_member( Siesta::User->find_or_create({ email => $email }) );    
+    my $member = Siesta::Member->find_or_create({ email => $email });
+    my $nomail = ($data->{user_options}->{$email} & $flags{'DisableDelivery'} == $flags{'DisableDelivery'});
+    $member->nomail($nomail);
+    $list->add_member( $member );    
+
+
+
 }
 print "\n\n";
 
@@ -83,10 +137,13 @@
 # members only
 my $members_only  = $data->{'member_posting_only'};
    $members_only  = 0 unless defined $members_only;
+
 print "MembersOnly => $members_only\n";
 $plugins{'MembersOnly'}->pref('approve', $members_only);
 $plugins{'MembersOnly'}->pref('tell_user', 1);
+$plugins{'MembersOnly'}->pref('allowed_posters', join " ", @{$data->{posters}});
 
+
 # set the subject line
 my $subject_munge = $data->{'subject_prefix'};
    $subject_munge = "" unless defined $subject_munge;
@@ -100,7 +157,10 @@
 $plugins{'Moderated'}->pref('tell_user', 1);  
 
 
+# now copy across the archives
 
+
+
 print "\n\nNow paste this into your aliases file :\n\n\n"; 
 print $list->alias("bandito (the Siesta config stealing tool)");
 

Generated at 13:57 on 01 Jul 2004 by mariachi 0.52