diff options
author | James Booth <boothj5@gmail.com> | 2015-08-06 01:56:52 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-08-06 01:56:52 +0100 |
commit | 406b821b35797081936be3a5c51a35ac23a1ca92 (patch) | |
tree | 2f36178cf7a870ff96e64abb056778d429bb646e /src/command | |
parent | b75bc660b4109ce06ff38afc1e9574904523e9a3 (diff) | |
download | profani-tty-406b821b35797081936be3a5c51a35ac23a1ca92.tar.gz |
Show software version result in current window
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/commands.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/command/commands.c b/src/command/commands.c index ede1b395..5e7146fc 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -2104,6 +2104,30 @@ cmd_software(ProfWin *window, const char * const command, gchar **args) } break; case WIN_CHAT: + if (args[0]) { + cons_show("No parameter needed to /software when in chat."); + } else { + ProfChatWin *chatwin = (ProfChatWin*)window; + assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK); + + char *resource = NULL; + ChatSession *session = chat_session_get(chatwin->barejid); + if (chatwin->resource_override) { + resource = chatwin->resource_override; + } else if (session && session->resource) { + resource = session->resource; + } + + if (resource) { + GString *fulljid = g_string_new(chatwin->barejid); + g_string_append_printf(fulljid, "/%s", resource); + iq_send_software_version(fulljid->str); + g_string_free(fulljid, TRUE); + } else { + win_println(window, 0, "Unknown resource for /software command."); + } + } + break; case WIN_CONSOLE: if (args[0]) { Jid *myJid = jid_create(jabber_get_fulljid()); |