1

The XMPP message being sent has some custom attribtes added in message tag like :

<message to = " asdf" from = "asdf" type = "chat" id="adsf" direction = "asdf" speed = "asdf">
<body>Speed</body>
</message>

Message that is being sent is all fine. But on receiving end , I dnt know how to read these extra attributes i.e. direction and speed added in message tag. I tried to make custom PacketListener but for that i need to change the whole smack library bcz every class is connected to other class.

Flow
  • 23,572
  • 15
  • 99
  • 156
Aleena
  • 273
  • 4
  • 12

1 Answers1

0

You can't.

Never add custom values to specified stream element attributes (e.g. a new value for the type attribute of messages), and never add new attributes to top level elements (like you did with msgType, msgTimeStamp and so on).

This has the potential to break things! Don't do it. See also "XEP-0134: XMPP Design Guidelines § 2.1 XMPP is Sacred". That's why it's not possible in Smack. Instead, use a custom extension element, like xnyhps showed in his example (the data element). See also "RFC 6120 § 8.4 Extended Content" Those are called PacketExtension's in Smack.

See also this answer and question.

Community
  • 1
  • 1
Flow
  • 23,572
  • 15
  • 99
  • 156