summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2012-03-27 23:01:17 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-04-12 14:09:34 (GMT)
commit2dcdee8e9f657c7f5c5d5c507373fd328beaa568 (patch)
treef6c0516afefdcf1561e32b45a415a387bc71f9d3 /Swift/Controllers/XMPPEvents
parent0bf6afc5c01b9eb3024a8cfd04bfd743890db4f6 (diff)
downloadswift-2dcdee8e9f657c7f5c5d5c507373fd328beaa568.zip
swift-2dcdee8e9f657c7f5c5d5c507373fd328beaa568.tar.bz2
Refactoring incoming MUC invites UI.
Making MUC invites non-modal by moving them into the chat view. Adding event classes for invites so they turn up in 'Notices'-tab and generate notifications. License: This patch is BSD-licensed, see http://www.opensource.org/licenses/bsd-license.php
Diffstat (limited to 'Swift/Controllers/XMPPEvents')
-rw-r--r--Swift/Controllers/XMPPEvents/EventController.cpp4
-rw-r--r--Swift/Controllers/XMPPEvents/MUCInviteEvent.h31
2 files changed, 34 insertions, 1 deletions
diff --git a/Swift/Controllers/XMPPEvents/EventController.cpp b/Swift/Controllers/XMPPEvents/EventController.cpp
index 98fd634..0808aa0 100644
--- a/Swift/Controllers/XMPPEvents/EventController.cpp
+++ b/Swift/Controllers/XMPPEvents/EventController.cpp
@@ -13,6 +13,7 @@
#include "Swift/Controllers/XMPPEvents/MessageEvent.h"
#include "Swift/Controllers/XMPPEvents/ErrorEvent.h"
#include "Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h"
+#include "Swift/Controllers/XMPPEvents/MUCInviteEvent.h"
namespace Swift {
@@ -29,7 +30,8 @@ void EventController::handleIncomingEvent(boost::shared_ptr<StanzaEvent> sourceE
boost::shared_ptr<MessageEvent> messageEvent = boost::dynamic_pointer_cast<MessageEvent>(sourceEvent);
boost::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(sourceEvent);
boost::shared_ptr<ErrorEvent> errorEvent = boost::dynamic_pointer_cast<ErrorEvent>(sourceEvent);
- if ((messageEvent && messageEvent->isReadable()) || subscriptionEvent || errorEvent) {
+ boost::shared_ptr<MUCInviteEvent> mucInviteEvent = boost::dynamic_pointer_cast<MUCInviteEvent>(sourceEvent);
+ if ((messageEvent && messageEvent->isReadable()) || subscriptionEvent || errorEvent || mucInviteEvent) {
events_.push_back(sourceEvent);
sourceEvent->onConclusion.connect(boost::bind(&EventController::handleEventConcluded, this, sourceEvent));
onEventQueueLengthChange(events_.size());
diff --git a/Swift/Controllers/XMPPEvents/MUCInviteEvent.h b/Swift/Controllers/XMPPEvents/MUCInviteEvent.h
new file mode 100644
index 0000000..0b430cd
--- /dev/null
+++ b/Swift/Controllers/XMPPEvents/MUCInviteEvent.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2012 Tobias Markmann
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#pragma once
+
+namespace Swift {
+
+ class MUCInviteEvent : public StanzaEvent {
+ public:
+ typedef boost::shared_ptr<MUCInviteEvent> ref;
+
+ public:
+ MUCInviteEvent(const JID& inviter, const JID& roomJID, const std::string& reason, const std::string& password, bool direct) : inviter_(inviter), roomJID_(roomJID), reason_(reason), password_(password), direct_(direct) {}
+
+ const JID& getInviter() const { return inviter_; }
+ const JID& getRoomJID() const { return roomJID_; }
+ const std::string& getReason() const { return reason_; }
+ const std::string& getPassword() const { return password_; }
+ bool getDirect() const { return direct_; }
+
+ private:
+ JID inviter_;
+ JID roomJID_;
+ std::string reason_;
+ std::string password_;
+ bool direct_;
+ };
+}