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/Session
parent958fe81b045e54ed6dadfe1fa9b14ac317811abf (diff)
downloadswift-d66658252e70abfc2d4eb7cf5f694ba5dc824291.zip
swift-d66658252e70abfc2d4eb7cf5f694ba5dc824291.tar.bz2
Factor out remote & local JID into Session.
Diffstat (limited to 'Swiften/Session')
-rw-r--r--Swiften/Session/Session.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/Swiften/Session/Session.h b/Swiften/Session/Session.h
index b35179c..2c5ec34 100644
--- a/Swiften/Session/Session.h
+++ b/Swiften/Session/Session.h
@@ -46,6 +46,14 @@ namespace Swift {
void finishSession();
void sendElement(boost::shared_ptr<Element>);
+ const JID& getLocalJID() const {
+ return localJID;
+ }
+
+ const JID& getRemoteJID() const {
+ return remoteJID;
+ }
+
boost::signal<void (boost::shared_ptr<Element>)> onElementReceived;
boost::signal<void ()> onSessionStarted;
boost::signal<void (const boost::optional<SessionError>&)> onSessionFinished;
@@ -53,6 +61,16 @@ namespace Swift {
boost::signal<void (const ByteArray&)> onDataRead;
protected:
+ void setRemoteJID(const JID& j) {
+ assert(!isInitialized());
+ remoteJID = j;
+ }
+
+ void setLocalJID(const JID& j) {
+ assert(!isInitialized());
+ localJID = j;
+ }
+
void finishSession(const SessionError&);
virtual void handleSessionStarted() {}
@@ -81,6 +99,8 @@ namespace Swift {
void handleDisconnected(const boost::optional<Connection::Error>& error);
private:
+ JID localJID;
+ JID remoteJID;
boost::shared_ptr<Connection> connection;
PayloadParserFactoryCollection* payloadParserFactories;
PayloadSerializerCollection* payloadSerializers;