summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2015-09-15 15:30:48 (GMT)
committerSwift Review <review@swift.im>2015-10-16 14:13:30 (GMT)
commit8da6e35afab55d7232d47575faea2bde7cd44ece (patch)
tree3467ab34d5e1f97c2487c557ce43e14c459219ea /Swift/Controllers/Chat
parentf3279c4497e80bd9497a1e2b834b1921dbf21d86 (diff)
downloadswift-8da6e35afab55d7232d47575faea2bde7cd44ece.zip
swift-8da6e35afab55d7232d47575faea2bde7cd44ece.tar.bz2
Require a node-part for JIDs entered in 'Add contact…'-dialog
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
Diffstat (limited to 'Swift/Controllers/Chat')
-rw-r--r--Swift/Controllers/Chat/UserSearchController.cpp6
1 files changed, 5 insertions, 1 deletions
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<std::string>());
}
}