forked from wridgers/talon
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtaloncommon.pm
More file actions
35 lines (27 loc) · 721 Bytes
/
Copy pathtaloncommon.pm
File metadata and controls
35 lines (27 loc) · 721 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/perl
package taloncommon;
use strict;
sub is_admin {
my ($self, $sql, $nick, $host) = @_;
my @res = $sql->selectrow_array("select id from users where `nick`='$nick' and `isadmin`=1;");
if (@res) {
if ( taloncommon->host_match($sql, $nick, $host )) {
return 1;
} else {
return 0;
}
} else {
return 0;
}
}
sub is_god {
my ($self, $sql, $nick, $host) = @_;
my @res = $sql->selectrow_array("select id from users where `nick`='$nick' and `isgod`=1;");
(@res) ? return 1 : return 0;
}
sub host_match {
my ($self, $sql, $nick, $host) = @_;
my @res = $sql->selectrow_array("select hostmask from users where `nick`='$nick' limit 1;");
($host =~ /@res[0]/) ? return 1 : return 0;
}
1;