diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-11-18 17:01:22 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2011-04-24 19:01:16 (GMT) |
commit | 522a3a1c66233792741eb47f75e009a2fe9fa3ad (patch) | |
tree | 580673097cef48e58441f0adbef0462b6d0a8cbf /Swiften/AdHoc/OutgoingAdHocCommandSession.h | |
parent | e3041b220e4846fb2f0273c720d8bcbd78cafaaf (diff) | |
download | swift-contrib-522a3a1c66233792741eb47f75e009a2fe9fa3ad.zip swift-contrib-522a3a1c66233792741eb47f75e009a2fe9fa3ad.tar.bz2 |
Initial Ad-Hoc commands support.
This is not finished, use at your own peril.
Diffstat (limited to 'Swiften/AdHoc/OutgoingAdHocCommandSession.h')
-rw-r--r-- | Swiften/AdHoc/OutgoingAdHocCommandSession.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/Swiften/AdHoc/OutgoingAdHocCommandSession.h b/Swiften/AdHoc/OutgoingAdHocCommandSession.h new file mode 100644 index 0000000..820dc62 --- /dev/null +++ b/Swiften/AdHoc/OutgoingAdHocCommandSession.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2010-2011 Kevin Smith + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/boost_bsignals.h> +#include <boost/shared_ptr.hpp> +#include <Swiften/Elements/DiscoItems.h> +#include <Swiften/Elements/Command.h> +#include <Swiften/Elements/ErrorPayload.h> + +namespace Swift { + class IQRouter; + class MainWindow; + class UIEventStream; + class AdHocCommandWindowFactory; + class OutgoingAdHocCommandSession { + public: + OutgoingAdHocCommandSession(const DiscoItems::Item& command, AdHocCommandWindowFactory* factory, IQRouter* iqRouter); + /** + * 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(); + + /** + * 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; + private: + void handleResponse(boost::shared_ptr<Command> payload, ErrorPayload::ref error); + private: + DiscoItems::Item command_; + IQRouter* iqRouter_; + bool isMultiStage_; + std::string sessionID_; + }; +} |