… | |
… | |
1466 | DC::weaken $self; |
1466 | DC::weaken $self; |
1467 | |
1467 | |
1468 | $self->{options}->clear; |
1468 | $self->{options}->clear; |
1469 | $self->{options}->add ($self->{bye_button}); |
1469 | $self->{options}->add ($self->{bye_button}); |
1470 | |
1470 | |
1471 | for my $kw (sort keys %{ $self->[DC::Pod::N_KW] }) { |
1471 | for my $kw (sort keys %{ $self->{kw} }) { |
1472 | $self->{options}->add (new DC::UI::Button |
1472 | $self->{options}->add (new DC::UI::Button |
1473 | text => $kw, |
1473 | text => $kw, |
1474 | on_activate => sub { |
1474 | on_activate => sub { |
1475 | $self->send ($kw); |
1475 | $self->send ($kw); |
1476 | 0 |
1476 | 0 |
… | |
… | |
1485 | DC::weaken $self; |
1485 | DC::weaken $self; |
1486 | |
1486 | |
1487 | if ($type eq "update") { |
1487 | if ($type eq "update") { |
1488 | my (%info) = @arg; |
1488 | my (%info) = @arg; |
1489 | |
1489 | |
1490 | $self->[DC::Pod::N_KW]{$_} = 1 for @{$info{add_topics} || []}; |
1490 | $self->{kw}{$_} = 1 for @{$info{add_topics} || []}; |
1491 | $self->[DC::Pod::N_KW]{$_} = 0 for @{$info{del_topics} || []}; |
1491 | $self->{kw}{$_} = 0 for @{$info{del_topics} || []}; |
1492 | |
1492 | |
1493 | if (exists $info{msg}) { |
1493 | if (exists $info{msg}) { |
1494 | my $text = "\n" . DC::Protocol::sanitise_xml $info{msg}; |
1494 | my $text = "\n" . DC::Protocol::sanitise_xml $info{msg}; |
1495 | my $match = join "|", map "\\b\Q$_\E\\b", sort { (length $b) <=> (length $a) } keys %{ $self->[DC::Pod::N_KW] }; |
1495 | my $match = join "|", map "\\b\Q$_\E\\b", sort { (length $b) <=> (length $a) } keys %{ $self->{kw} }; |
1496 | my @link; |
1496 | my @link; |
1497 | $text =~ s{ |
1497 | $text =~ s{ |
1498 | ($match) |
1498 | ($match) |
1499 | }{ |
1499 | }{ |
1500 | my $kw = $1; |
1500 | my $kw = $1; |