mirror of
https://github.com/PsychoticNinjaRepo/idlerpg-ng.git
synced 2025-04-29 15:01:17 -05:00
Implement new user report email
This commit is contained in:
parent
ef9da25bc7
commit
6c39ca2717
12
.irpg.conf
12
.irpg.conf
@ -239,3 +239,15 @@ mapy 500
|
|||||||
# specify modes / line. the bot will override this from what it grabs from the
|
# specify modes / line. the bot will override this from what it grabs from the
|
||||||
# server's 005 numeric, though, if anything. used only for auto-login voicing
|
# server's 005 numeric, though, if anything. used only for auto-login voicing
|
||||||
modesperline 3
|
modesperline 3
|
||||||
|
|
||||||
|
# do we want to receive new user repors emails?
|
||||||
|
newuserreports off
|
||||||
|
|
||||||
|
# where do new user emails go?
|
||||||
|
newuserdest user\@email.tld
|
||||||
|
|
||||||
|
# From name on newuser report email
|
||||||
|
newuserfromname IdleRPG Monitor
|
||||||
|
|
||||||
|
# From addr on newuser report email
|
||||||
|
newuserfromaddr idlerpg-monitor\@email.tld
|
||||||
|
@ -92,6 +92,10 @@ GetOptions(\%opts,
|
|||||||
"rpbase=i",
|
"rpbase=i",
|
||||||
"rppenstep=f",
|
"rppenstep=f",
|
||||||
"dbfile|irpgdb|db|d=s",
|
"dbfile|irpgdb|db|d=s",
|
||||||
|
"newuserreports",
|
||||||
|
"newuserdest=s",
|
||||||
|
"newuserfromname=s",
|
||||||
|
"newuserfromaddr=s",
|
||||||
) or debug("Error: Could not parse command line. Try $0 --help\n",1);
|
) or debug("Error: Could not parse command line. Try $0 --help\n",1);
|
||||||
|
|
||||||
$opts{help} and do { help(); exit 0; };
|
$opts{help} and do { help(); exit 0; };
|
||||||
@ -538,6 +542,12 @@ sub parse {
|
|||||||
"pen_logout","pen_logout") {
|
"pen_logout","pen_logout") {
|
||||||
$rps{$arg[4]}{$pen} = 0;
|
$rps{$arg[4]}{$pen} = 0;
|
||||||
}
|
}
|
||||||
|
if ($opts{newuserreports}) {
|
||||||
|
my $char = $arg[4];
|
||||||
|
my $class = "@arg[6..$#arg]";
|
||||||
|
my $host = $arg[0];
|
||||||
|
report_new ($char, $class, $usernick, $host);
|
||||||
|
}
|
||||||
chanmsg("Welcome $usernick\'s new player $arg[4], the ".
|
chanmsg("Welcome $usernick\'s new player $arg[4], the ".
|
||||||
"@arg[6..$#arg]! Next level in ".
|
"@arg[6..$#arg]! Next level in ".
|
||||||
duration($opts{rpbase}).".");
|
duration($opts{rpbase}).".");
|
||||||
@ -2401,6 +2411,35 @@ sub readconfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub report_new ($$$$) {
|
||||||
|
my ($char, $class, $nick, $host) = @_;
|
||||||
|
|
||||||
|
# mail subject
|
||||||
|
my $subject = "New IdleRPG Character";
|
||||||
|
|
||||||
|
# name of the mail program being used
|
||||||
|
my $mail_prog = "/usr/lib/sendmail";
|
||||||
|
|
||||||
|
# open a pipe to the mail program, allowing us to feed the mail as stdin text
|
||||||
|
open (MAILPIPE, "|$mail_prog $opts{newuserdest}") || die ("can't open pipe to $mail_prog");
|
||||||
|
|
||||||
|
# send mail header
|
||||||
|
print MAILPIPE "To: $opts{newuserdest}\n";
|
||||||
|
print MAILPIPE "From: \"$opts{newuserfromname}\" <$opts{newuserfromaddr}>\n";
|
||||||
|
print MAILPIPE "Subject: $subject\n";
|
||||||
|
print MAILPIPE "\n";
|
||||||
|
print MAILPIPE ("A new IdleRPG character has been created:\n");
|
||||||
|
print MAILPIPE "\n";
|
||||||
|
print MAILPIPE ("Char: $char\n");
|
||||||
|
print MAILPIPE ("Class: $class\n");
|
||||||
|
print MAILPIPE ("Nick: $nick\n");
|
||||||
|
print MAILPIPE ("Host: $host\n");
|
||||||
|
print MAILPIPE "\n";
|
||||||
|
|
||||||
|
# close the mail pipe, sending the message on
|
||||||
|
close (MAILPIPE);
|
||||||
|
}
|
||||||
|
|
||||||
# signal handler to permit sane quitting from the command line
|
# signal handler to permit sane quitting from the command line
|
||||||
sub quit {
|
sub quit {
|
||||||
$opts{reconnect} = 0;
|
$opts{reconnect} = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user