1
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-02-02 15:08:15 -05:00

7484 Commits

Author SHA1 Message Date
Michael Vetter
0081db643f
Merge pull request #2015 from ventosus/issue#2012
Load resources from chat history db
2025-01-28 17:25:10 +01:00
Michael Vetter
4e06fa4187
Merge pull request #2007 from profanity-im/debug-1946
Debug #1946
2025-01-28 17:21:30 +01:00
Steffen Jaeckel
f27fa98717 Some minor changes
* Fix some linter suggestions.
* Change some defines to `const` vars.
* Free buffer entries in the reverse order they were allocated.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-01-28 16:43:13 +01:00
Steffen Jaeckel
8151dfa3b4 /quit now exits from the event loop
Before this change issuing `/quit` directly called `exit(0)` and did not
invoke all the graceful shutdown routines. Now we first try to exit from
the event loop, which includes cleaning up everything.
In case the event loop is stuck for some reason, you could try to issue a
second `/quit`, which will then directly call `exit(0)`.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-01-28 16:43:13 +01:00
Steffen Jaeckel
2696989ce5 Fix a bunch of obvious memory leaks at termination
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-01-28 16:43:13 +01:00
Steffen Jaeckel
06f5c2670e PyEval_InitThreads() is deprecated
`Py_Initialize()` does it since 3.7, it's a noop and deprecated since 3.9.

https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-01-28 16:43:13 +01:00
Steffen Jaeckel
80193ca41f cmd_ac: Refactor alloc, reset & free
Add all elements to an array, in order to easily be able to run operations
in bulk.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-01-28 16:43:13 +01:00
Steffen Jaeckel
f67c76c032 Add make target my-prof.supp
This creates a "as personal as possible" Valgrind suppressions file.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-01-28 16:43:13 +01:00
Steffen Jaeckel
46b788846c These defines don't have to be in the header file
They're only used in `window.c`.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-01-28 16:43:13 +01:00
Steffen Jaeckel
67d8d7110b Revert "Fix underscrolling problem"
This reverts commit d7e46d64fe6bc9926eb404dad6a4803e1fc2e8b2.
2025-01-28 16:43:13 +01:00
Steffen Jaeckel
69eb852ca5 Provide autogen.sh
This seems to be some kind of standard script name for bootstrapping
autotools.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-01-28 16:43:13 +01:00
Hanspeter Portner
c804137669 Load resources from chat history db
Fixes: https://github.com/profanity-im/profanity/issues/2012
2025-01-26 20:12:41 +01:00
Michael Vetter
329ca8a089
Merge pull request #2014 from ventosus/issue#2013
Make `muc_nick` return a `const char* const`
2025-01-26 18:54:17 +01:00
Hanspeter Portner
cb395b7c09 Make muc_nick return a const char* const
In the documentation of the `muc_nick` function we can read:

> The nickname is owned by the chat room and should not be modified or freed

We should reflect that in the return type and `strdup` the value for the
plugin API.

Fixes: https://github.com/profanity-im/profanity/issues/2013
2025-01-26 18:16:14 +01:00
Michael Vetter
baddf2a8da
Merge pull request #2009 from profanity-im/fix/2004-Dockerfile-archlinux-image
Enable Arch CI
2025-01-07 10:33:58 +01:00
Michael Vetter
797e0bc3ce ci: use official libsignal package instead of aur
This fixes the build as well.
2025-01-06 10:17:19 +01:00
Michael Vetter
d7398d11e1 ci: re-enable arch
This reverts commit 3def839c0ed01fbacf8406ef5961caa666110df3.
2025-01-05 18:39:58 +01:00
belmiro adriano
bbc88557a4 ci: replace archlinux tag in Dockerfile
This pull request addresses an error in the Dockerfile.arch file caused by using an incorrect base image reference (archlinux/latest). The Docker Hub archlinux repository does not support a latest tag, which leads to a "failed to resolve source metadata" error during the Docker build process. This PR updates the base image reference to archlinux, resolving the error and allowing for a successful build.

Fix https://github.com/profanity-im/profanity/issues/2004

Note: Commit message edited by @jubalh since @tjsweetblack didn't respond.
2025-01-05 18:34:25 +01:00
Michael Vetter
313ab5d55a
Merge pull request #1998 from mdosch/no-plenking
Remove plenking
2024-10-04 11:57:56 +02:00
Martin Dosch
50e82376b0 Remove plenking
There were two cases of plenking (a space between a word and the punctuation
marks) in front of `…`.
2024-10-03 15:51:52 +02:00
Michael Vetter
dce0b7376e Add cosmetic commit to ignore file 2024-09-19 08:35:09 +02:00
Michael Vetter
69301503ce Add missing space to description 2024-09-19 08:34:21 +02:00
Michael Vetter
0995b1a180 Add NULL check to _gpgme_key_to_ProfPGPKey
Fix https://github.com/profanity-im/profanity/issues/1995

Tested-by: Martin Dosch <martin@mdosch.de>
2024-09-07 12:44:42 +02:00
Michael Vetter
3b19a6afcd
Merge pull request #1993 from profanity-im/fix/1992-typemismatch
Fix outdated types in tests
2024-08-05 17:17:52 +02:00
Michael Vetter
3441aa3279 Fix outdated types in tests
Fix https://github.com/profanity-im/profanity/issues/1992
2024-08-05 12:14:09 +02:00
Michael Vetter
beeddda568 docs: Add more info to ignore revs 2024-06-24 10:24:40 +02:00
Michael Vetter
996a1fdf35 Fix build on some compilers regardind switch statement
Fix the famous `error: a label can only be part of a statement and a
declaration is not a statement`.
2024-06-20 18:04:12 +02:00
Michael Vetter
a8ba8af0de Add link to fugitive 2024-06-20 17:39:04 +02:00
Michael Vetter
7e0338b369 Add hint about git blame ignore to CONTRIBUTING.md 2024-06-20 17:36:54 +02:00
Michael Vetter
0beac569c9 Add two more format commits to the ignore list 2024-06-20 17:34:27 +02:00
Michael Vetter
4d9852a76a
Merge pull request #1983 from profanity-im/feat/dl-location
Change default download location
2024-06-20 13:52:51 +02:00
Michael Vetter
f147a5ca27 Change default download location
`/url save $someurl` will now download to
`~/.local/share/profanity/downloads/from_jid/date/filename` instead of
`~/.local/share/profanity/downloads`.

Like this the downloaded files should be better ordered.

This will only happen for MUC and 1:1 chat windows.
Private windows might have only a nick or jid. Lets not distinguish
between those two ways. And since the nick option is unreliable to be
the same person lets just put them in the general downloads folder.
As is done with downloads from all other windows as well.

I also had the idea to make this configurable but this suits my needs
and time limits right now.
2024-06-20 13:35:14 +02:00
Michael Vetter
29fd8199f1
Merge pull request #1978 from profanity-im/feat/1974-actlist
Make statusbar actlist respect the /statusbar show setting
2024-06-20 12:47:34 +02:00
Michael Vetter
534c14917a
Merge pull request #1982 from profanity-im/fix/1976-autocon-acc
Reset autoconnect account when the account gets removed
2024-06-20 12:45:53 +02:00
Michael Vetter
07900e9617 Revert "Fix potential double free of ratchet identity key"
This reverts commit 3b099e9403c61d184d325c7b5c7fde30a572cf5c.

This resulted in:
```
==5285== Invalid read of size 16
==5285==    at 0x4FA80FC: ec_public_key_serialize (in /usr/lib64/libsignal-protocol-c.so.2.3.3)
==5285==    by 0x4E5E76: omemo_identity_key (omemo.c:419)
==5285==    by 0x4EBB7E: omemo_bundle_publish (omemo.c:129)
==5285==    by 0x4E5BD9: omemo_publish_crypto_materials (omemo.c:335)
==5285==    by 0x460407: sv_ev_connection_features_received (server_events.c:202)
==5285==    by 0x43AA87: connection_features_received (connection.c:779)
==5285==    by 0x4418C9: _disco_info_response_id_handler_onconnect (iq.c:2423)
==5285==    by 0x43B9F1: _iq_handler (iq.c:241)
==5285==    by 0x5163848: ??? (in /usr/lib64/libstrophe.so.0.13.1)
==5285==    by 0x516A224: ??? (in /usr/lib64/libstrophe.so.0.13.1)
==5285==    by 0x5E4FE43: ??? (in /usr/lib64/libxml2.so.2.12.8)
==5285==    by 0x5E54927: xmlParseChunk (in /usr/lib64/libxml2.so.2.12.8)
==5285==    by 0x5163450: xmpp_run_once (in /usr/lib64/libstrophe.so.0.13.1)
==5285==    by 0x439797: connection_check_events (connection.c:162)
==5285==    by 0x43894E: session_process_events (session.c:256)
==5285==    by 0x4319FF: prof_run (profanity.c:128)
==5285==    by 0x4EDAE6: main (main.c:174)
==5285==  Address 0xa1cb1e0 is 16 bytes inside a block of size 72 free'd
==5285==    at 0x484875B: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==5285==    by 0x4395D0: _xfree (connection.c:110)
==5285==    by 0x516A1A7: xmpp_stanza_release (in /usr/lib64/libstrophe.so.0.13.1)
==5285==    by 0x516A16C: xmpp_stanza_release (in /usr/lib64/libstrophe.so.0.13.1)
==5285==    by 0x516A16C: xmpp_stanza_release (in /usr/lib64/libstrophe.so.0.13.1)
==5285==    by 0x516A230: ??? (in /usr/lib64/libstrophe.so.0.13.1)
==5285==    by 0x5E4FE43: ??? (in /usr/lib64/libxml2.so.2.12.8)
==5285==    by 0x5E54927: xmlParseChunk (in /usr/lib64/libxml2.so.2.12.8)
==5285==    by 0x5163450: xmpp_run_once (in /usr/lib64/libstrophe.so.0.13.1)
==5285==    by 0x439797: connection_check_events (connection.c:162)
==5285==    by 0x43894E: session_process_events (session.c:256)
==5285==    by 0x4319FF: prof_run (profanity.c:128)
==5285==    by 0x4EDAE6: main (main.c:174)
==5285==  Block was alloc'd at
==5285==    at 0x4845794: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==5285==    by 0x43958A: _xmalloc (connection.c:102)
==5285==    by 0x516A0D1: xmpp_stanza_new (in /usr/lib64/libstrophe.so.0.13.1)
==5285==    by 0x516BF34: ??? (in /usr/lib64/libstrophe.so.0.13.1)
==5285==    by 0x5F10A17: ??? (in /usr/lib64/libxml2.so.2.12.8)
==5285==    by 0x5E5481F: xmlParseChunk (in /usr/lib64/libxml2.so.2.12.8)
==5285==    by 0x5163450: xmpp_run_once (in /usr/lib64/libstrophe.so.0.13.1)
==5285==    by 0x439797: connection_check_events (connection.c:162)
==5285==    by 0x43894E: session_process_events (session.c:256)
==5285==    by 0x4319FF: prof_run (profanity.c:128)
==5285==    by 0x4EDAE6: main (main.c:174)
```

Tested via sending OMEMO messages via 1:1 and in MUC.
2024-06-20 12:41:20 +02:00
Michael Vetter
5765edbe1b Reset autoconnect account when the account gets removed
When a user added an account, set it as autoconnect and then removed
that account. It still was set as the autoconnect account.

```
    /account add test
    /autoconnect set test
    /account remove test
    /save
    /quit
    Start profanity
```

Fix https://github.com/profanity-im/profanity/issues/1976
2024-06-20 11:04:20 +02:00
Michael Vetter
87935b744d
Merge pull request #1979 from profanity-im/fix/leaks
Fix memleaks
2024-06-20 10:51:12 +02:00
Michael Vetter
b6c2aa5074
Merge pull request #1981 from profanity-im/minor-improvements
Minor improvements
2024-06-19 16:14:35 +02:00
Steffen Jaeckel
3b099e9403 Fix potential double free of ratchet identity key
libsignal does this properly, so there wouldn't be a real double free, but
it will `abort()`.

Instead of destroying the identity key on disconnect, already destroy it
after it has been put into the libsignal 'ratchet identity key pair'.

In the case where the key pair is initially generated, the public
and private parts are only `ref()`'ed once in [0].
In the case where the key pair is read from the disk, the public
and private parts are `ref()`'ed twice, first when decoded in [1] resp.
[2] and a second time in [3].

When `omemo_on_disconnect()` is called we were `unref()`'ing the parts
twice, before this patch. First in [4], a second time in [5] resp. [6].

Now we do the second `unref()` already when loading.

[0] `signal_protocol_key_helper_generate_identity_key_pair()`
[1] `curve_decode_point()`
[2] `curve_decode_private_point()`
[3] `ratchet_identity_key_pair_create()`
[4] `ratchet_identity_key_pair_destroy()`
[5] `ec_private_key_destroy()`
[6] `ec_public_key_destroy()`

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2024-06-19 16:01:46 +02:00
Steffen Jaeckel
9640670f0f Less GString usage
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2024-06-19 16:01:46 +02:00
Steffen Jaeckel
848acdd1fa Improve const correctness
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2024-06-19 16:01:46 +02:00
Michael Vetter
cee92b0a70 Use variable name in buffer_remove_entry()
We assign it just above.
2024-06-19 15:27:51 +02:00
Michael Vetter
ebcb198f09 Fix statusbar display of active tab
When using `/statusbar tabmode actlist` and `/statusbar self user` then we get `[00:23] [user]` and now `[00:23] [1:user]` where `1` is the active tab. The active tab is only displayed with fulljid.

This commit fixes 7d290b04d.

Fix https://github.com/profanity-im/profanity/issues/1980
2024-06-19 13:20:00 +02:00
Michael Vetter
c32aac7644 statusbar: dont query setting twice
We already got that just a couple of lines above..
2024-06-19 13:08:27 +02:00
Michael Vetter
42876619ec Make statusbar actlist respect the /statusbar show setting
This lets users use the actlist and decide if they want to see name or
numbers.

The old behaviour can be achieved with:
```
/statusbar hide read
/statusbar hide name
/statusbar show number
/statusbar tabmode actlist
```

Fix https://github.com/profanity-im/profanity/issues/1974
2024-06-19 13:08:01 +02:00
Michael Vetter
d341705a43 Fix possible leaks in omemo_receive_message()
At that point we might have allocated memory that should be freed.
2024-06-19 11:46:50 +02:00
Michael Vetter
b04650fb1c Fix memleak in cmd_omemo_gen() 2024-06-19 11:40:23 +02:00
Michael Vetter
8a62d8e88b Fix typo in OMEMO message 2024-06-19 11:37:34 +02:00
Michael Vetter
cfd4207d93
Merge pull request #1973 from profanity-im/fix/omemo-muc-twice
Check whether we are already in an omemo session for MUCs as well
2024-06-14 13:51:56 +02:00
Michael Vetter
ca5308ae68
Merge pull request #1972 from profanity-im/fix/1970-sub-req-block
Remove subscription when reporting spam/abuse
2024-06-14 13:51:04 +02:00