From 0a8486091b4cbcce1df883f4be1e65a4628c539b Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Fri, 25 Nov 2011 15:01:31 +0000
Subject: Deal with bookmarks with an empty nick


diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index 83a09d4..e648f20 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -200,7 +200,6 @@ void ChatsManager::handleBookmarksReady() {
 void ChatsManager::handleMUCBookmarkAdded(const MUCBookmark& bookmark) {
 	std::map<JID, MUCController*>::iterator it = mucControllers_.find(bookmark.getRoom());
 	if (it == mucControllers_.end() && bookmark.getAutojoin()) {
-		//FIXME: need vcard stuff here to get a nick
 		handleJoinMUCRequest(bookmark.getRoom(), bookmark.getPassword(), bookmark.getNick(), false, false);
 	}
 	chatListWindow_->addMUCBookmark(bookmark);
@@ -497,7 +496,7 @@ void ChatsManager::handleJoinMUCRequest(const JID &mucJID, const boost::optional
 	if (it != mucControllers_.end()) {
 		it->second->rejoin();
 	} else {
-		std::string nick = nickMaybe ? nickMaybe.get() : jid_.getNode();
+		std::string nick = (nickMaybe && !(*nickMaybe).empty()) ? nickMaybe.get() : nickResolver_->jidToNick(jid_);
 		MUC::ref muc = mucManager->createMUC(mucJID);
 		if (createAsReservedIfNew) {
 			muc->setCreateAsReservedIfNew();
-- 
cgit v0.10.2-6-g49f6