From 4dde3a55c46c95d89a7564738e132ad23bc946ee Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Fri, 11 Feb 2011 10:01:34 +0000
Subject: Rejoin MUCs with the requested nick, not the one that was in previous
 use.

(e.g. don't try to rejoin as Kev_________ just because of some previous ghosts, try as Kev again).

Resolves: #737

diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp
index 001251e..e4c13af 100644
--- a/Swift/Controllers/Chat/MUCController.cpp
+++ b/Swift/Controllers/Chat/MUCController.cpp
@@ -48,7 +48,7 @@ MUCController::MUCController (
 		bool useDelayForLatency,
 		TimerFactory* timerFactory,
 		EventController* eventController) :
-			ChatControllerBase(self, stanzaChannel, iqRouter, chatWindowFactory, muc->getJID(), presenceOracle, avatarManager, useDelayForLatency, uiEventStream, eventController, timerFactory), muc_(muc), nick_(nick) {
+			ChatControllerBase(self, stanzaChannel, iqRouter, chatWindowFactory, muc->getJID(), presenceOracle, avatarManager, useDelayForLatency, uiEventStream, eventController, timerFactory), muc_(muc), nick_(nick), desiredNick_(nick) {
 	parting_ = true;
 	joined_ = false;
 	lastWasPresence_ = false;
@@ -296,6 +296,7 @@ void MUCController::setOnline(bool online) {
 			if (loginCheckTimer_) {
 				loginCheckTimer_->start();
 			}
+			nick_ = desiredNick_;
 			rejoin();
 		}
 	}
diff --git a/Swift/Controllers/Chat/MUCController.h b/Swift/Controllers/Chat/MUCController.h
index 5ce799f..374ad79 100644
--- a/Swift/Controllers/Chat/MUCController.h
+++ b/Swift/Controllers/Chat/MUCController.h
@@ -83,6 +83,7 @@ namespace Swift {
 			MUC::ref muc_;
 			UIEventStream* events_;
 			String nick_;
+			String desiredNick_;
 			Roster* roster_;
 			TabComplete* completer_;
 			bool parting_;
-- 
cgit v0.10.2-6-g49f6