I currently using Smack 4.2.0 for Android, and I’m unable to obtain a BoBExtension send by another client.
Content:
<?xml version="1.0" encoding="UTF-8"?>
<message to=“to@localhost” from=“from@localhost/test”
base
b6d49b03-db5f-443a-b910-151e876175c6
<body xmlns="http://www.w3.org/1999/xhtml">
<img src="cid:base64+YmFzZQ==@bob.xmpp.org"/>
Exception:
Exception in async packet listener
java.lang.ClassCastException: org.jivesoftware.smackx.xhtmlim.packet.XHTMLExtension cannot be cast to org.jivesoftware.smackx.bob.element.BoBExtension
at org.jivesoftware.smackx.bob.element.BoBExtension.from(BoBExtension.java:93)
at com.messenger.xmpp.XMPPSession.manageMessageReceived(XMPPSession.java:806)
at com.messenger.xmpp.XMPPSession.saveMessage(XMPPSession.java:717)
at com.messenger.xmpp.XMPPSession.access$600(XMPPSession.java:102)
at com.messenger.xmpp.XMPPSession$3.processStanza(XMPPSession.java:256)
at org.jivesoftware.smack.AbstractXMPPConnection$4.run(AbstractXMPPConnection.java :1164)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
A working example can be found in here: mangosta-android/XMPPSession.java at master · esl/mangosta-android · GitHub
But I found out that they are using a modified and precompiled version of Smack 4.2.0-beta3. mangosta-android/app/libs at master · esl/mangosta-android · GitHub