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

62 Commits

Author SHA1 Message Date
Anthony Bilinski
5d56a3c039
refactor(paths): move Settings path functions into Paths 2020-05-10 18:03:47 -07: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
f37f9a9492
refactor(history): enforce using PK instead of ToxId in history
We need to be lenient when reading from db because of ToxIds being saved in the
db from a bug introduced in e07d8d358f, which
used self ID rather than self Pk. Was subsequently fixed in
033f28e67e.
2020-05-03 16:22:12 -07:00
iphydf
e71225268f
chore: Various code cleanups.
* Reorder class data members and/or constructor initialisers to match,
  reducing confusion about when members will be initialised.
* Remove (most) unused variables. Not removed: some global variables with
  `TODO(sudden6)` on them for using them in the future. I don't know how
  far into the future sudden6 wants to use them, so I left them there for
  now.
* Distinguish different bootstrap nodes in the logs by index in the
  bootstrap node list. Originally, we used to log the address/port of the
  node we're bootstrapping to. This was removed out of privacy concerns
  (even though the bootstrap nodes are public). This made the logs much
  less useful when debugging why the client isn't connecting. Having
  indices makes it easier to see that different nodes are being selected,
  and makes it possible to determine which node was selected.
* Explicitly cast unused results of Tox API functions to `void` when all
  we want is to know whether the function succeeds or not.
* Don't try to `#include <unistd.h>` on Windows. It does not exist on
  MSVC.
* Remove extra `;` after function definitions.
* Remove reference indirection of QJsonValueRef, since a copy of that ref
  (small pointer-like object) has to be made anyway when iterating over
  QJsonArrays.
* Make some file-scope global state `static`.
* Use `nullptr` instead of `NULL`.
* Add `#if DESKTOP_NOTIFICATIONS` around the code that implements desktop
  notifications, so it becomes a bit easier to compile everything with a
  single compiler command - useful for manually running static analysers.
* Fix an error on MSVC where `disconnect` is looked up to be a non-static
  member function and the `this` capture is missing.
* Consistently use `struct` and `class` tags for types.
* Use references in ranged-for where it reduces copies.
* Move private static data members out of the Style class and into
  file-local scope. There is no need for them to be in the class. Also
  marked them `const` where possible.
* Removed unused lambda capture.
* Ensure qTox can compile under NDEBUG with `-Wunused-variable` by
  inlining the unused variable into the `assert` that was its only
  target.
* Minor reformatting in core_test.cpp.
2020-04-16 19:07:40 +00:00
Anthony Bilinski
35f89612ff
chore(cleanup): don't add semicolon to Q_DECLARE_METATYPE
Remove missed cases from ad042b09e0.

Fix #6007
2020-04-13 01:06:30 -07:00
Anthony Bilinski
70824729ff
chore(cleanup): don't use 0 as nullptr
Don't add Wzero-as-null-pointer-constant by default, since on older Qt
versions that we stil support and that our CI runs agains, Qt API themselves
cause warnings which lead to build errors all over the place.

Fix #6008
2020-03-21 23:20:03 -07:00
Anthony Bilinski
2c1a86482a
chore(style): remove old style casts and cross sign comparisons
Enable warnings for both. Favour casting to signed rather than casting to
unsigend for comparisons. Per isocpp's core guidelines ES.102, signed
arithmetic gives more expected results. If we need one extra bit of range,
using longer signed types achives that.

Fix #6010
Fix #6012
2020-03-21 20:29:10 -07:00
Anthony Bilinski
cf672375be
revert(toxme): remove toxme from qTox - the service is offline permanently
As of 2019-10-09, toxme.io was taken offline permanently. Remove UI and code
in qTox relating to it. Revert this commit if it comes back online in the
future.

Fix #5897
2020-01-16 13:28:41 -08:00
Anthony Bilinski
239dfdc65c
refactor(status): move isOnline into Status from Friend
Allows checking if a status if equivalent to Online without needing a Friend
class.
2019-11-25 20:52:06 -08: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
Jimi Huotari
489d07c0eb
refactor(Qt): use 'QLatin1String' instead of 'QLatin1Literal' part 2
This is required when building against Qt 5.14.
2019-10-09 23:19:27 -07:00
Jimi Huotari
7f74d41586
refactor(Qt): use 'QLatin1String' instead of 'QLatin1Literal'
This is an undocumented Qt 2/3/4 remnant, deprecated in Qt 5.14.

- https://code.qt.io/cgit/qt/qtbase.git/commit/?h=5.14&id=3e75c296
- https://code.qt.io/cgit/qt/qtbase.git/commit/?h=5.14&id=45373c19
2019-10-09 23:19:26 -07:00
sudden6
2ce00afcbb
test: add regression test for #2119
Also modify the test to test highlighting via public key
2019-08-26 23:22:43 -07:00
jenli669
34e1e25b7f
fix(test): include <set> in groupmessagedispatcher_test.cpp 2019-07-15 10:26:50 +02:00
sudden6
79c88f2154
Merge pull request #5722
jenli669 (2):
      docs(copyright): update and add copyright info
      docs(copyright): Added copyright to apparmor .qtox files
2019-06-28 09:00:13 +02:00
jenli669
04a9bc46f4
docs(copyright): update and add copyright info
zealously updates and adds qTox copyright information.

Fixes #5713
2019-06-28 01:18:26 +02:00
Anthony Bilinski
819016960d
fix(ci): increase bsu_test timeout
for slow nodes server causing sporadic failures
2019-06-27 00:37:09 -07:00
Mick Sayson
71f8220925 refactor(chatlog): Add class to manage underlying chatlog state 2019-06-21 11:01:35 -07:00
Mick Sayson
f0d840002a refactor(messages): Create class to manage sending/receiving group messages from core 2019-06-21 11:01:10 -07:00
Mick Sayson
22a4c38bfd refactor(messages): Create class to manage sending/receiving friend messages from core 2019-06-21 11:01:10 -07:00
Mick Sayson
e5016337bb refactor(offlinemsg): Decouple OfflineMsgEngine from other components 2019-05-26 15:33:51 -07:00
Anthony Bilinski
316893ace9
test(db): add db schema upgrade test 2019-05-15 13:26:21 -07:00
Anthony Bilinski
97d05f9d67
refactor(id): make ContactId interface, implement GroupId
Precursor for group history, friend blocking
2019-04-13 12:58:25 -07:00
Patrick
9d2a8a3af6 test(core): Implement recommended changes 2019-03-17 13:52:42 +01:00
Patrick
e3a02b6ccb test(core): Added test for startup with invalid proxy 2019-03-17 13:52:42 +01:00
Patrick
cf32ccfa0e test(core): Add test cases for core, initial 2019-03-17 13:52:42 +01:00
sudden6
1f2bdf3a1b
feat: load bootstrap nodes directly from JSON
This allows us to easily update the list of bootstrap nodes.
2019-03-01 10:39:24 +01:00
sudden6
793d744705
test: add simple testcase for BoostrapNodeUpdater
This test just tries to connect to nodes.tox.chat and retrieve nodes.
The result is not checked yet.
2018-11-19 17:16:23 +01:00
sudden6
55c361eb71
test(paths): add tests for paths module 2018-11-14 11:02:20 +01:00
Patrick
ad6d60d1ab
test(toxstring): Add test cases for toxstring.h 2018-10-07 13:51:33 +02:00
iphydf
52a5951d26
chore: Use nullptr instead of 0 for NULL pointer constants. 2018-09-07 21:38:59 +00:00
Anthony Bilinski
5dc4e6de81
chore(legal): update copyright date to 2018 for all source files 2018-04-25 17:33:38 -07:00
Anthony Bilinski
e564b85e3c
fix(chatform): Broaden URL matching to include unicode
Fix #4853
Fix #4295

*Instead of searching strictly valid URIs, allow anything characters following scheme. This allows for UTF-8 characters used in other languages, as well as parentheses and other ASCII characters. This will over-match some invalid URLs.
*Ignored surrounding characters of URIs and ending punctuation
*Fix www-only links by adding http scheme to href
2018-02-25 01:48:25 -08:00
noavarice
de108ce834
refactor: allow newline|space to appear after multiline code seq
Also added tests
2017-11-03 21:00:09 +03:00
noavarice
acff6e0450
test: removed debug messages 2017-11-03 21:00:09 +03:00
noavarice
3faa0ecaad
test: added test for multiline code 2017-11-03 21:00:09 +03:00
noavarice
e80a2bcc69
test: added tests for IPv6 format 2017-11-03 21:00:09 +03:00
noavarice
5a569ea467
test: re-made test for URL highlighting
Also one test was removed. Answering sudden6's question, this test will
not pass after merging current pull request (if it will)
2017-11-03 21:00:09 +03:00
noavarice
40c4f431dd
refactor: removed unnecessary functions and test depending on them 2017-11-03 21:00:09 +03:00
noavarice
d302e261d4
test: updated tests for text formatting
Updated test data, changed additional functions and reimplemented test
slots
2017-11-03 21:00:09 +03:00
noavarice
a9eca8e626
refactor: removed TextFormatter instantiations from tests 2017-11-03 21:00:08 +03:00
Diadlo
7c74491226
fix(test): If json string not quoted is server error 2017-10-31 17:51:26 +03:00
Diadlo
d3babb3fbe
test(toxmedata): Add test for toxmedata class 2017-10-13 14:56:15 +03:00
Diadlo
42c4a74826
test: Add tests for PosixSignalNotifier 2017-10-11 14:50:09 +03:00