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

5387 Commits

Author SHA1 Message Date
Michael Vetter
8075b32ebc Align avatar behaviour with urlopen
`/executable avatar` now also uses cmdtemplate and parse %p.
It seems to me that the `/avatar` command was actually completely broken
on master.
2023-05-10 09:34:48 +02:00
Michael Vetter
daf3d193e2 Remove parsing of /avatar cmd
This is done in `/executable avatar set` since d7848e38b.
The command help also didn't mention this anymore.
Seems like it was forgotten to remove the actual parsing of this.
2023-05-10 09:21:32 +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
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
Steffen Jaeckel
7167760bdd fix #1761 by changing the implementation from recursive
... to an iterative approach

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-03-11 15:05:03 +01:00
Steffen Jaeckel
e99c4b7128 simplify some code
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-03-11 15:05:03 +01:00
Steffen Jaeckel
92eed34fb3 remove compat code
We already depend on libstrophe >= 0.12, so this code can go.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-03-11 15:05:03 +01:00
IsaacM88
d043d53948 Fix duplicate download IDs.
Fixes https://github.com/profanity-im/profanity/issues/1794

Explanation
The problem is the download's identifier. Downloads are given an ID so they can be referenced later when their progress changes. Currently, the download's ID is the download's URL. When you download the same file twice, you have two downloads with the same ID. Download progress updates are shown on the first of both downloads with the same ID.

Solution
Change the download's ID from its URL to a random number. A random ID is generated when get_random_string() is called from cmd_funcs.c. Several other functions are updated to cope with the new ID format.
2023-03-09 15:02:26 -07:00
Michael Vetter
4887d21a11 cmd: Update MAM help 2023-02-15 15:40:51 +01:00
Michael Vetter
0c24271a63
Merge pull request #1789 from MarcoPolo-PasTonMolo/fix/autocompletion_after_MAM
Fix quote and url autocompletion for MAM and history
2023-02-15 15:18:59 +01:00
MarcoPolo-PasTonMolo
b64411a3f9 Fix MAM not loading some recent messages
Reverse a small change from commit e886ba0 that caused this issue.
Fixes https://github.com/profanity-im/profanity/issues/1790
2023-02-14 00:25:11 +02:00
MarcoPolo-PasTonMolo
6d266984a4 Fix quote and url autocompletion for MAM and history
After adding MAM quote and url autocompletion wouldn't pick up messages
from MAM or history(from DB) or would have them in the wrong order. This
commit fixes that.

Fixes https://github.com/profanity-im/profanity/issues/1770
2023-02-13 23:40:58 +02:00
Michael Vetter
1105571584
Merge pull request #1788 from profanity-im/minor-improvements
Minor improvements
2023-01-30 09:07:17 +01:00
Steffen Jaeckel
b602d619f6 prevent setting invalid combination of libstrophe flags
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-01-27 17:04:48 +01:00
the xhr
e1072c8640 Remove space to match clang coding style 2023-01-26 17:43:04 +01:00
the xhr
714add207b Add macro for possible NULL prints and use it on known sports
The macro is effective on OpenBSD and basically a no op on other platforms.
Use it for one existing and the other known debug statements.
2023-01-26 17:42:52 +01:00
the xhr
6ceafac6aa Check if string is NULL and print placeholder instead
OpenBSD's kernel warns about NULL printfs.  Fix this with a standard check.
2023-01-26 17:39:46 +01:00
Steffen Jaeckel
901ef21727 simplify some code
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-01-26 11:50:02 +01:00
Steffen Jaeckel
f406384c34 fix libstrophe timer-callback usage
The timer will be auto-removed if the callback returns `0`. The way it was
done before breaks some internals of libstrophe.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-01-26 11:49:29 +01:00
Steffen Jaeckel
99ffaf0a00 introduce auto_gcharv
This also fixes memory leaks in `_omemo_autocomplete()`.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-01-19 10:40:25 +01:00
Steffen Jaeckel
b535921484 introduce auto_jid and refcounting in Jid
This also fixes a memory leak from within `_handle_groupchat()` in [0].

[0] src/xmpp/message.c

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-01-19 10:40:25 +01:00
Steffen Jaeckel
1a85448bf2 improve const correctness
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-01-18 20:11:13 +01:00
Steffen Jaeckel
e886ba0c6f fix more memory leaks
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-01-18 20:11:13 +01:00
Steffen Jaeckel
698aefa005 fix memory leaks in OMEMO
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-01-18 20:11:13 +01:00
Steffen Jaeckel
302d0dd576 let account_new() take ownership of passed values
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-01-18 20:02:46 +01:00
Steffen Jaeckel
a0aa26b6fa add now option to /reconnect command
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-01-18 20:02:46 +01:00
Steffen Jaeckel
a45f05a45e slightly improve command_defs[]
* make the struct `const`
* use designated initializers
* remove `CMD_NOxyz` macros
* fix function-pointer correctness of `sub_func[]`

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-01-18 20:02:46 +01:00
Steffen Jaeckel
e9aaba938b minor changes
* fix typo
* less code duplication
* less `GString` usage
* more `auto_gchar` usage
* document connecting to servers supporting SASL ANONYMOUS
* ignore valgrind output

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-01-18 20:02:46 +01:00
Steffen Jaeckel
b1b6c6f62d add /strophe command to modify libstrophe-specific settings
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-01-18 17:04:41 +01:00
Michael Vetter
3adc399da0 Update copyright year 2023-01-10 10:37:25 +01:00
MarcoPolo-PasTonMolo
525ec11e46 Make /url save autocomplete filenames after a url
Previously after the url if you pressed tab, even if you typed out a
filepath, profanity would erase that and cycle through url autocomplete
results.

This patch solves that and autocompletes filepaths after the url.

Fixes https://github.com/profanity-im/profanity/issues/1783
2022-12-27 14:39:31 +02:00
Michael Vetter
413b5f9bc9 Work around different clang-format versions
Locally I have clang-format 15.0.2.
Our CI runs ubuntu-20.04 so it has 10.0.

Seems like a default value changed but I can't find it.
When I still had clang-format 14.x everything was fine and checking:
https://releases.llvm.org/15.0.0/tools/clang/docs/ReleaseNotes.html#clang-format

I only see irrelevant things.

Someone on the llvm IRC channel sais "there is no guarantee" and "maybe
a regression or intended change".
But seems like noone knows which setting could be the one we need.

Since I don't have a better solution for now I will just edit this by
hand to apply to the clang-format version we have on the CI.
Will look into updating this one.

But in any case it would be best if the configuration file could have
this setting so formatting works the same for all contributors.
2022-10-26 15:15:37 +02:00
Martin Dosch
a33d027f49 Improve MAM loading string.
Replaced three dots `...` by a proper ellipsis `…`.
Removed plenking (space between `messages` and ellipsis.
2022-10-22 16:09:39 +02:00
MarcoPolo-PasTonMolo
135a4cd9e6 Fix segfault when loading from MAM
When loading messages from MAM profanity would segfault. Reason was that
we were freeing the timestamp of messages when displaying them and we
needed it for loading MAM.
2022-10-22 12:56:15 +03:00
Michael Vetter
a04031cec9 Apply codigng style on new MAM code 2022-10-21 16:55:18 +02:00
Michael Vetter
5ebd7df7e8 Let users scroll up again
We removed this so that we don't get "[SCROLLED]" in the titlebar when
there is actually not more text available.

But now with MAM we can enable this again so that the user can scroll up
and load more text out of the database.

Maybe this also could use a check.

This reverts commit c84b1b5e5d.
2022-10-21 16:52:07 +02:00
Michael Vetter
688191f5e1 Fix merge mistake in database
When doing 3bdc14dbcf I forgot an `,`
before encryption
2022-10-21 16:39:44 +02:00
Paul Fertser
6a47266f0b Fix GSList handling in new MAM code
This patch was provided by @paulfertser and applied by @jubalh.
Thanks a lot Paul!
2022-10-21 16:28:30 +02:00
Michael Vetter
a74a3a4312 Fix merge mistake 2022-10-21 13:49:07 +02:00
Michael Vetter
3bdc14dbcf Merge MAM improvements from #1724
I think this PR already solves and improves the MAM situation a lot.

What's @MarcoPolo-PasTonMolo still wanted to do in this branch is:
* MAM for mucs
* Check if url and quotes autocompletion works fine
* Check if the api still works fine
* Resolve conflicts

Conflicts are solved with this commit.

MAM for mucs can be another feature PR.

The rest we can check while being on master. And more people can help
testing.
2022-10-21 13:30:43 +02:00
Marouane L
f934c5b59f
Add vCard support
Only nicknames, photos, birthdays, addresses, telephone numbers, emails,
JIDs, titles, roles, notes, and URLs are supported

Due to the synopsis array not having enough space, `/vcard photo
open-self` and `/vcard photo save-self` are not documented properly in
the synopsis section of the `/vcard` command, but they are documented in
the arguments section

Fixed memory leak in vcard autocomplete (thanks to debXwoody)
2022-10-18 23:24:30 +01:00
Stefan Kropp
5401c1b634 Fix autocompletion for lastactivity
`/lastactivity` used autocompletion for /status instead.
There was no get/set autocompletion thus user had to write `/lastactivity
get` to get the proper results.

Original fix by Stefan at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1021028
Proper commit message and adapted patch by jubalh.
Co-authored-by: jubalh@iodoru.org
2022-10-17 17:12:29 +02:00
Michael Vetter
65aff65596 Improve /msg and /win autocompletion
Let /win and /msg both autocomplete roster nickname and actual barejid
2022-10-17 16:53:58 +02:00
Michael Vetter
aa9ba63f5f
Merge pull request #1760 from techmetx11/fix/1759-async
Replace `call_external`'s implementation with an async one
2022-10-12 12:45:07 +02:00
Marouane L
2d11a35ee1 Spawn external programs asynchronously
Drawback is that we can't check the exitcode anymore.
But we were unsure why/when we need this, see:
https://github.com/profanity-im/profanity/pull/1760/files#r980868708

Fixes https://github.com/profanity-im/profanity/issues/1759
2022-10-12 12:25:00 +02:00
Michael Vetter
a86e86cce0 Fix first start detection
Only display help message on first start.
This is a fixup for:
27a5c9d287
2022-10-11 16:39:55 +02:00
Michael Vetter
4b2bbe59ea Format Maxis commit properly 2022-09-29 11:11:01 +02:00
Maxi Wuttke
021927a549 Use G_GSIZE_FORMAT instead of "%lu" for portability
In the function stanza_create_avatar_metadata_publish_iq, use the format
string `"%"G_GSIZE_FORMAT` instead of "%lu", for an argument of type
gsize.
2022-09-29 10:46:32 +02:00
Michael Vetter
7ffe55e980
Merge pull request #1756 from sgn/python-3.11
plugin: python: fix build for Python 3.11
2022-09-25 22:34:25 +02:00
Đoàn Trần Công Danh
5a72fefe89 plugin: python: fix build for Python 3.11
From Python 3.11, PyFrameObject has been changed into opaque struct.
We need to access those fields via API.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
2022-09-24 12:49:12 +07:00
Viachaslau Khalikin
0cb46460b3
fix: print when no plugins installed
Signed-off-by: Viachaslau Khalikin <viachaslau.vinegret@outlook.com>
2022-09-20 04:30:11 +03:00
Viachaslau Khalikin
d75e5c1c28
add: autocompletion plugins arguments
support for "update" and "uninstall"

Signed-off-by: Viachaslau Khalikin <viachaslau.vinegret@outlook.com>
2022-09-20 04:00:44 +03:00
Viachaslau Khalikin
0ceb8c53c3
fix: filtering of the available global plugins
For command /plugins :
Don't print files that do not correspond to the plugins design

Signed-off-by: Viachaslau Khalikin <viachaslau.vinegret@outlook.com>
2022-09-20 01:46:51 +03:00
Viachaslau Khalikin
cc7231a43b
minor: using cons_bad_cmd_usage() instead of the manual handling
Signed-off-by: Viachaslau Khalikin <viachaslau.vinegret@outlook.com>
2022-09-19 18:08:54 +03:00
Viachaslau Khalikin
6cb6823aed
Fix typo which catched by codespell 2022-09-19 00:45:29 +03:00
Viachaslau Khalikin
45fa60e7e2
Print unloaded plugins which already installed
Signed-off-by: Viachaslau Khalikin <viachaslau.vinegret@outlook.com>
2022-09-19 00:29:24 +03:00
Viachaslau Khalikin
dd1a9a1e50
Fix handle cmd_plugins_uninstall without args
Signed-off-by: Viachaslau Khalikin <viachaslau.vinegret@outlook.com>
2022-09-19 00:12:49 +03:00
Steffen Jaeckel
25e56fb494 less strdup()+free()
Improvement of f8ff93234e

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-09-07 12:42:15 +02:00
Steffen Jaeckel
095d40d3bd tell the user to which file we're logging
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-09-07 10:04:00 +02:00
Steffen Jaeckel
099b443dc8 Tell user where the downloaded file is stored
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-09-07 10:04:00 +02:00
nandesu-utils
e1ed012f72 support for formatting in avatar executable
in before it just used the input command line as it was but this fixes
this by adding formatting using `format_call_external_argv` which is
already used in `url open` executable.
2022-09-06 12:51:27 +02:00
nandesu-utils
056b19eb91 refactored call_external code
unluckily here the code neglected the fact that glib will set an error
to a location that was pointed by the error pointer if it is not null.
but it was of an undefined value hence profanity crashed. now it is null
as it must be.

also spawn error is returned when glib could not spawn the task for
some reason like the executable file does not exist but if the exit
status was non-zero it neglected the exit error and tried to output a
spawn error instead. now we check whether the process that we
instantiated has exited successfully

also now code uses `g_spawn_check_wait_status` which
`g_spawn_check_exit_status` has been aliased to.
2022-08-27 16:25:15 +03:00
MarcoPolo-PasTonMolo
d692aec32e Don't notify on MAM messages 2022-08-20 23:03:46 +03:00
MarcoPolo-PasTonMolo
a704838152 Handle late delivery 2022-08-20 22:48:02 +03:00
MarcoPolo-PasTonMolo
4b9ff6d4dc Apply corrections when getting messages from db 2022-08-12 12:13:47 +03:00
Steffen Jaeckel
65acffcf07 fixup 11f52ad547
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-08-08 17:15:58 +02:00
Steffen Jaeckel
11f52ad547 integrate XEP-0198 Stream-Management
* save SM state and send-queue entries on disconnect
* restore SM state and send-queue entries on reconnect

fixes #698

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-08-08 13:39:58 +02:00
Michael Vetter
932e7826aa common: dont use GError twice
We need to use a new one or call `g_clear_error()`.

Fix segfault in https://github.com/profanity-im/profanity/issues/1738
2022-08-02 14:13:28 +02:00
Michael Vetter
9df4bd29ea Check for error before trying to append it
Related to https://github.com/profanity-im/profanity/issues/1738
2022-08-02 08:55:18 +02:00
Netboy3
4ea98c71ee Fix /autoaway command logic
Two issues were fixed in the parser logic:
* A call to cons_bad_cmd_usage() was placed at the end of the "time"
  parser section that blocked reachability to both "message" and
  "check" parser sections. This caused "/autoaway message ..." and
  "/autoaway check ..." to always fail with "Invalid usage". This
  issue was introduced in commit 3c1e4ba.
* "/autoaway message xa" with no message argument returns message
  set to (null). This should be fixed the same way as
  "/autoaway message away" was fixed in commit 3c1e4ba.
2022-07-28 11:48:38 -04:00
MarcoPolo-PasTonMolo
72f613a014 Handle MAM when chatwin gets created from incoming message 2022-07-10 12:28:14 +03:00
MarcoPolo-PasTonMolo
a2f79a19b9 Fix duplicate sent messages in db 2022-07-10 11:17:35 +03:00
MarcoPolo-PasTonMolo
85aaf40432 Have ability to scroll through history even without MAM 2022-07-10 11:17:35 +03:00
MarcoPolo-PasTonMolo
47b3e528e2 Handle scrolling down when buffer fills up 2022-07-10 11:17:35 +03:00
MarcoPolo-PasTonMolo
b03c3bda98 Cleanup 2022-07-05 11:30:04 +03:00
MarcoPolo-PasTonMolo
4d6e95d691 Add loading history message on initial MAM request
This prevents scrolling to top and initiating another MAM request while
still fetching the initial one.
Also free timestamp object in database.c
2022-07-05 11:12:29 +03:00
Michael Vetter
27a5c9d287 Display a help message upon first start of Profanity
Explaining how to register/connect/set up an account.
2022-07-05 06:57:11 +02:00
MarcoPolo-PasTonMolo
6429698f18 Fix initial MAM not displaying
Did this by waiting for a batch of MAM messages to arrive before
prepending them to the buffer. Also limited the number of messages
to fetch to 10 so that the user gets more frequent updates.
2022-07-05 00:06:04 +03:00
Michael Vetter
c8b2979dcd Exit *_incoming_msg functions when plain message is empty
Fix https://github.com/profanity-im/profanity/issues/1733
2022-07-04 16:58:16 +02:00
Michael Vetter
f30999fd51 ox: handle empty message->plain
In case we dont have plain but have body, copy this (like in
_sv_ev_incoming_pgp).
In case we have neither, return.
2022-07-04 16:40:44 +02:00
MarcoPolo-PasTonMolo
e9da694265 Add 'Loading messages' message when scrolling up 2022-07-04 12:39:59 +03:00
Michael Vetter
9ef3491228 Let slashguard ignore quoted messages
This let's us whole `/me` messages and other messages starting with `>`.

Fix https://github.com/profanity-im/profanity/issues/1732
2022-07-04 09:15:03 +02:00
MarcoPolo-PasTonMolo
97a610e915 Fech data from mam when all history gets displayed
Fetch from mam without displaying when all mam messages get received
display new messages from db.
Unstable, initial mam doesn't get displayed unless we start scrolling.
2022-07-03 21:30:02 +03:00
MarcoPolo-PasTonMolo
ea83165a35 Get messages from history when scrolling up. 2022-07-03 21:29:36 +03:00
MarcoPolo-PasTonMolo
f0202a2fe0 On new chatwin fetch mam according to guidelines.
Taken from here:
cd3e871e55
2022-07-03 21:23:07 +03:00
Michael Vetter
4818b02391
Merge pull request #1731 from profanity-im/retrieve-enc-type-from-db
Retrieve enc type from db
2022-06-29 15:58:24 +02:00
Michael Vetter
3d17ecc62b database: remove comment 2022-06-29 15:31:37 +02:00
Michael Vetter
6375b2719f database: retrieve encryption type
When we get a message from the database, also retrieve the encryption
type.
2022-06-29 15:30:54 +02:00
Michael Vetter
c84b1b5e5d Don't scroll if not needed
If we are in a window with a lot of text and press PAGE UP we scroll up
and write [scrolled] in the titlebar.

So far we also wrote [scrolled] in there even when actually nothing
happened. Like when opening a new window (/msg someone) and there is no
text inside.
2022-06-29 13:50:04 +02:00
Michael Vetter
449c7ce2ba ox: add helper message in case signcrypt doesnt work
Most likely they didnt trust/sign the key. Which is described in the
profanity-ox-setup man page.
2022-06-29 13:26:15 +02:00
Michael Vetter
b3b76d9f5c stanza: remove strange assignment 2022-06-29 12:31:06 +02:00
Michael Vetter
14a2fb6e72 accounts: deduplicate code via helper function 2022-06-29 12:30:05 +02:00
Michael Vetter
945ac79364 scripts: get rid of read variable 2022-06-29 10:34:59 +02:00
Michael Vetter
30faa6c367 chatlog: remove unused variable 2022-06-29 09:44:57 +02:00
Michael Vetter
dfc51f7ba4 database: unref date 2022-06-29 09:42:54 +02:00
Michael Vetter
ca9cc3275a Remove comment 2022-06-29 09:21:44 +02:00
Michael Vetter
4d215fc33e Move ox_gpg_public_keys description 2022-06-29 09:20:27 +02:00
Michael Vetter
a40a0f5189 Split ox functions from gpg.c to ox.c 2022-06-29 09:17:15 +02:00
Michael Vetter
974f21efdc chatlog: sort and rename some functions 2022-06-28 20:49:22 +02:00
Michael Vetter
9312333ba2 log: put static functions on top 2022-06-28 20:13:55 +02:00
Michael Vetter
38ea55431d Include xmpp.h to cafile.c
Was pulled in through log.h
2022-06-28 20:08:44 +02:00
Michael Vetter
9eec0ce26e Include common.h and xmpp.h in editor.c
That was pulled in through log.h
2022-06-28 20:08:44 +02:00
Michael Vetter
99e93f6b8b Include xmpp.h in bookmark_ignore.c
That was pulled in through log.h
2022-06-28 20:08:44 +02:00
Michael Vetter
31e6b7564e Include xmpp and message header to database.c
That was pulled in through log.h.
2022-06-28 20:08:44 +02:00
Michael Vetter
585f68f4f7 Split log.c into log.c and chatlog.c 2022-06-28 20:08:38 +02:00
Michael Vetter
c0e27f5e72 Fix formatting 2022-06-22 13:10:42 +02:00
Michael Vetter
4da322db3b Add autocompletion for /log level 2022-06-22 13:05:11 +02:00
Michael Vetter
b302c604ab Display log level information in preferences 2022-06-22 13:05:11 +02:00
Michael Vetter
ff8065eaca Rename _log_string_from_level to _log_abbreviation_string_from_level 2022-06-22 13:05:11 +02:00
Michael Vetter
5c0c386ffa Correct default log maxsize in help
This was changed in c4d7f1c29 from 1MB to 10MB.
2022-06-22 13:05:02 +02:00
Michael Vetter
3f26dd6be9 Let user change log level while running
`/log level INFO|DEBUG|WARN|ERROR` is now available.
Looks like this solves a TODO (see removed comment in source) from 2013
:-)

Works only with default log file. Not with user provided log file during
start up via the -f parameter.

Fix https://github.com/profanity-im/profanity/issues/1627
2022-06-22 12:39:44 +02:00
Michael Vetter
918d060817 Display mood preferences 2022-06-22 11:45:13 +02:00
Michael Vetter
9f13b9e939 Make mood display optional 2022-06-22 11:32:27 +02:00
MarcoPolo-PasTonMolo
f1d1a80d07 Fix build without omemo 2022-06-17 15:51:45 +03:00
MarcoPolo-PasTonMolo
e4e53d6e01 Don't forget encryption status for OX and PGP.
Use a pgp.enabled and ox.enabled array the same way that omemo.enabled
is used.

Fixes https://github.com/profanity-im/profanity/issues/1694
Fixes https://github.com/profanity-im/profanity/issues/733
2022-06-17 15:43:54 +03:00
MarcoPolo-PasTonMolo
13f1b831df Improve cmd argument parser
"" used to become " now it just becomes an empty argument.
Also if quotes appeared after a token started then if the number of
quotes in the token is n the resulting one would be a token with the
n last characters cut off, now it's fixed.

Fixes https://github.com/profanity-im/profanity/issues/497
2022-06-16 21:07:15 +03:00
Michael Vetter
35d10868f4 Reset buffer correctly 2022-06-15 15:09:38 +02:00
swirl
7276db07f4
remove memset in cons_show_qrcode
Signed-off-by: swirl <swurl@swurl.xyz>
2022-06-15 08:36:24 -04:00
swirl
7ed944254f
remove VLAs in OMEMO QR Code function
Removes the use of VLAs in favor of calloc

Signed-off-by: swirl <swurl@swurl.xyz>
2022-06-14 21:04:26 -04:00
Michael Vetter
4d6bc1adf8
Merge pull request #1717 from MarcoPolo-PasTonMolo/fix/chat-with-self-duplicate-msgs
Fix duplicate messages in chat with oneself.
2022-06-11 12:33:56 +02:00
Michael Vetter
8c313011c0 Fix typo in omemo command 2022-06-05 17:25:53 +02:00
Michael Vetter
2e85f18cd6 Use our omemo sid/fingerprint in qr code
Current clients sid/fingerprint will be shown in following format:
`xmpp:<user@server>?omemo-sid-<numerical-sid>=<omemo-fingerprint-hex-string>`

Fix https://github.com/profanity-im/profanity/issues/1320
2022-05-31 15:44:44 +02:00
MarcoPolo-PasTonMolo
91e8a89b59 Fix duplicate messages in chat with oneself.
Messages would get duplicated when you chat with yourself, worse if you
had omemo enabled the duplicated message would say something along the
lines of "Your client doesn't support OMEMO". The cause was carbons
when the message was sent from another client, whilst it was a sent
and received message when profanity was the one to send it. This commit
ignores the carbon message in the 1st case and ignores the received one
in the 2nd.

Fixes https://github.com/profanity-im/profanity/issues/1595
2022-05-31 15:55:02 +03:00
Michael Vetter
42fb8f86d9 Add command help for omemo qrcode 2022-05-30 18:04:42 +02:00
swirl
d64cb38240 Reverse QR code colors and add padding
All QR scanners should be able to recognize this, as it is now the
correct color with some padding to prevent blending.

Signed-off-by: swirl <swurl@swurl.xyz>
2022-05-30 18:04:42 +02:00
swirl
9a9a97868d implement working OMEMO QR code
TODO: We need to find a way to switch the colors of the QR code, so that
more QR readers can detect it, without "blending" the edges of the QR
code with the surrounding terminal window.

Signed-off-by: swirl <swurl@swurl.xyz>
2022-05-30 18:04:42 +02:00
Michael Vetter
cf83976b51 Add basic qrcode functions 2022-05-30 18:04:36 +02:00
Michael Vetter
010ed78b32
Merge pull request #1714 from MarcoPolo-PasTonMolo/feature/avatar-set
Add `/avatar set` command to publish avatar
2022-05-30 18:01:50 +02:00
Michael Vetter
d9e39b596b
Merge pull request #1712 from MarcoPolo-PasTonMolo/fix/1347
Update capabilities of muc on available presence
2022-05-29 16:21:45 +02:00
MarcoPolo-PasTonMolo
4839093a8b Make muc config update after form submit
Muc configuration in profanity used to not update until next login, ie:
make muc non_anonymous and members_only but be unable to start omemo
until next login. Now a disco info request is sent after forrm submit
and chatroom details are changed accordingly.

Fixes https://github.com/profanity-im/profanity/issues/1347
2022-05-27 18:51:35 +03:00
Michael Vetter
d510f3a430 Final touches for /avatar set 2022-05-27 10:46:36 +02:00
Michael Vetter
09f3c08af5 Fix description of mood 2022-05-27 09:36:41 +02:00
MarcoPolo-PasTonMolo
63f694d6a7 Respect silent nick change in mucs
Profanity would ignore the silent nick change in some places. The roster
and history would show the correct nick, new messages from the current
user and the "Autojoined <jid> as <nick>" message would show the wrong
one. This commit fixes that problem.

Fixes https://github.com/profanity-im/profanity/issues/757
2022-05-26 21:57:42 +03:00
MarcoPolo-PasTonMolo
0cff111249 Add checks for whether gdk-pixbuf exists before using avatar set 2022-05-26 21:06:27 +03:00
MarcoPolo-PasTonMolo
719f3fbee0 Fix segfault on /ox discover
`/ox discover` segfaults on some misconfigured? nodes because there are
newlines before and after some pubkey-metadata stanzas so the newlines
get treated as seperate stanzas. This commit just skips each stanza in
public-keys-list that doesn't have a fingerprint.

Fixes https://github.com/profanity-im/profanity/issues/1713
2022-05-26 19:00:56 +03:00
MarcoPolo-PasTonMolo
6a44e18853 Add /avatar set command to publish avatar
Use `/avatar set <path>` where <path> is an image file to upload a new
avatar for the current user. When the avatar is too big it gets scaled
down. Scaling code copied from dino.

Fixes https://github.com/profanity-im/profanity/issues/1687
2022-05-26 17:49:34 +03:00
MarcoPolo-PasTonMolo
4ea1ed8324 Fix room name not updating.
Now whenever the name of a room changes, either in profanity or another
client, it gets updated inside profanity.
Fixes https://github.com/profanity-im/profanity/issues/1710
2022-05-18 16:47:33 +03:00
Michael Vetter
1330ad4e1e Update copyright year 2022-05-09 15:43:33 +02:00
Michael Vetter
e17ea040c9 Log encrypted messages by default to chatlog
In case chatlogs are available lets log everything by default.
Seems like most users expect this behaviour and I agree.
2022-05-09 14:16:28 +02:00
Michael Vetter
2e76e4f0c7 ox: remove /ox sendfile because its actually not implemented 2022-05-05 23:55:37 +02:00
Michael Vetter
b16bdca726 ox: show ox preferences 2022-05-05 23:55:31 +02:00
Michael Vetter
d011d6707c ox: Add /ox log command 2022-05-05 23:41:45 +02:00
Michael Vetter
66eeccf408 ox: only process proper messages
We only want to have the decrypted message or the alternative body in
message->plain.

Also let's print error messages if it makes sense and log other issues.

Partly addresses the commit in the comit mesage of:
2dc0cc489c
2022-05-04 16:11:00 +02:00
Michael Vetter
1eaa2c1529 ox: prefix function _openpgp_signcrypt with ox_
To make the destinction clearer and easier to search.
2022-05-04 14:26:43 +02:00
Michael Vetter
54b57326b8 ox: have metadata node open
Should have been done alogn with e9f218cdf6.

Like this people who are not in the roster can get our public key and
write messages to use.
2022-05-04 13:46:02 +02:00
Michael Vetter
0500e209a6 ox: return upon invalid fingerprint 2022-05-04 13:37:12 +02:00
Michael Vetter
e5e661e92d ox: fix mistakes in p_ox_gpg_decrypt()
strcpy() can't work here because the data doesn't have to be
NULL-terminated. So let's use memcpy.

Fix memleak of plain_str.
2022-05-04 11:35:15 +02:00
Michael Vetter
281c8b7d8d Improve ox command help
Mention new man page.
Correct the usage of /ox request.
2022-05-04 00:22:18 +02:00
Michael Vetter
acedd42d78 ox: print message when /ox end is run but not started 2022-05-04 00:03:45 +02:00
Michael Vetter
58911926de ox: print more error messages to UI 2022-05-03 23:39:10 +02:00
Michael Vetter
c3deb5d325 ox: dont require marginal trust level
Maybe we can make this configurable later.
So users have the freedom to be more strict.

This commit partly reverts 62018f48c5.

Example to edit trust level:
```
gpg --edit-key somekeyid
gpg (GnuPG) 2.3.4; Copyright (C) 2021 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

pub  rsa4096/keyid
     created: 2020-06-26  expires: 2022-06-26  usage: SC
     trust: unknown       validity: full
sub  rsa4096/keyid
     created: 2020-06-26  expires: 2022-06-26  usage: E
[  full  ] (1). xmpp:user@domain.de

gpg> trust
pub  rsa4096/keyid
     created: 2020-06-26  expires: 2022-06-26  usage: SC
     trust: unknown       validity: full
sub  rsa4096/keyid
     created: 2020-06-26  expires: 2022-06-26  usage: E
[  full  ] (1). xmpp:user@domain.de

Please decide how far you trust this user to correctly verify other users' keys
(by looking at passports, checking fingerprints from different sources, etc.)

  1 = I don't know or won't say
  2 = I do NOT trust
  3 = I trust marginally
  4 = I trust fully
  5 = I trust ultimately
  m = back to the main menu

Your decision? 3

pub  rsa4096/keyid
     created: 2020-06-26  expires: 2022-06-26  usage: SC
     trust: marginal      validity: full
sub  rsa4096/keyid
     created: 2020-06-26  expires: 2022-06-26  usage: E
[  full  ] (1). xmpp:user@domain.de
Please note that the shown key validity is not necessarily correct
unless you restart the program.

gpg> quit
```
2022-05-03 23:11:25 +02:00
Stefan Kropp
c9e6a89aea Bugfix OX rpad generation
________________________________________
< No comment - should be much better now >
 ----------------------------------------
 \
  \
   \ >()_
      (__)__ _
2022-05-03 23:00:11 +02:00