E
echohtp
does anyone know what format the data thats returned from a privmsg
while using Net::IRC? im trying to split the text then search for a
string but it doesnt seem to work right. here is a code snippet, maybe
someone can see the problem, i cant.
here is my on_msg subroutine.
# what to do on msg
###################
sub on_msg {
my ($conn, $event) = @_;
my (@msg) = split /\s+/, $event->{args};
# $conn->privmsg($event->{nick},"..");
# check list of "super_users" for correct user and pass
print $event->{args};
if ($event->{args} eq 'su'){
if (defined($super_users{$event->{nick}}) &&
$super_users{$event->{nick}} eq $msg[1])
{
$conn->privmsg($event->{nick}, "Hello $event->{nick} you
have root access");
$have_root{$event->{nick}} = 1;
}
else
{
$conn->privmsg($event->{nick}, "Incorrect password...");
}
}
else
{
$conn->privmsg($event->{nick}, "Why are you msging me, i dont
have much set up for you currently);
}
}
$conn->add_handler('msg', \&on_msg);
it doesnt seem to get past the first if statement checking if the 1st
part of the privmsg was 'su' there was a output statment after it for
debugging but it never made it that far, always went straight to the
last privmsg "Why are you msging me...."
any help would be greatly appericated.
and here are what the hashes look like that im testing. which are
declared above the subroutine.
%super_users= ( "nenn" => "XXXXXXXXX");
%have_root = ("nenn" => 0);
if anyone knows a better way to do this i would be more than grateful
to listen
while using Net::IRC? im trying to split the text then search for a
string but it doesnt seem to work right. here is a code snippet, maybe
someone can see the problem, i cant.
here is my on_msg subroutine.
# what to do on msg
###################
sub on_msg {
my ($conn, $event) = @_;
my (@msg) = split /\s+/, $event->{args};
# $conn->privmsg($event->{nick},"..");
# check list of "super_users" for correct user and pass
print $event->{args};
if ($event->{args} eq 'su'){
if (defined($super_users{$event->{nick}}) &&
$super_users{$event->{nick}} eq $msg[1])
{
$conn->privmsg($event->{nick}, "Hello $event->{nick} you
have root access");
$have_root{$event->{nick}} = 1;
}
else
{
$conn->privmsg($event->{nick}, "Incorrect password...");
}
}
else
{
$conn->privmsg($event->{nick}, "Why are you msging me, i dont
have much set up for you currently);
}
}
$conn->add_handler('msg', \&on_msg);
it doesnt seem to get past the first if statement checking if the 1st
part of the privmsg was 'su' there was a output statment after it for
debugging but it never made it that far, always went straight to the
last privmsg "Why are you msging me...."
any help would be greatly appericated.
and here are what the hashes look like that im testing. which are
declared above the subroutine.
%super_users= ( "nenn" => "XXXXXXXXX");
%have_root = ("nenn" => 0);
if anyone knows a better way to do this i would be more than grateful
to listen