DADA::MailingList::Archives
use DADA::MailingList::Archives;
my $archive = DADA::MailingList::Archives->new(-List => \%list);
Archive interface to a simple tied hash archiving system for messages saved in Dada Mail
my $archive = DADA::MailingList::Archives->new(-List => \%list);
this wil tie the db hash and get you going with this whole gosh darn thing if it has a valid list, it will open up the archive and get to work on it.
=cut
sub new {
# the "new" function, wee my $that = shift; my $class = ref($that) || $that; my $self = SUPER::new $class ( function => 'archives', ); #we gots some stuff passed to this darn thing my %args = ( -List => undef, ignore_open_db_error => 0, @_, ); my $list_ref = $args{-List}; $self->{list_info} = $list_ref; $self->{name} = $self->{list_info}->{list}; $self->{ignore_open_db_error} = $args{ignore_open_db_error};
$self->init(); return $self;
}
sub init { my $self = shift; $self->_open_db; }
sub get { my $self = shift; return $self->{DB_HASH}; }
sub save { | |
my $self = shift; | |
my $new_vals = shift; |
$self->_close_db;
# hack. fix later. my %tmp; chmod($FILE_CHMOD, $self->_db_filename) if -e $self->_db_filename; tie %tmp, "AnyDBM_File", $self->_db_filename, O_RDWR|O_CREAT, $FILE_CHMOD or die 'couldn\'t tie '. $self->_db_filename . ' for reading: ' . $! . '; If your server recently upgraded software or moved your lists to a different server, you may need to restore your list ' . $self->{function} . '. Visit ' . $PROGRAM_URL . '?f=restore_lists '; %tmp = %$new_vals; untie %tmp; $self->_open_db; }
sub get_available_archives{ | |
my $self = shift; |
my @all_dbs = (); my @available_lists = (); my @available_archives = ();
while (defined(my $present_list = <$ARCHIVES/mj-*>)){
$present_list =~ s#.*/##; $present_list =~ s/mj-//; $present_list =~ s/\..*//; push(@all_dbs, $present_list); }
foreach my $all_those(@all_dbs) { if($all_those =~ m/.*-archive/) { push( @available_archives, $all_those) } } @available_archives = sort(@available_archives); my %seen = (); my @unique = grep {! $seen{$_} ++ } @available_archives; return \@unique;
}
my $entries = $archive -> get_archive_entries();
this will give you a refernce to an array that has the keys to your entries there.
my $message = get_archive_message($key);
gets the message of the given $key
my $subject = get_archive_subject($key);
gets the subject of the given $key
gets the subject of the given $key
delete_archive($key);
deletes the archive entry.
my $results = search_entries($keyword);
this is a funky subroutine that returns a refernce to an array of keys that has the $keyword in the subject or message, otherwise known as a ``search''?
DESTROY ALL ASTROMEN!
Copyright (c) 1999 - 2005 Justin Simoni me@justinsimoni.com http://justinsimoni.com All rights reserved.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.