summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-03-31 14:57:35 (GMT)
committerTobias Markmann <tm@ayena.de>2016-03-31 14:57:35 (GMT)
commitcfbdb43d2cadd40aa87338d41548e4bf89e146e6 (patch)
tree18d94153a302445196fc0c18586abf44a1ce4a38 /Limber/Server/ServerStanzaRouter.cpp
parent1d545a4a7fb877f021508094b88c1f17b30d8b4e (diff)
downloadswift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.zip
swift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.tar.bz2
Convert tabs to 4 spaces for all source files
Removed trailing spaces and whitespace on empty lines in the process. Changed CheckTabs.py tool to disallow hard tabs in source files. Test-Information: Manually checked 30 random files that the conversion worked as expected. Change-Id: I874f99d617bd3d2bb55f02d58f22f58f9b094480
Diffstat (limited to 'Limber/Server/ServerStanzaRouter.cpp')
-rw-r--r--Limber/Server/ServerStanzaRouter.cpp78
1 files changed, 39 insertions, 39 deletions
diff --git a/Limber/Server/ServerStanzaRouter.cpp b/Limber/Server/ServerStanzaRouter.cpp
index d0896a0..3ab88e1 100644
--- a/Limber/Server/ServerStanzaRouter.cpp
+++ b/Limber/Server/ServerStanzaRouter.cpp
@@ -16,61 +16,61 @@
namespace Swift {
namespace {
- struct PriorityLessThan {
- bool operator()(const ServerSession* s1, const ServerSession* s2) const {
- return s1->getPriority() < s2->getPriority();
- }
- };
+ struct PriorityLessThan {
+ bool operator()(const ServerSession* s1, const ServerSession* s2) const {
+ return s1->getPriority() < s2->getPriority();
+ }
+ };
- struct HasJID {
- HasJID(const JID& jid) : jid(jid) {}
- bool operator()(const ServerSession* session) const {
- return session->getJID().equals(jid, JID::WithResource);
- }
- JID jid;
- };
+ struct HasJID {
+ HasJID(const JID& jid) : jid(jid) {}
+ bool operator()(const ServerSession* session) const {
+ return session->getJID().equals(jid, JID::WithResource);
+ }
+ JID jid;
+ };
}
ServerStanzaRouter::ServerStanzaRouter() {
}
bool ServerStanzaRouter::routeStanza(boost::shared_ptr<Stanza> stanza) {
- JID to = stanza->getTo();
- assert(to.isValid());
+ JID to = stanza->getTo();
+ assert(to.isValid());
- // For a full JID, first try to route to a session with the full JID
- if (!to.isBare()) {
- std::vector<ServerSession*>::const_iterator i = std::find_if(clientSessions_.begin(), clientSessions_.end(), HasJID(to));
- if (i != clientSessions_.end()) {
- (*i)->sendStanza(stanza);
- return true;
- }
- }
+ // For a full JID, first try to route to a session with the full JID
+ if (!to.isBare()) {
+ std::vector<ServerSession*>::const_iterator i = std::find_if(clientSessions_.begin(), clientSessions_.end(), HasJID(to));
+ if (i != clientSessions_.end()) {
+ (*i)->sendStanza(stanza);
+ return true;
+ }
+ }
- // Look for candidate sessions
- to = to.toBare();
- std::vector<ServerSession*> candidateSessions;
- for (std::vector<ServerSession*>::const_iterator i = clientSessions_.begin(); i != clientSessions_.end(); ++i) {
- if ((*i)->getJID().equals(to, JID::WithoutResource) && (*i)->getPriority() >= 0) {
- candidateSessions.push_back(*i);
- }
- }
- if (candidateSessions.empty()) {
- return false;
- }
+ // Look for candidate sessions
+ to = to.toBare();
+ std::vector<ServerSession*> candidateSessions;
+ for (std::vector<ServerSession*>::const_iterator i = clientSessions_.begin(); i != clientSessions_.end(); ++i) {
+ if ((*i)->getJID().equals(to, JID::WithoutResource) && (*i)->getPriority() >= 0) {
+ candidateSessions.push_back(*i);
+ }
+ }
+ if (candidateSessions.empty()) {
+ return false;
+ }
- // Find the session with the highest priority
- std::vector<ServerSession*>::const_iterator i = std::max_element(clientSessions_.begin(), clientSessions_.end(), PriorityLessThan());
- (*i)->sendStanza(stanza);
- return true;
+ // Find the session with the highest priority
+ std::vector<ServerSession*>::const_iterator i = std::max_element(clientSessions_.begin(), clientSessions_.end(), PriorityLessThan());
+ (*i)->sendStanza(stanza);
+ return true;
}
void ServerStanzaRouter::addClientSession(ServerSession* clientSession) {
- clientSessions_.push_back(clientSession);
+ clientSessions_.push_back(clientSession);
}
void ServerStanzaRouter::removeClientSession(ServerSession* clientSession) {
- erase(clientSessions_, clientSession);
+ erase(clientSessions_, clientSession);
}
}