From c8a610d825985ca470fff46f1a2c43f6afe5080f Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Sat, 23 Jun 2012 17:23:29 +0100
Subject: Use a consistent fallback nickname when autojoining MUCs

Previously there was a race whereby initial bookmark autojoins would join with a JID-based nick, and subsequent joins (where no nick is specified) would use the user's VCard nick.

Resolves: #1034

diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 53387ca..f124298 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -290,6 +290,11 @@ void MainController::handleConnected() {
 
 		contactEditController_ = new ContactEditController(rosterController_, client_->getVCardManager(), uiFactory_, uiEventStream_);
 
+		/* Doing this early as an ordering fix. Various things later will
+		 * want to have the user's nick available and this means it will
+		 * be before they receive stanzas that need it (e.g. bookmarks).*/
+		client_->getVCardManager()->requestOwnVCard();
+
 		chatsManager_ = new ChatsManager(jid_, client_->getStanzaChannel(), client_->getIQRouter(), eventController_, uiFactory_, uiFactory_, client_->getNickResolver(), client_->getPresenceOracle(), client_->getPresenceSender(), uiEventStream_, uiFactory_, useDelayForLatency_, networkFactories_->getTimerFactory(), client_->getMUCRegistry(), client_->getEntityCapsProvider(), client_->getMUCManager(), uiFactory_, profileSettings_, ftOverview_, client_->getRoster(), !settings_->getSetting(SettingConstants::REMEMBER_RECENT_CHATS), settings_);
 		
 		client_->onMessageReceived.connect(boost::bind(&ChatsManager::handleIncomingMessage, chatsManager_, _1));
-- 
cgit v0.10.2-6-g49f6