xep-0308: set correction char in config

This commit is contained in:
Michael Vetter
2020-02-10 13:48:31 +01:00
parent 039bf5d04d
commit c2d70a071f
5 changed files with 58 additions and 1 deletions

View File

@@ -2365,7 +2365,7 @@ static struct cmd_t command_defs[] =
{ "/correction",
parse_args, 1, 1, &cons_correction_setting,
CMD_NOSUBFUNCS
CMD_MAINFUNC(cmd_os)
CMD_MAINFUNC(cmd_correction)
CMD_TAGS(
CMD_TAG_CHAT,
CMD_TAG_GROUPCHAT)

View File

@@ -8651,3 +8651,30 @@ cmd_os(ProfWin *window, const char *const command, gchar **args)
return TRUE;
}
gboolean
cmd_correction(ProfWin *window, const char *const command, gchar **args)
{
// enable/disable
if (g_strcmp0(args[0], "on") == 0) {
prefs_set_boolean(PREF_BOOKMARK_INVITE, TRUE);
return TRUE;
} else if (g_strcmp0(args[0], "off") == 0) {
prefs_set_boolean(PREF_BOOKMARK_INVITE, FALSE);
return TRUE;
}
// char
if (g_strcmp(args[0], "char") == 0) {
if (args[1] == NULL) {
cons_bad_cmd_usage(command);
} else if (strlen(args[1]) != 1) {
cons_bad_cmd_usage(command);
} else {
prefs_set_correction_char(args[1][0]);
cons_show("LMC char set to %c.", args[1][0]);
}
}
return TRUE;
}

View File

@@ -227,4 +227,5 @@ gboolean cmd_paste(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_color(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_avatar(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_os(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_correction(ProfWin *window, const char *const command, gchar **args);
#endif