69 XmppClient(
const ScriptInterface* scriptInterface,
const std::string& sUsername,
const std::string& sPassword,
const std::string& sRoom,
const std::string& sNick,
const int historyRequestSize = 0,
const bool regOpt =
false);
73 static void Trace(JSTracer *trc,
void *data)
89 void SendIqGetConnectionData(
const std::string& jid,
const std::string& password,
const std::string& clientSalt,
bool localIP);
93 void SetNick(
const std::string& nick);
95 std::string
GetJID()
const;
96 void kick(
const std::string& nick,
const std::string& reason);
97 void ban(
const std::string& nick,
const std::string& reason);
99 const char*
GetPresence(
const std::string& nickname);
100 const char*
GetRole(
const std::string& nickname);
101 std::wstring
GetRating(
const std::string& nickname);
114 static const char*
GetPresenceString(
const gloox::Presence::PresenceType presenceType);
115 static const char*
GetRoleString(
const gloox::MUCRoomRole role);
136 virtual void handleLog(gloox::LogLevel level, gloox::LogArea area,
const std::string& message);
168 template<
typename... Args>
170 const std::string& type,
171 const std::string& level,
172 const std::time_t time,
173 Args
const&... args);
185 using PlayerMap = std::map<glooxwrapper::string, SPlayer>;
Definition: IXmppClient.h:26
Abstraction around a SpiderMonkey JS::Realm.
Definition: ScriptInterface.h:72
Spidermonkey maintains some 'local' state via the JSContext* object.
Definition: ScriptRequest.h:60
Definition: XmppClient.h:39
void SendStunEndpointToHost(const std::string &ip, u16 port, const std::string &hostJID)
Definition: XmppClient.cpp:1504
virtual void handleMUCSubject(glooxwrapper::MUCRoom &room, const glooxwrapper::string &nick, const glooxwrapper::string &subject)
Update local cache when subject changes.
Definition: XmppClient.cpp:1172
std::map< glooxwrapper::string, SPlayer > PlayerMap
Definition: XmppClient.h:185
virtual void handleMUCMessage(glooxwrapper::MUCRoom &room, const glooxwrapper::Message &msg, bool priv)
Handle a room message.
Definition: XmppClient.cpp:802
virtual void handleMessage(const glooxwrapper::Message &msg, glooxwrapper::MessageSession *session)
Handle a private message.
Definition: XmppClient.cpp:817
std::wstring GetRating(const std::string &nickname)
Get the most recent received rating of the given nick.
Definition: XmppClient.cpp:1285
PlayerMap m_PlayerMap
Map of players.
Definition: XmppClient.h:188
std::vector< const glooxwrapper::Tag * > m_BoardList
List of rankings.
Definition: XmppClient.h:194
std::deque< JS::Heap< JS::Value > > m_GuiMessageQueue
Queue of messages for the GUI.
Definition: XmppClient.h:200
bool isConnected()
Definition: XmppClient.cpp:223
virtual void handleAlreadyRegistered(const glooxwrapper::JID &)
Definition: XmppClient.cpp:545
std::vector< const glooxwrapper::Tag * > m_GameList
List of games.
Definition: XmppClient.h:192
JS::Value GUIGetGameList(const ScriptRequest &rq)
Handle requests from the GUI for the list of all active games.
Definition: XmppClient.cpp:597
static const char * GetRoleString(const gloox::MUCRoomRole role)
Convert a gloox role type to an untranslated string literal to be used as an identifier by the script...
Definition: XmppClient.cpp:1350
glooxwrapper::SessionManager * m_sessionManager
Definition: XmppClient.h:47
virtual void handleMUCError(glooxwrapper::MUCRoom &room, gloox::StanzaError)
Handle MUC room errors.
Definition: XmppClient.cpp:323
void recv()
Definition: XmppClient.cpp:228
virtual void handleMUCParticipantPresence(glooxwrapper::MUCRoom &room, const glooxwrapper::MUCRoomParticipant, const glooxwrapper::Presence &)
Update local data when a user changes presence.
Definition: XmppClient.cpp:1053
virtual void handleLog(gloox::LogLevel level, gloox::LogArea area, const std::string &message)
Log (debug) Handler.
Definition: XmppClient.cpp:236
bool m_initialLoadComplete
Definition: XmppClient.h:64
std::string m_server
Definition: XmppClient.h:52
virtual void handleSessionAction(gloox::Jingle::Action action, glooxwrapper::Jingle::Session &session, const glooxwrapper::Jingle::Session::Jingle &jingle)
Definition: XmppClient.cpp:1513
glooxwrapper::Client * m_client
Definition: XmppClient.h:44
virtual void handleDataForm(const glooxwrapper::JID &, const glooxwrapper::DataForm &)
Definition: XmppClient.cpp:550
std::wstring m_Subject
Current room subject/topic.
Definition: XmppClient.h:204
void ban(const std::string &nick, const std::string &reason)
Ban a player from the current room.
Definition: XmppClient.cpp:1232
JS::Value GuiPollNewMessages(const ScriptInterface &guiInterface)
Definition: XmppClient.cpp:726
virtual bool onTLSConnect(const glooxwrapper::CertInfo &info)
Handle TLS connection.
Definition: XmppClient.cpp:299
bool m_isConnected
Definition: XmppClient.h:65
gloox::CertStatus m_certStatus
Definition: XmppClient.h:63
bool m_PlayerMapUpdate
Whether or not the playermap has changed since the last time the GUI checked.
Definition: XmppClient.h:190
void SendIqGetBoardList()
Request the leaderboard data from the server.
Definition: XmppClient.cpp:336
std::string m_password
Definition: XmppClient.h:51
void SendIqChangeStateGame(const std::string &nbp, const std::string &players)
Send a request to change the state of a registered game on the server.
Definition: XmppClient.cpp:486
std::string m_nick
Definition: XmppClient.h:54
virtual void handleIqID(const glooxwrapper::IQ &, int)
Definition: XmppClient.h:145
void TraceMember(JSTracer *trc)
Definition: XmppClient.cpp:202
const char * GetRole(const std::string &nickname)
Get the current xmpp role of the given nick.
Definition: XmppClient.cpp:1271
JS::Value GuiPollHistoricMessages(const ScriptInterface &guiInterface)
Definition: XmppClient.cpp:773
std::string GetNick() const
Get current nickname.
Definition: XmppClient.cpp:1205
void SendIqLobbyAuth(const std::string &to, const std::string &token)
Send lobby authentication token.
Definition: XmppClient.cpp:511
std::string m_echelonId
Definition: XmppClient.h:56
void SendMUCMessage(const std::string &message)
Send a standard MUC textual message.
Definition: XmppClient.cpp:794
std::string m_connectionDataJid
Definition: XmppClient.h:59
virtual void handleRegistrationFields(const glooxwrapper::JID &, int fields, glooxwrapper::string instructions)
Definition: XmppClient.cpp:527
void kick(const std::string &nick, const std::string &reason)
Kick a player from the current room.
Definition: XmppClient.cpp:1221
std::string m_connectionDataIqId
Definition: XmppClient.h:60
void SendIqRegisterGame(const ScriptRequest &rq, JS::HandleValue data)
Send a request to register a game to the server.
Definition: XmppClient.cpp:422
virtual void handleSessionInitiation(glooxwrapper::Jingle::Session &session, const glooxwrapper::Jingle::Session::Jingle &jingle)
Definition: XmppClient.cpp:1519
virtual void onDisconnect(gloox::ConnectionError e)
Handle disconnection.
Definition: XmppClient.cpp:264
virtual void onConnect()
Handle connection.
Definition: XmppClient.cpp:248
static std::string RegistrationResultToString(gloox::RegistrationResult res)
Convert a gloox registration result enum to string Keep in sync with Gloox documentation.
Definition: XmppClient.cpp:1482
void CreateGUIMessage(const std::string &type, const std::string &level, const std::time_t time, Args const &... args)
Definition: XmppClient.cpp:690
virtual void handleRegistrationResult(const glooxwrapper::JID &, gloox::RegistrationResult result)
Definition: XmppClient.cpp:535
void SetPresence(const std::string &presence)
Change the xmpp presence of the client.
Definition: XmppClient.cpp:1242
const char * GetPresence(const std::string &nickname)
Get the current xmpp presence of the given nick.
Definition: XmppClient.cpp:1258
std::vector< JS::Heap< JS::Value > > m_HistoricGuiMessages
Cache of all GUI messages received since the login.
Definition: XmppClient.h:202
std::string m_xpartamuppId
Definition: XmppClient.h:55
void SendIqUnregisterGame()
Send a request to unregister a game to the server.
Definition: XmppClient.cpp:464
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.
Definition: XmppClient.cpp:368
virtual void handleOOB(const glooxwrapper::JID &, const glooxwrapper::OOB &oob)
Definition: XmppClient.cpp:555
virtual bool handleIq(const glooxwrapper::IQ &iq)
Handle portions of messages containing custom stanza extensions.
Definition: XmppClient.cpp:834
std::string m_room
Definition: XmppClient.h:53
std::vector< const glooxwrapper::Tag * > m_Profile
Profile data.
Definition: XmppClient.h:196
static std::string ConnectionErrorToString(gloox::ConnectionError err)
Convert a gloox connection error enum to string Keep in sync with Gloox documentation.
Definition: XmppClient.cpp:1443
static const char * GetPresenceString(const gloox::Presence::PresenceType presenceType)
Convert gloox values to string or time.
Definition: XmppClient.cpp:1326
glooxwrapper::MUCRoom * m_mucRoom
Definition: XmppClient.h:45
const std::wstring & GetSubject()
Get current subject.
Definition: XmppClient.cpp:1187
static std::string CertificateErrorToString(gloox::CertStatus status)
Translates a gloox certificate error codes, i.e.
Definition: XmppClient.cpp:1371
JS::Value GUIGetProfile(const ScriptRequest &rq)
Handle requests from the GUI for profile data.
Definition: XmppClient.cpp:651
JS::Value GUIGetBoardList(const ScriptRequest &rq)
Handle requests from the GUI for leaderboard data.
Definition: XmppClient.cpp:625
static void Trace(JSTracer *trc, void *data)
Definition: XmppClient.h:73
void SetNick(const std::string &nick)
Request nick change, real change via mucRoomHandler.
Definition: XmppClient.cpp:1197
glooxwrapper::Registration * m_registration
Definition: XmppClient.h:46
XmppClient(const ScriptInterface *scriptInterface, const std::string &sUsername, const std::string &sPassword, const std::string &sRoom, const std::string &sNick, const int historyRequestSize=0, const bool regOpt=false)
Construct the XMPP client.
Definition: XmppClient.cpp:79
void SendIqGameReport(const ScriptRequest &rq, JS::HandleValue data)
Send game report containing numerous game properties to the server.
Definition: XmppClient.cpp:389
virtual ~XmppClient()
Destroy the xmpp client.
Definition: XmppClient.cpp:179
void disconnect()
Definition: XmppClient.cpp:218
void connect()
Network.
Definition: XmppClient.cpp:212
JS::Value GUIGetPlayerList(const ScriptRequest &rq)
Handle requests from the GUI for the list of players.
Definition: XmppClient.cpp:569
std::string GetJID() const
Definition: XmppClient.cpp:1210
static std::time_t ComputeTimestamp(const glooxwrapper::Message &msg)
Parse and return the timestamp of a historic chat message and return the current time for new chat me...
Definition: XmppClient.cpp:1306
void SendIqGetProfile(const std::string &player)
Request the profile data from the server.
Definition: XmppClient.cpp:352
bool GuiPollHasPlayerListUpdate()
Definition: XmppClient.cpp:714
std::string m_username
Definition: XmppClient.h:50
static std::string StanzaErrorToString(gloox::StanzaError err)
Convert a gloox stanza error type to string.
Definition: XmppClient.cpp:1399
const ScriptInterface * m_ScriptInterface
ScriptInterface to root the values.
Definition: XmppClient.h:198
Definition: glooxwrapper.h:406
Definition: glooxwrapper.h:345
Definition: glooxwrapper.h:465
Definition: glooxwrapper.h:354
Definition: glooxwrapper.h:495
Definition: glooxwrapper.h:682
Definition: glooxwrapper.h:661
Definition: glooxwrapper.h:654
Definition: glooxwrapper.h:369
Definition: glooxwrapper.h:534
Definition: glooxwrapper.h:362
Definition: glooxwrapper.h:515
Definition: glooxwrapper.h:558
Definition: glooxwrapper.h:379
Definition: glooxwrapper.h:566
Definition: glooxwrapper.h:691
Definition: glooxwrapper.h:120
Definition: glooxwrapper.cpp:46
Definition: XmppClient.h:176
SPlayer(const gloox::Presence::PresenceType presence, const gloox::MUCRoomRole role, const glooxwrapper::string &rating)
Definition: XmppClient.h:177
glooxwrapper::string m_Rating
Definition: XmppClient.h:183
gloox::MUCRoomRole m_Role
Definition: XmppClient.h:182
gloox::Presence::PresenceType m_Presence
Definition: XmppClient.h:181
Definition: glooxwrapper.h:294
Definition: glooxwrapper.h:330
uint16_t u16
Definition: types.h:38