I'm currently developing a XMPP-based system that consists of an iOS app, an ejabberd server, and a standalone client that acts as a controller that can receive requests from users and take actions accordingly (I'm aware of IQ stanzas, but developing ejabberd modules in Erlang is way out of my league.)
For the iOS app I'm using XMPPFramework, and for the controller I've chosen Swiften, as it was the most recommended C++ library around here. Since this is more than a plain messaging system, I've found the need to include some custom attributes in the messages, like the following:
<message type="chat"
to="controller@example"
custom_attribute_1="Value 1"
custom_attribute_2="Value 2"
<subject>Subject</subject>
<body>Body</body>
<thread>Thread</thread>
</message>
This was very easy to do with XMPPFramework, but I've failed miserably at trying to read the custom attributes with Swiften, let alone generate a custom message.
I've tried two approaches. The first one was to get the Raw XML from the message and get the attributes using a boost XML Parser, but I haven't even been able to get the RawXMLPayload
out of the message.
The second approach, which I thought would be more straightforward in the end, was to analyze the Swift/Swiften code to find out how they manage the whole XML-to-object conversion. I know they use the AttributeMap
class, but I have no idea how those objects come to be, so no luck there either.
How can I accomplish this? Can it be done using Swiften?