--- deliantra/server/ext/irc.ext 2012/02/03 03:01:44 1.20 +++ deliantra/server/ext/irc.ext 2012/11/11 02:38:10 1.22 @@ -1,6 +1,5 @@ #! perl -use Time::HiRes; use AnyEvent::IRC::Client; use AnyEvent::IRC::Util qw/filter_colors/; @@ -31,9 +30,29 @@ sub users { $CON ? grep $_ ne $CON->nick, keys %{ $CON->channel_list->{$BOTCHAN} || {} } - : () + : () } +# for nicklist monitoring, #d# should be done event-based +our %NICKLIST; +our $NICKLIST = AE::timer 20, 59.17, sub { + return unless defined &ext::nickmon::NT_OTHER; + + my %NEXTLIST; + for (users) { + &ext::nickmon::upd ("irc/$_", &ext::nickmon::NT_OTHER, "irc") + unless exists $NICKLIST{$_}; + + delete $NICKLIST{$_}; + undef $NEXTLIST{$_}; + } + + &ext::nickmon::del ("irc/$_") + for keys %NICKLIST; + + %NICKLIST = %NEXTLIST; +}; + sub handle_fcmd { my ($name, $me, $msg) = @_; @@ -85,7 +104,7 @@ my ($con, $msg) = @_; my $name = 'irc'; my $nick = AnyEvent::IRC::Util::prefix_nick ($msg); - my $NOW = Time::HiRes::time; + my $NOW = EV::time; my $tmsg = filter_colors ($msg->{params}->[-1]); $tmsg =~ s/\x01[^\x01]*\x01//g;