1
0
forked from 0ad/0ad

Allow using the XMPP room subject to display lobby information to user, make the lobby GUI code more readable, and cleanup the modern styles.

This was SVN commit r14656.
This commit is contained in:
JoshuaJB 2014-01-24 18:20:15 +00:00
parent dd274113bc
commit b46a6de335
12 changed files with 209 additions and 87 deletions

View File

@ -52,24 +52,18 @@
sound_closed="audio/interface/ui/ui_button_click.ogg"
sound_selected="audio/interface/ui/ui_button_click.ogg"
/>
<style name="ModernLeftLabelText"
font="serif-bold-stroke-14"
textcolor="white"
text_align="left"
text_valign="center"
/>
<style name="ModernRightLabelText"
font="serif-bold-stroke-14"
textcolor="white"
text_align="right"
text_valign="center"
/>
<style name="ModernCenteredLabelText"
<style name="ModernLabelText"
font="serif-bold-stroke-14"
textcolor="white"
text_align="center"
text_valign="center"
/>
<style name="ModernText"
font="serif-14"
textcolor="white"
text_align="left"
text_valign="top"
/>
<style name="ModernInput"
sprite="ModernDarkBoxWhite"
sprite_selectarea="colour:150 0 0"

View File

@ -38,6 +38,7 @@ function init(attribs)
Engine.SendGetBoardList();
Engine.SendGetRatingList();
updatePlayerList();
updateSubject(Engine.LobbyGetRoomSubject());
resetFilters();
setTimeout(clearSpamMonitor, 5000);
@ -80,7 +81,7 @@ function resetFilters()
updateGameList();
// Update info box about the game currently selected
selectGame(Engine.GetGUIObjectByName("gamesBox").selected);
updateGameSelection();
}
function applyFilters()
@ -89,24 +90,64 @@ function applyFilters()
updateGameList();
// Update info box about the game currently selected
selectGame(Engine.GetGUIObjectByName("gamesBox").selected);
updateGameSelection();
}
function displayGame(g, mapSizeFilter, playersNumberFilter, mapTypeFilter, showFullFilter)
/**
* Filter a game based on the status of the filter dropdowns.
*
* @param game Game to be tested.
* @return True if game should not be displayed.
*/
function filterGame(game)
{
if(mapSizeFilter != "" && g.mapSize != mapSizeFilter)
return false;
if(playersNumberFilter != "" && g.tnbp != playersNumberFilter)
return false;
if(mapTypeFilter != "" && g.mapType != mapTypeFilter)
return false;
if(!showFullFilter && g.tnbp <= g.nbp)
return false;
var mapSizeFilter = Engine.GetGUIObjectByName("mapSizeFilter");
var playersNumberFilter = Engine.GetGUIObjectByName("playersNumberFilter");
var mapTypeFilter = Engine.GetGUIObjectByName("mapTypeFilter");
var showFullFilter = Engine.GetGUIObjectByName("showFullFilter");
// We assume index 0 means display all for any given filter.
if (mapSizeFilter.selected != 0 && game.mapSize != mapSizeFilter.list_data[mapSizeFilter.selected])
return true;
if (playersNumberFilter.selected != 0 && game.tnbp != playersNumberFilter.list_data[playersNumberFilter.selected])
return true;
if (mapTypeFilter.selected != 0 && game.mapType != mapTypeFilter.list_data[mapTypeFilter.selected])
return true;
if (!showFullFilter.checked && game.tnbp <= game.nbp)
return true;
return true;
return false;
}
// Do a full update of the player listing, including ratings.
/**
* Update the subject GUI object.
*
* @param newSubject New room subject.
*/
function updateSubject(newSubject)
{
var subject = Engine.GetGUIObjectByName("subject");
var subjectBox = Engine.GetGUIObjectByName("subjectBox");
var logo = Engine.GetGUIObjectByName("logo");
// Load new subject and un-escape newlines.
subject.caption = newSubject.replace("\\n", "\n", "g");
// If the subject is only whitespace, hide it and reposition the logo.
if (subject.caption.match(/^([\s\t\r\n]*)$/g))
{
subjectBox.hidden = true;
logo.size = "50%-110 50%-50 50%+110 50%+50";
}
else
{
subjectBox.hidden = false;
logo.size = "50%-110 40 50%+110 140";
}
}
/**
* Do a full update of the player listing, including ratings.
*
* @return Array containing the player, presence, nickname, and rating listings.
*/
function updatePlayerList()
{
var playersBox = Engine.GetGUIObjectByName("playersBox");
@ -139,8 +180,10 @@ function updatePlayerList()
return [playerList, presenceList, nickList, ratingList];
}
// Update leaderboard listing
function updateBoardList()
/**
* Update the leaderboard from data cached in C++.
*/
function updateLeaderboard()
{
// Get list from C++
var boardList = Engine.GetBoardList();
@ -172,7 +215,9 @@ function updateBoardList()
leaderboard.selected = -1;
}
// Update game listing
/**
* Update the game listing from data cached in C++.
*/
function updateGameList()
{
var gamesBox = Engine.GetGUIObjectByName("gamesBox");
@ -195,21 +240,10 @@ function updateGameList()
var list = [];
var list_data = [];
var mapSizeFilterDD = Engine.GetGUIObjectByName("mapSizeFilter");
var playersNumberFilterDD = Engine.GetGUIObjectByName("playersNumberFilter");
var mapTypeFilterDD = Engine.GetGUIObjectByName("mapTypeFilter");
var showFullFilterCB = Engine.GetGUIObjectByName("showFullFilter");
// Get filter values
var mapSizeFilter = mapSizeFilterDD.selected >= 0 ? mapSizeFilterDD.list_data[mapSizeFilterDD.selected] : "";
var playersNumberFilter = playersNumberFilterDD.selected >=0 ? playersNumberFilterDD.list_data[playersNumberFilterDD.selected] : "";
var mapTypeFilter = mapTypeFilterDD.selected >= 0 ? mapTypeFilterDD.list_data[mapTypeFilterDD.selected] : "";
var showFullFilter = showFullFilterCB.checked;
var c = 0;
for each (var g in gameList)
{
if(displayGame(g, mapSizeFilter, playersNumberFilter, mapTypeFilter, showFullFilter))
if(!filterGame(g))
{
// Highlight games 'waiting' for this player, otherwise display as green
var name = (g.state != 'waiting') ? '[color="0 125 0"]' + g.name + '[/color]' : '[color="orange"]' + g.name + '[/color]';
@ -237,12 +271,18 @@ function updateGameList()
if (gamesBox.selected >= gamesBox.list_name.length)
gamesBox.selected = -1;
// If game selected, update info box about the game.
if(Engine.GetGUIObjectByName("gamesBox").selected != -1)
selectGame(Engine.GetGUIObjectByName("gamesBox").selected)
// Update info box about the game currently selected
updateGameSelection();
}
// The following function colorizes and formats the entries in the player list.
/**
* Colorize and format the entries in the player list.
*
* @param nickname Name of player.
* @param presence Presence of player.
* @param rating Rating of player.
* @return Array of mutated parameters.
*/
function formatPlayerListEntry(nickname, presence, rating)
{
// Set colors based on player status
@ -280,8 +320,13 @@ function formatPlayerListEntry(nickname, presence, rating)
return [name, status, elo];
}
function selectGame(selected)
/**
* Populate the game info area with information on the current game selection.
*/
function updateGameSelection()
{
var selected = Engine.GetGUIObjectByName("gamesBox").selected;
// If a game is not selected, hide the game information area.
if (selected == -1)
{
// Hide the game info panel if a game is not selected
@ -333,6 +378,9 @@ function selectGame(selected)
Engine.GetGUIObjectByName("sgMapPreview").sprite = "cropped:(0.7812,0.5859)session/icons/mappreview/" + mapPreview;
}
/**
* Start the joining process on the currectly selected game.
*/
function joinSelectedGame()
{
var gamesBox = Engine.GetGUIObjectByName("gamesBox");
@ -346,7 +394,7 @@ function joinSelectedGame()
// Check if it looks like an ip address
if (sip.split('.').length != 4)
{
addChatMessage({ "from": "system", "text": "This game does not have a valid address" });
addChatMessage({ "from": "system", "text": "This game's address '" + sip + "' does not appear to be valid." });
return;
}
@ -359,6 +407,9 @@ function joinSelectedGame()
// Utils
////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Add a leading zero to single-digit numbers.
*/
function twoDigits(n)
{
return n < 10 ? "0" + n : n;
@ -387,15 +438,15 @@ function onTick()
// Clean Message
if (!message)
break;
message.from = escapeText(message.from);
message.text = escapeText(message.text);
var from = escapeText(message.from);
var text = escapeText(message.text);
switch (message.type)
{
case "mucmessage": // For room messages
addChatMessage({ "from": message.from, "text": message.text });
addChatMessage({ "from": from, "text": text });
break;
case "message": // For private messages
addChatMessage({ "from": message.from, "text": message.text });
addChatMessage({ "from": from, "text": text });
break;
case "muc":
var nick = message.text;
@ -455,6 +506,9 @@ function onTick()
playerList[nickIndex] = name;
ratingList[nickIndex] = rating;
break;
case "subject":
updateSubject(message.text);
break;
default:
warn("Unknown message.level '" + message.level + "'");
break;
@ -471,12 +525,12 @@ function onTick()
switch (message.level)
{
case "standard":
addChatMessage({ "from": "system", "text": message.text, "color": "150 0 0" });
addChatMessage({ "from": "system", "text": text, "color": "150 0 0" });
if (message.text == "disconnected")
{
// Clear the list of games and the list of players
updateGameList();
updateBoardList();
updateLeaderboard();
updatePlayerList();
// Disable the 'host' button
Engine.GetGUIObjectByName("hostButton").enabled = false;
@ -487,7 +541,7 @@ function onTick()
}
break;
case "error":
addChatMessage({ "from": "system", "text": message.text, "color": "150 0 0" });
addChatMessage({ "from": "system", "text": text, "color": "150 0 0" });
break;
case "internal":
switch (message.text)
@ -496,7 +550,7 @@ function onTick()
updateGameList();
break;
case "boardlist updated":
updateBoardList();
updateLeaderboard();
break;
case "ratinglist updated":
updatePlayerList();
@ -531,21 +585,24 @@ function completeNick()
if (text.length)
{
var matched = false;
for each (var playerObj in Engine.GetPlayerList()) {
for each (var playerObj in Engine.GetPlayerList())
{
var player = playerObj.name;
var breaks = text.match(/(\s+)/g) || [];
text.split(/\s+/g).reduceRight(function (wordsSoFar, word, index) {
text.split(/\s+/g).reduceRight(function (wordsSoFar, word, index)
{
if (matched)
return null;
var matchCandidate = word + (breaks[index - 1] || "") + wordsSoFar;
if (player.toUpperCase().indexOf(matchCandidate.toUpperCase().trim()) == 0) {
if (player.toUpperCase().indexOf(matchCandidate.toUpperCase().trim()) == 0)
{
input.caption = text.replace(matchCandidate.trim(), player);
matched = true;
}
return matchCandidate;
}, "");
if (matched)
break;
if (matched)
break;
}
}
}
@ -556,6 +613,12 @@ function isValidNick(nick)
return prohibitedNicks.indexOf(nick) == -1;
}
/**
* Handle all '/' commands.
*
* @param text Text to be checked for commands.
* @return true if more text processing is needed, false otherwise.
*/
function handleSpecialCommand(text)
{
if (text[0] != '/')
@ -566,7 +629,6 @@ function handleSpecialCommand(text)
switch (cmd)
{
case "away":
// TODO: Should we handle away messages?
Engine.LobbySetPlayerPresence("away");
break;
case "back":
@ -592,6 +654,11 @@ function handleSpecialCommand(text)
return true;
}
/**
* Process and, if appropriate, display a formatted message.
*
* @param msg The message to be processed.
*/
function addChatMessage(msg)
{
// Highlight local user's nick
@ -621,7 +688,15 @@ function ircSplit(string)
return [string.substr(1), ""];
}
// The following formats text in an IRC-like way
/**
* Format text in an IRC-like way.
*
* @param text Body of the message.
* @param from Sender of the message.
* @param color Optional color of sender.
* @param key Key to verify join/leave messages with. TODO: Remove this, it only provides synthetic security.
* @return Formatted text.
*/
function ircFormat(text, from, color, key)
{
// Generate and apply color to uncolored names,
@ -661,13 +736,19 @@ function ircFormat(text, from, color, key)
return formatted + '[font="serif-bold-13"]<' + coloredFrom + '>[/font] ' + text;
}
// The following function tracks message stats and returns true if the input text is spam.
/**
* Track potential spammers and block if nessasary.
*
* @param text Body of message.
* @param from Sender of message.
* @return True is message is spam.
*/
function updateSpamandDetect(text, from)
{
// Check for blank lines.
if (text == " ")
return true;
// Update the spam monitor.
// Update the spam monitor. TODO: Make this smarter and block profanity.
if (g_spamMonitor[from])
g_spamMonitor[from]++;
else
@ -678,6 +759,7 @@ function updateSpamandDetect(text, from)
if(from in g_spammers)
{
if (from == g_Name)
// TODO: Only show this once each time they are blocked.
addChatMessage({ "from": "system", "text": "Please do not spam. You have been blocked for thirty seconds." });
return true;
}
@ -685,13 +767,18 @@ function updateSpamandDetect(text, from)
return false;
}
// Timers to clear spammers after some time.
/**
* Reset timer used to measure message send speed.
*/
function clearSpamMonitor()
{
g_spamMonitor = {};
setTimeout(clearSpamMonitor, 5000);
}
/**
* Clear the list of spammers every 30 seconds.
*/
function clearSpammers()
{
g_spammers = {};

View File

@ -37,12 +37,15 @@
<!-- Right panel: Game details. -->
<object name="rightPanel" size="100%-250 30 100%-20 100%-20" >
<object name="gameInfoEmpty" size="0 0 100% 100%-60" type="image" sprite="ModernDarkBoxGold" hidden="false">
<object size="50%-110 50%-50 50%+110 50%+50" type="image" sprite="productLogo"/>
<object name="logo" size="50%-110 40 50%+110 140" type="image" sprite="productLogo"/>
<object name="subjectBox" type="image" sprite="ModernDarkBoxWhite" size="3% 180 97% 99%">
<object name="subject" size="5 5 100%-5 100%-5" type="text" style="ModernText" text_align="center"/>
</object>
</object>
<object name="gameInfo" size="0 0 100% 100%-90" type="image" sprite="ModernDarkBoxGold" hidden="true">
<!-- Map Name -->
<object name="sgMapName" size="0 5 100% 20" type="text" style="ModernCenteredLabelText"/>
<object name="sgMapName" size="0 5 100% 20" type="text" style="ModernLabelText"/>
<!-- Map Preview -->
<object name="sgMapPreview" size="5 25 100%-5 235" type="image" sprite=""/>
@ -51,20 +54,20 @@
<!-- Map Type -->
<object size="5 240 50% 265" type="image" sprite="ModernItemBackShadeLeft">
<object size="0 0 100%-10 100%" type="text" style="ModernRightLabelText">Map Type:</object>
<object size="0 0 100%-10 100%" type="text" style="ModernLabelText" text_align="right">Map Type:</object>
</object>
<object size="50% 240 100%-5 265" type="image" sprite="ModernItemBackShadeRight">
<object name="sgMapType" size="0 0 100% 100%" type="text" style="ModernLeftLabelText"/>
<object name="sgMapType" size="0 0 100% 100%" type="text" style="ModernLabelText" text_align="left"/>
</object>
<object size="5 264 100%-5 265" type="image" sprite="ModernWhiteLine" z="25"/>
<!-- Map Size -->
<object size="5 265 50% 290" type="image" sprite="ModernItemBackShadeLeft">
<object size="0 0 100%-10 100%" type="text" style="ModernRightLabelText">Map Size:</object>
<object size="0 0 100%-10 100%" type="text" style="ModernLabelText" text_align="right">Map Size:</object>
</object>
<object size="50% 265 100%-5 290" type="image" sprite="ModernItemBackShadeRight">
<object name="sgMapSize" size="0 0 100% 100%" type="text" style="ModernLeftLabelText"/>
<object name="sgMapSize" size="0 0 100% 100%" type="text" style="ModernLabelText" text_align="left"/>
</object>
<object size="5 289 100%-5 290" type="image" sprite="ModernWhiteLine" z="25"/>
@ -76,8 +79,8 @@
<object type="image" sprite="ModernDarkBoxWhite" size="3% 76% 97% 99%">
<!-- Number of Players -->
<object size="32% 3% 57% 12%" type="text" style="ModernLeftLabelText">Players:</object>
<object name="sgNbPlayers" size="52% 3% 62% 12%" type="text" style="ModernLeftLabelText"/>
<object size="32% 3% 57% 12%" type="text" style="ModernLabelText" text_align="left">Players:</object>
<object name="sgNbPlayers" size="52% 3% 62% 12%" type="text" style="ModernLabelText" text_align="left"/>
<!-- Player Names -->
<object name="sgPlayersNames" size="0 15% 100% 100%" type="text" style="MapPlayerList"/>
@ -109,7 +112,7 @@
<!-- Middle panel: Filters, game list, chat box. -->
<object name="middlePanel" size="20%+5 5% 100%-255 97.2%">
<object name="gamesBox" style="ModernList" type="olist" size="0 25 100% 48%">
<action on="SelectionChange">selectGame(this.selected);</action>
<action on="SelectionChange">updateGameSelection();</action>
<def id="name" heading="Name" color="0 60 0" width="25%"/>
<!--<def id="ip" heading="IP" color="0 128 128" width="170"/>-->
<def id="mapName" heading="Map Name" color="128 128 128" width="25%"/>

View File

@ -25,10 +25,10 @@
</object>
<object name="pageConnect" size="0 32 100% 100%">
<object type="text" style="ModernCenteredLabelText" size="0 0 400 30">
<object type="text" size="0 0 400 30" style="ModernLabelText" text_align="center">
Connect to the game lobby
</object>
<object name="connectUsernameLabel" type="text" size="50 40 125 70" style="ModernRightLabelText">
<object name="connectUsernameLabel" type="text" size="50 40 125 70" style="ModernLabelText" text_align="right">
Login:
</object>
<object name="connectUsername" type="input" size="135 40 100%-50 64" style="ModernInput">
@ -36,7 +36,7 @@
this.caption = Engine.ConfigDB_GetValue("user", "lobby.login");
</action>
</object>
<object name="connectPasswordLabel" type="text" size="50 80 125 110" style="ModernRightLabelText">
<object name="connectPasswordLabel" type="text" size="50 80 125 110" style="ModernLabelText" text_align="right">
Password:
</object>
<object name="connectPassword" type="input" size="135 80 100%-50 104" style="ModernInput" mask="true" mask_char="*">
@ -50,10 +50,10 @@
</object>
</object>
<object name="pageRegister" size="0 32 100% 100%" hidden="true">
<object type="text" style="ModernCenteredLabelText" size="0 0 400 30">
<object type="text" style="ModernLabelText" size="0 0 400 30" text_align="center">
Registration
</object>
<object type="text" size="50 40 170 70" style="ModernRightLabelText">
<object type="text" size="50 40 170 70" style="ModernLabelText" text_align="right">
Password again:
</object>
<object name="registerPasswordAgain" type="input" size="180 40 100%-50 64" style="ModernInput" mask="true" mask_char="*">
@ -62,7 +62,7 @@
</action>
</object>
</object>
<object name="feedback" type="text" style="ModernCenteredLabelText" size="50 150 100%-50 190" textcolor="red"/>
<object name="feedback" type="text" size="50 150 100%-50 190" style="ModernLabelText" textcolor="red" text_align="center"/>
<object type="button" size="18 100%-45 126 100%-17" style="StoneButton">
Cancel
<action on="Press">

View File

@ -917,5 +917,6 @@ void GuiScriptingInit(ScriptInterface& scriptInterface)
scriptInterface.RegisterFunction<std::wstring, std::wstring, std::wstring, &JSI_Lobby::EncryptPassword>("EncryptPassword");
scriptInterface.RegisterFunction<bool, &JSI_Lobby::IsRankedGame>("IsRankedGame");
scriptInterface.RegisterFunction<void, bool, &JSI_Lobby::SetRankedGame>("SetRankedGame");
scriptInterface.RegisterFunction<std::wstring, &JSI_Lobby::LobbyGetRoomSubject>("LobbyGetRoomSubject");
#endif // CONFIG2_LOBBY
}

View File

@ -44,6 +44,7 @@ public:
virtual void ban(const std::string& nick, const std::string& reason) = 0;
virtual void SetPresence(const std::string& presence) = 0;
virtual void GetPresence(const std::string& nickname, std::string& presence) = 0;
virtual void GetSubject(std::string& subject) = 0;
virtual CScriptValRooted GUIGetPlayerList(ScriptInterface& scriptInterface) = 0;
virtual CScriptValRooted GUIGetGameList(ScriptInterface& scriptInterface) = 0;

View File

@ -728,7 +728,7 @@ void XmppClient::CreateSimpleMessage(const std::string& type, const std::string&
}
/*****************************************************
* Presence and nickname *
* Presence, nickname, and subject *
*****************************************************/
/**
@ -765,6 +765,25 @@ void XmppClient::handleMUCParticipantPresence(glooxwrapper::MUCRoom*, const gloo
}
}
/**
* Update local cache when subject changes.
*/
void XmppClient::handleMUCSubject(glooxwrapper::MUCRoom*, const std::string& UNUSED(nick), const std::string& subject)
{
m_Subject = subject;
CreateSimpleMessage("muc", subject, "subject");
}
/**
* Get current subject.
*
* @param topic Variable to store subject in.
*/
void XmppClient::GetSubject(std::string& subject)
{
subject = m_Subject;
}
/**
* Request nick change, real change via mucRoomHandler.
*

View File

@ -71,6 +71,7 @@ public:
void ban(const std::string& nick, const std::string& reason);
void SetPresence(const std::string& presence);
void GetPresence(const std::string& nickname, std::string& presence);
void GetSubject(std::string& subject);
CScriptValRooted GUIGetPlayerList(ScriptInterface& scriptInterface);
CScriptValRooted GUIGetGameList(ScriptInterface& scriptInterface);
@ -85,9 +86,9 @@ protected:
virtual void handleMUCParticipantPresence(glooxwrapper::MUCRoom*, const glooxwrapper::MUCRoomParticipant, const glooxwrapper::Presence&);
virtual void handleMUCError(glooxwrapper::MUCRoom*, gloox::StanzaError);
virtual void handleMUCMessage(glooxwrapper::MUCRoom* room, const glooxwrapper::Message& msg, bool priv);
virtual void handleMUCSubject(glooxwrapper::MUCRoom*, const std::string& nick, const std::string& subject);
/* MUC handlers not supported by glooxwrapper */
// virtual bool handleMUCRoomCreation(glooxwrapper::MUCRoom*) {return false;}
// virtual void handleMUCSubject(glooxwrapper::MUCRoom*, const std::string&, const std::string&) {}
// virtual void handleMUCInviteDecline(glooxwrapper::MUCRoom*, const glooxwrapper::JID&, const std::string&) {}
// virtual void handleMUCInfo(glooxwrapper::MUCRoom*, int, const std::string&, const glooxwrapper::DataForm*) {}
// virtual void handleMUCItems(glooxwrapper::MUCRoom*, const std::list<gloox::Disco::Item*, std::allocator<gloox::Disco::Item*> >&) {}
@ -143,8 +144,10 @@ private:
std::vector<const glooxwrapper::Tag*> m_BoardList;
/// List of ratings
std::vector<const glooxwrapper::Tag*> m_RatingList;
/// Queue of messages
/// Queue of messages for the GUI
std::deque<GUIMessage> m_GuiMessageQueue;
/// Current room subject/topic.
std::string m_Subject = "";
};
#endif // XMPPCLIENT_H

View File

@ -164,9 +164,10 @@ public:
return false;
}
virtual void handleMUCSubject(gloox::MUCRoom* UNUSED(room), const std::string& UNUSED(nick), const std::string& UNUSED(subject))
virtual void handleMUCSubject(gloox::MUCRoom* UNUSED(room), const std::string& nick, const std::string& subject)
{
/* Not supported */
/* MUCRoom not supported */
m_Wrapped->handleMUCSubject(NULL, nick, subject);
}
virtual void handleMUCInviteDecline(gloox::MUCRoom* UNUSED(room), const gloox::JID& UNUSED(invitee), const std::string& UNUSED(reason))

View File

@ -340,6 +340,7 @@ namespace glooxwrapper
virtual void handleMUCParticipantPresence(MUCRoom* room, const MUCRoomParticipant participant, const Presence& presence) = 0; // MUCRoom not supported
virtual void handleMUCMessage(MUCRoom* room, const Message& msg, bool priv) = 0; // MUCRoom not supported
virtual void handleMUCError(MUCRoom* room, gloox::StanzaError error) = 0; // MUCRoom not supported
virtual void handleMUCSubject(MUCRoom* room, const std::string& nick, const std::string& subject) = 0; // MUCRoom not supported
};
class GLOOXWRAPPER_API RegistrationHandler

View File

@ -274,4 +274,14 @@ void JSI_Lobby::SetRankedGame(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bo
g_rankedGame = isRanked;
}
std::wstring JSI_Lobby::LobbyGetRoomSubject(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
{
if (!g_XmppClient)
return L"";
std::string subject;
g_XmppClient->GetSubject(subject);
return wstring_from_utf8(subject);
}
#endif

View File

@ -26,7 +26,7 @@ namespace JSI_Lobby
{
bool HasXmppClient(ScriptInterface::CxPrivate* pCxPrivate);
#if CONFIG2_LOBBY
#if CONFIG2_LOBBY
void StartXmppClient(ScriptInterface::CxPrivate* pCxPrivate, std::wstring username, std::wstring password, std::wstring room, std::wstring nick);
void StartRegisterXmppClient(ScriptInterface::CxPrivate* pCxPrivate, std::wstring username, std::wstring password);
void StopXmppClient(ScriptInterface::CxPrivate* pCxPrivate);
@ -52,6 +52,7 @@ namespace JSI_Lobby
void LobbyKick(ScriptInterface::CxPrivate* pCxPrivate, std::wstring nick, std::wstring reason);
void LobbyBan(ScriptInterface::CxPrivate* pCxPrivate, std::wstring nick, std::wstring reason);
std::wstring LobbyGetPlayerPresence(ScriptInterface::CxPrivate* pCxPrivate, std::wstring nickname);
std::wstring LobbyGetRoomSubject(ScriptInterface::CxPrivate* pCxPrivate);
// Non-public secure PBKDF2 hash function with salting and 1,337 iterations
std::string EncryptPassword(const std::string& password, const std::string& username);
@ -61,7 +62,8 @@ namespace JSI_Lobby
bool IsRankedGame(ScriptInterface::CxPrivate* pCxPrivate);
void SetRankedGame(ScriptInterface::CxPrivate* pCxPrivate, bool isRanked);
#endif // CONFIG2_LOBBY
#endif // CONFIG2_LOBBY
}
#endif