qxmpp-project / qxmpp

Cross-platform C++ XMPP client and server library
411 stars 197 forks source link

Introduce QXmppAccountMigrationManager #584

Closed pasnox closed 5 months ago

pasnox commented 11 months ago

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

PR check list:

Funded by NLnet via NGI Zero Entrust.

lnjX commented 10 months ago

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:

pasnox commented 8 months ago

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 commented 8 months ago

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:

lnjX commented 8 months ago
  • 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.