[jdev] Swiften Question about payload parsing
scooterschorschi at gmail.com
scooterschorschi at gmail.com
Thu Mar 4 10:20:25 UTC 2021
Hi
I did read that document a long time ago with a different scope in mind. I totally forget about it. This seems to be exacty what I was looking for. Thank you for the reminder.
Best regards
George
Am Donnerstag, 4. März 2021 schrieb Kevin Smith:
> 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>
>
> /
More information about the JDev
mailing list