From f05ebe11aab27012380d635a3fb0d284f601fa99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Wed, 31 Mar 2021 16:31:52 -0400 Subject: [PATCH] nodejs: fix build with Node v12, latest SWIG Change-Id: Iab028848b637ea8031621d2f5567a1bb01d2bf79 --- bin/nodejs/Makefile.am | 2 +- bin/nodejs/callback.h | 4 ++-- bin/nodejs/callmanager.i | 2 +- bin/nodejs/configurationmanager.i | 4 +--- bin/nodejs/meson.build | 2 +- bin/nodejs/nodejs_interface.i | 26 -------------------------- bin/nodejs/videomanager.i | 7 ------- 7 files changed, 6 insertions(+), 41 deletions(-) diff --git a/bin/nodejs/Makefile.am b/bin/nodejs/Makefile.am index 6d91b7cd76..5923b9f215 100644 --- a/bin/nodejs/Makefile.am +++ b/bin/nodejs/Makefile.am @@ -9,7 +9,7 @@ ring_wrapper.cpp: nodejs_interface.i configurationmanager.i managerimpl.i $(SWIG) -v -c++ -javascript -node -o ring_wrapper.cpp nodejs_interface.i build/Makefile: ring_wrapper.cpp binding.gyp - node-gyp configure --target=1.6.2 --arch=x64 --dist-url=https://atom.io/download/electron + node-gyp configure --target=1.6.2 --arch=x64 build/Release/obj.target/dring.node: build/Makefile ring_wrapper.cpp callback.h node-gyp build diff --git a/bin/nodejs/callback.h b/bin/nodejs/callback.h index 1cfb238505..b74390471a 100755 --- a/bin/nodejs/callback.h +++ b/bin/nodejs/callback.h @@ -235,7 +235,7 @@ void accountMessageStatusChanged(const std::string& account_id, uint64_t message uv_async_send(&signalAsync); } -void incomingAccountMessage(const std::string& account_id, const std::string& from, const std::map<std::string, std::string>& payloads) { +void incomingAccountMessage(const std::string& account_id, const std::string& messageId, const std::string& from, const std::map<std::string, std::string>& payloads) { std::lock_guard<std::mutex> lock(pendingSignalsLock); pendingSignals.emplace([account_id, from, payloads]() { @@ -274,7 +274,7 @@ void incomingTrustRequest(const std::string& account_id, const std::string& from pendingSignals.emplace([account_id, from, payload, received]() { Local<Function> func = Local<Function>::New(Isolate::GetCurrent(), incomingTrustRequestCb); if (!func.IsEmpty()) { - Local<Array> jsArray = SWIGV8_ARRAY_NEW(); + Local<Array> jsArray = SWIGV8_ARRAY_NEW(payload.size()); intVectToJsArray(payload, jsArray); Local<Value> callback_args[] = {V8_STRING_NEW(account_id), V8_STRING_NEW(from), jsArray, SWIGV8_NUMBER_NEW(received)}; func->Call(SWIGV8_CURRENT_CONTEXT()->Global(), 4, callback_args); diff --git a/bin/nodejs/callmanager.i b/bin/nodejs/callmanager.i index b51b4e8543..dbcd364b5d 100644 --- a/bin/nodejs/callmanager.i +++ b/bin/nodejs/callmanager.i @@ -96,7 +96,7 @@ void hangupParticipant(const std::string& confId, const std::string& peerId); /* File Playback methods */ bool startRecordedFilePlayback(const std::string& filepath); -void stopRecordedFilePlayback(const std::string& filepath); +void stopRecordedFilePlayback(); /* General audio methods */ bool toggleRecording(const std::string& callID); diff --git a/bin/nodejs/configurationmanager.i b/bin/nodejs/configurationmanager.i index 6eef9ceef2..596dfd7d77 100644 --- a/bin/nodejs/configurationmanager.i +++ b/bin/nodejs/configurationmanager.i @@ -34,7 +34,6 @@ public: virtual void volatileAccountDetailsChanged(const std::string& account_id, const std::map<std::string, std::string>& details){} virtual void incomingAccountMessage(const std::string& /*account_id*/, const std::string& /*from*/, const std::map<std::string, std::string>& /*payload*/){} virtual void accountMessageStatusChanged(const std::string& /*account_id*/, uint64_t /*message_id*/, const std::string& /*to*/, int /*state*/){} - virtual void profileReceived(const std::string& /*account_id*/, const std::string& /*from*/, const std::string& /*path*/){} virtual void knownDevicesChanged(const std::string& /*account_id*/, const std::map<std::string, std::string>& /*devices*/){} virtual void exportOnRingEnded(const std::string& /*account_id*/, int /*state*/, const std::string& /*pin*/){} @@ -59,9 +58,9 @@ public: virtual void hardwareDecodingChanged(bool /*state*/){} virtual void hardwareEncodingChanged(bool /*state*/){} -}; virtual void audioMeter(const std::string& /*id*/, float /*level*/){} +}; %} %feature("director") ConfigurationCallback; @@ -234,7 +233,6 @@ public: virtual void volatileAccountDetailsChanged(const std::string& account_id, const std::map<std::string, std::string>& details){} virtual void incomingAccountMessage(const std::string& /*account_id*/, const std::string& /*from*/, const std::map<std::string, std::string>& /*payload*/){} virtual void accountMessageStatusChanged(const std::string& /*account_id*/, uint64_t /*message_id*/, const std::string& /*to*/, int /*state*/){} - virtual void profileReceived(const std::string& /*account_id*/, const std::string& /*from*/, const std::string& /*path*/){} virtual void knownDevicesChanged(const std::string& /*account_id*/, const std::map<std::string, std::string>& /*devices*/){} virtual void exportOnRingEnded(const std::string& /*account_id*/, int /*state*/, const std::string& /*pin*/){} diff --git a/bin/nodejs/meson.build b/bin/nodejs/meson.build index 606b5f2ae2..df48ccec4b 100644 --- a/bin/nodejs/meson.build +++ b/bin/nodejs/meson.build @@ -5,7 +5,7 @@ nodejs_wrapper_target = custom_target('nodejs.wrapper', ) nodejs_makefile_target = custom_target('nodejs.makefile', - command: [prognodegyp, 'configure', '--target=1.6.2', '--arch=x64', '--dist-url=https://atom.io/download/electron'], + command: [prognodegyp, 'configure', '--target=1.6.2', '--arch=x64'], output: 'build/Makefile', depends: nodejs_wrapper_target ) diff --git a/bin/nodejs/nodejs_interface.i b/bin/nodejs/nodejs_interface.i index b207d053a0..3915d19ca7 100644 --- a/bin/nodejs/nodejs_interface.i +++ b/bin/nodejs/nodejs_interface.i @@ -55,25 +55,7 @@ namespace std { } } %template(StringMap) map<string, string>; - - -%extend vector<string> { - value_type set(int i, const value_type& in) throw (std::out_of_range) { - const std::string old = $self->at(i); - $self->at(i) = in; - return old; - } - bool add(const value_type& in) { - $self->push_back(in); - return true; - } - int32_t size() const { - return $self->size(); - } -} %template(StringVect) vector<string>; - - %template(VectMap) vector< map<string,string> >; %template(IntegerMap) map<string,int>; %template(IntVect) vector<int32_t>; @@ -89,17 +71,12 @@ namespace std { #include <functional> %} -/* parsed by SWIG to generate all the glue */ -/* %include "../managerimpl.h" */ -/* %include <client/callmanager.h> */ - %include "managerimpl.i" %include "callmanager.i" %include "configurationmanager.i" %include "presencemanager.i" %include "callmanager.i" %include "videomanager.i" -//#include "dring/callmanager_interface.h" %header %{ #include "callback.h" @@ -134,7 +111,6 @@ void init(const v8::Handle<v8::Value> &funcMap){ const std::map<std::string, SharedCallback> callEvHandlers = { exportable_callback<CallSignal::StateChange>(bind(&callStateChanged, _1, _2, _3)), exportable_callback<CallSignal::IncomingMessage>(bind(&incomingMessage, _1, _2, _3)), - exportable_callback<CallSignal::VoiceMailNotify>(bind(&voiceMailNotify, _1, _2, _3, _4)), exportable_callback<CallSignal::IncomingCall>(bind(&incomingCall, _1, _2, _3)), }; @@ -146,12 +122,10 @@ void init(const v8::Handle<v8::Value> &funcMap){ exportable_callback<ConfigurationSignal::ExportOnRingEnded>(bind(&exportOnRingEnded, _1, _2, _3 )), exportable_callback<ConfigurationSignal::NameRegistrationEnded>(bind(&nameRegistrationEnded, _1, _2, _3 )), exportable_callback<ConfigurationSignal::RegisteredNameFound>(bind(®isteredNameFound, _1, _2, _3, _4 )), - exportable_callback<ConfigurationSignal::UserSearchEnded>(bind(&ConfigurationCallback::userSearchEnded, confM, _1, _2, _3, _4 )), exportable_callback<ConfigurationSignal::VolatileDetailsChanged>(bind(&volatileDetailsChanged, _1, _2)), exportable_callback<ConfigurationSignal::KnownDevicesChanged>(bind(&knownDevicesChanged, _1, _2 )), exportable_callback<ConfigurationSignal::IncomingAccountMessage>(bind(&incomingAccountMessage, _1, _2, _3, _4 )), exportable_callback<ConfigurationSignal::AccountMessageStatusChanged>(bind(&accountMessageStatusChanged, _1, _2, _3, _4 )), - exportable_callback<ConfigurationSignal::ProfileReceived>(bind(&profileReceived, _1, _2, _3, _4 )), exportable_callback<ConfigurationSignal::IncomingTrustRequest>(bind(&incomingTrustRequest, _1, _2, _3, _4 )), }; diff --git a/bin/nodejs/videomanager.i b/bin/nodejs/videomanager.i index 8b8f21a52f..fa5e109f1c 100644 --- a/bin/nodejs/videomanager.i +++ b/bin/nodejs/videomanager.i @@ -36,13 +36,6 @@ public: virtual void stopCapture() {} virtual void decodingStarted(const std::string& id, const std::string& shm_path, int w, int h, bool is_mixer) {} virtual void decodingStopped(const std::string& id, const std::string& shm_path, bool is_mixer) {} - virtual std::string startLocalRecorder(const bool& audioOnly, const std::string& filepath) {} - virtual void stopLocalRecorder(const std::string& filepath) {} - virtual bool getDecodingAccelerated() {} - virtual void setDecodingAccelerated(bool state) {} - virtual bool getEncodingAccelerated() {} - virtual void setEncodingAccelerated(bool state) {} - virtual void setDeviceOrientation(const std::string& name, int angle) {} }; %} -- GitLab