ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/Protocol.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/Protocol.pm (file contents):
Revision 1.171 by root, Sat Sep 1 08:08:52 2007 UTC vs.
Revision 1.181 by root, Wed Dec 26 19:11:13 2007 UTC

1package CFPlus::Protocol; 1package CFPlus::Protocol;
2 2
3use utf8; 3use utf8;
4use strict; 4use strict;
5 5
6use Crossfire::Protocol::Constants; 6use Deliantra::Protocol::Constants;
7 7
8use CFPlus; 8use CFPlus;
9use CFPlus::DB; 9use CFPlus::DB;
10use CFPlus::UI; 10use CFPlus::UI;
11use CFPlus::Pod; 11use CFPlus::Pod;
12use CFPlus::Macro; 12use CFPlus::Macro;
13use CFPlus::Item; 13use CFPlus::Item;
14 14
15use Crossfire::Protocol::Base 0.95;
16
17use base 'Crossfire::Protocol::Base'; 15use base 'Deliantra::Protocol::Base';
18 16
19sub new { 17sub new {
20 my ($class, %arg) = @_; 18 my ($class, %arg) = @_;
21 19
22 my $self = $class->SUPER::new (%arg, 20 my $self = $class->SUPER::new (%arg,
23 setup_req => { 21 setup_req => {
24 extmap => 1, 22 extmap => 1,
25 excmd => 1, 23 excmd => 1,
26 xwidget2 => 1,#d# 24 widget => 1,
27 %{$arg{setup_req} || {}}, 25 %{$arg{setup_req} || {}},
28 }, 26 },
29 ); 27 );
30 28
31 $self->{map_widget}->clr_commands; 29 $self->{map_widget}->clr_commands;
296############################################################################# 294#############################################################################
297 295
298sub logprint { 296sub logprint {
299 my ($self, @a) = @_; 297 my ($self, @a) = @_;
300 298
301 CFPlus::DB::logprint "$Crossfire::VARDIR/log.$self->{host}" => (join "", @a), sub { }; 299 CFPlus::DB::logprint "$Deliantra::VARDIR/log.$self->{host}" => (join "", @a), sub { };
302} 300}
303 301
304sub _stat_numdiff { 302sub _stat_numdiff {
305 my ($self, $name, $old, $new) = @_; 303 my ($self, $name, $old, $new) = @_;
306 304
615 } 613 }
616 } 614 }
617 615
618 if ($delay) { 616 if ($delay) {
619 # delay the map drawing a tiny bit in the hope of getting the missing fetched 617 # delay the map drawing a tiny bit in the hope of getting the missing fetched
620 Event->timer (after => 0.03, cb => sub { 618 EV::once undef, 0, 0.03, sub {
621 $_[0]->w->cancel;
622 $self->{map_widget}->update 619 $self->{map_widget}->update
623 if $self->{map_widget}; 620 if $self->{map_widget};
624 }); 621 };
625 } else { 622 } else {
626 $self->{map_widget}->update; 623 $self->{map_widget}->update;
627 } 624 }
628} 625}
629 626
969 966
970sub sanitise_xml($) { 967sub sanitise_xml($) {
971 local $_ = shift; 968 local $_ = shift;
972 969
973 # we now weed out all tags we do not support 970 # we now weed out all tags we do not support
974 s%<(?!/?i>|/?u>|/?b>|fg |/fg>)%&lt;%g; 971 s{ <(?! /?i> | /?u> | /?b> | /?big | /?small | /?s | /?tt | fg\ | /fg>)
972 }{
973 "&lt;"
974 }gex;
975
975 # now all entities 976 # now all entities
976 s/&(?!amp;|lt;|gt;|apos;|quot;|#[0-9]+;|#x[0-9a-fA-F]+;)/&amp;/g; 977 s/&(?!amp;|lt;|gt;|apos;|quot;|#[0-9]+;|#x[0-9a-fA-F]+;)/&amp;/g;
977 978
978 # handle some elements 979 # handle some elements
979 s/<fg name='([^']*)'>(.*?)<\/fg>/<span foreground='$1'>$2<\/span>/gs; 980 s/<fg name='([^']*)'>(.*?)<\/fg>/<span foreground='$1'>$2<\/span>/gs;
1038 ::message ({ 1039 ::message ({
1039 fg => $fg, 1040 fg => $fg,
1040 markup => $_, 1041 markup => $_,
1041 type => $type, 1042 type => $type,
1042 extra => [@extra], 1043 extra => [@extra],
1043 color_flags => $color, #d# ugly, kill 1044 color_flags => $color, #d# ugly, kill
1044 }); 1045 });
1045 1046
1046 $color &= ~NDI_CLEAR; # only clear once for multiline messages 1047 $color &= ~NDI_CLEAR; # only clear once for multiline messages
1047 # actually, this is an ugly design. _we_ should control the channels, 1048 # actually, this is an ugly design. _we_ should control the channels,
1048 # not some random other widget, as the channels are clearly protocol-specific. 1049 # not some random other widget, as the channels are clearly protocol-specific.
1053 $self->{statusbox}->add ($text, 1054 $self->{statusbox}->add ($text,
1054 group => $text, 1055 group => $text,
1055 fg => $fg, 1056 fg => $fg,
1056 timeout => $color >= 2 ? 180 : 10, 1057 timeout => $color >= 2 ? 180 : 10,
1057 tooltip_font => $::FONT_FIXED, 1058 tooltip_font => $::FONT_FIXED,
1058 ); 1059 ) if $type eq "info";
1059 } 1060 }
1060} 1061}
1061 1062
1062sub spell_add { 1063sub spell_add {
1063 my ($self, $spell) = @_; 1064 my ($self, $spell) = @_;
1150 } 1151 }
1151 1152
1152 $::FLOORBOX->add_at (@add); 1153 $::FLOORBOX->add_at (@add);
1153 }); 1154 });
1154 1155
1155 $::WANT_REFRESH->start; 1156 $::WANT_REFRESH = 1;
1156} 1157}
1157 1158
1158sub set_opencont { 1159sub set_opencont {
1159 my ($conn, $tag, $name) = @_; 1160 my ($conn, $tag, $name) = @_;
1160 $conn->{open_container} = $tag; 1161 $conn->{open_container} = $tag;
1301 0 1302 0
1302 }); 1303 });
1303 1304
1304 $self->update_server_info; 1305 $self->update_server_info;
1305 1306
1306 $self->send_command ("output-sync $::CFG->{output_sync}");
1307 $self->send_command ("output-count $::CFG->{output_count}");
1308 $self->send_command ("output-rate $::CFG->{output_rate}") if $::CFG->{output_rate} > 0; 1307 $self->send_command ("output-rate $::CFG->{output_rate}") if $::CFG->{output_rate} > 0;
1309 $self->send_command ("pickup $::CFG->{pickup}"); 1308 $self->send_command ("pickup $::CFG->{pickup}");
1310} 1309}
1311 1310
1312sub lookat { 1311sub lookat {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines