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.