diff options
| author | Michael Vetter <jubalh@iodoru.org> | 2022-06-22 12:02:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-22 12:02:51 +0200 |
| commit | 6147a1342d4cda8cb5c15d1453d48dc028c2b24d (patch) | |
| tree | a2f1731cf0d1175e8dacb0af8ec3d97478cd6fe9 /src/command | |
| parent | f4d8728809640a812e02eb6974989f4e08f9a38b (diff) | |
| parent | 918d0608173d8f561eea3071613818bf3a59319d (diff) | |
| download | profani-tty-6147a1342d4cda8cb5c15d1453d48dc028c2b24d.tar.gz | |
Merge pull request #1725 from profanity-im/feat/optional-mood
Make display of user mood optional
Diffstat (limited to 'src/command')
| -rw-r--r-- | src/command/cmd_ac.c | 2 | ||||
| -rw-r--r-- | src/command/cmd_defs.c | 4 | ||||
| -rw-r--r-- | src/command/cmd_funcs.c | 10 |
3 files changed, 14 insertions, 2 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c index 531d189b..d8121d65 100644 --- a/src/command/cmd_ac.c +++ b/src/command/cmd_ac.c @@ -1079,6 +1079,8 @@ cmd_ac_init(void) mood_ac = autocomplete_new(); autocomplete_add(mood_ac, "set"); autocomplete_add(mood_ac, "clear"); + autocomplete_add(mood_ac, "on"); + autocomplete_add(mood_ac, "off"); mood_type_ac = autocomplete_new(); autocomplete_add(mood_type_ac, "afraid"); autocomplete_add(mood_type_ac, "amazed"); diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c index 411de396..2eaec284 100644 --- a/src/command/cmd_defs.c +++ b/src/command/cmd_defs.c @@ -2714,17 +2714,19 @@ static struct cmd_t command_defs[] = { }, { "/mood", - parse_args, 1, 3, NULL, + parse_args, 1, 3, &cons_mood_setting, CMD_NOSUBFUNCS CMD_MAINFUNC(cmd_mood) CMD_TAGS( CMD_TAG_CHAT) CMD_SYN( + "/mood on|off", "/mood set <mood> [text]", "/mood clear") CMD_DESC( "Set your mood (XEP-0107).") CMD_ARGS( + { "on|off", "Enable or disable displaying the mood of other users. On by default."}, { "set <mood> [text]", "Set user mood to <mood> with an optional [text]. Use /mood set <tab> to toggle through predfined moods." }, { "clear", "Clear your user mood." }) CMD_EXAMPLES( diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index bd025886..4edc7c16 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -90,6 +90,7 @@ #include "xmpp/muc.h" #include "xmpp/chat_session.h" #include "xmpp/avatar.h" +#include "xmpp/stanza.h" #ifdef HAVE_LIBOTR #include "otr/otr.h" @@ -9769,7 +9770,13 @@ cmd_register(ProfWin* window, const char* const command, gchar** args) gboolean cmd_mood(ProfWin* window, const char* const command, gchar** args) { - if (g_strcmp0(args[0], "set") == 0) { + if (g_strcmp0(args[0], "on") == 0) { + _cmd_set_boolean_preference(args[0], command, "User mood", PREF_MOOD); + caps_add_feature(STANZA_NS_MOOD_NOTIFY); + } else if (g_strcmp0(args[0], "off") == 0) { + _cmd_set_boolean_preference(args[0], command, "User mood", PREF_MOOD); + caps_remove_feature(STANZA_NS_MOOD_NOTIFY); + } else if (g_strcmp0(args[0], "set") == 0) { if (args[1]) { cons_show("Your mood: %s", args[1]); if (args[2]) { @@ -9782,5 +9789,6 @@ cmd_mood(ProfWin* window, const char* const command, gchar** args) cons_show("Clearing the user mood."); publish_user_mood(NULL, NULL); } + return TRUE; } |