43 lines
1.9 KiB
Diff
43 lines
1.9 KiB
Diff
--- a/Swiften/Component/CoreComponent.cpp
|
|
+++ b/Swiften/Component/CoreComponent.cpp
|
|
@@ -19,12 +19,26 @@
|
|
#include <Swiften/TLS/PKCS12Certificate.h>
|
|
#include <Swiften/TLS/TLSOptions.h>
|
|
|
|
+
|
|
namespace Swift {
|
|
|
|
+namespace {
|
|
+
|
|
+void CoreComponent_onMessageReceived(CoreComponent *self, std::shared_ptr<Message> msg)
|
|
+{
|
|
+ self->onMessageReceived(msg);
|
|
+}
|
|
+
|
|
+void CoreComponent_onPresenceReceived(CoreComponent *self, std::shared_ptr<Presence> p)
|
|
+{
|
|
+ self->onPresenceReceived(p);
|
|
+}
|
|
+}
|
|
+
|
|
CoreComponent::CoreComponent(const JID& jid, const std::string& secret, NetworkFactories* networkFactories) : networkFactories(networkFactories), jid_(jid), secret_(secret), disconnectRequested_(false) {
|
|
stanzaChannel_ = new ComponentSessionStanzaChannel();
|
|
- stanzaChannel_->onMessageReceived.connect(boost::ref(onMessageReceived));
|
|
- stanzaChannel_->onPresenceReceived.connect(boost::ref(onPresenceReceived));
|
|
+ stanzaChannel_->onMessageReceived.connect(boost::bind(&CoreComponent_onMessageReceived, this, _1));
|
|
+ stanzaChannel_->onPresenceReceived.connect(boost::bind(&CoreComponent_onPresenceReceived, this, _1));
|
|
stanzaChannel_->onAvailableChanged.connect(boost::bind(&CoreComponent::handleStanzaChannelAvailableChanged, this, _1));
|
|
|
|
iqRouter_ = new IQRouter(stanzaChannel_);
|
|
@@ -38,8 +52,8 @@ CoreComponent::~CoreComponent() {
|
|
delete iqRouter_;
|
|
|
|
stanzaChannel_->onAvailableChanged.disconnect(boost::bind(&CoreComponent::handleStanzaChannelAvailableChanged, this, _1));
|
|
- stanzaChannel_->onMessageReceived.disconnect(boost::ref(onMessageReceived));
|
|
- stanzaChannel_->onPresenceReceived.disconnect(boost::ref(onPresenceReceived));
|
|
+ stanzaChannel_->onMessageReceived.disconnect(boost::bind(&CoreComponent_onMessageReceived, this, _1));
|
|
+ stanzaChannel_->onPresenceReceived.disconnect(boost::bind(&CoreComponent_onPresenceReceived, this, _1));
|
|
delete stanzaChannel_;
|
|
}
|
|
|