commit f8e21ca0c3b0a799d18704d6ce806af11b1fe289 from: jrmu date: Tue Mar 07 02:17:38 2023 UTC Added mailhostname commit - 06fd50e5187460e6e0e79aff305f3a7f8e5be32a commit + f8e21ca0c3b0a799d18704d6ce806af11b1fe289 blob - 3506a94d4da51d91073637c1bb4c9d0f653f97c8 blob + d6c2d94abc841244afc88265e509634ce5f38a8b --- Mail.pm +++ Mail.pm @@ -13,7 +13,7 @@ use Digest::SHA qw(sha256_hex); my %conf = %main::conf; my $chans = $conf{chans}; my $staff = $conf{staff}; -my $hostname = $conf{hostname}; +my $mailhostname = $conf{mailhostname}; my $mailfrom = $conf{mailfrom}; my $mailname = $conf{mailname}; my $imapport = $conf{imapport}; @@ -74,7 +74,7 @@ sub mmail { my $username = $1; my @passwd = main::readarray($passwdpath); foreach my $line (@passwd) { - $line =~ s/^#(${username}\@${hostname}.*)/$1/; + $line =~ s/^#(${username}\@${mailhostname}.*)/$1/; } # trailing newline necessary `doas touch $passwdpath.bak`; @@ -111,7 +111,6 @@ sub mmail { my $username = SQLite::get("mail", "ircid", $ircid, "username"); my $email = SQLite::get("mail", "ircid", $ircid, "email"); my $hashirc = SQLite::get("irc", "id", $ircid, "hashid"); - my $bindhost = "$username.$hostname"; SQLite::set("mail", "ircid", $ircid, "password", $encrypted); sleep(2); createmail($pass, $username); @@ -121,7 +120,7 @@ sub mmail { if ($approval) { my @passwd = main::readarray($passwdpath); foreach my $line (@passwd) { - $line =~ s/^(${username}\@${hostname}.*)/#$1/; + $line =~ s/^(${username}\@${mailhostname}.*)/#$1/; } # trailing newline necessary `doas touch $passwdpath.bak`; @@ -135,7 +134,7 @@ sub mmail { } } foreach my $chan (@teamchans) { - main::putservlocalnet($bot, "PRIVMSG $chan :$staff: $nick\'s mail registration of $username\@$hostname on $bot->{name} was successful, but you *must* help him to connect. Most users are unable to connect. Show him https://wiki.ircnow.org/?n=Email.Email"); + main::putservlocalnet($bot, "PRIVMSG $chan :$staff: $nick\'s mail registration of $username\@$mailhostname on $bot->{name} was successful, but you *must* help him to connect. Most users are unable to connect. Show him https://wiki.ircnow.org/?n=Email.Email"); } #www($newnick, $reply, $password, "bouncer"); return; @@ -232,9 +231,9 @@ Welcome to IRCNow! You created an email account: -Username: $username\@$hostname +Username: $username\@$mailhostname Password: $password -Server: $hostname +Server: $mailhostname IMAP Port: $imapport (STARTTLS) SMTP Port: $smtpport (STARTTLS) Webpanel: $mailwebpanel @@ -255,10 +254,10 @@ EOF sub createmail { my ($password, $username) = @_; chomp(my $encrypted = `encrypt $password`); - my $line = "${username}\@$hostname:${encrypted}::::::userdb_quota_rule=*:storage=1G"; + my $line = "${username}\@$mailhostname:${encrypted}::::::userdb_quota_rule=*:storage=1G"; $line =~ s{\$}{\\\$}g; - my $line2 = "${username}\@$hostname vmail"; - my $line3 = "${username}\@$hostname: ${username}\@$hostname"; + my $line2 = "${username}\@$mailhostname vmail"; + my $line3 = "${username}\@$mailhostname: ${username}\@$mailhostname"; `doas sh -c 'echo $line >> $passwdpath'`; `doas sh -c 'echo $line2 >> $virtualspath'`; `doas sh -c 'echo $line3 >> $senderspath'`; @@ -271,9 +270,9 @@ sub deletemail { my @passwd = main::readarray($passwdpath); my @virtuals = main::readarray($virtualspath); my @senders = main::readarray($senderspath); - @passwd = grep !/^${username}\@${hostname}/, @passwd; - @virtuals = grep !/^${username}\@${hostname}/, @virtuals; - @senders = grep !/^${username}\@${hostname}/, @senders; + @passwd = grep !/^${username}\@${mailhostname}/, @passwd; + @virtuals = grep !/^${username}\@${mailhostname}/, @virtuals; + @senders = grep !/^${username}\@${mailhostname}/, @senders; # trailing newline necessary `doas touch $passwdpath.bak`; blob - 31dce65e7fcc58401ba0dcd4e5fa4d620e535f35 blob + e44acd77d71b64fb77d2155a9caac72d8c14fa7d --- botnow.conf.example +++ botnow.conf.example @@ -10,6 +10,9 @@ localnet = example #Bouncer hostname hostname = example.com +#Mail hostname +mailhostname = example.com + #Webpanel URL webpanel = https://bnc.example.com