Changeset View
Changeset View
Standalone View
Standalone View
source/lobby/scripting/JSInterface_Lobby.cpp
/* Copyright (C) 2020 Wildfire Games. | /* Copyright (C) 2021 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 126 Lines • ▼ Show 20 Lines | JS::Value GuiPollNewMessages(const ScriptInterface& scriptInterface) | ||||
if (!g_XmppClient) | if (!g_XmppClient) | ||||
return JS::UndefinedValue(); | return JS::UndefinedValue(); | ||||
return g_XmppClient->GuiPollNewMessages(scriptInterface); | return g_XmppClient->GuiPollNewMessages(scriptInterface); | ||||
} | } | ||||
// Non-public secure PBKDF2 hash function with salting and 1,337 iterations | // Non-public secure PBKDF2 hash function with salting and 1,337 iterations | ||||
// | // | ||||
Stan: Could invert | |||||
Done Inline ActionsMore consistent with other functions that way wraitii: More consistent with other functions that way | |||||
// TODO: We should use libsodium's crypto_pwhash instead of this. The first reason is that | // TODO: We should use libsodium's crypto_pwhash instead of this. The first reason is that | ||||
// libsodium doesn't propose a bare PBKDF2 hash in its API and it's too bad to rely on custom | // libsodium doesn't propose a bare PBKDF2 hash in its API and it's too bad to rely on custom | ||||
// code when we have a fully-fledged library available; the second reason is that Argon2 (the | // code when we have a fully-fledged library available; the second reason is that Argon2 (the | ||||
// default algorithm for crypto_pwhash) is better than what we use (and it's the default one | // default algorithm for crypto_pwhash) is better than what we use (and it's the default one | ||||
// in the lib for a reason). | // in the lib for a reason). | ||||
// However changing the hashing method should be planned carefully, by trying to login with a | // However changing the hashing method should be planned carefully, by trying to login with a | ||||
// password hashed the old way, and, if successful, updating the password in the database using | // password hashed the old way, and, if successful, updating the password in the database using | ||||
// the new hashing method. Dropping the old hashing code can only be done either by giving users | // the new hashing method. Dropping the old hashing code can only be done either by giving users | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | #define REGISTER_XMPP(func, name) \ | ||||
ScriptFunction::Register<&GuiPollNewMessages>(rq, "LobbyGuiPollNewMessages"); | ScriptFunction::Register<&GuiPollNewMessages>(rq, "LobbyGuiPollNewMessages"); | ||||
REGISTER_XMPP(GuiPollHistoricMessages, "LobbyGuiPollHistoricMessages"); | REGISTER_XMPP(GuiPollHistoricMessages, "LobbyGuiPollHistoricMessages"); | ||||
REGISTER_XMPP(GuiPollHasPlayerListUpdate, "LobbyGuiPollHasPlayerListUpdate"); | REGISTER_XMPP(GuiPollHasPlayerListUpdate, "LobbyGuiPollHasPlayerListUpdate"); | ||||
REGISTER_XMPP(SendMUCMessage, "LobbySendMessage"); | REGISTER_XMPP(SendMUCMessage, "LobbySendMessage"); | ||||
REGISTER_XMPP(SetPresence, "LobbySetPlayerPresence"); | REGISTER_XMPP(SetPresence, "LobbySetPlayerPresence"); | ||||
REGISTER_XMPP(SetNick, "LobbySetNick"); | REGISTER_XMPP(SetNick, "LobbySetNick"); | ||||
REGISTER_XMPP(GetNick, "LobbyGetNick"); | REGISTER_XMPP(GetNick, "LobbyGetNick"); | ||||
REGISTER_XMPP(GetJID, "LobbyGetJID"); | |||||
REGISTER_XMPP(kick, "LobbyKick"); | REGISTER_XMPP(kick, "LobbyKick"); | ||||
REGISTER_XMPP(ban, "LobbyBan"); | REGISTER_XMPP(ban, "LobbyBan"); | ||||
REGISTER_XMPP(GetPresence, "LobbyGetPlayerPresence"); | REGISTER_XMPP(GetPresence, "LobbyGetPlayerPresence"); | ||||
REGISTER_XMPP(GetRole, "LobbyGetPlayerRole"); | REGISTER_XMPP(GetRole, "LobbyGetPlayerRole"); | ||||
REGISTER_XMPP(GetRating, "LobbyGetPlayerRating"); | REGISTER_XMPP(GetRating, "LobbyGetPlayerRating"); | ||||
REGISTER_XMPP(GetSubject, "LobbyGetRoomSubject"); | REGISTER_XMPP(GetSubject, "LobbyGetRoomSubject"); | ||||
#undef REGISTER_XMPP | #undef REGISTER_XMPP | ||||
ScriptFunction::Register<&EncryptPassword>(rq, "EncryptPassword"); | ScriptFunction::Register<&EncryptPassword>(rq, "EncryptPassword"); | ||||
#endif // CONFIG2_LOBBY | #endif // CONFIG2_LOBBY | ||||
} | } | ||||
} | } |
Wildfire Games · Phabricator
Could invert