summaryrefslogtreecommitdiff
path: root/louloulibs/xmpp/adhoc_session.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'louloulibs/xmpp/adhoc_session.cpp')
-rw-r--r--louloulibs/xmpp/adhoc_session.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/louloulibs/xmpp/adhoc_session.cpp b/louloulibs/xmpp/adhoc_session.cpp
new file mode 100644
index 0000000..dda4bea
--- /dev/null
+++ b/louloulibs/xmpp/adhoc_session.cpp
@@ -0,0 +1,35 @@
+#include <xmpp/adhoc_session.hpp>
+#include <xmpp/adhoc_command.hpp>
+
+#include <assert.h>
+
+AdhocSession::AdhocSession(const AdhocCommand& command, const std::string& owner_jid,
+ const std::string& to_jid):
+ command(command),
+ owner_jid(owner_jid),
+ to_jid(to_jid),
+ current_step(0),
+ terminated(false)
+{
+}
+
+const AdhocStep& AdhocSession::get_next_step()
+{
+ assert(this->current_step < this->command.callbacks.size());
+ return this->command.callbacks[this->current_step++];
+}
+
+size_t AdhocSession::remaining_steps() const
+{
+ return this->command.callbacks.size() - this->current_step;
+}
+
+bool AdhocSession::is_terminated() const
+{
+ return this->terminated;
+}
+
+void AdhocSession::terminate()
+{
+ this->terminated = true;
+}