… | |
… | |
19 | } elsif (!cf::player::exists $k) { |
19 | } elsif (!cf::player::exists $k) { |
20 | $player->message ("Your ignore on $k is no longer valid (no such user).", cf::NDI_GREEN | cf::NDI_UNIQUE); |
20 | $player->message ("Your ignore on $k is no longer valid (no such user).", cf::NDI_GREEN | cf::NDI_UNIQUE); |
21 | delete $hash->{$k}; |
21 | delete $hash->{$k}; |
22 | } |
22 | } |
23 | } |
23 | } |
|
|
24 | } |
|
|
25 | } |
|
|
26 | |
|
|
27 | # send_irc ($format, @args, $msg) |
|
|
28 | # make sure the last argument is the message! |
|
|
29 | sub send_irc { |
|
|
30 | my ($format, @args) = @_; |
|
|
31 | my $msg = pop @args; |
|
|
32 | for (split /\n/, $msg) { |
|
|
33 | ext::irc::do_notice (sprintf $format, @args, $_) |
24 | } |
34 | } |
25 | } |
35 | } |
26 | |
36 | |
27 | cf::player->attach ( |
37 | cf::player->attach ( |
28 | prio => -1000, |
38 | prio => -1000, |
… | |
… | |
824 | if ($msg) { |
834 | if ($msg) { |
825 | my $name = $pl->name; |
835 | my $name = $pl->name; |
826 | my $NOW = time; |
836 | my $NOW = time; |
827 | |
837 | |
828 | cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg; |
838 | cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg; |
829 | ext::irc::do_notice (sprintf "[%s] %s", $name, $msg); |
839 | send_irc ("[%s] %s", $name, $msg); |
830 | |
840 | |
831 | $_->ob->message ("$name chats: $msg", cf::NDI_BLUE) |
841 | $_->ob->message ("$name chats: $msg", cf::NDI_BLUE) |
832 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 10 } cf::player::list; |
842 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 10 } cf::player::list; |
833 | |
843 | |
834 | } else { |
844 | } else { |
… | |
… | |
846 | if ($msg) { |
856 | if ($msg) { |
847 | my $NOW = time; |
857 | my $NOW = time; |
848 | my $name = $pl->name; |
858 | my $name = $pl->name; |
849 | |
859 | |
850 | cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; |
860 | cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; |
851 | ext::irc::do_notice (sprintf "\007\0034{%s} %s\n", $name, $msg); |
861 | send_irc ("\007\0034{%s} %s\n", $name, $msg); |
852 | |
862 | |
853 | $_->ob->message ("$name shouts: $msg", cf::NDI_RED) |
863 | $_->ob->message ("$name shouts: $msg", cf::NDI_RED) |
854 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 2 } cf::player::list; |
864 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 2 } cf::player::list; |
855 | |
865 | |
856 | } else { |
866 | } else { |
… | |
… | |
869 | my $name = $pl->name; |
879 | my $name = $pl->name; |
870 | |
880 | |
871 | if ($target =~ /irc\//) { |
881 | if ($target =~ /irc\//) { |
872 | my (undef, $nick) = split /\//, $target, 2; |
882 | my (undef, $nick) = split /\//, $target, 2; |
873 | $pl->message ("You tell $target: $args"); |
883 | $pl->message ("You tell $target: $args"); |
874 | ext::irc::do_notice (sprintf "(%s) %s: %s\n", $name, $nick, $msg); |
884 | send_irc ("(%s) %s: %s\n", $name, $nick, $msg); |
875 | } elsif (my $other = cf::player::find_active $target) { |
885 | } elsif (my $other = cf::player::find_active $target) { |
876 | |
886 | |
877 | if ($msg) { |
887 | if ($msg) { |
878 | if ($target eq $name) { |
888 | if ($target eq $name) { |
879 | $pl->message ("You are talking to yourself, you freak!", cf::NDI_UNIQUE); |
889 | $pl->message ("You are talking to yourself, you freak!", cf::NDI_UNIQUE); |
… | |
… | |
905 | return if $pl->contr->invoke (cf::EVENT_PLAYER_TELL, $pl->{ext_last_tell}, $args); |
915 | return if $pl->contr->invoke (cf::EVENT_PLAYER_TELL, $pl->{ext_last_tell}, $args); |
906 | |
916 | |
907 | if ($pl->{ext_last_tell} =~ /irc\//) { |
917 | if ($pl->{ext_last_tell} =~ /irc\//) { |
908 | my (undef, $nick) = split /\//, $pl->{ext_last_tell}, 2; |
918 | my (undef, $nick) = split /\//, $pl->{ext_last_tell}, 2; |
909 | $pl->message ("You tell " . $pl->{ext_last_tell} . ": $args"); |
919 | $pl->message ("You tell " . $pl->{ext_last_tell} . ": $args"); |
910 | ext::irc::do_notice (sprintf "(%s) %s: %s\n", $name, $nick, $args); |
920 | send_irc ("(%s) %s: %s\n", $name, $nick, $args); |
911 | } elsif (my $other = cf::player::find_active $pl->{ext_last_tell}) { |
921 | } elsif (my $other = cf::player::find_active $pl->{ext_last_tell}) { |
912 | |
922 | |
913 | if ($args) { |
923 | if ($args) { |
914 | $other->ob->{ext_ignore_tell}{$name} >= time |
924 | $other->ob->{ext_ignore_tell}{$name} >= time |
915 | or delete $other->ob->{ext_ignore_tell}{$name}; |
925 | or delete $other->ob->{ext_ignore_tell}{$name}; |