# $Id: majordomo-share.cf,v 1.4 1997/02/25 05:41:33 fitz Exp $
# Config file shared by majordomo.cf and majordomo-admin.cf
#

package config;

use strict;

#----------------------------------------------------------------------
# get command
#
$config::command{"get"} = <<EOT;
<TABLE>
<TR VALIGN=top>
<TD ALIGN=right><FONT SIZE="-1">Filenames:</FONT></TD>
<TD>
<FONT SIZE="-1">
<TEXTAREA NAME="majordomoGetFile" COLS="$main::size" ROWS=3></TEXTAREA>
</FONT>
</TD>
</TR>
</TABLE>
EOT

sub process_get
{
    my($file, @commands);

    &main::error("Before you can get a file, you must enter ",
                "the name of the mailing list.")
        unless ($main::in{"list"});

    &main::error("You must specify the filename to get.")
        unless ($main::in{"majordomoGetFile"});

    # Multiple files are allowed
    foreach $file (split(/\n/, $main::in{"majordomoGetFile"}))
    {
        # Skip empty lines
        next if $file =~ /^\s*$/;

        push(@commands,
             "get $main::in{list} $file");
    }

    # Return the commands
    @commands;
}

#----------------------------------------------------------------------
# which command
#
$config::command{"which"} = <<EOT;
<TABLE>
<TR><TD></TD><TD><FONT SIZE="-1">(<EM>optional</EM>)</FONT></TD></TR>
<TR>
<TD ALIGN=right><FONT SIZE="-1">Search for address:</FONT></TD>
<TD><FONT SIZE="-1"><INPUT NAME="majordomoWhich" SIZE="$main::size"></FONT></TD>
</TR>
</TABLE>
EOT

sub process_which
{
    "which $main::in{majordomoWhich}";
}

#----------------------------------------------------------------------
# enter command
#
$config::command{"enter"} = <<EOT;
<TABLE>
<TR VALIGN=top>
<TD ALIGN=right><FONT SIZE="-1">Commands:</FONT></TD>
<TD>
<FONT SIZE="-1">
<TEXTAREA NAME="majordomoEnter" COLS="$main::size" ROWS=2></TEXTAREA>
</FONT></TD>
</TR>
</TABLE>
EOT

sub process_enter
{
    my($command, @commands);

    &main::error("You must specify a <EM>$config::name</EM> command to send.")
        unless ($main::in{"majordomoEnter"});

    # Multiple files are allowed
    foreach $command (split(/\n/, $main::in{"majordomoEnter"}))
    {
        # Skip empty lines
        next if $command =~ /^\s*$/;

        push(@commands, $command);
    }

    # Return the commands
    @commands;
}

#----------------------------------------------------------------------
# help command
#
sub process_help
{
    "help";
}

#----------------------------------------------------------------------
# index command
#
sub process_index
{
    &main::error("Before you can get an index of files, ",
                "you must enter the name of the mailing list.")
        unless ($main::in{"list"});

    "index $main::in{list}";
}

#----------------------------------------------------------------------
# info command
#
sub process_info
{
    &main::error("Before you can get information about the list, ",
                "you must enter the name of the mailing list.")
        unless ($main::in{"list"});

    "info $main::in{list}";
}

#----------------------------------------------------------------------
# lists command
#
sub process_lists
{
    "lists";
}

#----------------------------------------------------------------------
# who command
#
sub process_who
{
    &main::error("Before you can list who is on the list, ",
                "you must enter the name of the mailing list.")
        unless ($main::in{"list"});

    "who $main::in{list}";
}

1;
