… | |
… | |
412 | |
412 | |
413 | $text = CFClient::UI::Label::escape $text; |
413 | $text = CFClient::UI::Label::escape $text; |
414 | $text =~ s/\[b\](.*?)\[\/b\]/<b>\1<\/b>/g; |
414 | $text =~ s/\[b\](.*?)\[\/b\]/<b>\1<\/b>/g; |
415 | $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/<span foreground='\1'>\2<\/span>/g; |
415 | $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/<span foreground='\1'>\2<\/span>/g; |
416 | |
416 | |
417 | $self->{logview}->add_paragraph ($color[$color], |
417 | $self->{logview}->add_paragraph ($color[$color], $_) |
418 | join "\n", map "$time $_", split /\n/, $text); |
418 | for map "$time $_", split /\n/, $text; |
|
|
419 | $self->{logview}->scroll_to_bottom; |
419 | |
420 | |
420 | $self->{statusbox}->add ($text, |
421 | $self->{statusbox}->add ($text, |
421 | group => $text, |
422 | group => $text, |
422 | fg => $color[$color], |
423 | fg => $color[$color], |
423 | timeout => $color >= 2 ? 60 : 10, |
424 | timeout => $color >= 2 ? 60 : 10, |
… | |
… | |
817 | |
818 | |
818 | if ($type eq "msg") { |
819 | if ($type eq "msg") { |
819 | my ($msg, @kw) = split /\x00/, $msg; |
820 | my ($msg, @kw) = split /\x00/, $msg; |
820 | $self->{kw}{$_} = 1 for @kw; |
821 | $self->{kw}{$_} = 1 for @kw; |
821 | |
822 | |
822 | $msg = CFClient::UI::Label::escape $msg; |
823 | $msg = "\n" . CFClient::UI::Label::escape $msg; |
823 | my $match = join "|", map "\\b\Q$_\E\\b", sort { (length $b) <=> (length $a) } keys %{ $self->{kw} }; |
824 | my $match = join "|", map "\\b\Q$_\E\\b", sort { (length $b) <=> (length $a) } keys %{ $self->{kw} }; |
824 | $msg =~ s/($match)/<span foreground='#c0c0ff' underline='none'>$1<\/span>/gi; # underline when http-ready, huh. |
825 | my @link; |
|
|
826 | $msg =~ s{ |
|
|
827 | ($match) |
|
|
828 | }{ |
|
|
829 | push @link, new CFClient::UI::Label |
|
|
830 | markup => "<span foreground='#c0c0ff' underline='single'>$1</span>", |
|
|
831 | can_hover => 1, |
|
|
832 | can_events => 1; |
|
|
833 | |
|
|
834 | chr 0xfffc |
|
|
835 | }giex; |
825 | |
836 | |
826 | $self->{textview}->add_paragraph ([1, 1, 1, 1], "\n$msg"); |
837 | $self->{textview}->add_paragraph ([1, 1, 1, 1], [$msg, @link]); |
827 | $self->update_options; |
838 | $self->update_options; |
828 | } else { |
839 | } else { |
829 | $self->destroy; |
840 | $self->destroy; |
830 | } |
841 | } |
831 | |
842 | |