libQuotient icon indicating copy to clipboard operation
libQuotient copied to clipboard

Connection (and cross-connection room) management

Open KitsuneRal opened this issue 7 years ago • 0 comments

Now that Quaternion gains multiple accounts support, a need arises to have a ConnectionManager singleton that would create, keep, and delete Connection objects. This same singleton would own a NetworkAccessManager instance; but more importantly, it could notify clients what happens to connections without re-connecting to a new object every time a new Connection is made.

In addition, here come a few words from Fxrh/quaternion#155:

  • There's a dubious distinction between loginError and loggedOut signals in Connection. In reality loginError is emitted in cases where something terribly bad goes on with user's access - such as AuthenticationRequired response returned from a /sync REST call. I suppose we have to merge these into one signal.
  • A logged out connection lives for a very short time and its status in general is unclear. In theory the libqmatrixclient code could support relogin in such case (and there's a reconnect() method that does exactly that) - however, Quaternion simply disposes of logged out connections as soon as it detects them. Given that logout (as well as login error, see the previous question) basically mean that the password is not (or no more) effectual, seems that this is the only reasonable way to deal with such connections. If that's the case, emitting Connection::loggedOut may be followed by deleteLater() right in the Connection code.
  • There's quite a bit of connection orchestration code that now resides in MainWindow but is very well worth putting in the library. There's a rationale for a QMatrixClient::ConnectionManager class. A similar RoomManager class would also be very nice to have and could serve as a library base for the room list model, or even the model itself.

KitsuneRal avatar May 17 '17 18:05 KitsuneRal