[jdev] Swiften Question about payload parsing
george b
scooterschorschi at gmail.com
Wed Mar 3 20:12:29 UTC 2021
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 :-).
Best regards
George
[1] https://github.com/gkdr/lurch/
[2]
https://github.com/geobra/harbour-shmoose/blob/80da28bc87aa0fb3ed600db9ba6cb2b8e18f5500/source/xep/omemo/LurchAdapter.cpp#L448
[3] https://xmpp.org/extensions/xep-0384.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.jabber.org/jdev/attachments/20210303/99483170/attachment.html>
More information about the JDev
mailing list