From 5a48b7b7d5a170154054f31b7ba11a3b5746e4b6 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 1 May 2016 20:06:34 +0100 Subject: [PATCH] Use current jid for /blocked add in chat win --- src/command/commands.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/command/commands.c b/src/command/commands.c index a717054b..c83bf908 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -2998,14 +2998,20 @@ cmd_blocked(ProfWin *window, const char *const command, gchar **args) } if (g_strcmp0(args[0], "add") == 0) { - if (args[1] == NULL) { + char *jid = args[1]; + if (jid == NULL && (window->type == WIN_CHAT)) { + ProfChatWin *chatwin = (ProfChatWin*)window; + jid = chatwin->barejid; + } + + if (jid == NULL) { cons_bad_cmd_usage(command); return TRUE; } - gboolean res = blocked_add(args[1]); + gboolean res = blocked_add(jid); if (!res) { - cons_show("User %s already blocked.", args[1]); + cons_show("User %s already blocked.", jid); } return TRUE;