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

1215 Commits

Author SHA1 Message Date
Michael Vetter
569e37f018 Update copyright to 2024 2024-01-22 16:03:48 +01:00
Steffen Jaeckel
f458d6ebdf Fix when feature discovery is finished
Feature discovery was marked as finished once we received a reply to the
initial request. The discovery mechanism allows to delegate the real
feature discovery to another service running on different domain and those
requests are created dynamically.

This was another instance causing the warning message described in #1940

Fixes #1940 (once more)

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-12-28 19:21:27 +01:00
Steffen Jaeckel
dc0f2acb9a Simplify usage of roster_get_display_name()
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-12-12 18:27:11 +01:00
Steffen Jaeckel
b4c088232e Improve const correctness
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-12-12 18:27:09 +01:00
Steffen Jaeckel
bac24601da Introduce equals_our_barejid()
Instead of always repeating the same pattern, introduce a helper function.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-12-12 18:27:02 +01:00
Steffen Jaeckel
835ea397ac Tidy up some code
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-12-12 18:26:21 +01:00
Steffen Jaeckel
847a86de50 add connection_get_jid()
Use a singleton `Jid` inside the connection instead of always re-creating
a `Jid` from the same string.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-12-12 18:26:21 +01:00
Steffen Jaeckel
629cd33e2f Reset internal flag
Reset the `received_disco_items` flag when initializing the iq module.

This has caused the console error message "Server doesn't support MAM"
sometimes on reconnect.

Fixes #1940

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-12-12 16:31:42 +01:00
Steffen Jaeckel
c3ed0c3262 Only handle MAM response if window still exists
Before this patch the following scenario lead to a segfault:
1. open a window that sends a MAM request
2. fast enough close that window again before the MAM response was
   processed
Once the MAM response is received we'd call `_mam_rsm_id_handler()`
from the `_iq_handler()` and `window` would point to a non-existant window
which leads to a segfault.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-12-12 16:31:42 +01:00
Steffen Jaeckel
2b51675e89 Save SM queue on /reconnect now
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-12-12 16:31:42 +01:00
Steffen Jaeckel
ff32f51f4f Fix libstrophe verbosity level always being set to 0 on start
Fixup/revert of e55f6d7f4d

This line had been added because an earlier release of libstrophe missed
the initialisation of that variable, which has since been fixed.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-12-12 16:30:19 +01:00
Steffen Jaeckel
64046bcdf3 Fix some things regarding char* vs. gchar*
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-12-09 15:09:52 +01:00
Michael Vetter
45fe1be58f
Merge pull request #1902 from H3rnand3zzz/feature/improved-history
Change DB structure
2023-11-06 22:41:36 +01:00
Steffen Jaeckel
4c26462827 Ensure instances of auto types are initialized
Follow-up of #1913

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-11-06 22:22:35 +01:00
John Hernandez
a671cff964 Improve XEP-0308 compliance
Disallow correcting historical MUC messages, as the XEP-308 requires.

Previous changes introduce problem with
"Illicit LMC attempt from conference@server/user for message from user"

During investigation it was revealed that XEP does not recommend support
of historical MUC messages correction.

```
When used in a Multi-User Chat (XEP-0045) context,
corrections must not be allowed (by the receiver)
for messages received before the sender joined the room -
particularly a full JID leaving the room
then rejoining and correcting a message SHOULD be disallowed,
as the entity behind the full JID in the MUC may have changed.
```
https://xmpp.org/extensions/xep-0308.html#rules

XEP details mentioned by @jubalh
Bug discovered and solution improved by  @jaeckel
2023-11-06 22:04:53 +01:00
John Hernandez
3c8b4acac4 Fix typos, correct grammar 2023-10-14 18:07:52 +02:00
Michael Vetter
634cb586d9
Merge pull request #1892 from ike08/improvement/muc-title-behaviour
Improve MUC title behaviour for roster, statusbar, and titlebar
2023-10-09 09:47:03 +02:00
IsaacM88
23c6936398 Improve MUC title behaviour for roster, statusbar, and titlebar
## Abstract

Continuation of https://github.com/profanity-im/profanity/pull/1881

Give all MUC title commands a consistent command structure and appearance.

- `/roster room use name|jid` and `/roster room show|hide server` are now `/roster room title bookmark|jid|localpart|name`
- `/statusbar room room|jid` is now `/statusbar room title bookmark|jid|localpart|name`
- `/statusbar show|hide jid` and `/statusbar show|hide name` are now `/titlebar room title bookmark|jid|localpart|name`

Fix both bugs mentioned in https://github.com/profanity-im/profanity/pull/1881

### src/ui/mucwin.c:mucwin_generate_title

Called by each command to generate a properly formatted title. It checks for "name" first because "name" is the default preference for each command. The last if-statement sets the title to "localpart" for special cases when the title should be "localpart" instead of the user-defined preference.

## Testing

### Preparation

Remove preferences that will interfere with testing.

```
sed -i "/roster.rooms.title=/d" profrc
sed -i "/statusbar.room.title=/d" profrc
sed -i "/titlebar.muc.title=/d" profrc
sed -i "/roster.rooms.use.name=/d" profrc
sed -i "/roster.rooms.server=/d" profrc
sed -i "/statusbar.room=/d" profrc
sed -i "/titlebar.muc.title.jid=/d" profrc
sed -i "/titlebar.muc.title.name=/d" profrc
sed -i "/roster.rooms.by=/d" profrc
```

### Command Definitions

| Test | Window |
| :--- | :--- |
| `/help roster` | - /roster room title bookmark\|jid\|localpart\|name<br>- room title bookmark\|jid\|localpart\|name : Display the bookmark name, JID, JID localpart, or room name as the roster title for MUCs.<br>- *No /roster show\|hide server*<br>- *No /roster room use jid\|name* |
| `/help statusbar` | - /statusbar room title bookmark\|jid\|localpart\|name<br>- room title bookmark\|jid\|localpart\|name : Display the bookmark name, JID, JID localpart, or room name as the title for MUC tabs.<br>- *No /statusbar room jid\|room* |
| `/help titlebar` | - /titlebar room title bookmark\|jid\|localpart\|name<br>- room title bookmark\|jid\|localpart\|name : Display the bookmark name, JID, JID localpart, or room name as the MUC window title.<br>- *No /titlebar show\|hide jid\|name* |

### Autocomplete

| Test | Command line |
| :--- | :--- |
| `/roster room <TAB>` | Autocompletes `title` |
| `/roster room title <TAB>` | Autocompletes `bookmark\|jid\|localpart\|name` |
| `/statusbar room <TAB>` | Autocompletes `title` |
| `/statusbar room title <TAB>` | Autocompletes `bookmark\|jid\|localpart\|name` |
| `/titlebar room <TAB>` | Autocompletes `title` |
| `/titlebar room title <TAB>` | Autocompletes `bookmark\|jid\|localpart\|name` |
| `/roster room <TAB>` | Does not autocomplete `use`, `show`, or `hide` |
| `/roster room use <TAB>` | Does not autocomplete `name` |
| `/roster room show <TAB>` | Does not autocomplete `server` |
| `/roster room hide <TAB>` | Does not autocomplete `server` |
| `/statusbar room <TAB>` | Does not autocomplete `jid` or `room` |
| `/titlebar show <TAB>` | Does not autocomplete `jid` or `name` |
| `/titlebar hide <TAB>` | Does not autocomplete `jid` or `name` |

### Set Preferences

| Test | Window | profrc |
| :--- | :--- | :--- |
| `/roster room title bookmark` | Roster MUCs will display 'bookmark' as their title. | roster.rooms.title=bookmark |
| `/roster room title jid` | Roster MUCs will display 'jid' as their title. | roster.rooms.title=jid |
| `/roster room title localpart` | Roster MUCs will display 'localpart' as their title. | roster.rooms.title=localpart |
| `/roster room title name` | Roster MUCs will display 'name' as their title. | roster.rooms.title=name |
| `/roster room title invalid` | Invalid usage, see '/help roster' for details. | |
| `/statusbar room title bookmark` | Displaying 'bookmark' as the title for MUC tabs. | statusbar.room.title=bookmark |
| `/statusbar room title jid` | Displaying 'jid' as the title for MUC tabs. | statusbar.room.title=jid |
| `/statusbar room title localpart` | Displaying 'localpart' as the title for MUC tabs. | statusbar.room.title=localpart |
| `/statusbar room title name` | Displaying 'name' as the title for MUC tabs. | statusbar.room.title=name |
| `/statusbar room title invalid` | Invalid usage, see '/help statusbar' for details. |  |
| `/titlebar room title bookmark` | MUC windows will display 'bookmark' as the window title. | titlebar.muc.title=bookmark |
| `/titlebar room title jid` | MUC windows will display 'jid' as the window title. | titlebar.muc.title=jid |
| `/titlebar room title localpart` | MUC windows will display 'localpart' as the window title. | titlebar.muc.title=localpart |
| `/titlebar room title name` | MUC windows will display 'name' as the window title. | titlebar.muc.title=name |
| `/titlebar room title invalid` | Invalid usage, see '/help titlebar' for details. |  |
| `/roster room use jid` | Invalid usage, see '/help roster' for details. |  |
| `/roster room use name` | Invalid usage, see '/help roster' for details. |  |
| `/roster room show server` | Invalid usage, see '/help roster' for details. |  |
| `/roster room hide server` | Invalid usage, see '/help roster' for details. |  |
| `/statusbar room jid` | Invalid usage, see '/help statusbar' for details. |  |
| `/statusbar room room` | Invalid usage, see '/help statusbar' for details. |  |
| `/titlebar show jid` | Invalid usage, see '/help titlebar' for details. |  |
| `/titlebar hide jid` | Invalid usage, see '/help titlebar' for details. |  |
| `/titlebar show name` | Invalid usage, see '/help titlebar' for details. |  |
| `/titlebar hide name` | Invalid usage, see '/help titlebar' for details. |  |

### Display Set Preferences

| Test | Window |
| :--- | :--- |
| /prefs ui | - Roster rooms title (/roster) : name<br>- Room tab display (/statusbar) : name<br>- MUC window title (/titlebar) : name |

### Test MUC Window

#### Test: without *name* preference, without *room name* field

```
/join muc@dmn.im
/room config
/field1 ""
/form submit
/quit
```

| Test | Roster | Statusbar | Titlebar |
| :--- | :--- | :--- | :--- |
| `/join muc@dmn.im` | muc<span/>@dmn.im | muc<span/>@dmn.im | muc<span/>@dmn.im |
| `/room config` |  | muc<span/>@dmn.im conf | muc<span/>@dmn.im config |
| `/field2 edit` |  |  | muc<span/>@dmn.im config * |
| `/msg tst` | tst | muc<span/>@dmn.im/tst | muc<span/>@dmn.im/tst |
| `/roster room by service` | muc |  |  |

#### Test: with *name* preference, without *room name* field

```
/roster room title name
/statusbar room title name
/titlebar room title name
/save
/quit
```

| Test | Roster | Statusbar | Titlebar |
| :--- | :--- | :--- | :--- |
| `/join muc@dmn.im` | muc<span/>@dmn.im | muc<span/>@dmn.im | muc<span/>@dmn.im |
| `/room config` |  | muc<span/>@dmn.im conf | muc<span/>@dmn.im config |
| `/field2 edit` |  |  | muc<span/>@dmn.im config * |
| `/msg tst` | tst | muc<span/>@dmn.im/tst | muc<span/>@dmn.im/tst |
| `/roster room by service` | muc |  |  |

#### Test: without *name* preference, with *room name* field

```
sed -i "/roster.rooms.title=/d" profrc
sed -i "/statusbar.room.title=/d" profrc
sed -i "/titlebar.muc.title=/d" profrc
/join muc@dmn.im
/room config
/field1 "my_room"
/form submit
/quit
```

| Test | Roster | Statusbar | Titlebar |
| :--- | :--- | :--- | :--- |
| `/join muc@dmn.im` | my_room | my_room | my_room |
| `/room config` |  | my_room conf | my_room config |
| `/field2 edit` |  |  | my_room config * |
| `/msg tst` | tst | my_room/tst | my_room/tst |
| `/roster room by service` | my_room |  |  |

#### Test: with *name* preference, with *room name* field

```
/quit
/roster room title name
/statusbar room title name
/titlebar room title name
/save
/quit
```

| Test | Roster | Statusbar | Titlebar |
| :--- | :--- | :--- | :--- |
| `/join muc@dmn.im` | my_room | my_room | my_room |
| `/room config` |  | my_room conf | my_room config |
| `/field2 edit` |  |  | my_room config * |
| `/msg tst` | tst | my_room/tst | my_room/tst |
| `/roster room by service` | my_room |  |  |

#### Test: with *localpart* preference

```
/quit
/roster room title localpart
/statusbar room title localpart
/titlebar room title localpart
/save
/quit
```

| Test | Roster | Statusbar | Titlebar |
| :--- | :--- | :--- | :--- |
| `/join muc@dmn.im` | muc | muc | muc |
| `/room config` |  | muc conf | muc config |
| `/field2 edit` |  |  | muc config * |
| `/msg tst` | tst | muc/tst | muc/tst |
| `/roster room by service` | muc |  |  |

#### Test: with *bookmark* preference, without *bookmark name*

```
/quit
/roster room title bookmark
/statusbar room title bookmark
/titlebar room title bookmark
/save
/quit
/bookmark add muc@dmn.im
```

| Test | Roster | Statusbar | Titlebar |
| :--- | :--- | :--- | :--- |
| `/bookmark join muc@dmn.im` | muc<span/>@dmn.im | muc<span/>@dmn.im | muc<span/>@dmn.im |
| `/room config` |  | muc<span/>@dmn.im conf | muc<span/>@dmn.im config |
| `/field2 edit` |  |  | muc<span/>@dmn.im config * |
| `/msg tst` | tst | muc<span/>@dmn.im/tst | muc<span/>@dmn.im/tst |
| `/roster room by service` | muc |  |  |

#### Test: with *bookmark* preference, with *bookmark name*

```
/quit
/bookmark remove muc@dmn.im
/bookmark add muc@dmn.im name "my_bookmark"
```

| Test | Roster | Statusbar | Titlebar |
| :--- | :--- | :--- | :--- |
| `/bookmark join muc@dmn.im` | my_bookmark | my_bookmark | my_bookmark |
| `/room config` |  | my_bookmark conf | my_bookmark config |
| `/field2 edit` |  |  | my_bookmark config * |
| `/msg tst` | tst | my_bookmark/tst | my_bookmark/tst |
| `/roster room by service` | my_bookmark |  |  |

#### Test: with *jid* preference

```
/quit
/roster room title jid
/statusbar room title jid
/titlebar room title jid
/save
/quit
```

| Test | Roster | Statusbar | Titlebar |
| :--- | :--- | :--- | :--- |
| `/join muc@dmn.im` | muc<span/>@dmn.im | muc<span/>@dmn.im | muc<span/>@dmn.im |
| `/room config` |  | muc<span/>@dmn.im conf | muc<span/>@dmn.im config |
| `/field2 edit` |  |  | muc<span/>@dmn.im config * |
| `/msg tst` | tst | muc<span/>@dmn.im/tst | muc<span/>@dmn.im/tst |
| `/roster room by service` | muc |  |  |

### Test Contact Chat Window Title

#### Test: without contact nick

```
/roster add tst@dmn.im
```

| Test | Titlebar |
| :--- | :--- |
| `/msg tst@dmn.im` | tst<span/>@dmn.im |

#### Test: with contact nick

```
/roster add tst@dmn.im my_tst
```

| Test | Titlebar |
| :--- | :--- |
| `/msg my_tst` | my_tst <tst<span/>@ike.snikket.chat> |

### Test Preference Upgrade

#### Test /roster

| Test | profrc |
| :--- | :--- |
| `sed -i '/\[ui\]/a\roster.rooms.use.name=name' profrc` | Original key removed. |
| `sed -i '/\[ui\]/a\roster.rooms.use.name=' profrc` | Original key removed. |
| `sed -i '/\[ui\]/a\roster.rooms.server=' profrc` | Original key removed. |
| `sed -i '/\[ui\]/a\roster.rooms.use.name=jid' profrc` | Original key removed.<br>roster.rooms.title=jid |
| `sed -i '/\[ui\]/a\roster.rooms.use.name=jid' profrc`<br>`sed -i '/\[ui\]/a\roster.rooms.server=false' profrc` | Original keys removed.<br>roster.rooms.title=localpart |
| `sed -i '/\[ui\]/a\roster.rooms.use.name=jid' profrc`<br>`sed -i '/\[ui\]/a\roster.rooms.server=true' profrc` | Original keys removed.<br>roster.rooms.title=jid |
| `sed -i '/\[ui\]/a\roster.rooms.use.name=jid' profrc`<br>`sed -i '/\[ui\]/a\roster.rooms.server=' profrc` | Original keys removed.<br>roster.rooms.title=jid |
| `sed -i '/\[ui\]/a\statusbar.room=' profrc` | Original key removed. |
| `sed -i '/\[ui\]/a\statusbar.room=room' profrc` | Original key removed.<br>statusbar.room.title=localpart |
| `sed -i '/\[ui\]/a\statusbar.room=jid' profrc` | Original key removed.<br>statusbar.room.title=jid |
| `sed -i '/\[ui\]/a\titlebar.muc.title.jid=' profrc` | Original key removed. |
| `sed -i '/\[ui\]/a\titlebar.muc.title.name=' profrc` | Original key removed. |
| `sed -i '/\[ui\]/a\titlebar.muc.title.jid=true' profrc` | Original key removed. |
| `sed -i '/\[ui\]/a\titlebar.muc.title.name=true' profrc` | Original key removed. |
| `sed -i '/\[ui\]/a\titlebar.muc.title.jid=false' profrc` | Original key removed. |
| `sed -i '/\[ui\]/a\titlebar.muc.title.name=false' profrc` | Original key removed. |
| `sed -i '/\[ui\]/a\titlebar.muc.title.jid=true' profrc`<br>`sed -i '/\[ui\]/a\titlebar.muc.title.name=false' profrc` | Original key removed.<br>titlebar.muc.title=jid |
| `sed -i '/\[ui\]/a\titlebar.muc.title.jid=false' profrc`<br>`sed -i '/\[ui\]/a\titlebar.muc.title.name=true' profrc` | Original keys removed. |
| `sed -i '/\[ui\]/a\titlebar.muc.title.jid=true' profrc`<br>`sed -i '/\[ui\]/a\titlebar.muc.title.name=true' profrc` | Original keys removed. |

### Test Valgrind

No memory leaks detected relating to these changes.
2023-10-05 18:16:04 -06:00
Steffen Jaeckel
6f1ea087c8 Fix memleak.
In some cases it was possible that the `roster_pending_presence` list was
not free'd correctly.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-10-04 17:02:10 +02:00
Steffen Jaeckel
e668c4f7df Extend autoping timer on each stanza we receive.
Sometimes the server is too busy sending other stanzas or our connection is
saturated because of something else, so the pong arrives too late.
Prevent the autoping disconnect event by extending the timeout
each time a stanza is received.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-10-04 17:02:10 +02:00
Steffen Jaeckel
ca2df180d8 Introduce a shared implementation for keyfile loading
Instead of copy&pasting the same code over again, use a common
implementation.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-09-04 09:59:09 +02:00
Michael Vetter
492efc432c Display headline sender 2023-08-11 15:56:26 +02:00
Michael Vetter
215e35b198 Fix my email address 2023-07-31 16:42:45 +02:00
Michael Vetter
22b1d14b67 Add helper function to create version string
And remove all the duplicate code.

Depending on the situation prof_get_version() will return:
* 0.13.1
* 0.13.1dev
* 0.13.1dev.master.69d8c1f9
2023-07-25 20:58:15 +02:00
Michael Vetter
a963ff4d24 mam: check if we get 'first' stanza before usage
Fix https://github.com/profanity-im/profanity/issues/1868
2023-07-18 16:44:44 +02:00
John Hernandez
865a056315 Cleanup g_strfreev() to auto_gcharv
Include some additional minor cleanups
2023-07-13 17:05:07 +02:00
John Hernandez
029f1caa52 Cleanup jid_destroy to auto_jid
Remove unused variables
Apply minor cleanups
2023-07-13 17:05:07 +02:00
John Hernandez
8304ac86ff g_free() to auto_gfree, introduce auto_guchar
Fix 11 potential mem leaks in theme.c
2023-07-13 17:04:59 +02:00
John Hernandez
3a4cd7da48 Cleanup and mem leak fix
Improve usage of `gchar` and `char` by setting them correctly
Increase usage of `auto_gchar` and `auto_char`
Fix 2 mem leaks (rosterwin.c, avatar.c)
2023-07-12 17:43:33 +02:00
John Hernandez
e1d137f4e6 Change char->free to auto_char char for autocleanup
Replace `gchar` and `g_free` to `auto_gchar`
Correct certain  `char` functions/variables to `gchar`

Related to #1819.

Edited by @jubalh.
2023-07-11 13:26:37 +02:00
John Hernandez
4a70f5f513 Cleanup char* to auto_gchar gchar* for prefs_get_string
Necessity explained in #1819
2023-07-03 16:06:27 +02:00
Michael Vetter
6247c28e31
Merge pull request #1842 from H3rnand3zzz/feature/plugins-download
New Feature: Plugins Download
2023-06-06 18:35:18 +02:00
Steffen Jaeckel
88d383b052 Fix double-free of values.
The strings have to be dup'ed, otherwise we'll free them twice.

Fixes #1855

Introduced by b6bb50ceb2

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-06-04 13:39:03 +02:00
Steffen Jaeckel
b6bb50ceb2 Fix use-after-free
introduced in 8d3c1f79ac

This fixes #1852

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-05-21 11:02:14 +02:00
Steffen Jaeckel
c0861eed49 Improve debug logging
Tell the user that a MAM request will be issued delayed instead of showing
a warning that MAM isn't supported by the server.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-05-21 11:00:32 +02:00
Steffen Jaeckel
638b15c6d9 Fix memleak
introduced in 5d3c8ce7c1

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-05-21 10:59:13 +02:00
Steffen Jaeckel
d8eea87f60 Fix -Werror=maybe-uninitialized
When compiling with `CFLAGS="-O2 -fexceptions -Wp,-D_FORTIFY_SOURCE=2"`, as
done per default when creating an AUR package e.g. via `makepkg`, this
error is produced.

Refactor `stanza_create_mam_iq()` in order to fix said warning-turned-into-
an-error.

Edit by jubalh:
I still think the error message is a false positive. But this commit improves the
code a lot.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-05-12 08:39:29 +02:00
Steffen Jaeckel
860dd22bc5 Fix potential double-free
introduced in 8d3c1f79ac

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-05-12 08:39:16 +02:00
John Hernandez
9a68aab011 /url save and /url open refactoring
Additional changes: jid.c minor refactoring
2023-05-11 09:44:55 +02:00
Michael Vetter
ea35a4ceb0
Merge branch 'master' into cleanup/gchar-char 2023-05-11 08:45:46 +02:00
Steffen Jaeckel
8d3c1f79ac fix memory leaks
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-05-10 18:12:11 +02:00
Steffen Jaeckel
8cd53acfd7 fix /reconnect now
This fixes #1846
Issue introduced by a0aa26b6fa

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-05-10 18:12:11 +02:00
John Hernandez
7f3fca2bd0 Cleanup: gchar as gchar instead of char
Use gchar instead of char in most of the cases where gchar is intended.

Reason: improve compatibility and stability. Issue #1819

Minor refactoring.
2023-05-04 16:15:09 +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
abaf96dcef Fix memleak in stanza_create_caps_query_element
Got introduced with 5d3c8ce7c.
2023-04-18 20:26:24 +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
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
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
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