mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Merge branch 'DebXWoody/usermoodimprovement1'
This commit is contained in:
commit
f14f9afe03
@ -1063,6 +1063,7 @@ cmd_ac_init(void)
|
||||
|
||||
mood_ac = autocomplete_new();
|
||||
autocomplete_add(mood_ac, "set");
|
||||
autocomplete_add(mood_ac, "clean");
|
||||
mood_type_ac = autocomplete_new();
|
||||
autocomplete_add(mood_type_ac, "afraid");
|
||||
autocomplete_add(mood_type_ac, "amazed");
|
||||
@ -4243,7 +4244,7 @@ _mood_autocomplete(ProfWin* window, const char* const input, gboolean previous)
|
||||
{
|
||||
char* result = NULL;
|
||||
|
||||
result = autocomplete_param_with_ac(input, "/mood", status_ac, TRUE, previous);
|
||||
result = autocomplete_param_with_ac(input, "/mood", mood_ac, TRUE, previous);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
|
@ -2680,20 +2680,23 @@ static struct cmd_t command_defs[] = {
|
||||
},
|
||||
|
||||
{ "/mood",
|
||||
parse_args, 2, 3, NULL,
|
||||
parse_args, 1, 3, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_mood)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CHAT)
|
||||
CMD_SYN(
|
||||
"/mood set <mood> [text]")
|
||||
"/mood set <mood> [text]",
|
||||
"/mood clean")
|
||||
CMD_DESC(
|
||||
"Set your mood (XEP-0107). Use tab to switch through predefined moods.")
|
||||
"Set your mood (XEP-0107).")
|
||||
CMD_ARGS(
|
||||
{ "set <mood>", "Setting your mood." },
|
||||
{ "<text>", "Additional Text." })
|
||||
{ "set <mood> <", "Set user mood to <mood> with an optional [text]. Use /mood set <tab> to toggle through predfined moods." },
|
||||
{ "clean", "Clean your user mood." })
|
||||
CMD_EXAMPLES(
|
||||
"/mood set happy \"So happy to use Profanity!\"")
|
||||
"/mood set happy \"So happy to use Profanity!\"",
|
||||
"/mood set amazed",
|
||||
"/mood clean")
|
||||
},
|
||||
// NEXT-COMMAND (search helper)
|
||||
};
|
||||
|
@ -9650,7 +9650,7 @@ gboolean
|
||||
cmd_mood(ProfWin* window, const char* const command, gchar** args)
|
||||
{
|
||||
if (g_strcmp0(args[0], "set") == 0) {
|
||||
if(args[1]) {
|
||||
if (args[1]) {
|
||||
cons_show("Your mood: %s", args[1]);
|
||||
if (args[2]) {
|
||||
publish_user_mood(args[1], args[2]);
|
||||
@ -9658,6 +9658,9 @@ cmd_mood(ProfWin* window, const char* const command, gchar** args)
|
||||
publish_user_mood(args[1], args[1]);
|
||||
}
|
||||
}
|
||||
} else if (g_strcmp0(args[0], "clean") == 0) {
|
||||
cons_show("Cleaning your user mood.");
|
||||
publish_user_mood(NULL, NULL);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -2828,17 +2828,18 @@ publish_user_mood(const char* const mood, const char* const text)
|
||||
xmpp_stanza_add_child(item, mood_t);
|
||||
|
||||
xmpp_stanza_t* x = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(x, mood);
|
||||
xmpp_stanza_add_child(mood_t, x);
|
||||
|
||||
xmpp_stanza_t* text_t = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(text_t, STANZA_NAME_TEXT);
|
||||
xmpp_stanza_add_child(mood_t, text_t);
|
||||
|
||||
xmpp_stanza_t* t = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_text(t, text);
|
||||
xmpp_stanza_add_child(text_t, t);
|
||||
if (mood) {
|
||||
xmpp_stanza_set_name(x, mood);
|
||||
xmpp_stanza_add_child(mood_t, x);
|
||||
|
||||
xmpp_stanza_set_name(text_t, STANZA_NAME_TEXT);
|
||||
xmpp_stanza_add_child(mood_t, text_t);
|
||||
|
||||
xmpp_stanza_set_text(t, text);
|
||||
xmpp_stanza_add_child(text_t, t);
|
||||
}
|
||||
iq_send_stanza(iq);
|
||||
|
||||
xmpp_stanza_release(iq);
|
||||
|
Loading…
Reference in New Issue
Block a user