Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
4268eb2b
Commit
4268eb2b
authored
4 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
nodejs: add missing method
Change-Id: Id5fd5d03bbc809ce0dfd9e318e4e2534838c1651
parent
b3877e77
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/nodejs/callback.h
+19
-0
19 additions, 0 deletions
bin/nodejs/callback.h
bin/nodejs/nodejs_interface.i
+1
-0
1 addition, 0 deletions
bin/nodejs/nodejs_interface.i
with
20 additions
and
0 deletions
bin/nodejs/callback.h
+
19
−
0
View file @
4268eb2b
...
...
@@ -11,6 +11,7 @@
using
namespace
v8
;
Persistent
<
Function
>
accountsChangedCb
;
Persistent
<
Function
>
accountDetailsChangedCb
;
Persistent
<
Function
>
registrationStateChangedCb
;
Persistent
<
Function
>
volatileDetailsChangedCb
;
Persistent
<
Function
>
incomingAccountMessageCb
;
...
...
@@ -34,6 +35,8 @@ uv_async_t signalAsync;
Persistent
<
Function
>*
getPresistentCb
(
const
std
::
string
&
signal
)
{
if
(
signal
==
"AccountsChanged"
)
return
&
accountsChangedCb
;
else
if
(
signal
==
"AccountDetailsChanged"
)
return
&
accountDetailsChangedCb
;
else
if
(
signal
==
"RegistrationStateChanged"
)
return
&
registrationStateChangedCb
;
else
if
(
signal
==
"VolatileDetailsChanged"
)
...
...
@@ -142,6 +145,22 @@ void volatileDetailsChanged(const std::string& account_id, const std::map<std::s
uv_async_send
(
&
signalAsync
);
}
void
accountDetailsChanged
(
const
std
::
string
&
accountId
,
const
std
::
map
<
std
::
string
,
std
::
string
>&
details
)
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
pendingSignalsLock
);
pendingSignals
.
emplace
([
accountId
,
details
]()
{
Local
<
Function
>
func
=
Local
<
Function
>::
New
(
Isolate
::
GetCurrent
(),
accountDetailsChangedCb
);
if
(
!
func
.
IsEmpty
())
{
Local
<
Object
>
jsDetails
=
SWIGV8_OBJECT_NEW
();
stringMapToJsMap
(
payloads
,
jsDetails
);
Local
<
Value
>
callback_args
[]
=
{
V8_STRING_NEW_LOCAL
(
accountId
),
jsDetails
};
func
->
Call
(
SWIGV8_CURRENT_CONTEXT
(),
SWIGV8_NULL
(),
2
,
callback_args
);
}
});
uv_async_send
(
&
signalAsync
);
}
void
accountsChanged
()
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
pendingSignalsLock
);
...
...
This diff is collapsed.
Click to expand it.
bin/nodejs/nodejs_interface.i
+
1
−
0
View file @
4268eb2b
...
...
@@ -125,6 +125,7 @@ void init(const SWIGV8_VALUE& funcMap){
const std::map<std::string, SharedCallback> configEvHandlers = {
exportable_callback<ConfigurationSignal::AccountsChanged>(bind(&accountsChanged)),
exportable_callback<ConfigurationSignal::AccountDetailsChanged>(bind(&accountDetailsChanged, _1, _2)),
exportable_callback<ConfigurationSignal::RegistrationStateChanged>(bind(®istrationStateChanged, _1, _2, _3, _4)),
exportable_callback<ConfigurationSignal::ContactAdded>(bind(&contactAdded, _1, _2, _3 )),
exportable_callback<ConfigurationSignal::ContactRemoved>(bind(&contactRemoved, _1, _2, _3 )),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment