Ensure consistent invocation of `plugins_pre_chat_message_display`
for outgoing messages. Before the change, the function was not
called for sent messages upon sending, but only on fetching
sent messages from DB.
Fix https://github.com/profanity-im/profanity/issues/1917
Refactor function to enhance memory handling, addressing
temporary workaround introduced in 2e0adbd. Adjustments
ensure cleaner code and maintainability.
Part of the improvements suggested by @sjaeckel.
On some commands execution (like `/privacy logging X`
where X is any symbol/group of symbols)
FALSE is being returned.
Which main cycle understands as a signal to exit profanity.
The mistake is common since returns are often used by
developers to communicate success status.
First reported by @doctor in the Profanity MUC,
as exit on `/logging group color` command.
`/executable vcard_photo test`
Printed
`Invalid usage, see '/help card_photo' for details.`
So it used the subcommand instead of the command and lost one of the
letters as well.
This mistake got introduced in 60c197487.
Where we added helper functions for the various `/executable` functions.
Discovered by @H3rnand3zzz with correct solution.
Fix https://github.com/profanity-im/profanity/issues/1921
Disallow correcting historical MUC messages, as the XEP-308 requires.
Previous changes introduce problem with
"Illicit LMC attempt from conference@server/user for message from user"
During investigation it was revealed that XEP does not recommend support
of historical MUC messages correction.
```
When used in a Multi-User Chat (XEP-0045) context,
corrections must not be allowed (by the receiver)
for messages received before the sender joined the room -
particularly a full JID leaving the room
then rejoining and correcting a message SHOULD be disallowed,
as the entity behind the full JID in the MUC may have changed.
```
https://xmpp.org/extensions/xep-0308.html#rules
XEP details mentioned by @jubalh
Bug discovered and solution improved by @jaeckel
Enhance data consistency by updating the database to treat empty
strings as NULL values. This change simplifies queries and improves
overall database integrity.
**Please, backup your DB before performing any testing.**
Introduce new DB structure and DB migration mechanism.
Index `timestamp`, `to_jid`, `from_jid` columns to improve performance.
Add trigger for `replaced_by_db_id` calculation by DB on message insert.
Now LMC messages are interconnected with original messages,
this way we have fast access to last (hence correct) applicable edits,
as well as reference to the original message from any edit (in case of chained edits).
Change the way LMC messages are being displayed. Now we check if we
can replace a message from current buffer. If we don't have a message in
the buffer, it might've been lost, but we can still display it as a
new message.
Further information available here:
https://github.com/profanity-im/profanity/pull/1893https://github.com/profanity-im/profanity/issues/1899https://github.com/profanity-im/profanity/pull/1902
Refactor getting char, introduce get_show_char() to follow DRY principle.
In theory, performance might be negatively affected after this change.
Ideally get_show_char should be optimized in the future.
Commit to allow unicode support in omemo/pgp/otr chars misses
adding support to set correction character.
1f8b1eb740
Further fixing commit also misses adding support to set the unicode character,
it only adds ability to display unicode correction character in the settings.
5cf6ee15cf6ee1bc6d0b99b01891bc455a657bf022a72b0
## Summary
Fixes https://github.com/profanity-im/profanity/issues/1907
Update functional and unit test code to comply with the current cmocka test runner.
## Changes
- `UnitTest` struct to `CMUnitTest` struct
- `unit_test()` macro to `cmocka_unit_test(f)` macro
- `unit_test_setup_teardown()` macro to `cmocka_unit_test_setup_teardown` macro
- `run_tests()` macro to `cmocka_run_group_tests()` function
- Setup and teardown functions return `int` instead of `void`
## Testing
### Unit Tests
`make check`
### Functional Tests
I did not compile or run functional tests because they are *shelved* for now.
### Valgrind
I'm not entirely sure how to fun Valgrind in this case. I did not do fancy memory management, so it should be fine.
Stop fetching message from DB when profanity reached start or end of the history
with the user. This allows to save resources on page up/down
when ceiling or bottom accordingly are reached.
Currently buffer is being redrawn on each DB fetch,
this causes a big waste of resources as on every page_up button click
we redraw 1200 messages (each message can be longer than 1 line),
commit will reduce buffer size to 200,
thus reducing amount of messages redrawn on each page up,
this is a temporary solution for a bigger problem.
Before aliases used spaces in their name,
now the alias part is being read only before the first space,
thus allowing execution of complex command with aliases.
Example (with plugin):
`/alias add echo "/system exec echo"`
will allow execution of
`/echo test`
as opposed to prior state when the Profanity will
search for alias "echo tests" and output `Unknown command: /echo test`
Minor change: removed an example with invalid command (`/away`)
`/plugins reload non-existent-plugin` printed:
```
Failed to reload plugin: non-existent-plugin, `:^C
```
There were two mistakes:
error_message instead of error_message->str was passed to cons_show().
And in case of failing to unload the plugin due to not finding it in the
hash table it didn't print an error.
This bug was introduced in cc697de05.
When we received a message correction via `XEP-0308: Last Message Correction`
we accepted the change without checking the sender
making it possible for anybody to replace the message if the ID was known.
This change has been proposed by @jubalh
https://github.com/profanity-im/profanity/pull/1893#issuecomment-1752434740
Add logging for cases when the message is not being inserted in the DB due to its ID.
Make diagnostic of unreliable message history much easier,
lay the groundwork for a fully reliable message history.
Further changes might include insertion of messages with non-unique stanza-id,
but as it's a big change with plentiful issues, decision was made
to further investigate potential causes of history unreliability.
For details see #1893 discussion