summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-07-19 14:06:18 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-07-19 14:06:18 (GMT)
commitd66658252e70abfc2d4eb7cf5f694ba5dc824291 (patch)
tree516515e36150034a1142aaf9e69e4b1d2058fe70 /Swiften/Server
parent958fe81b045e54ed6dadfe1fa9b14ac317811abf (diff)
downloadswift-d66658252e70abfc2d4eb7cf5f694ba5dc824291.zip
swift-d66658252e70abfc2d4eb7cf5f694ba5dc824291.tar.bz2
Factor out remote & local JID into Session.
Diffstat (limited to 'Swiften/Server')
-rw-r--r--Swiften/Server/ServerFromClientSession.cpp10
-rw-r--r--Swiften/Server/ServerFromClientSession.h10
2 files changed, 5 insertions, 15 deletions
diff --git a/Swiften/Server/ServerFromClientSession.cpp b/Swiften/Server/ServerFromClientSession.cpp
index 4489654..3efacd7 100644
--- a/Swiften/Server/ServerFromClientSession.cpp
+++ b/Swiften/Server/ServerFromClientSession.cpp
@@ -42,7 +42,7 @@ void ServerFromClientSession::handleElement(boost::shared_ptr<Element> element)
}
else {
PLAINMessage plainMessage(authRequest->getMessage());
- if (userRegistry_->isValidUserPassword(JID(plainMessage.getAuthenticationID(), domain_.getDomain()), plainMessage.getPassword())) {
+ if (userRegistry_->isValidUserPassword(JID(plainMessage.getAuthenticationID(), getLocalJID().getDomain()), plainMessage.getPassword())) {
getXMPPLayer()->writeElement(boost::shared_ptr<AuthSuccess>(new AuthSuccess()));
user_ = plainMessage.getAuthenticationID();
authenticated_ = true;
@@ -56,13 +56,13 @@ void ServerFromClientSession::handleElement(boost::shared_ptr<Element> element)
}
else if (IQ* iq = dynamic_cast<IQ*>(element.get())) {
if (boost::shared_ptr<ResourceBind> resourceBind = iq->getPayload<ResourceBind>()) {
- jid_ = JID(user_, domain_.getDomain(), resourceBind->getResource());
+ setRemoteJID(JID(user_, getLocalJID().getDomain(), resourceBind->getResource()));
boost::shared_ptr<ResourceBind> resultResourceBind(new ResourceBind());
- resultResourceBind->setJID(jid_);
+ resultResourceBind->setJID(getRemoteJID());
getXMPPLayer()->writeElement(IQ::createResult(JID(), iq->getID(), resultResourceBind));
}
else if (iq->getPayload<StartSession>()) {
- getXMPPLayer()->writeElement(IQ::createResult(jid_, iq->getID()));
+ getXMPPLayer()->writeElement(IQ::createResult(getRemoteJID(), iq->getID()));
setInitialized();
}
}
@@ -70,7 +70,7 @@ void ServerFromClientSession::handleElement(boost::shared_ptr<Element> element)
}
void ServerFromClientSession::handleStreamStart(const ProtocolHeader& incomingHeader) {
- domain_ = JID("", incomingHeader.getTo());
+ setLocalJID(JID("", incomingHeader.getTo()));
ProtocolHeader header;
header.setFrom(incomingHeader.getTo());
header.setID(id_);
diff --git a/Swiften/Server/ServerFromClientSession.h b/Swiften/Server/ServerFromClientSession.h
index 213f5c7..748f7eb 100644
--- a/Swiften/Server/ServerFromClientSession.h
+++ b/Swiften/Server/ServerFromClientSession.h
@@ -31,14 +31,6 @@ namespace Swift {
PayloadSerializerCollection* payloadSerializers,
UserRegistry* userRegistry);
- const JID& getJID() const {
- return jid_;
- }
-
- const JID& getDomain() const {
- return domain_;
- }
-
private:
void handleElement(boost::shared_ptr<Element>);
void handleStreamStart(const ProtocolHeader& header);
@@ -47,8 +39,6 @@ namespace Swift {
String id_;
UserRegistry* userRegistry_;
bool authenticated_;
- JID domain_;
String user_;
- JID jid_;
};
}