Changeset View
Changeset View
Standalone View
Standalone View
source/lobby/StanzaExtensions.cpp
Show First 20 Lines • Show All 277 Lines • ▼ Show 20 Lines | if (!m_Token.empty()) | ||||
t->addChild(glooxwrapper::Tag::allocate("token", m_Token)); | t->addChild(glooxwrapper::Tag::allocate("token", m_Token)); | ||||
return t; | return t; | ||||
} | } | ||||
glooxwrapper::StanzaExtension* LobbyAuth::clone() const | glooxwrapper::StanzaExtension* LobbyAuth::clone() const | ||||
{ | { | ||||
return new LobbyAuth(); | return new LobbyAuth(); | ||||
} | } | ||||
/****************************************************** | |||||
* ConnectionData, a custom IQ Stanza, used to send and | |||||
* receive a ip and port of the server. | |||||
*/ | |||||
ConnectionData::ConnectionData(const glooxwrapper::Tag* tag) | |||||
: StanzaExtension(EXTCONNECTIONDATA) | |||||
{ | |||||
if (!tag || tag->name() != "connectiondata" || tag->xmlns() != XMLNS_CONNECTIONDATA) | |||||
return; | |||||
const glooxwrapper::Tag* c = tag->findTag_clone("connectiondata/ip"); | |||||
if (c) | |||||
m_Ip = c->cdata(); | |||||
const glooxwrapper::Tag* p= tag->findTag_clone("connectiondata/port"); | |||||
if (p) | |||||
m_port = p->cdata(); | |||||
const glooxwrapper::Tag* s = tag->findTag_clone("connectiondata/useSTUN"); | |||||
if (s) | |||||
m_useSTUN = s->cdata(); | |||||
glooxwrapper::Tag::free(c); | |||||
glooxwrapper::Tag::free(p); | |||||
glooxwrapper::Tag::free(s); | |||||
} | |||||
/** | |||||
* Required by gloox, used to find the LobbyAuth element in a received IQ. | |||||
*/ | |||||
const glooxwrapper::string& ConnectionData::filterString() const | |||||
{ | |||||
static const glooxwrapper::string filter = "/iq/connectiondata[@xmlns='" XMLNS_CONNECTIONDATA "']"; | |||||
return filter; | |||||
} | |||||
/** | |||||
* Required by gloox, used to serialize the auth object into XML for sending. | |||||
*/ | |||||
glooxwrapper::Tag* ConnectionData::tag() const | |||||
{ | |||||
Stan: That's a bit strange? | |||||
Done Inline Actionswhats strange, have you seen other cases above ? Silier: whats strange, have you seen other cases above ?
anyway filter is created just once that good… | |||||
Not Done Inline Actions
the static const thing?
I don't know maybe @wraitii or @vladislavbelov knows Stan: > whats strange, have you seen other cases above ?
the static const thing?
> anyway filter is… | |||||
glooxwrapper::Tag* t = glooxwrapper::Tag::allocate("connectiondata"); | |||||
t->setXmlns(XMLNS_CONNECTIONDATA); | |||||
if (!m_Ip.empty()) | |||||
t->addChild(glooxwrapper::Tag::allocate("ip", m_Ip)); | |||||
if (!m_port.empty()) | |||||
t->addChild(glooxwrapper::Tag::allocate("port", m_port)); | |||||
if (!m_useSTUN.empty()) | |||||
t->addChild(glooxwrapper::Tag::allocate("useSTUN", m_useSTUN)); | |||||
return t; | |||||
} | |||||
glooxwrapper::StanzaExtension* ConnectionData::clone() const | |||||
{ | |||||
return new ConnectionData(); | |||||
} |
Wildfire Games · Phabricator
That's a bit strange?