summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-02-03 13:45:44 (GMT)
committerKevin Smith <kevin.smith@isode.com>2016-02-04 15:41:17 (GMT)
commitde378c0b47268aea03177165156627659e28dde3 (patch)
tree3da89610ffb11bcdcc850ad260d01830187444c2 /Swiftob/LuaCommands.h
parent20333d5b8dc0f97b60415f0daf3c53a573e0ff8f (diff)
downloadswift-de378c0b47268aea03177165156627659e28dde3.zip
swift-de378c0b47268aea03177165156627659e28dde3.tar.bz2
Remove abandoned Swiftob subprojectswift-3.0rc1
Swifttob used to be an initial approach of a XMPP bot using Swiften. Today such a bot would probably use Sluift. Test-Information: ./scons test=system passes on OS X 10.11.3. Change-Id: I976f26d906f3007b4395e90fdd966e2c00cb1c2c
Diffstat (limited to 'Swiftob/LuaCommands.h')
-rw-r--r--Swiftob/LuaCommands.h90
1 files changed, 0 insertions, 90 deletions
diff --git a/Swiftob/LuaCommands.h b/Swiftob/LuaCommands.h
deleted file mode 100644
index 2ade6b3..0000000
--- a/Swiftob/LuaCommands.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2011 Isode Limited.
- * All rights reserved.
- * See the COPYING file for more information.
- */
-
-#pragma once
-
-#include <string>
-#include <vector>
-
-#include <lua.hpp>
-#include <boost/filesystem/fstream.hpp>
-#include <boost/noncopyable.hpp>
-#include <Swiften/Network/NetworkFactories.h>
-#include <Swiften/Elements/SoftwareVersion.h>
-#include <Swiften/Queries/Requests/GetSoftwareVersionRequest.h>
-#include <Swiften/Network/Timer.h>
-
-#include <Swiftob/Commands.h>
-#include <Swiftob/Storage.h>
-
-using namespace Swift;
-/**
- * Yes, there's an odd naming scheme going on here for methods.
- * normalCamelCase methods are methods called from C++
- * lower_case_methods are exposed to Lua through wrappers and
- * l_lower_case_functions are functions directly exposed (often calling the lower_case_methods).
- */
-class LuaCommands {
- public:
- class LuaCommand : public Commands::Command, boost::noncopyable {
- public:
- /** Takes ownership of lua and storage.*/
- LuaCommand(Commands::RoleList allowedBy, const std::string& description, lua_State* lua, Storage* storage) : Command(allowedBy, description), lua_(lua), storage_(storage) {
- }
-
- virtual ~LuaCommand() {
- lua_close(lua_);
- delete storage_;
- };
-
- private:
- lua_State* lua_;
- Storage* storage_;
- };
-
- class Callbacks {
- public:
- Callbacks(int success, int failure, int timeout) : success(success), failure(failure), timeout(timeout) {};
- int success;
- int failure;
- int timeout;
- void erase(lua_State *L) {
- lua_pushnil(L);
- lua_rawseti(L, LUA_REGISTRYINDEX, success);
- lua_pushnil(L);
- lua_rawseti(L, LUA_REGISTRYINDEX, failure);
- lua_pushnil(L);
- lua_rawseti(L, LUA_REGISTRYINDEX, timeout);
- }
- };
-
- LuaCommands(Commands* commands, const std::string& path, Client* client, TimerFactory* timerFactory, MUCs* mucs);
- /* Public but aren't really part of the API */
- void handleLuaCommand(int callbackIndex, lua_State* L, const std::string& command, const std::string& params, Message::ref message);
- void handleLuaListener(int callbackIndex, lua_State* L, Message::ref message);
- Commands* getCommands() {return commands_;}
- int get_software_version(lua_State *L);
- int muc_input_to_jid(lua_State *L);
- int store_setting(lua_State *L);
- int get_setting(lua_State *L);
- int muc_kick(lua_State *L);
- static LuaCommands* commandsFromLua(lua_State *L);
- static Storage* storageFromLua(lua_State *L);
- private:
- void registerCommands();
- void loadScript(boost::filesystem::path filePath);
- void messageOntoStack(Message::ref message, lua_State* L);
- void handleSoftwareVersionResponse(boost::shared_ptr<SoftwareVersion> version, ErrorPayload::ref error, bool timeout, GetSoftwareVersionRequest::ref request, Timer::ref timer, lua_State* L, Callbacks callbacks);
- private:
- std::string path_;
- boost::filesystem::path scriptsPath_;
- Commands* commands_;
- MUCs* mucs_;
- Client* client_;
- TimerFactory* timerFactory_;
-};
-
-