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.91 by root, Sat Dec 9 02:21:25 2006 UTC vs.
Revision 1.94 by root, Fri Mar 16 02:33:49 2007 UTC

628 [0.75, 0.61, 0.20], 628 [0.75, 0.61, 0.20],
629 [0.99, 0.77, 0.26], 629 [0.99, 0.77, 0.26],
630 [0.74, 0.65, 0.41], 630 [0.74, 0.65, 0.41],
631 ); 631 );
632 632
633 my $fg = $color[$color % @color];
634
633 $self->logprint ("info: ", $text); 635 $self->logprint ("info: ", $text);
634 636
635 # try to create single paragraphs of multiple lines sent by the server 637 # try to create single paragraphs of multiple lines sent by the server
636 $text =~ s/(?<=\S)\n(?=\w)/ /g; 638 $text =~ s/(?<=\S)\n(?=\w)/ /g;
637 639
638 $text = CFPlus::asxml $text; 640 $text = CFPlus::asxml $text;
639 $text =~ s/\[b\](.*?)\[\/b\]/<b>\1<\/b>/g; 641 $text =~ s/\[b\](.*?)\[\/b\]/<b>\1<\/b>/g;
640 $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/<span foreground='\1'>\2<\/span>/g; 642 $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/<span foreground='\1'>\2<\/span>/g;
641 643
642 ::message ({ fg => $color[$color], markup => $_ }) 644 ::message ({ fg => $fg, markup => $_ })
643 for split /\n/, $text; 645 for split /\n/, $text;
644 646
645 $self->{statusbox}->add ($text, 647 $self->{statusbox}->add ($text,
646 group => $text, 648 group => $text,
647 fg => $color[$color], 649 fg => $fg,
648 timeout => $color >= 2 ? 180 : 10, 650 timeout => $color >= 2 ? 180 : 10,
649 tooltip_font => $::FONT_FIXED, 651 tooltip_font => $::FONT_FIXED,
650 ); 652 );
651} 653}
652 654
926 928
927 $self->update_server_info; 929 $self->update_server_info;
928 930
929 $self->send_command ("output-sync $::CFG->{output_sync}"); 931 $self->send_command ("output-sync $::CFG->{output_sync}");
930 $self->send_command ("output-count $::CFG->{output_count}"); 932 $self->send_command ("output-count $::CFG->{output_count}");
933 $self->send_command ("output-rate $::CFG->{output_rate}") if $::CFG->{output_rate} > 0;
931 $self->send_command ("pickup $::CFG->{pickup}"); 934 $self->send_command ("pickup $::CFG->{pickup}");
932} 935}
933 936
934sub buildat { 937sub buildat {
935 my ($self, $builditem, $x, $y) = @_; 938 my ($self, $builditem, $x, $y) = @_;
987 kw => { hi => 0, yes => 0, no => 0 }, 990 kw => { hi => 0, yes => 0, no => 0 },
988 has_close_button => 1, 991 has_close_button => 1,
989 @_, 992 @_,
990 ); 993 );
991 994
992 Scalar::Util::weaken (my $this = $self); 995 CFPlus::weaken (my $this = $self);
993 996
994 $self->connect (delete => sub { $this->destroy; 1 }); 997 $self->connect (delete => sub { $this->destroy; 1 });
995 998
996 # better use a pane... 999 # better use a pane...
997 $self->add (my $hbox = new CFPlus::UI::HBox); 1000 $self->add (my $hbox = new CFPlus::UI::HBox);
1041}; 1044};
1042 1045
1043sub update_options { 1046sub update_options {
1044 my ($self) = @_; 1047 my ($self) = @_;
1045 1048
1046 Scalar::Util::weaken $self; 1049 CFPlus::weaken $self;
1047 1050
1048 $self->{options}->clear; 1051 $self->{options}->clear;
1049 $self->{options}->add ($self->{bye_button}); 1052 $self->{options}->add ($self->{bye_button});
1050 1053
1051 for my $kw (sort keys %{ $self->{kw} }) { 1054 for my $kw (sort keys %{ $self->{kw} }) {
1060} 1063}
1061 1064
1062sub feed { 1065sub feed {
1063 my ($self, $msg) = @_; 1066 my ($self, $msg) = @_;
1064 1067
1065 Scalar::Util::weaken $self; 1068 CFPlus::weaken $self;
1066 1069
1067 if ($msg->{msgtype} eq "reply") { 1070 if ($msg->{msgtype} eq "reply") {
1068 $self->{kw}{$_} = 1 for @{$msg->{add_topics} || []}; 1071 $self->{kw}{$_} = 1 for @{$msg->{add_topics} || []};
1069 $self->{kw}{$_} = 0 for @{$msg->{del_topics} || []}; 1072 $self->{kw}{$_} = 0 for @{$msg->{del_topics} || []};
1070 1073

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines