summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordknn <yoann.blein@free.fr>2012-03-24 15:11:14 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-04-08 20:17:23 (GMT)
commitfe477c0da80c2e5799a1841ce7fcf4e023ad57bb (patch)
tree6aedfd75c47c64dee7fcf282e84ebafb6722c65d /Swift/Controllers/Chat/UserSearchController.cpp
parent36eaae275b39340f44d8225a73ea129bc0c47464 (diff)
downloadswift-contrib-fe477c0da80c2e5799a1841ce7fcf4e023ad57bb.zip
swift-contrib-fe477c0da80c2e5799a1841ce7fcf4e023ad57bb.tar.bz2
'Add contact' from MUC right-click menu
This patch allows to add a contact from a MUC, by right clicking a contact in the rooster. The action is only available if the JID of the user is also available License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Diffstat (limited to 'Swift/Controllers/Chat/UserSearchController.cpp')
-rw-r--r--Swift/Controllers/Chat/UserSearchController.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/Swift/Controllers/Chat/UserSearchController.cpp b/Swift/Controllers/Chat/UserSearchController.cpp
index af962e9..47d57d4 100644
--- a/Swift/Controllers/Chat/UserSearchController.cpp
+++ b/Swift/Controllers/Chat/UserSearchController.cpp
@@ -46,8 +46,9 @@ UserSearchController::~UserSearchController() {
void UserSearchController::handleUIEvent(boost::shared_ptr<UIEvent> event) {
bool handle = false;
+ boost::shared_ptr<RequestAddUserDialogUIEvent> request = boost::shared_ptr<RequestAddUserDialogUIEvent>();
if (type_ == AddContact) {
- if (boost::dynamic_pointer_cast<RequestAddUserDialogUIEvent>(event)) {
+ if (request = boost::dynamic_pointer_cast<RequestAddUserDialogUIEvent>(event)) {
handle = true;
}
} else {
@@ -65,6 +66,13 @@ void UserSearchController::handleUIEvent(boost::shared_ptr<UIEvent> event) {
window_->clear();
}
window_->show();
+ if (request) {
+ const std::string& name = request->getPredefinedName();
+ const JID& jid = request->getPredefinedJID();
+ if (!name.empty() && jid.isValid()) {
+ window_->prepopulateJIDAndName(jid, name);
+ }
+ }
return;
}
}