diff options
Diffstat (limited to 'Swiftob')
-rw-r--r-- | Swiftob/LuaCommands.cpp | 3 | ||||
-rw-r--r-- | Swiftob/MUCs.cpp | 2 | ||||
-rw-r--r-- | Swiftob/MUCs.h | 20 | ||||
-rw-r--r-- | Swiftob/SConscript | 14 | ||||
-rw-r--r-- | Swiftob/Storage.cpp | 2 | ||||
-rw-r--r-- | Swiftob/Users.cpp | 2 | ||||
-rw-r--r-- | Swiftob/Users.h | 10 |
7 files changed, 30 insertions, 23 deletions
diff --git a/Swiftob/LuaCommands.cpp b/Swiftob/LuaCommands.cpp index d27c131..c2478cd 100644 --- a/Swiftob/LuaCommands.cpp +++ b/Swiftob/LuaCommands.cpp @@ -15,6 +15,7 @@ #include <Swiften/Client/Client.h> #include <Swiften/Network/TimerFactory.h> #include <boost/filesystem/operations.hpp> +#include <Swiften/Base/Path.h> #include <Swiftob/Commands.h> @@ -414,7 +415,7 @@ void LuaCommands::loadScript(boost::filesystem::path filePath) { std::string filename = filePath.filename().string(); #endif filename += ".storage"; - boost::filesystem::path storagePath(boost::filesystem::path(path_) / filename); + boost::filesystem::path storagePath(boost::filesystem::path(path_) / stringToPath(filename)); Storage* storage = new Storage(storagePath); lua_pushlightuserdata(lua, storage); lua_setfield(lua, LUA_REGISTRYINDEX, STORAGE); diff --git a/Swiftob/MUCs.cpp b/Swiftob/MUCs.cpp index 5bad3a1..aec821a 100644 --- a/Swiftob/MUCs.cpp +++ b/Swiftob/MUCs.cpp @@ -17,6 +17,8 @@ #include <Swiftob/Storage.h> +using namespace Swift; + #define MUC_LIST_SETTING "muc_list" #define NICK "default_nick" diff --git a/Swiftob/MUCs.h b/Swiftob/MUCs.h index 8f56182..ecbb7a6 100644 --- a/Swiftob/MUCs.h +++ b/Swiftob/MUCs.h @@ -21,27 +21,25 @@ class MUC; class Storage; -using namespace Swift; - class MUCs { public: - MUCs(Client* client, Storage* storage); - void join(const JID& room, boost::signal<void (const std::string&)>::slot_type successCallback, boost::function<void(const std::string& /*reason*/)> failureCallback); - void part(const JID& room); - bool contains(const JID& room); - MUC::ref getMUC(const JID& room); + MUCs(Swift::Client* client, Storage* storage); + void join(const Swift::JID& room, boost::signal<void (const std::string&)>::slot_type successCallback, boost::function<void(const std::string& /*reason*/)> failureCallback); + void part(const Swift::JID& room); + bool contains(const Swift::JID& room); + Swift::MUC::ref getMUC(const Swift::JID& room); const std::string& getDefaultNick() const {return defaultNick_;} bool setDefaultNick(const std::string& nick); private: void handleConnected(); - void handleJoinFailed(const JID& room, ErrorPayload::ref error, boost::function<void(const std::string& /*reason*/)> failureCallback); + void handleJoinFailed(const Swift::JID& room, Swift::ErrorPayload::ref error, boost::function<void(const std::string& /*reason*/)> failureCallback); void handleInitialJoinSuccess(); void handleInitialJoinFailure(const std::string&); void save(); private: - MUCRegistry registry_; - std::map<JID, MUC::ref> mucs_; - Client* client_; + Swift::MUCRegistry registry_; + std::map<Swift::JID, Swift::MUC::ref> mucs_; + Swift::Client* client_; Storage* storage_; std::string defaultNick_; }; diff --git a/Swiftob/SConscript b/Swiftob/SConscript index bb056bb..424ae72 100644 --- a/Swiftob/SConscript +++ b/Swiftob/SConscript @@ -1,11 +1,17 @@ Import("env") +if env["SCONS_STAGE"] == "build" and not GetOption("help") and not env.get("HAVE_LUA", 0) : + print "Warning: Lua was not found. Swiftob will not be built." + if "Sluift" in env["PROJECTS"] : + env["PROJECTS"].remove("Sluift") -if env["SCONS_STAGE"] == "build": +elif env["SCONS_STAGE"] == "build": myenv = env.Clone() - myenv.MergeFlags(myenv.get("LUA_FLAGS", {})) - myenv.MergeFlags(myenv["SWIFTEN_FLAGS"]) - myenv.MergeFlags(myenv["SWIFTEN_DEP_FLAGS"]) + # Too many compile warnings here at the moment + myenv.Replace(CXXFLAGS = [flag for flag in env["CXXFLAGS"] if flag != "-Weverything"]) + myenv.UseFlags(myenv.get("LUA_FLAGS", {})) + myenv.UseFlags(myenv["SWIFTEN_FLAGS"]) + myenv.UseFlags(myenv["SWIFTEN_DEP_FLAGS"]) sources = [ "linit.cpp", "Swiftob.cpp", diff --git a/Swiftob/Storage.cpp b/Swiftob/Storage.cpp index 141be9f..5311d82 100644 --- a/Swiftob/Storage.cpp +++ b/Swiftob/Storage.cpp @@ -25,7 +25,7 @@ Storage::Storage(const boost::filesystem::path& path) : settingsPath_(path) { void Storage::load() { if (boost::filesystem::exists(settingsPath_)) { Swift::ByteArray data; - Swift::readByteArrayFromFile(data, settingsPath_.string()); + Swift::readByteArrayFromFile(data, settingsPath_); foreach (std::string line, Swift::String::split(Swift::byteArrayToString(data), '\n')) { std::pair<std::string, std::string> pair = Swift::String::getSplittedAtFirst(line, '\t'); settings_[pair.first] = pair.second; diff --git a/Swiftob/Users.cpp b/Swiftob/Users.cpp index 09173cc..868efb0 100644 --- a/Swiftob/Users.cpp +++ b/Swiftob/Users.cpp @@ -13,6 +13,8 @@ #include <Swiftob/MUCs.h> +using namespace Swift; + Users::Users(Client* client, MUCs* mucs) { client_ = client; mucs_ = mucs; diff --git a/Swiftob/Users.h b/Swiftob/Users.h index 0acc330..a78beed 100644 --- a/Swiftob/Users.h +++ b/Swiftob/Users.h @@ -18,15 +18,13 @@ class Client; class MUCs; -using namespace Swift; - class Users { public: class User { public: /* If you add a role here, edit the role lists in Commands.cpp*/ enum Role {Unknown, Owner}; - User(const JID& jid, Role role) : jid_(jid), role_(role) {} + User(const Swift::JID& jid, Role role) : jid_(jid), role_(role) {} Role getRole() {return role_;} Swift::JID getJID() {return jid_;} private: @@ -35,14 +33,14 @@ class Users { }; public: - Users(Client* client, MUCs* mucs); + Users(Swift::Client* client, MUCs* mucs); void clearAll(); void addUser(const User& user); - User::Role getRoleForSender(Message::ref message); + User::Role getRoleForSender(Swift::Message::ref message); private: std::vector<User> users_; - Client* client_; + Swift::Client* client_; MUCs* mucs_; }; |