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

$commands::parser::lastID is now a hash ref

parent b1dc66ec
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -116,7 +116,6 @@ sub later
$irc->yield(privmsg => $nick => $donnees[0]);
$lastID{$nick} = $id;
$commands::parser::lastID{$nick} = $id;
}
}
......@@ -129,8 +128,13 @@ sub cycle
Module::Reload->check;
commands::parser::setConf($irc, $dbh, $log);
%commands::parser::lastID = %lastID;
setConf();
}
sub setConf
{
commands::parser::setConf($irc, $dbh, $log, \%lastID);
$sites::parser::dbh = $dbh;
$sites::parser::irc = $irc;
......@@ -276,7 +280,6 @@ sub on_speak
if ($id) {
# if yes, we need to save the new content's id
$lastID{$chan->[0]} = $id;
$commands::parser::lastID{$chan->[0]} = $id;
# we insert the potiential tags
commands::parser::tag($msg, $chan);
......@@ -285,11 +288,7 @@ sub on_speak
}
commands::parser::setConf($irc, $dbh, $log);
$sites::parser::dbh = $dbh;
$sites::parser::irc = $irc;
$sites::parser::log = $log;
setConf();
# Boucle des events
$poe_kernel->run();
......
......@@ -12,12 +12,11 @@ use commands::later;
use commands::tag;
use commands::get;
our %lastID;
my $lastID;
my $irc;
sub setConf {
my ($ircNew, $dbh, $log) = @_;
my ($ircNew, $dbh, $log, $lastIDnew) = @_;
$commands::fav::dbh = $dbh;
$commands::tag::dbh = $dbh;
......@@ -32,6 +31,7 @@ sub setConf {
$commands::get::irc = $ircNew;
$irc = $ircNew;
$lastID = $lastIDnew;
}
sub exec {
......@@ -39,12 +39,12 @@ sub exec {
my ($nick, $mask) = split(/!/,$user);
if ($msg =~ /^ *!fav(?: ([0-9]+))?/) {
my $id = ($1) ? $1 : $lastID{$chan->[0]};
my $id = ($1) ? $1 : $lastID->{$chan->[0]};
commands::fav::exec($nick, $id)
}
elsif ($msg =~ /^ *!later(?: ([0-9]+))?(?: in ([0-9]*)?(h|m|s)?)?/) {
my $id = ($1) ? $1 : $lastID{$chan->[0]};
my $id = ($1) ? $1 : $lastID->{$chan->[0]};
my ($time, $unit) = ($2, $3);
commands::later::exec($kernel, $nick, $id, $time, $unit);
......@@ -56,7 +56,7 @@ sub exec {
$msg = substr $msg, (length $1) + (length $2) + (length $id);
}
else {
$id = $lastID{$chan->[0]};
$id = $lastID->{$chan->[0]};
$msg = substr $msg, (length $1) + (length $2);
}
......@@ -68,7 +68,7 @@ sub exec {
my $id = commands::get::exec(@args);
if ($id) {
$lastID{$chan->[0]} = $id;
$lastID->{$chan->[0]} = $id;
}
}
elsif ($msg =~ /^ *!help/) {
......@@ -90,7 +90,7 @@ sub tag {
my ($msg, $chan) = @_;
my @tags = ($msg =~ /#([a-zA-Z0-9_-]+)/g);
commands::tag::exec($lastID{$chan->[0]}, "@tags");
commands::tag::exec($lastID->{$chan->[0]}, "@tags");
}
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