AnsweredAssumed Answered

MUC Invitation from parsing

Question asked by Brian on Jan 20, 2017
Latest reply on Jan 22, 2017 by Brian

Hi, I am using Smack (4.2.0 beta3) to develop an Android client. On some servers I can send/receive MUC invitations without issue. However on other servers, the client receiving the invitation is failing to parse the invite/from. From what I see the invite/from is a bare JID, and that is causing issues for Smack. Please let me know if I'm overlooking anything.

 

Here is a sample invite:

<message from="spark-test@conference.openfire.test.net" to="byoung1@openfire.test.net"><x xmlns="http://jabber.org/protocol/muc#user"><invite from="skinny@openfire.test.net"><reason>Please join me in a conference</reason></invite></x><x xmlns="jabber:x:conference" jid="spark-test@conference.openfire.test.net"/></message>

 

However it appears Smack is hardcoded to require a Full JID:

MUCUserProvider.parseInvite() currently around line 101

EntityFullJid from = ParserUtils.getFullJidAttribute(parser, "from");

 

XEP-0045 apparently does not require a Full JID

The <room@service> itself MUST then add a 'from' address to the <invite/> element whose value is the bare JID, full JID, or occupant JID of the inviter and send the invitation to the invitee specified in the 'to' address; the room SHOULD add the password if the room is password-protected)

http://xmpp.org/extensions/xep-0045.html

 

Here is the error I receive consistently (with a test Open Fire server)

 

org.jxmpp.stringprep.XmppStringprepException: XmppStringprepException caused by 'skinny@openfire.test.net': org.jxmpp.stringprep.XmppStringprepException: XmppStringprepException caused by 'skinny@openfire.test.net/': org.jxmpp.stringprep.XmppStringprepException: Argument can't be the empty string

  at org.jxmpp.jid.impl.JidCreate.entityFullFrom(JidCreate.java:417)

  at org.jivesoftware.smack.util.ParserUtils.getFullJidAttribute(ParserUtils.java:98 )

  at org.jivesoftware.smackx.muc.provider.MUCUserProvider.parseInvite(MUCUserProvide r.java:89)

  at org.jivesoftware.smackx.muc.provider.MUCUserProvider.parse(MUCUserProvider.java :55)

  at org.jivesoftware.smackx.muc.provider.MUCUserProvider.parse(MUCUserProvider.java :37)

  at org.jivesoftware.smack.provider.Provider.parse(Provider.java:31)

  at org.jivesoftware.smack.util.PacketParserUtils.parseExtensionElement(PacketParse rUtils.java:917)

  at org.jivesoftware.smack.util.PacketParserUtils.addExtensionElement(PacketParserU tils.java:1025)

  at org.jivesoftware.smack.util.PacketParserUtils.parseMessage(PacketParserUtils.ja va:283)

  at org.jivesoftware.smack.util.PacketParserUtils.parseStanza(PacketParserUtils.jav a:149)

  at org.jivesoftware.smack.AbstractXMPPConnection.parseAndProcessStanza(AbstractXMP PConnection.java:981)

  at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$500(XMPPTCPConnection.java: 146)

  at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPC onnection.java:1007)

  at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPCon nection.java:962)

  at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnecti on.java:977)

  at java.lang.Thread.run(Thread.java:818)

Outcomes