… | |
… | |
34 | } |
34 | } |
35 | |
35 | |
36 | sub handle_fcmd { |
36 | sub handle_fcmd { |
37 | my ($name, $me, $msg) = @_; |
37 | my ($name, $me, $msg) = @_; |
38 | |
38 | |
39 | utf8::decode $msg; |
|
|
40 | |
|
|
41 | if ($msg eq "!who") { |
39 | if ($msg eq "!who") { |
|
|
40 | # clobbers irc, http is available |
|
|
41 | do_notice "see http://www.deliantra.net/userlist.crossfire.schmorp.de.html"; |
42 | do_notice $_ |
42 | # do_notice $_ |
43 | for ext::commands::who_listing (); |
43 | # for ext::commands::who_listing (0, "."); |
44 | |
44 | |
45 | } elsif ($msg =~ /^\!tell/) { |
45 | } elsif ($msg =~ /^\!tell/) { |
46 | my (undef, $target, $tmsg) = split / /, $msg, 3; |
46 | my (undef, $target, $tmsg) = split / /, $msg, 3; |
47 | |
47 | |
48 | if (my $other = cf::player::find_active $target) { |
48 | if (my $other = cf::player::find_active $target) { |
… | |
… | |
53 | } elsif ($other->ob->{ext_ignore_tell}{$me} >= time) { |
53 | } elsif ($other->ob->{ext_ignore_tell}{$me} >= time) { |
54 | $CON->send_chan ($BOTCHAN, NOTICE => "$me: $target ignores what you say. Give up on it.", $BOTCHAN); |
54 | $CON->send_chan ($BOTCHAN, NOTICE => "$me: $target ignores what you say. Give up on it.", $BOTCHAN); |
55 | } else { |
55 | } else { |
56 | cf::LOG cf::llevDebug, sprintf "TELL [%s/%s>%s] %s\n", $name, $me, $target, $tmsg; |
56 | cf::LOG cf::llevDebug, sprintf "TELL [%s/%s>%s] %s\n", $name, $me, $target, $tmsg; |
57 | |
57 | |
58 | $other->ob->message ("$name/$me tells you: $tmsg"); |
58 | $other->ns->send_msg (ext::chat::tell_channel ("$name/$me"), "$name/$me tells you: $tmsg", cf::NDI_DK_ORANGE | cf::NDI_DEF); |
59 | $other->ob->{ext_last_tell} = "$name/$me"; |
|
|
60 | } |
59 | } |
61 | } else { |
60 | } else { |
62 | do_notice "$me: What do you want to tell $target?"; |
61 | do_notice "$me: What do you want to tell $target?"; |
63 | } |
62 | } |
64 | |
63 | |
… | |
… | |
78 | irc_privmsg => sub { |
77 | irc_privmsg => sub { |
79 | my ($con, $msg) = @_; |
78 | my ($con, $msg) = @_; |
80 | my $name = 'irc'; |
79 | my $name = 'irc'; |
81 | my $nick = Net::IRC3::Util::prefix_nick ($msg); |
80 | my $nick = Net::IRC3::Util::prefix_nick ($msg); |
82 | my $NOW = Time::HiRes::time; |
81 | my $NOW = Time::HiRes::time; |
|
|
82 | |
83 | my $tmsg = $msg->{trailing}; |
83 | my $tmsg = $msg->{trailing}; |
84 | $tmsg =~ s/\x01[^\x01]*\x01//g; |
84 | $tmsg =~ s/\x01[^\x01]*\x01//g; |
85 | $tmsg =~ s/\015?\012/ /g; |
85 | $tmsg =~ s/\015?\012/ /g; |
86 | utf8::encode $tmsg; # ->message not yet utf8-ified |
86 | |
|
|
87 | utf8::decode $tmsg; |
|
|
88 | |
87 | if ($tmsg =~ /^\!/) { |
89 | if ($tmsg =~ /^\!/) { |
88 | handle_fcmd ($name, $nick, $tmsg); |
90 | handle_fcmd ($name, $nick, $tmsg); |
89 | } elsif ($tmsg =~ m/\S/) { |
91 | } elsif ($tmsg =~ m/\S/) { |
90 | $_->ob->message ( |
92 | $_->ns->send_msg ($ext::chat::CHAT_CHANNEL, |
91 | "$name/".$nick." chats: $tmsg", cf::NDI_BLUE |
93 | "$name/".$nick." chats: $tmsg", cf::NDI_BLUE | cf::NDI_DEF |
92 | ) for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 10 } cf::player::list; |
94 | ) for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 10 } cf::player::list; |
93 | } |
95 | } |
94 | 1; |
96 | 1; |
95 | }, |
97 | }, |
96 | # registered => sub { |
98 | # registered => sub { |