powered by Jive Software

Perl NET::XMPP : Can't send message to groupchat

Hello,

I have upgrade my server from openfire 3.10.3 to 4.1.5. Before upgrade no problem ton send message to groupchat but now I can’t. I can only send to user.

See below the debug :

XML::Stream: new: hostname = (mypc)

XML::Stream: SetCallBacks: tag(node) func(CODE(0x22f6738))

XMPP::Conn: xmppCallbackInit: start

XMPP::Conn: SetCallBacks: tag(message) func(CODE(0x27b4518))

XMPP::Conn: SetCallBacks: tag(presence) func(CODE(0x27b4458))

XMPP::Conn: SetCallBacks: tag(iq) func(CODE(0x27b4338))

XMPP::Conn: SetPresenceCallBacks: type(subscribe) func(CODE(0x27b4440))

XMPP::Conn: SetPresenceCallBacks: type(subscribed) func(CODE(0x27b47b8))

XMPP::Conn: SetPresenceCallBacks: type(unsubscribe) func(CODE(0x27b46f8))

XMPP::Conn: SetPresenceCallBacks: type(unsubscribed) func(CODE(0x27b4878))

XMPP::Conn: SetDirectXPathCallBacks: xpath(/[@xmlns=“urn:ietf:params:xml:ns:xmpp-tls”]) func(CODE(0x27b47a0))

XMPP::Conn: SetDirectXPathCallBacks: xpath(/[@xmlns=“urn:ietf:params:xml:ns:xmpp-sasl”]) func(CODE(0x27b4980))

XMPP::Conn: xmppCallbackInit: stop

XMPP::Conn: Connect: host(imserver:5222) namespace(jabber:client)

XMPP::Conn: Connect: timeout(10)

XML::Stream: Connect: type(tcpip)

XML::Stream: Connect: Got a connection

XML::Stream: Send: (<?xml version='1.0'?><stream:stream version=‘1.0’ xmlns:stream=‘http://etherx.jabber.org/streams’ xmlns=‘jabber:client’ to=‘imserver’ from=‘mypc’ xml:lang=‘en’ >)

XML::Stream: Read: buff(<?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream=“http://etherx.jabber.org/streams” xmlns=“jabber:client” from=“imserver” id=“75d2lhy3ar” xml:lang=“en” version=“1.0”>)

XML::Stream: Read: buff(stream:featuresPLAIN</mechanis ms>zlib</stream:features>)

XMPP::Conn: Connect: connection made

XML::Stream: SetCallBacks: tag(node) func(CODE(0x27b4dd0))

XMPP::Conn: AuthSASL: shiney new auth

XML::Stream: Send: (cGFAaW0ubnVtbG9nLnByaXYAcGEAaWVhZTY3YWU=)

XMPP::Conn: AuthSASL: haven’t authed yet… let’s wait.

XMPP::Conn: Process: timeout(1)

XML::Stream: Read: buff()

XMPP::Conn: AuthSASL: We authed!

XML::Stream: Send: (<?xml version='1.0'?><stream:stream version=‘1.0’ xmlns:stream=‘http://etherx.jabber.org/streams’ xmlns=‘jabber:client’ to=‘imserver’ from=‘mypc’ xml:lang=‘en’ >)

XML::Stream: Read: buff(<?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream=“http://etherx.jabber.org/streams” xmlns=“jabber:client” from=“imserver” id=“75d2lhy3ar” xml:lang=“en” version=“1.0”>stream:featureszlib</stream:features>)

XMPP::Conn: AuthSASL: We got a new session. sid(75d2lhy3ar)

XMPP::Conn: AuthSASL: Binding to resource

XMPP::Conn: SendAndReceiveWithID: object(Net::XMPP::IQ=HASH(0x288a468))

XMPP::Conn: SendWithID: id(netjabber-0)

XMPP::Conn: SendWithID: in()

XMPP::Conn: RegisterID: tag(iq) id(netjabber-0)

XMPP::Conn: SendWithID: out()

XMPP::Conn: SendXML: sent()

XML::Stream: Send: ()

XMPP::Conn: SendAndReceiveWithID: sent with id(netjabber-0)

XMPP::Conn: WaitForID: id(netjabber-0)

XMPP::Conn: Receivroom1D: id(netjabber-0)

XMPP::Conn: Receivroom1D: nope…

XMPP::Conn: WaitForID: haven’t gotten it yet… let’s wait for more packets

XMPP::Conn: Process: timeout(1)

XML::Stream: Read: buff(pa@imserver/75d2lhy3ar</bin d>)

XMPP::Conn: CallBack: sid(75d2lhy3ar) received(pa@imserver/75d2lhy3ar</bin d>)

XMPP::Conn: CallBack: tag(iq)

XMPP::Conn: CallBack: id(netjabber-0)

XMPP::Conn: CallBack: we either want it or were waiting for it.

XMPP::Conn: CallBack: check directxpath

XMPP::Conn: CallBack: check directxpath(/[@xmlns=“urn:ietf:params:xml:ns:xmpp-sasl”])

XMPP::Conn: CallBack: check directxpath(/[@xmlns=“urn:ietf:params:xml:ns:xmpp-tls”])

XMPP::Conn: BuildObject: tag(iq) package(Net::XMPP::IQ)

XMPP::Conn: CheckID: tag(iq) id(netjabber-0)

XMPP::Conn: CheckID: we have that here somewhere…

XMPP::Conn: CallBack: found registry entry: tag(iq) id(netjabber-0)

XMPP::Conn: DeregisterID: tag(iq) id(netjabber-0)

XMPP::Conn: CallBack: they still want it… we still got it…

XMPP::Conn: GotID: id(netjabber-0) xml(pa@imserver/75d2lhy3ar</bin d>)

XMPP::Conn: Receivroom1D: id(netjabber-0)

XMPP::Conn: Receivroom1D: id(netjabber-0)

XMPP::Conn: WaitForID: we got it!

XMPP::Conn: GetID: id(netjabber-0)

XMPP::Conn: Receivroom1D: id(netjabber-0)

XMPP::Conn: CleanID: id(netjabber-0)

XMPP::Conn: AuthSASL: Starting session

XMPP::Conn: SendAndReceiveWithID: object(Net::XMPP::IQ=HASH(0x204b340))

XMPP::Conn: SendWithID: id(netjabber-1)

XMPP::Conn: SendWithID: in()

XMPP::Conn: RegisterID: tag(iq) id(netjabber-1)

XMPP::Conn: SendWithID: out()

XMPP::Conn: SendXML: sent()

XML::Stream: Send: ()

XMPP::Conn: SendAndReceiveWithID: sent with id(netjabber-1)

XMPP::Conn: WaitForID: id(netjabber-1)

XMPP::Conn: Receivroom1D: id(netjabber-1)

XMPP::Conn: Receivroom1D: nope…

XMPP::Conn: WaitForID: haven’t gotten it yet… let’s wait for more packets

XMPP::Conn: Process: timeout(1)

XML::Stream: Read: buff()

XMPP::Conn: CallBack: sid(75d2lhy3ar) received()

XMPP::Conn: CallBack: tag(iq)

XMPP::Conn: CallBack: id(netjabber-1)

XMPP::Conn: CallBack: we either want it or were waiting for it.

XMPP::Conn: CallBack: check directxpath

XMPP::Conn: CallBack: check directxpath(/[@xmlns=“urn:ietf:params:xml:ns:xmpp-sasl”])

XMPP::Conn: CallBack: check directxpath(/[@xmlns=“urn:ietf:params:xml:ns:xmpp-tls”])

XMPP::Conn: BuildObject: tag(iq) package(Net::XMPP::IQ)

XMPP::Conn: CheckID: tag(iq) id(netjabber-1)

XMPP::Conn: CheckID: we have that here somewhere…

XMPP::Conn: CallBack: found registry entry: tag(iq) id(netjabber-1)

XMPP::Conn: DeregisterID: tag(iq) id(netjabber-1)

XMPP::Conn: CallBack: they still want it… we still got it…

XMPP::Conn: GotID: id(netjabber-1) xml()

XMPP::Conn: Receivroom1D: id(netjabber-1)

XMPP::Conn: Receivroom1D: id(netjabber-1)

XMPP::Conn: WaitForID: we got it!

XMPP::Conn: GetID: id(netjabber-1)

XMPP::Conn: Receivroom1D: id(netjabber-1)

XMPP::Conn: CleanID: id(netjabber-1)

XMPP::Conn: SendXML: sent(coucouNotification)

XML::Stream: Send: (coucouNotification)

Pearl Script :

#!/usr/bin/perl -w

use strict;

use Net::XMPP;

use Data::Dumper;

use Encode ‘decode’;

Configuration

my $username = “user”;

my $password = “mdp”;

End of configuration

my $len = scalar @ARGV;

if ($len lt 2) {

die “Usage…\n $0 [jabberid] [message] [groupchat]\n”;

}

my @field=split(/,/,$ARGV[0]);

#------------------------------------

Google Talk & Jabber parameters :

my $hostname = ‘imserver’;

my $port = 5222;

my $componentname = ‘imserver’;

my $connectiontype = ‘tcpip’;

my $tls = 0;

#------------------------------------

my $Connection = Net::XMPP::Client->new( debuglevel=>1,);

my $status = $Connection->Connect(

hostname => $hostname, port => $port,

componentname => $componentname,

connectiontype => $connectiontype, tls => $tls);

if (!(defined($status))) {

print “ERROR: XMPP connection failed.\n”;

print " ($!)\n";

exit(0);

}

Authenticate

my @result = $Connection->AuthSend(

username => $username,

password => $password);

if ($result[0] ne “ok”) {

print “ERROR: Authorization failed: $result[0] - $result[1]\n”;

exit(0);

}

if ($len lt 3 || $ARGV[2] ne “groupchat”) {

Send messages

foreach ( @field ) {

$Connection->MessageSend(

to => “$_@$componentname”,

resource => $resource,

subject => “Notification”,

type => “chat”,

body => decode(‘UTF-8’,$ARGV[1]));

}

} else {

Send messages groupchat

foreach ( @field ) {

my @result = $Connection->MessageSend(

from => “user@$componentname”,

to => “$_@conf.$componentname”,

resource => $resource,

subject => “Notification”,

type => “groupchat”,

body => decode(‘UTF-8’,$ARGV[1]));

}

}

print Dumper @result;

Can you help me ?