summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiftob')
-rw-r--r--Swiftob/Commands.cpp9
-rw-r--r--Swiftob/LuaCommands.cpp6
-rw-r--r--Swiftob/Swiftob.cpp12
3 files changed, 14 insertions, 13 deletions
diff --git a/Swiftob/Commands.cpp b/Swiftob/Commands.cpp
index 4e31212..9212aaf 100644
--- a/Swiftob/Commands.cpp
+++ b/Swiftob/Commands.cpp
@@ -1,16 +1,17 @@
/*
- * Copyright (c) 2011 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <Swiftob/Commands.h>
-#include <Swiften/Base/foreach.h>
#include <iostream>
-#include <boost/bind.hpp>
+
#include <boost/algorithm/string.hpp>
+#include <boost/bind.hpp>
+#include <Swiften/Base/foreach.h>
#include <Swiften/Client/Client.h>
typedef std::pair<std::string, Commands::Command*> NamedCommand;
@@ -211,6 +212,6 @@ void Commands::replyTo(Swift::Message::ref source, std::string replyBody, bool o
if (client_->isAvailable()) {
client_->sendMessage(reply);
} else {
- std::cout << "Dropping '" + reply->getBody() + "' -> " + reply->getTo().toString() + " on the floor due to missing connection." << std::endl;
+ std::cout << "Dropping '" + reply->getBody().get_value_or("") + "' -> " + reply->getTo().toString() + " on the floor due to missing connection." << std::endl;
}
}
diff --git a/Swiftob/LuaCommands.cpp b/Swiftob/LuaCommands.cpp
index 1192452..18535f3 100644
--- a/Swiftob/LuaCommands.cpp
+++ b/Swiftob/LuaCommands.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -380,7 +380,7 @@ int LuaCommands::get_setting(lua_State *L) {
void LuaCommands::handleLuaListener(int callbackIndex, lua_State* L, Swift::Message::ref message) {
lua_rawgeti(L, LUA_REGISTRYINDEX, callbackIndex);
- lua_pushstring(L, message->getBody().c_str());
+ lua_pushstring(L, message->getBody().get_value_or("").c_str());
lua_pushstring(L, message->getFrom().toBare().toString().c_str());
lua_pushstring(L, message->getFrom().getResource().c_str());
messageOntoStack(message, L);
@@ -426,7 +426,7 @@ void LuaCommands::messageOntoStack(Swift::Message::ref message, lua_State* L) {
lua_setfield(L, -2, "frombare");
lua_pushstring(L, message->getTo().toString().c_str());
lua_setfield(L, -2, "to");
- lua_pushstring(L, message->getBody().c_str());
+ lua_pushstring(L, message->getBody().get_value_or("").c_str());
lua_setfield(L, -2, "body");
}
diff --git a/Swiftob/Swiftob.cpp b/Swiftob/Swiftob.cpp
index d26ea23..d534479 100644
--- a/Swiftob/Swiftob.cpp
+++ b/Swiftob/Swiftob.cpp
@@ -1,22 +1,22 @@
/*
- * Copyright (c) 2011 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <Swiftob/Swiftob.h>
-#include <string>
#include <iostream>
+#include <string>
+
#include <boost/bind.hpp>
-#include <Swiften/JID/JID.h>
#include <Swiften/Base/String.h>
+#include <Swiften/JID/JID.h>
#include <Swiften/Presence/PresenceSender.h>
-#include <Swiftob/Users.h>
#include <Swiftob/Storage.h>
-
+#include <Swiftob/Users.h>
po::options_description Swiftob::getOptionsDescription() {
po::options_description result("Options");
@@ -98,7 +98,7 @@ void Swiftob::handleMessageReceived(Swift::Message::ref message) {
std::cout << "Ignoring typed message" << std::endl;
return;
}
- std::string body = message->getBody();
+ std::string body = message->getBody().get_value_or("");
std::cout << "Got message with body " << body << std::endl;
if (body.size() == 0) {
std::cout << "Not handling empty body" << std::endl;