From 8da6e35afab55d7232d47575faea2bde7cd44ece Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Tue, 15 Sep 2015 17:30:48 +0200 Subject: =?UTF-8?q?Require=20a=20node-part=20for=20JIDs=20entered=20in=20'?= =?UTF-8?q?Add=20contact=E2=80=A6'-dialog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While it is possible to add domain only JIDs to a user's roster this is rarely the intention of a user. This patch adds the requirement of a node-part for the address entered in the dialog and presents a warning if the node-part is missing. Test-Information: Verified that a warning triangle is shown if there is no node-part in the user entered address. Change-Id: I38dd0b34ca7cb19b38bb7e1c457f7a8a9ef84028 diff --git a/Swift/Controllers/Chat/UserSearchController.cpp b/Swift/Controllers/Chat/UserSearchController.cpp index ece897f..454a110 100644 --- a/Swift/Controllers/Chat/UserSearchController.cpp +++ b/Swift/Controllers/Chat/UserSearchController.cpp @@ -210,7 +210,11 @@ void UserSearchController::handleJIDEditingFinished(const JID& jid) { if (jid.isValid()) { if (rosterController_->getItem(jid)) { window_->setWarning(QT_TRANSLATE_NOOP("", "This contact is already on your contact list.")); - } else { + } + else if (jid.getNode().empty()) { + window_->setWarning(QT_TRANSLATE_NOOP("", "Part of the address you have entered is missing. An address has a structure of 'user@example.com'.")); + } + else { window_->setWarning(boost::optional()); } } -- cgit v0.10.2-6-g49f6