diff --git a/spectrum/src/frontends/slack/SlackSession.cpp b/spectrum/src/frontends/slack/SlackSession.cpp index f5b8c54196fe9dc02eed640592ba0343cf5bd92e..0334a4d84d8bf5109e8d07c35e0c0424de88535f 100644 --- a/spectrum/src/frontends/slack/SlackSession.cpp +++ b/spectrum/src/frontends/slack/SlackSession.cpp @@ -39,6 +39,8 @@ #include #include "Swiften/Elements/MUCPayload.h" +#include +#define HAVE_SWIFTEN_3 (SWIFTEN_VERSION >= 0x030000) #include #include @@ -148,7 +150,12 @@ void SlackSession::sendMessage(boost::shared_ptr message) { } LOG4CXX_INFO(logger, m_uinfo.jid << "Sending message to Slack channel " << channel << " from " << from); - m_rtm->getAPI()->sendMessage(from, channel, message->getBody()); +#if HAVE_SWIFTEN_3 + std::string body = message->getBody().value_or(""); +#else + std::string body = message->getBody(); +#endif + m_rtm->getAPI()->sendMessage(from, channel, body); } void SlackSession::setPurpose(const std::string &purpose, const std::string &channel) {