diff --git a/src/transport.cpp b/src/transport.cpp index a98f101ac9e4e3aaf633fa0c3457321869a369df..18fc4830f0bc8a68073b7e1b66d43a28727d1c86 100644 --- a/src/transport.cpp +++ b/src/transport.cpp @@ -52,6 +52,9 @@ #include "Swiften/Parser/PayloadParsers/InvisibleParser.h" #include "Swiften/Serializer/PayloadSerializers/InvisibleSerializer.h" #include "Swiften/Parser/GenericPayloadParserFactory.h" +#include "Swiften/Queries/IQRouter.h" +#include "Swiften/Elements/RosterPayload.h" +#include "Swiften/Elements/InBandRegistrationPayload.h" using namespace Swift; using namespace boost; @@ -67,9 +70,11 @@ Component::Component(Swift::EventLoop *loop, Swift::NetworkFactories *factories, m_server = NULL; m_reconnectCount = 0; m_config = config; + m_config->onBackendConfigUpdated.connect(boost::bind(&Component::handleBackendConfigChanged, this)); m_factory = factory; m_loop = loop; m_userRegistry = userRegistry; + m_rawXML = false; m_jid = Swift::JID(CONFIG_STRING(m_config, "service.jid")); @@ -177,6 +182,30 @@ Component::~Component() { } } +bool Component::handleIQ(boost::shared_ptr iq) { + if (!m_rawXML) { + return false; + } + + if (iq->getPayload() != NULL) { return false; } + if (iq->getPayload() != NULL) { return false; } + if (iq->getPayload() != NULL) { return false; } + + if (iq->getTo().getNode().empty()) { + return false; + } + + onRawIQReceived(iq); + return true; +} + +void Component::handleBackendConfigChanged() { + if (!m_rawXML && CONFIG_BOOL_DEFAULTED(m_config, "features.rawxml", false)) { + m_rawXML = true; + m_iqRouter->addHandler(this); + } +} + Swift::StanzaChannel *Component::getStanzaChannel() { return m_stanzaChannel; }