Fix HAVE_SWIFTEN_3 definition to work also in gcc. Fix the tests to work with swiften3 and also with swiften2.
This commit is contained in:
parent
1045ad7b73
commit
90ef6e3128
17 changed files with 55 additions and 27 deletions
|
@ -2,7 +2,7 @@
|
|||
#include "transport/config.h"
|
||||
#include "transport/networkplugin.h"
|
||||
#include "transport/logging.h"
|
||||
#define HAVE_SWIFTEN_3 SWIFTEN_VERSION >= 0x030000
|
||||
#define HAVE_SWIFTEN_3 (SWIFTEN_VERSION >= 0x030000)
|
||||
|
||||
// Yahoo2
|
||||
#include <yahoo2.h>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// Swiften
|
||||
#include "Swiften/Swiften.h"
|
||||
#include <Swiften/Version.h>
|
||||
#define HAVE_SWIFTEN_3 SWIFTEN_VERSION >= 0x030000
|
||||
#define HAVE_SWIFTEN_3 (SWIFTEN_VERSION >= 0x030000)
|
||||
|
||||
#ifndef WIN32
|
||||
// for signal handler
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <set>
|
||||
#include <cstdio>
|
||||
#include <Swiften/Version.h>
|
||||
#define HAVE_SWIFTEN_3 SWIFTEN_VERSION >= 0x030000
|
||||
#define HAVE_SWIFTEN_3 (SWIFTEN_VERSION >= 0x030000)
|
||||
#if HAVE_SWIFTEN_3
|
||||
#include <Swiften/Crypto/CryptoProvider.h>
|
||||
#include <Swiften/Crypto/PlatformCryptoProvider.h>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "transport/presenceoracle.h"
|
||||
#include <Swiften/FileTransfer/OutgoingFileTransfer.h>
|
||||
#include <Swiften/Version.h>
|
||||
#define HAVE_SWIFTEN_3 SWIFTEN_VERSION >= 0x030000
|
||||
#define HAVE_SWIFTEN_3 (SWIFTEN_VERSION >= 0x030000)
|
||||
|
||||
namespace Swift {
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <Swiften/Elements/ErrorPayload.h>
|
||||
#include <Swiften/FileTransfer/IBBSendSession.h>
|
||||
#include <Swiften/Version.h>
|
||||
#define HAVE_SWIFTEN_3 SWIFTEN_VERSION >= 0x030000
|
||||
#define HAVE_SWIFTEN_3 (SWIFTEN_VERSION >= 0x030000)
|
||||
|
||||
namespace Swift {
|
||||
class IQRouter;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <Swiften/Network/DummyConnection.h>
|
||||
#include <Swiften/Network/ConnectionServer.h>
|
||||
#include <Swiften/EventLoop/EventOwner.h>
|
||||
#include <Swiften/Version.h>
|
||||
|
||||
namespace Swift {
|
||||
class DummyConnectionServer : public ConnectionServer, public EventOwner, public boost::enable_shared_from_this<DummyConnectionServer> {
|
||||
|
@ -32,9 +33,11 @@ namespace Swift {
|
|||
|
||||
void acceptConnection(boost::shared_ptr<Swift::Connection> connection);
|
||||
|
||||
virtual boost::optional<Swift::ConnectionServer::Error> tryStart() {
|
||||
return boost::optional<Swift::ConnectionServer::Error>();
|
||||
#if (SWIFTEN_VERSION >= 0x030000)
|
||||
virtual boost::optional<ConnectionServer::Error> tryStart() {
|
||||
return boost::optional<ConnectionServer::Error>();
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual void start();
|
||||
virtual void stop();
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <Swiften/Version.h>
|
||||
#define HAVE_SWIFTEN_3 SWIFTEN_VERSION >= 0x030000
|
||||
#define HAVE_SWIFTEN_3 (SWIFTEN_VERSION >= 0x030000)
|
||||
|
||||
#include <Swiften/Network/NetworkFactories.h>
|
||||
#include <Swiften/Parser/PlatformXMLParserFactory.h>
|
||||
|
|
|
@ -29,6 +29,11 @@
|
|||
#include <iostream>
|
||||
#include <Swiften/TLS/CertificateWithKey.h>
|
||||
|
||||
#include <Swiften/Version.h>
|
||||
#if (SWIFTEN_VERSION >= 0x030000)
|
||||
#include <Swiften/Elements/ToplevelElement.h>
|
||||
#endif
|
||||
|
||||
namespace Swift {
|
||||
|
||||
ServerFromClientSession::ServerFromClientSession(
|
||||
|
@ -76,7 +81,11 @@ void ServerFromClientSession::handlePasswordInvalid(const std::string &error) {
|
|||
}
|
||||
}
|
||||
|
||||
#if (SWIFTEN_VERSION >= 0x030000)
|
||||
void ServerFromClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) {
|
||||
#else
|
||||
void ServerFromClientSession::handleElement(boost::shared_ptr<Element> element) {
|
||||
#endif
|
||||
if (isInitialized()) {
|
||||
onElementReceived(element);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include <Swiften/Base/ByteArray.h>
|
||||
#include <Swiften/TLS/CertificateWithKey.h>
|
||||
#include <Swiften/Version.h>
|
||||
#define HAVE_SWIFTEN_3 SWIFTEN_VERSION >= 0x030000
|
||||
#define HAVE_SWIFTEN_3 (SWIFTEN_VERSION >= 0x030000)
|
||||
|
||||
namespace Swift {
|
||||
class ProtocolHeader;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "Swiften/Elements/Presence.h"
|
||||
#include "Swiften/TLS/Certificate.h"
|
||||
#include <Swiften/Version.h>
|
||||
#define HAVE_SWIFTEN_3 SWIFTEN_VERSION >= 0x030000
|
||||
#define HAVE_SWIFTEN_3 (SWIFTEN_VERSION >= 0x030000)
|
||||
|
||||
namespace Swift {
|
||||
class Error;
|
||||
|
|
|
@ -20,23 +20,22 @@
|
|||
|
||||
#pragma once
|
||||
#include <Swiften/Version.h>
|
||||
#define HAVE_SWIFTEN_3 SWIFTEN_VERSION >= 0x030000
|
||||
#define HAVE_SWIFTEN_3 (SWIFTEN_VERSION >= 0x030000)
|
||||
|
||||
#include <Swiften/Elements/StreamInitiationFileInfo.h>
|
||||
#if !HAVE_SWIFTEN_3
|
||||
#include <Swiften/FileTransfer/ConnectivityManager.h>
|
||||
#endif
|
||||
#include <Swiften/FileTransfer/CombinedOutgoingFileTransferManager.h>
|
||||
#include <Swiften/FileTransfer/IncomingFileTransferManager.h>
|
||||
#if !HAVE_SWIFTEN_3
|
||||
#include <Swiften/FileTransfer/DefaultLocalJingleTransportCandidateGeneratorFactory.h>
|
||||
#include <Swiften/FileTransfer/DefaultRemoteJingleTransportCandidateSelectorFactory.h>
|
||||
#else
|
||||
#include <Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.h>
|
||||
#include <Swiften/FileTransfer/SOCKS5BytestreamServerManager.h>
|
||||
#endif
|
||||
#include <Swiften/FileTransfer/SOCKS5BytestreamRegistry.h>
|
||||
#include <Swiften/FileTransfer/SOCKS5BytestreamServer.h>
|
||||
#if !HAVE_SWIFTEN_3
|
||||
|
||||
|
||||
#if HAVE_SWIFTEN_3
|
||||
#include <Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.h>
|
||||
#include <Swiften/FileTransfer/SOCKS5BytestreamServerManager.h>
|
||||
#else
|
||||
#include <Swiften/FileTransfer/ConnectivityManager.h>
|
||||
#include <Swiften/FileTransfer/DefaultLocalJingleTransportCandidateGeneratorFactory.h>
|
||||
#include <Swiften/FileTransfer/DefaultRemoteJingleTransportCandidateSelectorFactory.h>
|
||||
#include <Swiften/FileTransfer/SOCKS5BytestreamProxy.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include "storagebackend.h"
|
||||
#include "transport/filetransfermanager.h"
|
||||
#include <Swiften/Version.h>
|
||||
#define HAVE_SWIFTEN_3 SWIFTEN_VERSION >= 0x030000
|
||||
#define HAVE_SWIFTEN_3 (SWIFTEN_VERSION >= 0x030000)
|
||||
|
||||
namespace Transport {
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "transport/adhoccommand.h"
|
||||
#include "transport/adhoccommandfactory.h"
|
||||
#include <Swiften/Version.h>
|
||||
#define HAVE_SWIFTEN_3 SWIFTEN_VERSION >= 0x030000
|
||||
#define HAVE_SWIFTEN_3 (SWIFTEN_VERSION >= 0x030000)
|
||||
|
||||
|
||||
namespace Transport {
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "Swiften/Elements/RosterPayload.h"
|
||||
#include <boost/signal.hpp>
|
||||
#include <Swiften/Version.h>
|
||||
#define HAVE_SWIFTEN_3 SWIFTEN_VERSION >= 0x030000
|
||||
#define HAVE_SWIFTEN_3 (SWIFTEN_VERSION >= 0x030000)
|
||||
|
||||
namespace Transport {
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "Swiften/Elements/DiscoInfo.h"
|
||||
#include "Swiften/Elements/CapsInfo.h"
|
||||
#include <Swiften/Version.h>
|
||||
#define HAVE_SWIFTEN_3 SWIFTEN_VERSION >= 0x030000
|
||||
#define HAVE_SWIFTEN_3 (SWIFTEN_VERSION >= 0x030000)
|
||||
#if HAVE_SWIFTEN_3
|
||||
#include <Swiften/Crypto/CryptoProvider.h>
|
||||
#include <Swiften/Crypto/PlatformCryptoProvider.h>
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include "Swiften/Server/ServerStanzaChannel.h"
|
||||
#include "Swiften/Server/ServerFromClientSession.h"
|
||||
#include "Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h"
|
||||
#define HAVE_SWIFTEN_3 SWIFTEN_VERSION >= 0x030000
|
||||
#define HAVE_SWIFTEN_3 (SWIFTEN_VERSION >= 0x030000)
|
||||
|
||||
using namespace Transport;
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "Swiften/Server/ServerStanzaChannel.h"
|
||||
#include "Swiften/Server/ServerFromClientSession.h"
|
||||
#include "Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h"
|
||||
#include "Swiften/Version.h"
|
||||
#include "basictest.h"
|
||||
|
||||
using namespace Transport;
|
||||
|
@ -147,7 +148,11 @@ class SettingsAdHocCommandTest : public CPPUNIT_NS :: TestFixture, public BasicT
|
|||
|
||||
// set enabled_transport = 0
|
||||
Swift::FormField::ref f = getStanza(received[0])->getPayload<Swift:: Command>()->getForm()->getField("enable_transport");
|
||||
#if (SWIFTEN_VERSION >= 0x030000)
|
||||
f->setBoolValue(false);
|
||||
#else
|
||||
boost::dynamic_pointer_cast<Swift::BooleanFormField>(f)->setValue(false);
|
||||
#endif
|
||||
|
||||
std::string sessionId = getStanza(received[0])->getPayload<Swift::Command>()->getSessionID();
|
||||
|
||||
|
@ -207,7 +212,11 @@ class SettingsAdHocCommandTest : public CPPUNIT_NS :: TestFixture, public BasicT
|
|||
|
||||
// set enabled_transport = 0
|
||||
f = getStanza(received[0])->getPayload<Swift:: Command>()->getForm()->getField("enable_transport");
|
||||
#if (SWIFTEN_VERSION >= 0x030000)
|
||||
CPPUNIT_ASSERT_EQUAL(false, f->getBoolValue());
|
||||
#else
|
||||
CPPUNIT_ASSERT_EQUAL(false, boost::dynamic_pointer_cast<Swift::BooleanFormField>(f)->getValue());
|
||||
#endif
|
||||
}
|
||||
|
||||
void executeTwoCommands() {
|
||||
|
@ -355,7 +364,11 @@ class SettingsAdHocCommandTest : public CPPUNIT_NS :: TestFixture, public BasicT
|
|||
|
||||
// set enabled_transport = 0
|
||||
Swift::FormField::ref f = getStanza(received[0])->getPayload<Swift:: Command>()->getForm()->getField("send_headlines");
|
||||
#if (SWIFTEN_VERSION >= 0x030000)
|
||||
f->setBoolValue(true);
|
||||
#else
|
||||
boost::dynamic_pointer_cast<Swift::BooleanFormField>(f)->setValue(true);
|
||||
#endif
|
||||
|
||||
std::string sessionId = getStanza(received[0])->getPayload<Swift::Command>()->getSessionID();
|
||||
|
||||
|
@ -397,7 +410,11 @@ class SettingsAdHocCommandTest : public CPPUNIT_NS :: TestFixture, public BasicT
|
|||
CPPUNIT_ASSERT(getStanza(received[0])->getPayload<Swift::Command>()->getForm());
|
||||
CPPUNIT_ASSERT(getStanza(received[0])->getPayload<Swift::Command>()->getForm()->getField("send_headlines"));
|
||||
Swift::FormField::ref f = getStanza(received[0])->getPayload<Swift:: Command>()->getForm()->getField("send_headlines");
|
||||
#if (SWIFTEN_VERSION >= 0x030000)
|
||||
CPPUNIT_ASSERT_EQUAL(true, f->getBoolValue());
|
||||
#else
|
||||
CPPUNIT_ASSERT_EQUAL(true, boost::dynamic_pointer_cast<Swift::BooleanFormField>(f)->getValue());
|
||||
#endif
|
||||
}
|
||||
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue