summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers/XMPPEvents')
-rw-r--r--Swift/Controllers/XMPPEvents/EventController.cpp14
-rw-r--r--Swift/Controllers/XMPPEvents/EventController.h18
-rw-r--r--Swift/Controllers/XMPPEvents/IncomingFileTransferEvent.h30
3 files changed, 46 insertions, 16 deletions
diff --git a/Swift/Controllers/XMPPEvents/EventController.cpp b/Swift/Controllers/XMPPEvents/EventController.cpp
index 1561905..bbe7356 100644
--- a/Swift/Controllers/XMPPEvents/EventController.cpp
+++ b/Swift/Controllers/XMPPEvents/EventController.cpp
@@ -1,20 +1,23 @@
/*
- * Copyright (c) 2010-2012 Isode Limited.
+ * Copyright (c) 2010-2015 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <Swift/Controllers/XMPPEvents/EventController.h>
+#include <algorithm>
+
#include <boost/bind.hpp>
#include <boost/numeric/conversion/cast.hpp>
-#include <algorithm>
#include <Swiften/Base/foreach.h>
-#include <Swift/Controllers/XMPPEvents/MessageEvent.h>
+
#include <Swift/Controllers/XMPPEvents/ErrorEvent.h>
-#include <Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h>
+#include <Swift/Controllers/XMPPEvents/IncomingFileTransferEvent.h>
#include <Swift/Controllers/XMPPEvents/MUCInviteEvent.h>
+#include <Swift/Controllers/XMPPEvents/MessageEvent.h>
+#include <Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h>
namespace Swift {
@@ -32,6 +35,7 @@ void EventController::handleIncomingEvent(boost::shared_ptr<StanzaEvent> sourceE
boost::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(sourceEvent);
boost::shared_ptr<ErrorEvent> errorEvent = boost::dynamic_pointer_cast<ErrorEvent>(sourceEvent);
boost::shared_ptr<MUCInviteEvent> mucInviteEvent = boost::dynamic_pointer_cast<MUCInviteEvent>(sourceEvent);
+ boost::shared_ptr<IncomingFileTransferEvent> incomingFileTransferEvent = boost::dynamic_pointer_cast<IncomingFileTransferEvent>(sourceEvent);
/* If it's a duplicate subscription request, remove the previous request first */
if (subscriptionEvent) {
@@ -46,7 +50,7 @@ void EventController::handleIncomingEvent(boost::shared_ptr<StanzaEvent> sourceE
}
}
- if ((messageEvent && messageEvent->isReadable()) || subscriptionEvent || errorEvent || mucInviteEvent) {
+ if ((messageEvent && messageEvent->isReadable()) || subscriptionEvent || errorEvent || mucInviteEvent || incomingFileTransferEvent) {
events_.push_back(sourceEvent);
sourceEvent->onConclusion.connect(boost::bind(&EventController::handleEventConcluded, this, sourceEvent));
onEventQueueLengthChange(boost::numeric_cast<int>(events_.size()));
diff --git a/Swift/Controllers/XMPPEvents/EventController.h b/Swift/Controllers/XMPPEvents/EventController.h
index 026d03e..35938ac 100644
--- a/Swift/Controllers/XMPPEvents/EventController.h
+++ b/Swift/Controllers/XMPPEvents/EventController.h
@@ -1,25 +1,24 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2015 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
-#ifndef SWIFTEN_EventController_H
-#define SWIFTEN_EventController_H
+#pragma once
+#include <vector>
-#include "Swiften/Base/boost_bsignals.h"
#include <boost/shared_ptr.hpp>
-#include <vector>
-#include "Swift/Controllers/XMPPEvents/StanzaEvent.h"
-#include "Swift/Controllers/XMPPEvents/MessageEvent.h"
+#include <Swiften/Base/boost_bsignals.h>
+
+#include <Swift/Controllers/XMPPEvents/MessageEvent.h>
+#include <Swift/Controllers/XMPPEvents/StanzaEvent.h>
namespace Swift {
typedef std::vector<boost::shared_ptr<StanzaEvent> > EventList;
class EventController {
public:
-
EventController();
~EventController();
@@ -35,6 +34,3 @@ namespace Swift {
EventList events_;
};
}
-#endif
-
-
diff --git a/Swift/Controllers/XMPPEvents/IncomingFileTransferEvent.h b/Swift/Controllers/XMPPEvents/IncomingFileTransferEvent.h
new file mode 100644
index 0000000..24af640
--- /dev/null
+++ b/Swift/Controllers/XMPPEvents/IncomingFileTransferEvent.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#pragma once
+
+#include <boost/shared_ptr.hpp>
+
+#include <Swiften/JID/JID.h>
+
+#include <Swift/Controllers/XMPPEvents/StanzaEvent.h>
+
+namespace Swift {
+ class IncomingFileTransferEvent : public StanzaEvent {
+ public:
+ typedef boost::shared_ptr<IncomingFileTransferEvent> ref;
+
+ IncomingFileTransferEvent(const JID& sender) : sender_(sender) {}
+
+ const JID& getSender() const {
+ return sender_;
+ }
+
+ private:
+ JID sender_;
+ };
+}
+