ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/lib/cf.pm
(Generate patch)

Comparing deliantra/server/lib/cf.pm (file contents):
Revision 1.349 by root, Fri Aug 31 04:10:43 2007 UTC vs.
Revision 1.352 by root, Sun Sep 2 04:57:14 2007 UTC

1463sub expand_cfpod { 1463sub expand_cfpod {
1464 ((my $self), (local $_)) = @_; 1464 ((my $self), (local $_)) = @_;
1465 1465
1466 # escape & and < 1466 # escape & and <
1467 s/&/&amp;/g; 1467 s/&/&amp;/g;
1468 s/(?<![BIUGH])</&lt;/g; 1468 s/(?<![BIUGHT])</&lt;/g;
1469 1469
1470 # this is buggy, it needs to properly take care of nested <'s 1470 # this is buggy, it needs to properly take care of nested <'s
1471 1471
1472 1 while 1472 1 while
1473 # replace B<>, I<>, U<> etc. 1473 # replace B<>, I<>, U<> etc.
1474 s/B<([^\>]*)>/<b>$1<\/b>/ 1474 s/B<([^\>]*)>/<b>$1<\/b>/
1475 || s/I<([^\>]*)>/<i>$1<\/i>/ 1475 || s/I<([^\>]*)>/<i>$1<\/i>/
1476 || s/U<([^\>]*)>/<u>$1<\/u>/ 1476 || s/U<([^\>]*)>/<u>$1<\/u>/
1477 || s/T<([^\>]*)>/<big><b>$1<\/b><\/big>/
1477 # replace G<male|female> tags 1478 # replace G<male|female> tags
1478 || s{G<([^>|]*)\|([^>]*)>}{ 1479 || s{G<([^>|]*)\|([^>]*)>}{
1479 $self->gender ? $2 : $1 1480 $self->gender ? $2 : $1
1480 }ge 1481 }ge
1481 # replace H<hint text> 1482 # replace H<hint text>
2091 { 2092 {
2092 my $lock = cf::lock_acquire "map_data:$self->{path}"; 2093 my $lock = cf::lock_acquire "map_data:$self->{path}";
2093 2094
2094 delete $cf::MAP{$self->path}; 2095 delete $cf::MAP{$self->path};
2095 2096
2097 $self->unlink_save;
2098
2096 bless $self, "cf::map"; 2099 bless $self, "cf::map";
2097 delete $self->{deny_reset}; 2100 delete $self->{deny_reset};
2098 $self->{deny_save} = 1; 2101 $self->{deny_save} = 1;
2099 $self->reset_timeout (1); 2102 $self->reset_timeout (1);
2100 $self->path ($self->{path} = "{nuke}/" . ($nuke_counter++)); 2103 $self->path ($self->{path} = "{nuke}/" . ($nuke_counter++));
2101
2102 $self->unlink_save;
2103 2104
2104 $cf::MAP{$self->path} = $self; 2105 $cf::MAP{$self->path} = $self;
2105 } 2106 }
2106 2107
2107 $self->reset; # polite request, might not happen 2108 $self->reset; # polite request, might not happen
2504the message, with C<log> being the default. If C<$color> is negative, suppress 2505the message, with C<log> being the default. If C<$color> is negative, suppress
2505the message unless the client supports the msg packet. 2506the message unless the client supports the msg packet.
2506 2507
2507=cut 2508=cut
2508 2509
2510our %CHANNEL = (
2511 "c/identify" => {
2512 id => "identify",
2513 title => "Identify",
2514 reply => undef,
2515 tooltip => "Items recently identified",
2516 },
2517 "c/examine" => {
2518 id => "examine",
2519 title => "Examine",
2520 reply => undef,
2521 tooltip => "Signs and other items you examined",
2522 },
2523);
2524
2509sub cf::client::send_msg { 2525sub cf::client::send_msg {
2510 my ($self, $channel, $msg, $color, @extra) = @_; 2526 my ($self, $channel, $msg, $color, @extra) = @_;
2511 2527
2512 $msg = $self->pl->expand_cfpod ($msg); 2528 $msg = $self->pl->expand_cfpod ($msg);
2513 2529
2514 $color &= cf::NDI_CLIENT_MASK; # just in case... 2530 $color &= cf::NDI_CLIENT_MASK; # just in case...
2531
2532 # check predefined channels, for the benefit of C
2533 $channel = $CHANNEL{$channel} if $CHANNEL{$channel};
2515 2534
2516 if (ref $channel) { 2535 if (ref $channel) {
2517 # send meta info to client, if not yet sent 2536 # send meta info to client, if not yet sent
2518 unless (exists $self->{channel}{$channel->{id}}) { 2537 unless (exists $self->{channel}{$channel->{id}}) {
2519 $self->{channel}{$channel->{id}} = $channel; 2538 $self->{channel}{$channel->{id}} = $channel;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines