From 8ccdfd958ba1e7afbeb8c5893c12f09046cb8892 Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Fri, 23 Mar 2012 09:51:38 +0000
Subject: Don't let trailing whitespace in JIDS interfere with User Search


diff --git a/Swift/QtUI/UserSearch/QtUserSearchFirstPage.cpp b/Swift/QtUI/UserSearch/QtUserSearchFirstPage.cpp
index cba2f33..7a91a98 100644
--- a/Swift/QtUI/UserSearch/QtUserSearchFirstPage.cpp
+++ b/Swift/QtUI/UserSearch/QtUserSearchFirstPage.cpp
@@ -21,11 +21,11 @@ QtUserSearchFirstPage::QtUserSearchFirstPage(UserSearchWindow::Type type, const
 bool QtUserSearchFirstPage::isComplete() const {
 	bool complete = false;
 	if (byJID_->isChecked()) {
-		complete = JID(Q2PSTRING(jid_->text())).isValid();
+		complete = JID(Q2PSTRING(jid_->text().trimmed())).isValid();
 	} else if (byLocalSearch_->isChecked()) {
 		complete = true;
 	} else if (byRemoteSearch_->isChecked()) {
-		complete = JID(Q2PSTRING(service_->currentText())).isValid();
+		complete = JID(Q2PSTRING(service_->currentText().trimmed())).isValid();
 	}
 	return complete;
 }
diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
index 53eac07..949d65c 100644
--- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
+++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
@@ -97,7 +97,7 @@ void QtUserSearchWindow::handleCurrentChanged(int page) {
 }
 
 JID QtUserSearchWindow::getServerToSearch() {
-	return firstPage_->byRemoteSearch_->isChecked() ? JID(Q2PSTRING(firstPage_->service_->currentText())) : myServer_;
+	return firstPage_->byRemoteSearch_->isChecked() ? JID(Q2PSTRING(firstPage_->service_->currentText().trimmed())) : myServer_;
 }
 
 void QtUserSearchWindow::handleAccepted() {
@@ -192,7 +192,7 @@ JID QtUserSearchWindow::getContactJID() const {
 		}
 	}
 	else {
-		jid = JID(Q2PSTRING(firstPage_->jid_->text()));
+		jid = JID(Q2PSTRING(firstPage_->jid_->text().trimmed()));
 	}
 	return jid;
 }
-- 
cgit v0.10.2-6-g49f6