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

5197 Commits

Author SHA1 Message Date
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
Stefan Kropp
62018f48c5 ox_key_is_usable - Logging and owner trust check
* Added logging messages (INFO if key can not be used)
 * Check owner_trust < GPGME_VALIDITY_MARGINAL

The key can not be used if the owner_trust is less than MARGINAL.
2022-05-03 23:00:11 +02:00
Michael Vetter
7acc044a52 ox: use glib date function in _gettimestamp and fix memleak 2022-05-03 21:26:31 +02:00
Michael Vetter
e16bff2328 ox: Use connection_create_stanza_id() instead of xmpp_uuid_gen() 2022-05-03 19:54:43 +02:00
Michael Vetter
e5998fb63e ox: implement /ox end
We also need to be able to stop an ox conversation :-)
2022-05-03 18:54:20 +02:00
Michael Vetter
c8daee8c88 ox: use iq_id_handler_add instead of xmpp_id_handler_add 2022-05-03 18:34:07 +02:00
Michael Vetter
794bd25cd9 ox: use iq_send_stanza instead of xmpp_send 2022-05-03 18:27:20 +02:00
Michael Vetter
e9f218cdf6 ox: use pubsub acces model open when announce ox public key 2022-05-03 18:20:11 +02:00
Michael Vetter
be55b16bef Restore default behaviour for stamps
@mdosch discovered that we now don't print `:` for messages from others
anymore.

Until
https://github.com/profanity-im/profanity/pull/1663#issuecomment-1114625151
is fixed lets restore the default behaviour to always add `:` in
`_win_print_internal()`.

The result will be that a stamp set to `-->` will also look like `-->:`.
2022-05-03 12:17:29 +02:00
Martin Dosch
c72c3f797c Fix autocomplete for /ox discover. 2022-05-02 17:33:01 +02:00
Michael Vetter
95686eb642 ox: add jid autocompletion for /ox request 2022-05-02 10:23:24 +02:00
Michael Vetter
82a2b17c1f Use profanity.001.log instead of profanity.log.001 for rotated logs
Rotated log files will now be: `.local/share/profanity/logs/profanity.001.log`
We only use logrotation if we use the default log file ending with .log.
So Replacing the `.` should be fine.

User supplied log files are not rotated.
2022-04-29 19:19:01 +02:00
Michael Vetter
188afc58da Use 3 digits for rotated logfiles
profanity.log.001 -> 999.
2022-04-29 15:40:56 +02:00
Michael Vetter
c4d7f1c29a Set default max log size to 10MB
In case logrotate is on.
2022-04-29 15:40:50 +02:00
Michael Vetter
e0bcaaf81f
Merge pull request #1700 from profanity-im/feat/change-chatlog
Use ISO8601 as date format in log files
2022-04-29 14:13:25 +02:00
Michael Vetter
4220a1832d Use ISO8601 for log files 2022-04-29 13:05:02 +02:00
Michael Vetter
534ed34d73 Use ISO8601 for chatlogs
For both 1:1 and groupchat.
2022-04-29 13:04:16 +02:00
Michael Vetter
27f25172e9
Merge branch 'master' into add_stamp_settings 2022-04-28 19:33:23 +02:00
Michael Vetter
0dd0193eba use more standard replies when setting stamp 2022-04-28 19:31:27 +02:00
Michael Vetter
6c5d983f13 Rename stamp preference variable
PREF_INCOMING_STR -> PREF_INCOMING_STAMP
PREF_OUTGOING_STR -> PREF_OUTGOING_STAMP
2022-04-28 19:29:27 +02:00
Michael Vetter
69a8fdec95 Rewrite stamp help 2022-04-28 19:26:59 +02:00
Michael Vetter
066df7f741
Merge pull request #1697 from cockroach/feature/offline-muc-notifications
Add support for offline MUC notifications
2022-04-28 18:32:26 +02:00
Michael Vetter
69663b83c8 Fix ox autocompletion
Sometimes this happened:
 `ox d<tab>` → `/ox request`
 `ox a<tab>` → `/ox request`
 `ox c<tab>` → `/ox keys`
 `ox s<tab>` → `/ox keys`
 `ox e<tab>` → `/ox keys`

We didn't reset the ox_*_ac variables.
2022-04-28 17:54:12 +02:00
Michael Vetter
9fcd589682 ox: group online autocompletion together 2022-04-28 17:37:24 +02:00
Michael Vetter
2dc0cc489c ox: dont print empty body message
Fix https://github.com/profanity-im/profanity/issues/1693

```
@StefanKropp @DebXWoody please check `_handle_ox_chat()` I don't
understand what you are doing there.
1)
First plain is assigned `message->plain =
p_ox_gpg_decrypt(xmpp_stanza_get_text(ox));`
and then in the same if block you overwrite this with `message->plain =
xmpp_stanza_get_text(b);` without freeing the old value as far as I can
see.

2)
Sometimes even doing `message->plain = "OX error: No payload found";`.
Shouldn't there be a `strdup()`? I think later on we try to free the
whole message struct. So we can't mix this static things.
```
2022-04-27 17:00:30 +02:00
Michael Vetter
196fdd9cb9
Merge pull request #1699 from profanity-im/1698-fixoxabrt
Fix SIGABRT when using wrong argument order for receiving ox key
2022-04-27 16:51:39 +02:00
Michael Vetter
8ee3a43983 ox: remove comment 2022-04-27 16:36:30 +02:00
Michael Vetter
c8b88733ef ox: print invalid fingerprint instead of aborting
Asserting here is not the right thing to do at all.
A person could have a typo in the fingerprint. Or like in the case of
the reported bug just confuse the arguments.

An additional check for valid jid should be added later to the calling
function maybe.

Fix https://github.com/profanity-im/profanity/issues/1698
2022-04-27 16:30:01 +02:00
Michael Vetter
866f688621 ox: print bad usage instead of custom message 2022-04-27 16:13:05 +02:00
Michael Vetter
ecafb6deaf Remove comment 2022-04-27 16:08:39 +02:00
Stefan Ott
8044c82614 Add support for offline MUC notifications 2022-04-23 02:42:23 +02:00
Michael Vetter
f891edc0e9 Fix typo Annonuce -> Announce 2022-04-14 09:23:12 +02:00
Michael Vetter
0293b639c7 Fix typo: paylod -> payload 2022-04-12 20:52:39 +02:00
Paul Fertser
8e728fee15 Show return symbol for embedded newlines
When editing multi-line messages or comments everything past the first
newline becomes invisible.

This patch fixes it by substituting a Unicode symbol for "return"
instead of printing the newline as is. On locales where it's not
available single backslash is used instead.
2022-04-12 12:17:36 +03:00
Paul Fertser
ccede06a65 Handle input win redisplay via Readline hook
Allow Readline to control when to redisplay the input line. This makes
text entered via /editor visible after editor is closed.
2022-04-12 12:17:36 +03:00
Paul Fertser
026522534b Show Readline prompt in input window
When doing an interactive search the prompt is needed to show the
current state of the search to avoid confusion.
2022-04-12 12:17:32 +03:00
Paul Fertser
b00e74f3b8 Allow /editor while not connected
Since /editor can be used also for commands it doesn't make sense to
restrict it to only connected state.
2022-04-12 11:42:50 +03:00
Michael Vetter
59b9b44d53 Dont show presence status changes by default
Dont show presence status changes by default in chat and muc windows.

Users repeatedly ask how to change this setting in the MUC.
We have it in the FAQ since a long time.

And most people I know change this setting, including me.

So it looks like it's time to change this default.
2022-04-07 17:32:37 +02:00
Michael Vetter
db154f226e
Merge pull request #1674 from paulfertser/allow-bold-for-default-colours
Allow bold for default colours
2022-04-04 23:38:31 +02:00
Michael Vetter
55cc76450b
Merge pull request #1681 from akaWolf/fix_theme_load_non_exist
Fix theme load

When we execute `/theme load somethingthatdoesntexist` it still loaded some colors wrongly.
2022-04-03 23:36:39 +02:00
Michael Vetter
dfa3ca344b
Merge pull request #1675 from paulfertser/fix-no-me-history
Use correct colour for their nick when showing history
2022-04-03 03:15:25 +02:00
Artjom Vejsel
9c2713c917 disable execution of colors-changing code when call for theme load and it doesn't exist 2022-04-02 19:07:59 +03:00
Maxi Wuttke
373385e90e Include config.h in src/config.cafile.c
See <https://github.com/profanity-im/profanity/issues/1512>
2022-04-02 01:15:34 +02:00
Maxi Wuttke
f11ad16714 Fix a segfault when uploading or downloading files
The variable `ccount->tls_policy` was not null-tested before `strcmp`.
2022-04-02 01:15:34 +02:00
Artjom Vejsel
2c003dd2e1 add /stamp command
command allow override standard stamps of incoming and outgoing messages
2022-04-02 00:23:08 +03:00
Paul Fertser
4290d87df9 Use correct colour for their nick when showing history 2022-04-01 17:14:48 +03:00
Paul Fertser
4217105ff0 Allow bold for default colours 2022-04-01 17:00:13 +03:00
Steffen Jaeckel
7da2e6d9f3 Fix logging (this time for real)
... I hope ...

We also need to create the path where the logs are stored.

Fixup of d82f2f293b

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-04-01 14:56:08 +02:00
Steffen Jaeckel
d82f2f293b fix path where logs are stored
43e5f15e66 broke the creation of the path
where chatlogs are stored. This is fixed now.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-04-01 14:17:44 +02:00
Michael Vetter
ba3d5e8de9
Merge pull request #1664 from paulfertser/tab-completion-cleanup
Tab completion code simplification
2022-04-01 12:52:54 +02:00
Michael Vetter
129886454c
Merge pull request #1667 from paulfertser/fix-screen-arrows-bindings
Add Alt/Ctrl-arrows combinations for GNU Screen
2022-04-01 12:50:47 +02:00
Michael Vetter
eed5e8a652
Merge pull request #1669 from paulfertser/make-rl-functions-bindable
Make all existing input functions bindable from config
2022-04-01 12:50:29 +02:00
Michael Vetter
1bd0e4ddf5
Merge pull request #1670 from profanity-im/moar-cleanup
Even moar cleanup
2022-04-01 12:23:56 +02:00
Steffen Jaeckel
b914929320 fix account set theme help
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-04-01 11:03:28 +02:00
Paul Fertser
e1323655ee Fix race condition on resize
The current code is inherently racy: if screen update takes
considerable time (e.g. when working over network) and a user
performed a series of resizes the final event might get ignored and
the display will be left in inconsistent state.

Fix the race by unsetting the flag first so if the next WINCH signal
is received while display is resizing it'll be processed on the next
iteration.
2022-04-01 10:49:01 +03:00
Steffen Jaeckel
1c7bae4ae9 fix linter warnings
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-03-31 14:29:56 +02:00
Steffen Jaeckel
f284641710 less duplication
Print error message from `_string_matches_one_of()` instead of forming
an error message manually that contains the same entries that were checked
in `_string_matches_one_of()`.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-03-31 14:29:56 +02:00
Steffen Jaeckel
c53b78ea1c use _string_matches_one_of() at more places
I missed them the last time ...

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-03-31 10:33:14 +02:00
Paul Fertser
54c00e206d Make all existing input functions bindable from config 2022-03-30 23:00:14 +03:00
Paul Fertser
4a6f88cc23 Add Alt/Ctrl-arrows combinations for GNU Screen
GNU Screen terminal emulator is modelled after VT100, its key bindings
for "application mode" (which profanity enables on startup) can be
seen with this: info screen "Input Translation".
2022-03-30 21:46:25 +03:00
Steffen Jaeckel
2ca63d1d5f run make format
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-03-30 18:26:10 +02:00
Steffen Jaeckel
2995fbb953 add _string_matches_one_of() helper function
... instead of copying the same pattern over and over again.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-03-30 18:26:10 +02:00
Steffen Jaeckel
3a03496817 clean-up connection (act I)
* use custom memory descriptor that `abort()`s on `malloc()` failure
* use static log descriptor
* don't always re-create all contexts
* de-duplicate code of `.._connect()` and `.._register()`

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-03-30 18:26:10 +02:00
Paul Fertser
3b40da854d Tab completion code simplification
Factor out common code for Tab and Shift-Tab in a separate function.

No functional change.
2022-03-30 16:36:10 +03:00
Paul Fertser
1e81eea899 Input window: handle invalid multibyte
The current code enters an infinite loop if the input string happens
to get an invalid utf-8 sequence somehow. For me it was reproducible
by running profanity in a Screen session and pressing Alt-т (cyrillic
letter).

Fix it the way borrowed from 0501e49623
where mbrlen is used for the same purposes.
2022-03-29 13:57:07 +03:00
Michael Vetter
92f1ba47df
Merge pull request #1656 from MarcoPolo-PasTonMolo/feature/who-none
Add none option for /who
2022-03-29 01:28:58 +02:00
Paul Fertser
1272543237 Use EDITOR environment variable
When preferences do not specify a program to be used for /editor
command, try getting it from EDITOR (which POSIX.1-2017 calls one of
"variables that are frequently exported by widely used command
interpreters and applications"), fall back to "vim" if not set.
2022-03-27 21:48:45 +03:00
MarcoPolo-PasTonMolo
03f8db9658 Add none option for /who
Fixes https://github.com/profanity-im/profanity/issues/1425
`/who none` now displays all users in an muc without an affiliation
2022-03-27 16:06:29 +03:00
Michael Vetter
409268e2b6
Merge pull request #1655 from profanity-im/win-autocomplete
Reset url autocompletion after open/save
2022-03-24 20:30:40 +01:00
Michael Vetter
923af3ba38 Reset url autocompletion after open/save
I guess we should reset the position after we ran `/url open|save`.
So that next time `/url open <tab>` starts with the latest entry.

Fix https://github.com/profanity-im/profanity/issues/1654
2022-03-24 15:39:58 +01:00
MarcoPolo-PasTonMolo
ce152a82b4 Fix crash on /editor 2022-03-24 11:42:49 +02:00
Michael Vetter
2c7f52f81d
Merge pull request #1652 from profanity-im/fix-1624
Fix #1624
2022-03-23 13:02:01 +01:00
Steffen Jaeckel
3a86b8c29b apply tls.policy to cURL calls
In case the user decides to ignore the validity-state of certificates
we also have to configure libcurl accordingly.

`tls.policy` can be set via
```
/account set <account> tls trust
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-03-22 11:44:01 +01:00
Steffen Jaeckel
7f1f9787cb add profanity-specific CAfile
The profanity-internal mechanism to allow connecting to a server isn't
easily portable to cURL. Therefor introduce a profanity-specific CAfile
which is managed individually and will be configured in libcurl calls.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-03-22 11:44:01 +01:00
Steffen Jaeckel
b28ac09368 a tad more const-correctness
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-03-22 11:44:00 +01:00
Steffen Jaeckel
7c56eac154 also store PEM in TLSCertificate
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-03-22 11:34:23 +01:00
Steffen Jaeckel
44e65f3089 simplify code
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-03-21 14:33:30 +01:00
MarcoPolo-PasTonMolo
fb790a955b Use funcs available in all glib versions to replace \n in quotes 2022-03-21 14:52:17 +02:00
MarcoPolo-PasTonMolo
06ef6842e8 Add quote autocompletion for previous messages
Fixes https://github.com/profanity-im/profanity/issues/1649

Type `>` then press tab or shift tab to autocomplete previous messages,
then type your reply and send message.
Newlines are replaced with newline followed by `> `.
A newline is added at the end so that the user can immediately type a
message without manually adding a new line.
2022-03-21 13:46:50 +02:00
Michael Vetter
09e7f63c79 Add adhoc cmd autocompletion
Add tab completion for `/cmd`.
Complete the `list` and `exec` subcommands.

Didn't complete the `<jid>` part since I think it's usually used for
components and etc. Things that might not be in the roster.

Fix https://github.com/profanity-im/profanity/issues/1650
2022-03-21 10:35:07 +01:00
Michael Vetter
024694215d
Merge pull request #1644 from profanity-im/ox-polish
Improve OX user experience
2022-03-21 10:08:13 +01:00
Michael Vetter
963065775b
Merge pull request #1646 from MarcoPolo-PasTonMolo/fix/nick-autocomplete
Fix not autocompleting nicks with '/'
2022-03-21 10:06:29 +01:00
MarcoPolo-PasTonMolo
ffeb8c33f1 Reverse priority for nick vs cmd autocomplete 2022-03-21 00:12:12 +02:00
Steffen Jaeckel
8c55294352 re-factor get_message_from_editor()
* use GLib functions to write&read compose file
* trim trailing new-line characters from compose file

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-03-14 15:45:01 +01:00
Steffen Jaeckel
4d71848837 replace GString usage where a simple strdup works
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-03-14 13:17:46 +01:00
Steffen Jaeckel
43e5f15e66 refactor logfile-name creation
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-03-14 13:17:46 +01:00
Steffen Jaeckel
705b6f7806 use g_mkdir_with_parents() instead of home-baked solution
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-03-14 13:17:46 +01:00
Steffen Jaeckel
b8e46552bf add files_file_in_account_data_path()
As all parts of the code invoking the `files_get_account_data_path()`
function did the same afterwards, a function has been added with the same
behavior.

1. create path
2. `mkdir` of that path
3. return final path

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-03-13 14:15:02 +01:00
Steffen Jaeckel
764a7fb71b prevent segfault
In case we're not connected yet and press Alt+c a segfault occurred
since `conn.xmpp_conn` is dereferenced while it's still `NULL`.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-03-13 13:21:40 +01:00
Steffen Jaeckel
07e584734d Alt+e is already bound, use Alt+c
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-03-13 13:21:40 +01:00
Michael Vetter
198ff3e9be Add stat.h to editor
Fix on openbsd:
`src/tools/editor.c:55:36: error: 'S_IRWXU' undeclared (first use in
this function)`
2022-03-04 21:09:24 +01:00
Michael Vetter
9578b03bf6 Include errno header in editor.c 2022-03-04 14:26:18 +01:00
MarcoPolo-PasTonMolo
3f78af2591 Move get_message_from_editor to appropriate file and change its keybinding 2022-03-03 12:56:03 +01:00
MarcoPolo-PasTonMolo
0fdaad7cbf Add hotkey for sending readline text to editor 2022-03-03 12:55:57 +01:00
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
swirl
4d3f26154e hacky fix(?) for register
very bad and spaghetti will fix later
2021-08-17 14:09:48 -04:00
swirl
2cc354b6ae fixed some bugs, added some more
- Added JABBER_RAW_CONNECT[ING/ED] connection states
- Added cl_ev_connect_raw and session_connect_raw to conform to normal
connection functions
- Fixed SIGABRT during registration
- Added a check in cmd_register to ensure it's actually connected before
registering--but this will always fail atm
2021-08-17 14:09:48 -04:00
swirl
5ea1ccbb46 /register: parameter updates
add auth param, switch host and username params, rename host param to server
2021-08-17 14:09:48 -04:00
swirl
d9366a26d6 initial register command test 2021-08-17 14:09:48 -04:00