0
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-07-26 12:14:28 -04:00

Merge 116e85fe74af4e52ba59f1661c2c31e11b48e856 into 0081db643f306d1b62304780f4ee3ae4b0540ec4

This commit is contained in:
Andrea Zanni 2025-02-02 10:57:27 +05:30 committed by GitHub
commit 4ca062d04a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 40 additions and 3 deletions

View File

@ -2307,7 +2307,8 @@ static const struct cmd_t command_defs[] = {
{ "char", cmd_omemo_char },
{ "policy", cmd_omemo_policy },
{ "clear_device_list", cmd_omemo_clear_device_list },
{ "qrcode", cmd_omemo_qrcode })
{ "qrcode", cmd_omemo_qrcode },
{ "colors", cmd_omemo_colors })
CMD_TAGS(
CMD_TAG_CHAT,
CMD_TAG_UI)
@ -2322,7 +2323,8 @@ static const struct cmd_t command_defs[] = {
"/omemo trustmode manual|firstusage|blind",
"/omemo policy manual|automatic|always",
"/omemo clear_device_list",
"/omemo qrcode")
"/omemo qrcode",
"/omemo colors on|off")
CMD_DESC(
"OMEMO commands to manage keys, and perform encryption during chat sessions.")
CMD_ARGS(
@ -2340,7 +2342,8 @@ static const struct cmd_t command_defs[] = {
{ "policy automatic", "Set the global OMEMO policy to opportunistic, an OMEMO session will be attempted upon starting a conversation." },
{ "policy always", "Set the global OMEMO policy to always, an error will be displayed if an OMEMO session cannot be initiated upon starting a conversation." },
{ "clear_device_list", "Clear your own device list on server side. Each client will reannounce itself when connected back."},
{ "qrcode", "Display QR code of your OMEMO fingerprint"})
{ "qrcode", "Display QR code of your OMEMO fingerprint"},
{ "colors on|off", "Enable or disable coloring of OMEMO messages. Default: off." })
CMD_EXAMPLES(
"/omemo gen",
"/omemo start odin@valhalla.edda",

View File

@ -8800,6 +8800,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)
{

View File

@ -233,6 +233,7 @@ gboolean cmd_omemo_trust_mode(ProfWin* window, const char* const command, gchar*
gboolean cmd_omemo_policy(ProfWin* window, const char* const command, gchar** args);
gboolean cmd_omemo_clear_device_list(ProfWin* window, const char* const command, gchar** args);
gboolean cmd_omemo_qrcode(ProfWin* window, const char* const command, gchar** args);
gboolean cmd_omemo_colors(ProfWin* window, const char* const command, gchar** args);
gboolean cmd_save(ProfWin* window, const char* const command, gchar** args);
gboolean cmd_reload(ProfWin* window, const char* const command, gchar** args);

View File

@ -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:

View File

@ -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,

View File

@ -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);
}