Swiften 4.0rc2 compatibility
This commit is contained in:
parent
c6468d0400
commit
6b45e0e418
18 changed files with 32 additions and 28 deletions
|
@ -156,7 +156,7 @@ class FrotzNetworkPlugin : public NetworkPlugin {
|
|||
m_factories = new Swift::BoostNetworkFactories(loop);
|
||||
m_conn = m_factories->getConnectionFactory()->createConnection();
|
||||
m_conn->onDataRead.connect(boost::bind(&FrotzNetworkPlugin::_handleDataRead, this, _1));
|
||||
m_conn->connect(Swift::HostAddressPort(Swift::HostAddress(host), port));
|
||||
m_conn->connect(Swift::HostAddressPort(SWIFT_HOSTADDRESS(host), port));
|
||||
// m_conn->onConnectFinished.connect(boost::bind(&FrotzNetworkPlugin::_handleConnected, this, _1));
|
||||
// m_conn->onDisconnected.connect(boost::bind(&FrotzNetworkPlugin::handleDisconnected, this));
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ class SMSNetworkPlugin : public NetworkPlugin {
|
|||
m_factories = new Swift::BoostNetworkFactories(loop);
|
||||
m_conn = m_factories->getConnectionFactory()->createConnection();
|
||||
m_conn->onDataRead.connect(boost::bind(&SMSNetworkPlugin::_handleDataRead, this, _1));
|
||||
m_conn->connect(Swift::HostAddressPort(Swift::HostAddress(host), port));
|
||||
m_conn->connect(Swift::HostAddressPort(SWIFT_HOSTADDRESS(host), port));
|
||||
// m_conn->onConnectFinished.connect(boost::bind(&FrotzNetworkPlugin::_handleConnected, this, _1));
|
||||
// m_conn->onDisconnected.connect(boost::bind(&FrotzNetworkPlugin::handleDisconnected, this));
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ class SwiftenPlugin : public NetworkPlugin, Swift::XMPPParserClient {
|
|||
m_factories = new Swift::BoostNetworkFactories(loop);
|
||||
m_conn = m_factories->getConnectionFactory()->createConnection();
|
||||
m_conn->onDataRead.connect(boost::bind(&SwiftenPlugin::_handleDataRead, this, _1));
|
||||
m_conn->connect(Swift::HostAddressPort(Swift::HostAddress(host), port));
|
||||
m_conn->connect(Swift::HostAddressPort(SWIFT_HOSTADDRESS(host), port));
|
||||
#if HAVE_SWIFTEN_3
|
||||
serializer = new Swift::XMPPSerializer(&collection, Swift::ClientStreamType, false);
|
||||
#else
|
||||
|
|
|
@ -20,7 +20,7 @@ Plugin::Plugin(Config *config, Swift::SimpleEventLoop *loop, const std::string &
|
|||
m_factories = new Swift::BoostNetworkFactories(loop);
|
||||
m_conn = m_factories->getConnectionFactory()->createConnection();
|
||||
m_conn->onDataRead.connect(boost::bind(&Plugin::_handleDataRead, this, _1));
|
||||
m_conn->connect(Swift::HostAddressPort(Swift::HostAddress(host), port));
|
||||
m_conn->connect(Swift::HostAddressPort(SWIFT_HOSTADDRESS(host), port));
|
||||
|
||||
LOG4CXX_INFO(logger, "Starting the plugin.");
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ TwitterPlugin::TwitterPlugin(Config *config, Swift::SimpleEventLoop *loop, Stora
|
|||
m_factories = new Swift::BoostNetworkFactories(loop);
|
||||
m_conn = m_factories->getConnectionFactory()->createConnection();
|
||||
m_conn->onDataRead.connect(boost::bind(&TwitterPlugin::_handleDataRead, this, _1));
|
||||
m_conn->connect(Swift::HostAddressPort(Swift::HostAddress(host), port));
|
||||
m_conn->connect(Swift::HostAddressPort(SWIFT_HOSTADDRESS(host), port));
|
||||
|
||||
tp = new ThreadPool(loop_, 10);
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "CombinedOutgoingFileTransferManager.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/smart_ptr/make_shared.hpp>
|
||||
|
||||
#include <Swiften/JID/JID.h>
|
||||
|
@ -18,7 +19,6 @@
|
|||
#include <Swiften/FileTransfer/SOCKS5BytestreamServer.h>
|
||||
#include <Swiften/Base/IDGenerator.h>
|
||||
#include <Swiften/Elements/Presence.h>
|
||||
#include <Swiften/Base/foreach.h>
|
||||
|
||||
|
||||
namespace Swift {
|
||||
|
@ -68,7 +68,7 @@ boost::optional<JID> CombinedOutgoingFileTransferManager::highestPriorityJIDSupp
|
|||
std::vector<Presence::ref> presences = presenceOracle->getAllPresence(bareJID);
|
||||
|
||||
//iterate over them
|
||||
foreach(Presence::ref pres, presences) {
|
||||
BOOST_FOREACH(Presence::ref pres, presences) {
|
||||
if (pres->getPriority() > priority) {
|
||||
// look up caps from the jid
|
||||
DiscoInfo::ref info = capsProvider->getCaps(pres->getFrom());
|
||||
|
@ -92,7 +92,7 @@ boost::optional<JID> CombinedOutgoingFileTransferManager::highestPriorityJIDSupp
|
|||
std::vector<Presence::ref> presences = presenceOracle->getAllPresence(bareJID);
|
||||
|
||||
//iterate over them
|
||||
foreach(Presence::ref pres, presences) {
|
||||
BOOST_FOREACH(Presence::ref pres, presences) {
|
||||
if (pres->getPriority() > priority) {
|
||||
// look up caps from the jid
|
||||
DiscoInfo::ref info = capsProvider->getCaps(pres->getFrom());
|
||||
|
|
|
@ -6,18 +6,18 @@
|
|||
|
||||
#include <Swiften/Parser/PayloadParsers/GatewayPayloadParser.h>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <Swiften/Parser/PayloadParserFactoryCollection.h>
|
||||
#include <Swiften/Parser/PayloadParserFactory.h>
|
||||
#include <Swiften/Base/foreach.h>
|
||||
#include <Swiften/Elements/MUCOccupant.h>
|
||||
#include <Swiften/Parser/Tree/TreeReparser.h>
|
||||
|
||||
namespace Swift {
|
||||
|
||||
void GatewayPayloadParser::handleTree(ParserElement::ref root) {
|
||||
foreach (ParserElement::ref child, root->getAllChildren()) {
|
||||
BOOST_FOREACH (ParserElement::ref child, root->getAllChildren()) {
|
||||
if (child->getName() == "desc") {
|
||||
getPayloadInternal()->setDesc(child->getText());
|
||||
}
|
||||
|
|
|
@ -6,18 +6,18 @@
|
|||
|
||||
#include <Swiften/Parser/PayloadParsers/MUCPayloadParser.h>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <Swiften/Parser/PayloadParserFactoryCollection.h>
|
||||
#include <Swiften/Parser/PayloadParserFactory.h>
|
||||
#include <Swiften/Base/foreach.h>
|
||||
#include <Swiften/Elements/MUCOccupant.h>
|
||||
#include <Swiften/Parser/Tree/TreeReparser.h>
|
||||
|
||||
namespace Swift {
|
||||
|
||||
void MUCPayloadParser::handleTree(ParserElement::ref root) {
|
||||
foreach (ParserElement::ref child, root->getAllChildren()) {
|
||||
BOOST_FOREACH (ParserElement::ref child, root->getAllChildren()) {
|
||||
if (child->getName() == "password" && child->getNamespace() == root->getNamespace()) {
|
||||
getPayloadInternal()->setPassword(child->getText());
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <Swiften/Parser/PlatformXMLParserFactory.h>
|
||||
#include <Swiften/Parser/Tree/ParserElement.h>
|
||||
#include <Swiften/Parser/XMLParser.h>
|
||||
#include <Swiften/Version.h>
|
||||
|
||||
namespace Swift {
|
||||
|
||||
|
@ -28,11 +29,17 @@ class DefaultStringTreeParser : public StringTreeParser {
|
|||
ParserElement::ref StringTreeParser::parse(const std::string &xml) {
|
||||
PlatformXMLParserFactory factory;
|
||||
DefaultStringTreeParser client;
|
||||
#if (SWIFTEN_VERSION >= 0x040000)
|
||||
std::unique_ptr<XMLParser> parser = factory.createXMLParser(&client);
|
||||
#else
|
||||
XMLParser *parser = factory.createXMLParser(&client);
|
||||
#endif
|
||||
|
||||
parser->parse(xml);
|
||||
ParserElement::ref root = client.getRoot();
|
||||
#if (SWIFTEN_VERSION < 0x040000)
|
||||
delete parser;
|
||||
#endif
|
||||
return root;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
|
||||
#include <Swiften/Serializer/PayloadSerializers/GatewayPayloadSerializer.h>
|
||||
#include <Swiften/Base/foreach.h>
|
||||
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
|
||||
#include <Swiften/Serializer/XML/XMLTextNode.h>
|
||||
#include <Swiften/Serializer/XML/XMLElement.h>
|
||||
|
|
|
@ -6,12 +6,10 @@
|
|||
|
||||
#include <Swiften/Serializer/PayloadSerializers/SpectrumErrorSerializer.h>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <Swiften/Base/foreach.h>
|
||||
#include <Swiften/Serializer/XML/XMLTextNode.h>
|
||||
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
|
||||
#include <Swiften/Serializer/XML/XMLElement.h>
|
||||
#include "Swiften/SwiftenCompat.h"
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
namespace Swift {
|
||||
|
|
|
@ -4,11 +4,10 @@
|
|||
* See Documentation/Licenses/BSD-simplified.txt for more information.
|
||||
*/
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <Swiften/Serializer/PayloadSerializers/StatsSerializer.h>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <Swiften/Base/foreach.h>
|
||||
#include <Swiften/Serializer/XML/XMLTextNode.h>
|
||||
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
|
||||
#include <Swiften/Serializer/XML/XMLElement.h>
|
||||
|
@ -22,7 +21,7 @@ StatsSerializer::StatsSerializer() : GenericPayloadSerializer<StatsPayload>() {
|
|||
|
||||
std::string StatsSerializer::serializePayload(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<StatsPayload> stats) const {
|
||||
XMLElement queryElement("query", "http://jabber.org/protocol/stats");
|
||||
foreach(const StatsPayload::Item& item, stats->getItems()) {
|
||||
BOOST_FOREACH(const StatsPayload::Item& item, stats->getItems()) {
|
||||
SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<XMLElement> statElement(new XMLElement("stat"));
|
||||
statElement->setAttribute("name", item.getName());
|
||||
if (!item.getUnits().empty()) {
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
|
||||
#include <Swiften/Serializer/PayloadSerializers/XHTMLIMSerializer.h>
|
||||
#include <Swiften/Base/foreach.h>
|
||||
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
|
||||
#include <Swiften/Serializer/XML/XMLTextNode.h>
|
||||
#include <Swiften/Serializer/XML/XMLElement.h>
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
|
||||
#include <string>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/signal.hpp>
|
||||
|
||||
#include "Swiften/Base/String.h"
|
||||
#include "Swiften/Base/foreach.h"
|
||||
#include "Swiften/Network/Connection.h"
|
||||
#include "Swiften/Network/ConnectionServer.h"
|
||||
#include "Swiften/Network/ConnectionServerFactory.h"
|
||||
|
@ -70,7 +70,7 @@ void Server::start() {
|
|||
serverFromClientConnectionServer = networkFactories_->getConnectionServerFactory()->createConnectionServer(port_);
|
||||
}
|
||||
else {
|
||||
serverFromClientConnectionServer = networkFactories_->getConnectionServerFactory()->createConnectionServer(Swift::HostAddress(address_), port_);
|
||||
serverFromClientConnectionServer = networkFactories_->getConnectionServerFactory()->createConnectionServer(SWIFT_HOSTADDRESS(address_), port_);
|
||||
}
|
||||
serverFromClientConnectionServerSignalConnections.push_back(
|
||||
serverFromClientConnectionServer->onNewConnection.connect(
|
||||
|
@ -96,7 +96,7 @@ void Server::stop() {
|
|||
|
||||
if (serverFromClientConnectionServer) {
|
||||
serverFromClientConnectionServer->stop();
|
||||
foreach(SWIFTEN_SIGNAL_NAMESPACE::connection& connection, serverFromClientConnectionServerSignalConnections) {
|
||||
BOOST_FOREACH(SWIFTEN_SIGNAL_NAMESPACE::connection& connection, serverFromClientConnectionServerSignalConnections) {
|
||||
connection.disconnect();
|
||||
}
|
||||
serverFromClientConnectionServerSignalConnections.clear();
|
||||
|
|
|
@ -38,7 +38,9 @@
|
|||
#if (SWIFTEN_VERSION >= 0x040000)
|
||||
#define SWIFTEN_SHRPTR_NAMESPACE std
|
||||
#define SWIFTEN_SIGNAL_NAMESPACE boost::signals2
|
||||
#define SWIFT_HOSTADDRESS(x) *(Swift::HostAddress::fromString(x))
|
||||
#else
|
||||
#define SWIFTEN_SHRPTR_NAMESPACE boost
|
||||
#define SWIFTEN_SIGNAL_NAMESPACE boost::signals
|
||||
#define SWIFT_HOSTADDRESS(x) Swift::HostAddress(x)
|
||||
#endif
|
||||
|
|
|
@ -73,7 +73,7 @@ bool Config::load(std::istream &ifs, boost::program_options::options_description
|
|||
m_unregistered.clear();
|
||||
opts.add_options()
|
||||
("service.jid", value<std::string>()->default_value(""), "Transport Jabber ID")
|
||||
("service.server", value<std::string>()->default_value(""), "Server to connect to")
|
||||
("service.server", value<std::string>()->default_value("127.0.0.1"), "Server to connect to")
|
||||
("service.password", value<std::string>()->default_value(""), "Password used to auth the server")
|
||||
("service.port", value<int>()->default_value(0), "Port the server is listening on")
|
||||
("service.user", value<std::string>()->default_value(""), "The name of user Spectrum runs as.")
|
||||
|
@ -86,7 +86,7 @@ bool Config::load(std::istream &ifs, boost::program_options::options_description
|
|||
("service.allowed_servers", value<std::vector<std::string> >()->multitoken(), "Only users from these servers can connect")
|
||||
("service.server_mode", value<bool>()->default_value(false), "True if Spectrum should behave as server")
|
||||
("service.users_per_backend", value<int>()->default_value(100), "Number of users per one legacy network backend")
|
||||
("service.backend_host", value<std::string>()->default_value("localhost"), "Host to bind backend server to")
|
||||
("service.backend_host", value<std::string>()->default_value("127.0.0.1"), "Host to bind backend server to")
|
||||
("service.backend_port", value<std::string>()->default_value("0"), "Port to bind backend server to")
|
||||
("service.cert", value<std::string>()->default_value(""), "PKCS#12 Certificate.")
|
||||
("service.cert_password", value<std::string>()->default_value(""), "PKCS#12 Certificate password.")
|
||||
|
|
|
@ -306,7 +306,7 @@ NetworkPluginServer::NetworkPluginServer(Component *component, Config *config, U
|
|||
// // m_blockResponder->onBlockToggled.connect(boost::bind(&NetworkPluginServer::handleBlockToggled, this, _1));
|
||||
// // m_blockResponder->start();
|
||||
|
||||
m_server = component->getNetworkFactories()->getConnectionServerFactory()->createConnectionServer(Swift::HostAddress(CONFIG_STRING(m_config, "service.backend_host")), boost::lexical_cast<int>(CONFIG_STRING(m_config, "service.backend_port")));
|
||||
m_server = component->getNetworkFactories()->getConnectionServerFactory()->createConnectionServer(SWIFT_HOSTADDRESS(CONFIG_STRING_DEFAULTED(m_config, "service.backend_host", "127.0.0.1")), boost::lexical_cast<int>(CONFIG_STRING(m_config, "service.backend_port")));
|
||||
m_server->onNewConnection.connect(boost::bind(&NetworkPluginServer::handleNewClientConnection, this, _1));
|
||||
}
|
||||
|
||||
|
|
|
@ -591,7 +591,7 @@ void ask_local_server(ManagerConfig *config, Swift::BoostNetworkFactories &netwo
|
|||
m_conn = networkFactories.getConnectionFactory()->createConnection();
|
||||
m_conn->onDataRead.connect(boost::bind(&handleDataRead, m_conn, _1));
|
||||
m_conn->onConnectFinished.connect(boost::bind(&handleConnected, m_conn, message, _1));
|
||||
m_conn->connect(Swift::HostAddressPort(Swift::HostAddress(CONFIG_STRING(&cfg, "service.backend_host")), getPort(CONFIG_STRING(&cfg, "service.portfile"))));
|
||||
m_conn->connect(Swift::HostAddressPort(SWIFT_HOSTADDRESS(CONFIG_STRING_DEFAULTED(&cfg, "service.backend_host", "127.0.0.1")), getPort(CONFIG_STRING(&cfg, "service.portfile"))));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue