sub is_agent($) {
my ($nick) = @_;
- print "is agent $nick";
- print "EXISTS: " . Dumper($agents{lc $nick});
return (defined($agents{lc $nick}));
}
return 0;
}
}
-
sub agent_connect($$$$$) {
my ($nick, $ident, $host, $modes, $gecos) = @_;
my $time = time();
}
$agents{lc $nick}{PARMS} = [ @_ ];
+
$host = main_conf_local unless $host;
-=cut
-# Unreal specific version
- ircsend("@{[TOK_NICK]} $nick 1 $time $ident $host ".
- (SJB64 ? itob64(main_conf_numeric) : main_conf_local).
- " 1 $modes * :$gecos");
-=cut
+ #ircsend("@{[TOK_NICK]} $nick 1 $time $ident $host ".
+ #(SJB64 ? itob64(main_conf_numeric) : main_conf_local).
+ #" 1 $modes * :$gecos");
ircd::agent_doconn ($nick, $ident, $host, $modes, $gecos);
- #$host = main_conf_local unless $host;
- #ircsend($tkn{NICK}[$tkn]." $nick 1 $time $ident $host ".
- # (SJB64 ? itob64(main_conf_numeric) : main_conf_local).
- # " 1 $modes * :$gecos");
-
-=cut
-# Unreal specific again -.-
foreach my $chan (@chans) {
- ircsend(":$nick ".$tkn{JOIN}[$tkn]." $chan");
+ ircsend(":$nick @{[TOK_JOIN]} $chan");
# If we tracked chanmodes for agents, that would go here as well.
}
-=cut
}
sub agent_quit($$) {
}
sub kill_callback($$$$) {
- my ($src, $dst, $path, $reason) = @_;
+ my ($srcUser, $dstUser, $path, $reason) = @_;
+ my $src = $srcUser->{NICK};
+ my $dst = $dstUser->{NICK};
if (defined($agents{lc $dst})) {
if (defined ($agents{lc $dst}{KILLED}) and ($agents{lc $dst}{KILLED} == time())) {
if ($agents{lc $dst}{KILLCOUNT} > 3) {
} elsif (defined($agents{lc $src})) {
# Do Nothing.
} else {
- ircd::irckill($main::rsnick, $src, "Do not kill services agents.");
+ my $rsUser = {NICK=>$main::rsnick,ID=>"123AAAAAA"}; #FIXME - erry
+ ircd::irckill($rsUser, $srcUser, "Do not kill services agents.");
}
&agent_connect(@{$agents{lc $dst}{PARMS}}) if synced();
-../Unreal/Validate.pm
\ No newline at end of file
+/home/errietta/srsv/branches/0.5.0/SrSv/Unreal/Validate.pm
\ No newline at end of file
use SrSv::IRCd::IO qw( ircsend ircsendimm);
use SrSv::IRCd::Send qw (getRevUuid getUuid setRevUuid setUuid);
use SrSv::Unreal::Modes qw(%opmodes);
-
+use SrSv::RunLevel 'main_shutdown';
# Unreal uses its own modified base64 for everything except NICKIP
use SrSv::Unreal::Base64 qw(b64toi itob64);
use SrSv::User '/./';
}
}
+sub CAPAB {
+#CAPAB MODULES :m_botmode.so,m_chanprotect.so,m_chghost.so,m_chgident.so,m_cloaking.so,m_deaf.so,m_delayjoin.so,m_delaymsg.so,m_gecosban.so,m_globops.so,m_helpop.so,m_messageflood.so,m_muteban.so,m_nokicks.so,m_nonicks.so,m_nonotice.so,m_nopartmsg.so,m_ojoin.so,m_operchans.so,m_operinvex.so,m_permchannels.so,m_redirect.so,m_regex_glob.so,m_remove.so,m_sajoin.so,m_sakick.so,m_sanick.so,m_sapart.so,m_saquit.so,m_serverban.so,m_services_account.so,m_servprotect.so,m_setident.so,m_showwhois.so,m_shun.so
+#CAPAB MODULES :m_silence.so,m_watch.so
+#CAPAB MODSUPPORT :m_chghost.so,m_chgident.so,m_gecosban.so,m_muteban.so,m_nopartmsg.so,m_remove.so,m_sajoin.so,m_sakick.so,m_sanick.so,m_sapart.so,m_saquit.so,m_serverban.so,m_services_account.so,m_showwhois.so,m_silence.so,m_watch.so
+#CAPAB CHANMODES :admin=&a ban=b c_registered=r delayjoin=D delaymsg=d flood=f founder=~q halfop=%h inviteonly=i key=k limit=l moderated=m noextmsg=n nokick=Q nonick=N nonotice=T official-join=!Y op=@o operonly=O permanent=P private=p redirect=L reginvite=R regmoderated=M secret=s topiclock=t voice=+v
+#6 CAPAB USERMODES :bot=B cloak=x deaf=d helpop=h invisible=i oper=o regdeaf=R servprotect=k showwhois=W snomask=s u_registered=r wallops=w
+#CAPAB CAPABILITIES :NICKMAX=32 CHANMAX=65 MAXMODES=20 IDENTMAX=12 MAXQUIT=256 MAXTOPIC=308 MAXKICK=256 MAXGECOS=129 MAXAWAY=201 IP6SUPPORT=1 PROTOCOL=1202 HALFOP=1 PREFIX=(Yqaohv)!~&@%+ CHANMODES=b,k,Ldfl,DMNOPQRTimnprst USERMODES=,,s,BRWdhikorwx SVSPART=1
+#---
+#What we care about: CHANMODES :admin=&a founder=~q Determines if we can set +a and +q on people, halfop %h: likewise... cloak=x determines if we can have cloaks or vhosts. in the modules we care about chghost, chgident, cloaking for vhosts, m_silence and m_watch for silence and watch respectively. Also c_registered, we can _NOT_ continue w/o it.
+#I HAVE NO IDEA where to get the watch/silence list limit!!!
+#let's do this the lame way!
+#FIXME this is so ugly
+ my $capab = $_[0];
+ print "CAPAB $_[0]\n";
+ $capab =~ /CAPAB (\S+)/;
+ my $type = $1;
+ if ($type eq "END" && $IRCd_capabilities {"REG"} eq "") {
+ ircd::debug ("WARNING: SurrealServices requires m_services_account.so to be loaded in Inspircd.");
+ ircd::debug ("m_services_account.so not loaded! Shutting down NOW!");
+ print "m_services_account.so not loaded! Shutting down NOW!\n";
+ main_shutdown;
+ }
+ if ($capab =~ /m_chghost/ && $type eq "MODSUPPORT") {
+ $IRCd_capabilities{"CHGHOST"} = 1;
+ }
+ if ($capab =~ /m_chgident/ && $type eq "MODSUPPORT") {
+ $IRCd_capabilities{"CHGIDENT"} = 1;
+ }
+ if ($capab =~ /m_cloaking/ ) {
+ $IRCd_capabilities{"CLOAKHOST"} = 1;
+ }
+ if ($capab =~ /cloak=(\S)/ ) {
+ $IRCd_capabilities{"CLOAK"} = $1;
+ }
+ if ($capab =~ /admin=(\S)(\S)/) {
+ $IRCd_capabilities{"ADMIN"} = $2;
+ }
+ if ($capab =~ /founder=(\S)(\S)/) {
+ $IRCd_capabilities{"FOUNDER"} = $2;
+ }
+ if ($capab =~ /silence/) {
+ $IRCd_capabilities{"SILENCE"} = 32; #unless we can make it TELL US
+ }
+ if ($capab =~ /watch/) {
+ $IRCd_capabilities{"WATCH"} = 32; #unless we can make it TELL US
+ }
+ if ($capab =~ /registered/) {
+ $IRCd_capabilities{"REG"} = 1;
+ }
+
+}
sub STATS($) {
$_[0] =~ /^:(\S+) (?:STATS|2) (\S) :(.+)$/;
return ('STATS', undef, undef, WF_NONE, $1, $2, $3)
'2' => \&STATS,
UID => \&UID,
OPERTYPE => \&OPERTYPE,
- OPERQUIT => \&OPERQUIT, #Opers are so special, they get their own QUIT.
+ OPERQUIT => \&OPERQUIT, #Opers are so special, they get their own QUIT. SOme of the time.
+ CAPAB => \&CAPAB,
);
}
sub setmode($$$;$) {
my ($src, $dst, $modes, $target) = @_;
my $srcId;
+ print "IRCD::SETMODE\n";
+ print Dumper ($src);
+ print Dumper ($target);
if (initial_synced()) {
if (ref($src) eq "HASH") {
$srcId = ($src->{ID}?$src->{ID}:($src->{UUID}?$src->{UUID}:$src->{NICK}));
}
my $targetId;
if (ref ($target) eq "HASH") {
- $targetId = ($target->{ID}?encodeUUID($target->{ID}):$target->{NICK});
+ $targetId = ($target->{UID}?$target->{UID}:($target->{ID}?$target->{ID}:$target->{NICK}));
}
else {
$targetId = $target;
}
callfuncs('MODE', undef, 1, [$srcId, $dst, $modes, $targetId]);
- #print "$ircline -- setmode($srcId, $dst, $modes, $targetId)\n" ;
+ print "$ircline -- setmode($srcId, $dst, $modes, $targetId)\n" ;
ircsend(":$srcId MODE $dst $modes $targetId");
}
my $parms = "";
foreach my $target (@targets) {
my $targetId = ($target->{ID}?encodeUUID($target->{ID}):$target->{NICK});
- $parms .= ($parms == ""?"":" ") . $targetId;
+ $parms .= ($parms eq ""?"":" ") . $targetId;
}
callfuncs('MODE', undef, 1, [$srcId, $dst, $modes, $parms]);
print "$ircline -- setmode($srcId, $dst, $modes, $parms)\n" ;
my $targetId = ($target->{ID}?encodeUUID($target->{ID}):$target->{NICK});
my $srcNick = $target->{NICK};
return 0 unless update_userkill($targetId);
- ircsendimm(":$srcId KILL $targetId ($reason)");
- callfuncs('KILL', 0, 1, [$srcId, $targetId, $srcNick, $reason]);
+ ircsendimm(":$srcId KILL $targetId :($reason)");
+ callfuncs('KILL', 0, 1, [$src, $target, $srcNick, $reason]);
}
sub svssno($$$) {
# Example: SVSWATCH Blah :+Blih!*@* -Bluh!*@* +Bleh!*@*.com
# *** We do not track this info nor care.
my ($src, $target, @watchlist) = @_;
- my $base_str = ":$src SVSWATCH $target :";
+ my $srcId = ($src->{ID}?$src->{ID}:$src->{NICK});
+ my $targetId = ($target->{ID}?encodeUUID($target->{ID}):$target->{NICK});
+ my $base_str = ":$srcId SVSWATCH $targetId ";
my $send_str = $base_str;
while (@watchlist) {
my $watch = shift @watchlist;
# Example: SVSSILENCE Blah :+Blih!*@* -Bluh!*@* +Bleh!*@*.com
# *** We do not track this info nor care.
my ($src, $target, @silencelist) = @_;
- my $base_str = ":$src SVSSILENCE $target :";
+ my $srcId = ($src->{ID}?$src->{ID}:$src->{NICK});
+ my $targetId = ($target->{ID}?encodeUUID($target->{ID}):$target->{NICK});
+ my $base_str = ":$srcId SVSSILENCE $targetId ";
my $send_str = $base_str;
while (@silencelist) {
my $silence = shift @silencelist;
}
$send_str = "$send_str $silence";
}
+ print "SENDING $send_str\n";
ircsend($send_str);
}
return $sidN;
}
sub decodeUUID($) {
+ Carp::confess ("WELP !SOMEONE CALLED DECDOEUUID");
my ($UUID) = @_;
my @chars = split(//, $UUID);
#my @sidC = @chars[0..2];
}
}
sub encodeUUID($) {
+ Carp::confess ("WELP !SOMEONE CALLED ENCODEUUID");
my ($int) = @_;
my $SID_int = ($int & (SID_BITMASK)) >> UID_BITS;
my $UID_int = $int & UID_BITMASK;
#my $int = decodeUUID('583AAAAAE');
#print "$int\n";
#print log($int)/log(2), "\n";
-print encodeUUID(142036011587731460);
#print decodeUUID('583AAAAAK');
#print encodeUUID (1);
#=cut
BEGIN { *SJB64 = \&ircd::SJB64; *CLK = \&ircd::CLK; *NICKIP = \&ircd::NICKIP; }
use SrSv::Conf 'main';
-use SrSv::Conf2Consts 'main';
-
-use Socket;
-BEGIN {
- if(main_conf_ipv6) {
- require Socket6; import Socket6;
- }
-}
use SrSv::Debug;
use SrSv::IRCd::State qw($ircline $remoteserv create_server get_server_children set_server_state get_server_state %IRCd_capabilities);
use SrSv::IRCd::Queue qw(queue_size);
use SrSv::IRCd::IO qw( ircsend ircsendimm);
-use SrSv::IRCd::Send qw (getRevUuid getUuid setRevUuid setUuid);
use SrSv::Unreal::Modes qw(%opmodes);
# Unreal uses its own modified base64 for everything except NICKIP
use SrSv::Unreal::Base64 qw(b64toi itob64);
-
+use SrSv::User '/./';
# Unreal uses unmodified base64 for NICKIP.
# Consider private implementation,
# tho MIME's is probably faster
use MIME::Base64;
-
+use Data::Dumper;
# FIXME
use constant {
# Wait For
return @out;
}
-#parse_fjoin($server, $channel, $ts, $modes, @nicks, @status)
-sub parse_fjoin ($$$$$$) {
- my ($server, $channel, $ts, $modes, $nicksref, $statusref) = @_;
- my @status = @$statusref;
- my @nicks = @$nicksref;
- my $i = 0;
- my @users;
- foreach my $nick (@nicks) {
- my $op = 0;
- my @ops = split ("",$status[$i]);
- foreach my $prefix (@ops) {
- $op |= $opmodes{$prefix};
- }
- push @users, { NICK => ircd::getRevUuid($nick), __OP => $op};
- $i++;
- }
- return ($server, $channel, $ts, $modes, undef, \@users, undef, undef, undef); #those are got from FMODE...
-}
sub parse_sjoin($$$$) {
my ($server, $ts, $cn, $parms) = @_;
my (@users, @bans, @excepts, @invex, @blobs, $blobs, $chmodes, $chmodeparms);
return ($server, $cn, $ts, $chmodes, $chmodeparms, \@users, \@bans, \@excepts, \@invex);
}
-sub parse_addline ($) {
- my ($line) = @_;
- #return ($type, +1, $ident, $host, $setter, $expire, $time, $reason);
- #>> 47 :583AAAAAA ADDLINE G test@testie inspircd.erry.omg 1308118489 0 :hi
- my ($setter, undef, $type, $mask, $server, $time, $expiry, $reason) = split (/ /, $line, 7);
- $reason =~ /:(.*)/;
- $reason = $1;
- $setter =~ /:(.*)/;
- $setter = $1;
- my @masks = split (/@/,$mask, 1);
- my $ident = $masks[0];
- my $host = $masks[1];
- #return ($type, +1, $ident, $host, $setter, $expire, $time, $reason);
- return ($type, +1, $ident, $host, $setter, $expiry, $time, $reason);
-}
sub parse_tkl ($) {
my ($in) = @_;
# This function is intended to accept ALL tkl types,
# ($event, $src, $dst, $args)
return ('PING', undef, undef, WF_NONE, $1);
}
-sub UID ($) {
- #:583 UID 583AAAAAJ 1307703236 erry__ localhost localhost errietta 127.0.0.1 1307703241 + :errietta
- $_[0] =~ /^(:\S+) UID (\S+) (\d+) (\S+) (\S+) (\S+) (\S+) (\S+) (\d+) (\S+) :(.*)$/;
- my ($server, $uid, $ts, $nick, $host, $vhost, $ident, $IP, $stamp, $modes, $gecos) = ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12);
- ircd::setRevUuid ($uid, $nick);
- ircd::setUuid ($nick, $uid);
- return ('NICKCONN', undef, undef, WF_NICK, $nick, 0, $ts, $ident, $host, $server, $stamp, $modes, $vhost, $gecos,
- join('.', unpack('C4', MIME::Base64::decode($IP))));
-}
sub EOS($) {
my $event;
- print "EOS\n";
- if ($_[1] != "ENDBURST") {
- $_[0] =~ /^(@|:)(\S+) (?:EOS|ES)/; # Sometimes there's extra crap on the end?
- my $server;
- if ($1 eq '@') {
- $server = $servernum[b64toi($2)];
- }
- else {
- $server = $2;
- }
- set_server_state($server, 1);
- return undef() unless get_server_state($remoteserv);
- if($server eq $remoteserv) { $event = 'SEOS' } else { $event = 'EOS' }
- print "Ok. we had EOS\n";
- return ($event, undef, undef, WF_ALL, $server);
+ $_[0] =~ /^(@|:)(\S+) (?:EOS|ES)/; # Sometimes there's extra crap on the end?
+ my $server;
+ if ($1 eq '@') {
+ $server = $servernum[b64toi($2)];
}
else {
- print "This be it! Got endbrust!\n";
- return ("ENDBURST", undef, undef, WF_ALL, $1);
+ $server = $2;
}
+ print "SERVER $server\n";
+ set_server_state($server, 1);
+ return undef() unless get_server_state($remoteserv);
+ if($server eq $remoteserv) { $event = 'SEOS' } else { $event = 'EOS' }
+ print "Ok. we had EOS\n";
+ return ($event, undef, undef, WF_ALL, $server);
}
sub SERVER($) {
#ircd::debug($_[0]) if $debug;
+
if($_[0] =~ /^(?:SERVER|\') (\S+) (\S+) :(U[0-9]+)-([A-Za-z0-9]+)-([0-9]+) (.*)$/) {
- # SERVER test-tab.surrealchat.net 1 :U2307-FhinXeOoZEmM-200 SurrealChat
- # cmd, servername, hopCount, U<protocol>-<buildflags>-<numeric> infoLine
+ # SERVER test-tab.surrealchat.net 1 :U2307-FhinXeOoZEmM-200 SurrealChat
+ # cmd, servername, hopCount, U<protocol>-<buildflags>-<numeric> infoLine
$remoteserv = $1;
create_server($1);
$servernum[$5] = $1;
return ('SERVER', undef, undef, WF_ALL, $1, $2, $3, $4);
# src, serverName, numHops, infoLine
}
+ elsif ($_[0] =~ /SERVER (\S+) (\S+) (\d+) (\S+) :(.*)$/) {
+ #SERVER inspircd.erry.omg mypass 0 583 :erry World
+ #SERVER servername password hopcount SID :Server Desc
+ $remoteserv = $4;
+ create_server ($4);
+ #since from now on we'll be getting commands as sent from the SID it's much wiser to keep that than the name.
+ return ("SERVER", undef, undef, WF_ALL, undef, $1, $3, $5, $4);
+ }
}
sub SQUIT($) {
sub JOIN($) {
$_[0] =~ /^:(\S+) (?:C|JOIN) (\S+)$/;
- return ('JOIN', undef, 1, WF_CHAN, $1, $2);
-}
-#>> 13 :97K FJOIN #erry 1307879417 +nt :o,97KAAAAAA ,97KAAAAAB
-sub FJOIN ($) {
- $_[0] =~ m"^(:\S+) FJOIN (\S+) (\d+) (\S+) (.*)$";
- my ($server, $channel, $ts, $modes, $userstring) = ($1, $2, $3, $4, $5);
- my @users = split (" ", $userstring);
- my (@nicks, @status);
- foreach my $user (@users) {
- my @params = split (",",$user);
- push (@status, $params[0]);
- push (@nicks, $params[1]);
- }
- return ('SJOIN', undef, undef, WF_CHAN, parse_fjoin($server, $channel, $ts, $modes, \@nicks, \@status));
+ my $user = { NICK => $1 };
+ get_user_id ($user);
+ return ('JOIN', undef, 1, WF_CHAN, $user, $2);
}
+
sub SJOIN($) {
if ($_[0] =~ /^(?:\~|SJOIN) (\S+) (\S+) (.*)$/) {
my ($ts, $cn, $payload) = ($1, $2, $3);
return ('SJOIN', undef, undef, WF_CHAN, parse_sjoin($remoteserv, $ts, $cn, $payload));
}
elsif($_[0] =~ /^(@|:)(\S+) (?:\~|SJOIN) (\S+) (\S+) (.*)$/) {
+ print "SJOIN\n";
my ($server, $ts, $cn, $payload) = ($2, $3, $4, $5);
if ($1 eq '@') {
$server = $servernum[b64toi($2)];
}
sub PART($) {
+ my $user;
+
if($_[0] =~ /^:(\S+) (?:D|PART) (\S+) :(.*)$/) {
- return ('PART', undef, 0, WF_CHAN, $1, $2, $3);
+ $user = {NICK => $1};
+ get_user_id ($user);
+ return ('PART', undef, 0, WF_CHAN, $user, $2, $3);
}
elsif($_[0] =~ /^:(\S+) (?:D|PART) (\S+)$/) {
- return ('PART', undef, 0, WF_CHAN, $1, $2, undef);
+ $user = {NICK => $1};
+ get_user_id ($user);
+ return ('PART', undef, 0, WF_CHAN, $user, $2, undef);
}
}
-
sub MODE($) {
+ my $user;
+
if($_[0] =~ /^(@|:)(\S+) (?:G|MODE) (#\S+) (\S+) (.*)(?: \d+)?$/) {
my $name;
if ($1 eq '@') {
$name = $servernum[b64toi($2)];
+ $user = {NICK => $name};
}
else {
$name = $2;
+ $user = { NICK=>$name};
+ get_user_id ($user);
}
- my $properName = getRevUuid ($name);
- if ($properName) { $name = $properName; }
- return ('MODE', undef, 1, WF_ALL, $name, $3, $4, $5);
+ return ('MODE', undef, 1, WF_ALL, $user, $3, $4, $5);
}
elsif($_[0] =~ /^:(\S+) (?:G|MODE) (\S+) :(\S+)$/) {
# We shouldn't ever get this, as UMODE2 is preferred
- return ('UMODE', 0, 0, WF_ALL, $1, $3);
+ $user = { NICK => $1 };
+ get_user_id($user);
+ return ('UMODE', 0, 0, WF_ALL, $user, $3);
}
}
sub MESSAGE($) {
my ($event, @args);
if($_[0] =~ /^(@|:)(\S+) (?:\!|PRIVMSG) (\S+) :(.*)$/) {
- my $name;
+
+ my ($name, $srcUser, $dstUser) ;
if ($1 eq '@') {
$name = $servernum[b64toi($2)];
+ $srcUser = {NICK=>$name};
}
else {
$name = $2;
+ $srcUser = {NICK=>$name};
+ get_user_id ($srcUser);
}
my $dest = $3;
- my $reverse_uuid = ircd::getRevUuid($dest);
- my $user_revuuid = ircd::getRevUuid($name);
- unless ($reverse_uuid eq "") {
- $dest = $reverse_uuid;
- }
- unless ($user_revuuid eq "") {
- $name = $user_revuuid;
- }
- $event = 'PRIVMSG'; @args = ($name, $dest, $4);
+ $dstUser = {NICK=>$dest};
+ $event = 'PRIVMSG'; @args = ($srcUser, $dstUser, $4);
}
elsif($_[0] =~ /^(@|:)(\S+) (?:B|NOTICE) (\S+) :(.*)$/) {
my $name;
sub AWAY($) {
if($_[0] =~ /^:(\S+) (?:6|AWAY) :(.*)$/) {
- return ('AWAY', undef, undef, WF_ALL, $1, $2);
+ my $user = {NICK=>$1};
+ get_user_id($user);
+ return ('AWAY', undef, undef, WF_ALL, $user, $2);
}
- elsif($_[0] =~ /^:(\S+) (?:6|AWAY) $/) {
- return ('BACK', undef, undef, WF_ALL, $1);
+ elsif($_[0] =~ /^:(\S+) (?:6|AWAY)$/) {
+ my $user = {NICK => $1};
+ get_user_id ($user);
+ return ('BACK', undef, undef, WF_ALL, $user);
}
}
sub NICK($) {
my ($event, @args);
- #:97KAAAAAA NICK erry_ 1307878528
if($_[0] =~ /^:(\S+) (?:NICK|\&) (\S+) :?(\S+)$/) {
- my $oldnick = ircd::getRevUuid ($1);
- ircd::setRevUuid ($1, $2);
- ircd::setUuid ($2, $1);
- return ('NICKCHANGE', undef, undef, WF_NICK, $oldnick, $2, $3);
+ return ('NICKCHANGE', undef, undef, WF_NICK, $1, $2, $3);
}
elsif(CLK && NICKIP && $_[0] =~ /^(?:NICK|\&) (\S+) (\d+) (\S+) (\S+) (\S+) (\S+) (\d+) (\S+) (\S+) (\S+) (\S+) :(.*)$/) {
#NICK Guest57385 1 !14b7t0 northman tabriel.tabris.net 38 0 +iowghaAxNWzt netadmin.SCnet.ops SCnet-3B0714C4.tabris.net CgECgw== :Sponsored By Skuld
$server = $servernum[b64toi($server)];
}
- if(main_conf_ipv6 && (length($IP) > 8)) {
- $IP = Socket6::inet_ntop(AF_INET6, MIME::Base64::decode($IP));
+ if((length($IP) > 8)) {
+ #$IP = Socket6::inet_ntop(AF_INET6, MIME::Base64::decode($IP));
} else {
$IP = join('.', unpack('C4', MIME::Base64::decode($IP)));
}
- return ('NICKCONN', undef, undef, WF_NICK, $nick, $hops, $ts, $ident, $host, $server, $stamp, $modes, $vhost,
+ my $user = {NICK=>$nick};
+ return ('NICKCONN', undef, undef, WF_NICK, $user, $hops, $ts, $ident, $host, $server, $stamp, $modes, $vhost,
$gecos, $IP, $cloakhost
);
}
$server = $servernum[b64toi($server)];
}
- if(main_conf_ipv6 && length($IP) > 8) {
+ if( length($IP) > 8) {
$IP = Socket6::inet_ntop(AF_INET6, MIME::Base64::decode($IP));
} else {
$IP = join('.', unpack('C4', MIME::Base64::decode($IP)));
}
- return ('NICKCONN', undef, undef, WF_NICK, $nick, $hops, $ts, $ident, $host, $server, $stamp, $modes, $vhost,
+ my $user = {NICK=>$nick};
+ return ('NICKCONN', undef, undef, WF_NICK, $user, $hops, $ts, $ident, $host, $server, $stamp, $modes, $vhost,
$gecos, $IP
);
}
$server = $servernum[b64toi($server)];
}
- return ('NICKCONN', undef, undef, WF_NICK, $nick, $hops, $ts, $ident, $host, $server, $stamp, $modes,
+ my $user = {NICK=>$nick};
+ return ('NICKCONN', undef, undef, WF_NICK, $user, $hops, $ts, $ident, $host, $server, $stamp, $modes,
$vhost, $gecos);
}
}
sub QUIT($) {
- $_[0] =~ /^:(\S+) (?:QUIT|\,) :(.*)$/;
- my $id = $1;
- my $nick = ircd::getRevUuid($id);
- if (!$nick) { $nick = $id; }
- return ('QUIT', 0, undef, WF_NICK, $nick, $2);
+ if ($_[0] =~ /^:(\S+) QUIT :(.*)$/) {
+ my $user = { NICK=>$1 };
+ return ('QUIT', 0, undef, WF_NICK, $user, $2);
+ }
}
sub KILL($) {
-#:tabris KILL ProxyBotW :tabris.netadmin.SCnet.ops!tabris (test.)
-#:ProxyBotW!bopm@ircop.SCnet.ops QUIT :Killed (tabris (test.))
- $_[0] =~ /^(@|:)(\S+) (?:KILL|\.) (\S+) :(\S+) \((.*)\)$/;
- my $name;
- if ($1 eq '@') {
- $name = $servernum[b64toi($2)];
- }
- else {
- $name = $2;
- }
- return ('KILL', 0, 1, WF_NICK, $name, $3, $4, $5);
+ $_[0] =~ /^:(\S+) KILL (\S+) :(.*)$/;
+ my $murderer = {NICK=>$1};
+ my $victim = {NICK=>$2};
+ return ("KILL", 0, 1, WF_NICK, $murderer, $victim, $3, undef);
}
-
sub KICK($) {
#:tabris KICK #diagnostics SurrealBot :i know you don't like this. but it's for science!
$_[0] =~ /^(@|:)(\S+) (?:KICK|H) (\S+) (\S+) :(.*)$/;
else {
$name = $2;
}
- return ('KICK', 0, undef, WF_CHAN, $name, $3, $4, $5);
+ my $user = {NICK => $name};
+ return ('KICK', 0, undef, WF_CHAN, $user, $3, $4, $5);
}
sub HOST($) {
if ($ts =~ s/^!//) {
$ts = b64toi($ts);
}
- return ('TOPIC', 0, 1, WF_ALL, $name, $cn, $setter, $ts, $topic);
+ my $usetter = {NICK=>$name};
+ return ('TOPIC', 0, 1, WF_ALL, $usetter, $cn, $setter, $ts, $topic);
}
elsif($_[0] =~ /^(?:TOPIC|\)) (\S+) (\S+) (\S+) :(.*)$/) {
my ($cn, $setter, $ts, $topic) = ($1, $2, $3, $4);
if ($ts =~ s/^!//) {
$ts = b64toi($ts);
}
- # src, channel, setter, timestamp, topic
- return ('TOPIC', 0, 1, WF_ALL, undef, $cn, $setter, $ts, $topic);
+ # src, channel, setter, timestamp, topic
+ my $usetter = {NICK=>$setter};
+ return ('TOPIC', 0, 1, WF_ALL, undef, $cn, $usetter, $ts, $topic);
}
}
# on IRCds with only MODE.
return ('UMODE', 0, 0, WF_ALL, $1, $2);
}
-
sub SVSMODE($) {
#:tabris | +oghaANWt
$_[0] =~ /^:(\S+) (?:SVS2?MODE|n|v) (\S+) (\S+)$/;
my ($key, $value) = split('=', $token);
$IRCd_capabilities{$key} = ($value ? $value : 1);
}
+ #for insp... unreal supports it anyway
+ $IRCd_capabilities{"CHGHOST"} = 1;
+ $IRCd_capabilities{"CHGIDENT"} = 1;
+ $IRCd_capabilities{"CLOAKHOST"} = 1;
+ $IRCd_capabilities{"CLOAK"} = 1;
+ $IRCd_capabilities{"ADMIN"} = 'a';
+ $IRCd_capabilities{"FOUNDER"} = 'q';
+ $IRCd_capabilities{"SILENCE"} = 32;
+ $IRCd_capabilities{"WATCH"} = 32;
+ $IRCd_capabilities{"REG"} = 1;
}
sub STATS($) {
EOS => \&EOS,
ES => \&EOS,
- ENDBURST => \&EOS,
SERVER => \&SERVER,
"\'" => \&SERVER,
SJOIN => \&SJOIN,
'~' => \&SJOIN,
FJOIN => \&FJOIN,
+ FMODE => \&FMODE,
MODE => \&MODE,
G => \&MODE,
STATS => \&STATS,
'2' => \&STATS,
- UID => \&UID,
);
}
use Event;
use Carp;
use MIME::Base64;
-
+use Data::Dumper;
use SrSv::Conf 'main';
use SrSv::Conf::main;
use SrSv::Conf2Consts qw( main );
-
use SrSv::Debug;
use SrSv::Log;
use Exporter 'import';
-our @EXPORT = qw (agent_doconn getRevUuid getUuid setRevUuid setUuid);
+our @EXPORT = qw (agent_doconn getUuid getRevUuid setUuid setRevUuid);
# FIXME
use constant {
MAXBUFLEN => 510,
use SrSv::IRCd::State qw($ircline $remoteserv $ircd_ready synced initial_synced set_server_state set_server_juped get_server_state get_online_servers);
use SrSv::Unreal::Modes qw(@opmodes %opmodes $scm $ocm $acm);
-use SrSv::Unreal::Tokens qw( :tokens );
+use SrSv::Unreal::Tokens;
use SrSv::IRCd::Parse qw(parse_tkl parse_addline);
use SrSv::Unreal::Base64 qw(itob64 b64toi);
use SrSv::Agent;
-use SrSv::Process::InParent qw(update_userkill getRevUuid getUuid setRevUuid SetUUid);
+use SrSv::Process::InParent qw(update_userkill);
our %defer_mode;
our %preconnect_defer_mode;
addhandler('NETINFO', undef(), undef(), 'ircd::netinfo', 1);
addhandler('VERSION', undef(), undef(), 'ircd::version', 1);
addhandler('SERVER', undef(), undef(), 'ircd::handle_server', 1);
-addhandler('ENDBURST',undef(),undef(),'ircd::endburst',1);
-sub getRevUuid($) {
- my $id = $_[0];
- my $nick = $reverse_uuids{$id};
- $uuids{lc $nick} = $id;
- return $nick;
-}
-sub getUuid($) {
- my $nick = lc $_[0];
- print "Get uuid $nick " . $uuids{$nick} . "\n";
- return $uuids{$nick};
+sub setUuid ($$) {
+ return undef;
}
sub setRevUuid ($$) {
- my ($id, $nick) = @_;
- $reverse_uuids{$id} = lc $nick;
+ return undef;
}
-sub setUuid ($$) {
- my ($nick, $id) = @_;
- $uuids{lc $nick} = $id;
- print "Set uuid $nick $id\n";
+sub getUuid ($) {
+ return undef;
+}
+sub getRevUuid ($) {
+ return undef;
}
sub serv_connect() {
my $remote = main_conf_remote;
%defer_mode = ();
}
+
# Helper Functions
sub handle_server($$$$;$$$) {
# Handler functions
sub pong($$$) {
- my ($src, $cookie, $dst) = @_;
+ my ($src, $cookie, $dst) = @_;
# This will only make sense if you remember that
# $src is where it came from, $dst is where it went (us)
# we're basically bouncing it back, but changing from PING to PONG.
# $dst is always $main_conf{local} anyway...
# this is only valid b/c we never have messages routed THROUGH us
# we are always an end point.
- ircsendimm(":$dst @{[TOK_PONG]} $src :$cookie");
+ ircsendimm(":$dst PONG $src :$cookie");
}
else {
- ircsendimm("@{[TOK_PONG]} :$src");
+ ircsendimm("PONG :$src");
}
}
-sub endburst {
- print "GOT ENDBURST\n\n";
- ircd_flush_queue();
- ircsendimm ("ENDBURST");
- $ircd_ready = 1; #!
-}
sub eos {
print "GOT EOS\n\n";
#print "Synced: ", synced(), "\n\n";
#exit;
- ircsendimm(':'.main_conf_local.' '.TOK_EOS, 'VERSION');
-
+ ircsendimm(':'.$main_conf{local}.' EOS');
+ ircsendimm(':'.$main_conf{local}.' VERSION');
agent_sync();
flushmodes(\%preconnect_defer_mode);
ircd_flush_queue();
}
sub netinfo($$$$$$$$) {
- ircsendimm(TOK_NETINFO.' 0 '.time." $_[2] $_[3] 0 0 0 :$_[7]");
+ ircsendimm('NETINFO 0 '.time." $_[2] $_[3] 0 0 0 :$_[7]");
$main_conf{network} = $_[7];
}
sub tssync {
- ircsendimm((SJB64 ? '@'.itob64(main_conf_numeric) : ':'.main_conf_local)." @{[TOK_TSCTL]} SVSTIME ".time);
+ ircsendimm((SJB64 ? '@'.itob64($main_conf{numeric}) : ':'.$main_conf{local})." TSCTL SVSTIME ".time);
}
sub parse_sjoin($$$$) {
sub kick($$$$) {
my ($src, $chan, $target, $reason) = @_;
- $src = main_conf_local unless initial_synced();
- ircsend(":$src @{[TOK_KICK]} $chan $target :$reason");
-# thread::ircrecv(":$src @{[TOK_KICK]} $chan $target :$reason");
- callfuncs('KICK', 0, 2, [$src, $chan, $target, $reason]);
+ $src = $main_conf{local} unless initial_synced();
+ my $srcN = $src->{NICK};
+ my $targetN = $target->{NICK};
+ ircsend(":$srcN KICK $chan $targetN :$reason");
+ callfuncs('KICK', 0, 2, [$srcN, $chan, $targetN, $reason]);
}
sub invite($$$) {
my ($src, $chan, $target) = @_;
- #:SecurityBot INVITE tabris #channel
- ircsend(":$src @{[TOK_INVITE]} $target $chan");
+ my $srcN = $src->{NICK};
+ my $targetN = $target->{NICK};
+ ircsend(":$srcN INVITE $targetN $chan 0");
}
sub ping {
# if(@_ == 1) {
- ircsend(':'.main_conf_local.' '.TOK_PING.' :'.main_conf_local);
+ ircsend(':'.$main_conf{local}.' PING :'.$main_conf{local});
# } else {
-# ircsend(':'.$_[2].' '.TOK_PONG.' '.$_[0].' :'.$_[1]);
+# ircsend(':'.$_[2].' '.$tkn{PONG}[$tkn].' '.$_[0].' :'.$_[1]);
# }
}
-sub __privmsg($$@) {
+sub privmsg($$@) {
my ($src, $dst, @msgs) = @_;
-
my @bufs;
foreach my $buf (@msgs) {
# 3 spaces, two colons, PRIVMSG=7
# Length restrictions are for CLIENT Protocol
# hence the (MASKLEN - (NICKLEN + 1))
# Technically optimizable if we use $agent{lc $src}'s ident and host
- my $buflen = length($src) + length($dst) + 5 + length(TOK_PRIVMSG) + (MASKLEN - (NICKLEN + 1));
+ my $buflen = length($src) + length($dst) + 12 + (MASKLEN - (NICKLEN + 1));
push @bufs, wordwrap($buf, (MAXBUFLEN - $buflen));
}
- my $properSrc = getUuid($src);
- if ($properSrc) { $src = $properSrc; }
+ my $srcN = $src->{NICK};
# submit a list of messages as a single packet to the server
- ircsend(":$src @{[TOK_PRIVMSG]} $dst :".join("\r\n".":$src @{[TOK_PRIVMSG]} $dst :", @bufs));
- return \@bufs;
-}
-sub privmsg($$@) {
- my ($src, $dst, @msgs) = @_;
- my $bufs = __privmsg($src, $dst, @msgs);
- callfuncs('LOOP_PRIVMSG', 0, 1, [$src, $dst, $bufs]);
-}
-sub privmsg_noloop($$@) {
- my ($src, $dst, @msgs) = @_;
- __privmsg($src, $dst, @msgs);
- return;
+ ircsend(":$srcN PRIVMSG $dst :".join("\r\n".":$src PRIVMSG $dst :", @bufs));
+ callfuncs('LOOP_PRIVMSG', 0, 1, [$src, $dst, \@bufs]);
}
sub debug(@) {
my (@msgs) = @_;
- privmsg(main_conf_local, main_conf_diag, @msgs);
- write_log('diag', '<'.main_conf_local.'>', @msgs);
+ debug_privmsg($main_conf{local}, $main_conf{diag}, @msgs);
+ write_log('diag', '<'.$main_conf{local}.'>', @msgs);
}
-
+sub write_log () { }
sub debug_nolog(@) {
my (@msgs) = @_;
- privmsg(main_conf_local, main_conf_diag, @msgs);
+ debug_privmsg($main_conf{local}, $main_conf{diag}, @msgs);
}
+sub debug_privmsg($$@) {
+ my ($src, $dst, @msgs) = @_;
+
+ my @bufs;
+ foreach my $buf (@msgs) {
+ # 3 spaces, two colons, PRIVMSG=7
+ # Length restrictions are for CLIENT Protocol
+ # hence the (MASKLEN - (NICKLEN + 1))
+ my $buflen = length($src) + length($dst) + 12 + (MASKLEN - (NICKLEN + 1));
+ push @bufs, wordwrap($buf, (MAXBUFLEN - $buflen));
+ }
+
+ # submit a list of messages as a single packet to the server
+ ircsendimm(":$src PRIVMSG $dst :".join("\r\n".":$src PRIVMSG $dst :", @bufs));
+ callfuncs('LOOP_PRIVMSG', 0, 1, [$src, $dst, \@bufs]);
+}
sub notice($$@) {
my ($src, $dst, @msgs) = @_;
-
+ my $target = $dst; #lazy erry
my @bufs;
foreach my $buf (@msgs) {
# 3 spaces, two colons, NOTICE=6
# Length restrictions are for CLIENT Protocol
# hence the (MASKLEN - (NICKLEN + 1))
- my $buflen = length($src) + length($dst) + 5 + length(TOK_NOTICE) + (MASKLEN - (NICKLEN + 1));
+ my $buflen = length($src) + length($dst) + 12 + (MASKLEN - (NICKLEN + 1));
push @bufs, wordwrap($buf, (MAXBUFLEN - $buflen));
}
- my $propersrc = getUuid($src);
- if ($propersrc) { $src = $propersrc; }
- my $properdest = getUuid($dst);
- if ($properdest) { $dst = $properdest; }
- # submit a list of notices as a single packet to the server
- ircsend(":$src @{[TOK_NOTICE]} $dst :".join("\r\n".":$src @{[TOK_NOTICE]} $dst :", @bufs));
- callfuncs('LOOP_NOTICE', 0, 1, [$src, $dst, \@bufs]);
+ my $srcN = $src->{NICK};
+ my $targetN;
+ if (ref ($dst) eq "HASH") { #User Object
+ $targetN = $target->{NICK};
+ }
+ else { # /notice #channel This probably sucks. Blame erry :(
+ $targetN = $dst;
+ }
+ ircsend(":$srcN NOTICE $targetN :".join("\r\n".":$srcN NOTICE $targetN :", @bufs));
+ callfuncs('LOOP_NOTICE', 0, 1, [$srcN, $targetN, \@bufs]);
}
sub ctcp($$@) {
my ($src, $dst, $cmd, @toks) = @_;
-
- privmsg($src, $dst, "\x01".join(' ', ($cmd, @toks))."\x01");
+ my $target = $dst; #lazy erry
+ my $srcN = $src->{NICK};
+ my $targetN = ($target->{NICK});
+ privmsg($srcN, $targetN, "\x01".join(' ', ($cmd, @toks))."\x01");
}
sub ctcp_reply($$@) {
my ($src, $dst, $cmd, @toks) = @_;
-
- notice($src, $dst, "\x01".join(' ', ($cmd, @toks))."\x01");
+ my $target = $dst; #lazy erry
+ my $srcN = $src->{NICK};
+ my $targetN = $target->{NICK};
+ notice($srcN, $targetN, "\x01".join(' ', ($cmd, @toks))."\x01");
}
sub setumode($$$) {
my ($src, $dst, $modes) = @_;
-
- ircsend(":$src @{[TOK_SVS2MODE]} $dst $modes");
+ my $target = $dst; #lazy erry
+ my $srcN = $src->{NICK};
+ my $targetN = $target->{NICK};
+ ircsend(":$srcN SVSMODE $targetN $modes");
callfuncs('UMODE', 0, undef, [$dst, $modes]);
}
sub setsvsstamp($$$) {
my ($src, $dst, $stamp) = @_;
-
- ircsend(":$src @{[TOK_SVS2MODE]} $dst +d $stamp");
+
+ ircsend(":$src SVS2MODE $dst +d $stamp");
# This function basically set the svsstamp to
# be the same as the userid. Not all ircd will
# support this function.
+ #and insp doesn't.
# We obviously already know the userid, so don't
# use a callback here.
#callfuncs('UMODE', 0, undef, [$dst, $modes]);
sub setagent_umode($$) {
my ($src, $modes) = @_;
-
- ircsend(":$src @{[TOK_UMODE2]} $modes");
+ ircsend(":$src UMODE2 $modes");
}
sub setmode2($$@) {
my ($src, $dst, @modelist) = @_;
#debug(" --", "-- ircd::setmode2: ".$_[0], split(/\n/, Carp::longmess($@)), " --");
foreach my $modetuple (@modelist) {
+ my $target = $modetuple->[1];
setmode($src, $dst, $modetuple->[0], $modetuple->[1]);
}
}
}
sub setmode($$$;$) {
- my ($src, $dst, $modes, $parms) = @_;
- $src = main_conf_local unless initial_synced();
- my $properSrc = getUuid ($src);
- if ($properSrc) { $src = $properSrc; }
- callfuncs('MODE', undef, 1, [$src, $dst, $modes, $parms]);
-
- print "$ircline -- setmode($src, $dst, $modes, $parms)\n" if DEBUG;
- my $prev = $defer_mode{"$src $dst"}[-1];
-
- if(defined($prev)) {
- my ($oldmodes, $oldparms) = split(/ /, $prev, 2);
-
- # 12 modes per line
- if((length($oldmodes.$modes) - @{[($oldmodes.$modes) =~ /[+-]/g]}) <= 12 and length($src.$dst.$parms.$oldparms) < 400) {
- $defer_mode{"$src $dst"}[-1] = modes::merge(
- $prev, "$modes $parms", ($dst =~ /^#/ ? 1 : 0));
- print $defer_mode{"$src $dst"}[-1], " *** \n" if DEBUG;
-
- return;
+ my ($src, $dst, $modes, $target) = @_;
+ my $srcN;
+ if (initial_synced()) {
+ if (ref($src) eq "HASH") {
+ $srcN = $src->{NICK};
+ }
+ else {
+ $srcN = $src;
}
}
-
- push @{$defer_mode{"$src $dst"}}, "$modes $parms";
+ else {
+ $src = $main_conf{local};
+ $srcN = $src;
+ }
+ my $targetN;
+ if (ref ($target) eq "HASH") {
+ $targetN = $target->{NICK};
+ }
+ else {
+ $targetN = $target;
+ }
+ callfuncs('MODE', undef, 1, [$srcN, $dst, $modes, $targetN]);
+ #print "$ircline -- setmode($srcId, $dst, $modes, $targetId)\n" ;
+ ircsend(":$srcN MODE $dst $modes $targetN");
}
+sub setmode_many($$$;@) {
+ my ($src, $dst, $modes, @targets) = @_;
+ my $srcN;
+ if (initial_synced()) {
+ $srcN = $src->{NICK};
+ }
+ else {
+ $srcN = $main_conf{local};
+ $srcN = $src;
+ }
+ my $parms = "";
+ foreach my $target (@targets) {
+ my $targetN = $target->{NICK};
+ $parms .= ($parms eq ""?"":" ") . $targetN;
+ print "parms" . $parms . "\n";
+ }
+ callfuncs('MODE', undef, 1, [$srcN, $dst, $modes, $parms]);
+ print "$ircline -- setmode($srcN, $dst, $modes, $parms)\n" ;
+ ircsend(":$srcN MODE $dst $modes $parms");
+}
+
+
sub flushmodes(;$) {
my $dm = (shift or \%defer_mode);
my @k = keys(%$dm); my @v = values(%$dm);
-
for(my $i; $i<@k; $i++) {
my ($src, $dst) = split(/ /, $k[$i]);
my @m = @{$v[$i]};
foreach my $m (@m) {
my ($modes, $parms) = split(/ /, $m, 2);
-
setmode_real($src, $dst, $modes, $parms);
}
}
-
%$dm = ();
}
sub setmode_real($$$;$) {
my ($src, $dst, $modes, $parms) = @_;
-
- print "$ircline -- setmode_real($src, $dst, $modes, $parms)\n" if DEBUG;
+ print "$ircline -- setmode_real($src, $dst, $modes, $parms)\n";
# for server sources, there must be a timestamp. but you can put 0 for unspecified.
$parms =~ s/\s+$//; #trim any trailing whitespace, as it might break the simple parser in the ircd.
- ircsend(":$src @{[TOK_MODE]} $dst $modes".($parms?" $parms":'').($src =~ /\./ ? ' 0' : ''));
+
+ ircsend(":$src MODE $dst $modes".($parms?" $parms":'').($src =~ /\./ ? ' 0' : ''));
}
sub settopic($$$$$) {
my ($src, $chan, $setter, $time, $topic) = @_;
- $src = main_conf_local unless initial_synced();
-
- ircsend(":$src @{[TOK_TOPIC]} $chan $setter $time :$topic");
- callfuncs('TOPIC', undef, undef, [$src, $chan, $setter, $time, $topic]);
+ my $srcN;
+ $srcN = $main_conf{local} unless initial_synced();
+ if ($srcN eq "") {
+ $srcN = $src->{NICK};
+ }
+ ircsend(":$srcN TOPIC $chan :$topic");
+ callfuncs('TOPIC', undef, undef, [$srcN, $chan, $setter, $time, $topic]);
}
sub wallops ($$) {
my ($src, $message) = @_;
- ircsend(":$src @{[TOK_WALLOPS]} :$message");
+ ircsend(":$src WALLOPS :$message");
}
sub globops ($$) {
my ($src, $message) = @_;
- ircsend(":$src @{[TOK_GLOBOPS]} :$message");
+ my $srcN = $src->{NICK};
+ ircsend(":$srcN GLOBOPS :$message");
}
sub kline ($$$$$) {
- my ($setter, $ident, $host, $expiry, $reason) = @_;
- $setter=main_conf_local unless defined($setter);
+ my ($setter, $ident, $host, $expiry, $reason) = @_;
+ $setter = "srsv.erry.omg" unless defined($setter); #FIXME
$ident = '*' unless defined($ident);
- # you need to use ADDLINE for this. GLINE is a user command
- # format is
- #>> 47 :583AAAAAA ADDLINE G test@testie inspircd.erry.omg 1308118489 0 :hi
- my $line = ":$setter ADDLINE G $ident\@$host " . $main_conf{local} . " ". time() . " " . ($expiry + time())." :$reason";
+ my $setN;
+ if (ref ($setter) eq "HASH") {
+ $setN = $setter->{NICK};
+ }
+ else { $setN = $setter; }
+ #:nascent.surrealchat.net TKL + G * *.testing.only tabris!northman@netadmin.SCnet.ops 1089168439 1089168434 :This is just a test.
+ my $line = "TKL + G $ident $host $setN ".($expiry + time()).' '.time()." :$reason";
+
ircsend($line);
- #return ($type, +1, $ident, $host, $setter, $expire, $time, $reason);
- callfuncs('TKL', undef, undef, [parse_addline($line)]);
+ callfuncs('TKL', undef, undef, [parse_tkl($line)]);
}
-
sub unkline ($$$) {
my ($setter, $ident, $host) = @_;
# TKL - G ident host setter
# TKL - G ident *.test.dom tabris!northman@netadmin.SCnet.ops
- my $line = "TKL - G $ident $host $setter";
+ my $setN;
+ if (ref ($setter) eq "HASH") {
+ $setN = $setter->{NICK};
+ }
+ else { $setN = $setter; }
+ my $line = "TKL - G $ident $host $setN";
ircsend($line);
callfuncs('TKL', undef, undef, [parse_tkl($line)]);
}
sub zline ($$$$) {
- my ($setter, $host, $expiry, $reason) = @_;
- $setter=main_conf_local unless defined($setter);
+ my ($setter, $host, $expiry, $reason) = @_;
#foreach my $ex (@except) { return 1 if $mask =~ /\Q$ex\E/i; }
# format is
# TKL +/- type ident host setter expiretime settime :reason
- my $line = "TKL + Z * $host $setter ".($expiry + time).' '.time." :$reason";
+ my $setN;
+ if (ref ($setter) eq "HASH") {
+ $setN = $setter->{NICK};
+ }
+ else { $setN = $setter; }
+ my $line = "TKL + Z * $host $setN ".($expiry + time).' '.time." :$reason";
ircsend($line);
callfuncs('TKL', undef, undef, [parse_tkl($line)]);
}
my ($setter, $host) = @_;
# TKL - G ident host setter
# TKL - G ident *.test.dom tabris!northman@netadmin.SCnet.ops
- my $line = "TKL - Z * $host $setter";
+ my $setN;
+ if (ref ($setter) eq "HASH") {
+ $setN = $setter->{NICK};
+ }
+ else { $setN = $setter; }
+ my $line = "TKL - Z * $host $setN";
ircsend($line);
callfuncs('TKL', undef, undef, [parse_tkl($line)]);
}
}
sub irckill($$$) {
- my ($src, $targetlist, $reason) = @_;
- $src = main_conf_local unless initial_synced();
-
- foreach my $target (split(',', $targetlist)) {
- next unless update_userkill($target);
-
- ircsendimm(":$src @{[TOK_KILL]} $target :$src ($reason)");
-
- callfuncs('KILL', 0, 1, [$src, $target, $src, $reason]);
- }
+ my ($src, $target, $reason) = @_;
+ $src = $main_conf{local} unless initial_synced();
+ my $srcN = $src->{NICK};
+ my $targetN = $target->{NICK};
+ return 0 unless update_userkill($targetN);
+ ircsendimm(":$srcN KILL $targetN ($reason)");
+ callfuncs('KILL', 0, 1, [$srcN, $targetN, $srcN, $reason]);
}
sub svssno($$$) {
my ($src, $target, $snomasks) = @_;
- $src=main_conf_local unless defined($src);
+ $src=$main_conf{local} unless defined($src);
# TODO:
# None, this doesn't affect us.
}
sub svsnick($$$) {
- my ($src, $oldnick, $newnick) = @_;
- $src=main_conf_local unless defined($src);
+ my ($src, $target, $newnick) = @_;
+ $src=$main_conf{local} unless defined($src);
# note: we will get a NICK cmd back after a
# successful nick change.
# warning, if misused, this can KILL the user
# with a collision
- ircsend(":$src @{[TOK_SVSNICK]} $oldnick $newnick ".time);
-# ircsend("@{[TOK_SVSNICK]} $oldnick $newnick :".time);
+ my $srcN = $src->{NICK};
+ my $targetN = $target->{NICK};
+ ircsend(":$srcN SVSNICK $targetN $newnick ".time);
}
sub svsnoop($$$) {
my ($targetserver, $bool, $src) = @_;
- $src = main_conf_local unless defined($src);
+ $src = $main_conf{local} unless defined($src);
if ($bool > 0) { $bool = '+'; } else { $bool = '-'; }
#this is SVS NO-OP not SVS SNOOP
- ircsend(":@{[main_conf_local]} @{[TOK_SVSNOOP]} $targetserver $bool");
+ ircsend(":$main_conf{local} SVSNOOP $targetserver $bool");
}
-sub svswatch ($$@) {
+#START TODO - erry
+
+sub svswatch ($$@) {
# Changes the WATCH list of a user.
# Syntax: SVSWATCH <nick> :<watch parameters>
# Example: SVSWATCH Blah :+Blih!*@* -Bluh!*@* +Bleh!*@*.com
# *** We do not track this info nor care.
my ($src, $target, @watchlist) = @_;
- my $base_str = ":$src @{[TOK_SVSWATCH]} $target :";
+ my $srcId = ($src->{NICK});
+ my $targetId = $target->{NICK};
+ my $base_str = ":$srcId SVSWATCH $targetId :";
my $send_str = $base_str;
while (@watchlist) {
my $watch = shift @watchlist;
# Example: SVSSILENCE Blah :+Blih!*@* -Bluh!*@* +Bleh!*@*.com
# *** We do not track this info nor care.
my ($src, $target, @silencelist) = @_;
- my $base_str = ":$src @{[TOK_SVSSILENCE]} $target :";
+ my $srcId = ($src->{NICK});
+ my $targetId = ($target->{NICK});
+ my $base_str = ":$srcId SVSSILENCE $targetId :";
my $send_str = $base_str;
while (@silencelist) {
my $silence = shift @silencelist;
}
$send_str = "$send_str $silence";
}
+ print "SENDING $send_str\n";
ircsend($send_str);
}
# *** We do not track this info nor care.
# *** We will see any umode changes later.
# *** this cmd does not change any umodes!
-
my ($src, $target, $oflags) = @_;
- $src = main_conf_local unless defined($src);
- ircsend(":$src @{[TOK_SVSO]} $target $oflags");
-
+ $src = $main_conf{local} unless defined($src);
+ ircsend(":$src SVSO $target $oflags");
}
sub swhois($$$) {
# *** We do not track this info nor care.
my ($src, $target, $swhois) = @_;
- $src = main_conf_local unless defined($src);
- ircsend(":$src @{[TOK_SWHOIS]} $target :$swhois");
+ $src = $main_conf{local} unless defined($src);
+ ircsend(":$src SWHOIS $target :$swhois");
}
+#END TODO - erry
sub svsjoin($$@) {
my ($src, $target, @chans) = @_;
# a note. a JOIN is returned back to us on success
# so no need to process this command.
# similar for svspart.
- ircsend(($src?":$src":'')." @{[TOK_SVSJOIN]} $target ".join(',', @chans));
+ my $srcN = $src->{NICK};
+ my $targetN = $target->{NICK};
+ ircsend(($srcN?":$srcN":'')." SVSJOIN $targetN ".join(',', @chans));
}
sub svspart($$$@) {
my ($src, $target, $reason, @chans) = @_;
- ircsend(($src ? ":$src" : '')." @{[TOK_SVSPART]} $target ".join(',', @chans).
+ my $srcN = $src->{NICK};
+ my $targetN = $target->{NICK};
+ ircsend(($srcN ? ":$srcN" : '')." SVSPART $targetN ".join(',', @chans).
($reason ? " :$reason" : ''));
}
sub sqline ($;$) {
-# we need to sqline most/all of our agents.
-# tho whether we want to put it in agent_connect
-# or leave it to the module to call it...
+ # we need to sqline most/all of our agents.
+ # tho whether we want to put it in agent_connect
+ # or leave it to the module to call it...
my ($nickmask, $reason) = @_;
- #ircsend("@{[TOK_SQLINE]} $nickmask".($reason?" :$reason":''));
+ #ircsend("$tkn{S1QLINE}[$tkn] $nickmask".($reason?" :$reason":''));
qline($nickmask, 0, $reason);
}
sub svshold($$$) {
+ # Not all IRCd will support this command, as such the calling module must check the IRCd capabilities first.
my ($nickmask, $expiry, $reason) = @_;
-# TKL version - Allows timed qlines.
-# TKL + Q * test services.SC.net 0 1092179497 :test
+ # TKL version - Allows timed qlines.
+ # TKL + Q * test services.SC.net 0 1092179497 :test
my $line = 'TKL + Q H '.$nickmask.' '.main_conf_local.' '.($expiry ? $expiry+time() : 0).' '.time().' :'.$reason;
ircsend($line);
- callfuncs('TKL', undef, undef, [parse_addline($line)]);
+ # at startup we send these too early,
+ # before the handlers are initialized
+ # so they may be lost.
+ callfuncs('TKL', undef, undef, [parse_tkl($line)]);
}
sub svsunhold($) {
my ($nickmask) = @_;
-# TKL version
-# TKL - Q * test services.SC.net
+ # TKL version
+ # TKL - Q * test services.SC.net
my $line = 'TKL - Q H '.$nickmask.' '.main_conf_local;
ircsend($line);
callfuncs('TKL', undef, undef, [parse_tkl($line)]);
# not sure if it'll accept a servername or not.
# consider defaulting to ServServ
die('svskill called w/o $src') unless $src;
- ircsend(':'.$src.' '.TOK_SVSKILL.' '.$target.' :'.$reason);
+ ircsend(':'.$src.' SVSKILL '.$target.' :'.$reason);
callfuncs('QUIT', 0, undef, [$target, $reason]);
}
sub version($) {
my ($src) = @_;
- ircsend(":@{[main_conf_local]} 351 $src $main::progname ver $main::version @{[main_conf_local]} ".
- $main::extraversion);
+ #ircsend(":$main_conf{local} 351 $src $main::progname ver $main::version $main_conf{local} ".
+ # $main::extraversion);
}
sub userhost($) {
my ($target) = @_;
- ircsend("@{[TOK_USERHOST]} $target");
+ ircsend("USERHOST $target");
}
sub userip($) {
sub chghost($$$) {
my ($src, $target, $vhost) = @_;
- ircsend(($src?":$src ":'')."@{[TOK_CHGHOST]} $target $vhost");
- callfuncs('CHGHOST', 0, 1, [$src, $target, $vhost]);
+ my $srcN = $src->{NICK};
+ my $targetN = $target->{NICK};
+ ircsend(($srcN?":$srcN ":'')." CHGHOST $targetN $vhost");
+ callfuncs('CHGHOST', 0, 1, [$srcN, $targetN, $vhost]);
}
sub chgident($$$) {
my ($src, $target, $ident) = @_;
- ircsend(($src?":$src ":'')."@{[TOK_CHGIDENT]} $target $ident");
- callfuncs('CHGIDENT', 0, 1, [$src, $target, $ident]);
+ my $srcN = $src->{NICK};
+ my $targetN = $target->{NICK};
+ ircsend(($src?":$srcN ":'')." CHGIDENT $targetN $ident");
+ callfuncs('CHGIDENT', 0, 1, [$srcN, $targetN, $ident]);
}
sub jupe_server($$) {
# :nascent.surrealchat.net SERVER wyvern.surrealchat.net 2 :SurrealChat
die "You can't jupe $server"
- if ((lc($server) eq lc($remoteserv)) or (lc($server) eq lc(main_conf_local)));
- ircsend(':'.main_conf_local.' '."@{[TOK_SQUIT]} $server :");
- ircsend(':'.main_conf_local.' '."@{[TOK_SERVER]} $server 2 :$reason");
+ if ((lc($server) eq lc($remoteserv)) or (lc($server) eq lc($main_conf{local})));
+ ircsend(':'.$main_conf{local}." SQUIT $server :");
+ ircsend(':'.$main_conf{local}." SERVER $server 2 :$reason");
set_server_juped($server);
}
sub agent_dojoin($$) {
my ($agent, $chan) = @_;
- my $uuid = getUuid($agent);
- if ($uuid) { $agent = $uuid; }
- ircsend(":" . $agent . " JOIN " . $chan);
+ my $srcN;
+ if (ref($agent) ne "HASH") {
+ $srcN = $agent;
+ }
+ else {
+ my $src = $agent;
+ $srcN = $src->{NICK};
+ }
+ ircsend(":" . $srcN . " JOIN " . $chan);
}
sub agent_dopart ($$$) {
my ($agent, $chan, $reason) = @_;
- my $uuid = getUuid($agent);
- if ($uuid) { $agent = $uuid; }
- ircsend(":$agent $tkn{PART}[$tkn] $chan :$reason");
+ my $srcN;
+ if (ref($agent) ne "HASH") {
+ $srcN = $agent;
+ }
+ else {
+ my $src = $agent;
+ $srcN = $src->{NICK};
+ }
+ ircsend(":$srcN PART $chan :$reason");
}
sub rehash_all_servers(;$) {
my ($type) = @_;
$type = undef() if(defined($type) && !($type =~ /^\-(motd|botmotd|opermotd|garbage)$/i));
foreach my $server (get_online_servers()) {
- ircsend(':'.$main::rsnick.' '.TOK_REHASH.' '.$server.(defined($type) ? ' '.$type : '') );
+ ircsend(':'.$main::rsnick.' REHASH '.$server.(defined($type) ? ' '.$type : '') );
}
}
# It is not expected to be portable to other ircds.
# Similar concepts may exist in other ircd implementations
my ($src, $cn, @nicks) = @_;
-
+ my $srcN = $src->{NICK};
my $i = 0; my @nicklist = ();
while(my $nick = shift @nicks) {
push @nicklist, $nick;
if(++$i >= 10) {
- ircsend(($src ? ":$src " : '' )."@{[TOK_SVSMODE]} $cn -".'b'x($i).' '.join(' ', @nicklist));
+ ircsend(($src ? ":$src" : '' )." SVSMODE $cn -".'b'x($i).' '.join(' ', @nicklist));
$i = 0; @nicklist = ();
}
}
-
- ircsend(($src ? ":$src " : '' )."@{[TOK_SVSMODE]} $cn -".'b'x($i).' '.join(' ', @nicklist));
+ ircsend(($srcN ? ":$srcN " : "SVSMODE $cn -".'b'x($i).' '.join(' ', @nicklist)));
# We don't loopback this, as we'll receive back the list
# of removed bans.
}
# Similar concepts may exist in other ircd implementations
my ($src, $cn) = @_;
- ircsend(($src ? ":$src " : '' )."@{[TOK_SVSMODE]} $cn -b");
+ ircsend(($src ? ":$src " : '' ). "SVSMODE $cn -b");
# We don't loopback this, as we'll receive back the list
# of removed bans.
}
sub agent_doconn ($$$$$) {
my ($nick, $ident, $host, $modes, $gecos) = @_;
- my $char = chr($count);
- my $uuid = $main_conf{numeric} . "AAAAA" . $char; #FIXME - erry
- ircsend(":" . $main_conf{numeric} . " UID" . " $uuid " . time . " $nick $host $host $ident 127.0.0.1 ". (time+5) . " $modes " . ":$gecos" );
- setUuid($nick,$uuid);
- setRevUuid($uuid, $nick);
- $count++;
+ ircsend("NICK $nick 1 " . time . " $ident $host ".
+ (SJB64 ? itob64(main_conf_numeric) : main_conf_local).
+ " 1 $modes * :$gecos");
}
sub nolag($$@) {
my ($src, $sign, @targets) = @_;
- $src = main_conf_local unless $src;
+ $src = $main_conf{local} unless $src;
foreach my $target (@targets) {
- ircsend(':'.$src .' '.TOK_SVS2NOLAG.' '.$sign.' '.$target);
+ ircsend(':'.$src .' SVSNOLAG '.$sign.' '.$target);
}
}
use SrSv::IPv6;
use SrSv::Log;
-
+use Carp;
our (
$get_user_id, $get_user_nick, $get_nickchg, $is_online,
my ($user) = @_;
my ($id, $n);
unless(ref($user) eq 'HASH') {
- die("invalid get_user_id call");
+ print "USER $user\mn";
+ Carp::confess("invalid get_user_id call");
}
my $nick = $user->{NICK};
if($nick eq '') {
- die("get_user_id called on empty string");
+ print "USER " . Dumper($user);
+ Carp::confess("get_user_id called on empty string");
}
my $properId = ircd::getUuid ($user->{NICK});
- if ($properId != "") {
+ print "PROPERID $properId\n";
+ if ($properId != undef) {
+ print "CALLING DECODE\n";
$properId = decodeUUID($properId);
return $user->{ID} = $properId;
}
};
our $rsnick = 'ServServ';
-our $rsUser = { NICK => $rsnick, ID => ircd::getUuid($rsnick) };
+our $rsUser = { NICK => $rsnick, ID => 1 };
addhandler('STATS', undef, undef, 'core::stats');
sub stats($$) {
my ($src, $token) = @_;
agent_connect($a->[0], 'services', undef, $a->[1], $a->[2]);
ircd::sqline($a->[0], $qlreason);
agent_join($a->[0], main_conf_diag);
- my $rsUser = { NICK => $main::rsnick, ID => ircd::getUuid($main::rsnick) };
- my $agent = { NICK => $a->[0], ID => ircd::getUuid ($a->[0]) };
+ my $rsUser = { NICK => $main::rsnick, ID => 1 };
+ my $agent = { NICK => $a->[0], ID => 2 };
ircd::setmode($agent, main_conf_diag, '+o', $agent);
}
no strict 'refs';
use Safe;
-
+use SrSv::IRCd::State qw($ircline synced initial_synced %IRCd_capabilities);
use SrSv::Agent;
use SrSv::Process::Worker 'ima_worker'; #FIXME
use SrSv::Insp::UUID;
use SrSv::Help qw( sendhelp );
use SrSv::ChanReg::Flags;
use SrSv::NickReg::Flags qw(NRF_NOHIGHLIGHT nr_chk_flag_user);
-
+use Data::Dumper;
use SrSv::MySQL '$dbh';
use constant {
our $bsnick = $bsnick_default;
our $botchmode;
our $bsuser = { NICK => $bsnick, ID => "123AAAAAF" };
-if(!ircd::PREFIXAQ_DISABLE()) {
+if(!ircd::PREFIXAQ_DISABLE() && $IRCd_capabilities{"FOUNDER"} ne "" && $IRCd_capabilities{"ADMIN"} ne "") {
$botchmode = '+q';
} else {
- $botchmode = '+qo';
+ $botchmode = '+o';
}
-
+print Dumper ($botchmode);
*agent = \&chanserv::agent;
our $calc_safe = new Safe;
while(my ($nick, $ident, $vhost, $gecos, $flags) = $get_all_bots->fetchrow_array) {
agent_connect($nick, $ident, $vhost, '+pqBSrz'.(($flags & F_DEAF())?'d':''), $gecos);
ircd::sqline($nick, $services::qlreason);
- my $bot = { NICK => $nick };
- get_user_id ($bot);
+ my $bot = { NICK => $nick, ID=>ircd::getUuid($nick) };
agent_join($nick, main_conf_diag);
my $rsuser = { NICK => $main::rsnick };
get_user_id ($rsuser);
- $rsuser->{ID} = encodeUUID($rsuser->{ID});
ircd::setmode($rsuser, main_conf_diag, '+h', $bot);
}
}
my $nick = $bot->{NICK};
unless(is_agent_in_chan($nick, $cn)) {
agent_join($bot, $cn);
- get_user_id ($bot);
- my $bot2 = { NICK => $nick, ID => encodeUUID($bot->{ID}) };
- print "!!!!!!!! BOT $nick " . $bot->{ID} . "\n";
- ircd::setmode($bot2, $cn, $botchmode, $bot );
+ my $bot2 = { NICK => $nick, ID => ircd::getUuid($nick), UID=>ircd::getUuid($nick) };
+ print Dumper ($botchmode);
+ print Dumper ($bot);
+ ircd::setmode($bot, $cn, $botchmode, $bot );
}
}
use SrSv::Time;
use SrSv::Text::Format qw( columnar enum );
use SrSv::Errors;
-
+use SrSv::Insp::UUID;
use SrSv::Log;
use SrSv::User qw(
next;
}
}
-
- push @modes, [($de ? '-' : '+').$l[$level], $target];
+ get_user_id ($tuser);
+ push @modes, [($de ? '-' : '+').$l[$level], $tuser->{ID}];
$count++;
}
next;
}
- ircd::invite(agent($chan), $cn, $tnick); push @invited, $tnick;
- ircd::notice(agent($chan), $tnick, "\002$src\002 has invited you to \002$cn\002.")
+ ircd::invite(agent($chan), $cn, $tuser); push @invited, $tnick;
+ ircd::notice(agent($chan), $tuser, "\002$src\002 has invited you to \002$cn\002.")
unless(lc($src) eq lc($tnick));
}
my $user = { NICK => $nick };
get_user_id ($user);
my $opmodes = get_op($user, $chan);
+ print "OPMODES $opmodes\n";
for(my $i; $i < 5; $i++) {
if($opmodes & 2**$i) {
push @modelist, ['-'.$opmodes[$i], $user];
}
my ($acc, $root) = get_best_acc($user, $chan, 2);
if(!can_do($chan, 'JOIN', $user, { ACC => $acc, NOREPLY => 1 })) {
- kickban($chan, $user, undef, 'This is a private channel.')
- unless $check_only;
+ if (!is_agent ($user->{NICK})) {
+ kickban($chan, $user, undef, 'This is a private channel.')
+ unless $check_only;
+ }
return 0;
}
for(my $i; $i < 5; $i++) {
my @l = ('v', 'h', 'o', 'a', 'q');
-
+ if ($IRCd_capabilities{"FOUNDER"} eq "") {
+ $l[4] = 'o';
+ }
+ if ($IRCd_capabilities{"ADMIN"} eq "") {
+ $l[3] = 'o';
+ }
if($masks[$sign] & 2**$i) {
$out .= $l[$i];
my $user_ = { NICK => $nick, AGENT => $csnick};
my $seq = $ircline;
my $multi_tradeoff = 2; # could use some synthetic-benchmark tuning
foreach my $user (@$users) {
+ print "USER " . Dumper($user);
$user->{__ID} = get_user_id($user);
unless (defined($user->{__ID})) {
# This does happen occasionally. it's a BUG.
my $arg = shift(@args) if($mode =~ $scm or $mode =~ $ocm);
my $auser = { ID => $arg };
- get_user_nick ($auser);
+
if($mode =~ /^[vhoaq]$/) {
next if $arg eq '';
next if is_agent($arg);
) {
push @unargs, ["-" . $mode, $auser];
} else {
- my $nid = get_user_id($auser) or next;
+ my $nid;
+ if (!$auser->{ID} && $auser->{NICK}) {
+ $nid = get_user_id($auser) or next;
+ }
+ elsif ($auser->{ID} && !$auser->{NICK}) {
+ $nid = decodeUUID($auser->{ID});
+ get_user_nick ($auser);
+ }
my ($r, $i);
do {
if($sign) {
use SrSv::NickReg::Flags qw(NRF_NOHIGHLIGHT nr_chk_flag_user);
use SrSv::NickReg::User qw(is_identified);
-
+use SrSv::IRCd::State qw($ircline synced initial_synced %IRCd_capabilities);
use SrSv::MySQL '$dbh';
use SrSv::MySQL::Glob;
require SrSv::DB::StubGen;
notice($user, "You are not identified to \002$nick\002.");
return;
}
-
+ if ($IRCd_capabilities{"CHGHOST"} eq "" || $IRCd_capabilities{"CHGIDENT"} eq "" || $IRCd_capabilities{"CLOAKHOST"} eq "" || $IRCd_capabilities{"CLOAK"} eq "") {
+ notice ($user, "The IRCd is not properly configured to support vhosts. Please contact your friendly network administrators.");
+ notice ($user, "CHGHOST, CHGIDENT, CLOAKHOST and CLOAK need to be enabled for proper vhost support.");
+ return;
+ }
my ($vident, $vhost) = get_vhost($nick);
unless ($vhost) {
notice($user, "You don't have a vHost.") unless $identify;
}
if ($vident) {
- ircd::chgident($hsuser, $src, $vident);
+ ircd::chgident($hsuser, $user, $vident);
}
- ircd::chghost($hsuser, $src, $vhost);
+ ircd::chghost($hsuser, $user, $vhost);
notice($user, "Your vHost has been changed to \002".($vident?"$vident\@":'')."$vhost\002");
}
sub hs_off($) {
my ($user) = @_;
my $src = get_user_nick($user);
-
+ if (!$IRCd_capabilities{"CHGHOST"} || !$IRCd_capabilities{"CHGIDENT"} || !$IRCd_capabilities{"CLOAKHOST"} || !$IRCd_capabilities{"CLOAK"}) {
+ notice ($user, "The IRCd is not properly configured to support vhosts. Please contact your friendly network administrators.");
+ notice ($user, "CHGHOST, CHGIDENT, CLOAKHOST and CLOAK need to be enabled for proper vhost support.");
+ return;
+ }
# This requires a hack that is only known to work in UnrealIRCd 3.2.6 and later.
- ircd::reset_cloakhost($hsuser, $src);
+ # And insp!
+ ircd::reset_cloakhost($hsuser, $user);
notice($user, "vHost reset to cloakhost.");
}
notice($user, $err_deny);
return;
}
+ if (!$IRCd_capabilities{"CHGHOST"} || !$IRCd_capabilities{"CHGIDENT"} || !$IRCd_capabilities{"CLOAKHOST"} || !$IRCd_capabilities{"CLOAK"}) {
+ notice ($user, "The IRCd is not properly configured to support vhosts. Please contact your friendly network administrators.");
+ notice ($user, "CHGHOST, CHGIDENT, CLOAKHOST and CLOAK need to be enabled for proper vhost support.");
+ return;
+ }
my $rootnick = nickserv::get_root_nick($target);
unless ($rootnick) {
$msg =~ s/^\s+//;
my @args = split(/\s+/, $msg);
my $cmd = shift @args;
+ print "NICKSERV: USER " . $user . "\n";
get_user_id ($user);
my $src = $user->{NICK};
$user->{AGENT} = $dstUser;
if ($cmd =~ /^add$/i) {
my $max_watches = $IRCd_capabilities{WATCH}; # load here for caching.
+ if ($max_watches eq "") {
+ notice ($user, "The IRCd is not configured to support WATCH. Please contact your friendly network administrators.");
+ return;
+ }
if(count_watches($root) >= $max_watches) {
notice($user, "WATCH list for $target full, there is a limit of $max_watches. Please trim your list.");
return;
}
elsif ($cmd =~ /^del(ete)?$/i) {
$check_watch->execute($root, $mask);
+ if ($IRCd_capabilities{WATCH} eq "") {
+ notice ($user, "The IRCd is not configured to support WATCH. Please contact your friendly network administrators.");
+ return;
+ }
unless ($check_watch->fetchrow_array) {
notice($user, "\002$mask\002 is not in \002$target\002's watch list.");
return;
if ($cmd =~ /^add$/i) {
my $max_silences = $IRCd_capabilities{SILENCE};
+ if ($max_silences eq "") {
+ notice ($user, "The IRCd is not configured to support SILENCE. Please contact your friendly network administrators.");
+ return;
+ }
if(count_silences($root) >= $max_silences) {
notice($user, "SILENCE list for $target full, there is a limit of $max_silences. Please trim your list.");
return;
my ($user, @nicks) = @_;
foreach my $nick (@nicks) {
- if(lc $nick eq lc $user->{AGENT}) {
+ if(lc $nick eq lc (($user->{AGENT})->{NICK})) {
notice($user, "Oh, a wise guy, eh?");
next;
}
}
sub do_svssilence($$) {
my ($user, $rootnick) = @_;
+ if ($IRCd_capabilities{SILENCE} eq "") {
+ notice ($user, "The IRCd is not configured to support SILENCE. Please contact your friendly network administrators.");
+ return;
+ }
my $target = get_user_nick($user);
$get_silences->execute($rootnick);
sub do_svswatch($$) {
my ($user, $rootnick) = @_;
+ if ($IRCd_capabilities{WATCH} eq "") {
+ notice ($user, "The IRCd is not configured to support WATCH. Please contact your friendly network administrators.");
+ return;
+ }
my $target = get_user_nick($user);
$get_watches->execute($rootnick);
$set_umodes->execute(modes::add($omodes, "o", 0), $id);
#this is _safe_. even an oper block with no privs gets +o
#it's just not passed to srsv for some reason, all we get is :UID opertype X
+ release_lock ($nick);
}
sub umode($$) {
my ($user, $modes) = @_;
my $src = $srcUser->{NICK};
print "KILL $src $dst\n";
unless (is_agent($dst)) {
- print "WhootS";
nick_delete($dstUser, "Killed ($src ($reason))");
}
}
notice($user, "You don't have the right access");
return $event::SUCCESS;
}
- ircd::svsjoin($osuser, $target, @chans);
+ my $tuser = {NICK=>$target};
+ get_user_id ($tuser);
+ ircd::svsjoin($osuser, $tuser, @chans);
}
sub os_fpart($$@) {