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

32 Commits

Author SHA1 Message Date
Anthony Bilinski
9571434df9
feat(CI): Disallow unsafe implicit casts to QString
Covers char* without size, and QByteArray.

Catches the case of QByteArray to QString implicit conversion like was
fixed in 47ee51c61d, but still allows
construction or assignment from string literals in source. Gives most
of the type safety of QT_NO_CAST_FROM_ASCII without having to wrap
every literal string in QStringLiteral.

No functional issues found during change.
2022-04-05 12:10:05 -07:00
Anthony Bilinski
1e4eed76b5
refactor: Move GroupList global state into class 2022-04-05 10:34:53 -07:00
bodwok
a1b08d6493
fix(FriendList): exclusion of possible undefined behavior 2022-04-03 11:03:48 +03:00
Anthony Bilinski
71c3f997b4
refactor: Move FriendList global state into class 2022-03-30 19:04:11 -07:00
Anthony Bilinski
cabcf4111f
refactor(style): Match declaration and definition argument names
Conform with readability-named-parameter and
readability-inconsistent-declaration-parameter-name
2022-03-15 08:19:53 -07:00
Anthony Bilinski
1206da2b05
refactor(ToxPk): Don't define model's ToxPk, ToxId, GroupId from tox.h
Since they exist in saved settings and the chat database, they are their own
size. assert that it matches tox.h's size in Core constructor, though.
2022-03-13 05:28:41 -07:00
Anthony Bilinski
bda1a6a909
refactor: Comply with Wpedantic
* Remove semicolons after calling a macro
* Remove semicolons at the end of class declarations
* Remove semicolons at the end of namespaces
2022-03-11 10:08:02 -08:00
Anthony Bilinski
adc0f0cca6
refactor: Comply with Wmissing-declarations
* Move free functions to the anonymous namespace
* Additionally move static free functions to the anonymous namespace
* Move functions that must be accessed externally to static class functions
2022-03-11 10:08:02 -08:00
Anthony Bilinski
48ad6cc17a
refactor: Comply with Wunused-parameter
Explicitly ignore unused parameters.

Also replace Q_UNUSED with std::ignore for consistency and to favour std
over Qt when equivalent.
2022-03-11 10:07:57 -08:00
Anthony Bilinski
fc2e445294
refactor: Comply with Wshadow
Avoid shadowing variables:
* Rename variables to something better if possible
* If not, postfix shadowing arguments with _. Favour leaving member
  variables without postfixes.
* Rename variables prefixed with _ to avoid library function collisions
* Avoid double underscore anywhere in names
* Make definition and declaration argument names match where seen
* Favour using class variable over argument variable, where equivalent
* Remove explicit this-> where equivalent
2022-03-11 08:35:38 -08:00
Anthony Bilinski
bc751c8e1c
refactor(test): Move mocks into their own library
Avoid re-compiling sources for each test that uses them.
2022-03-02 23:30:04 -08:00
Anthony Bilinski
1be5b99d17
feat(Settings): Add setting for hiding group join and leave system messages
Messages can become spammy is long lasting quiet groups, drowning out real user
messages
2022-02-20 17:32:23 -08:00
Anthony Bilinski
e5df648e1a
refactor(settings): Use IGroupSettings in GroupChatForm
Move interface signals from Settings to be declared by the interface itself
2022-02-20 17:32:23 -08:00
Anthony Bilinski
a1ebf297d3
chore(cleanup): Minor cleanup to contact management test
* Fix compile error on macOS by marking GroupWidget::widgetIsVisible as
override
* Mark mock functions override for consistency
* Change QWARN to QVERIFY since logs will be missed in CI
* Uncomment add of offline and online friends in testSortByActivity
* Add out-of-line method definition to anchor vtable
2022-02-17 17:17:48 -08:00
bodwok
0a9e121811
test(FriendListManager): add contact management test 2022-02-17 13:20:58 -08:00
Brandon Mosher
1438f8f766 refactor: Provide a Virtual Method Anchor for Classes in Headers
Define at least one virtual method in polymorphic class cpp files to
improve link efficiency. Do so by defining a defaulted destructor or
another overridden virtual method in the class cpp file.
Also add explicitly defaulted copy/move constructors and assignment
operators to follow the rule of five and to avoid compiler suppression
of these functions due to the addition of a user-provided destructor.
Where neccessary, create new cpp files and add them to CMakeLists and
Testing.cmake. Set the -Wweak-vtables by default when compiling with
clang to issue warnings for new classes that do not comply with this
pattern.

See http://llvm.org/docs/CodingStandards.html#provide-a-virtual-method-anchor-for-classes-in-headers.

Fixes #6036.
2021-10-26 16:47:40 +00:00
Mick Sayson
26701283cd
feat(extensions): Split messages on extended messages
v0.0.2 of toxext_extended_messages brought in a user configurable max
message size. This changeset implements the minimum work required for
qTox to work sanely under the new API.

* Hardcode a max message size for all friends
* If a friend negotiates a max message size below the hardcoded value
  pretend they do not have the extension
* Move splitMessage out of Core to MessageProcessor
* Updates to allow for extended messages to be split
2021-01-30 18:15:49 -08: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
Mick Sayson
7474c6d8ac
feat(messages): Multipacket message support
* Introduced ToxExt and CoreExt abstraction
    * Along with interfaces for mocking and unit testing
* Add "supportedExtensions" concept to Friend
* Dispatch messages to CoreExt instead of Core when friend supports
extended messages
    * Only split messages for core when extended messages are unavailable
* Offline message engine/History not altered. Currently only valid for
an existing session after extension negotiation has completed
2021-01-30 12:52:06 -08:00
sudden6
b0295b7c0a
refactor(chatlog): remove getInstance from ChatlogItem 2020-08-24 23:24:24 +02:00
Mick Sayson
6e163ca5ed
feat(notification): Notifications now always replace the previous one
This is a feature/fix to improve notification behavior when we receive
over 3 messages.

SnoreNotify prevents over 3 notifications from being displayed before a
user clears the notification. This is presumably to avoid infinite
notification spam.

Unfortunately this results in the notifications just coming in _after_
the user clears them. This means if there are 100s of messages built up
the user has to clear their notifications N messages / 3 times.

This feature/fix folds all notifications into a single notification
representing the current qTox notification state. See
notificationgenerator_test.cpp for what the new messages look like.
2020-05-17 00:00:53 -07:00
Mick Sayson
a9f6543e43
feat(notification): Notification string generator for multiple messages 2020-05-17 00:00:48 -07:00
Mick Sayson
99c1753a76 fix(preview): Fix exif orientations
Previous exif transformations were not valid. The exif spec defines the
orientations as where the 0th row and the 0th column should end. The
previous mappings used in qTox did not respect these mappings and needed
to be updated.
2020-05-16 16:53:14 -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
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
Jimi Huotari
4f83187ce0 refactor(Qt): use 'QLatin1String' instead of 'QLatin1Literal' part 2
This is required when building against Qt 5.14.
2019-09-25 13:47:42 +03:00
sudden6
4d84db1a4e
test: add regression test for #2119
Also modify the test to test highlighting via public key
2019-08-26 19:08:42 +02:00
jenli669
34e1e25b7f
fix(test): include <set> in groupmessagedispatcher_test.cpp 2019-07-15 10:26:50 +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
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