Changeset View
Standalone View
binaries/data/mods/public/gui/lobby/lobby.js
Show First 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* Whether the player was already asked to reconnect to the lobby. | * Whether the player was already asked to reconnect to the lobby. | ||||
* Ensures that no more than one message box is opened at a time. | * Ensures that no more than one message box is opened at a time. | ||||
*/ | */ | ||||
var g_AskedReconnect = false; | var g_AskedReconnect = false; | ||||
/** | /** | ||||
* These functions handle messages sent to this user directly, i.e. not through the multi-user-chat room. | |||||
*/ | |||||
var g_MessageHandlers = { | |||||
"Chat": msg => { | |||||
// We intend to not support private messages between users | |||||
Stan: "Private messages between users are not supported." ? | |||||
elexisAuthorUnsubmitted Done Inline ActionsThat doesn't express that it is intentionally not supported, so someone will remove the line and can claim to add support. elexis: That doesn't express that it is intentionally not supported, so someone will remove the line… | |||||
if (msg.from && Engine.LobbyGetPlayerRole(msg.from) != "moderator") | |||||
return; | |||||
// some XMPP clients send trailing whitespace | |||||
StanUnsubmitted Not Done Inline ActionsCapital S, final dot. Stan: Capital S, final dot. | |||||
addChatMessage({ | |||||
"from": escapeText(msg.from || "system"), | |||||
"text": escapeText(msg.body.trim()), | |||||
"time": msg.time, | |||||
"private": true, | |||||
"historic": msg.historic | |||||
}); | |||||
}, | |||||
"Error": msg => { | |||||
addChatMessage({ | |||||
"from": "system", | |||||
"text": escapeText(msg.body), | |||||
"time": msg.time, | |||||
"historic": msg.historic | |||||
}); | |||||
}, | |||||
"Groupchat": msg => { | |||||
error("Unexpected groupchat message: " + uneval(msg)) | |||||
}, | |||||
"Headline": msg => { | |||||
// Announcement or message of the day | |||||
StanUnsubmitted Not Done Inline ActionsMissing dot. Stan: Missing dot. | |||||
addChatMessage({ | |||||
"from": escapeText(msg.from || "system"), | |||||
"text": escapeText(msg.subject.trim()) + "\n" + escapeText(msg.body.trim()), | |||||
"time": msg.time, | |||||
"historic": msg.historic | |||||
}); | |||||
if (!msg.historic) | |||||
messageBox( | |||||
400, 250, | |||||
msg.body.trim(), | |||||
msg.subject.trim()); | |||||
elexisAuthorUnsubmitted Done Inline ActionsAs reported by riversa during the test announcement stage yesterday, the popup boxes should not be displayed again when the user opens the lobby dialog again (only the first time). (08:35:46 PM) ValihrAnt: is the announcement showing up everytime i look at lobby room intended/ elexis: As reported by riversa during the test announcement stage yesterday, the popup boxes should not… | |||||
}, | |||||
"Normal": msg => { | |||||
warn("Normal message not implemented: " + uneval(msg)); | |||||
} | |||||
}; | |||||
/** | |||||
* These functions handle messages sent through the multi-user-chat room. | |||||
*/ | |||||
var g_MUCRoomMessageHandlers = { | |||||
"Chat": msg => { | |||||
// We intend to not support private messages between users | |||||
if (msg.private && (msg.from && Engine.LobbyGetPlayerRole(msg.from) != "moderator")) | |||||
return; | |||||
addChatMessage({ | |||||
"from": escapeText(msg.from), | |||||
"text": escapeText(msg.body), | |||||
"time": msg.times, | |||||
"private": msg.private, | |||||
"historic": msg.historic | |||||
}); | |||||
}, | |||||
"Error": msg => { | |||||
addChatMessage({ | |||||
"from": "system", | |||||
"text": escapeText(msg.tex), | |||||
"time": msg.time, | |||||
"historic": msg.historic | |||||
}); | |||||
}, | |||||
"Groupchat": msg => { | |||||
addChatMessage({ | |||||
"from": escapeText(msg.from), | |||||
"text": escapeText(msg.body), | |||||
"time": msg.time, | |||||
"historic": msg.historic | |||||
}); | |||||
}, | |||||
"Headline": msg => { | |||||
warn("Headline muc room message not implemented: " + uneval(msg)); | |||||
}, | |||||
"Normal": msg => { | |||||
// gloox receives an empty message of this type if the banlist changed | |||||
if (msg.subject || msg.body) | |||||
warn("Normal muc message not implemented: " + uneval(msg)); | |||||
} | |||||
}; | |||||
/** | |||||
* Processing of notifications sent by XmppClient.cpp. | * Processing of notifications sent by XmppClient.cpp. | ||||
* | |||||
* @returns true if the playerlist GUI must be updated. | |||||
*/ | */ | ||||
var g_NetMessageTypes = { | var g_NetMessageTypes = { | ||||
"system": { | "system": { | ||||
// Three cases are handled in prelobby.js | // Three cases are handled in prelobby.js | ||||
"registered": msg => { | "registered": msg => { | ||||
}, | }, | ||||
"connected": msg => { | "connected": msg => { | ||||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | "nick": msg => { | ||||
}); | }); | ||||
}, | }, | ||||
"kicked": msg => { | "kicked": msg => { | ||||
handleKick(false, msg.nick, msg.reason, msg.time, msg.historic); | handleKick(false, msg.nick, msg.reason, msg.time, msg.historic); | ||||
}, | }, | ||||
"banned": msg => { | "banned": msg => { | ||||
handleKick(true, msg.nick, msg.reason, msg.time, msg.historic); | handleKick(true, msg.nick, msg.reason, msg.time, msg.historic); | ||||
}, | }, | ||||
"room-message": msg => { | "muc-message": msg => { | ||||
addChatMessage({ | if (g_MUCRoomMessageHandlers[msg.subtype]) | ||||
"from": escapeText(msg.from), | g_MUCRoomMessageHandlers[msg.subtype](msg); | ||||
"text": escapeText(msg.text), | else | ||||
"time": msg.time, | error("Received invalid MUC message: " + uneval(msg)); | ||||
"historic": msg.historic | |||||
}); | |||||
}, | }, | ||||
"private-message": msg => { | "message": msg => { | ||||
// Announcements and the Message of the Day are sent by the server directly | if (g_MessageHandlers[msg.subtype]) | ||||
if (!msg.from) | g_MessageHandlers[msg.subtype](msg); | ||||
messageBox( | else | ||||
400, 250, | error("Received invalid message: " + uneval(msg)); | ||||
msg.text.trim(), | |||||
translate("Notice")); | |||||
// We intend to not support private messages between users | |||||
if (!msg.from || Engine.LobbyGetPlayerRole(msg.from) == "moderator") | |||||
// some XMPP clients send trailing whitespace | |||||
addChatMessage({ | |||||
"from": escapeText(msg.from || "system"), | |||||
"text": escapeText(msg.text.trim()), | |||||
"time": msg.time, | |||||
"historic": msg.historic, | |||||
"private": true | |||||
}); | |||||
} | } | ||||
}, | }, | ||||
"game": { | "game": { | ||||
"gamelist": msg => { | "gamelist": msg => { | ||||
updateGameList(); | updateGameList(); | ||||
}, | }, | ||||
"profile": msg => { | "profile": msg => { | ||||
updateProfile(); | updateProfile(); | ||||
▲ Show 20 Lines • Show All 1,288 Lines • Show Last 20 Lines |
"Private messages between users are not supported." ?