--- deliantra/server/ext/chat.ext 2007/06/19 17:32:56 1.19 +++ deliantra/server/ext/chat.ext 2007/06/28 08:34:42 1.20 @@ -24,6 +24,16 @@ } } +# send_irc ($format, @args, $msg) +# make sure the last argument is the message! +sub send_irc { + my ($format, @args) = @_; + my $msg = pop @args; + for (split /\n/, $msg) { + ext::irc::do_notice (sprintf $format, @args, $_) + } +} + cf::player->attach ( prio => -1000, on_login => sub { @@ -826,7 +836,7 @@ my $NOW = time; cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg; - ext::irc::do_notice (sprintf "[%s] %s", $name, $msg); + send_irc ("[%s] %s", $name, $msg); $_->ob->message ("$name chats: $msg", cf::NDI_BLUE) for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 10 } cf::player::list; @@ -848,7 +858,7 @@ my $name = $pl->name; cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; - ext::irc::do_notice (sprintf "\007\0034{%s} %s\n", $name, $msg); + send_irc ("\007\0034{%s} %s\n", $name, $msg); $_->ob->message ("$name shouts: $msg", cf::NDI_RED) for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 2 } cf::player::list; @@ -871,7 +881,7 @@ if ($target =~ /irc\//) { my (undef, $nick) = split /\//, $target, 2; $pl->message ("You tell $target: $args"); - ext::irc::do_notice (sprintf "(%s) %s: %s\n", $name, $nick, $msg); + send_irc ("(%s) %s: %s\n", $name, $nick, $msg); } elsif (my $other = cf::player::find_active $target) { if ($msg) { @@ -907,7 +917,7 @@ if ($pl->{ext_last_tell} =~ /irc\//) { my (undef, $nick) = split /\//, $pl->{ext_last_tell}, 2; $pl->message ("You tell " . $pl->{ext_last_tell} . ": $args"); - ext::irc::do_notice (sprintf "(%s) %s: %s\n", $name, $nick, $args); + send_irc ("(%s) %s: %s\n", $name, $nick, $args); } elsif (my $other = cf::player::find_active $pl->{ext_last_tell}) { if ($args) {