summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-10-30 19:55:41 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-10-30 19:57:00 (GMT)
commit4804022049cb53ac28902639274826b68a803c18 (patch)
treeb2a7439e15b409c66e051f2ec5e3ef4397591cbf
parentba333999576d89f3340c271b2a3331d6a3e64ac7 (diff)
downloadswift-contrib-4804022049cb53ac28902639274826b68a803c18.zip
swift-contrib-4804022049cb53ac28902639274826b68a803c18.tar.bz2
When MUC notifications are clicked, open the MUC.
Release-Notes: When clicking notifications coming from rooms, bring up the room dialog. Resolves: #674
-rw-r--r--Swift/Controllers/EventNotifier.cpp6
-rw-r--r--Swift/Controllers/MainController.cpp10
-rw-r--r--Swift/Controllers/UIEvents/JoinMUCUIEvent.h2
3 files changed, 15 insertions, 3 deletions
diff --git a/Swift/Controllers/EventNotifier.cpp b/Swift/Controllers/EventNotifier.cpp
index e08c8ed..343abd9 100644
--- a/Swift/Controllers/EventNotifier.cpp
+++ b/Swift/Controllers/EventNotifier.cpp
@@ -33,7 +33,11 @@ void EventNotifier::handleEventAdded(boost::shared_ptr<StanzaEvent> event) {
JID jid = messageEvent->getStanza()->getFrom();
String title = nickResolver->jidToNick(jid);
if (!messageEvent->getStanza()->isError() && !messageEvent->getStanza()->getBody().isEmpty()) {
- notifier->showMessage(Notifier::IncomingMessage, title, messageEvent->getStanza()->getBody(), avatarManager->getAvatarPath(jid), boost::bind(&EventNotifier::handleNotificationActivated, this, jid));
+ JID activationJID = jid;
+ if (messageEvent->getStanza()->getType() == Message::Groupchat) {
+ activationJID = jid.toBare();
+ }
+ notifier->showMessage(Notifier::IncomingMessage, title, messageEvent->getStanza()->getBody(), avatarManager->getAvatarPath(jid), boost::bind(&EventNotifier::handleNotificationActivated, this, activationJID));
}
}
else if(boost::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(event)) {
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 92a3f2a..4501f2c 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -56,6 +56,7 @@
#include "Swiften/StringCodecs/Hexify.h"
#include "Swift/Controllers/UIEvents/RequestChatUIEvent.h"
#include "Swift/Controllers/UIEvents/ToggleNotificationsUIEvent.h"
+#include "Swift/Controllers/UIEvents/JoinMUCUIEvent.h"
namespace Swift {
@@ -509,7 +510,14 @@ void MainController::handleVCardReceived(const JID& jid, VCard::ref vCard) {
void MainController::handleNotificationClicked(const JID& jid) {
assert(chatsManager_);
- uiEventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(jid)));
+ if (client_) {
+ if (client_->getMUCRegistry()->isMUC(jid)) {
+ uiEventStream_->send(boost::shared_ptr<JoinMUCUIEvent>(new JoinMUCUIEvent(jid)));
+ }
+ else {
+ uiEventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(jid)));
+ }
+ }
}
void MainController::handleQuitRequest() {
diff --git a/Swift/Controllers/UIEvents/JoinMUCUIEvent.h b/Swift/Controllers/UIEvents/JoinMUCUIEvent.h
index 4ebf1f1..d294fe8 100644
--- a/Swift/Controllers/UIEvents/JoinMUCUIEvent.h
+++ b/Swift/Controllers/UIEvents/JoinMUCUIEvent.h
@@ -14,7 +14,7 @@
namespace Swift {
class JoinMUCUIEvent : public UIEvent {
public:
- JoinMUCUIEvent(const JID& jid, const boost::optional<String>& nick) : jid_(jid), nick_(nick) {};
+ JoinMUCUIEvent(const JID& jid, const boost::optional<String>& nick = boost::optional<String>()) : jid_(jid), nick_(nick) {};
boost::optional<String> getNick() {return nick_;};
JID getJID() {return jid_;};
private: