[libnet-dbus-perl] 116/335: If the message doesnt include a interface, then try & figure it out

Intrigeri intrigeri at moszumanska.debian.org
Sat Mar 21 01:07:35 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 f2fd2e261c3109cb27d9e55d3ab22921cf07ce80
Author: Daniel P. Berrange <dan at berrange.com>
Date:   Mon Sep 26 20:11:13 2005 +0000

    If the message doesnt include a interface, then try & figure it out
---
 lib/Net/DBus/Binding/Introspector.pm | 43 ++++++++++++++++++++++++++----------
 1 file changed, 31 insertions(+), 12 deletions(-)

diff --git a/lib/Net/DBus/Binding/Introspector.pm b/lib/Net/DBus/Binding/Introspector.pm
index b9c7e57..e178585 100644
--- a/lib/Net/DBus/Binding/Introspector.pm
+++ b/lib/Net/DBus/Binding/Introspector.pm
@@ -580,12 +580,21 @@ sub encode {
 
     my $interface = $message->get_interface;
 
-    die "no introspection data for interface '$interface' in object '" . $self->get_object_path . "'\n"
-	unless exists $self->{interfaces}->{$interface};
-
-    die "no introspection data for $type '$name' in object " . $self->get_object_path . "\n" 
-	unless exists $self->{interfaces}->{$interface}->{$type}->{$name};
-
+    if ($interface) {
+	die "no interface '$interface' in introspection data for object '" . $self->get_object_path . "' encoding $type '$name'\n"
+	    unless exists $self->{interfaces}->{$interface};
+	die "no introspection data when encoding $type '$name' in object " . $self->get_object_path . "\n" 
+	    unless exists $self->{interfaces}->{$interface}->{$type}->{$name};
+    } else {
+	foreach my $in (keys %{$self->{interfaces}}) {
+	    if (exists $self->{interfaces}->{$in}->{$type}->{$name}) {
+		$interface = $in;
+	    }
+	}
+	if (!$interface) {
+	    die "no interface in introspection data for object " . $self->get_object_path . " encoding $type '$name'\n" 
+	}
+    }
 
     my @types = $type eq "signals" ? 
 	@{$self->{interfaces}->{$interface}->{$type}->{$name}} :
@@ -647,12 +656,21 @@ sub decode {
 
     my $interface = $message->get_interface;
 
-    die "no introspection data for interface '$interface' in object '" . $self->get_object_path . "'\n"
-	unless exists $self->{interfaces}->{$interface};
-
-    die "no introspection data for $type '$name' in object " . $self->get_object_path . "\n" 
-	unless exists $self->{interfaces}->{$interface}->{$type}->{$name};
-
+    if ($interface) {
+	die "no interface '$interface' in introspection data for object '" . $self->get_object_path . "' decoding $type '$name'\n"
+	    unless exists $self->{interfaces}->{$interface};
+	die "no introspection data when encoding $type '$name' in object " . $self->get_object_path . "\n" 
+	    unless exists $self->{interfaces}->{$interface}->{$type}->{$name};
+    } else {
+	foreach my $in (keys %{$self->{interfaces}}) {
+	    if (exists $self->{interfaces}->{$in}->{$type}->{$name}) {
+		$interface = $in;
+	    }
+	}
+	if (!$interface) {
+	    die "no interface in introspection data for object " . $self->get_object_path . " decoding $type '$name'\n" 
+	}
+    }
 
     my @types = $type eq "signals" ? 
 	@{$self->{interfaces}->{$interface}->{$type}->{$name}} :
@@ -662,6 +680,7 @@ sub decode {
     
     # XXX validate received message against instrospection data!
     my @rawtypes = $self->convert(@types);
+    return () unless @rawtypes;
     my @ret;
     do {
 	my $rawtype = shift @rawtypes;

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