summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul W. Frields <stickster@gmail.com>2007-01-28 01:54:50 +0000
committerPaul W. Frields <stickster@gmail.com>2007-01-28 01:54:50 +0000
commit08de8ea8f9bf34bb6182b5e473ec7fd442fb3ddc (patch)
tree2b3b38693549b3461a285e34e88fe89472d3f6d8
parentefd2efb54863b16bbcd0730e86194cb1001f8562 (diff)
downloadirssi-notify-08de8ea8f9bf34bb6182b5e473ec7fd442fb3ddc.tar.gz
irssi-notify-08de8ea8f9bf34bb6182b5e473ec7fd442fb3ddc.tar.xz
irssi-notify-08de8ea8f9bf34bb6182b5e473ec7fd442fb3ddc.zip
Try a better test for DBus service existence
git-svn-id: https://irssi-libnotify.googlecode.com/svn/trunk@20 291cbfae-0d27-0410-99d7-557b17e6fe3d
-rw-r--r--notify.pl9
1 files changed, 5 insertions, 4 deletions
diff --git a/notify.pl b/notify.pl
index bd00c3d..e217f1a 100644
--- a/notify.pl
+++ b/notify.pl
@@ -16,7 +16,7 @@ $VERSION = "0.01";
authors => 'Luke Macken, Paul W. Frields',
contact => 'lewk@csh.rit.edu, stickster@gmail.com',
name => 'notify.pl',
- description => 'Use libnotify to alert user to hilighted messages',
+ description => 'Use D-Bus to alert user to hilighted messages',
license => 'GNU General Public License',
url => 'http://lewk.org/log/code/irssi-notify',
);
@@ -27,11 +27,12 @@ Irssi::settings_add_str('notify', 'notify_time', '5000');
sub notify {
my ($server, $summary, $message) = @_;
my $bus = Net::DBus->session;
- return if (!$bus);
+
+ if (!&test_dbus("org.freedesktop.Notifications")) {
+ return;
+ }
my $svc = $bus->get_service("org.freedesktop.Notifications");
- return if (!$svc);
my $obj = $svc->get_object("/org/freedesktop/Notifications");
- return if (!$obj);
# Make the message entity-safe. This is all a crappy hack and I'd
# love to know a Perl-ish way to do this properly.