# $Id: listproc.cf,v 1.3 1997/02/25 05:39:51 fitz Exp $
# Config file for ListProcessor
#

package config;
$name = "ListProcessor";
@commands =
    (
     "subscribe",
     "unsubscribe",
     "information",
     "recipients",
     "statistics",
     "lists",
     "which",
     "help",
     "help_topic",
     "", # Split columns here
     "set_query",
     "set_mail",
     "set_conceal",
     "set_password",
     "enter",
     );
%description =
    (
     "subscribe", "Subscribe",
     "unsubscribe", "Unsubscribe",
     "which", "Show lists to which you are subscribed.",
     "information", "Describe the mailing list.",
     "recipients", "Who is on the mailing list?",
     "set_query", "Get your <em>$name</em> settings.",
     "set_mail", "Change the way you receive mailing list messages.",
     "set_password", "Change your list password:",
     "set_conceal", "Conceal/reveal your presence:",
     "lists", "Show other lists on this server.",
     "statistics", "Get statistics about the list:",
     "enter", "Enter a <em>$name</em> command.",
     "help", "Get help for <em>$name</em> commands.",
     "help_topic", "Get help for topic:",
     );

#######################################################################
#----------------------------------------------------------------------
# Listproc command forms
#----------------------------------------------------------------------
#######################################################################

use strict;

#----------------------------------------------------------------------
# subscribe command
#
$config::command{"subscribe"} = <<EOT;
<TABLE>
<TR>
<TD ALIGN=right><FONT SIZE="-1">Your full name:</TD>
<TD><INPUT NAME=subName SIZE="$main::size"></TD>
</TR>
</TABLE>
EOT

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

    &main::error("To subscribe you must specify your full name.")
        unless $main::in{"subName"};

    "subscribe $main::in{list} $main::in{subName}";
}
#----------------------------------------------------------------------
# help_topic command
#
    $config::command{"help_topic"} = <<EOT;

Topic:<input name=helpTopic size=$main::size>
EOT

sub process_help_topic
{
    &main::error("You must enter a help topic.")
        unless ($main::in{helpTopic});

    "help $main::in{helpTopic}";
}
#----------------------------------------------------------------------
# statistics command
#
$config::command{"statistics"} = <<EOT;
<TABLE>
<TR>
<TD></TD>
<TD><FONT SIZE="-1">(<EM>optional</EM>, separate with commas)</FONT></TD>
</TR>
<TR>
<TD ALIGN=right><FONT SIZE="-1">Email addresses:</FONT></TD>
<TD><FONT SIZE="-1"><INPUT NAME="statistics_addr" SIZE="$main::size"></FONT></TD>
</TR>
</TABLE>
EOT

sub process_statistics
{
    &main::error("Before you can get statistics you must enter a list name.")
        unless ($main::in{'list'});

    "statistics $main::in{list} $main::in{statistics_addr}";
}
#----------------------------------------------------------------------
# set_mail command
#
$config::command{"set_mail"} = <<EOT;
<TABLE>
<TR VALIGN=top>
<TD ALIGN=right><FONT SIZE="-1"><INPUT TYPE=radio NAME=setMail VALUE=ack></FONT></TD>
<TD><FONT SIZE="-1">Send messages one at a time; also send back my postings</FONT></TD>
</TR>
<TR VALIGN=top>
<TD><FONT SIZE="-1"><INPUT TYPE=radio NAME=setMail VALUE=noack></FONT></TD>
<TD><FONT SIZE="-1">Send messages one at a time; do not send back my postings</FONT></TD>
</TR>
<TR VALIGN=top>
<TD><FONT SIZE="-1"><INPUT TYPE=radio NAME=setMail VALUE=digest></FONT></TD>
<TD><FONT SIZE="-1">Send messages in digests; do not send back my postings</FONT></TD>
</TR>
<TR VALIGN=top>
<TD><FONT SIZE="-1"><INPUT TYPE=radio NAME=setMail VALUE=postpone></FONT></TD>
<TD><FONT SIZE="-1">Temporarily stop sending messages until I change mode again</FONT></TD>
</TR>
</TABLE>
EOT

sub process_set_mail
{
    &main::error("Before you can change your mail options ",
                "you must enter a list name.")
        unless $main::in{'list'};

    &main::error("You can select a mail option.")
        unless $main::in{'setMail'};

    "set $main::in{list} mail $main::in{setMail}";
}
#----------------------------------------------------------------------
# set_password command
#
$config::command{"set_password"} = <<EOT;
<TABLE>
<TR>
<TD ALIGN=right><FONT SIZE="-1">Current:</FONT></TD>
<TD><INPUT TYPE=password NAME=oldpass SIZE="$main::size"></TD>
</TR>
<TR>
<TD ALIGN=right><FONT SIZE="-1">New:</FONT></TD>
<TD><INPUT TYPE=password NAME=newpass SIZE="$main::size"></TD>
</TR>
<TR>
<TD ALIGN=right><FONT SIZE="-1">Retype:</FONT></TD>
<TD><INPUT TYPE=password NAME=newpass2 SIZE="$main::size"></TD>
</TR>
</TABLE>
EOT

sub process_set_password
{
    &main::error("Before you change passwords you must enter a list name.")
        unless $main::in{'list'};

    &main::error("You must enter the current password.")
        unless $main::in{'oldpass'};

    &main::error("You must enter the new password twice.")
        unless ($main::in{'newpass'} && $main::in{'newpass2'});

    &main::error("The new password must match the retyped password.")
        unless ($main::in{'newpass'} eq $main::in{'newpass2'});

    "set $main::in{list} password " .
        &hidePassword($main::in{oldpass}) . " " .
            &hidePassword($main::in{newpass});
}
#----------------------------------------------------------------------
# set_conceal command
#
    $config::command{"set_conceal"} = <<EOT;
<TABLE>
<TR>
<TD ALIGN=right><FONT SIZE="-1"><INPUT TYPE=radio NAME=conceal VALUE=yes></FONT></TD>
<TD><FONT SIZE="-1">Conceal your presence</FONT></TD>
</TR>
<TR>
<TD ALIGN=right><FONT SIZE="-1"><INPUT TYPE=radio NAME=conceal VALUE=no></FONT></TD>
<TD><FONT SIZE="-1">Reveal your presence</FONT></TD>
</TR>
</TABLE>
EOT

sub process_set_conceal
{
    &main::error("Before you conceal/reveal you must enter a list name.")
        unless $main::in{'list'};

    &main::error("You must select a conceal/reveal option.")
        unless $main::in{'conceal'};

    "set $main::in{list} conceal $main::in{conceal}";
}
#----------------------------------------------------------------------
# enter command
#
$config::command{"enter"} = <<EOT;
<TABLE>
<TR>
<TD ALIGN=right><FONT SIZE="-1">Command:</FONT></TD>
<TD><FONT SIZE="-1"><INPUT NAME=enter SIZE="$main::size"></FONT></TD>
</TR>
</TABLE>
EOT

sub process_enter
{
    &main::error("You must enter a <em>$config::name</em> command.")
      unless $main::in{"enter"};

    $main::in{"enter"};
}
#----------------------------------------------------------------------
# help command
#
sub process_help
{
    "help";
}
#----------------------------------------------------------------------
# set_query command
#
sub process_set_query
{
    &main::error("Before you can query the settings ",
                "you must enter a list name.")
        unless ($main::in{'list'});

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

    "information $main::in{list}";
}
#----------------------------------------------------------------------
# lists command
#
sub process_lists
{
    "lists";
}
#----------------------------------------------------------------------
# unsubscribe command
#
sub process_unsubscribe
{
    &main::error("Before you can unsubscribe ",
                "you must enter the name of the mailing list.")
        unless ($main::in{"list"});

    "unsubscribe $main::in{list}";
}
#----------------------------------------------------------------------
# which command
#
sub process_which
{
    "which";
}
#----------------------------------------------------------------------
# recipients command
#
sub process_recipients
{
    &main::error("Before you can get a list of recipients ",
                "you must enter the name of the list.")
        unless ($main::in{"list"});

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

1;
