Skip to content

Commit

Permalink
move notify client & server code to plugin modules
Browse files Browse the repository at this point in the history
  • Loading branch information
grantm committed May 23, 2010
1 parent 1c9d2b5 commit 2a42d23
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions bcvi
Original file line number Diff line number Diff line change
Expand Up @@ -222,22 +222,12 @@ Uses C<scp> to copy the specified files to the calling user's F<~/Desktop>.
END_POD
);

$class->register_command(
name => 'notify',
description => <<'END_POD'
Uses the desktop notification protocol to display a message on the calling
user's desktop. Typically used with the C<--no-path-xlate> option so that any
arguments are passed as a text string rather than a list of filenames.
END_POD
);


$class->register_aliases(
'test -n "$(which bcvi)" && eval "$(bcvi --unpack-term)"',
'test -n "${BCVI_CONF}" && alias vi="bcvi"',
'test -n "${BCVI_CONF}" && alias suvi="EDITOR=\'bcvi -c viwait\' sudoedit"',
'test -n "${BCVI_CONF}" && alias bcp="bcvi -c scpd"',
'test -n "${BCVI_CONF}" && alias bnotify="bcvi -n -c notify"',
);

$class->pod_class->init();
Expand Down Expand Up @@ -1106,31 +1096,6 @@ sub execute_scpd {
}


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();
}


##############################################################################
# The BCVI::POD class implements POD extraction and formatting on platforms
# where POD::Text is available.
Expand Down

0 comments on commit 2a42d23

Please sign in to comment.