--- deliantra/Deliantra-Client/DC/Protocol.pm 2007/09/01 08:01:08 1.170 +++ deliantra/Deliantra-Client/DC/Protocol.pm 2007/12/26 19:11:13 1.181 @@ -3,7 +3,7 @@ use utf8; use strict; -use Crossfire::Protocol::Constants; +use Deliantra::Protocol::Constants; use CFPlus; use CFPlus::DB; @@ -12,9 +12,7 @@ use CFPlus::Macro; use CFPlus::Item; -use Crossfire::Protocol::Base 0.95; - -use base 'Crossfire::Protocol::Base'; +use base 'Deliantra::Protocol::Base'; sub new { my ($class, %arg) = @_; @@ -23,7 +21,7 @@ setup_req => { extmap => 1, excmd => 1, - xwidget2 => 1,#d# + widget => 1, %{$arg{setup_req} || {}}, }, ); @@ -298,7 +296,7 @@ sub logprint { my ($self, @a) = @_; - CFPlus::DB::logprint "$Crossfire::VARDIR/log.$self->{host}" => (join "", @a), sub { }; + CFPlus::DB::logprint "$Deliantra::VARDIR/log.$self->{host}" => (join "", @a), sub { }; } sub _stat_numdiff { @@ -617,11 +615,10 @@ if ($delay) { # delay the map drawing a tiny bit in the hope of getting the missing fetched - Event->timer (after => 0.03, cb => sub { - $_[0]->w->cancel; + EV::once undef, 0, 0.03, sub { $self->{map_widget}->update if $self->{map_widget}; - }); + }; } else { $self->{map_widget}->update; } @@ -971,7 +968,11 @@ local $_ = shift; # we now weed out all tags we do not support - s%<(?!/?i>|/?u>|/?b>|fg |/fg>)%<%g; + s{ <(?! /?i> | /?u> | /?b> | /?big | /?small | /?s | /?tt | fg\ | /fg>) + }{ + "<" + }gex; + # now all entities s/&(?!amp;|lt;|gt;|apos;|quot;|#[0-9]+;|#x[0-9a-fA-F]+;)/&/g; @@ -1036,14 +1037,18 @@ for (split /\n/, $text) { ::message ({ - fg => $fg, - markup => $_, - type => $type, - extra => [@extra], - color_flags => $color + fg => $fg, + markup => $_, + type => $type, + extra => [@extra], + color_flags => $color, #d# ugly, kill }); $color &= ~NDI_CLEAR; # only clear once for multiline messages + # actually, this is an ugly design. _we_ should control the channels, + # not some random other widget, as the channels are clearly protocol-specific. + # then we could also react to flags such as CLEAR without resorting to + # hacks such as color_flags, above. } $self->{statusbox}->add ($text, @@ -1051,7 +1056,7 @@ fg => $fg, timeout => $color >= 2 ? 180 : 10, tooltip_font => $::FONT_FIXED, - ); + ) if $type eq "info"; } } @@ -1148,7 +1153,7 @@ $::FLOORBOX->add_at (@add); }); - $::WANT_REFRESH->start; + $::WANT_REFRESH = 1; } sub set_opencont { @@ -1299,8 +1304,6 @@ $self->update_server_info; - $self->send_command ("output-sync $::CFG->{output_sync}"); - $self->send_command ("output-count $::CFG->{output_count}"); $self->send_command ("output-rate $::CFG->{output_rate}") if $::CFG->{output_rate} > 0; $self->send_command ("pickup $::CFG->{pickup}"); }