qxmpp icon indicating copy to clipboard operation
qxmpp copied to clipboard

Introduce QXmppAccountMigrationManager

Open pasnox opened this issue 1 year ago • 4 comments

This manager allows to export and import account data to migrate account into another server.

PR check list:

  • [ ] Document your code
  • [ ] Add \since QXmpp 1.X, QXMPP_EXPORT
  • [ ] Fix doxygen warnings (see log when building with -DBUILD_DOCUMENTATION=ON)
  • [ ] Update doc/doap.xml
  • [x] Add unit tests
  • [x] Format the code: Run clang-format -i src/<edited-file(s)> tests/<edited-file(s)>

Funded by NLnet via NGI Zero Entrust.

pasnox avatar Nov 04 '23 22:11 pasnox

Sorry for the delay. My idea is to make it possible to add new extensions without modifying QXmpp. It's not that easy to explain how to implement that without giving examples, so I did a proof-of-concept now. See https://github.com/lnjX/qxmpp/commit/167985330a1fbf2057deaa3a16646bec29e86ddc. I didn't do many tests whether everything works though. Feel free to ask if you have any questions.

The idea is basically:

  • you can register extension types for an AccountData class by giving a parse, serialize function and the std::type_index (so AccountData can relate the functions with extensions of type std::any)
  • you can register managers with import/export functions and a data type they consume/generate

lnjX avatar Dec 05 '23 21:12 lnjX

Sorry for the delay. My idea is to make it possible to add new extensions without modifying QXmpp. It's not that easy to explain how to implement that without giving examples, so I did a proof-of-concept now. See lnjX@1679853. I didn't do many tests whether everything works though. Feel free to ask if you have any questions.

The idea is basically:

  • you can register extension types for an AccountData class by giving a parse, serialize function and the std::type_index (so AccountData can relate the functions with extensions of type std::any)
  • you can register managers with import/export functions and a data type they consume/generate

Hey, thanks for the feedback. I will read that and come back with updated MR at a later time.

pasnox avatar Jan 16 '24 19:01 pasnox

Sorry for the delay. My idea is to make it possible to add new extensions without modifying QXmpp. It's not that easy to explain how to implement that without giving examples, so I did a proof-of-concept now. See lnjX@1679853. I didn't do many tests whether everything works though. Feel free to ask if you have any questions.

The idea is basically:

  • you can register extension types for an AccountData class by giving a parse, serialize function and the std::type_index (so AccountData can relate the functions with extensions of type std::any)
  • you can register managers with import/export functions and a data type they consume/generate

I finally pushed a refactoring around your idea. I have 2 remaining issues:

  • For the unit tests, I don't know how I can use a fake client to send data (ie, when importing data, I need to sendIq)
  • In QXmppAccountData you added registration helper to serialize / unserialize QXmppAccountData documents, I'm not sure from where I should register those helpers ?

pasnox avatar Jan 21 '24 15:01 pasnox

  • In QXmppAccountData you added registration helper to serialize / unserialize QXmppAccountData documents, I'm not sure from where I should register those helpers ?

I haven't fully thought this through, but I think registering those in the ctor of the corresponding managers should work.

lnjX avatar Feb 06 '24 19:02 lnjX