… | |
… | |
35 | |
35 | |
36 | sub handle_fcmd { |
36 | sub handle_fcmd { |
37 | my ($name, $me, $msg) = @_; |
37 | my ($name, $me, $msg) = @_; |
38 | |
38 | |
39 | 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"; |
40 | do_notice $_ |
42 | # do_notice $_ |
41 | for ext::commands::who_listing (); |
43 | # for ext::commands::who_listing (0, "."); |
42 | |
44 | |
43 | } elsif ($msg =~ /^\!tell/) { |
45 | } elsif ($msg =~ /^\!tell/) { |
44 | my (undef, $target, $tmsg) = split / /, $msg, 3; |
46 | my (undef, $target, $tmsg) = split / /, $msg, 3; |
45 | |
47 | |
46 | if (my $other = cf::player::find_active $target) { |
48 | if (my $other = cf::player::find_active $target) { |
… | |
… | |
51 | } elsif ($other->ob->{ext_ignore_tell}{$me} >= time) { |
53 | } elsif ($other->ob->{ext_ignore_tell}{$me} >= time) { |
52 | $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); |
53 | } else { |
55 | } else { |
54 | 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; |
55 | |
57 | |
56 | $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); |
57 | $other->ob->{ext_last_tell} = "$name/$me"; |
|
|
58 | } |
59 | } |
59 | } else { |
60 | } else { |
60 | do_notice "$me: What do you want to tell $target?"; |
61 | do_notice "$me: What do you want to tell $target?"; |
61 | } |
62 | } |
62 | |
63 | |
… | |
… | |
86 | utf8::decode $tmsg; |
87 | utf8::decode $tmsg; |
87 | |
88 | |
88 | if ($tmsg =~ /^\!/) { |
89 | if ($tmsg =~ /^\!/) { |
89 | handle_fcmd ($name, $nick, $tmsg); |
90 | handle_fcmd ($name, $nick, $tmsg); |
90 | } elsif ($tmsg =~ m/\S/) { |
91 | } elsif ($tmsg =~ m/\S/) { |
91 | $_->ob->message ( |
92 | $_->ns->send_msg ($ext::chat::CHAT_CHANNEL, |
92 | "$name/".$nick." chats: $tmsg", cf::NDI_BLUE |
93 | "$name/".$nick." chats: $tmsg", cf::NDI_BLUE | cf::NDI_DEF |
93 | ) 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; |
|
|
95 | cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", "$name/$nick", $tmsg; |
94 | } |
96 | } |
95 | 1; |
97 | 1; |
96 | }, |
98 | }, |
97 | # registered => sub { |
99 | # registered => sub { |
98 | # 1; |
100 | # 1; |
… | |
… | |
104 | 0; |
106 | 0; |
105 | } |
107 | } |
106 | ); |
108 | ); |
107 | } |
109 | } |
108 | |
110 | |
109 | Event->timer ( |
111 | our $RECONNECT = cf::periodic 30, Coro::unblock_sub { |
110 | reentrant => 0, |
112 | check_connection; |
111 | after => 1, |
113 | }; |
112 | interval => 30, |
|
|
113 | data => cf::WF_AUTOCANCEL, |
|
|
114 | cb => Coro::unblock_sub { check_connection }, |
|
|
115 | ); |
|
|
116 | |
114 | |