mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Adds preference PREF_OMEMO_COLORS
This commit adds the possibility to save the preference for `/omemo colors on|off`.
This commit is contained in:
parent
8fbadae369
commit
dd9289828e
@ -3,17 +3,16 @@
|
||||
The main goal of this MarkDown is to organize the ideas for this feature that has the potential to become an interesting and useful feature for every profanity's user, IMHO. The chosen color must not cause eyestrain on long OMEMO chats sessions. I'll try to keep this document updated as I make progress in the development.
|
||||
|
||||
## TODO list
|
||||
- [ ] Understand how to implement the option `/omemo color on|off` (default: off).
|
||||
- [ ] Implement `/omemo color on|off`.
|
||||
- [ ] Understand how `/save` works.
|
||||
- [X] Understand how to implement the option `/omemo color on|off` (default: off).
|
||||
- [X] Implement `/omemo color on|off`.
|
||||
- [X] Understand how `/save` works, getting a light grasp of it is sufficient.
|
||||
- [ ] Implement sent OMEMO messages are white, received OMEMO messages are darker white.
|
||||
- [ ] When `/omemo color on`, implement sent OMEMO messages are white, received OMEMO messages are darker white.
|
||||
- [ ] Understand how to insert `color` in the autocompletion.
|
||||
|
||||
-------------------------------
|
||||
- [ ] Support OMEMO colors on MUC.
|
||||
- [ ] Develop a contrast checker to choose which color should be used based on the loaded theme.
|
||||
- [ ] Make a working example of OMEMO messages. Sent OMEMO messages will be blue whereas received OMEMO messages will be of a darker blue. This choice should work well with the default theme of profanity without causing eyestrain. Perhaps, a better idea would be leave sent OMEMO messages white and make received OMEMO messages darker white, in this case it would be advised to set the `/omemo char <symbol>`.
|
||||
- [ ] Support OMEMO colors on MUC. NOTE: profanity doesn't support OMEMO on MUCs yet.
|
||||
- [ ] Develop a contrast checker to choose which color for OMEMO received messages should be used based on the loaded theme.
|
||||
|
||||
Further ideas:
|
||||
- [ ] (optional) create a background around OMEMO messages.
|
||||
|
@ -8799,6 +8799,30 @@ cmd_omemo_log(ProfWin* window, const char* const command, gchar** args)
|
||||
#endif
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_omemo_colors(ProfWin* window, const char* const command, gchar** args)
|
||||
{
|
||||
#ifdef HAVE_OMEMO
|
||||
char* choice = args[1];
|
||||
if (g_strcmp0(choice, "on") == 0) {
|
||||
prefs_set_string(PREF_OMEMO_COLORS, "on");
|
||||
cons_show("Received OMEMO messages will be darker white.");
|
||||
} else if (g_strcmp0(choice, "off") == 0) {
|
||||
prefs_set_string(PREF_OMEMO_COLORS, "off");
|
||||
cons_show("Received OMEMO messages will be the default color.");
|
||||
}
|
||||
else
|
||||
{
|
||||
cons_bad_cmd_usage(command);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
#else
|
||||
cons_show("This version of Profanity has not been built with OMEMO support enabled");
|
||||
return TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_omemo_end(ProfWin* window, const char* const command, gchar** args)
|
||||
{
|
||||
|
@ -1858,6 +1858,7 @@ _get_group(preference_t pref)
|
||||
case PREF_ROOM_LIST_CACHE:
|
||||
return PREF_GROUP_MUC;
|
||||
case PREF_OMEMO_LOG:
|
||||
case PREF_OMEMO_COLORS:
|
||||
case PREF_OMEMO_POLICY:
|
||||
case PREF_OMEMO_TRUST_MODE:
|
||||
return PREF_GROUP_OMEMO;
|
||||
@ -2114,6 +2115,8 @@ _get_key(preference_t pref)
|
||||
return "statusbar.tabmode";
|
||||
case PREF_OMEMO_LOG:
|
||||
return "log";
|
||||
case PREF_OMEMO_COLORS:
|
||||
return "colors";
|
||||
case PREF_OMEMO_POLICY:
|
||||
return "policy";
|
||||
case PREF_OMEMO_TRUST_MODE:
|
||||
@ -2281,6 +2284,8 @@ _get_default_string(preference_t pref)
|
||||
return "name";
|
||||
case PREF_OMEMO_LOG:
|
||||
return "on";
|
||||
case PREF_OMEMO_COLORS:
|
||||
return "off";
|
||||
case PREF_OMEMO_POLICY:
|
||||
return "automatic";
|
||||
case PREF_OMEMO_TRUST_MODE:
|
||||
|
@ -168,6 +168,7 @@ typedef enum {
|
||||
PREF_OMEMO_LOG,
|
||||
PREF_OMEMO_POLICY,
|
||||
PREF_OMEMO_TRUST_MODE,
|
||||
PREF_OMEMO_COLORS,
|
||||
PREF_OCCUPANTS_WRAP,
|
||||
PREF_CORRECTION_ALLOW,
|
||||
PREF_AVATAR_CMD,
|
||||
|
@ -2271,6 +2271,9 @@ cons_show_omemo_prefs(void)
|
||||
auto_gchar gchar* ch = prefs_get_omemo_char();
|
||||
cons_show("OMEMO char (/omemo char) : %s", ch);
|
||||
|
||||
auto_gchar gchar* colors_value = prefs_get_string(PREF_OMEMO_COLORS);
|
||||
cons_show("OMEMO colors (/omemo colors) : %s", colors_value);
|
||||
|
||||
cons_alert(NULL);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user