Changeset View
Changeset View
Standalone View
Standalone View
source/lobby/scripting/JSInterface_Lobby.cpp
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | #if CONFIG2_LOBBY // Allow the lobby to be disabled | ||||
scriptInterface.RegisterFunction<JS::Value, &JSI_Lobby::GetProfile>("GetProfile"); | scriptInterface.RegisterFunction<JS::Value, &JSI_Lobby::GetProfile>("GetProfile"); | ||||
scriptInterface.RegisterFunction<JS::Value, &JSI_Lobby::LobbyGuiPollNewMessages>("LobbyGuiPollNewMessages"); | scriptInterface.RegisterFunction<JS::Value, &JSI_Lobby::LobbyGuiPollNewMessages>("LobbyGuiPollNewMessages"); | ||||
scriptInterface.RegisterFunction<JS::Value, &JSI_Lobby::LobbyGuiPollHistoricMessages>("LobbyGuiPollHistoricMessages"); | scriptInterface.RegisterFunction<JS::Value, &JSI_Lobby::LobbyGuiPollHistoricMessages>("LobbyGuiPollHistoricMessages"); | ||||
scriptInterface.RegisterFunction<bool, &JSI_Lobby::LobbyGuiPollHasPlayerListUpdate>("LobbyGuiPollHasPlayerListUpdate"); | scriptInterface.RegisterFunction<bool, &JSI_Lobby::LobbyGuiPollHasPlayerListUpdate>("LobbyGuiPollHasPlayerListUpdate"); | ||||
scriptInterface.RegisterFunction<void, std::wstring, &JSI_Lobby::LobbySendMessage>("LobbySendMessage"); | scriptInterface.RegisterFunction<void, std::wstring, &JSI_Lobby::LobbySendMessage>("LobbySendMessage"); | ||||
scriptInterface.RegisterFunction<void, std::wstring, &JSI_Lobby::LobbySetPlayerPresence>("LobbySetPlayerPresence"); | scriptInterface.RegisterFunction<void, std::wstring, &JSI_Lobby::LobbySetPlayerPresence>("LobbySetPlayerPresence"); | ||||
scriptInterface.RegisterFunction<void, std::wstring, &JSI_Lobby::LobbySetNick>("LobbySetNick"); | scriptInterface.RegisterFunction<void, std::wstring, &JSI_Lobby::LobbySetNick>("LobbySetNick"); | ||||
scriptInterface.RegisterFunction<std::wstring, &JSI_Lobby::LobbyGetNick>("LobbyGetNick"); | scriptInterface.RegisterFunction<std::wstring, &JSI_Lobby::LobbyGetNick>("LobbyGetNick"); | ||||
scriptInterface.RegisterFunction<std::string, &JSI_Lobby::LobbyGetJID>("LobbyGetJID"); | |||||
scriptInterface.RegisterFunction<void, std::wstring, std::wstring, &JSI_Lobby::LobbyKick>("LobbyKick"); | scriptInterface.RegisterFunction<void, std::wstring, std::wstring, &JSI_Lobby::LobbyKick>("LobbyKick"); | ||||
scriptInterface.RegisterFunction<void, std::wstring, std::wstring, &JSI_Lobby::LobbyBan>("LobbyBan"); | scriptInterface.RegisterFunction<void, std::wstring, std::wstring, &JSI_Lobby::LobbyBan>("LobbyBan"); | ||||
scriptInterface.RegisterFunction<const char*, std::wstring, &JSI_Lobby::LobbyGetPlayerPresence>("LobbyGetPlayerPresence"); | scriptInterface.RegisterFunction<const char*, std::wstring, &JSI_Lobby::LobbyGetPlayerPresence>("LobbyGetPlayerPresence"); | ||||
scriptInterface.RegisterFunction<const char*, std::wstring, &JSI_Lobby::LobbyGetPlayerRole>("LobbyGetPlayerRole"); | scriptInterface.RegisterFunction<const char*, std::wstring, &JSI_Lobby::LobbyGetPlayerRole>("LobbyGetPlayerRole"); | ||||
scriptInterface.RegisterFunction<std::wstring, std::wstring, &JSI_Lobby::LobbyGetPlayerRating>("LobbyGetPlayerRating"); | scriptInterface.RegisterFunction<std::wstring, std::wstring, &JSI_Lobby::LobbyGetPlayerRating>("LobbyGetPlayerRating"); | ||||
scriptInterface.RegisterFunction<std::wstring, std::wstring, std::wstring, &JSI_Lobby::EncryptPassword>("EncryptPassword"); | scriptInterface.RegisterFunction<std::wstring, std::wstring, std::wstring, &JSI_Lobby::EncryptPassword>("EncryptPassword"); | ||||
scriptInterface.RegisterFunction<std::wstring, &JSI_Lobby::LobbyGetRoomSubject>("LobbyGetRoomSubject"); | scriptInterface.RegisterFunction<std::wstring, &JSI_Lobby::LobbyGetRoomSubject>("LobbyGetRoomSubject"); | ||||
#endif // CONFIG2_LOBBY | #endif // CONFIG2_LOBBY | ||||
▲ Show 20 Lines • Show All 321 Lines • ▼ Show 20 Lines | if (!g_XmppClient) | ||||
return std::wstring(); | return std::wstring(); | ||||
} | } | ||||
std::string nick; | std::string nick; | ||||
g_XmppClient->GetNick(nick); | g_XmppClient->GetNick(nick); | ||||
return wstring_from_utf8(nick); | return wstring_from_utf8(nick); | ||||
} | } | ||||
std::string JSI_Lobby::LobbyGetJID(ScriptInterface::CmptPrivate* pCmptPrivate) | |||||
{ | |||||
if (!g_XmppClient) | |||||
Stan: Could invert | |||||
Done Inline ActionsMore consistent with other functions that way wraitii: More consistent with other functions that way | |||||
{ | |||||
ScriptRequest rq(pCmptPrivate->pScriptInterface); | |||||
ScriptException::Raise(rq, "Cannot call LobbyGetJID without an initialized XmppClient!"); | |||||
return std::string(); | |||||
} | |||||
return g_XmppClient->GetJID(); | |||||
} | |||||
void JSI_Lobby::LobbyKick(ScriptInterface::CmptPrivate* pCmptPrivate, const std::wstring& nick, const std::wstring& reason) | void JSI_Lobby::LobbyKick(ScriptInterface::CmptPrivate* pCmptPrivate, const std::wstring& nick, const std::wstring& reason) | ||||
{ | { | ||||
if (!g_XmppClient) | if (!g_XmppClient) | ||||
{ | { | ||||
ScriptRequest rq(pCmptPrivate->pScriptInterface); | ScriptRequest rq(pCmptPrivate->pScriptInterface); | ||||
ScriptException::Raise(rq, "Cannot call LobbyKick without an initialized XmppClient!"); | ScriptException::Raise(rq, "Cannot call LobbyKick without an initialized XmppClient!"); | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 112 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Could invert