… | |
… | |
39 | for ext::commands::who_listing (); |
39 | for ext::commands::who_listing (); |
40 | |
40 | |
41 | } elsif ($msg =~ /^\!tell/) { |
41 | } elsif ($msg =~ /^\!tell/) { |
42 | my (undef, $target, $tmsg) = split / /, $msg, 3; |
42 | my (undef, $target, $tmsg) = split / /, $msg, 3; |
43 | |
43 | |
44 | if (my $other = cf::player::find $target) { |
44 | if (my $other = cf::player::find_active $target) { |
45 | |
45 | |
46 | if ($tmsg) { |
46 | if ($tmsg) { |
47 | if ($me eq $target) { |
47 | if ($me eq $target) { |
48 | $CON->send_chan ($BOTCHAN, NOTICE => "$me: You are talking to yourself, you freak!", $BOTCHAN); |
48 | $CON->send_chan ($BOTCHAN, NOTICE => "$me: You are talking to yourself, you freak!", $BOTCHAN); |
49 | } elsif ($other->ob->{ext_ignore_tell}{$me} >= time) { |
49 | } elsif ($other->ob->{ext_ignore_tell}{$me} >= time) { |
50 | $CON->send_chan ($BOTCHAN, NOTICE => "$me: $target ignores what you say. Give up on it.", $BOTCHAN); |
50 | $CON->send_chan ($BOTCHAN, NOTICE => "$me: $target ignores what you say. Give up on it.", $BOTCHAN); |
51 | } else { |
51 | } else { |
52 | utf8::encode $tmsg; # ->message not yet utf8-ified |
|
|
53 | cf::LOG cf::llevDebug, sprintf "TELL [%s/%s>%s] %s\n", $name, $me, $target, $tmsg; |
52 | cf::LOG cf::llevDebug, sprintf "TELL [%s/%s>%s] %s\n", $name, $me, $target, $tmsg; |
54 | |
53 | |
55 | $other->ob->message ("$name/$me tells you: $tmsg"); |
54 | $other->ob->message ("$name/$me tells you: $tmsg"); |
56 | $other->ob->{ext_last_tell} = "$name/$me"; |
55 | $other->ob->{ext_last_tell} = "$name/$me"; |
57 | } |
56 | } |
… | |
… | |
78 | my $nick = Net::IRC3::Util::prefix_nick ($msg); |
77 | my $nick = Net::IRC3::Util::prefix_nick ($msg); |
79 | my $NOW = Time::HiRes::time; |
78 | my $NOW = Time::HiRes::time; |
80 | my $tmsg = $msg->{trailing}; |
79 | my $tmsg = $msg->{trailing}; |
81 | $tmsg =~ s/\x01[^\x01]*\x01//g; |
80 | $tmsg =~ s/\x01[^\x01]*\x01//g; |
82 | $tmsg =~ s/\015?\012/ /g; |
81 | $tmsg =~ s/\015?\012/ /g; |
|
|
82 | utf8::encode $tmsg; # ->message not yet utf8-ified |
83 | if ($tmsg =~ /^\!/) { |
83 | if ($tmsg =~ /^\!/) { |
84 | handle_fcmd ($name, $nick, $tmsg); |
84 | handle_fcmd ($name, $nick, $tmsg); |
85 | } elsif ($tmsg =~ m/\S/) { |
85 | } elsif ($tmsg =~ m/\S/) { |
86 | $_->ob->message ( |
86 | $_->ob->message ( |
87 | "$name/".$nick." chats: $tmsg", cf::NDI_BLUE |
87 | "$name/".$nick." chats: $tmsg", cf::NDI_BLUE |
… | |
… | |
91 | }, |
91 | }, |
92 | # registered => sub { |
92 | # registered => sub { |
93 | # 1; |
93 | # 1; |
94 | # }, |
94 | # }, |
95 | disconnect => sub { |
95 | disconnect => sub { |
|
|
96 | my ($con, $reason) = @_; |
|
|
97 | warn "CFBOT: disconnect: $reason\n"; |
96 | undef $CON; |
98 | undef $CON; |
97 | 0; |
99 | 0; |
98 | } |
100 | } |
99 | ); |
101 | ); |
100 | } |
102 | } |
101 | |
103 | |
102 | Event->timer (after => 1, interval => 30, data => cf::WF_AUTOCANCEL, cb => \&check_connection); |
104 | Event->timer ( |
|
|
105 | reentrant => 0, |
|
|
106 | after => 1, |
|
|
107 | interval => 30, |
|
|
108 | data => cf::WF_AUTOCANCEL, |
|
|
109 | cb => Coro::unblock_sub { check_connection }, |
|
|
110 | ); |
103 | |
111 | |