Skip to content
Extraits de code Groupes Projets
Valider 3ba030ca rédigé par ElTata's avatar ElTata :ok_hand:
Parcourir les fichiers

autologin irc-identified users with their last played character

parent ddd2aad5
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -390,6 +390,11 @@ sub parse { ...@@ -390,6 +390,11 @@ sub parse {
elsif ($arg[1] eq 'join') { elsif ($arg[1] eq 'join') {
# %onchan holds time user joined channel. used just to now who is there # %onchan holds time user joined channel. used just to now who is there
$onchan{$usernick}=time() if ($opts->{botchan} eq substr($arg[2], 1)); $onchan{$usernick}=time() if ($opts->{botchan} eq substr($arg[2], 1));
if (grep { $rps->{$_}{nick} eq $usernick } keys %$rps) {
Irpg::Irc::sts("WHOIS $usernick");
}
if ($opts->{'detectsplits'} && exists($split{substr($arg[0],1)})) { if ($opts->{'detectsplits'} && exists($split{substr($arg[0],1)})) {
delete($split{substr($arg[0],1)}); delete($split{substr($arg[0],1)});
} }
...@@ -437,8 +442,10 @@ sub parse { ...@@ -437,8 +442,10 @@ sub parse {
} }
} }
elsif ($arg[1] eq 'part') { elsif ($arg[1] eq 'part') {
$rps->{$username}{online}=0 if (defined($username)); if (defined($username)) {
$rps->{$username}{online}=0;
penalize($username,"part"); penalize($username,"part");
}
delete($onchan{$usernick}) if ($opts->{botchan} eq substr($arg[2], 1)); delete($onchan{$usernick}) if ($opts->{botchan} eq substr($arg[2], 1));
} }
elsif ($arg[1] eq 'kick') { elsif ($arg[1] eq 'kick') {
...@@ -500,9 +507,26 @@ sub parse { ...@@ -500,9 +507,26 @@ sub parse {
# to login # to login
$onchan{$arg[7]}=time() if ($opts->{botchan} eq $arg[3]); $onchan{$arg[7]}=time() if ($opts->{botchan} eq $arg[3]);
if (exists($prev_online->{$arg[7]."!".$arg[4]."\@".$arg[5]})) { if (exists($prev_online->{$arg[7]."!".$arg[4]."\@".$arg[5]})) {
$rps->{$prev_online->{$arg[7]."!".$arg[4]."\@".$arg[5]}}{online} = 1; $rps->{$prev_online->{$arg[7]."!".$arg[4]."\@".$arg[5]}}{online} = 1;
$auto_login{$prev_online->{$arg[7]."!".$arg[4]."\@".$arg[5]}}=1; $auto_login{$prev_online->{$arg[7]."!".$arg[4]."\@".$arg[5]}}=1;
}
elsif (grep { $rps->{$_}{nick} eq $arg[7] } keys %$rps) {
Irpg::Irc::sts("WHOIS $arg[7]");
}
}
elsif ($arg[1] eq '307') {
# 307 is the line of /WHOIS which exists if the user is registered
my @persos = grep { $rps->{$_}{nick} eq $arg[3] } keys %$rps;
return unless (@persos);
my $char_name = $persos[0];
foreach (@persos) {
$char_name = $_ if $rps->{$_}{lastlogin} > $rps->{$char_name}{lastlogin};
} }
$rps->{$char_name}{online} = 1;
Irpg::Irc::chanmsg("Logged in registered user $arg[3] as $char_name.");
} }
elsif ($arg[1] eq 'privmsg') { elsif ($arg[1] eq 'privmsg') {
$arg[0] = substr($arg[0],1); # strip leading : from privmsgs $arg[0] = substr($arg[0],1); # strip leading : from privmsgs
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter