summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-03-31 14:57:35 (GMT)
committerTobias Markmann <tm@ayena.de>2016-03-31 14:57:35 (GMT)
commitcfbdb43d2cadd40aa87338d41548e4bf89e146e6 (patch)
tree18d94153a302445196fc0c18586abf44a1ce4a38 /Swift/Controllers/XMPPEvents
parent1d545a4a7fb877f021508094b88c1f17b30d8b4e (diff)
downloadswift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.zip
swift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.tar.bz2
Convert tabs to 4 spaces for all source files
Removed trailing spaces and whitespace on empty lines in the process. Changed CheckTabs.py tool to disallow hard tabs in source files. Test-Information: Manually checked 30 random files that the conversion worked as expected. Change-Id: I874f99d617bd3d2bb55f02d58f22f58f9b094480
Diffstat (limited to 'Swift/Controllers/XMPPEvents')
-rw-r--r--Swift/Controllers/XMPPEvents/ErrorEvent.h22
-rw-r--r--Swift/Controllers/XMPPEvents/EventController.cpp72
-rw-r--r--Swift/Controllers/XMPPEvents/EventController.h34
-rw-r--r--Swift/Controllers/XMPPEvents/IncomingFileTransferEvent.h20
-rw-r--r--Swift/Controllers/XMPPEvents/MUCInviteEvent.h44
-rw-r--r--Swift/Controllers/XMPPEvents/MessageEvent.h46
-rw-r--r--Swift/Controllers/XMPPEvents/StanzaEvent.h28
-rw-r--r--Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h52
8 files changed, 159 insertions, 159 deletions
diff --git a/Swift/Controllers/XMPPEvents/ErrorEvent.h b/Swift/Controllers/XMPPEvents/ErrorEvent.h
index 0b18dfc..959f210 100644
--- a/Swift/Controllers/XMPPEvents/ErrorEvent.h
+++ b/Swift/Controllers/XMPPEvents/ErrorEvent.h
@@ -17,16 +17,16 @@
#include <Swift/Controllers/XMPPEvents/StanzaEvent.h>
namespace Swift {
- class ErrorEvent : public StanzaEvent {
- public:
- ErrorEvent(const JID& jid, const std::string& text) : jid_(jid), text_(text){}
- virtual ~ErrorEvent(){}
- const JID& getJID() const {return jid_;}
- const std::string& getText() const {return text_;}
-
- private:
- JID jid_;
- std::string text_;
- };
+ class ErrorEvent : public StanzaEvent {
+ public:
+ ErrorEvent(const JID& jid, const std::string& text) : jid_(jid), text_(text){}
+ virtual ~ErrorEvent(){}
+ const JID& getJID() const {return jid_;}
+ const std::string& getText() const {return text_;}
+
+ private:
+ JID jid_;
+ std::string text_;
+ };
}
diff --git a/Swift/Controllers/XMPPEvents/EventController.cpp b/Swift/Controllers/XMPPEvents/EventController.cpp
index bbe7356..4c6b3bc 100644
--- a/Swift/Controllers/XMPPEvents/EventController.cpp
+++ b/Swift/Controllers/XMPPEvents/EventController.cpp
@@ -25,56 +25,56 @@ EventController::EventController() {
}
EventController::~EventController() {
- foreach(boost::shared_ptr<StanzaEvent> event, events_) {
- event->onConclusion.disconnect(boost::bind(&EventController::handleEventConcluded, this, event));
- }
+ foreach(boost::shared_ptr<StanzaEvent> event, events_) {
+ event->onConclusion.disconnect(boost::bind(&EventController::handleEventConcluded, this, event));
+ }
}
void EventController::handleIncomingEvent(boost::shared_ptr<StanzaEvent> sourceEvent) {
- 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);
- boost::shared_ptr<MUCInviteEvent> mucInviteEvent = boost::dynamic_pointer_cast<MUCInviteEvent>(sourceEvent);
- boost::shared_ptr<IncomingFileTransferEvent> incomingFileTransferEvent = boost::dynamic_pointer_cast<IncomingFileTransferEvent>(sourceEvent);
+ 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);
+ 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) {
- EventList existingEvents(events_);
- foreach(boost::shared_ptr<StanzaEvent> existingEvent, existingEvents) {
- boost::shared_ptr<SubscriptionRequestEvent> existingSubscriptionEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(existingEvent);
- if (existingSubscriptionEvent) {
- if (existingSubscriptionEvent->getJID() == subscriptionEvent->getJID()) {
- existingEvent->conclude();
- }
- }
- }
- }
+ /* If it's a duplicate subscription request, remove the previous request first */
+ if (subscriptionEvent) {
+ EventList existingEvents(events_);
+ foreach(boost::shared_ptr<StanzaEvent> existingEvent, existingEvents) {
+ boost::shared_ptr<SubscriptionRequestEvent> existingSubscriptionEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(existingEvent);
+ if (existingSubscriptionEvent) {
+ if (existingSubscriptionEvent->getJID() == subscriptionEvent->getJID()) {
+ existingEvent->conclude();
+ }
+ }
+ }
+ }
- 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()));
- onEventQueueEventAdded(sourceEvent);
- if (sourceEvent->getConcluded()) {
- handleEventConcluded(sourceEvent);
- }
- }
+ 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()));
+ onEventQueueEventAdded(sourceEvent);
+ if (sourceEvent->getConcluded()) {
+ handleEventConcluded(sourceEvent);
+ }
+ }
}
void EventController::handleEventConcluded(boost::shared_ptr<StanzaEvent> event) {
- event->onConclusion.disconnect(boost::bind(&EventController::handleEventConcluded, this, event));
- events_.erase(std::remove(events_.begin(), events_.end(), event), events_.end());
- onEventQueueLengthChange(boost::numeric_cast<int>(events_.size()));
+ event->onConclusion.disconnect(boost::bind(&EventController::handleEventConcluded, this, event));
+ events_.erase(std::remove(events_.begin(), events_.end(), event), events_.end());
+ onEventQueueLengthChange(boost::numeric_cast<int>(events_.size()));
}
void EventController::disconnectAll() {
- onEventQueueLengthChange.disconnect_all_slots();
- onEventQueueEventAdded.disconnect_all_slots();
+ onEventQueueLengthChange.disconnect_all_slots();
+ onEventQueueEventAdded.disconnect_all_slots();
}
void EventController::clear() {
- events_.clear();
- onEventQueueLengthChange(0);
+ events_.clear();
+ onEventQueueLengthChange(0);
}
}
diff --git a/Swift/Controllers/XMPPEvents/EventController.h b/Swift/Controllers/XMPPEvents/EventController.h
index 35938ac..3081449 100644
--- a/Swift/Controllers/XMPPEvents/EventController.h
+++ b/Swift/Controllers/XMPPEvents/EventController.h
@@ -16,21 +16,21 @@
#include <Swift/Controllers/XMPPEvents/StanzaEvent.h>
namespace Swift {
- typedef std::vector<boost::shared_ptr<StanzaEvent> > EventList;
- class EventController {
- public:
- EventController();
- ~EventController();
-
- void handleIncomingEvent(boost::shared_ptr<StanzaEvent> sourceEvent);
- boost::signal<void (int)> onEventQueueLengthChange;
- boost::signal<void (boost::shared_ptr<StanzaEvent>)> onEventQueueEventAdded;
- const EventList& getEvents() const {return events_;}
- void disconnectAll();
- void clear();
-
- private:
- void handleEventConcluded(boost::shared_ptr<StanzaEvent> event);
- EventList events_;
- };
+ typedef std::vector<boost::shared_ptr<StanzaEvent> > EventList;
+ class EventController {
+ public:
+ EventController();
+ ~EventController();
+
+ void handleIncomingEvent(boost::shared_ptr<StanzaEvent> sourceEvent);
+ boost::signal<void (int)> onEventQueueLengthChange;
+ boost::signal<void (boost::shared_ptr<StanzaEvent>)> onEventQueueEventAdded;
+ const EventList& getEvents() const {return events_;}
+ void disconnectAll();
+ void clear();
+
+ private:
+ void handleEventConcluded(boost::shared_ptr<StanzaEvent> event);
+ EventList events_;
+ };
}
diff --git a/Swift/Controllers/XMPPEvents/IncomingFileTransferEvent.h b/Swift/Controllers/XMPPEvents/IncomingFileTransferEvent.h
index 24af640..4c128e8 100644
--- a/Swift/Controllers/XMPPEvents/IncomingFileTransferEvent.h
+++ b/Swift/Controllers/XMPPEvents/IncomingFileTransferEvent.h
@@ -13,18 +13,18 @@
#include <Swift/Controllers/XMPPEvents/StanzaEvent.h>
namespace Swift {
- class IncomingFileTransferEvent : public StanzaEvent {
- public:
- typedef boost::shared_ptr<IncomingFileTransferEvent> ref;
+ class IncomingFileTransferEvent : public StanzaEvent {
+ public:
+ typedef boost::shared_ptr<IncomingFileTransferEvent> ref;
- IncomingFileTransferEvent(const JID& sender) : sender_(sender) {}
+ IncomingFileTransferEvent(const JID& sender) : sender_(sender) {}
- const JID& getSender() const {
- return sender_;
- }
+ const JID& getSender() const {
+ return sender_;
+ }
- private:
- JID sender_;
- };
+ private:
+ JID sender_;
+ };
}
diff --git a/Swift/Controllers/XMPPEvents/MUCInviteEvent.h b/Swift/Controllers/XMPPEvents/MUCInviteEvent.h
index 1ae9891..7d333fb 100644
--- a/Swift/Controllers/XMPPEvents/MUCInviteEvent.h
+++ b/Swift/Controllers/XMPPEvents/MUCInviteEvent.h
@@ -22,26 +22,26 @@
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, bool impromptu) : inviter_(inviter), roomJID_(roomJID), reason_(reason), password_(password), direct_(direct), impromptu_(impromptu) {}
-
- 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_; }
- bool getImpromptu() const { return impromptu_; }
-
- private:
- JID inviter_;
- JID roomJID_;
- std::string reason_;
- std::string password_;
- bool direct_;
- bool impromptu_;
- };
+ 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, bool impromptu) : inviter_(inviter), roomJID_(roomJID), reason_(reason), password_(password), direct_(direct), impromptu_(impromptu) {}
+
+ 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_; }
+ bool getImpromptu() const { return impromptu_; }
+
+ private:
+ JID inviter_;
+ JID roomJID_;
+ std::string reason_;
+ std::string password_;
+ bool direct_;
+ bool impromptu_;
+ };
}
diff --git a/Swift/Controllers/XMPPEvents/MessageEvent.h b/Swift/Controllers/XMPPEvents/MessageEvent.h
index b5b1215..4ec0406 100644
--- a/Swift/Controllers/XMPPEvents/MessageEvent.h
+++ b/Swift/Controllers/XMPPEvents/MessageEvent.h
@@ -4,7 +4,7 @@
* See the COPYING file for more information.
*/
-#pragma once
+#pragma once
#include <cassert>
@@ -15,34 +15,34 @@
#include <Swift/Controllers/XMPPEvents/StanzaEvent.h>
namespace Swift {
- class MessageEvent : public StanzaEvent {
- public:
- typedef boost::shared_ptr<MessageEvent> ref;
+ class MessageEvent : public StanzaEvent {
+ public:
+ typedef boost::shared_ptr<MessageEvent> ref;
- MessageEvent(boost::shared_ptr<Message> stanza) : stanza_(stanza), targetsMe_(true) {}
+ MessageEvent(boost::shared_ptr<Message> stanza) : stanza_(stanza), targetsMe_(true) {}
- boost::shared_ptr<Message> getStanza() {return stanza_;}
+ boost::shared_ptr<Message> getStanza() {return stanza_;}
- bool isReadable() {
- return getStanza()->isError() || !getStanza()->getBody().get_value_or("").empty();
- }
+ bool isReadable() {
+ return getStanza()->isError() || !getStanza()->getBody().get_value_or("").empty();
+ }
- void read() {
- assert (isReadable());
- conclude();
- }
+ void read() {
+ assert (isReadable());
+ conclude();
+ }
- void setTargetsMe(bool targetsMe) {
- targetsMe_ = targetsMe;
- }
+ void setTargetsMe(bool targetsMe) {
+ targetsMe_ = targetsMe;
+ }
- bool targetsMe() const {
- return targetsMe_;
- }
+ bool targetsMe() const {
+ return targetsMe_;
+ }
- private:
- boost::shared_ptr<Message> stanza_;
- bool targetsMe_;
- };
+ private:
+ boost::shared_ptr<Message> stanza_;
+ bool targetsMe_;
+ };
}
diff --git a/Swift/Controllers/XMPPEvents/StanzaEvent.h b/Swift/Controllers/XMPPEvents/StanzaEvent.h
index e8d5eb9..fe97e23 100644
--- a/Swift/Controllers/XMPPEvents/StanzaEvent.h
+++ b/Swift/Controllers/XMPPEvents/StanzaEvent.h
@@ -12,18 +12,18 @@
#include <Swiften/Base/boost_bsignals.h>
namespace Swift {
- class StanzaEvent {
- public:
- StanzaEvent() : time_(boost::posix_time::microsec_clock::universal_time()) {concluded_ = false;}
- virtual ~StanzaEvent() {}
- void conclude() {concluded_ = true; onConclusion();}
- /** Do not call this directly from outside the class.
- * If you connect to this signal, you *must* disconnect from it manually. */
- boost::signal<void()> onConclusion;
- bool getConcluded() {return concluded_;}
- boost::posix_time::ptime getTime() {return time_;}
- private:
- bool concluded_;
- boost::posix_time::ptime time_;
- };
+ class StanzaEvent {
+ public:
+ StanzaEvent() : time_(boost::posix_time::microsec_clock::universal_time()) {concluded_ = false;}
+ virtual ~StanzaEvent() {}
+ void conclude() {concluded_ = true; onConclusion();}
+ /** Do not call this directly from outside the class.
+ * If you connect to this signal, you *must* disconnect from it manually. */
+ boost::signal<void()> onConclusion;
+ bool getConcluded() {return concluded_;}
+ boost::posix_time::ptime getTime() {return time_;}
+ private:
+ bool concluded_;
+ boost::posix_time::ptime time_;
+ };
}
diff --git a/Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h b/Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h
index a22399b..92922e9 100644
--- a/Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h
+++ b/Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h
@@ -17,31 +17,31 @@
#include <Swift/Controllers/XMPPEvents/StanzaEvent.h>
namespace Swift {
- class SubscriptionRequestEvent : public StanzaEvent {
- public:
- SubscriptionRequestEvent(const JID& jid, const std::string& reason) : jid_(jid), reason_(reason){}
- virtual ~SubscriptionRequestEvent(){}
- const JID& getJID() const {return jid_;}
- const std::string& getReason() const {return reason_;}
- boost::signal<void()> onAccept;
- boost::signal<void()> onDecline;
- void accept() {
- onAccept();
- conclude();
- }
-
- void decline() {
- onDecline();
- conclude();
- }
-
- void defer() {
- conclude();
- }
-
- private:
- JID jid_;
- std::string reason_;
- };
+ class SubscriptionRequestEvent : public StanzaEvent {
+ public:
+ SubscriptionRequestEvent(const JID& jid, const std::string& reason) : jid_(jid), reason_(reason){}
+ virtual ~SubscriptionRequestEvent(){}
+ const JID& getJID() const {return jid_;}
+ const std::string& getReason() const {return reason_;}
+ boost::signal<void()> onAccept;
+ boost::signal<void()> onDecline;
+ void accept() {
+ onAccept();
+ conclude();
+ }
+
+ void decline() {
+ onDecline();
+ conclude();
+ }
+
+ void defer() {
+ conclude();
+ }
+
+ private:
+ JID jid_;
+ std::string reason_;
+ };
}