[jdev] Swiften Question about payload parsing
Kevin Smith
kevin.smith at isode.com
Thu Mar 4 08:54:04 UTC 2021
On 3 Mar 2021, at 20:12, george b <scooterschorschi at gmail.com> wrote:
>
> Hello everyone
>
> Today I have question, specific to Swiften. So maybe Kevin could answer this ;-)?
>
> My omemo implementation works as expected now. But from an architecture or performance point of view, it is not really smart implemented.
>
> The LurchAdapter Class (which handles all the message parsing and forwarding to lurch [1]) catches each incoming Swift::Message stanza. This stanza will be serialized to a std::string [2]. Just to be able to parse out the <items> or the <encrypted> xml part within a message [3]. This part will then be forwarded to lurch, which does the real work on it.
>
> While this works, especially on an embedded device (mobile phone) this has an huge resource impact. I tried to get into swiften in more depth and tried to implement a class, derived from Swift::Payload, which should do the parsing for the 'items' or 'encrypted' payload part. But I don't know how to integrate it in the overall parsing of incoming stanzas. My target would be to have it somehow integrated in a derived class of Swift::Message which could provide me with
> std::string Message::getItems()
> std::string Message::getEncrypted()
>
> Any hints on how to do this, or any clever alternatives are appreciated :-).
If you want a new payload type in Swiften, the quickest way is to follow the dev guide - https://swift.im/swiften/guide/#Section-Extending <https://swift.im/swiften/guide/#Section-Extending>
/K
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.jabber.org/jdev/attachments/20210304/4f325cf9/attachment.html>
More information about the JDev
mailing list