1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-15 19:38:07 -04:00
Commit Graph

1571 Commits

Author SHA1 Message Date
Dmitry Podgorny
ba291a03f4 Fix memory leak in cons_show_disco_info() 2020-04-06 13:29:36 +03:00
Dmitry Podgorny
dc5ddb8ebe Fix memory leak in _rosterwin_resources() 2020-04-05 15:57:27 +03:00
Dmitry Podgorny
37c200571f Fixed memory leak in ProfMucWin
Profanity remembers last message and its id for the message correction
feature. We must free them in window destructor.
2020-04-03 01:47:38 +03:00
Michael Vetter
4fc938d804 Add setting to not colorize own nick according to xep-0392
Some users might want there nick to always stay white (etc) for easier
recognition.

Now we can do `/color own off` to not generate the color based on
xep-0392. The `me=` color (etc) from the theme will then be used.

Once we run this command `theme_load()` is called again.
And the theme looks totally wrong.
We encountered this at other times already and I think it's nothing
wrong with this new code here now but that there seems to be a missing
closing attr for the color when drawing.

Should be investigated seperately.

Fix https://github.com/profanity-im/profanity/issues/1288
2020-03-25 12:54:25 +01:00
Michael Vetter
f131680055 titlebar: allow displaying MUC name and MUC jid
`/titlebar use name|jid` -> `/titlebar show|hide name|jid`

Fix https://github.com/profanity-im/profanity/issues/1284
2020-03-24 22:22:16 +01:00
Michael Vetter
fd090d384d move titlebar code in correct function 2020-03-24 21:46:40 +01:00
Michael Vetter
3c56b289ed Add slashguard feature
New command `/slashguard` tries to protect against typing ` /quit` by
not allowing a slash in the first 4 characters.
2020-03-18 18:20:05 +01:00
Michael Vetter
52e7e596aa xep-0084/avatar: add option to open avatar directly
Change:
`/avatar me@somewhere.org` -> `/avatar get me@somewhere.org`

New:
`/avatar cmd feh`
`/avatar open me@somewhere.org`

Implement https://github.com/profanity-im/profanity/issues/1281
2020-03-10 07:12:13 +01:00
Michael Vetter
7e62d458ee Make statusbar tab more resilient
If users input strange stuff and we can't create a jid from it even the
setting is set to 'user' we still should fallback to the regular
identifer.

For example with `/msg @name%matrix.domain.org@matrix.org hi`.
2020-03-09 16:33:42 +01:00
Michael Vetter
a3889c94bc Rename ProfBufferEntry jid variable 2020-03-09 13:33:48 +01:00
Michael Vetter
f3d9de133e Check for sender of LMC message 2020-03-09 13:31:49 +01:00
Michael Vetter
f7fe87dd4e Write from jid in buffer
Not all cases covered yet.
2020-03-09 12:52:47 +01:00
Michael Vetter
95a16c2486 Add barejid to buffer struct 2020-03-09 12:47:43 +01:00
Michael Vetter
441e31984e Remove old comments 2020-03-09 12:31:49 +01:00
Michael Vetter
56836fb72d Use correct MUC message timestamp
win_println_incoming_muc_msg() always used the current time. Now let's
use whatever is sent int he message struct (from the delay stanza or
the current time that we set now once the message is received).

No playing with the time upon display anymore.
2020-03-09 12:22:36 +01:00
Michael Vetter
3d7e6fae7c Use ProfMessage as parameter for win_println_incoming_muc_msg() 2020-03-09 12:00:15 +01:00
Michael Vetter
0801623018 window.c: Rename variable 2020-03-09 11:51:32 +01:00
Michael Vetter
ca14f3a1a2 Fix memory leak in win_create_muc()
I suspect this was just a copy paste error.
`_win_create_simple_layout()` is called in other creation functions like
`win_create_config()` or `win_create_private()`.

I suspect when `win_create_muc()` was created it was just copied. But in
this function we actually set the layout ourself later.

So calling the function isn't needed.

Regards https://github.com/profanity-im/profanity/issues/1279
2020-02-27 16:14:54 +01:00
Michael Vetter
fc35a5a492 Stop buffer_remove_entry_by_id() once we found the entry
No need to continue to loop through the rest.
2020-02-25 16:11:59 +01:00
Michael Vetter
f597de4889 Properly free buffer entry
g_slist_delete_link() is not enough we also need to call _free_entry()
on the entry.

This fixes a memleak in win_insert_last_read_position_marker()
2020-02-25 16:06:00 +01:00
Michael Vetter
1a87d7be3e Only use enc_char in win_print_incoming() when needed
Fixes potential memory leak too.
2020-02-25 14:52:38 +01:00
Michael Vetter
99dc1c9494 Rename separator to trackbar 2020-02-21 19:17:12 +01:00
Michael Vetter
6dbbbe11e5 Make trackbar color configurable
Use `main.trackbar` in themes.
2020-02-21 19:12:16 +01:00
Michael Vetter
eb2fbdba2e Dont filter out own MUC messages if muc history is set to 'regular'
We use the same incoming function as for regular incoming text here. But
don't want to filter out our own messages since we didn't print them
during sending.

Follow up to 8ee2cdadc8
2020-02-21 18:46:09 +01:00
Michael Vetter
7fdc4ed7f6 win_print_incoming() strdup the charactar
Fix bug introduced in 1f8b1eb740.
Forgot to strdup() here.
2020-02-21 08:02:11 +01:00
Michael Vetter
1f8b1eb740 Allow utf8 symbols as omemo/pgp/otr indicator char
Fix https://github.com/profanity-im/profanity/issues/1264
2020-02-20 23:36:10 +01:00
Michael Vetter
8ee2cdadc8 Parse mentions and triggers in muc history if display is 'regular'
Fix https://github.com/profanity-im/profanity/issues/1261
2020-02-20 10:28:24 +01:00
Michael Vetter
80dd3fdbb2 Add option to color MUC history like regular messages
`/logging group color` has:
* `unanimous` which will color it with one unanimous color. Like it was
done always.
* `regular` which colors it like regular incoming messages.

Regards https://github.com/profanity-im/profanity/issues/1261
2020-02-20 08:11:58 +01:00
Michael Vetter
6aa793fca6 Refactor mucwin_history()
Just pass ProfMessage.
2020-02-19 16:57:37 +01:00
Michael Vetter
cf36a92dcb Add define names to comment 2020-02-19 16:36:54 +01:00
Michael Vetter
b4c6470df4
Merge pull request #1269 from wstrm/add-sr.ht-ci
Add builds.sr.ht CI for OpenBSD
2020-02-17 16:47:52 +01:00
Michael Vetter
ea5a947f52 Refactor win_print_history()
We never use the printf like behaviour anyways.
2020-02-17 12:05:58 +01:00
Michael Vetter
6e68f1812b Refactor win_print_outgoing_muc_msg()
We never use the printf like behaviour anyways.
2020-02-17 12:03:23 +01:00
Michael Vetter
f13ea11f95 Refactor win_println_incoming_muc_msg()
We never use the printf like behaviour anyways.
2020-02-17 11:58:36 +01:00
Michael Vetter
69d474b3a7 Refactor win_print_outgoing()
We never use the printf like behaviour anyways.
2020-02-17 11:48:50 +01:00
William Wennerström
b267b065f5
Add builds.sr.ht CI for OpenBSD
* Add .builds/openbsd.yml for builds.sr.ht
* Update travis-build.sh -> ci-build.sh with OpenBSD case
* Fix libdl check in configure.ac (OpenBSD has libdl built-in)
* Fix some minor issues found when compiling on OpenBSD with GCC (e.g.
  uninitialized variables)
2020-02-17 10:54:15 +01:00
Michael Vetter
7d596d8cef Make /sendfile in PGP session configurable
`/pgp sendfile on` allows unencrypted file transfer in an PGP session.

Regards https://github.com/profanity-im/profanity/pull/1270
2020-02-17 08:57:35 +01:00
Michael Vetter
86bcadcbe3 Make /sendfile in OTR session configurable
`/otr sendfile on` allows unencrypted file transfer in an OMEMO session.

Regards https://github.com/profanity-im/profanity/pull/1270
2020-02-17 08:51:43 +01:00
Michael Vetter
36713a2ed7 Make /sendfile in OMEMO session configurable
`/omemo sendfile on` allows unencrypted file transfer in an OMEMO
session.

Regards https://github.com/profanity-im/profanity/pull/1270
2020-02-17 08:31:46 +01:00
Michael Vetter
421c67e284 Add workaround for compiler warning
Regards https://github.com/profanity-im/profanity/issues/1265
2020-02-14 11:23:19 +01:00
Michael Vetter
fcfb493dfb Rename buffer->from to buffer->display_from 2020-02-14 10:17:07 +01:00
Michael Vetter
e27c414f1f xep-0308: enable for carbon copied messages
If we are connected with another client and send a message, then correct
it. We now display it correctly in Profanity.

Id wasn't saved for carbon copied messages too so far.
2020-02-14 10:17:07 +01:00
Michael Vetter
9b3593bdf9 xep-0308: enable correction in outgoing messages with delivery receipts 2020-02-14 10:17:07 +01:00
Michael Vetter
3e901aee99 Rename win_print_with_receipt() -> win_print_outgoing_with_receipt() 2020-02-14 10:17:07 +01:00
Michael Vetter
3a1be74e93 Add myself to copyright 2020-02-14 10:17:07 +01:00
Michael Vetter
2900bf4aef Rename win_println_them_message() -> win_println_incoming_muc_msg()
In aa3693daa211b36c78d136d5a1ee9f3258e21352 I renamed
`win_println_me_message()` -> `win_print_outgoing_muc_msg()`.

Now: `win_println_them_message()` -> `win_println_incoming_muc_msg()`
to be more consistent and descriptive.
2020-02-14 10:17:07 +01:00
Michael Vetter
50271493b7 xep-0308: remove replace_id from privwin signature
No `/correct` allowed in privwins
2020-02-14 10:17:07 +01:00
Michael Vetter
743ec6afd0 xep-0308: only replace messages if the user enabled the feature
Outgoing `/correct` will still work.
2020-02-14 10:17:07 +01:00
Michael Vetter
4ec005e4c3 xep-0308: Implement LMC for outgoing MUC messages
Including OMEMO encrypted ones.
Also rename `win_println_me_message()` to `win_print_outgoing_muc_msg()
as I think it's a more descriptive name.
2020-02-14 10:17:07 +01:00
Michael Vetter
66d3f572f9 xep-0308: Dont allow to correct MUC PMs
People could change messages of other people if the nick isn't
registered.
2020-02-14 10:17:00 +01:00
Michael Vetter
7cd1be36f2 xep-0308: Display corrected incoming MUC messages correctly 2020-02-12 12:56:34 +01:00
Michael Vetter
38c32be14c Distinguish between _win_print() and _win_printf()
_win_print() and _win_printf() sound like they are the same. But
actually they are something totally different.

I renamed _win_print() to _win_print_internal() for that reason. It's
more about actually drawing to the ncurses window.

_win_printf() calls _win_print() and also writes the text to the window
buffer. Which _win_print() didn't, it was really just the ncurses
specific things.

In some cases there is _win_print_internal() called after a
buffer_append() in those cases it might be more correct to actually call
_win_printf().
It was not done so far. But probably is better. But will mean a bit more
operations.

I'll have to check this later.
2020-02-12 08:32:34 +01:00
Michael Vetter
0482a80f8a Rename win_correct_incoming to win_correct
and make it static.
2020-02-12 07:07:54 +01:00
Michael Vetter
b6b7dd5ad4 xep-0308: update the UI upon sending a corrected message
So far we don't do this for encrypted messages. Still needs to be done.
And MUC also needs to be done.
2020-02-11 15:26:58 +01:00
Michael Vetter
1118110071 xep-0308: Implement /correct to correct the last send message
So far the correction is sent. But the UI in Profanity itself is not
updated.

Also autocompletion for `/correct` with the last sent message is
missing.
2020-02-10 16:17:01 +01:00
Michael Vetter
dd8086772d xep-0308: create setting to toggle lmc
and print settings if only `/correction` is run.
2020-02-10 14:52:42 +01:00
Michael Vetter
039bf5d04d xep-0308: add correction autocompletion 2020-02-10 13:35:46 +01:00
Michael Vetter
f16d56a15e xep-0308: Initial support for incoming LMC 2020-02-10 13:19:54 +01:00
Michael Vetter
772224421d Clear buffer upon /clear
I think both the window and the buffer should also be cleared in case
`/clear` is issue and persist_history is off.

Otherwise it could happen that win_redraw() redraws the whole content of
the buffer again.
2020-02-07 15:52:24 +01:00
Michael Vetter
c73d70171b rosterwin: end correct colors
Actually presence_colour should be stopped there.
Thanks to rumin-miller for finding this.
2020-02-03 11:41:13 +01:00
Paul Fariello
a52e3ea1d8 Add context to autocomplete_with_func and use it for omemo trust command
Fix #1068
2020-01-31 10:07:08 +01:00
Michael Vetter
cd80b6cbf2 Change theme handling
So far when loading a theme it also overwrote the preferences the user
set.

Lengthy discussion can be found at
https://github.com/profanity-im/profanity/issues/1077

Now we use `/theme load themename` to load the [colours] part of a
themem only.

`/theme full-load themename` will load the complete theme including
preferences set in there.

Regards https://github.com/profanity-im/profanity/issues/1077
2020-01-29 12:33:55 +01:00
Michael Vetter
4bc82a5318 XEP-0092: Add configuration option to choose whether to send OS name
`/os on|off` now let's one choose whether to include the OS name once
`/software` (XEP-0092) is ran on us.
2020-01-24 19:27:42 +01:00
Michael Vetter
fd38c7adae Add myself to copyright 2020-01-23 19:58:31 +01:00
Michael Vetter
6567936406 Refactor rosterwin_roster()
Use helper function for duplicate code.
2020-01-23 19:52:41 +01:00
Michael Vetter
56b7482b08 Add option to display MUC name or JID in titlebar
Add `/titlebar use [name|jid]`.
2020-01-23 19:42:22 +01:00
Michael Vetter
0401412c64 Display MUC name in titlebar 2020-01-23 18:53:14 +01:00
Michael Vetter
036389e8c5 Fix spacing in titlebar.c 2020-01-23 18:48:54 +01:00
Michael Vetter
08a3f94a89 Print roster rooms use in info page 2020-01-23 18:38:52 +01:00
Michael Vetter
10c4032d12 Respect /roster room use setting also when sorted for service 2020-01-23 18:29:49 +01:00
Michael Vetter
31509022ef NULL room_name in win_create_muc() 2020-01-23 18:22:36 +01:00
Michael Vetter
9e35861001 Add /roster room use command
`/roster room use name` to use the name of the MUC in the roster list.
`/roster room use jid` to use the jid of the MUC in the roster list.

Display it only in case `/roster room by none` is set so far.
2020-01-23 16:50:43 +01:00
Michael Vetter
3066fd77fc Save MUC room name in ProfMucWin
We will need this if we want to display the Name instead of the JID.
2020-01-23 11:35:33 +01:00
Michael Vetter
dac6d088d0 rosterwin: remove duplicate if 2020-01-22 09:30:09 +01:00
Michael Vetter
be13e98fe7 Update my Copyright to 2020 2020-01-03 19:52:31 +01:00
Michael Vetter
abd8e3d6c5 Adjust /color configuration output
Fix https://github.com/profanity-im/profanity/issues/1243
2019-12-20 10:05:58 +01:00
Michael Vetter
fdd6897eee Add workaround for stupid compiler warning
Makes travis builds for TW, Debian and Arch fail.
2019-12-19 20:38:05 +01:00
Michael Vetter
808850c6f5 Add /occupants color command
`/occupants color on|off` to enable or disable XEP-0392 also for the
MUC occupants.

Regards
https://github.com/profanity-im/profanity/issues/1191
2019-12-19 19:14:59 +01:00
Michael Vetter
0af54d8a72 Add /roster color command
`/roster color on|off` to enable or disable XEP-0392 also for the
roster.

Regards https://github.com/profanity-im/profanity/issues/1191
2019-12-19 18:53:22 +01:00
Michael Vetter
c302af99b7 xep-0392: colorize roster 2019-12-19 14:02:24 +01:00
Michael Vetter
3036834ec8 separator: Enable for MUC and PRIVWIN too
Fix https://github.com/profanity-im/profanity/issues/1238
2019-12-13 13:13:02 +01:00
Michael Vetter
e2b44a69bd separator: Print only one for each chat window
So far we printed one after the last received message, which doesn't
make much sense of course.
Now only print one if there is not already one present.
2019-12-13 12:47:27 +01:00
Michael Vetter
a1ed37953c separator: print trackbar across the whole line
Use the whole line.
We do this in win_redraw() so upon terminal size change it still
matches.

Regards https://github.com/profanity-im/profanity/issues/1238
2019-12-13 12:19:07 +01:00
Michael Vetter
14f25992c3 Initial work on last-read-position feature
Print dashes on the position we last left off in a chat window.
So far the number of dashes is hardcoded, and the feature only works in
chat windows.

Regards https://github.com/profanity-im/profanity/issues/1238
2019-12-13 12:05:24 +01:00
Michael Vetter
9bb2d7f95e Dont print error message if a valid setting function is called
This is because the actual command that parses itself (cmd_logging) returns false if it didn't get the expected parameters.
Handing the printing however is done by another function. This function is added to the Command struct as setting_function.
So if this is set, and the actual command returns false. We should just call the setting_function and not print the error message.

Fix https://github.com/profanity-im/profanity/issues/1237
2019-12-12 22:24:09 +01:00
Michael Vetter
fd36fcdb1e Handle case where color.nick is not set
Fixes a segfault if color.nick was never set but we want to print it's
value.
2019-12-12 20:16:10 +01:00
Michael Vetter
2750194279 Implement Color Vision Deficiencies setting
Implement settings for redgreen and blue blindness.

Regards https://github.com/profanity-im/profanity/issues/1191
2019-12-12 11:07:11 +01:00
Michael Vetter
ddf6ada3d1 Add initial support for XEP-0392
The last 3 commits added basic support.
Thanks @aaptel!

This commit adds basic settings interface to use it.
See `/color on|off`.

We still have to enable settings for color blindness.
And maybe another setting to decide whether to color the
occupantslist/roster with the same algo.

Regards https://github.com/profanity-im/profanity/issues/1191
2019-12-09 16:12:54 +01:00
Aurelien Aptel
7a0a578a8a XEP-0392: theme, ui: conditionally colorize user nicks
* add theme_hash_attrs()
* when printing a user message check PREF_COLOR_NICK to decide whether
  to colorize it or not

ideally we should hash the jid instead of the nick but this is already
a first step.
2019-12-03 21:10:39 +01:00
Michael Vetter
19de066008 Call ncurses resize function before move function
From @xaizek s comment on issue #1235:
```
If the move would cause the window to be off the screen, it is an error and the window
is not moved.

Resize on the other hand doesn't fail like this according to its documentation. So new size needs to be applied first.
```

Big thanks to @xaizek for taking a look at our code and helping us!!

Regards https://github.com/profanity-im/profanity/issues/1235
2019-12-02 14:03:53 +01:00
Michael Vetter
09b8802f51 _win_print: Guard against time being null
This is encountered when biboumi is used.
Example: `/join #debian-next%irc.oftc.net@biboumi.lebihan.pl`
It seems then time can be null.

g_date_time_format() will not work in this case although time_pref will
not be "off". So let's not call g_date_time_format() in this case. But
treat it like time is set to off.

However message reflection will not work properly with biboumi.
Probably we dont get origin-id.

Fix https://github.com/profanity-im/profanity/issues/1230
2019-12-01 18:01:28 +01:00
Michael Vetter
46fd7150e5 Add vim modeline 2019-11-13 12:11:05 +01:00
Michael Vetter
9bc4dc3827 Merge /chlog and /grlog commands into /logging
Instead of `/chlog on` we now have `/logging chat on`.
Instead of `/grlog on` we now have `/logging group on`.

Fix https://github.com/profanity-im/profanity/issues/1224
2019-11-12 12:39:24 +01:00
Michael Vetter
c1a9736232 Merge /invite, /invites and /decline commands
`/invite <contact>` became `/invite send <contact>.
`/invites` became `/invite list`.
`/decline` became `/invite decline`.

Accept is still done via `/join`.

Regards https://github.com/profanity-im/profanity/issues/1116
2019-11-05 22:06:19 +01:00
Michael Vetter
40dc5932f7 Add /titlebar show presence command
Additionally to `/presence titlebar on` we now allow the setting via
/titlebar show|hide presence` since it's about the titlebar.

Regards https://github.com/profanity-im/profanity/issues/1116
2019-11-05 21:06:07 +01:00
Michael Vetter
68843f2448 Display resource information in /titlebar 2019-11-05 21:01:30 +01:00
Michael Vetter
fc6f2755c1 Move /encwarn command into /titlebar
Instead of `/encwarn on|off` we now have `/titlebar show|hide encwarn`.

Regards https://github.com/profanity-im/profanity/issues/1116
2019-11-05 20:39:33 +01:00
Michael Vetter
ba0f925222 Fix add_history usage in down arrow handler
[Programming with GNU
History](http://www.math.utah.edu/docs/info/hist_2.html) mentions
using_history().

Chet, maintainer of readline told me about it. (Thanks Chet!)

Seems like we need to call this so that the history offset is at the
right end of the list. I assume it's called in the linehandler
automatically.

Fix https://github.com/profanity-im/profanity/issues/200
2019-11-05 17:19:51 +01:00
Michael Vetter
330ef3bcf3 Store current input line in history
Regards https://github.com/profanity-im/profanity/issues/200

This doesn't work yet. And I have no idea why.
Weird behaviour:

- start profanity
- type 'ASDF'
- ctrl+arrow down
-> text vanishes (like intended)
- arrow up
-> nothing happens (intended is that the last history item [ASDF]
appears)

- type 'ABC'
- press enter
- arrow up
-> ABC appears
- enter

- type 'UUU'
- ctrl+arrow down
- type 'ZZZ'
- enter
- arrow up
- ZZZ appears
- arrow up
- UUU appears

So in the latter case we added to history and deleted from the input
line and then immediately entered new text and pressed enter, to add
this to the history too.
When we do this the not sent text succesfully was stored in history.
2019-11-05 17:18:42 +01:00
Michael Vetter
8d2b1b05e7 Initialize ProfBufEntry->id correctly 2019-11-01 18:31:19 +01:00