swiften: patch for boost 1.83.0

This commit is contained in:
Đoàn Trần Công Danh 2023-08-24 09:32:25 +07:00
parent ea0160e03d
commit 4b58e20844

View File

@ -0,0 +1,42 @@
--- 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_;
}