1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-23 21:45:30 +00:00
Commit Graph

4944 Commits

Author SHA1 Message Date
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
Steffen Jaeckel
705b6f7806 use g_mkdir_with_parents() instead of home-baked solution
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-03-14 13:17:46 +01:00
Steffen Jaeckel
b8e46552bf add files_file_in_account_data_path()
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>
2022-03-13 14:15:02 +01:00
Steffen Jaeckel
764a7fb71b prevent segfault
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>
2022-03-13 13:21:40 +01:00
Steffen Jaeckel
07e584734d Alt+e is already bound, use Alt+c
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-03-13 13:21:40 +01:00
Michael Vetter
198ff3e9be Add stat.h to editor
Fix on openbsd:
`src/tools/editor.c:55:36: error: 'S_IRWXU' undeclared (first use in
this function)`
2022-03-04 21:09:24 +01:00
Michael Vetter
9578b03bf6 Include errno header in editor.c 2022-03-04 14:26:18 +01:00
MarcoPolo-PasTonMolo
3f78af2591 Move get_message_from_editor to appropriate file and change its keybinding 2022-03-03 12:56:03 +01:00
MarcoPolo-PasTonMolo
0fdaad7cbf Add hotkey for sending readline text to editor 2022-03-03 12:55:57 +01:00
Michael Vetter
b8711d5627 Add /subject editor command
Allow editing the MUC subject using external editor.

Use `/subject editor`.

Fix https://github.com/profanity-im/profanity/issues/1638
2022-02-26 10:10:33 +01:00
Michael Vetter
e55f6d7f4d Set libstrophe log verbosity
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
2022-02-21 21:53:33 +01:00
j.r
5676159aa5
Fix python executed during configure
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
2022-02-18 19:45:31 +01:00
Michael Vetter
57fb10f0bf Fix typos in comments 2022-02-18 18:59:32 +01:00
Michael Vetter
33106ecf9c build: remove otr3 support
All the distributions I checked have libotr 4.1.1 now.
2022-02-18 14:01:28 +01:00
Michael Vetter
3f8720d70f build: remove support for old libsignal
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.
2022-02-18 14:01:28 +01:00
Steffen Jaeckel
7a2af5e3ad fix handling of connection errors
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>
2022-02-08 19:52:13 +01:00
Michael Vetter
6d1c661e21 Remove banned muc member from member list
If I'm understing everything right the member should be removed here.
muc_members_update() seems to have been writen for the same purpose.

Fix https://github.com/profanity-im/profanity/issues/1594
2022-02-02 21:57:44 +01:00
Steffen Jaeckel
569525c6c7 Fix off-by-one
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-02-01 17:41:19 +01:00
Steffen Jaeckel
ad87bdffc2 add missing IPv6 handling
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-02-01 16:56:26 +01:00
Steffen Jaeckel
196f20a7d5 add fall-back for older GLib versions
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-02-01 16:33:22 +01:00
Steffen Jaeckel
0e58509c16 handle see-other-host XMPP stream error
Fixes #1628

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-02-01 15:52:08 +01:00
Steffen Jaeckel
9cf78e59d5 auto-format
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-02-01 15:01:28 +01:00
Steffen Jaeckel
20a8ef7a3e session: combine internal free-functions
`_session_free_saved_details()` remains as it's still required alone

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-02-01 15:01:28 +01:00
Michael Vetter
e31e2877fc command: change user mood clearing message 2022-02-01 00:03:13 +01:00
Michael Vetter
af7a4257f5 command: rename /mood clean to /mood clear
As per suggestion of @mdosch.
2022-02-01 00:00:32 +01:00
Michael Vetter
b766807bc3 command: adapt mood description 2022-01-30 18:25:21 +01:00
Stefan Kropp
7a4cfc14d1 XEP-0107: User Mood - Clean mood
* Bugfix in mood_autocomplete (wrong parameter)
 * Implemented /mood clean
 ______________________________________
/ Profanity! THE XMPP client with mood \
\ support!                             /
 --------------------------------------
   \
    \
        .--.
       |o_o |
       |:_/ |
      //   \ \
     (|     | )
    /'\_   _/`\
    \___)=(___/
2022-01-30 18:14:03 +01:00
Michael Vetter
b1929068ff presence: guard against invalid input
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
2022-01-27 11:52:23 +01:00
Juraj Mlich
c5b370bffc database.c: fix inserting messages to chat logs if archive_id is empty
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.
2021-12-31 17:45:45 +01:00
Michael Vetter
d4c9a98d71 omemo: log when no pubsub
Closes https://github.com/profanity-im/profanity/issues/1621
2021-12-13 17:11:30 +01:00
Michael Vetter
b67054aa39
Merge branch 'master' into xep/xep0107-user-mood 2021-12-06 13:49:04 +01:00
Michael Vetter
6c3e6a5262 xep-0107: adapting the pubsub/headline code
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.
2021-12-06 13:44:04 +01:00
Michael Vetter
67fea6f3c4 xep-0107: adjust help 2021-12-06 13:38:46 +01:00
DebXWoody
2f3de0eb0d xep-0107: code review
* 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
2021-12-06 13:33:21 +01:00
DebXWoody
23e886ed5e Add xep-0107: User Mood support
Implementation of XEP 0107 - User Mood
2021-12-06 13:32:54 +01:00
Michael Vetter
7a8f0e4873
Merge pull request #1610 from nandesu-utils/master
Fix message encryption for sender devices
2021-11-30 15:31:51 +01:00
Michael Vetter
9efceb8240
Merge pull request #1616 from trofi/master
gcc-12 fixes
2021-11-26 16:43:32 +01:00
Sergei Trofimovich
f0a39a4b66 python_api.c: enlarge c_arguments array to avoid OOB write
Code below explicitly refers past `args_len`th element:

        c_arguments[args_len][0] = NULL;
        c_arguments[args_len][1] = NULL;

Let's always allocate space for `NULL`. Noticed by Steffen Jaeckel.
2021-11-26 07:54:01 +00:00
Michael Vetter
2f7317cc18 Fix carbons criteria
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
2021-11-25 15:33:49 +01:00
Sergei Trofimovich
a77a57a6a4 src/plugins/python_api.c: drop redundant NULL pointer check
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];
          |               ^~~~~~~~~~~
2021-11-18 22:29:11 +00:00
Sergei Trofimovich
753d9dbbdb src/plugins/callbacks.c: drop redundant NULL pointer check
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];
          |            ^~~~
2021-11-18 22:27:20 +00:00
Michael Vetter
9a9122c148 Cleanup _get_message_from_editor a bit
* 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()
2021-11-01 12:24:28 +01:00
nlfx
c41749b124
Fix OMEMO /sendfile on non-glibc systems 2021-11-01 03:59:44 +01:00
nandesu-utils
fee23b55f0
Refined sender device acquirement
Now the sender devices are acknowledged only after omemo is loaded. That
is, after key generation has been completed or identity has been loaded.
2021-10-29 01:27:38 +09:00
Steffen Jaeckel
d2ba0e0833 auto-format
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2021-10-27 22:45:44 +02:00
Steffen Jaeckel
7f646e3668 use new libstrophe API
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2021-10-27 22:45:44 +02:00
Steffen Jaeckel
ffc0b49ab1 first step to remove libmesode
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2021-10-27 22:45:44 +02:00
nandesu-utils
17d62921e9
Acquire sender's device list on connection
After generation of an identity we observe that `omemo_ctx.device_list`
has an entry for sender's jid. But on application restart it is absent
thus messages are not encrypted for the rest set of sender devices.

This commit fixes this by applying code for acquiring the aforementioned device list after the connection.
2021-10-28 04:23:41 +09:00
Michael Vetter
56846a5b77
Merge pull request #1607 from profanity-im/utf8indicatorchar
Allow more UI indicator signs to be utf8 "characters"
2021-10-22 17:08:14 +02:00
Michael Vetter
a9bcc8e8bd Allow utf8 in occupants header char 2021-10-22 16:54:05 +02:00