72f4f186da
merge: sync upstream profanity-im/profanity
...
CI Code / Check spelling (push) Successful in 18s
CI Code / Check coding style (push) Successful in 34s
CI Code / Code Coverage (push) Successful in 2m36s
CI Code / Linux (debian) (push) Successful in 4m41s
CI Code / Linux (ubuntu) (push) Successful in 4m52s
CI Code / Linux (arch) (push) Successful in 5m40s
Sync with upstream profanity-im/profanity.
Major upstream changes incorporated:
Memory management
- Replace malloc+memset with g_new0 throughout codebase
- Adopt auto_gchar / auto_gcharv / auto_gerror / auto_jid cleanup macros
- Replace free() with g_free() for GAlloc'd memory
Editor rewrite
- Remove pthread-based async editor; use GChildWatch callback API
- New launch_editor(initial_content, callback, user_data) interface
- Proper signal handling (SIGINT, SIGTSTP, SIGPIPE reset in child)
- ui_suspend()/ui_resume() integration for TTY management
OMEMO improvements
- Dual backend support: libsignal-protocol-c and libomemo-c
- Proper pre-key removal after use (XEP-0384 compliance)
- Automatic pre-key regeneration when store drops below threshold
- New functions: omemo_is_device_active(), omemo_is_jid_trusted()
- omemo_get_jid_untrusted_fingerprints() for better error messages
- Fingerprint notifications on new device identity discovery
- Deterministic pre-key ID generation tracking max_pre_key_id
- omemo_trust_changed() UI updates on trust state changes
JID validation
- RFC 6122-compliant validation in jid_is_valid()
- Character-level checks (RFC 6122 forbidden chars: & ' / : < > @)
- Length limits: 1023 per component, 3071 total
- New jid_is_valid_user_jid() for user vs. service JID distinction
Database
- Schema migration v3: UNIQUE constraint on archive_id for deduplication
- Triggers for corrected message tracking (replaces_db_id / replaced_by_db_id)
- db_history_result_t return type, _truncate_datetime_suffix()
UI / console
- win_warn_needed() / win_warn_sent() warning deduplication hash table
- PAD_MIN_HEIGHT dynamic pad sizing with PAD_THRESHOLD auto-cleanup
- Spellcheck integration in input field with Unicode word detection
- cons_spellcheck_setting() for /settings ui output
- /[command]? shortcut for command help
Account config
- Account name sanitization for GKeyFile special chars ([ ] = # \n \r)
- Replace popen() with g_spawn_sync() for eval_password
- TLS policy: add "direct" option alongside legacy
Connection
- Port validation with g_assert (0–65535)
- SHA-256 certificate fingerprint support (XMPP_CERT_PUBKEY_FINGERPRINT_SHA256)
- "direct" TLS policy alias for legacy SSL
Common utilities
- str_xml_sanitize() for XML 1.0 illegal character removal
- string_matches_one_of() with formatted error messages
- valid_tls_policy_option() helper
- prof_date_time_format_iso8601() utility
- Improved strip_arg_quotes() with backslash unescaping
- prof_occurrences() uses g_slist_prepend + reverse for performance
PGP / OX
- Proper GPGME resource cleanup with goto-cleanup pattern
- g_string_free(xmppuri) leak fix in _ox_key_lookup
CSV export
- Use GString + g_file_set_contents instead of raw write() syscalls
Tests
- Restructured into subdirectories: command/, config/, xmpp/, ui/, omemo/, otr/, pgp/
- New test_cmd_ac.c for autocompleter unit tests
- Updated stubs for new UI suspend/resume functions
License headers
- Migrate to SPDX-3.0 identifiers (GPL-3.0-or-later WITH OpenSSL-exception)
────────────────────────────────────────────────────
cproof-specific preservations:
- XEP-0308 LMC: replace_id ?: id logic in message/stanza/omemo
- Force encryption: cmd_force_encryption, test_forced_encryption
- CWE-134: format string protection (cons_show("%s", ...))
- y_start_pos-based paging in window.c
- db_history_result_t return type, _truncate_datetime_suffix()
Merge-time fixes:
- common.c: format-security (-Werror) — cons_show(errmsg) → cons_show("%s", errmsg)
- database.c: null-deref guard — !msg->timestamp → msg && !msg->timestamp
- console.c: implicit size_t → int cast — (int)(maxlen + 1)
- tlscerts.c: %d for size_t — %zu
Build system:
- Kept autotools (Makefile.am, configure.ac); upstream uses Meson
- Restored deleted files: bootstrap.sh, autogen.sh, ax_valgrind_check.m4, configure-debug
- Updated Makefile.am test paths for subdirectory structure
- Added test_cmd_ac, test_forced_encryption to test sources
Functional tests:
- Use cproof version; upstream requires stbbr_for_xmlns from updated stabber
- Not yet available in devs/stabber fork
Closes #64
Merge author: jabber.developer2
Commits authors:
Michael Vetter <jubalh@iodoru.org >
& Steffen Jaeckel <s@jaeckel.eu >
2026-05-26 17:48:14 +00:00
ad95edb2b9
feat: make /log level work with non-default files
2025-10-13 20:47:34 +02:00
Michael Vetter
07dfeec816
Release 0.15.0
2025-03-27 20:06:38 +01:00
Steffen Jaeckel
c0da36c48d
Rage-cleanup.
...
While trying to get the unit tests working again I stumbled over all those
things that I thought could be better^TM.
Now we also know "TODO: why does this make the test fail?" - because
the unit tests are brittle AF ... and we have to init the subsystems
we use in the test, otherwise the cleanup will fail...
BTW. you can now also only run a single test ... or a pattern or so ...
you'd have to read how `cmocka_set_test_filter()` works exactly.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu >
2025-03-10 11:45:15 +01:00
Steffen Jaeckel
c5a131ee46
Introduce our own shutdown callback mechanism.
...
Instead of adding stuff to `_shutdown()`, we can now register a shutdown
routine from the respective `init()` function of our modules.
This also has the advantage, that we're sure they're called in reverse
order from how the initialization happened.
I didn't simply use `atexit()` because POSIX says that the number of
possible callbacks is limited (min 32) and I was not sure whether
we will maybe extend this number at one point.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu >
2025-03-07 21:09:16 +01:00
Michael Vetter
569e37f018
Update copyright to 2024
2024-01-22 16:03:48 +01:00
Steffen Jaeckel
5657aac33d
Fix some more char* -> gchar*.
...
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de >
2023-08-31 23:14:02 +02:00
Michael Vetter
e853c121d9
Fix my email address
...
in all files
2023-07-31 16:51:58 +02:00
John Hernandez
8304ac86ff
g_free() to auto_gfree, introduce auto_guchar
...
Fix 11 potential mem leaks in theme.c
2023-07-13 17:04:59 +02:00
John Hernandez
e1d137f4e6
Change char->free to auto_char char for autocleanup
...
Replace `gchar` and `g_free` to `auto_gchar`
Correct certain `char` functions/variables to `gchar`
Related to #1819 .
Edited by @jubalh.
2023-07-11 13:26:37 +02:00
Daniel Santos
c7f05c9ebf
Fix typos and update codespell configuration
...
* Fix typos.
* Add words that are not typos to codespell's ignore words list and
ignore regex.
* Make codespell ignore URIs.
* Make `make doublecheck` throw no error.
Signed-off-by: Daniel Santos <dacs.git@brilhante.top >
2023-04-03 13:25:25 +01:00
Steffen Jaeckel
e9aaba938b
minor changes
...
* fix typo
* less code duplication
* less `GString` usage
* more `auto_gchar` usage
* document connecting to servers supporting SASL ANONYMOUS
* ignore valgrind output
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de >
2023-01-18 20:02:46 +01:00
Michael Vetter
3adc399da0
Update copyright year
2023-01-10 10:37:25 +01:00
Steffen Jaeckel
25e56fb494
less strdup()+free()
...
Improvement of f8ff93234e
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de >
2022-09-07 12:42:15 +02:00
Michael Vetter
9312333ba2
log: put static functions on top
2022-06-28 20:13:55 +02:00
Michael Vetter
585f68f4f7
Split log.c into log.c and chatlog.c
2022-06-28 20:08:38 +02:00
Michael Vetter
b302c604ab
Display log level information in preferences
2022-06-22 13:05:11 +02:00
Michael Vetter
ff8065eaca
Rename _log_string_from_level to _log_abbreviation_string_from_level
2022-06-22 13:05:11 +02:00
Michael Vetter
1330ad4e1e
Update copyright year
2022-05-09 15:43:33 +02:00
Michael Vetter
82a2b17c1f
Use profanity.001.log instead of profanity.log.001 for rotated logs
...
Rotated log files will now be: `.local/share/profanity/logs/profanity.001.log`
We only use logrotation if we use the default log file ending with .log.
So Replacing the `.` should be fine.
User supplied log files are not rotated.
2022-04-29 19:19:01 +02:00
Michael Vetter
188afc58da
Use 3 digits for rotated logfiles
...
profanity.log.001 -> 999.
2022-04-29 15:40:56 +02:00
Michael Vetter
4220a1832d
Use ISO8601 for log files
2022-04-29 13:05:02 +02:00
Michael Vetter
534ed34d73
Use ISO8601 for chatlogs
...
For both 1:1 and groupchat.
2022-04-29 13:04:16 +02:00
Steffen Jaeckel
7da2e6d9f3
Fix logging (this time for real)
...
... I hope ...
We also need to create the path where the logs are stored.
Fixup of d82f2f293b
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de >
2022-04-01 14:56:08 +02:00
Steffen Jaeckel
d82f2f293b
fix path where logs are stored
...
43e5f15e66 broke the creation of the path
where chatlogs are stored. This is fixed now.
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de >
2022-04-01 14:17:44 +02:00
Steffen Jaeckel
43e5f15e66
refactor logfile-name creation
...
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de >
2022-03-14 13:17:46 +01:00
Michael Vetter
f21595597f
Format code correctly
2021-10-05 10:01:27 +02:00
Michael Vetter
5022aeb337
Fix log rotation
...
Fix https://github.com/profanity-im/profanity/issues/1518
See
https://github.com/profanity-im/profanity/issues/1518#issuecomment-870581988
2021-07-05 11:52:06 +02:00
Michael Vetter
482f8955d7
Fix log rotation
...
See https://github.com/profanity-im/profanity/issues/1518
It has a good explanation of what happened:
```
Apparently, the _rotate_log_file function tried to extract user-provided
name from currently used mainlogfile and restart logging to the same
place after rotation, but currently this is interpreted as a full path
instead. As I understand, the log rotation is no longer done with
user-provided paths at all so this should be simply skipped altogether
now as passing any non-NULL value is interpreted as user-provided.
Replacing start with NULL appears to fix it for me.
```
In log_msg() we only rotate the log if not user_provided_log.
https://github.com/profanity-im/profanity/pull/1455 changed the
behaviour from user defined filename in the log dir to using full path.
2021-06-28 17:41:48 +02:00
Michael Vetter
057c9ad776
Add config.h in files were it was missing
...
Related to https://github.com/profanity-im/profanity/issues/1512
2021-03-26 19:54:22 +01:00
Michael Vetter
0277ffe6ae
Only rotate logs if user didn't specify a log file
2020-12-11 11:33:34 +01:00
Michael Vetter
57666bcb77
Remove log_reinit()
...
Not needed anymore.
2020-12-11 11:18:24 +01:00
Michael Vetter
35aecd425f
Declare counter var inside loop
...
We require c99/gnu99 anyways.
2020-11-09 11:33:33 +01:00
Michael Vetter
a2726b6a7d
Apply coding style
2020-07-07 14:18:57 +02:00
Michael Vetter
a4cadf78fa
Revert "Apply coding style"
...
This reverts commit 9b55f2dec0 .
Sorting the includes creates some problems.
2020-07-07 13:53:30 +02:00
Michael Vetter
9b55f2dec0
Apply coding style
...
Regards https://github.com/profanity-im/profanity/issues/1396
2020-07-07 09:43:28 +02:00
Stefan Kropp
b8207207f4
Rework logging
...
Changed default logging from INFO to WARN.
Issue: #1353
2020-07-03 18:47:16 +02:00
Michael Vetter
9c433e3033
log.c: Format code
2020-07-02 15:06:17 +02:00
Michael Vetter
f8ff93234e
log.c: Use gchar* instead of GString for mainlogfile
2020-07-02 15:00:09 +02:00
Michael Vetter
e5ac12afa6
Remove prefs_free_string()
...
It just does a free.
Related to b580b9ef11
2020-07-02 11:34:12 +02:00
Michael Vetter
74e061165a
Define POSIX macro to have strdup
...
98c38dc6d6
sets C99 as standard.
strdup() is not part of C99.
For now set `-D_POSIX_C_SOURCE=200809L` macro to have strdup() in C99.
Using `gnu99` instead would be another option.
We should take more care to use glib functions whenever possible.
Regards https://github.com/profanity-im/profanity/issues/1357
2020-06-12 16:12:21 +02:00
Michael Vetter
de8975c008
Add and use connection_get_barejid()
...
Instead of connection_get_fulljid() and then creating a Jid from it.
2020-05-25 13:04:19 +02:00
Michael Vetter
25dbebab17
log: don't log dt
...
Use another name.
2020-04-20 15:48:01 +02:00
Michael Vetter
5a42883c27
log: Dont shadow logp
...
Let's use another name.
2020-04-20 15:46:27 +02:00
Michael Vetter
180ec2b474
Add to_jid field to ProfMessage struct
...
Is usefult in many cases if we want cleaner code.
Hope this edit didn't break anything though ;-)
2020-04-11 17:11:53 +02:00
Michael Vetter
3524a53c7c
Add type field to ProfMessage
...
The mucuser boolean is not now needed anymore.
2020-04-06 19:15:02 +02:00
Michael Vetter
0942d98c61
Remove chat_log_get_previous()
...
We now dont get the log files from the text files via chat_log_get_previous() anymore.
We use the sql backend via log_database_get_previous_chat().
So far it just has the same behaviour like chat_log_get_previous(),
except that in _chatwin_history() we don't pass the sender to
win_print_history() which should be fixed in a commit soon.
And log_database_get_previous_chat() can later easily be expanded to fix
https://github.com/profanity-im/profanity/issues/205 .
2020-04-06 14:42:52 +02:00
Michael Vetter
a4b53550ca
Rename PROF_MSG_ENC_PLAIN to PROF_MSG_ENC_NONE
2020-04-06 10:50:20 +02:00
Michael Vetter
c08d0e9ce8
Fix errors in log.c
2020-02-22 09:27:04 +01:00
Michael Vetter
55f49f1259
get_log_file_location () should return const char*
...
Make clear that result should never be freed.
2020-02-21 21:19:54 +01:00