Implement a new custom Message.Type


I was wondering if it’s possible to implement a new Message.Type to be used with Smack/Openfire. I’ve searched for some examples but didn’t find any.

I’m using Smack libs in an Android project, I was thinking of the following steps for doing that:

  1. Modify the Message [1] class from smack-core lib and add the custom Message.Type;
  2. Compile the whole new Smack API and include it in the Android project;
  3. Modify the Openfire and add the new Message.Type there too;
  4. Compile a new version of Openfire.

I’m having problems with step 3, how exactly to include the modifications into Openfire?


[1] /jivesoftware/smack/packet/

Do not invent a custom message type. Never use unspecified values to specified stanza attributes. Use instead an extension element of you want that you message carries a special semantic.

See also

How to read custom attributes of xmpp message tag in android? - Stack Overflow

java - Adding Custom Attributes in Message tag in XMPP packet using asmack for android? - Stack Overflow

ejabberd - How to set custom Message.Type string in Smack 4.1? - Stack Overflow

So absolutely no tampering with the protocol.

I was asking because I wanted to do some extra verfications on the server-side regarding user registration and message sending.

I’m having a hard time understanding how can I protect the Open server against a user who decompiled/deobfuscated the client application or just sniffed the network, got the server hostname/port and just spam messages or users…

Don’t put credentials in your app’s binary.

And how exactly am I suppose to connect to Openfire server from a device if I ain’t got the hostname/port? )

Credentials are not the hostname and port but the username and password (for password authentication).