![]() |
Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
#include <XmppClient.h>
Classes | |
| class | Impl |
Public Member Functions | |
| XmppClient (const Script::Interface *scriptInterface, const std::string &username, const std::string &password, const std::string &room, const std::string &nick, const int historyRequestSize=0, bool regOpt=false) | |
| Construct the XMPP client. More... | |
| ~XmppClient () | |
| Destroy the xmpp client. More... | |
| void | connect () |
| Network. More... | |
| void | disconnect () |
| bool | isConnected () |
| void | recv () |
| void | SendIqGetBoardList () |
| Request the leaderboard data from the server. More... | |
| void | SendIqGetProfile (const std::string &player) |
| Request the profile data from the server. More... | |
| void | SendIqGameReport (const Script::Request &rq, JS::HandleValue data) |
| Send game report containing numerous game properties to the server. More... | |
| void | SendIqRegisterGame (const Script::Request &rq, JS::HandleValue data) |
| Send a request to register a game to the server. More... | |
| void | SendIqGetConnectionData (const std::string &jid, const std::string &password, const std::string &clientSalt, bool localIP) |
| Request the Connection data (ip, port...) from the server. More... | |
| void | SendIqUnregisterGame () |
| Send a request to unregister a game to the server. More... | |
| void | SendIqChangeStateGame (const std::string &nbp, const std::string &players) |
| Send a request to change the state of a registered game on the server. More... | |
| void | SendIqLobbyAuth (const std::string &to, const std::string &token) |
| Send lobby authentication token. More... | |
| void | SetNick (const std::string &nick) |
| Request MUC nick change, real change via mucRoomHandler. More... | |
| std::string | GetNick () const |
| Get current MUC nickname. More... | |
| std::string | GetJID () |
| std::string | GetUsername () const |
| Get the XMPP username. More... | |
| void | ChangePassword (const std::string &newPassword) |
| Change password for authenticated user. More... | |
| void | kick (const std::string &nick, const std::string &reason) |
| Kick a player from the current room. More... | |
| void | ban (const std::string &nick, const std::string &reason) |
| Ban a player from the current room. More... | |
| void | SetPresence (const std::string &presence) |
| Change the xmpp presence of the client. More... | |
| const char * | GetPresence (const std::string &nickname) |
| Get the current xmpp presence of the given nick. More... | |
| const char * | GetRole (const std::string &nickname) |
| Get the current xmpp role of the given nick. More... | |
| std::wstring | GetRating (const std::string &nickname) |
| Get the most recent received rating of the given nick. More... | |
| const std::wstring & | GetSubject () |
| Get current subject. More... | |
| JS::Value | GUIGetPlayerList (const Script::Request &rq) |
| Handle requests from the GUI for the list of players. More... | |
| JS::Value | GUIGetGameList (const Script::Request &rq) |
| Handle requests from the GUI for the list of all active games. More... | |
| JS::Value | GUIGetBoardList (const Script::Request &rq) |
| Handle requests from the GUI for leaderboard data. More... | |
| JS::Value | GUIGetProfile (const Script::Request &rq) |
| Handle requests from the GUI for profile data. More... | |
| JS::Value | GuiPollNewMessages (const Script::Interface &guiInterface) |
| JS::Value | GuiPollHistoricMessages (const Script::Interface &guiInterface) |
| bool | GuiPollHasPlayerListUpdate () |
| void | SendMUCMessage (const std::string &message) |
| Send a standard MUC textual message. More... | |
| void | SendStunEndpointToHost (const std::string &ip, std::uint16_t port, const std::string &hostJID) |
| void | AddBuddy (const std::string &nick) |
| Add the given nickname to the buddies of the current user. More... | |
| void | RemoveBuddy (const std::string &nick) |
| Remove the given nickname from the buddies of the current user. More... | |
| bool | IsBuddy (const std::string &nick) const |
| Whether the given nickname is a buddy of the current user. More... | |
| std::set< std::string > | GetBuddies () const |
| Get the nicknames of all buddies of the current user. More... | |
Private Attributes | |
| const std::unique_ptr< Impl > | m_Impl |
| XmppClient::XmppClient | ( | const Script::Interface * | scriptInterface, |
| const std::string & | username, | ||
| const std::string & | password, | ||
| const std::string & | room, | ||
| const std::string & | nick, | ||
| const int | historyRequestSize = 0, |
||
| bool | regOpt = false |
||
| ) |
Construct the XMPP client.
| scriptInterface | - Script::Interface to be used for storing GUI messages. Can be left blank for non-visual applications. |
| sUsername | Username to login with of register. |
| sPassword | Password to login with or register. |
| sRoom | MUC room to join. |
| sNick | Nick to join with. |
| historyRequestSize | Number of stanzas of room history to request. |
| regOpt | If we are just registering or not. |
| XmppClient::~XmppClient | ( | ) |
Destroy the xmpp client.
| void XmppClient::AddBuddy | ( | const std::string & | nick | ) |
Add the given nickname to the buddies of the current user.
| nick | The nickname of a player in the lobby. |
| void XmppClient::ban | ( | const std::string & | nick, |
| const std::string & | reason | ||
| ) |
Ban a player from the current room.
| nick | Nickname to be banned |
| reason | Reason the player was banned |
| void XmppClient::ChangePassword | ( | const std::string & | newPassword | ) |
Change password for authenticated user.
| newPassword | New password |
| void XmppClient::connect | ( | ) |
Network.
| void XmppClient::disconnect | ( | ) |
| std::set< std::string > XmppClient::GetBuddies | ( | ) | const |
Get the nicknames of all buddies of the current user.
| std::string XmppClient::GetJID | ( | ) |
| std::string XmppClient::GetNick | ( | ) | const |
Get current MUC nickname.
| const char * XmppClient::GetPresence | ( | const std::string & | nickname | ) |
Get the current xmpp presence of the given nick.
| std::wstring XmppClient::GetRating | ( | const std::string & | nick | ) |
Get the most recent received rating of the given nick.
Notice that this doesn't request a rating profile if it hasn't been received yet.
| const char * XmppClient::GetRole | ( | const std::string & | nickname | ) |
Get the current xmpp role of the given nick.
| const std::wstring & XmppClient::GetSubject | ( | ) |
Get current subject.
| std::string XmppClient::GetUsername | ( | ) | const |
Get the XMPP username.
| JS::Value XmppClient::GUIGetBoardList | ( | const Script::Request & | rq | ) |
Handle requests from the GUI for leaderboard data.
| JS::Value XmppClient::GUIGetGameList | ( | const Script::Request & | rq | ) |
Handle requests from the GUI for the list of all active games.
| JS::Value XmppClient::GUIGetPlayerList | ( | const Script::Request & | rq | ) |
Handle requests from the GUI for the list of players.
| JS::Value XmppClient::GUIGetProfile | ( | const Script::Request & | rq | ) |
Handle requests from the GUI for profile data.
| bool XmppClient::GuiPollHasPlayerListUpdate | ( | ) |
| JS::Value XmppClient::GuiPollHistoricMessages | ( | const Script::Interface & | guiInterface | ) |
| JS::Value XmppClient::GuiPollNewMessages | ( | const Script::Interface & | guiInterface | ) |
| bool XmppClient::IsBuddy | ( | const std::string & | nick | ) | const |
Whether the given nickname is a buddy of the current user.
The buddies are stored in the XMPP roster of the connected lobby. Since a nickname only identifies a user within one lobby, this is meaningless without a connection and always returns false in that case.
| nick | The nickname to look up, compared case-insensitively |
| bool XmppClient::isConnected | ( | ) |
| void XmppClient::kick | ( | const std::string & | nick, |
| const std::string & | reason | ||
| ) |
Kick a player from the current room.
| nick | Nickname to be kicked |
| reason | Reason the player was kicked |
| void XmppClient::recv | ( | ) |
| void XmppClient::RemoveBuddy | ( | const std::string & | nick | ) |
Remove the given nickname from the buddies of the current user.
| nick | The nickname of a player in the lobby. |
| void XmppClient::SendIqChangeStateGame | ( | const std::string & | nbp, |
| const std::string & | players | ||
| ) |
Send a request to change the state of a registered game on the server.
A game can either be in the 'running' or 'waiting' state - the server decides which - but we need to update the current players that are in-game so the server can make the calculation.
| void XmppClient::SendIqGameReport | ( | const Script::Request & | rq, |
| JS::HandleValue | data | ||
| ) |
Send game report containing numerous game properties to the server.
| data | A JS array of game statistics |
| void XmppClient::SendIqGetBoardList | ( | ) |
Request the leaderboard data from the server.
| void XmppClient::SendIqGetConnectionData | ( | const std::string & | jid, |
| const std::string & | password, | ||
| const std::string & | clientSalt, | ||
| bool | localIP | ||
| ) |
Request the Connection data (ip, port...) from the server.
| void XmppClient::SendIqGetProfile | ( | const std::string & | player | ) |
Request the profile data from the server.
| void XmppClient::SendIqLobbyAuth | ( | const std::string & | to, |
| const std::string & | token | ||
| ) |
Send lobby authentication token.
| void XmppClient::SendIqRegisterGame | ( | const Script::Request & | rq, |
| JS::HandleValue | data | ||
| ) |
Send a request to register a game to the server.
| data | A JS array of game attributes |
| void XmppClient::SendIqUnregisterGame | ( | ) |
Send a request to unregister a game to the server.
| void XmppClient::SendMUCMessage | ( | const std::string & | message | ) |
Send a standard MUC textual message.
| void XmppClient::SendStunEndpointToHost | ( | const std::string & | ip, |
| std::uint16_t | port, | ||
| const std::string & | hostJID | ||
| ) |
| void XmppClient::SetNick | ( | const std::string & | nick | ) |
Request MUC nick change, real change via mucRoomHandler.
| nick | Desired MUC nickname |
| void XmppClient::SetPresence | ( | const std::string & | presence | ) |
Change the xmpp presence of the client.
| presence | A string containing the desired presence |
|
private |