Changeset View
Changeset View
Standalone View
Standalone View
source/lobby/XmppClient.h
Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | public: | ||||
void GUIGetPlayerList(const ScriptInterface& scriptInterface, JS::MutableHandleValue ret); | void GUIGetPlayerList(const ScriptInterface& scriptInterface, JS::MutableHandleValue ret); | ||||
void GUIGetGameList(const ScriptInterface& scriptInterface, JS::MutableHandleValue ret); | void GUIGetGameList(const ScriptInterface& scriptInterface, JS::MutableHandleValue ret); | ||||
void GUIGetBoardList(const ScriptInterface& scriptInterface, JS::MutableHandleValue ret); | void GUIGetBoardList(const ScriptInterface& scriptInterface, JS::MutableHandleValue ret); | ||||
void GUIGetProfile(const ScriptInterface& scriptInterface, JS::MutableHandleValue ret); | void GUIGetProfile(const ScriptInterface& scriptInterface, JS::MutableHandleValue ret); | ||||
void SendStunEndpointToHost(StunClient::StunEndpoint* stunEndpoint, const std::string& hostJID); | void SendStunEndpointToHost(StunClient::StunEndpoint* stunEndpoint, const std::string& hostJID); | ||||
protected: | protected: | ||||
shared_ptr<ScriptInterface> GetScriptInterface(); | |||||
/* Xmpp handlers */ | /* Xmpp handlers */ | ||||
/* MUC handlers */ | /* MUC handlers */ | ||||
virtual void handleMUCParticipantPresence(glooxwrapper::MUCRoom*, const glooxwrapper::MUCRoomParticipant, const glooxwrapper::Presence&); | virtual void handleMUCParticipantPresence(glooxwrapper::MUCRoom*, const glooxwrapper::MUCRoomParticipant, const glooxwrapper::Presence&); | ||||
virtual void handleMUCError(glooxwrapper::MUCRoom*, gloox::StanzaError); | virtual void handleMUCError(glooxwrapper::MUCRoom*, gloox::StanzaError); | ||||
virtual void handleMUCMessage(glooxwrapper::MUCRoom* room, const glooxwrapper::Message& msg, bool priv); | virtual void handleMUCMessage(glooxwrapper::MUCRoom* room, const glooxwrapper::Message& msg, bool priv); | ||||
virtual void handleMUCSubject(glooxwrapper::MUCRoom*, const glooxwrapper::string& nick, const glooxwrapper::string& subject); | virtual void handleMUCSubject(glooxwrapper::MUCRoom*, const glooxwrapper::string& nick, const glooxwrapper::string& subject); | ||||
/* MUC handlers not supported by glooxwrapper */ | /* MUC handlers not supported by glooxwrapper */ | ||||
// virtual bool handleMUCRoomCreation(glooxwrapper::MUCRoom*) {return false;} | // virtual bool handleMUCRoomCreation(glooxwrapper::MUCRoom*) {return false;} | ||||
Show All 31 Lines | protected: | ||||
void GetPresenceString(const gloox::Presence::PresenceType p, std::string& presence) const; | void GetPresenceString(const gloox::Presence::PresenceType p, std::string& presence) const; | ||||
void GetRoleString(const gloox::MUCRoomRole r, std::string& role) const; | void GetRoleString(const gloox::MUCRoomRole r, std::string& role) const; | ||||
std::string StanzaErrorToString(gloox::StanzaError err) const; | std::string StanzaErrorToString(gloox::StanzaError err) const; | ||||
std::string ConnectionErrorToString(gloox::ConnectionError err) const; | std::string ConnectionErrorToString(gloox::ConnectionError err) const; | ||||
std::string RegistrationResultToString(gloox::RegistrationResult res) const; | std::string RegistrationResultToString(gloox::RegistrationResult res) const; | ||||
std::time_t ComputeTimestamp(const glooxwrapper::Message& msg) const; | std::time_t ComputeTimestamp(const glooxwrapper::Message& msg) const; | ||||
public: | public: | ||||
/* Messages */ | |||||
struct GUIMessage | |||||
{ | |||||
std::wstring type; | |||||
std::wstring level; | |||||
std::wstring text; | |||||
std::wstring data; | |||||
std::wstring from; | |||||
std::wstring message; | |||||
std::time_t time; | |||||
}; | |||||
void GuiPollMessage(const ScriptInterface& scriptInterface, JS::MutableHandleValue ret); | void GuiPollMessage(const ScriptInterface& scriptInterface, JS::MutableHandleValue ret); | ||||
void SendMUCMessage(const std::string& message); | void SendMUCMessage(const std::string& message); | ||||
void ClearPresenceUpdates(); | void ClearPresenceUpdates(); | ||||
protected: | |||||
void PushGuiMessage(XmppClient::GUIMessage message); | |||||
void CreateGUIMessage(const std::string& type, const std::string& level, const std::string& text = "", const std::string& data = ""); | |||||
protected: | |||||
void CreateGUIMessage( | |||||
std::string type, | |||||
std::string level, | |||||
std::string prop1, | |||||
std::string val1, | |||||
std::string prop2, | |||||
std::string val2, | |||||
std::time_t time); | |||||
private: | private: | ||||
/// Map of players | /// Map of players | ||||
std::map<std::string, std::vector<std::string> > m_PlayerMap; | std::map<std::string, std::vector<std::string> > m_PlayerMap; | ||||
/// List of games | /// List of games | ||||
std::vector<const glooxwrapper::Tag*> m_GameList; | std::vector<const glooxwrapper::Tag*> m_GameList; | ||||
/// List of rankings | /// List of rankings | ||||
std::vector<const glooxwrapper::Tag*> m_BoardList; | std::vector<const glooxwrapper::Tag*> m_BoardList; | ||||
/// Profile data | /// Profile data | ||||
std::vector<const glooxwrapper::Tag*> m_Profile; | std::vector<const glooxwrapper::Tag*> m_Profile; | ||||
/// Queue of messages for the GUI | /// Queue of messages for the GUI | ||||
std::deque<GUIMessage> m_GuiMessageQueue; | std::deque<JS::Heap<JS::Value>> m_GuiMessageQueue; | ||||
/// Current room subject/topic. | /// Current room subject/topic. | ||||
std::string m_Subject; | std::string m_Subject; | ||||
}; | }; | ||||
#endif // XMPPCLIENT_H | #endif // XMPPCLIENT_H |
Wildfire Games · Phabricator