Commit Graph

9 Commits

Author SHA1 Message Date
Tobias Fella
c3fd2428a2 Add QR code scanner 2024-03-28 22:02:55 +01:00
James Graham
f6ba4f2ecd Improve Text Handling
Improve the handling of text both when sending and receiving.

The main feature is to fix the linked bug (and a host of others that are unreported but similar) which is caused by the fact that we don't properly clean html. This mr does that as per the matrix spec https://spec.matrix.org/v1.5/client-server-api/#mroommessage-msgtypes. So any disallowed tags or attributes are removed and it does the special handling for certain attributes.

Additionally the functions are also designed to cover any other text formatting required, particularly fro received strings.

The receive side is covered by 2 functions `handleRecieveRichText` and `handleRecievePlainText`. The rich/plain in the function name refers to the output type not the input type (both can take plain and rich input), so `handleRecieveRichText` is called to get a string suitable to go in a rich text control and `handleRecievePlainText` for a plain control.

The functions also handle the following some of which was previously handled by `eventToString` in `NeoChatRoom`:
- Strip and reply from the string
- Format any user mentions
- Linkify links in plain strings
- Handle mxc urls in rich text (uses the new `room->makeMediaUrl` functionality from libQuotient)
- `handleRecievePlainText` also deals with markup making `NeoChatRoom->subtitle` redundant

There is also an extensive test suite which defines the behaviour and the best way to review this is probably to look at the tests and decide whether you agree with the expected output given the inputs and/or if there is any missing behaviour.

The final aim especially with the test suite is to give us a framework to make further updates in the future easier and hopefully prevent a new feature breaking old behaviour with the tests.

BUG: 463932 \
BUG: 466330 \
BUG: 466930
2023-03-13 17:28:56 +00:00
Tobias Fella
2cb81d1276 Unify License header style in C++ 2021-04-06 19:25:06 +02:00
Tobias Fella
d8dde6e082 Add license headers to code files 2020-11-11 15:17:23 +00:00
Black Hat
617855a780 Fix line strike.
Fix code block wrapping.
Fix replyModel being garbage collected.
Reply message in RoomPanelInput is richtext now.
2019-09-29 20:29:59 -07:00
Black Hat
a76e63063d Fix #108. 2019-05-23 16:44:34 +08:00
Black Hat
5192a91391 Replace QRegExp with QRegularExpression.
Fix timeline viewport saving.
Fix invitation dialog. #124
2018-11-29 10:41:38 +08:00
Black Hat
e7b2698521 Better rich reply. 2018-11-27 18:14:48 +08:00
Black Hat
e19e3b8ff9 Clean up event to string related codes.
Working on #55.
2018-10-24 21:15:26 +08:00