diff options
| author | xhe | 2017-01-23 21:47:58 +0800 | 
|---|---|---|
| committer | GitHub | 2017-01-23 21:47:58 +0800 | 
| commit | e786fbdfb17aac5ca19cbf1646e44b6009f02c60 (patch) | |
| tree | ff5aa17d35f10e89c2970232449acfeda20c252b | |
| parent | 6787b05165edd7a8670e110f2e07fca3e1d4fadf (diff) | |
| download | scripts.irssi.org-e786fbdfb17aac5ca19cbf1646e44b6009f02c60.tar.bz2 | |
desktop-notify.pl: process non-ascii msgs
irssi-1.0.0
bug found by jimgrape,  patched by xhebox.
https://github.com/irssi/scripts.irssi.org/issues/334
| -rw-r--r-- | scripts/desktop-notify.pl | 11 | 
1 files changed, 7 insertions, 4 deletions
| diff --git a/scripts/desktop-notify.pl b/scripts/desktop-notify.pl index da25b8c..97c3012 100644 --- a/scripts/desktop-notify.pl +++ b/scripts/desktop-notify.pl @@ -24,6 +24,7 @@ use strict;  use Irssi;  use HTML::Entities;  use Glib::Object::Introspection; # Ignore 'late INIT' warning message if autoloading +use Encode;  our $VERSION = '1.0.0';  our %IRSSI = ( @@ -38,6 +39,7 @@ our %IRSSI = (  # List of standard icons can be found here:  # http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html#names  my $notify_icon; +my $term_charset;  my $help = '  /set notify_icon <icon-name> @@ -60,6 +62,7 @@ sub UNLOAD {  sub setup_changed {  	$notify_icon = Irssi::settings_get_str('notify_icon'); +	$term_charset = Irssi::settings_get_str('term_charset');  }  sub priv_msg { @@ -71,9 +74,9 @@ sub priv_msg {  		return;  	} -	my $msg = HTML::Entities::encode_entities(Irssi::strip_codes($msg)); +	my $msg = HTML::Entities::encode_entities(Irssi::strip_codes($msg), "\<>&'");  	my $network = $server->{tag}; -	my $noti = Notify::Notification->new($nick . '@' . $network, $msg, $notify_icon); +	my $noti = Notify::Notification->new($nick . '@' . $network, decode($term_charset, $msg), $notify_icon);  	$noti->show();  } @@ -94,8 +97,8 @@ sub hilight {  	}  	my $network = $server->{tag}; -	my $msg = HTML::Entities::encode_entities($stripped); -	my $noti = Notify::Notification->new($dest->{target} . '@' . $network, $msg, $notify_icon); +	my $msg = HTML::Entities::encode_entities($stripped, "\'<>&"); +	my $noti = Notify::Notification->new($dest->{target} . '@' . $network, decode($term_charset, $msg), $notify_icon);  	$noti->show();  } | 
