Changeset - 7ba8909d719f
[Not reviewed]
0 9 0
Jan Kaluza - 9 years ago 2016-02-15 12:21:04
jkaluza@redhat.com
Use value_or instead of get_value_or
9 files changed with 16 insertions and 16 deletions:
0 comments (0 inline, 0 general)
libtransport/AdminInterface.cpp
Show inline comments
 
@@ -64,7 +64,7 @@ AdminInterface::~AdminInterface() {
 

	
 
void AdminInterface::handleQuery(Swift::Message::ref message) {
 
#if HAVE_SWIFTEN_3
 
	std::string msg = message->getBody().value_or("");
 
	std::string msg = message->getBody().get_value_or("");
 
#else
 
	std::string msg = message->getBody();
 
#endif
 
@@ -390,7 +390,7 @@ void AdminInterface::handleMessageReceived(Swift::Message::ref message) {
 
	
 
	// Ignore empty messages
 
#if HAVE_SWIFTEN_3
 
	if (message->getBody().value_or("").empty()) {
 
	if (message->getBody().get_value_or("").empty()) {
 
		return;
 
	}
 
#else
libtransport/NetworkPluginServer.cpp
Show inline comments
 
@@ -971,7 +971,7 @@ void NetworkPluginServer::handleQueryPayload(Backend *b, const std::string &data
 

	
 
	pbnetwork::BackendConfig response;
 
#if HAVE_SWIFTEN_3
 
	response.set_config(msg->getBody().value_or(""));
 
	response.set_config(msg->getBody().get_value_or(""));
 
#else
 
	response.set_config(msg->getBody());
 
#endif
 
@@ -1697,7 +1697,7 @@ void NetworkPluginServer::handleMessageReceived(NetworkConversation *conv, boost
 
		m.set_username(conv->getConversationManager()->getUser()->getJID().toBare());
 
		m.set_buddyname(conv->getLegacyName());
 
#if HAVE_SWIFTEN_3
 
		m.set_message(msg->getBody().value_or(""));
 
		m.set_message(msg->getBody().get_value_or(""));
 
#else
 
		m.set_message(msg->getBody());
 
#endif
 
@@ -1737,7 +1737,7 @@ void NetworkPluginServer::handleMessageReceived(NetworkConversation *conv, boost
 

	
 
	// Send normal message
 
#if HAVE_SWIFTEN_3
 
	std::string body = msg->getBody().value_or("");
 
	std::string body = msg->getBody().get_value_or("");
 
#else
 
	std::string body = msg->getBody();
 
#endif
libtransport/UserManager.cpp
Show inline comments
 
@@ -375,7 +375,7 @@ void UserManager::handleMessageReceived(Swift::Message::ref message) {
 
	}
 

	
 
#if HAVE_SWIFTEN_3
 
	std::string body = message->getBody().value_or("");
 
	std::string body = message->getBody().get_value_or("");
 
#else
 
	std::string body = message->getBody();
 
#endif
spectrum/src/frontends/slack/SlackSession.cpp
Show inline comments
 
@@ -151,7 +151,7 @@ void SlackSession::sendMessage(boost::shared_ptr<Swift::Message> message) {
 

	
 
	LOG4CXX_INFO(logger, m_uinfo.jid << "Sending message to Slack channel " << channel << " from " << from);
 
#if HAVE_SWIFTEN_3
 
	std::string body = message->getBody().value_or("");
 
	std::string body = message->getBody().get_value_or("");
 
#else
 
	std::string body = message->getBody();
 
#endif
spectrum/src/frontends/slack/SlackUserManager.cpp
Show inline comments
 
@@ -110,7 +110,7 @@ void SlackUserManager::handleUserCreated(User *user) {
 

	
 
bool SlackUserManager::handleAdminMessage(Swift::Message::ref message) {
 
#if HAVE_SWIFTEN_3
 
	std::string body = message->getBody().value_or("");
 
	std::string body = message->getBody().get_value_or("");
 
#else
 
	std::string body = message->getBody();
 
#endif
tests/libtransport/conversationmanager.cpp
Show inline comments
 
@@ -14,7 +14,7 @@
 
using namespace Transport;
 

	
 
#if !HAVE_SWIFTEN_3
 
#define value_or(X) substr()
 
#define get_value_or(X) substr()
 
#endif
 

	
 
class ConversationManagerTest : public CPPUNIT_NS :: TestFixture, public BasicTest {
tests/libtransport/user.cpp
Show inline comments
 
@@ -13,7 +13,7 @@
 
using namespace Transport;
 

	
 
#if !HAVE_SWIFTEN_3
 
#define value_or(X) substr()
 
#define get_value_or(X) substr()
 
#endif
 

	
 
class UserTest : public CPPUNIT_NS :: TestFixture, public BasicTest {
 
@@ -431,7 +431,7 @@ class UserTest : public CPPUNIT_NS :: TestFixture, public BasicTest {
 

	
 
		CPPUNIT_ASSERT_EQUAL(2, (int) received.size());
 
		Swift::Message *m = dynamic_cast<Swift::Message *>(getStanza(received[0]));
 
		CPPUNIT_ASSERT_EQUAL(std::string("Connection error"), m->getBody().value_or(""));
 
		CPPUNIT_ASSERT_EQUAL(std::string("Connection error"), m->getBody().get_value_or(""));
 

	
 
		CPPUNIT_ASSERT(dynamic_cast<Swift::StreamError *>(received[1].get()));
 
		CPPUNIT_ASSERT_EQUAL(std::string("Connection error"), dynamic_cast<Swift::StreamError *>(received[1].get())->getText());
tests/libtransport/usermanager.cpp
Show inline comments
 
@@ -13,7 +13,7 @@
 
using namespace Transport;
 

	
 
#if !HAVE_SWIFTEN_3
 
#define value_or(X) substr()
 
#define get_value_or(X) substr()
 
#endif
 

	
 
class UserManagerTest : public CPPUNIT_NS :: TestFixture, public BasicTest {
 
@@ -81,7 +81,7 @@ class UserManagerTest : public CPPUNIT_NS :: TestFixture, public BasicTest {
 

	
 
		CPPUNIT_ASSERT_EQUAL(3, (int) received.size());
 
		CPPUNIT_ASSERT(dynamic_cast<Swift::Message *>(getStanza(received[1])));
 
		CPPUNIT_ASSERT_EQUAL(std::string("Ahoj"), dynamic_cast<Swift::Message *>(getStanza(received[1]))->getBody().value_or(""));
 
		CPPUNIT_ASSERT_EQUAL(std::string("Ahoj"), dynamic_cast<Swift::Message *>(getStanza(received[1]))->getBody().get_value_or(""));
 
		CPPUNIT_ASSERT_EQUAL(std::string("user@localhost/resource"), dynamic_cast<Swift::Message *>(getStanza(received[1]))->getTo().toString());
 
		CPPUNIT_ASSERT_EQUAL(std::string("localhost"), dynamic_cast<Swift::Message *>(getStanza(received[1]))->getFrom().toString());
 

	
tests/libtransport/userregistration.cpp
Show inline comments
 
@@ -13,7 +13,7 @@
 
using namespace Transport;
 

	
 
#if !HAVE_SWIFTEN_3
 
#define value_or(X) substr()
 
#define get_value_or(X) substr()
 
#endif
 

	
 
class UserRegistrationTest : public CPPUNIT_NS :: TestFixture, public BasicTest {
 
@@ -204,7 +204,7 @@ class UserRegistrationTest : public CPPUNIT_NS :: TestFixture, public BasicTest
 
			CPPUNIT_ASSERT_EQUAL(std::string("localhost"), getStanza(received[0])->getPayload<Swift::RosterPayload>()->getItems()[0].getJID().toString());
 

	
 
			CPPUNIT_ASSERT(dynamic_cast<Swift::Message *>(getStanza(received[1])));
 
			CPPUNIT_ASSERT_EQUAL(std::string("registered: user@localhost"), dynamic_cast<Swift::Message *>(getStanza(received[1]))->getBody().value_or(""));
 
			CPPUNIT_ASSERT_EQUAL(std::string("registered: user@localhost"), dynamic_cast<Swift::Message *>(getStanza(received[1]))->getBody().get_value_or(""));
 

	
 
			UserInfo user;
 
			CPPUNIT_ASSERT_EQUAL(true, storage->getUser("user@localhost", user));
 
@@ -242,7 +242,7 @@ class UserRegistrationTest : public CPPUNIT_NS :: TestFixture, public BasicTest
 
			CPPUNIT_ASSERT(getStanza(received[0])->getPayload<Swift::RosterPayload>());
 

	
 
			CPPUNIT_ASSERT(dynamic_cast<Swift::Message *>(getStanza(received[1])));
 
			CPPUNIT_ASSERT_EQUAL(std::string("unregistered: user@localhost"), dynamic_cast<Swift::Message *>(getStanza(received[1]))->getBody().value_or(""));
 
			CPPUNIT_ASSERT_EQUAL(std::string("unregistered: user@localhost"), dynamic_cast<Swift::Message *>(getStanza(received[1]))->getBody().get_value_or(""));
 

	
 

	
 
			UserInfo user;
0 comments (0 inline, 0 general)