[libnet-dbus-perl] 173/335: Added binding for dbus_connection_register_fallback

Intrigeri intrigeri at moszumanska.debian.org
Sat Mar 21 01:07:48 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 d7a346223bb862e58f1368ec540c2f9323a3152c
Author: Daniel P. Berrange <dan at berrange.com>
Date:   Fri Jan 6 15:33:08 2006 +0000

    Added binding for dbus_connection_register_fallback
---
 DBus.xs                            | 14 +++++++++++++-
 lib/Net/DBus/Binding/Connection.pm | 31 ++++++++++++++++++++++++++++++-
 2 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/DBus.xs b/DBus.xs
index 753726e..c3ba8e6 100644
--- a/DBus.xs
+++ b/DBus.xs
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: DBus.xs,v 1.18 2005/12/21 12:08:24 dan Exp $
+ * $Id: DBus.xs,v 1.19 2006/01/06 15:33:08 dan Exp $
  */
 
 #include "EXTERN.h"
@@ -575,6 +575,18 @@ _unregister_object_path(con, path)
         }
 
 void
+_register_fallback(con, path, code)
+        DBusConnection *con;
+        char *path;
+        SV *code;
+    CODE:
+        SvREFCNT_inc(code);
+        if (!(dbus_connection_register_fallback(con, path, &_path_callback_vtable, code))) {
+          croak("failure when registering fallback object path");
+        }
+
+
+void
 _add_filter(con, code)
         DBusConnection *con;
         SV *code;
diff --git a/lib/Net/DBus/Binding/Connection.pm b/lib/Net/DBus/Binding/Connection.pm
index 95ec3b1..0e81c57 100644
--- a/lib/Net/DBus/Binding/Connection.pm
+++ b/lib/Net/DBus/Binding/Connection.pm
@@ -16,7 +16,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #
-# $Id: Connection.pm,v 1.5 2005/11/21 10:55:44 dan Exp $
+# $Id: Connection.pm,v 1.6 2006/01/06 15:33:08 dan Exp $
 
 =pod
 
@@ -402,6 +402,35 @@ sub register_object_path {
 
 =pod
 
+=item $con->register_fallback($path, \&handler)
+
+Registers a handler for messages whose path starts with 
+the prefix specified in the C<$path> parameter. The supplied
+code reference will be invoked with two parameters, the
+connection object on which the message was received,
+and the message to be processed (an instance of the
+C<Net::DBus::Binding::Message> class).
+
+=cut
+
+sub register_fallback {
+    my $self = shift;
+    my $path = shift;
+    my $code = shift;
+
+    my $callback = sub {
+	my $con = shift;
+	my $msg = shift;
+
+	&$code($con, Net::DBus::Binding::Message->new(message => $msg));
+    };
+
+    $self->{connection}->_register_fallback($path, $callback);
+}
+
+
+=pod
+
 =item $con->set_max_message_size($bytes)
 
 Sets the maximum allowable size of a single incoming

-- 
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