We only want to have the decrypted message or the alternative body in
message->plain.
Also let's print error messages if it makes sense and log other issues.
Partly addresses the commit in the comit mesage of:
2dc0cc489c
Maybe we can make this configurable later.
So users have the freedom to be more strict.
This commit partly reverts 62018f48c5.
Example to edit trust level:
```
gpg --edit-key somekeyid
gpg (GnuPG) 2.3.4; Copyright (C) 2021 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
pub rsa4096/keyid
created: 2020-06-26 expires: 2022-06-26 usage: SC
trust: unknown validity: full
sub rsa4096/keyid
created: 2020-06-26 expires: 2022-06-26 usage: E
[ full ] (1). xmpp:user@domain.de
gpg> trust
pub rsa4096/keyid
created: 2020-06-26 expires: 2022-06-26 usage: SC
trust: unknown validity: full
sub rsa4096/keyid
created: 2020-06-26 expires: 2022-06-26 usage: E
[ full ] (1). xmpp:user@domain.de
Please decide how far you trust this user to correctly verify other users' keys
(by looking at passports, checking fingerprints from different sources, etc.)
1 = I don't know or won't say
2 = I do NOT trust
3 = I trust marginally
4 = I trust fully
5 = I trust ultimately
m = back to the main menu
Your decision? 3
pub rsa4096/keyid
created: 2020-06-26 expires: 2022-06-26 usage: SC
trust: marginal validity: full
sub rsa4096/keyid
created: 2020-06-26 expires: 2022-06-26 usage: E
[ full ] (1). xmpp:user@domain.de
Please note that the shown key validity is not necessarily correct
unless you restart the program.
gpg> quit
```
* Added logging messages (INFO if key can not be used)
* Check owner_trust < GPGME_VALIDITY_MARGINAL
The key can not be used if the owner_trust is less than MARGINAL.
@mdosch discovered that we now don't print `:` for messages from others
anymore.
Until
https://github.com/profanity-im/profanity/pull/1663#issuecomment-1114625151
is fixed lets restore the default behaviour to always add `:` in
`_win_print_internal()`.
The result will be that a stamp set to `-->` will also look like `-->:`.
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.
Fix https://github.com/profanity-im/profanity/issues/1693
```
@StefanKropp @DebXWoody please check `_handle_ox_chat()` I don't
understand what you are doing there.
1)
First plain is assigned `message->plain =
p_ox_gpg_decrypt(xmpp_stanza_get_text(ox));`
and then in the same if block you overwrite this with `message->plain =
xmpp_stanza_get_text(b);` without freeing the old value as far as I can
see.
2)
Sometimes even doing `message->plain = "OX error: No payload found";`.
Shouldn't there be a `strdup()`? I think later on we try to free the
whole message struct. So we can't mix this static things.
```
Asserting here is not the right thing to do at all.
A person could have a typo in the fingerprint. Or like in the case of
the reported bug just confuse the arguments.
An additional check for valid jid should be added later to the calling
function maybe.
Fix https://github.com/profanity-im/profanity/issues/1698
When editing multi-line messages or comments everything past the first
newline becomes invisible.
This patch fixes it by substituting a Unicode symbol for "return"
instead of printing the newline as is. On locales where it's not
available single backslash is used instead.
Dont show presence status changes by default in chat and muc windows.
Users repeatedly ask how to change this setting in the MUC.
We have it in the FAQ since a long time.
And most people I know change this setting, including me.
So it looks like it's time to change this default.
... 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>
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>
The current code is inherently racy: if screen update takes
considerable time (e.g. when working over network) and a user
performed a series of resizes the final event might get ignored and
the display will be left in inconsistent state.
Fix the race by unsetting the flag first so if the next WINCH signal
is received while display is resizing it'll be processed on the next
iteration.
Print error message from `_string_matches_one_of()` instead of forming
an error message manually that contains the same entries that were checked
in `_string_matches_one_of()`.
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
GNU Screen terminal emulator is modelled after VT100, its key bindings
for "application mode" (which profanity enables on startup) can be
seen with this: info screen "Input Translation".
* use custom memory descriptor that `abort()`s on `malloc()` failure
* use static log descriptor
* don't always re-create all contexts
* de-duplicate code of `.._connect()` and `.._register()`
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
The current code enters an infinite loop if the input string happens
to get an invalid utf-8 sequence somehow. For me it was reproducible
by running profanity in a Screen session and pressing Alt-т (cyrillic
letter).
Fix it the way borrowed from 0501e49623
where mbrlen is used for the same purposes.
When preferences do not specify a program to be used for /editor
command, try getting it from EDITOR (which POSIX.1-2017 calls one of
"variables that are frequently exported by widely used command
interpreters and applications"), fall back to "vim" if not set.
In case the user decides to ignore the validity-state of certificates
we also have to configure libcurl accordingly.
`tls.policy` can be set via
```
/account set <account> tls trust
```
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
The profanity-internal mechanism to allow connecting to a server isn't
easily portable to cURL. Therefor introduce a profanity-specific CAfile
which is managed individually and will be configured in libcurl calls.
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Fixes https://github.com/profanity-im/profanity/issues/1649
Type `>` then press tab or shift tab to autocomplete previous messages,
then type your reply and send message.
Newlines are replaced with newline followed by `> `.
A newline is added at the end so that the user can immediately type a
message without manually adding a new line.
Add tab completion for `/cmd`.
Complete the `list` and `exec` subcommands.
Didn't complete the `<jid>` part since I think it's usually used for
components and etc. Things that might not be in the roster.
Fix https://github.com/profanity-im/profanity/issues/1650
* use GLib functions to write&read compose file
* trim trailing new-line characters from compose file
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
As all parts of the code invoking the `files_get_account_data_path()`
function did the same afterwards, a function has been added with the same
behavior.
1. create path
2. `mkdir` of that path
3. return final path
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
In case we're not connected yet and press Alt+c a segfault occurred
since `conn.xmpp_conn` is dereferenced while it's still `NULL`.
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Output before:
```
11:00:00 - Annonuce OpenPGP Key for OX ~/test/testuser.pub.gpg ...
```
After:
```
11:00:00 - Annonuce OpenPGP Key for OX /home/user/test/testuser.pub.gpg ...
```
Now we expand the path so that we can check for `~` properly.
And test if the file is actually a normal file.
Set this to 0.
We might want to have this configurable later.
For now we fix the valgrind report:
```
Conditional jump or move depends on uninitialised value
xmpp_debug_verbose()
```
Which will be fixed in libstrophe > 0.11.0 by commit
28f3ce19b8
Previously it relied on AX_PYTHON_DEVEL, which in turn executes
python-config to get the build flags. However this does not work while
cross compiling because we can't execute the python-config build for the
target platform. To circumvent this problem the python build flags are
now queried via pkgconfig, which has the drawback of not having some
extra build flags, but they do not seem to be needed.
I tested this patch with the termux build system and it build without
their existing hack of injecting python after the configure step. I also
tested non cross compile build on Arch Linux and it also still works.
Fixes#851
Remove support for libsignal-protocol-c < 2.3.2.
Debian 10 uses 2.3.2, Debian 11 and 12 use 2.3.3.
openSUSE from 15.2 onward uses 2.3.3.
Fedora since 28 uses 2.3.2.
We should be good.
When a `see-other-host` stream-error is received we try to re-connect to
the other host. Erroneously this also started the `reconnect_timer`.
This lead to the behavior that in cases where e.g. the login failed
we try to reconnect instead of bailing out with an error.
This commit fixes the wrong behavior by not starting the `reconnect_timer`.
Fix 0e58509c16
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
It shouldn't happen that we get the presence stanza without a resource.
https://datatracker.ietf.org/doc/html/rfc6120
```
Implementation Note: It is the server's responsibility to deliver
only stanzas that are addressed to the client's full JID or the
user's bare JID; thus, there is no need for the client to check
the 'to' address of incoming stanzas. However, if the client does
check the 'to' address then it is suggested to check at most the
bare JID portion (not the full JID), since the 'to' address might
be the user's bare JID, the client's current full JID, or even a
full JID with a different resourcepart (e.g., in the case of so-
called "offline messages" as described in [XEP-0160]).
```
Let's not segfault though.
Close https://github.com/profanity-im/profanity/issues/1630
The original intention of the code was that in case archive_id is not set, NULL should be inserted. What is
inserted however is an empty string. This causes the condition to not insert messages with non-unique
archive_id insert only one message in total and ignore all further ones (if NULL was there, the condition
would work properly). And this in turn causes chat history not work properly.
This commit makes the SQL condition work properly and therefore fixes chat history.
Fixes#1589.
Like mentioned on the review at
https://github.com/profanity-im/profanity/pull/1605 I don't ge why
@DebXWoody changed the code like he did.
I changed it to something that made more sense to me now.
Instead of looking for headline in two places and checking for pubsub in
a headline place (only).
I didn't check this deeply. And still have a feeling that this is not
the best way to go. But I didn't read the XEP yet.
Added a TODO to the code regarding this too.
A quick skimming through https://xmpp.org/extensions/xep-0107.html
doesn't show me anything regarding headline. So I really don't see why
this needs to go here.
Hopefully @DebXWoody checks this in the future. But since he didn't
react on the PR I decided to make some adjustments myself so we can
merge it.
* Remarks in the Merge Request (ac_reset, help)
* Defines in iq.c
* Mood help and null check
* Added additional information about tab key in CMD_DESC.
* Added additional null check
We came into the carbons checking code when we received `<private
xmlns="urn:xmpp:carbons:2"/>`. Which actually marks a message to _not_
be a carbon.
In this code we also make sure that carbons only come from us.
If not we don't call the message handler code.
So we should actually only check for `<sent xmlns='urn:xmpp:carbons:2'>`
and `<received xmlns='urn:xmpp:carbons:2'>`.
Thanks pukkamustard and Holger.
Fixes https://github.com/profanity-im/profanity/issues/1614
gcc-12 detects redundant check against array of arrays as:
src/plugins/python_api.c: In function ‘python_api_register_command’:
src/plugins/python_api.c:199:31: error: the comparison will always evaluate as ‘true’ for the address of ‘c_arguments’ will never be NULL [-Werror=address]
199 | while (c_arguments[i] != NULL && c_arguments[i][0] != NULL) {
| ^~
src/plugins/python_api.c:161:15: note: ‘c_arguments’ declared here
161 | char* c_arguments[args_len == 0 ? 0 : args_len + 1][2];
| ^~~~~~~~~~~
gcc-12 detects redundant check against array of arrays as:
src/plugins/callbacks.c: In function ‘_free_command_help’:
src/plugins/callbacks.c:85:26: error: the comparison will always evaluate as ‘true’ for the address of ‘args’ will never be NULL [-Werror=address]
85 | while (help->args[i] != NULL && help->args[i][0] != NULL) {
| ^~
In file included from ./src/ui/ui.h:44,
from ./src/command/cmd_defs.h:42,
from src/plugins/callbacks.c:41:
./src/command/cmd_funcs.h:48:12: note: ‘args’ declared here
48 | gchar* args[128][2];
| ^~~~
* Fix `src/command/cmd_funcs.c:9463:9: error: ignoring return value of
‘write’ declared with attribute ‘warn_unused_result’
[-Werror=unused-result]`
* Free memory earlier and on less places
* Check for succesful open() and write()