From 537afef23b0f5da31c0cd38597a13773d79f77d4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Mon, 4 Oct 2010 21:00:00 +0200
Subject: Implement getBoundJID() (as getJID())

Resolves: #582

diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 9915da9..d4093f0 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -247,7 +247,7 @@ void MainController::resetCurrentError() {
 }
 
 void MainController::handleConnected() {
-	boundJID_ = client_->getBoundJID();
+	boundJID_ = client_->getJID();
 	loginWindow_->setIsLoggingIn(false);
 	resetCurrentError();
 	resetPendingReconnects();
diff --git a/Swiften/Client/Client.cpp b/Swiften/Client/Client.cpp
index fe9bc60..974e256 100644
--- a/Swiften/Client/Client.cpp
+++ b/Swiften/Client/Client.cpp
@@ -42,11 +42,6 @@ bool Client::isAvailable() {
 	return session_ && session_->getState() == ClientSession::Initialized;
 }
 
-/** FIXME: implement */
-JID Client::getBoundJID() {
-	return JID();
-}
-
 void Client::connect() {
 	connect(jid_.getDomain());
 }
@@ -256,6 +251,7 @@ void Client::handleStanzaAcked(boost::shared_ptr<Stanza> stanza) {
 }
 
 void Client::handleSessionInitialized() {
+	jid_ = session_->getLocalJID();
 	onConnected();
 	onAvailableChanged(true);
 }
diff --git a/Swiften/Client/Client.h b/Swiften/Client/Client.h
index ca729a7..e046b3c 100644
--- a/Swiften/Client/Client.h
+++ b/Swiften/Client/Client.h
@@ -55,7 +55,13 @@ namespace Swift {
 				return iqRouter_;
 			}
 
-			JID getBoundJID();
+			/**
+			 * Returns the JID of the client. 
+			 * After the session was initialized, this returns the bound JID.
+			 */
+			const JID& getJID() const {
+				return jid_;
+			}
 
 		public:
 			boost::signal<void (const ClientError&)> onError;
diff --git a/Swiften/Client/ClientSession.h b/Swiften/Client/ClientSession.h
index cd364fe..2af9cab 100644
--- a/Swiften/Client/ClientSession.h
+++ b/Swiften/Client/ClientSession.h
@@ -72,6 +72,10 @@ namespace Swift {
 				return stanzaAckRequester_;
 			}
 
+			const JID& getLocalJID() const {
+				return localJID;
+			}
+
 			void start();
 			void finish();
 
-- 
cgit v0.10.2-6-g49f6