Bug#874260: libnet-xmpp-perl: messages don't trigger callbacks set by SetMessageCallBacks

Sébastien MARQUE pcf.12eme at gmail.com
Mon Sep 4 14:04:41 UTC 2017


Package: libnet-xmpp-perl
Version: 1.05-1
Severity: important
Tags: patch

Dear Maintainer,

For a while a script of my own didn't work anymore. I discovered the failure comes after the upgrade from 1.02 to 1.05-1 for package libnet-xmpp-perl.

I begin to check this lately and while debugging my script I've found that the callback function created using method SetMessageCallBacks wasn't triggered anymore.

With Data::Dumper I watched on the $self->{CB} structure and found that the expected data is not in the expected place, 
so the CallBack function never reaches the referred callback.

I corrected it by modifying /usr/share/perl5/Net/XMPP/Protocol.pm (the diff is taken from the backup made before the modification)
--- /usr/share/perl5/Net/XMPP/Protocol.pm       2017-09-02 22:58:53.974226800 +0200
+++ Protocol.pm.backup  2017-01-22 23:24:56.000000000 +0100
@@ -1265,10 +1265,10 @@
                     }
                 }

-                if (exists($self->{CB}->{Mess}->{$tag}))
+                if (exists($self->{CB}->{$tag}))
                 {
-                    $self->{DEBUG}->Log1("CallBack: goto user function($self->{CB}->{Mess}->{$tag})");
-                    &{$self->{CB}->{Mess}->{$tag}}($sid,$NXObject);
+                    $self->{DEBUG}->Log1("CallBack: goto user function($self->{CB}->{$tag})");
+                    &{$self->{CB}->{$tag}}($sid,$NXObject);
                 }
                 else
                 {

And modify the script to use attempted type for XMPP message from "chat" to "message"
my $bot = new Net::XMPP::Client();
$bot->SetMessageCallBacks(chat => \&messageCB);
$bot->SetMessageCallBacks(message => \&messageCB);

I haven't had a look on possible side effect or if I missed something in method usage.

Best regards,

Sebastien Marque

-- System Information:
Debian Release: 9.1
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages libnet-xmpp-perl depends on:
ii  libauthen-sasl-perl  2.1600-1
ii  libxml-stream-perl   1.24-2
ii  perl                 5.24.1-3+deb9u1

Versions of packages libnet-xmpp-perl recommends:
ii  libdigest-hmac-perl  1.03+dfsg-1
ii  libnet-dns-perl      1.07-1

libnet-xmpp-perl suggests no packages.

-- no debconf information
-------------- next part --------------
--- /usr/share/perl5/Net/XMPP/Protocol.pm	2017-09-02 22:58:53.974226800 +0200
+++ Protocol.pm.backup	2017-01-22 23:24:56.000000000 +0100
@@ -1265,10 +1265,10 @@
                     }
                 }
 
-                if (exists($self->{CB}->{Mess}->{$tag}))
+                if (exists($self->{CB}->{$tag}))
                 {
-                    $self->{DEBUG}->Log1("CallBack: goto user function($self->{CB}->{Mess}->{$tag})");
-                    &{$self->{CB}->{Mess}->{$tag}}($sid,$NXObject);
+                    $self->{DEBUG}->Log1("CallBack: goto user function($self->{CB}->{$tag})");
+                    &{$self->{CB}->{$tag}}($sid,$NXObject);
                 }
                 else
                 {


More information about the pkg-perl-maintainers mailing list