mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Add /mam command
Regards https://github.com/profanity-im/profanity/issues/660
This commit is contained in:
parent
05bf065e68
commit
44fc3f0506
@ -1165,7 +1165,7 @@ cmd_ac_remove_form_fields(DataForm* form)
|
|||||||
char*
|
char*
|
||||||
cmd_ac_complete(ProfWin* window, const char* const input, gboolean previous)
|
cmd_ac_complete(ProfWin* window, const char* const input, gboolean previous)
|
||||||
{
|
{
|
||||||
char *found = NULL;
|
char* found = NULL;
|
||||||
// autocomplete command
|
// autocomplete command
|
||||||
if ((strncmp(input, "/", 1) == 0) && (!strchr(input, ' '))) {
|
if ((strncmp(input, "/", 1) == 0) && (!strchr(input, ' '))) {
|
||||||
found = autocomplete_complete(commands_ac, input, TRUE, previous);
|
found = autocomplete_complete(commands_ac, input, TRUE, previous);
|
||||||
@ -1633,7 +1633,7 @@ _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previ
|
|||||||
|
|
||||||
// autocomplete boolean settings
|
// autocomplete boolean settings
|
||||||
gchar* boolean_choices[] = { "/beep", "/intype", "/states", "/outtype", "/flash", "/splash",
|
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++) {
|
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);
|
result = autocomplete_param_with_func(input, boolean_choices[i], prefs_autocomplete_boolean_choice, previous, NULL);
|
||||||
|
@ -2546,6 +2546,21 @@ static struct cmd_t command_defs[] = {
|
|||||||
"/url save https://profanity-im.github.io/guide/latest/userguide.html /home/user/Download/")
|
"/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)
|
// NEXT-COMMAND (search helper)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -9278,3 +9278,11 @@ cmd_executable_urlsave(ProfWin* window, const char* const command, gchar** args)
|
|||||||
|
|
||||||
return TRUE;
|
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;
|
||||||
|
}
|
||||||
|
@ -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_avatar(ProfWin* window, const char* const command, gchar** args);
|
||||||
gboolean cmd_executable_urlopen(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_executable_urlsave(ProfWin* window, const char* const command, gchar** args);
|
||||||
|
gboolean cmd_mam(ProfWin* window, const char* const command, gchar** args);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2082,6 +2082,16 @@ cons_slashguard_setting(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cons_mam_setting(void)
|
||||||
|
{
|
||||||
|
if (prefs_get_boolean(PREF_MAM)) {
|
||||||
|
cons_show("Message Archive Management (XEP-0313) (/mam) : ON");
|
||||||
|
} else {
|
||||||
|
cons_show("Message Archive Management (XEP-0313) (/mam) : OFF");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cons_show_connection_prefs(void)
|
cons_show_connection_prefs(void)
|
||||||
{
|
{
|
||||||
|
@ -321,6 +321,7 @@ void cons_os_setting(void);
|
|||||||
void cons_correction_setting(void);
|
void cons_correction_setting(void);
|
||||||
void cons_executable_setting(void);
|
void cons_executable_setting(void);
|
||||||
void cons_slashguard_setting(void);
|
void cons_slashguard_setting(void);
|
||||||
|
void cons_mam_setting(void);
|
||||||
void cons_show_contact_online(PContact contact, Resource* resource, GDateTime* last_activity);
|
void cons_show_contact_online(PContact contact, Resource* resource, GDateTime* last_activity);
|
||||||
void cons_show_contact_offline(PContact contact, char* resource, char* status);
|
void cons_show_contact_offline(PContact contact, char* resource, char* status);
|
||||||
void cons_theme_properties(void);
|
void cons_theme_properties(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user