Show the /whois result in the window it was typed in.
This commit is contained in:
parent
e1578532e3
commit
f7378e0d42
|
@ -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("* <strong>Is an administrator</strong>", null, true);
|
||||
cah.log.status_with_game(chatWindowId, "* <strong>Is an administrator</strong>", 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: <a onclick='$(\"#filter_games\").val(\"" + nick
|
||||
cah.log.status_with_game(chatWindowId, "* Game: <a onclick='$(\"#filter_games\").val(\"" + nick
|
||||
+ "\").keyup()' class='gamelink'>#" + gameId + "</a>, " + 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");
|
||||
};
|
||||
|
|
|
@ -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.");
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue