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 /Swiften/AdHoc
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 'Swiften/AdHoc')
-rw-r--r--Swiften/AdHoc/OutgoingAdHocCommandSession.cpp100
-rw-r--r--Swiften/AdHoc/OutgoingAdHocCommandSession.h138
2 files changed, 119 insertions, 119 deletions
diff --git a/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp b/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp
index a1f3d4c..1cdf467 100644
--- a/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp
+++ b/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp
@@ -18,83 +18,83 @@ OutgoingAdHocCommandSession::OutgoingAdHocCommandSession(const JID& to, const st
}
OutgoingAdHocCommandSession::~OutgoingAdHocCommandSession() {
- connection_.disconnect();
+ connection_.disconnect();
}
void OutgoingAdHocCommandSession::handleResponse(boost::shared_ptr<Command> payload, ErrorPayload::ref error) {
- if (error) {
- onError(error);
- } else {
- const std::vector<Command::Action>& actions = payload->getAvailableActions();
- actionStates_.clear();
- if (payload->getStatus() == Command::Executing ) {
- actionStates_[Command::Cancel] = EnabledAndPresent;
- actionStates_[Command::Complete] = Present;
- if (std::find(actions.begin(), actions.end(), Command::Complete) != actions.end()) {
- actionStates_[Command::Complete] = EnabledAndPresent;
- }
-
- if (getIsMultiStage()) {
- actionStates_[Command::Next] = Present;
- actionStates_[Command::Prev] = Present;
- }
-
- if (std::find(actions.begin(), actions.end(), Command::Next) != actions.end()) {
- actionStates_[Command::Next] = EnabledAndPresent;
- }
- if (std::find(actions.begin(), actions.end(), Command::Prev) != actions.end()) {
- actionStates_[Command::Prev] = EnabledAndPresent;
- }
- }
-
- sessionID_ = payload->getSessionID();
- if (std::find(actions.begin(), actions.end(), Command::Next) != actions.end()
- || std::find(actions.begin(), actions.end(), Command::Prev) != actions.end()) {
- isMultiStage_ = true;
- }
- onNextStageReceived(payload);
- }
+ if (error) {
+ onError(error);
+ } else {
+ const std::vector<Command::Action>& actions = payload->getAvailableActions();
+ actionStates_.clear();
+ if (payload->getStatus() == Command::Executing ) {
+ actionStates_[Command::Cancel] = EnabledAndPresent;
+ actionStates_[Command::Complete] = Present;
+ if (std::find(actions.begin(), actions.end(), Command::Complete) != actions.end()) {
+ actionStates_[Command::Complete] = EnabledAndPresent;
+ }
+
+ if (getIsMultiStage()) {
+ actionStates_[Command::Next] = Present;
+ actionStates_[Command::Prev] = Present;
+ }
+
+ if (std::find(actions.begin(), actions.end(), Command::Next) != actions.end()) {
+ actionStates_[Command::Next] = EnabledAndPresent;
+ }
+ if (std::find(actions.begin(), actions.end(), Command::Prev) != actions.end()) {
+ actionStates_[Command::Prev] = EnabledAndPresent;
+ }
+ }
+
+ sessionID_ = payload->getSessionID();
+ if (std::find(actions.begin(), actions.end(), Command::Next) != actions.end()
+ || std::find(actions.begin(), actions.end(), Command::Prev) != actions.end()) {
+ isMultiStage_ = true;
+ }
+ onNextStageReceived(payload);
+ }
}
bool OutgoingAdHocCommandSession::getIsMultiStage() const {
- return isMultiStage_;
+ return isMultiStage_;
}
void OutgoingAdHocCommandSession::start() {
- boost::shared_ptr<GenericRequest<Command> > commandRequest = boost::make_shared< GenericRequest<Command> >(IQ::Set, to_, boost::make_shared<Command>(commandNode_), iqRouter_);
- connection_ = commandRequest->onResponse.connect(boost::bind(&OutgoingAdHocCommandSession::handleResponse, this, _1, _2));
- commandRequest->send();
+ boost::shared_ptr<GenericRequest<Command> > commandRequest = boost::make_shared< GenericRequest<Command> >(IQ::Set, to_, boost::make_shared<Command>(commandNode_), iqRouter_);
+ connection_ = commandRequest->onResponse.connect(boost::bind(&OutgoingAdHocCommandSession::handleResponse, this, _1, _2));
+ commandRequest->send();
}
void OutgoingAdHocCommandSession::cancel() {
- if (!sessionID_.empty()) {
- submitForm(Form::ref(), Command::Cancel);
- }
+ if (!sessionID_.empty()) {
+ submitForm(Form::ref(), Command::Cancel);
+ }
}
void OutgoingAdHocCommandSession::goBack() {
- submitForm(Form::ref(), Command::Prev);
+ submitForm(Form::ref(), Command::Prev);
}
void OutgoingAdHocCommandSession::complete(Form::ref form) {
- submitForm(form, Command::Complete);
+ submitForm(form, Command::Complete);
}
void OutgoingAdHocCommandSession::goNext(Form::ref form) {
- submitForm(form, Command::Next);
+ submitForm(form, Command::Next);
}
void OutgoingAdHocCommandSession::submitForm(Form::ref form, Command::Action action) {
- boost::shared_ptr<Command> command(boost::make_shared<Command>(commandNode_, sessionID_, action));
- command->setForm(form);
- boost::shared_ptr<GenericRequest<Command> > commandRequest = boost::make_shared< GenericRequest<Command> >(IQ::Set, to_, command, iqRouter_);
- connection_.disconnect();
- connection_ = commandRequest->onResponse.connect(boost::bind(&OutgoingAdHocCommandSession::handleResponse, this, _1, _2));
- commandRequest->send();
+ boost::shared_ptr<Command> command(boost::make_shared<Command>(commandNode_, sessionID_, action));
+ command->setForm(form);
+ boost::shared_ptr<GenericRequest<Command> > commandRequest = boost::make_shared< GenericRequest<Command> >(IQ::Set, to_, command, iqRouter_);
+ connection_.disconnect();
+ connection_ = commandRequest->onResponse.connect(boost::bind(&OutgoingAdHocCommandSession::handleResponse, this, _1, _2));
+ commandRequest->send();
}
OutgoingAdHocCommandSession::ActionState OutgoingAdHocCommandSession::getActionState(Command::Action action) const {
- return get(actionStates_, action, Absent);
+ return get(actionStates_, action, Absent);
}
}
diff --git a/Swiften/AdHoc/OutgoingAdHocCommandSession.h b/Swiften/AdHoc/OutgoingAdHocCommandSession.h
index 73dc7a1..fdb6e35 100644
--- a/Swiften/AdHoc/OutgoingAdHocCommandSession.h
+++ b/Swiften/AdHoc/OutgoingAdHocCommandSession.h
@@ -18,82 +18,82 @@
#include <Swiften/JID/JID.h>
namespace Swift {
- class IQRouter;
- class MainWindow;
- class UIEventStream;
+ class IQRouter;
+ class MainWindow;
+ class UIEventStream;
- class SWIFTEN_API OutgoingAdHocCommandSession {
- public:
+ class SWIFTEN_API OutgoingAdHocCommandSession {
+ public:
- /**
- * Availability of action.
- */
- enum ActionState {
- Absent /** Action isn't applicable to this command. */ = 0,
- Present /** Action is applicable to this command */= 1,
- Enabled /** Action is applicable and currently available */ = 2,
- EnabledAndPresent = 3};
+ /**
+ * Availability of action.
+ */
+ enum ActionState {
+ Absent /** Action isn't applicable to this command. */ = 0,
+ Present /** Action is applicable to this command */= 1,
+ Enabled /** Action is applicable and currently available */ = 2,
+ EnabledAndPresent = 3};
- OutgoingAdHocCommandSession(const JID& to, const std::string& commandNode, IQRouter* iqRouter);
- ~OutgoingAdHocCommandSession();
- /**
- * Send initial request to the target.
- */
- void start();
- /**
- * Cancel command session with the target.
- */
- void cancel();
- /**
- * Return to the previous stage.
- */
- void goBack();
- /**
- * Send the form to complete the command.
- * \param form Form for submission - if missing the command will be submitted with no form.
- */
- void complete(Form::ref form);
- /**
- * Send the form to advance to the next stage of the command.
- * \param form Form for submission - if missing the command will be submitted with no form.
- */
- void goNext(Form::ref form);
+ OutgoingAdHocCommandSession(const JID& to, const std::string& commandNode, IQRouter* iqRouter);
+ ~OutgoingAdHocCommandSession();
+ /**
+ * Send initial request to the target.
+ */
+ void start();
+ /**
+ * Cancel command session with the target.
+ */
+ void cancel();
+ /**
+ * Return to the previous stage.
+ */
+ void goBack();
+ /**
+ * Send the form to complete the command.
+ * \param form Form for submission - if missing the command will be submitted with no form.
+ */
+ void complete(Form::ref form);
+ /**
+ * Send the form to advance to the next stage of the command.
+ * \param form Form for submission - if missing the command will be submitted with no form.
+ */
+ void goNext(Form::ref form);
- /**
- * Is the form multi-stage?
- */
- bool getIsMultiStage() const;
+ /**
+ * Is the form multi-stage?
+ */
+ bool getIsMultiStage() const;
- /**
- * Emitted when the form for the next stage is available.
- */
- boost::signal<void (Command::ref)> onNextStageReceived;
+ /**
+ * Emitted when the form for the next stage is available.
+ */
+ boost::signal<void (Command::ref)> onNextStageReceived;
- /**
- * Emitted on error.
- */
- boost::signal<void (ErrorPayload::ref)> onError;
+ /**
+ * Emitted on error.
+ */
+ boost::signal<void (ErrorPayload::ref)> onError;
- /**
- * Get the state of a given action.
- * This is useful for a UI to determine which buttons should be visible,
- * and which enabled.
- * Use for Next, Prev, Cancel and Complete only.
- * If no actions are available, the command has completed.
- */
- ActionState getActionState(Command::Action action) const;
+ /**
+ * Get the state of a given action.
+ * This is useful for a UI to determine which buttons should be visible,
+ * and which enabled.
+ * Use for Next, Prev, Cancel and Complete only.
+ * If no actions are available, the command has completed.
+ */
+ ActionState getActionState(Command::Action action) const;
- private:
- void handleResponse(boost::shared_ptr<Command> payload, ErrorPayload::ref error);
- void submitForm(Form::ref, Command::Action action);
+ private:
+ void handleResponse(boost::shared_ptr<Command> payload, ErrorPayload::ref error);
+ void submitForm(Form::ref, Command::Action action);
- private:
- JID to_;
- std::string commandNode_;
- IQRouter* iqRouter_;
- bool isMultiStage_;
- std::string sessionID_;
- std::map<Command::Action, ActionState> actionStates_;
- boost::bsignals::connection connection_;
- };
+ private:
+ JID to_;
+ std::string commandNode_;
+ IQRouter* iqRouter_;
+ bool isMultiStage_;
+ std::string sessionID_;
+ std::map<Command::Action, ActionState> actionStates_;
+ boost::bsignals::connection connection_;
+ };
}