Browse files

bring App::BCVI::NotifyDesktop into git

  • Loading branch information...
1 parent d3e4e64 commit 423acbd2c24884ffb5e991a0f8bd7956db3fe564 @grantm committed May 30, 2010
View
5 plugins/NotifyDesktop/Changes
@@ -0,0 +1,5 @@
+Revision history for App-BCVI-NotifyDesktop
+
+1.00 2010-??-??
+ First version, uploaded to CPAN
+
View
7 plugins/NotifyDesktop/MANIFEST
@@ -0,0 +1,7 @@
+Changes
+lib/App/BCVI/NotifyDesktop.pm
+Makefile.PL
+MANIFEST
+README
+t/00-load.t
+t/pod.t
View
6 plugins/NotifyDesktop/MANIFEST.SKIP
@@ -0,0 +1,6 @@
+^\.git
+\.(SKIP|bak|old|swp|gz)$
+^Makefile$
+^blib
+^pm_to_blib
+^cover_db
View
17 plugins/NotifyDesktop/Makefile.PL
@@ -0,0 +1,17 @@
+use strict;
+use warnings;
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ NAME => 'App::BCVI::NotifyDesktop',
+ AUTHOR => 'Grant McLean <grantm@cpan.org>',
+ VERSION_FROM => 'lib/App/BCVI/NotifyDesktop.pm',
+ ABSTRACT_FROM => 'lib/App/BCVI/NotifyDesktop.pm',
+ PL_FILES => {},
+ PREREQ_PM => {
+ 'Test::More' => 0,
+ 'Desktop::Notify' => 0,
+ },
+ dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+ clean => { FILES => 'App-BCVI-NotifyDesktop-*' },
+);
View
47 plugins/NotifyDesktop/README
@@ -0,0 +1,47 @@
+App-BCVI-NotifyDesktop
+
+This module is a plugin for 'bcvi' (see: http://search.cpan.org/dist/App-BCVI).
+To use it, simply copy the NotifyDesktop.pm file to your $HOME/.config/bcvi/
+folder.
+
+The role of this plugin is to use the desktop notification protocol to take
+messages sent from the 'bcvi' client and display them on the user's desktop
+using the notification protocol. This plugin implements the workstation-end
+of the protocol. You will also need to install another plugin to implement
+the client-end (e.g.: App::BCVI::NotifyClient)
+
+
+SUPPORT AND DOCUMENTATION
+
+You can find documentation for this module with the perldoc command.
+
+Before installation:
+
+ perldoc lib/App/BCVI/NotifyDesktop.pm
+
+After instalation:
+
+ perldoc $HOME/.config/bcvi/NotifyDesktop.pm
+
+You can also look for information at:
+
+ RT, CPAN's request tracker
+ http://rt.cpan.org/NoAuth/Bugs.html?Dist=App-BCVI-NotifyDesktop
+
+ AnnoCPAN, Annotated CPAN documentation
+ http://annocpan.org/dist/App-BCVI-NotifyDesktop
+
+ CPAN Ratings
+ http://cpanratings.perl.org/d/App-BCVI-NotifyDesktop
+
+ Search CPAN
+ http://search.cpan.org/dist/App-BCVI-NotifyDesktop
+
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2010 Grant McLean
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
View
102 plugins/NotifyDesktop/lib/App/BCVI/NotifyDesktop.pm
@@ -0,0 +1,102 @@
+package App::BCVI::NotifyDesktop;
+
+use warnings;
+use strict;
+
+our $VERSION = '1.00';
+
+use Encode qw(encode decode);
+
+
+sub execute_notify {
+ my($self, $sock) = @_;
+
+ my $title = "Notification from " . $self->calling_host();
+
+ my $message = decode('utf8', $self->read_request_body($sock));
+
+ eval { require Desktop::Notify; };
+ if($@) {
+ warn "Desktop::Notify is not installed.\n\n$title:\n$message\n\n";
+ return;
+ }
+
+ my $notify = Desktop::Notify->new();
+
+ my $notification = $notify->create(
+ summary => $title,
+ body => $message,
+ timeout => 10000,
+ );
+
+ $notification->show();
+}
+
+
+App::BCVI->register_command(
+ name => 'notify',
+ description => <<'END_POD'
+Send a message which will be displayed as a notification on the user's desktop
+(where the bcvi listener is running). Typically used with the
+C<--no-path-xlate> option so that any arguments are passed as text strings
+rather than as a list of filenames.
+END_POD
+);
+
+App::BCVI->hook_server_class();
+
+
+1;
+
+__END__
+
+=head1 NAME
+
+App::BCVI::NotifyDesktop - Display a notification message at the user's desktop
+
+
+=head1 DESCRIPTION
+
+This module is a plugin for C<bcvi> (see: L<App::BCVI>). It displays messages
+from the C<bcvi> client using the Desktop Notification protocol. It assumes
+the user has also installed a plugin (such as App::BCVI::NotifyClient) to send
+the messages.
+
+The module uses the L<Desktop::Notify> module to generate DBus messages for
+display by a notification applet running in the user's desktop environment.
+
+
+=head1 SUPPORT
+
+You can look for information at:
+
+=over 4
+
+=item * RT: CPAN's request tracker
+
+L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=App-BCVI-NotifyDesktop>
+
+=item * AnnoCPAN: Annotated CPAN documentation
+
+L<http://annocpan.org/dist/App-BCVI-NotifyDesktop>
+
+=item * CPAN Ratings
+
+L<http://cpanratings.perl.org/d/App-BCVI-NotifyDesktop>
+
+=item * Search CPAN
+
+L<http://search.cpan.org/dist/App-BCVI-NotifyDesktop>
+
+=back
+
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2010 Grant McLean E<lt>grantm@cpan.orgE<gt>
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+=cut
+
View
34 plugins/NotifyDesktop/t/00-load.t
@@ -0,0 +1,34 @@
+#!perl
+
+use File::Spec qw();
+use Test::More;
+
+my $bin_file = find_bcvi();
+
+if(not $bin_file) {
+ plan skip_all => 'App::BCVI does not appear to be installed';
+ exit(0);
+}
+
+eval { require $bin_file };
+if($@) {
+ plan skip_all => qq{Your bcvi installation ($bin_file) appears to be old/broken: "$@"};
+ exit(0);
+}
+
+plan tests => 1;
+
+use_ok('App::BCVI::NotifyDesktop');
+
+exit;
+
+
+
+sub find_bcvi {
+ foreach my $dir (File::Spec->path) {
+ my $path = File::Spec->catfile($dir, 'bcvi');
+ return $path if -x $path;
+ }
+ return;
+}
+
View
12 plugins/NotifyDesktop/t/pod.t
@@ -0,0 +1,12 @@
+#!perl -T
+
+use strict;
+use warnings;
+use Test::More;
+
+# Ensure a recent version of Test::Pod
+my $min_tp = 1.22;
+eval "use Test::Pod $min_tp";
+plan skip_all => "Test::Pod $min_tp required for testing POD" if $@;
+
+all_pod_files_ok();

0 comments on commit 423acbd

Please sign in to comment.