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

5384 Commits

Author SHA1 Message Date
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
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