ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/irc.ext
(Generate patch)

Comparing deliantra/server/ext/irc.ext (file contents):
Revision 1.14 by elmex, Tue Sep 23 14:41:26 2008 UTC vs.
Revision 1.16 by elmex, Wed Mar 11 22:36:39 2009 UTC

1#! perl 1#! perl
2 2
3use Time::HiRes; 3use Time::HiRes;
4use AnyEvent::IRC::Client; 4use AnyEvent::IRC::Client;
5use AnyEvent::IRC::Util; 5use AnyEvent::IRC::Util qw/filter_colors/;
6 6
7# requires: commands.ext 7# requires: commands.ext
8 8
9return unless exists $cf::CFG{irc_server}; 9return unless exists $cf::CFG{irc_server};
10 10
81 my ($con, $msg) = @_; 81 my ($con, $msg) = @_;
82 my $name = 'irc'; 82 my $name = 'irc';
83 my $nick = AnyEvent::IRC::Util::prefix_nick ($msg); 83 my $nick = AnyEvent::IRC::Util::prefix_nick ($msg);
84 my $NOW = Time::HiRes::time; 84 my $NOW = Time::HiRes::time;
85 85
86 my $tmsg = $msg->{params}->[-1]; 86 my $tmsg = filter_colors ($msg->{params}->[-1]);
87 $tmsg =~ s/\x01[^\x01]*\x01//g; 87 $tmsg =~ s/\x01[^\x01]*\x01//g;
88 $tmsg =~ s/\015?\012/ /g; 88 $tmsg =~ s/\015?\012/ /g;
89 89
90 utf8::decode $tmsg; 90 utf8::decode $tmsg;
91 91
97 ) for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW } cf::player::list; 97 ) for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW } cf::player::list;
98 cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", "$name/$nick", $tmsg; 98 cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", "$name/$nick", $tmsg;
99 } 99 }
100 }, 100 },
101 connect => sub { 101 connect => sub {
102 my ($con, $error) = @_;
103
104 if ($error) {
105 warn "IRC: CONNECT ERROR to IRC server: $BOTSERVER:$BOTPORT: $error\n";
106 undef $CON;
107
108 } else {
102 warn "IRC: connected to IRC server: $BOTSERVER:$BOTPORT\n"; 109 warn "IRC: connected to IRC server: $BOTSERVER:$BOTPORT\n";
110 }
103 }, 111 },
104 registered => sub { 112 registered => sub {
105 warn "IRC: successfully logged into IRC server: $BOTSERVER:$BOTPORT\n"; 113 warn "IRC: successfully logged into IRC server: $BOTSERVER:$BOTPORT\n";
106 }, 114 },
107 error => sub { 115 error => sub {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines