about summary refs log tree commit diff stats
path: root/src/command/commands.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-05-01 20:06:34 +0100
committerJames Booth <boothj5@gmail.com>2016-05-01 20:06:34 +0100
commit5a48b7b7d5a170154054f31b7ba11a3b5746e4b6 (patch)
treee9212f39f037c467be0e6fd799383b169563c6d8 /src/command/commands.c
parentb8c94376aad2d5edf4390e47b8dc89db8ab1a517 (diff)
downloadprofani-tty-5a48b7b7d5a170154054f31b7ba11a3b5746e4b6.tar.gz
Use current jid for /blocked add in chat win
Diffstat (limited to 'src/command/commands.c')
-rw-r--r--src/command/commands.c12
1 files 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;