Skip to content
Extraits de code Groupes Projets
Valider a274bcec rédigé par Alexandre Morignot's avatar Alexandre Morignot
Parcourir les fichiers

lastID can now manage multiple chan

parent 5f976ac3
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -32,7 +32,7 @@ my $admin = 'moise'; ...@@ -32,7 +32,7 @@ my $admin = 'moise';
my $baseurl = 'http://nightiies.iiens.net/links/'; my $baseurl = 'http://nightiies.iiens.net/links/';
my @nicksToVerify; my @nicksToVerify;
my @codesToVerify; my @codesToVerify;
my $lastID; my %lastID;
my $debug = 0; my $debug = 0;
...@@ -127,7 +127,7 @@ sub cycle ...@@ -127,7 +127,7 @@ sub cycle
Module::Refresh->refresh; Module::Refresh->refresh;
commands::parser::setConf($irc, $dbh, $log); commands::parser::setConf($irc, $dbh, $log);
$commands::parser::lastID = $lastID; %commands::parser::lastID = %lastID;
} }
...@@ -286,11 +286,11 @@ sub on_speak ...@@ -286,11 +286,11 @@ sub on_speak
$id = $sth->fetch->[0]; $id = $sth->fetch->[0];
} }
$lastID = $id; $lastID{$chan->[0]} = $id;
$commands::parser::lastID = $id; $commands::parser::lastID{$chan->[0]} = $id;
# insertion des éventuels tags # insertion des éventuels tags
commands::parser::tag($msg); commands::parser::tag($msg, $chan);
# message sur irc # message sur irc
if (defined $content{'author'}) { if (defined $content{'author'}) {
......
...@@ -9,7 +9,7 @@ use commands::fav; ...@@ -9,7 +9,7 @@ use commands::fav;
use commands::later; use commands::later;
use commands::tag; use commands::tag;
our $lastID; our %lastID;
my $irc; my $irc;
...@@ -30,18 +30,18 @@ sub exec { ...@@ -30,18 +30,18 @@ sub exec {
my ($nick,$mask) = split(/!/,$user); my ($nick,$mask) = split(/!/,$user);
if ($msg =~ /^!fav(?: ([0-9]+))?/) { if ($msg =~ /^!fav(?: ([0-9]+))?/) {
$id = ($1) ? $1 : $lastID; $id = ($1) ? $1 : $lastID{$chan->[0]};
commands::fav::exec($nick, $id) commands::fav::exec($nick, $id)
} }
elsif ($msg =~ /^!later(?: ([0-9]+))?(?: in ([0-9]*)?(h|m|s)?)?/) { elsif ($msg =~ /^!later(?: ([0-9]+))?(?: in ([0-9]*)?(h|m|s)?)?/) {
my $id = ($1) ? $1 : $lastID; my $id = ($1) ? $1 : $lastID{$chan->[0]};
my ($time, $unit) = ($2, $3); my ($time, $unit) = ($2, $3);
commands::later::exec($kernel, $nick, $id, $time, $unit); commands::later::exec($kernel, $nick, $id, $time, $unit);
} }
elsif ($msg =~ /^!tag(?: +([0-9]+))?/) { elsif ($msg =~ /^!tag(?: +([0-9]+))?/) {
my $id = ($1) ? $1 : $lastID; my $id = ($1) ? $1 : $lastID{$chan->[0]};
commands::tag::exec($id, $msg); commands::tag::exec($id, $msg);
} }
...@@ -59,9 +59,9 @@ sub exec { ...@@ -59,9 +59,9 @@ sub exec {
} }
sub tag { sub tag {
my ($msg) = @_; my ($msg, $chan) = @_;
commands::tag::exec($lastID, $msg); commands::tag::exec($lastID{$chan->[0]}, $msg);
} }
1; 1;
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