feat: Add /force-encryption command and update message handling
All checks were successful
CI / Check spelling (pull_request) Successful in 18s
CI / Check coding style (pull_request) Successful in 34s
CI / Linux (ubuntu) (pull_request) Successful in 14m5s
CI / Linux (debian) (pull_request) Successful in 14m5s
CI / Linux (arch) (pull_request) Successful in 14m53s
All checks were successful
CI / Check spelling (pull_request) Successful in 18s
CI / Check coding style (pull_request) Successful in 34s
CI / Linux (ubuntu) (pull_request) Successful in 14m5s
CI / Linux (debian) (pull_request) Successful in 14m5s
CI / Linux (arch) (pull_request) Successful in 14m53s
Implement /force-encryption command to configure forced encryption settings with on|off and policy resend-to-confirm|block options. The changes enhance user experience by clarifying encryption requirements and providing actionable commands. Users can now press Enter again to confirm unencrypted messages in resend-to-confirm mode.
This commit is contained in:
@@ -10633,3 +10633,22 @@ cmd_vcard_save(ProfWin* window, const char* const command, gchar** args)
|
||||
cons_show("User vCard uploaded");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_force_encryption(ProfWin* window, const char* const command, gchar** args)
|
||||
{
|
||||
if (g_strv_length(args) == 1 && (g_strcmp0(args[0], "on") == 0 || g_strcmp0(args[0], "off") == 0)) {
|
||||
_cmd_set_boolean_preference(args[0], "Forces encryption", PREF_FORCE_ENCRYPTION);
|
||||
} else if (g_strv_length(args) == 2 && g_strcmp0(args[0], "policy") == 0) {
|
||||
if (g_strcmp0(args[1], "resend-to-confirm") != 0 && g_strcmp0(args[1], "block") != 0) {
|
||||
cons_show_error("Invalid policy: \"%s\". See '/help force-encryption' for details.", args[1]);
|
||||
return TRUE;
|
||||
}
|
||||
prefs_set_string(PREF_FORCE_ENCRYPTION_MODE, args[1]);
|
||||
cons_show("Force encryption policy has been set to \"%s\".", args[1]);
|
||||
} else {
|
||||
cons_bad_cmd_usage(command);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
Reference in New Issue
Block a user