1
Vote

Suggestion: XMPP Message Object

description

Hi,
 
I have to send a customized message string.
At the moment there is one method for sending chat messages:
XMPPClient.SendChatMessage(String strMessage, JID jidTo)
 
For my use case, I can use the following methods:
XMPPClient.SendObject(object objXMLSerializable)
XMPPClient.SendRawXML(String strXML)
 
So I make the suggestion to implement a MessageObject with the properties:
String strType
String strContent
String strID
JID jidTo
 
A normal chat message would for example have strType = "chat", strContent = "<body>Hello World</body>", strID = "123".
 
With this object it would be easily possible to change the properties for sending things like this: (without having a <body>-Tag, because it's not needed)
strContent = "<mygame xmlns="http://example.com/my/namespace><action>fire</action><target x="13" y="20" /></mygame>"
 
So I would be very flexible, without having to build the whole XML string manually.
 
The overloaded method could me XMPPClient.SendMessage(XMPPMessage message)
 
This suggestion has no priority for me, because the alternative send methods are good to use, but it would be a nice feature. :-)

comments