From b898f9f8c9c8dd6650e6c635276eeeb44d9c0144 Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Tue, 1 Jun 2010 22:05:42 +0100
Subject: Don't try and send messages with labels until we've got a valid
 catalogue.

Resolves: #432

diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp
index 5f27efb..d1452c7 100644
--- a/Swift/Controllers/Chat/ChatControllerBase.cpp
+++ b/Swift/Controllers/Chat/ChatControllerBase.cpp
@@ -39,12 +39,12 @@ void ChatControllerBase::setEnabled(bool enabled) {
 
 void ChatControllerBase::setAvailableServerFeatures(boost::shared_ptr<DiscoInfo> info) {
 	if (iqRouter_->isAvailable() && info->hasFeature(DiscoInfo::SecurityLabels)) {
-		chatWindow_->setSecurityLabelsEnabled(true);
-		chatWindow_->setSecurityLabelsError();
+		//chatWindow_->setSecurityLabelsEnabled(true);
+		//chatWindow_->setSecurityLabelsError();
 		boost::shared_ptr<GetSecurityLabelsCatalogRequest> request(new GetSecurityLabelsCatalogRequest(JID(toJID_.toBare()), iqRouter_));
 		request->onResponse.connect(boost::bind(&ChatControllerBase::handleSecurityLabelsCatalogResponse, this, _1, _2));
 		request->send();
-		labelsEnabled_ = true;
+		//labelsEnabled_ = true;
 	} else {
 		chatWindow_->setSecurityLabelsEnabled(false);
 		labelsEnabled_ = false;
@@ -87,10 +87,12 @@ void ChatControllerBase::handleSecurityLabelsCatalogResponse(boost::shared_ptr<S
 			chatWindow_->setSecurityLabelsEnabled(false);
 			labelsEnabled_ = false;
 		} else {
+			labelsEnabled_ = true;
 			chatWindow_->setAvailableSecurityLabels(catalog->getLabels());
 			chatWindow_->setSecurityLabelsEnabled(true);
 		}
 	} else {
+		labelsEnabled_ = false;
 		chatWindow_->setSecurityLabelsError();
 	}
 }
-- 
cgit v0.10.2-6-g49f6