aboutsummaryrefslogtreecommitdiffstats
path: root/src/command
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2021-01-28 15:11:50 +0100
committerMichael Vetter <jubalh@iodoru.org>2021-01-28 15:11:50 +0100
commit44fc3f05069ec8981e953e3089af0d98026ac450 (patch)
tree3df39ee3d2ec7570698d8cea28035cd1ace648cf /src/command
parent05bf065e68108d21adc3a5ec19d8dc3b0c5b8d26 (diff)
downloadprofani-tty-44fc3f05069ec8981e953e3089af0d98026ac450.tar.gz
Add /mam command
Regards https://github.com/profanity-im/profanity/issues/660
Diffstat (limited to 'src/command')
-rw-r--r--src/command/cmd_ac.c6
-rw-r--r--src/command/cmd_defs.c15
-rw-r--r--src/command/cmd_funcs.c8
-rw-r--r--src/command/cmd_funcs.h1
4 files changed, 27 insertions, 3 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index f7414bad..65d73b33 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -1165,12 +1165,12 @@ cmd_ac_remove_form_fields(DataForm* form)
char*
cmd_ac_complete(ProfWin* window, const char* const input, gboolean previous)
{
- char *found = NULL;
+ char* found = NULL;
// autocomplete command
if ((strncmp(input, "/", 1) == 0) && (!strchr(input, ' '))) {
found = autocomplete_complete(commands_ac, input, TRUE, previous);
- // autocomplete parameters
+ // autocomplete parameters
} else {
found = _cmd_ac_complete_params(window, input, previous);
}
@@ -1633,7 +1633,7 @@ _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previ
// autocomplete boolean settings
gchar* boolean_choices[] = { "/beep", "/intype", "/states", "/outtype", "/flash", "/splash",
- "/history", "/vercheck", "/privileges", "/wrap", "/carbons", "/os", "/slashguard" };
+ "/history", "/vercheck", "/privileges", "/wrap", "/carbons", "/os", "/slashguard", "/mam" };
for (int i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
result = autocomplete_param_with_func(input, boolean_choices[i], prefs_autocomplete_boolean_choice, previous, NULL);
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c
index 94633f03..ce79cf7d 100644
--- a/src/command/cmd_defs.c
+++ b/src/command/cmd_defs.c
@@ -2546,6 +2546,21 @@ static struct cmd_t command_defs[] = {
"/url save https://profanity-im.github.io/guide/latest/userguide.html /home/user/Download/")
},
+ { "/mam",
+ parse_args, 1, 1, &cons_mam_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_mam)
+ CMD_TAGS(
+ CMD_TAG_CHAT)
+ CMD_SYN(
+ "/os <on>|<off>")
+ CMD_DESC(
+ "Enable/Disable Message Archive Management (XEP-0313)")
+ CMD_ARGS(
+ { "on|off", "Enable or disable MAM" })
+ CMD_NOEXAMPLES
+ },
+
// NEXT-COMMAND (search helper)
};
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index c227b79d..d2cf2307 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -9278,3 +9278,11 @@ cmd_executable_urlsave(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
+
+gboolean
+cmd_mam(ProfWin* window, const char* const command, gchar** args)
+{
+ _cmd_set_boolean_preference(args[0], command, "Message Archive Management", PREF_MAM);
+
+ return TRUE;
+}
diff --git a/src/command/cmd_funcs.h b/src/command/cmd_funcs.h
index 4955972c..bcd634da 100644
--- a/src/command/cmd_funcs.h
+++ b/src/command/cmd_funcs.h
@@ -240,5 +240,6 @@ gboolean cmd_url_save(ProfWin* window, const char* const command, gchar** args);
gboolean cmd_executable_avatar(ProfWin* window, const char* const command, gchar** args);
gboolean cmd_executable_urlopen(ProfWin* window, const char* const command, gchar** args);
gboolean cmd_executable_urlsave(ProfWin* window, const char* const command, gchar** args);
+gboolean cmd_mam(ProfWin* window, const char* const command, gchar** args);
#endif