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

5235 Commits

Author SHA1 Message Date
John Hernandez
9a68aab011 /url save and /url open refactoring
Additional changes: jid.c minor refactoring
2023-05-11 09:44:55 +02:00
IsaacM88
ecdeb750f3 Add ability to disable avatar publishing
Add "/avatar disable" to comply with point "3.5 Publisher Disables
Avatar Publishing" in XEP-0084.

src/command/cmd_defs.c:2416
Add "disable" argument. Reword the "/avatar" command description
so it flows better.

src/command/cmd_ac.c:1101
Add "disable" to the "/avatar" autocomplete dictionary.

src/command/cmd_funcs.c:9277
Split "/avatar" commands into two groups with an if statement; those
with a parameter and those without. "cons_bad_cmd_usage()" is in both
groups, which is messy. "disable" has similar logic to "set", but it
includes a failure message.

src/xmpp/avatar.c:152
"avatar_publishing_disable()" uses the same logic to publish metadata
as in "avatar_set()".

src/xmpp/avatar.c:238
Add a message to inform users when they do not receive an avatar after
using "/avatar get" and "/avatar open". In case of a failure, the user
will be subscribed to future avatar updates as long as they continue
to use their current instance of profanity. Adding
"caps_remove_feature()" after "cons_show()" will unsubscribe the user
from avatar updates and prevent the user from downloading an avatar
unexpectedly hours later without issuing an "/avatar" command.

src/xmpp/stanza.c:2698
The new "disable" function follows the same logic as
"stanza_create_avatar_metadata_publish_iq()".
2023-05-02 14:45:54 -06:00
Michael Vetter
f4d418a95f
Merge pull request #1838 from H3rnand3zzz/fix/omemo-trust-notification
Improve OMEMO messages
2023-04-19 17:53:27 +02:00
Michael Vetter
3be09147d7
Merge pull request #1840 from H3rnand3zzz/fix/plugins-unload
Fix `/plugins update`
2023-04-19 17:52:39 +02:00
John Hernandez
a54e5413ca Fix /plugins update
Before it tried to unload the plugin first and check the output.
But if broken plugin was loaded, then it couldn't unload it,
so before it require uninstall and install after it,
making update useless for plugin development purposes.

Unload is part of the uninstall so no unload is needed inside of the cmd function.

Refactoring of cmd_plugins_update.
2023-04-19 03:29:23 +02:00
John Hernandez
26e97d4e80 Improve OMEMO messages 2023-04-19 00:34:17 +02:00
Michael Vetter
f20dbcff09 Fix memleak in _inp_rl_linehandler
Introduced in 59b99fece.
2023-04-18 21:30:05 +02:00
Michael Vetter
abaf96dcef Fix memleak in stanza_create_caps_query_element
Got introduced with 5d3c8ce7c.
2023-04-18 20:26:24 +02:00
John Hernandez
96ddb2399e Add logging consistency
Since MUC private messages are not logged by design,
part where this logging happening is removed to add consistency.

Add explanation in comment.
2023-04-18 18:19:47 +02:00
John Hernandez
5a1f2dedd3 Fix /log level crash
Fix crash caused by `/log level` command.

Minor refactoring of command function.
2023-04-18 18:16:57 +02:00
Michael Vetter
4933d4e4f3
Merge pull request #1827 from H3rnand3zzz/feature/sessions-alarm
New Feature: Session Alarm
2023-04-18 14:43:01 +02:00
John Hernandez
07cc19ce10 Add sessions_alarm
Introduce new feature: sessions_alarm.

Added new account setting: max_connections. On exceeding this number,
user will get an alert. If number is less than 1, no alert will happen.

Tests altered to fit new feature.
2023-04-18 14:28:20 +02:00
John Hernandez
59b99fece8 Don't add the same command twice to history
Expected behaviour
When you type
/command
/command
it should be just 1 entry in the history.

Behaviour
All the entries were saved.

Behaviour is changed by introducing check. Before adding to history,
entry now is compared to the last history entry.
2023-04-17 11:29:47 +02:00
Michael Vetter
d17bcf619c Format code with clang-format 16 2023-04-14 21:45:21 +02:00
Michael Vetter
a99a4fad3e
Merge pull request #1823 from H3rnand3zzz/fix/msg-crash
Fix memory corruption crash
2023-04-14 13:14:01 +02:00
John Hernandez
899b26b3bc Cleanup p_ox_gpg_decrypt
In OX implementation gpgme's buffer remains untouched, thus not leading to the crash.

But code can be shorter and more concise.
2023-04-13 17:17:25 +02:00
John Hernandez
5e8f1f9c85 Fix memory corruption crash
Under certain circumstances setting plain_str[len] to 0 might lead to crash
and it does not follow the best practices as well.

This change allows better handling of buffer copying and prevents crash.
2023-04-13 17:16:55 +02:00
John Hernandez
5b8b9074a2 Add nickname support for /roster remove
Add support of name/nickname instead of only JID for `/roster remove` command.

Add tests for it as well.
2023-04-13 16:41:21 +02:00
Michael Vetter
ef3810638f iq: initialize os and os_txt
Let's set this to NULL.

Someone was using `picaur` and got an error about potential
uninitialization. Even though the code is fine let's set this to NULL to
make the compiler happy.

The strange thing was that building manually on the same system worked.

Related to 2e43b0ae62.
2023-04-11 20:19:49 +02:00
Michael Vetter
93fa8467ef
Merge pull request #1822 from H3rnand3zzz/fix/iq-os
Hotfix stanza release
2023-04-11 11:26:45 +02:00
John Hernandez
2e43b0ae62 Fix releases of os and os_txt stanzas
If custom client is not set and include_os is true,
stanzas might be released without initializiting.

This commit fixes it by introducing an additional check
on usage of custom client.

Related to commit e52ca2fbaa
2023-04-10 21:26:10 +02:00
Michael Vetter
e3820d7037 Add limitation info about /statusbar chat user|jid
While testing https://github.com/profanity-im/profanity/pull/1817
we found that:

```
/statusbar show name (I have this off by default
/msg someone where I chose someone in my roster that has a nick assigned
/statusbar chat jid
```

Will only take effect upon creation or redraw of that tab.
Reason is that we do this in create_tab to limit building this
dynamically.

Let's leave it like it is but add a note to users.
Not worth build that string all the time.
2023-04-10 20:22:40 +02:00
John Hernandez
7d290b04d5 Fixes Statusbar tabs and Cleanup
- Fixes statusbar tabs.
Bug: Statusbar used nickname if it was set in roster,
irrelevant to /statusbar chat setting.
Expected behaviour would be using this setting set as "user" to show nickname,
and to show jid with "jid" setting.
Other solution is to give a user control over it with another settings.
- _status_bar_draw_maintext cleaned up, no changes to behaviour
2023-04-10 16:28:44 +02:00
John Hernandez
0740d692dc Improve titlebar flexibility
Before this change, only nickname or JID (if no nickname set) is shown in the titlebar.
Change allows to alter nickname/JID preference
using already implemented /titlebar show jid|name setting.
If both are set to "show", then it is displayed in "nickname <JID>" format.
2023-04-10 11:04:20 +02:00
Michael Vetter
64cb52bef5 Rewrite description for clientid 2023-04-09 18:26:40 +02:00
Michael Vetter
e52ca2fbaa
Merge pull request #1815 from H3rnand3zzz/feature/the-client-switcher
Feature: Allow setting client identification name/version manually
2023-04-09 18:24:23 +02:00
John Hernandez
5d3c8ce7c1 Allow setting client identification name/version manually
Add changes allowing user to switch client name and version.

Useful for enhancing user privacy.

Minor cleanup.
2023-04-09 14:17:01 +02:00
Martin Dosch
e1ffc64a65 User proper ellipsis char
As stated in
https://github.com/profanity-im/profanity/pull/1820#issuecomment-1498083383
profanity uses "..." (three dots) in a lot of places instead the proper
ellipsis char "…".
2023-04-09 12:19:18 +02:00
Steffen Jaeckel
0cf79848e9 add /statusbar tabmode actlist
The existing way how active tabs are displayed didn't allow showing more
than 10 tabs. This patch adds a mode where the statusbar shows a
comma-separated list of tabs which were active since the last time viewed.
This view is inspired by how `irssi` shows the active tabs, therefore
it is also called `actlist`.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-04-08 18:38:36 +02:00
Steffen Jaeckel
7271898541 fix display of a "list type" in a form if there's no value assigned yet
It is possible, that a server sends a form with a field as follows, which
has no (default) value assigned.

```
<field label="foo" type="list-single" var="bar">
  <option label="a"><value>a</value></option>
  <option label="b"><value>b</value></option>
  <option label="c"><value>c</value></option>
</field>
```

This patch fixes profanity to show that list. Before this patch
profanity showed nothing.

I stumbled over this while running the `/room config` command inside
a newly created muc on the `sure.im` XMPP server.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-04-04 11:22:00 +02:00
Steffen Jaeckel
74415ae71d refactor into array of a struct
...instead of having two separate arrays.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-04-04 10:58:52 +02:00
Steffen Jaeckel
0242576d7c only create hashtable once
Before this change the same hashtable was re-created each time one used the
auto-completion feature.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-04-04 10:58:52 +02:00
Steffen Jaeckel
af6f468cb7 fix memory leak
`found` was leaked before

This was somehow missed in e9aaba938b

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-04-04 10:58:52 +02:00
Michael Vetter
6b597f6608 Fix typos 2023-04-03 17:27:37 +02:00
Michael Vetter
a086cfbc78
Merge pull request #1808 from MarcoPolo-PasTonMolo/fix/empty_window_after_reconnect
Fix empty window after reconnect
2023-04-03 17:16:47 +02:00
Michael Vetter
46c1262b91
Merge pull request #1809 from MarcoPolo-PasTonMolo/fix/no-ac-for-reconnect-now
Add autocomplete for the /reconnect command
2023-04-03 17:15:35 +02:00
Daniel Santos
c7f05c9ebf Fix typos and update codespell configuration
* Fix typos.
 * Add words that are not typos to codespell's ignore words list and
 ignore regex.
 * Make codespell ignore URIs.
 * Make `make doublecheck` throw no error.

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2023-04-03 13:25:25 +01:00
MarcoPolo-PasTonMolo
24ba431ed7 Add autocomplete for the /reconnect command
After typing `/reconnect ` and pressing tab nothing appeared where in
reality, it should have been autocompleted to `/reconnect now`
2023-04-02 22:06:17 +03:00
MarcoPolo-PasTonMolo
ce688f6737 Fix empty window after reconnect
Sometimes after a reconnect the current window would get cleared. This
was a deliberate change to fix the profanity window looking all garbled
up after providing the passphrase for a gpg key using pinentry-curses.

Fixes https://github.com/profanity-im/profanity/issues/1556
2023-04-02 21:53:12 +03:00
Michael Vetter
f2c83fa8ce
Merge pull request #1801 from alexandre1985/editor-with-arguments
Editor executable support flags
2023-03-31 16:01:22 +02:00
Daniel Santos
12fda4226b Add editor executable to CMD_SYN
* Add missing text of how to set editor in CMD_SYN

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2023-03-31 13:55:58 +01:00
John Hernandez
407905cfc5 Fix OTR
Fix OTR: carbon in stanza breaks OTR and prevents it from starting and working properly.
2023-03-31 12:30:51 +02:00
John Hernandez
99c9f150f6 Fix PGP
Fix of PGP and potentially other encryption methods by calling correct function that would initiate them in case if someone writes.
2023-03-31 12:30:51 +02:00
Daniel Santos
007f623ad8 Editor executable support flags
* Make editor executable into a string to be able to support
   (multiple) flags.
 * Change /help executable to suit this new feature

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2023-03-30 21:44:26 +01:00
Michael Vetter
732cbbfefc Add WIN_VCARD to win_get_tab_identifier()
Thanks to 12b997c5f3 we already found a
place where we should add this missing window type.
AFAIK there can be only one vcard window.
2023-03-23 10:33:54 +01:00
Michael Vetter
ac440e72d7 Adapt to new g_string_free() usage
Somehow this must have been overlooked when doing
e59c401c84.
2023-03-23 10:33:50 +01:00
Michael Vetter
12b997c5f3 ui: make it easier to find non covered window types
Rewrite `win_get_title()` to using switch without a default case. So the compiler warns us
(`enumeration value ‘WIN_XXX’ not handled in switch`)
in case we add a new window type (WIN_CHAT, WIN_PRIV etc) and forget to
adapt this function.

Add assert() in the end to make compiler happy when he realizes there
the function might have no return value (`control reaches end of
non-void function`). This should ever be reached.

Replace the default value of `win_to_string()`, `win_get_tab_identifier()` as
well, and replace it with an assert.

See discussion started at https://github.com/profanity-im/profanity/pull/1799#discussion_r1142444684
2023-03-23 10:20:04 +01:00
Michael Vetter
e59c401c84 Adapt to g_string_free glib 2.75.3 change
glib 2.75.3 changes warning behaviour of `g_string_free()`.
See:
* https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3219
* https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3226

Use this opportunity to replace the use of GString with
`g_strdup_printf()` where possible.
Otherwise correctly take the return value of `g_string_free()`
which is nicer anyways.
2023-03-21 10:53:10 +01:00
Steffen Jaeckel
2936b09a63 change OMEMO QR code 0 bits to 'space'
This makes the generated QR code a lot better recognizable in my case.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-03-12 17:39:57 +01:00
Steffen Jaeckel
091987db94 fix #1797
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-03-12 17:37:21 +01:00