… | |
… | |
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 | |
… | |
… | |
987 | kw => { hi => 0, yes => 0, no => 0 }, |
989 | kw => { hi => 0, yes => 0, no => 0 }, |
988 | has_close_button => 1, |
990 | has_close_button => 1, |
989 | @_, |
991 | @_, |
990 | ); |
992 | ); |
991 | |
993 | |
992 | Scalar::Util::weaken (my $this = $self); |
994 | CFPlus::weaken (my $this = $self); |
993 | |
995 | |
994 | $self->connect (delete => sub { $this->destroy; 1 }); |
996 | $self->connect (delete => sub { $this->destroy; 1 }); |
995 | |
997 | |
996 | # better use a pane... |
998 | # better use a pane... |
997 | $self->add (my $hbox = new CFPlus::UI::HBox); |
999 | $self->add (my $hbox = new CFPlus::UI::HBox); |
… | |
… | |
1041 | }; |
1043 | }; |
1042 | |
1044 | |
1043 | sub update_options { |
1045 | sub update_options { |
1044 | my ($self) = @_; |
1046 | my ($self) = @_; |
1045 | |
1047 | |
1046 | Scalar::Util::weaken $self; |
1048 | CFPlus::weaken $self; |
1047 | |
1049 | |
1048 | $self->{options}->clear; |
1050 | $self->{options}->clear; |
1049 | $self->{options}->add ($self->{bye_button}); |
1051 | $self->{options}->add ($self->{bye_button}); |
1050 | |
1052 | |
1051 | for my $kw (sort keys %{ $self->{kw} }) { |
1053 | for my $kw (sort keys %{ $self->{kw} }) { |
… | |
… | |
1060 | } |
1062 | } |
1061 | |
1063 | |
1062 | sub feed { |
1064 | sub feed { |
1063 | my ($self, $msg) = @_; |
1065 | my ($self, $msg) = @_; |
1064 | |
1066 | |
1065 | Scalar::Util::weaken $self; |
1067 | CFPlus::weaken $self; |
1066 | |
1068 | |
1067 | if ($msg->{msgtype} eq "reply") { |
1069 | if ($msg->{msgtype} eq "reply") { |
1068 | $self->{kw}{$_} = 1 for @{$msg->{add_topics} || []}; |
1070 | $self->{kw}{$_} = 1 for @{$msg->{add_topics} || []}; |
1069 | $self->{kw}{$_} = 0 for @{$msg->{del_topics} || []}; |
1071 | $self->{kw}{$_} = 0 for @{$msg->{del_topics} || []}; |
1070 | |
1072 | |