=cut
use strict;
-use SrSv::IRCd::UUID;
+use SrSv::Insp::UUID;
+use SrSv::Conf qw(main services sql);
+use SrSv::Conf2Consts qw(main services sql);
use Exporter 'import';
BEGIN {
my %constants = (
__flood_inc => ['NULL', "UPDATE user SET flood = flood + ? WHERE id=?"],
__flood_expire => ['NULL', "UPDATE user SET flood = flood >> 1"], # shift is faster than mul
};
+sub kill_user($$) {
+ my ($user, $reason) = @_;
+ ircd::irckill(get_user_agent($user) || main_conf_local, $user, $reason);
+}
sub get_flood_level($) {
my ($user) = @_;
sub get_user_id($) {
my ($user) = @_;
my ($id, $n);
- return undef if(is_agent($user->{NICK}) and not $enforcers{lc $user->{NICK}});
unless(ref($user) eq 'HASH') {
die("invalid get_user_nick call");
die("get_user_id called on empty string");
}
my $properId = ircd::getUuid ($user->{NICK});
+ print "!!!!!!!!!" . ($nick . " " . $properId) . "\n";
if ($properId != "") {
- print "Decoding $properId\n";
$properId = decodeUUID($properId);
return $user->{ID} = $properId;
}
- else { print "Null properId. User->id" . $user->{ID} . "\n"; }
- if(exists($user->{ID})) { print "Returning user_>id " . $user->{ID} . "\n"; return $user->{ID}; }
-
-
-
+ return undef if(is_agent($user->{NICK}) and not $enforcers{lc $user->{NICK}});
+ if(exists($user->{ID})) { return $user->{ID}; }
# a cheat for isServer()
if($user->{NICK} =~ /\./) {
return $user->{ID} = undef;
}
-
my $nick2;
while($n < 10 and !defined($id)) {
$n++;
$get_user_id->execute($nick);
($id) = $get_user_id->fetchrow_array;
- print "Finally got id from query: $id\n";
unless($id) {
$get_nickchg->execute($nick);
($id, $nick2) = $get_nickchg->fetchrow_array;
$user->{OLDNICK} = $user->{NICK};
$user->{NICK} = $nick2;
}
-
return $user->{ID} = $id;
}
unless(ref($user) eq 'HASH') {
die("invalid get_user_nick call");
}
+ if (exists($user->{ID})) {
+ if (my $nick = ircd::getRevUuid ($user->{ID})) {
+ return $user->{NICK} = $nick;
+ }
+ }
if(exists($user->{NICK}) and is_online($user->{NICK})) {
my $realnick = ircd::getRevUuid($user->{NICK});
if ($realnick) {