diff options
Diffstat (limited to 'kopete/protocols/jabber/jingle/libjingle/talk/p2p')
8 files changed, 124 insertions, 124 deletions
diff --git a/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/p2psocket.cc b/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/p2psocket.cc index eb53efeb..d07e2e5d 100644 --- a/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/p2psocket.cc +++ b/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/p2psocket.cc @@ -381,7 +381,7 @@ bool P2PSocket::CreateConnections(const Candidate &remote_candidate, } if ((origin_port != NULL) && - find(ports_.begin(), ports_.end(), origin_port) == ports_.end()) { + tqfind(ports_.begin(), ports_.end(), origin_port) == ports_.end()) { if (CreateConnection(origin_port, remote_candidate, origin_port, readable)) created = true; } @@ -783,7 +783,7 @@ void P2PSocket::OnConnectionDestroyed(Connection *connection) { // Remove this connection from the list. std::vector<Connection*>::iterator iter = - find(connections_.begin(), connections_.end(), connection); + tqfind(connections_.begin(), connections_.end(), connection); assert(iter != connections_.end()); connections_.erase(iter); @@ -807,7 +807,7 @@ void P2PSocket::OnPortDestroyed(Port* port) { assert(worker_thread_ == Thread::Current()); // Remove this port from the list (if we didn't drop it already). - std::vector<Port*>::iterator iter = find(ports_.begin(), ports_.end(), port); + std::vector<Port*>::iterator iter = tqfind(ports_.begin(), ports_.end(), port); if (iter != ports_.end()) ports_.erase(iter); @@ -843,7 +843,7 @@ const std::vector<Connection *>& P2PSocket::connections() { // Set options on ourselves is simply setting options on all of our available // port objects. int P2PSocket::SetOption(Socket::Option opt, int value) { - OptionMap::iterator it = options_.find(opt); + OptionMap::iterator it = options_.tqfind(opt); if (it == options_.end()) { options_.insert(std::make_pair(opt, value)); } else if (it->second == value) { diff --git a/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/port.cc b/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/port.cc index 14549b5b..c9272597 100644 --- a/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/port.cc +++ b/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/port.cc @@ -171,7 +171,7 @@ Port::~Port() { } Connection* Port::GetConnection(const SocketAddress& remote_addr) { - AddressMap::const_iterator iter = connections_.find(remote_addr); + AddressMap::const_iterator iter = connections_.tqfind(remote_addr); if (iter != connections_.end()) return iter->second; else @@ -449,7 +449,7 @@ void Port::Start() { } void Port::OnConnectionDestroyed(Connection* conn) { - AddressMap::iterator iter = connections_.find(conn->remote_candidate().address()); + AddressMap::iterator iter = connections_.tqfind(conn->remote_candidate().address()); assert(iter != connections_.end()); connections_.erase(iter); diff --git a/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/relayserver.cc b/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/relayserver.cc index bb52a1d5..002033dc 100644 --- a/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/relayserver.cc +++ b/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/relayserver.cc @@ -105,14 +105,14 @@ RelayServer::~RelayServer() { void RelayServer::AddInternalSocket(AsyncPacketSocket* socket) { assert(internal_sockets_.end() == - std::find(internal_sockets_.begin(), internal_sockets_.end(), socket)); + std::tqfind(internal_sockets_.begin(), internal_sockets_.end(), socket)); internal_sockets_.push_back(socket); socket->SignalReadPacket.connect(this, &RelayServer::OnInternalPacket); } void RelayServer::RemoveInternalSocket(AsyncPacketSocket* socket) { SocketList::iterator iter = - std::find(internal_sockets_.begin(), internal_sockets_.end(), socket); + std::tqfind(internal_sockets_.begin(), internal_sockets_.end(), socket); assert(iter != internal_sockets_.end()); internal_sockets_.erase(iter); socket->SignalReadPacket.disconnect(this); @@ -120,14 +120,14 @@ void RelayServer::RemoveInternalSocket(AsyncPacketSocket* socket) { void RelayServer::AddExternalSocket(AsyncPacketSocket* socket) { assert(external_sockets_.end() == - std::find(external_sockets_.begin(), external_sockets_.end(), socket)); + std::tqfind(external_sockets_.begin(), external_sockets_.end(), socket)); external_sockets_.push_back(socket); socket->SignalReadPacket.connect(this, &RelayServer::OnExternalPacket); } void RelayServer::RemoveExternalSocket(AsyncPacketSocket* socket) { SocketList::iterator iter = - std::find(external_sockets_.begin(), external_sockets_.end(), socket); + std::tqfind(external_sockets_.begin(), external_sockets_.end(), socket); assert(iter != external_sockets_.end()); external_sockets_.erase(iter); socket->SignalReadPacket.disconnect(this); @@ -143,7 +143,7 @@ void RelayServer::OnInternalPacket( // If this did not come from an existing connection, it should be a STUN // allocate request. - ConnectionMap::iterator piter = connections_.find(ap); + ConnectionMap::iterator piter = connections_.tqfind(ap); if (piter == connections_.end()) { HandleStunAllocate(bytes, size, ap, socket); return; @@ -186,7 +186,7 @@ void RelayServer::OnExternalPacket( assert(!ap.destination().IsAny()); // If this connection already exists, then forward the traffic. - ConnectionMap::iterator piter = connections_.find(ap); + ConnectionMap::iterator piter = connections_.tqfind(ap); if (piter != connections_.end()) { // TODO: Check the HMAC. RelayServerConnection* ext_conn = piter->second; @@ -220,7 +220,7 @@ void RelayServer::OnExternalPacket( // TODO: Check the HMAC. // The binding should already be present. - BindingMap::iterator biter = bindings_.find(username); + BindingMap::iterator biter = bindings_.tqfind(username); if (biter == bindings_.end()) { // TODO: Turn this back on. This is the sign of a client bug. //std::cerr << "Dropping packet: no binding with username" << std::endl; @@ -299,7 +299,7 @@ void RelayServer::HandleStunAllocate( RelayServerBinding* binding; - BindingMap::iterator biter = bindings_.find(username); + BindingMap::iterator biter = bindings_.tqfind(username); if (biter != bindings_.end()) { binding = biter->second; @@ -453,18 +453,18 @@ void RelayServer::HandleStunSend( } void RelayServer::AddConnection(RelayServerConnection* conn) { - assert(connections_.find(conn->addr_pair()) == connections_.end()); + assert(connections_.tqfind(conn->addr_pair()) == connections_.end()); connections_[conn->addr_pair()] = conn; } void RelayServer::RemoveConnection(RelayServerConnection* conn) { - ConnectionMap::iterator iter = connections_.find(conn->addr_pair()); + ConnectionMap::iterator iter = connections_.tqfind(conn->addr_pair()); assert(iter != connections_.end()); connections_.erase(iter); } void RelayServer::RemoveBinding(RelayServerBinding* binding) { - BindingMap::iterator iter = bindings_.find(binding->username()); + BindingMap::iterator iter = bindings_.tqfind(binding->username()); assert(iter != bindings_.end()); bindings_.erase(iter); diff --git a/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/sessionmanager.cc b/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/sessionmanager.cc index 4c1c09d9..d146d63c 100644 --- a/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/sessionmanager.cc +++ b/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/sessionmanager.cc @@ -63,7 +63,7 @@ Session *SessionManager::CreateSession(const std::string &name, const SessionID& void SessionManager::DestroySession(Session *session) { if (session != NULL) { - std::map<SessionID, Session *>::iterator it = session_map_.find(session->id()); + std::map<SessionID, Session *>::iterator it = session_map_.tqfind(session->id()); if (it != session_map_.end()) { SignalSessionDestroy(session); session_map_.erase(it); @@ -74,7 +74,7 @@ void SessionManager::DestroySession(Session *session) { Session *SessionManager::GetSession(const SessionID& id) { // If the id isn't present, the [] operator will make a NULL entry - std::map<SessionID, Session *>::iterator it = session_map_.find(id); + std::map<SessionID, Session *>::iterator it = session_map_.tqfind(id); if (it != session_map_.end()) return (*it).second; return NULL; diff --git a/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/socketmanager.cc b/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/socketmanager.cc index 2f0d67b8..e0257451 100644 --- a/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/socketmanager.cc +++ b/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/socketmanager.cc @@ -109,7 +109,7 @@ void SocketManager::DestroySocket_w(P2PSocket *socket) { // Only if socket exists CritScope cs(&critSM_); std::vector<P2PSocket *>::iterator it; - it = std::find(sockets_.begin(), sockets_.end(), socket); + it = std::tqfind(sockets_.begin(), sockets_.end(), socket); if (it == sockets_.end()) return; sockets_.erase(it); diff --git a/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/stunrequest.cc b/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/stunrequest.cc index 14d64735..34a62547 100644 --- a/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/stunrequest.cc +++ b/kopete/protocols/jabber/jingle/libjingle/talk/p2p/base/stunrequest.cc @@ -59,14 +59,14 @@ void StunRequestManager::Send(StunRequest* request) { void StunRequestManager::SendDelayed(StunRequest* request, int delay) { request->set_manager(this); - assert(requests_.find(request->id()) == requests_.end()); + assert(requests_.tqfind(request->id()) == requests_.end()); requests_[request->id()] = request; thread_->PostDelayed(delay, request, MSG_STUN_SEND, NULL); } void StunRequestManager::Remove(StunRequest* request) { assert(request->manager() == this); - RequestMap::iterator iter = requests_.find(request->id()); + RequestMap::iterator iter = requests_.tqfind(request->id()); if (iter != requests_.end()) { assert(iter->second == request); requests_.erase(iter); @@ -84,7 +84,7 @@ void StunRequestManager::Clear() { } bool StunRequestManager::CheckResponse(StunMessage* msg) { - RequestMap::iterator iter = requests_.find(msg->transaction_id()); + RequestMap::iterator iter = requests_.tqfind(msg->transaction_id()); if (iter == requests_.end()) return false; @@ -113,7 +113,7 @@ bool StunRequestManager::CheckResponse(const char* data, size_t size) { std::string id; id.append(data + 4, 16); - RequestMap::iterator iter = requests_.find(id); + RequestMap::iterator iter = requests_.tqfind(id); if (iter == requests_.end()) return false; diff --git a/kopete/protocols/jabber/jingle/libjingle/talk/p2p/client/basicportallocator.cc b/kopete/protocols/jabber/jingle/libjingle/talk/p2p/client/basicportallocator.cc index 5192595c..42c4a876 100644 --- a/kopete/protocols/jabber/jingle/libjingle/talk/p2p/client/basicportallocator.cc +++ b/kopete/protocols/jabber/jingle/libjingle/talk/p2p/client/basicportallocator.cc @@ -372,7 +372,7 @@ void BasicPortAllocatorSession::AddAllocatedPort(Port* port, void BasicPortAllocatorSession::OnAddressReady(Port *port) { assert(Thread::Current() == network_thread_); - std::vector<PortData>::iterator it = std::find(ports_.begin(), ports_.end(), port); + std::vector<PortData>::iterator it = std::tqfind(ports_.begin(), ports_.end(), port); assert(it != ports_.end()); assert(!it->ready); it->ready = true; @@ -418,7 +418,7 @@ void BasicPortAllocatorSession::OnProtocolEnabled(AllocationSequence * seq, Prot void BasicPortAllocatorSession::OnPortDestroyed(Port* port) { assert(Thread::Current() == network_thread_); std::vector<PortData>::iterator iter = - find(ports_.begin(), ports_.end(), port); + tqfind(ports_.begin(), ports_.end(), port); assert(iter != ports_.end()); ports_.erase(iter); diff --git a/kopete/protocols/jabber/jingle/libjingle/talk/p2p/client/sessionclient.cc b/kopete/protocols/jabber/jingle/libjingle/talk/p2p/client/sessionclient.cc index 09b38a52..668309f8 100644 --- a/kopete/protocols/jabber/jingle/libjingle/talk/p2p/client/sessionclient.cc +++ b/kopete/protocols/jabber/jingle/libjingle/talk/p2p/client/sessionclient.cc @@ -31,7 +31,7 @@ #include "talk/p2p/client/sessionclient.h" #include "talk/p2p/base/helpers.h" #include "talk/base/logging.h" -#include "talk/xmllite/qname.h" +#include "talk/xmllite/tqname.h" #include "talk/xmpp/constants.h" #include "talk/xmllite/xmlprinter.h" #include <iostream> @@ -74,25 +74,25 @@ namespace cricket { #endif const std::string NS_GOOGLESESSION("http://www.google.com/session"); -const buzz::QName QN_GOOGLESESSION_SESSION(true, NS_GOOGLESESSION, "session"); -const buzz::QName QN_GOOGLESESSION_CANDIDATE(true, NS_GOOGLESESSION, "candidate"); -const buzz::QName QN_GOOGLESESSION_TARGET(true, NS_GOOGLESESSION, "target"); -const buzz::QName QN_GOOGLESESSION_COOKIE(true, NS_GOOGLESESSION, "cookie"); -const buzz::QName QN_GOOGLESESSION_REGARDING(true, NS_GOOGLESESSION, "regarding"); - -const buzz::QName QN_TYPE(true, buzz::STR_EMPTY, "type"); -const buzz::QName QN_ID(true, buzz::STR_EMPTY, "id"); -const buzz::QName QN_INITIATOR(true, buzz::STR_EMPTY, "initiator"); -const buzz::QName QN_NAME(true, buzz::STR_EMPTY, "name"); -const buzz::QName QN_PORT(true, buzz::STR_EMPTY, "port"); -const buzz::QName QN_NETWORK(true, buzz::STR_EMPTY, "network"); -const buzz::QName QN_GENERATION(true, buzz::STR_EMPTY, "generation"); -const buzz::QName QN_ADDRESS(true, buzz::STR_EMPTY, "address"); -const buzz::QName QN_USERNAME(true, buzz::STR_EMPTY, "username"); -const buzz::QName QN_PASSWORD(true, buzz::STR_EMPTY, "password"); -const buzz::QName QN_PREFERENCE(true, buzz::STR_EMPTY, "preference"); -const buzz::QName QN_PROTOCOL(true, buzz::STR_EMPTY, "protocol"); -const buzz::QName QN_KEY(true, buzz::STR_EMPTY, "key"); +const buzz::TQName TQN_GOOGLESESSION_SESSION(true, NS_GOOGLESESSION, "session"); +const buzz::TQName TQN_GOOGLESESSION_CANDIDATE(true, NS_GOOGLESESSION, "candidate"); +const buzz::TQName TQN_GOOGLESESSION_TARGET(true, NS_GOOGLESESSION, "target"); +const buzz::TQName TQN_GOOGLESESSION_COOKIE(true, NS_GOOGLESESSION, "cookie"); +const buzz::TQName TQN_GOOGLESESSION_REGARDING(true, NS_GOOGLESESSION, "regarding"); + +const buzz::TQName TQN_TYPE(true, buzz::STR_EMPTY, "type"); +const buzz::TQName TQN_ID(true, buzz::STR_EMPTY, "id"); +const buzz::TQName TQN_INITIATOR(true, buzz::STR_EMPTY, "initiator"); +const buzz::TQName TQN_NAME(true, buzz::STR_EMPTY, "name"); +const buzz::TQName TQN_PORT(true, buzz::STR_EMPTY, "port"); +const buzz::TQName TQN_NETWORK(true, buzz::STR_EMPTY, "network"); +const buzz::TQName TQN_GENERATION(true, buzz::STR_EMPTY, "generation"); +const buzz::TQName TQN_ADDRESS(true, buzz::STR_EMPTY, "address"); +const buzz::TQName TQN_USERNAME(true, buzz::STR_EMPTY, "username"); +const buzz::TQName TQN_PASSWORD(true, buzz::STR_EMPTY, "password"); +const buzz::TQName TQN_PREFERENCE(true, buzz::STR_EMPTY, "preference"); +const buzz::TQName TQN_PROTOCOL(true, buzz::STR_EMPTY, "protocol"); +const buzz::TQName TQN_KEY(true, buzz::STR_EMPTY, "key"); class XmlCookie: public SessionMessage::Cookie { public: @@ -140,21 +140,21 @@ void SessionClient::OnSessionDestroySlot(Session *session) { bool SessionClient::IsClientStanza(const buzz::XmlElement *stanza) { // Is it a IQ set stanza? - if (stanza->Name() != buzz::QN_IQ) + if (stanza->Name() != buzz::TQN_IQ) return false; - if (stanza->Attr(buzz::QN_TYPE) != buzz::STR_SET) + if (stanza->Attr(buzz::TQN_TYPE) != buzz::STR_SET) return false; // Make sure it has the right child element const buzz::XmlElement* element - = stanza->FirstNamed(QN_GOOGLESESSION_SESSION); + = stanza->FirstNamed(TQN_GOOGLESESSION_SESSION); if (element == NULL) return false; // Is it one of the allowed types? std::string type; - if (element->HasAttr(QN_TYPE)) { - type = element->Attr(QN_TYPE); + if (element->HasAttr(TQN_TYPE)) { + type = element->Attr(TQN_TYPE); if (type != "initiate" && type != "accept" && type != "modify" && type != "candidates" && type != "reject" && type != "redirect" && type != "terminate") { @@ -163,7 +163,7 @@ bool SessionClient::IsClientStanza(const buzz::XmlElement *stanza) { } // Does this client own the session description namespace? - buzz::QName qn_session_desc(GetSessionDescriptionName(), "description"); + buzz::TQName qn_session_desc(GetSessionDescriptionName(), "description"); const buzz::XmlElement* description = element->FirstNamed(qn_session_desc); if (type == "initiate" || type == "accept" || type == "modify") { if (description == NULL) @@ -200,9 +200,9 @@ bool SessionClient::ParseIncomingMessage(const buzz::XmlElement *stanza, SessionMessage& message) { // Parse stanza into SessionMessage const buzz::XmlElement* element - = stanza->FirstNamed(QN_GOOGLESESSION_SESSION); + = stanza->FirstNamed(TQN_GOOGLESESSION_SESSION); - std::string type = element->Attr(QN_TYPE); + std::string type = element->Attr(TQN_TYPE); if (type == "initiate" || type == "accept" || type == "modify") { ParseInitiateAcceptModify(stanza, message); } else if (type == "candidates") { @@ -219,20 +219,20 @@ bool SessionClient::ParseIncomingMessage(const buzz::XmlElement *stanza, } void SessionClient::ParseHeader(const buzz::XmlElement *stanza, SessionMessage &message) { - if (stanza->HasAttr(buzz::QN_FROM)) - message.set_from(stanza->Attr(buzz::QN_FROM)); - if (stanza->HasAttr(buzz::QN_TO)) - message.set_to(stanza->Attr(buzz::QN_TO)); + if (stanza->HasAttr(buzz::TQN_FROM)) + message.set_from(stanza->Attr(buzz::TQN_FROM)); + if (stanza->HasAttr(buzz::TQN_TO)) + message.set_to(stanza->Attr(buzz::TQN_TO)); const buzz::XmlElement *element - = stanza->FirstNamed(QN_GOOGLESESSION_SESSION); - if (element->HasAttr(QN_ID)) - message.session_id().set_id_str(element->Attr(QN_ID)); + = stanza->FirstNamed(TQN_GOOGLESESSION_SESSION); + if (element->HasAttr(TQN_ID)) + message.session_id().set_id_str(element->Attr(TQN_ID)); - if (element->HasAttr(QN_INITIATOR)) - message.session_id().set_initiator(element->Attr(QN_INITIATOR)); + if (element->HasAttr(TQN_INITIATOR)) + message.session_id().set_initiator(element->Attr(TQN_INITIATOR)); - std::string type = element->Attr(QN_TYPE); + std::string type = element->Attr(TQN_TYPE); if (type == "initiate") { message.set_type(SessionMessage::TYPE_INITIATE); } else if (type == "accept") { @@ -258,8 +258,8 @@ void SessionClient::ParseInitiateAcceptModify(const buzz::XmlElement *stanza, Se // Parse session description const buzz::XmlElement *session - = stanza->FirstNamed(QN_GOOGLESESSION_SESSION); - buzz::QName qn_session_desc(GetSessionDescriptionName(), "description"); + = stanza->FirstNamed(TQN_GOOGLESESSION_SESSION); + buzz::TQName qn_session_desc(GetSessionDescriptionName(), "description"); const buzz::XmlElement* desc_elem = session->FirstNamed(qn_session_desc); const SessionDescription *description = NULL; if (desc_elem) @@ -275,10 +275,10 @@ void SessionClient::ParseCandidates(const buzz::XmlElement *stanza, SessionMessa // Parse candidates and session description std::vector<Candidate> candidates; const buzz::XmlElement *element - = stanza->FirstNamed(QN_GOOGLESESSION_SESSION); + = stanza->FirstNamed(TQN_GOOGLESESSION_SESSION); const buzz::XmlElement *child = element->FirstElement(); while (child != NULL) { - if (child->Name() == QN_GOOGLESESSION_CANDIDATE) { + if (child->Name() == TQN_GOOGLESESSION_CANDIDATE) { Candidate candidate; if (ParseCandidate(child, &candidate)) candidates.push_back(candidate); @@ -297,20 +297,20 @@ void SessionClient::ParseRejectTerminate(const buzz::XmlElement *stanza, Session bool SessionClient::ParseCandidate(const buzz::XmlElement *child, Candidate* candidate) { // Check for all of the required attributes. - if (!child->HasAttr(QN_NAME) || - !child->HasAttr(QN_ADDRESS) || - !child->HasAttr(QN_PORT) || - !child->HasAttr(QN_USERNAME) || - !child->HasAttr(QN_PREFERENCE) || - !child->HasAttr(QN_PROTOCOL) || - !child->HasAttr(QN_GENERATION)) { + if (!child->HasAttr(TQN_NAME) || + !child->HasAttr(TQN_ADDRESS) || + !child->HasAttr(TQN_PORT) || + !child->HasAttr(TQN_USERNAME) || + !child->HasAttr(TQN_PREFERENCE) || + !child->HasAttr(TQN_PROTOCOL) || + !child->HasAttr(TQN_GENERATION)) { LOG(LERROR) << "Candidate missing required attribute"; return false; } SocketAddress address; - address.SetIP(child->Attr(QN_ADDRESS)); - std::istringstream ist(child->Attr(QN_PORT)); + address.SetIP(child->Attr(TQN_ADDRESS)); + std::istringstream ist(child->Attr(TQN_PORT)); int port; ist >> port; address.SetPort(port); @@ -338,12 +338,12 @@ bool SessionClient::ParseCandidate(const buzz::XmlElement *child, } } - candidate->set_name(child->Attr(QN_NAME)); + candidate->set_name(child->Attr(TQN_NAME)); candidate->set_address(address); - candidate->set_username(child->Attr(QN_USERNAME)); - candidate->set_preference_str(child->Attr(QN_PREFERENCE)); - candidate->set_protocol(child->Attr(QN_PROTOCOL)); - candidate->set_generation_str(child->Attr(QN_GENERATION)); + candidate->set_username(child->Attr(TQN_USERNAME)); + candidate->set_preference_str(child->Attr(TQN_PREFERENCE)); + candidate->set_protocol(child->Attr(TQN_PROTOCOL)); + candidate->set_generation_str(child->Attr(TQN_GENERATION)); // Check that the username is not too long and does not use any bad chars. if (candidate->username().size() > kMaxUsernameSize) { @@ -356,12 +356,12 @@ bool SessionClient::ParseCandidate(const buzz::XmlElement *child, } // Look for the non-required attributes. - if (child->HasAttr(QN_PASSWORD)) - candidate->set_password(child->Attr(QN_PASSWORD)); - if (child->HasAttr(QN_TYPE)) - candidate->set_type(child->Attr(QN_TYPE)); - if (child->HasAttr(QN_NETWORK)) - candidate->set_network_name(child->Attr(QN_NETWORK)); + if (child->HasAttr(TQN_PASSWORD)) + candidate->set_password(child->Attr(TQN_PASSWORD)); + if (child->HasAttr(TQN_TYPE)) + candidate->set_type(child->Attr(TQN_TYPE)); + if (child->HasAttr(TQN_NETWORK)) + candidate->set_network_name(child->Attr(TQN_NETWORK)); return true; } @@ -369,15 +369,15 @@ bool SessionClient::ParseCandidate(const buzz::XmlElement *child, void SessionClient::ParseRedirect(const buzz::XmlElement *stanza, SessionMessage &message) { // Pull the standard header pieces out ParseHeader(stanza, message); - const buzz::XmlElement *session = stanza->FirstNamed(QN_GOOGLESESSION_SESSION); + const buzz::XmlElement *session = stanza->FirstNamed(TQN_GOOGLESESSION_SESSION); // Parse the target and cookie. - const buzz::XmlElement* target = session->FirstNamed(QN_GOOGLESESSION_TARGET); + const buzz::XmlElement* target = session->FirstNamed(TQN_GOOGLESESSION_TARGET); if (target) - message.set_redirect_target(target->Attr(QN_NAME)); + message.set_redirect_target(target->Attr(TQN_NAME)); - const buzz::XmlElement* cookie = session->FirstNamed(QN_GOOGLESESSION_COOKIE); + const buzz::XmlElement* cookie = session->FirstNamed(TQN_GOOGLESESSION_COOKIE); if (cookie) message.set_redirect_cookie(new XmlCookie(cookie)); } @@ -415,58 +415,58 @@ void SessionClient::OnOutgoingMessage(Session *session, const SessionMessage &me } buzz::XmlElement *SessionClient::TranslateHeader(const SessionMessage &message) { - buzz::XmlElement *result = new buzz::XmlElement(buzz::QN_IQ); - result->AddAttr(buzz::QN_TO, message.to()); - result->AddAttr(buzz::QN_TYPE, buzz::STR_SET); - buzz::XmlElement *session = new buzz::XmlElement(QN_GOOGLESESSION_SESSION, true); + buzz::XmlElement *result = new buzz::XmlElement(buzz::TQN_IQ); + result->AddAttr(buzz::TQN_TO, message.to()); + result->AddAttr(buzz::TQN_TYPE, buzz::STR_SET); + buzz::XmlElement *session = new buzz::XmlElement(TQN_GOOGLESESSION_SESSION, true); result->AddElement(session); switch (message.type()) { case SessionMessage::TYPE_INITIATE: - session->AddAttr(QN_TYPE, "initiate"); + session->AddAttr(TQN_TYPE, "initiate"); break; case SessionMessage::TYPE_ACCEPT: - session->AddAttr(QN_TYPE, "accept"); + session->AddAttr(TQN_TYPE, "accept"); break; case SessionMessage::TYPE_MODIFY: - session->AddAttr(QN_TYPE, "modify"); + session->AddAttr(TQN_TYPE, "modify"); break; case SessionMessage::TYPE_CANDIDATES: - session->AddAttr(QN_TYPE, "candidates"); + session->AddAttr(TQN_TYPE, "candidates"); break; case SessionMessage::TYPE_REJECT: - session->AddAttr(QN_TYPE, "reject"); + session->AddAttr(TQN_TYPE, "reject"); break; case SessionMessage::TYPE_REDIRECT: - session->AddAttr(QN_TYPE, "redirect"); + session->AddAttr(TQN_TYPE, "redirect"); break; case SessionMessage::TYPE_TERMINATE: - session->AddAttr(QN_TYPE, "terminate"); + session->AddAttr(TQN_TYPE, "terminate"); break; } - session->AddAttr(QN_ID, message.session_id().id_str()); - session->AddAttr(QN_INITIATOR, message.session_id().initiator()); + session->AddAttr(TQN_ID, message.session_id().id_str()); + session->AddAttr(TQN_INITIATOR, message.session_id().initiator()); return result; } buzz::XmlElement *SessionClient::TranslateCandidate(const Candidate &candidate) { - buzz::XmlElement *result = new buzz::XmlElement(QN_GOOGLESESSION_CANDIDATE); - result->AddAttr(QN_NAME, candidate.name()); - result->AddAttr(QN_ADDRESS, candidate.address().IPAsString()); - result->AddAttr(QN_PORT, candidate.address().PortAsString()); - result->AddAttr(QN_USERNAME, candidate.username()); - result->AddAttr(QN_PASSWORD, candidate.password()); - result->AddAttr(QN_PREFERENCE, candidate.preference_str()); - result->AddAttr(QN_PROTOCOL, candidate.protocol()); - result->AddAttr(QN_TYPE, candidate.type()); - result->AddAttr(QN_NETWORK, candidate.network_name()); - result->AddAttr(QN_GENERATION, candidate.generation_str()); + buzz::XmlElement *result = new buzz::XmlElement(TQN_GOOGLESESSION_CANDIDATE); + result->AddAttr(TQN_NAME, candidate.name()); + result->AddAttr(TQN_ADDRESS, candidate.address().IPAsString()); + result->AddAttr(TQN_PORT, candidate.address().PortAsString()); + result->AddAttr(TQN_USERNAME, candidate.username()); + result->AddAttr(TQN_PASSWORD, candidate.password()); + result->AddAttr(TQN_PREFERENCE, candidate.preference_str()); + result->AddAttr(TQN_PROTOCOL, candidate.protocol()); + result->AddAttr(TQN_TYPE, candidate.type()); + result->AddAttr(TQN_NETWORK, candidate.network_name()); + result->AddAttr(TQN_GENERATION, candidate.generation_str()); return result; } buzz::XmlElement *SessionClient::TranslateInitiateAcceptModify(const SessionMessage &message) { // Header info common to all message types buzz::XmlElement *result = TranslateHeader(message); - buzz::XmlElement *session = result->FirstNamed(QN_GOOGLESESSION_SESSION); + buzz::XmlElement *session = result->FirstNamed(TQN_GOOGLESESSION_SESSION); // Candidates assert(message.candidates().size() == 0); @@ -490,7 +490,7 @@ buzz::XmlElement *SessionClient::TranslateInitiateAcceptModify(const SessionMess buzz::XmlElement *SessionClient::TranslateCandidates(const SessionMessage &message) { // Header info common to all message types buzz::XmlElement *result = TranslateHeader(message); - buzz::XmlElement *session = result->FirstNamed(QN_GOOGLESESSION_SESSION); + buzz::XmlElement *session = result->FirstNamed(TQN_GOOGLESESSION_SESSION); // Candidates std::vector<Candidate>::const_iterator it; @@ -508,24 +508,24 @@ buzz::XmlElement *SessionClient::TranslateRejectTerminate(const SessionMessage & buzz::XmlElement *SessionClient::TranslateRedirect(const SessionMessage &message) { // Header info common to all message types buzz::XmlElement *result = TranslateHeader(message); - buzz::XmlElement *session = result->FirstNamed(QN_GOOGLESESSION_SESSION); + buzz::XmlElement *session = result->FirstNamed(TQN_GOOGLESESSION_SESSION); assert(message.candidates().size() == 0); assert(message.description() == NULL); assert(message.redirect_target().size() > 0); - buzz::XmlElement* target = new buzz::XmlElement(QN_GOOGLESESSION_TARGET); - target->AddAttr(QN_NAME, message.redirect_target()); + buzz::XmlElement* target = new buzz::XmlElement(TQN_GOOGLESESSION_TARGET); + target->AddAttr(TQN_NAME, message.redirect_target()); session->AddElement(target); - buzz::XmlElement* cookie = new buzz::XmlElement(QN_GOOGLESESSION_COOKIE); + buzz::XmlElement* cookie = new buzz::XmlElement(TQN_GOOGLESESSION_COOKIE); session->AddElement(cookie); // If the message does not have a redirect cookie, then this is a redirect // initiated by us. We will automatically add a regarding cookie. if (message.redirect_cookie() == NULL) { - buzz::XmlElement* regarding = new buzz::XmlElement(QN_GOOGLESESSION_REGARDING); - regarding->AddAttr(QN_NAME, GetJid().BareJid().Str()); + buzz::XmlElement* regarding = new buzz::XmlElement(TQN_GOOGLESESSION_REGARDING); + regarding->AddAttr(TQN_NAME, GetJid().BareJid().Str()); cookie->AddElement(regarding); } else { const buzz::XmlElement* cookie_elem = |