Add option to only allow messages from jids in roster
`/silence on` will throw away all messages (type: chat, normal) that come from jids that are not in the roster. Implement https://github.com/profanity-im/profanity/issues/955
This commit is contained in:
@@ -1672,7 +1672,8 @@ _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previ
|
||||
|
||||
// autocomplete boolean settings
|
||||
gchar* boolean_choices[] = { "/beep", "/states", "/outtype", "/flash", "/splash",
|
||||
"/history", "/vercheck", "/privileges", "/wrap", "/carbons", "/os", "/slashguard", "/mam" };
|
||||
"/history", "/vercheck", "/privileges", "/wrap",
|
||||
"/carbons", "/os", "/slashguard", "/mam", "/silence" };
|
||||
|
||||
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);
|
||||
|
||||
@@ -2622,6 +2622,20 @@ static struct cmd_t command_defs[] = {
|
||||
CMD_NOEXAMPLES
|
||||
},
|
||||
|
||||
{ "/silence",
|
||||
parse_args, 1, 1, &cons_silence_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_silence)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CHAT)
|
||||
CMD_SYN(
|
||||
"/silence on|off")
|
||||
CMD_DESC(
|
||||
"Let's you silence all message attempts from people who are not in your roster.")
|
||||
CMD_NOARGS
|
||||
CMD_NOEXAMPLES
|
||||
},
|
||||
|
||||
// NEXT-COMMAND (search helper)
|
||||
};
|
||||
|
||||
|
||||
@@ -9505,3 +9505,11 @@ cmd_editor(ProfWin* window, const char* const command, gchar** args)
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_silence(ProfWin* window, const char* const command, gchar** args)
|
||||
{
|
||||
_cmd_set_boolean_preference(args[0], command, "Block all messages from JIDs that are not in the roster", PREF_SILENCE_NON_ROSTER);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -246,5 +246,6 @@ gboolean cmd_executable_urlsave(ProfWin* window, const char* const command, gcha
|
||||
gboolean cmd_executable_editor(ProfWin* window, const char* const command, gchar** args);
|
||||
gboolean cmd_mam(ProfWin* window, const char* const command, gchar** args);
|
||||
gboolean cmd_editor(ProfWin* window, const char* const command, gchar** args);
|
||||
gboolean cmd_silence(ProfWin* window, const char* const command, gchar** args);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user