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

5001 Commits

Author SHA1 Message Date
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
MarcoPolo-PasTonMolo
1afe2aad24 Fix not autocompleting nicks with '/'
Remove check for '/' at the beginning of the line before autocompleting
and make it fallback to command autocompletion if no nicks found.

Fixes https://github.com/profanity-im/profanity/issues/1474
2022-03-03 09:59:21 +02: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
cdb8383260 Remove strange block from ox autocomplete
Not sure what this should do.
Can't see what kind of key we want to complete here.
`/ox help` also doesn't list anything that needs a key.
2022-02-25 20:09:09 +01:00
Michael Vetter
a086d3cd16 Remove useless comment 2022-02-25 20:07:47 +01:00
Michael Vetter
62eedb1cd5 Fix memleak in cmd_export 2022-02-24 12:02:13 +01:00
Michael Vetter
6d17b36605 ox: expand file and check for existance before trying to announce
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.
2022-02-24 11:57:25 +01:00
Michael Vetter
8173878bc7 ox: remove else case 2022-02-24 11:49:33 +01:00
Michael Vetter
144742cb70 ox: add autocomplete for /ox announce 2022-02-24 11:41:53 +01:00
Michael Vetter
423105085a ox: adjust formatting 2022-02-24 11:11:49 +01:00
Michael Vetter
9705e11527 ox: standardize log output 2022-02-24 11:10:23 +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
Michael Vetter
1c96115f97 Allow utf8 in occupants char 2021-10-22 16:54:05 +02:00
Michael Vetter
fa2881fcea Allow utf8 in roster room private char 2021-10-22 16:54:05 +02:00
Michael Vetter
8fc359ba2d Allow utf8 in roster rooms char 2021-10-22 16:54:05 +02:00
Michael Vetter
7faf15a18c Allow utf8 in roster private char 2021-10-22 16:54:05 +02:00
Michael Vetter
83ee4a27cb Allow utf8 in roster resource char 2021-10-22 16:54:02 +02:00
Michael Vetter
a668ca45b7 Allow utf8 in roster contact char 2021-10-22 16:23:18 +02:00
Michael Vetter
59063aa3b4
Merge pull request #1601 from MarcoPolo-PasTonMolo/master
Add /correct-editor command
2021-10-22 12:38:39 +02:00
MarcoPolo-PasTonMolo
da3a6d8743 Move declaration and definition of win_get_last_sent_message to the correct place 2021-10-22 10:24:51 +03:00
MarcoPolo-PasTonMolo
6b0f15a1c9 Remove autocomplete for /correct-editor
We decided that it was better to remove autocomplete for this command,
since adding it only introduced problems and the command can still
function perfectly without autocomplete.
2021-10-21 17:21:00 +03:00
Michael Vetter
91898597dd Allow utf8 in roster header char
This and the following commits should make a couple of more configs
allow utf8 chars so people can use their weird icons :-)

We did the same for the otr/omemo/pgp indicators at:
1f8b1eb740
5cf6ee1bc6
2021-10-21 15:30:01 +02:00
MarcoPolo-PasTonMolo
cd16264d2b Export common code to helper functions 2021-10-17 20:31:36 +03:00
Michael Vetter
46c8245af9 Format new register code correctly 2021-10-13 21:32:44 +02:00
Michael Vetter
e0e45b7b24
Merge pull request #1574 from binex-dsk/master
Add in-band account registration
Fix https://github.com/profanity-im/profanity/issues/199
2021-10-13 21:19:22 +02:00
swirl
0653200965 registration: memory leaks, error checking 2021-10-13 15:02:05 -04:00
swirl
feaa770444 fixed crashes when server doesn't support registration 2021-10-10 15:43:14 -04:00
MarcoPolo-PasTonMolo
09f5cadf1a Add /correct-editor command 2021-10-07 15:53:12 +03:00
Michael Vetter
f21595597f Format code correctly 2021-10-05 10:01:27 +02:00
MarcoPolo-PasTonMolo
97551aa131 Fix history timestamp
Fixes https://github.com/profanity-im/profanity/issues/1423

Oldest stanza is fetched like before but now the timestamp is generated by creating date_time_from_iso8601 and then to_local, instead of trusting that the timestamp is in utc.
The procedure previously was stamp = time_val_from_iso8601() then date_time = date_time_from_utc(stamp) then local_date_time = to_local(date_time)
2021-10-05 09:56:24 +02:00
Michael Vetter
242696f09a Fix fromat string in statusbar
Regards https://github.com/profanity-im/profanity/issues/1597#issuecomment-930540261
2021-09-29 23:25:38 +02:00
Michael Vetter
e5b6258c99 Fix wrong format string in titlebar
See
fd9ccec8dc
and
https://github.com/profanity-im/profanity/issues/1597#issuecomment-930426764.
2021-09-29 20:17:41 +02:00
Michael Vetter
3120636367 Add more help about how to use plugins
`/plugins install` installs a plugin to
`.local/share/profanity/plugins`.
And also loads it.
When a plugin is loaded it will automatically be added to the `profrc`
file like this:

```
[plugins]
load=my.py;
```

On the next start Profanity will try to load this plugin again unless
`/plugin unload my.py` is called.
2021-09-29 17:32:54 +02:00
Michael Vetter
b0e0012c22 Fix /plugins update ~/dir
If `~/dir` exists profanity exits for me.
Whole code for updating plugins from a dir isn't even implemented. Even
though some messgages suggest otherwise.

Remove this and only allow updating of one file.
2021-09-29 17:32:54 +02:00
Michael Vetter
25820235fe List globally available plugins
Packagers can package https://github.com/profanity-im/profanity-plugins
or another collection of plugins to `/usr/local/share/profanity/plugins`
(python) and `/usr/local/lib64/profanity`  (c).
`/plugins` will list these globally available plugins now along with the
ones thare are installed (`~/.local/share/profanity/plugins`) and loaded.

Regards https://github.com/profanity-im/profanity/issues/945
2021-09-29 17:32:54 +02:00
Michael Vetter
7486e22b77 Look for plugins to install in global location
Two options to install plugins.
Mention the whole path:
`/plugins install ~/src/profanity-plugins/my.py`

Mention only the plugin name:
`/plugins install my.py`

The latter will look in `/usr/local/share/profanity/plugins/` for the
file and copy it over to `~/.local/share/profanity/plugins`.

At first I was thinking about loading the plugins from the global
location. But users most likely don't want to have all plugins activated
that an admin installs on a system.

Regards https://github.com/profanity-im/profanity/issues/945
2021-09-29 17:32:54 +02:00
Michael Vetter
ba7b6c2e96 Clean sourcepath from profrc
See 3b3a6b7a75 for sourcepath removal.
2021-09-29 17:32:54 +02:00
Michael Vetter
3b3a6b7a75 Remove /python sourcepath
I feel like this mostly is confusing people.
Also don't see much value for it.

To me it looks like a regular workflow is like:
```
/plugin install ~/src/profanity-plugins/my.py
```

The whole thing with sourcepath, install (which also loads without
having that described anywhere), load etc is confusing.
Also each plugin file that is present in
`.local/share/profanity/plugins` will then be auto loaded. Which means
after installation.
2021-09-29 15:49:05 +02:00
Michael Vetter
fd9ccec8dc Fix wrong format string in titlebar encryption
Fix https://github.com/profanity-im/profanity/issues/1597

Thanks @debacle.
2021-09-29 15:48:09 +02:00
Michael Vetter
8e43ab05da Fix typos 2021-09-22 13:01:55 +02:00
Michael Vetter
31d72689c7 Add more keybindings to /help navigation 2021-09-15 11:29:20 +02:00
Michael Vetter
1dbe1a33b4 cmd_funcs: Use glib function 2021-09-09 09:53:23 +02:00
Michael Vetter
8c4ce7a939 notifier: Use glib function 2021-09-09 09:48:04 +02:00
Michael Vetter
0a8d69dc46 Enable whole word only notifications by default
Set PREF_NOTIFY_MENTION_WHOLE_WORD to true.

If I'm not mistaken the _mucwin_print_mention() / get_mentions()
functions only work correctly since
6bc440c6f7.

This changed the behaviour for users.
They got notified when their nick was `kaffee` and in the message the
string `kaffeekanne` occured.

Setting `/notify room mention word_whole` corrected this.

So my idea is that only now the mention function work correctly. And to
have a good default behaviour we should set the `word_whole` on by
default.

Regards https://github.com/profanity-im/profanity/issues/1578
2021-09-08 12:04:34 +02:00
Michael Vetter
c397657061 Change attentionflag shortcut to alt+v
alt+f is the default readline shortcut for forward one word.

Regards https://github.com/profanity-im/profanity/issues/1580
2021-08-31 22:25:29 +02:00
Paul Fariello
314d0034ed Fix memleak 2021-08-20 15:33:31 +02:00
Paul Fariello
35814d8bd0 Log error received while publishing OMEMO device list 2021-08-20 15:32:00 +02:00
Paul Fariello
6f33706e92 Cosmetic 2021-08-20 15:29:30 +02:00
Paul Fariello
4d93df4aba OMEMO: Fix precondition-not-met handling 2021-08-19 10:02:07 +02:00
Paul Fariello
d8cee98cc7 Create devicelist if it doesn't exists 2021-08-19 10:02:07 +02:00
Paul Fariello
0b6cf20183 OMEMO: try device list creation and reconfigure on precondition-not-met 2021-08-19 10:02:07 +02:00
Paul Fariello
46fe69de9b Ensure devicelist access model is configured before updating it 2021-08-19 10:02:06 +02:00
swirl
87d2c95c87 registration: remove auth param and excess functions 2021-08-17 14:09:48 -04:00
Michael Vetter
f53b4353fd REGISTRATION FIXED 2021-08-17 14:09:48 -04:00
swirl
8a6f1b52d7 progress on fixing registration
doesnt segfault on register, but aborts when you type after registering

need to find a way to disconnect later
2021-08-17 14:09:48 -04:00