diff options
author | Paul Fariello <paul@fariello.eu> | 2018-07-02 08:10:01 +0320 |
---|---|---|
committer | Paul Fariello <paul@fariello.eu> | 2018-09-05 13:52:20 +0200 |
commit | ec5fc3612fd46cc3661f5ec6988e54900f271447 (patch) | |
tree | 95a881e168be9295a3fb71d2bacce2d35b6f3881 /src/command/cmd_funcs.c | |
parent | e555e41eaf97bb40a41bbb25f1cc68cf537f9fd5 (diff) | |
download | profani-tty-ec5fc3612fd46cc3661f5ec6988e54900f271447.tar.gz |
Allow to use cmd without being in a window
Diffstat (limited to 'src/command/cmd_funcs.c')
-rw-r--r-- | src/command/cmd_funcs.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index 475a81b4..f067d67a 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -7484,9 +7484,12 @@ cmd_command_list(ProfWin *window, const char *const command, gchar **args) return TRUE; } - ProfMucWin *mucwin = (ProfMucWin*)window; - - iq_command_list(mucwin->roomjid); + char *jid = args[1]; + if (jid == NULL) { + ProfMucWin *mucwin = (ProfMucWin*)window; + jid = mucwin->roomjid; + } + iq_command_list(jid); cons_show("List available ad hoc commands"); return TRUE; @@ -7507,9 +7510,13 @@ cmd_command_exec(ProfWin *window, const char *const command, gchar **args) return TRUE; } - ProfMucWin *mucwin = (ProfMucWin*)window; + char *jid = args[2]; + if (jid == NULL) { + ProfMucWin *mucwin = (ProfMucWin*)window; + jid = mucwin->roomjid; + } - iq_command_exec(mucwin->roomjid, args[1]); + iq_command_exec(jid, args[1]); cons_show("Execute %s...", args[1]); return TRUE; |