diff --git a/WebContent/js/cah.ajax.handlers.js b/WebContent/js/cah.ajax.handlers.js index bb3b7eb..654ec70 100644 --- a/WebContent/js/cah.ajax.handlers.js +++ b/WebContent/js/cah.ajax.handlers.js @@ -305,21 +305,23 @@ cah.ajax.SuccessHandlers[cah.$.AjaxOperation.CARDCAST_LIST_CARDSETS] = function( } }; -cah.ajax.SuccessHandlers[cah.$.AjaxOperation.WHOIS] = function(data) { +cah.ajax.SuccessHandlers[cah.$.AjaxOperation.WHOIS] = function(data, req) { + var chatWindowId = req[cah.$.AjaxRequest.GAME_ID]; var nick = data[cah.$.AjaxResponse.NICKNAME]; var sigil = data[cah.$.AjaxResponse.SIGIL]; - cah.log.status("Whois information for " + sigil + nick + ":"); + cah.log.status_with_game(chatWindowId, "Whois information for " + sigil + nick + ":"); if (cah.$.Sigil.ADMIN == sigil) { - cah.log.status("* Is an administrator", null, true); + cah.log.status_with_game(chatWindowId, "* Is an administrator", null, true); } if (data[cah.$.AjaxResponse.ID_CODE] != "") { - cah.log.status("* Identification code: " + data[cah.$.AjaxResponse.ID_CODE]); + cah.log.status_with_game(chatWindowId, "* Identification code: " + + data[cah.$.AjaxResponse.ID_CODE]); } if (data[cah.$.AjaxResponse.IP_ADDRESS]) { - cah.log.status("* Hostname: " + data[cah.$.AjaxResponse.IP_ADDRESS]); + cah.log.status_with_game(chatWindowId, "* Hostname: " + data[cah.$.AjaxResponse.IP_ADDRESS]); } if (data[cah.$.AjaxResponse.CLIENT_NAME]) { - cah.log.status("* Client: " + data[cah.$.AjaxResponse.CLIENT_NAME]); + cah.log.status_with_game(chatWindowId, "* Client: " + data[cah.$.AjaxResponse.CLIENT_NAME]); } var gameId = data[cah.$.AjaxResponse.GAME_ID]; if (undefined !== gameId) { @@ -331,13 +333,13 @@ cah.ajax.SuccessHandlers[cah.$.AjaxOperation.WHOIS] = function(data) { break; } } - cah.log.status("* Game: #" + gameId + ", " + stateMsg, null, true); } - cah.log.status("* Connected at " + cah.log.status_with_game(chatWindowId, "* Connected at " + new Date(data[cah.$.AjaxResponse.CONNECTED_AT]).toLocaleString()); var idle = new Date(data[cah.$.AjaxResponse.IDLE]); - cah.log.status("* Idle " + idle.getUTCHours() + " hours " + idle.getUTCMinutes() + " mins " - + idle.getUTCSeconds() + " secs"); - cah.log.status("End of whois information"); + cah.log.status_with_game(chatWindowId, "* Idle " + idle.getUTCHours() + " hours " + + idle.getUTCMinutes() + " mins " + idle.getUTCSeconds() + " secs"); + cah.log.status_with_game(chatWindowId, "End of whois information"); }; diff --git a/WebContent/js/cah.app.js b/WebContent/js/cah.app.js index d87540d..2d26e29 100644 --- a/WebContent/js/cah.app.js +++ b/WebContent/js/cah.app.js @@ -238,6 +238,10 @@ function chatsubmit_click(game_id, parent_element) { break; case 'whois': ajax = cah.Ajax.build(cah.$.AjaxOperation.WHOIS).withNickname(text.split(' ')[0]); + // so we can show it in the right place; the server ignores this + if (game_id !== null) { + ajax = ajax.withGameId(game_id); + } break; default: cah.log.error("Invalid command."); diff --git a/WebContent/js/cah.log.js b/WebContent/js/cah.log.js index c14362e..32a38ce 100644 --- a/WebContent/js/cah.log.js +++ b/WebContent/js/cah.log.js @@ -79,7 +79,8 @@ cah.log.status = function(text, opt_class, opt_allow_html, opt_title) { */ cah.log.status_with_game = function(game_or_id, text, opt_class, opt_allow_html, opt_title) { var logElement; - if (game_or_id === null) { + // I think == null here would catch both of these cases and also be okay with game id 0 but... + if (game_or_id === null || game_or_id === undefined) { logElement = cah.log.log; } else { var game;