[libnet-dbus-perl] 125/335: Added emit_signal_to method to enable unicast of signals to specific clients

Intrigeri intrigeri at moszumanska.debian.org
Sat Mar 21 01:07:37 UTC 2015


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to branch experimental
in repository libnet-dbus-perl.

commit 969d6f7d8237a2dfb742e6bad9e1fd8ff8876c6d
Author: Daniel P. Berrange <dan at berrange.com>
Date:   Sat Oct 15 11:38:26 2005 +0000

    Added emit_signal_to method to enable unicast of signals to specific clients
---
 lib/Net/DBus/Object.pm | 29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/lib/Net/DBus/Object.pm b/lib/Net/DBus/Object.pm
index 4981e34..bed63f3 100644
--- a/lib/Net/DBus/Object.pm
+++ b/lib/Net/DBus/Object.pm
@@ -114,7 +114,17 @@ Retrieves the path under which this object is exported
 Emits a signal from the object, with a name of C<$name>. The
 signal and the data types of the arguments C<@args> must have 
 been registered with L<Net::DBus::Exporter> by calling the 
-C<dbus_signal> method.
+C<dbus_signal> method. The signal will be broadcast to all
+clients on the bus.
+
+=item $self->emit_signal_to($name, $client, @args);
+
+Emits a signal from the object, with a name of C<$name>. The
+signal and the data types of the arguments C<@args> must have 
+been registered with L<Net::DBus::Exporter> by calling the 
+C<dbus_signal> method. The signal will be sent only to the
+client named by the C<$client> parameter.
+
 
 =back
 
@@ -200,11 +210,15 @@ sub emit_signal_in {
     my $self = shift;
     my $name = shift;
     my $interface = shift;
+    my $destination = shift;
     my @args = @_;
 
     my $signal = Net::DBus::Binding::Message::Signal->new(object_path => $self->get_object_path,
 							  interface => $interface, 
 							  signal_name => $name);
+    if ($destination) {
+	$signal->set_destination($destination);
+    }
 
     my $ins = $self->_introspector;
     if ($ins) {
@@ -222,9 +236,10 @@ sub emit_signal_in {
     }
 }
 
-sub emit_signal {
+sub emit_signal_to {
     my $self = shift;
     my $name = shift;
+    my $destination = shift;
     my @args = @_;
 
     my $intro = $self->_introspector;
@@ -240,7 +255,15 @@ sub emit_signal {
 	die "signal '$name' is exported in more than one interface of '" .
 	    $self->get_object_path . "', use the emit_signal_in method instead.";
     }
-    $self->emit_signal_in($name, $interfaces[0], @args);
+    $self->emit_signal_in($name, $interfaces[0], $destination, @args);
+}
+
+sub emit_signal {
+    my $self = shift;
+    my $name = shift;
+    my @args = @_;
+
+    $self->emit_signal_to($name, undef, @args);
 }   
 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libnet-dbus-perl.git



More information about the Pkg-perl-cvs-commits mailing list