1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-22 19:45:54 -04:00
Commit Graph

407 Commits

Author SHA1 Message Date
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
c2d70a071f xep-0308: set correction char in config 2020-02-10 13:48:31 +01:00
Michael Vetter
7df964fe7b Set PREF_COLOR_NICK to false by default 2020-02-06 10:54:03 +01:00
Paul Fariello
be7157065c Add default pref for PREF_COLOR_NICK
Fix a segfault if corresponding preference is not saved in config file.
2020-02-05 15:29:17 +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
5c41c5b380 Add comments to preferences.c 2020-01-29 11:50:04 +01:00
Michael Vetter
7dbc0baef3 Refactor theme.c
Make _theme_list_dir() static.
Sort _load_preferences() loadings accoding to type.
Add comments.
2020-01-29 11:49:08 +01:00
Michael Vetter
8c34f2ce01 xep-0092: add config option to set whether OS is revealed
Default is on. `revail.os=false` in the `connection` section of the
config can disable it.
A command to configure this will follow.
2020-01-23 23:35:46 +01:00
Michael Vetter
2d19ad0db4 Add option to notify about version request
Cannot be configured for now.
Can be set via `adv.notify.discoversion` in the `notification` section.

Will notify about version requests via XEP-0092 and XEP-0232.

Client version can still be seen via caps (capabilities).
See `stanza_attach_caps()`.
2020-01-23 22:54:47 +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
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
802df37926 XEP-0392: get background color from theme
So far we just used -1 (default color). Now we actually check whether
`bkgnd` is set in the theme file and use this if available.

Fix https://github.com/profanity-im/profanity/issues/1255
2020-01-22 10:01:04 +01:00
Michael Vetter
be13e98fe7 Update my Copyright to 2020 2020-01-03 19:52:31 +01:00
Michael Vetter
92c8366880 Dont kill *.char preferences if theme doesnt contain it
So far `/occupants char *`, `/roster contact char *`, `/roster room char #`,
`/roster header char -`, `/occupants header char -` was saved and
loaded from the preferences.

But was overwritten when the theme was loaded. If the theme didn't set
these values the value was just cleared. Despite that it might have been
set in the users preferences.

Funny enough the themes don't operate generally like this.
For example `otr.char` is not cleared.

This is again due to our borked theme/prefs concept
(https://github.com/profanity-im/profanity/issues/1077).

For now let's just use the one set from the preferences if it's set. The
theme will however overwrite it if it is set there.

Fix https://github.com/profanity-im/profanity/issues/1244
2019-12-20 10:45:25 +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
3258211f27 Improve color blindness handling
Rename some things and use a swtich instead of if.
2019-12-12 14:23:07 +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
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
Aurelien Aptel
4a672bda22 XEP-0392: color: implement color hashing
* add the HSL values of each of the 256 terminal colors
* add color_pair_cache_hash_str()
* move common code to _color_pair_cache_get() helper func

after hashing a string to a color, return the closest matching
terminal color using euclidian distance of the HSL diff vector (this
method was found empirically and seems to work well enough...)
2019-12-03 21:10:39 +01:00
Aurelien Aptel
15064d9739 XEP-0392: config: add "color.nick" bool option
the option will control whether to enable coloration of usernames
based on the hashing algorithm described in XEP-0392.
2019-12-03 21:10:39 +01:00
Michael Vetter
46fd7150e5 Add vim modeline 2019-11-13 12:11:05 +01:00
Martin
b16426f66d Change default text colors to default (#1213)
Change default themes text color

Using "default" instead of white makes the default better readable
when using a black/dark font on white/light background.

May fix #535
2019-10-22 08:13:39 +02:00
Michael Vetter
ee0541a262 Rename identification file 2019-10-16 10:54:05 +02:00
Michael Vetter
1e09a055ca Create random-bytes file
So far only with dummy value.
We will need an identifier that we can hash together with a message ID
and put in as the origin-id.
So when we receive message we can unsplit it and see if it was sent from
this client.

Regards https://github.com/profanity-im/profanity/issues/1207
2019-10-16 10:17:34 +02:00
Michael Vetter
d0c3d3fd6b Null-set account struct
Surpresses the valgrind warning about uninit. values.
2019-10-14 11:35:18 +02:00
Michael Vetter
5c53e02d86 Add option to hilight unread rooms in /wins command
In the theme we can now set `cmd.wins.unread` to hvae a special color
for the lines of the `/wins` output that have unread messages.

Fix https://github.com/profanity-im/profanity/issues/895
2019-10-12 13:03:14 +02:00
Michael Vetter
4e8f0c90b5 Fix preferences memory leak
Memory leak detected through unit tests.

Regards https://github.com/profanity-im/profanity/issues/1019
2019-10-05 20:45:07 +02:00
Michael Vetter
d7c00360ea
Merge pull request #874 from spiridoncha/master
Change /clear behaviour. Closes issue #855.
2019-10-05 15:12:44 +02:00
Michael Vetter
5c77b97c35 Introduce /reload command
This command reloads the configuration file.

Fix https://github.com/profanity-im/profanity/issues/627
2019-10-04 14:06:25 +02:00
Daniel Lublin
641410f6bd Add coloring of statusbar.current tab in view
This theme color applies to the tab title text of the statusbar tab that
is currently shown.

The (somewhat confusingly named) `statusbar.active` theme color now
applies to all other tabs (before, it applied to all tabs).

Coloring of a tab that is highlighted/has new messages is done as before
using the `statusbar.new` theme color.

The default color is set to `cyan`, and thus causes no visible change
for users -- until modified.
2019-09-24 10:35:30 +02:00
Michael Vetter
e10f4d4bb0 Set default color for main.text.history
Might be related to https://github.com/profanity-im/profanity/issues/1186
2019-09-11 13:20:32 +02:00
Michael Vetter
aa0f497975 Allow colorization of history messages
History was always printed with `THEME_DEFAULT` we now use
`THEME_TEXT_HISTORY` which is accesible in theme files via
`main.text.history`.

Fix https://github.com/profanity-im/profanity/issues/1170
2019-09-10 11:22:30 +02:00
Michael Vetter
726eee2a66 Make sure memory in color_pair_cache_reset() was allocated.
Just to be on the safe side.

Probably only relevant for unit tests where ncurses vars are not
initialized with real values.
Fix unit tests on all platforms.
2019-08-24 18:04:02 +02:00
Michael Vetter
03fbf2e77a Remove unused colour_string_t struct 2019-08-23 14:59:26 +02:00
Michael Vetter
7d7a49f132 theme: print to log not to console
Seems this can cause trouble in case we cant use the theme properly.
2019-08-23 14:56:29 +02:00
Michael Vetter
e408e988a7 color: set capacity in unittest case
Fix https://github.com/profanity-im/profanity/issues/1178
2019-08-23 14:54:55 +02:00
Michael Vetter
c2a565c2ec Notify trying to load 256 colour theme in incapable terminal 2019-08-23 14:24:44 +02:00
Michael Vetter
56c77678f2 color: Include log.h 2019-08-23 14:07:41 +02:00
Michael Vetter
023e2dc387 Reset color pairs when new theme is loaded
We only need the colour pairs initialized that the theme actually uses.
It's otherwise possible that we run over the max value of initialzed
pairs.
2019-08-23 13:54:09 +02:00
Michael Vetter
df1b19ecec Reformat color.c 2019-08-23 13:48:42 +02:00
Michael Vetter
8a04496c79 Add header to color.h 2019-08-23 13:47:41 +02:00
Michael Vetter
0b9880f7a0 Use log_error() instead of g_warning() 2019-08-23 13:46:14 +02:00
Aurelien Aptel
269afa53b4 Add 256 colors support
Themes can now use color names from the xterm color name list [1].

1: https://jonasjacek.github.io/colors/
2019-08-23 13:25:45 +02:00
Michael Vetter
10ca3e8c31 Possibility to specify alternative config file
Introduce `profanity -c` to specify an alternative config file.
2019-08-02 15:55:47 +02:00
Michael Vetter
658e36a066 Add 'save' command to save preferences
Most applications have an 'apply changes' button. This makes testing
easier too.

Implement https://github.com/profanity-im/profanity/issues/1164
2019-08-02 10:23:13 +02:00
Paul Fariello
9482ce6168 Set foreground color for untrusted messages 2019-06-20 14:30:45 +02:00
Paul Fariello
3bb3cc625d Use flags in xmmp/message.c for encryption and trust 2019-06-20 14:30:37 +02:00