1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00
Commit Graph

12 Commits

Author SHA1 Message Date
Mick Sayson
18109b2f7f feat(history): Save/load system messages to history 2021-10-16 14:29:57 -07:00
Mick Sayson
e9131d33aa
feat(chatlog): Upgrade db schema to support system messages
* Resolves #6221
* System message schema designed to take enum of message base + args
* New table layout required many updates to the queries executed by
  history
* Bonus reduction of history signals/slots by issuing some file transfer
  insertions directly when possible
2021-05-02 03:26:04 -07:00
Mick Sayson
5f5f612841
feat(messages): History and offline message support for extended messages
* Added new negotiating friend state to allow delayed sending of offline
messages
* Added ability to flag currently outgoing message as broken in UI
* Reworked OfflineMsgEngine to support multiple receipt types
    * Moved resending logic out of the OfflineMsgEngine
    * Moved coordination of receipt and DispatchedMessageId into helper
    class usable for both ExtensionReceiptNum and ReceiptNum
    * Resending logic now has a failure case when the friend's extension
    set is lower than the required extensions needed for the message
    * When a user is known to be offline we do not allow use of any
    extensions
* Added DB support for broken message reasons
* Added DB support to tie an faux_offline_pending message to a required
extension set
2021-01-30 12:52:06 -08:00
Anthony Bilinski
062ba03fb8
refactor(db): map foreign key dependency in db schema
Reorder deletion of history to avoid violating constraint.
2020-05-03 18:06:10 -07:00
Anthony Bilinski
05064771ab
fix(test): create db tables in defined order, verify indexes
indexes need to be created after their corresponding table is created.
QMap doesn't enforce insertion order, just key order, so use a vector.
Also verify indexes from sql_master instead of only tables.
2019-11-25 16:21:17 -08:00
Anthony Bilinski
edd72906fb
perf(history): enable sql index on chat_id in history table
This makes every query with a "WHERE history.chat_id" clause quicker,
improving history load time by 50% on my profile.

Related to #5812
2019-11-25 16:21:17 -08:00
Anthony Bilinski
746314baf2
fix(history): move stuck action messages to broken_messages table
Before a bug in qTox would make it possible for a user to try to send an empty
action type message. This would fail to send at toxcore, but still be persisted
in history, causing it to fail every time FauxOfflineEngine tried to resend
it. Moving these stuck messages into the broke_messages table will stop qTox
from attempting to deliver them on each connect, and display in the GUI to
users that the messages aren't really pending anymore.
2019-10-20 02:35:20 -07:00
Anthony Bilinski
b28dc30061
fix(history): move stuck pending message into broken_messages table
Fix #5776

Due to a long standing bug, faux offline message have been able to become stuck
going back years. Because of recent fixes to history loading, faux offline
messages will correctly all be sent on connection, but this causes an issue of
long stuck messages suddenly being delivered to a friend, out of context,
creating a confusing interaction. To work around this, this upgrade moves any
faux offline messages in a chat that are older than the last successfully
delivered message, indicating they were stuck, to a new table,
`broken_messages`, preventing them from ever being sent in the future.
2019-10-20 02:34:47 -07:00
Anthony Bilinski
f72f3f714d
fix(history): handle errors during db upgrade 2019-10-20 02:34:47 -07:00
Anthony Bilinski
dacfcdadac
refactor(history): apply db schema upgrade one version at a time
This allows upgrade steps to query the db at the last version and run C++ code
on the results, then do a single transaction to make the upgrade, instead of
all actions of each upgrade step being required to be part of the overall
upgrade transaction.
2019-10-20 02:34:47 -07:00
Anthony Bilinski
996b17b1d1
refactor(test): allow generic schema creation and verification in for db schema 2019-10-20 02:34:47 -07:00
Anthony Bilinski
316893ace9
test(db): add db schema upgrade test 2019-05-15 13:26:21 -07:00