Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
917da92f
Commit
917da92f
authored
Dec 07, 2015
by
Sylvain Berfini
🐮
Browse files
More findClass removed in JNI layer
parent
f95eb81e
Changes
1
Hide whitespace changes
Inline
Side-by-side
coreapi/linphonecore_jni.cc
View file @
917da92f
...
...
@@ -1434,8 +1434,8 @@ extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_getDefaultProxyConfig
extern
"C"
jobjectArray
Java_org_linphone_core_LinphoneCoreImpl_getProxyConfigList
(
JNIEnv
*
env
,
jobject
thiz
,
jlong
lc
)
{
const
MSList
*
proxies
=
linphone_core_get_proxy_config_list
((
LinphoneCore
*
)
lc
);
int
proxyCount
=
ms_list_size
(
proxies
);
jclass
cls
=
(
jclass
)
env
->
NewGlobalRef
(
env
->
FindClass
(
"org/
linphone
/
core
/LinphoneProxyConfigImpl"
)
);
jobjectArray
jProxies
=
env
->
NewObjectArray
(
proxyCount
,
c
ls
,
NULL
);
LinphoneJavaBindings
*
ljb
=
(
LinphoneJavaBindings
*
)
linphone
_
core
_get_user_data
((
LinphoneCore
*
)
lc
);
jobjectArray
jProxies
=
env
->
NewObjectArray
(
proxyCount
,
l
jb
->
proxyClas
s
,
NULL
);
for
(
int
i
=
0
;
i
<
proxyCount
;
i
++
)
{
LinphoneProxyConfig
*
proxy
=
(
LinphoneProxyConfig
*
)
proxies
->
data
;
...
...
@@ -1445,7 +1445,7 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_getProxyConfigLi
}
proxies
=
proxies
->
next
;
}
env
->
DeleteGlobalRef
(
cls
);
return
jProxies
;
}
...
...
@@ -1944,8 +1944,8 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_getFriendList(JN
,
jlong
lc
)
{
const
MSList
*
friends
=
linphone_core_get_friend_list
((
LinphoneCore
*
)
lc
);
int
friendsSize
=
ms_list_size
(
friends
);
jclass
cls
=
(
jclass
)
env
->
NewGlobalRef
(
env
->
FindClass
(
"org/
linphone
/
core
/LinphoneFriendImpl"
)
);
jobjectArray
jFriends
=
env
->
NewObjectArray
(
friendsSize
,
c
ls
,
NULL
);
LinphoneJavaBindings
*
ljb
=
(
LinphoneJavaBindings
*
)
linphone
_
core
_get_user_data
((
LinphoneCore
*
)
lc
);
jobjectArray
jFriends
=
env
->
NewObjectArray
(
friendsSize
,
l
jb
->
friendClas
s
,
NULL
);
for
(
int
i
=
0
;
i
<
friendsSize
;
i
++
)
{
LinphoneFriend
*
lfriend
=
(
LinphoneFriend
*
)
friends
->
data
;
...
...
@@ -1955,8 +1955,7 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_getFriendList(JN
}
friends
=
friends
->
next
;
}
env
->
DeleteGlobalRef
(
cls
);
return
jFriends
;
}
extern
"C"
void
Java_org_linphone_core_LinphoneCoreImpl_setPresenceInfo
(
JNIEnv
*
env
...
...
@@ -3475,15 +3474,15 @@ static void message_state_changed(LinphoneChatMessage* msg, LinphoneChatMessageS
jobject
jmessage
=
getChatMessage
(
env
,
msg
);
env
->
DeleteLocalRef
(
clazz
);
jclass
chatMessageStateClass
=
(
jclass
)
env
->
FindClass
(
"org/linphone/core/LinphoneChatMessage$State"
);
jmethodID
chatMessageStateFromIntId
=
env
->
GetStaticMethodID
(
chatMessageStateClass
,
"fromInt"
,
"(I)Lorg/linphone/core/LinphoneChatMessage$State;"
);
env
->
CallVoidMethod
(
listener
,
method
,
jmessage
,
env
->
CallStaticObjectMethod
(
chatMessageStateClass
,
chatMessageStateFromIntId
,
(
jint
)
state
));
LinphoneChatRoom
*
room
=
linphone_chat_message_get_chat_room
(
msg
);
LinphoneCore
*
lc
=
linphone_chat_room_get_core
(
room
);
LinphoneJavaBindings
*
ljb
=
(
LinphoneJavaBindings
*
)
linphone_core_get_user_data
(
lc
);
env
->
CallVoidMethod
(
listener
,
method
,
jmessage
,
env
->
CallStaticObjectMethod
(
ljb
->
chatMessageStateClass
,
ljb
->
chatMessageStateFromIntId
,
(
jint
)
state
));
if
(
state
==
LinphoneChatMessageStateDelivered
||
state
==
LinphoneChatMessageStateNotDelivered
)
{
env
->
DeleteGlobalRef
(
listener
);
msg
->
message_state_changed_user_data
=
NULL
;
}
env
->
DeleteLocalRef
(
chatMessageStateClass
);
}
static
void
file_transfer_progress_indication
(
LinphoneChatMessage
*
msg
,
const
LinphoneContent
*
content
,
size_t
offset
,
size_t
total
)
{
...
...
@@ -3617,18 +3616,18 @@ static void chat_room_impl_callback(LinphoneChatMessage* msg, LinphoneChatMessag
jmethodID
method
=
env
->
GetMethodID
(
clazz
,
"onLinphoneChatMessageStateChanged"
,
"(Lorg/linphone/core/LinphoneChatMessage;Lorg/linphone/core/LinphoneChatMessage$State;)V"
);
jobject
jmessage
=
(
jobject
)
linphone_chat_message_get_user_data
(
msg
);
jclass
chatMessageStateClass
=
(
jclass
)
env
->
NewGlobalRef
(
env
->
FindClass
(
"org/linphone/core/LinphoneChatMessage$State"
));
jmethodID
chatMessageStateFromIntId
=
env
->
GetStaticMethodID
(
chatMessageStateClass
,
"fromInt"
,
"(I)Lorg/linphone/core/LinphoneChatMessage$State;"
);
LinphoneChatRoom
*
room
=
linphone_chat_message_get_chat_room
(
msg
);
LinphoneCore
*
lc
=
linphone_chat_room_get_core
(
room
);
LinphoneJavaBindings
*
ljb
=
(
LinphoneJavaBindings
*
)
linphone_core_get_user_data
(
lc
);
env
->
CallVoidMethod
(
listener
,
method
,
jmessage
,
env
->
CallStaticObjectMethod
(
chatMessageStateClass
,
chatMessageStateFromIntId
,(
jint
)
state
));
env
->
CallStaticObjectMethod
(
ljb
->
chatMessageStateClass
,
ljb
->
chatMessageStateFromIntId
,(
jint
)
state
));
if
(
state
==
LinphoneChatMessageStateDelivered
||
state
==
LinphoneChatMessageStateNotDelivered
)
{
env
->
DeleteGlobalRef
(
listener
);
env
->
DeleteGlobalRef
(
jmessage
);
env
->
DeleteGlobalRef
(
chatMessageStateClass
);
linphone_chat_message_set_user_data
(
msg
,
NULL
);
}
}
...
...
@@ -4433,6 +4432,7 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_tunnelGetServers
const
MSList
*
servers
=
linphone_tunnel_get_servers
(
tunnel
);
const
MSList
*
it
;
int
i
;
tunnelConfigArray
=
env
->
NewObjectArray
(
ms_list_size
(
servers
),
tunnelConfigClass
,
NULL
);
for
(
it
=
servers
,
i
=
0
;
it
!=
NULL
;
it
=
it
->
next
,
i
++
)
{
LinphoneTunnelConfig
*
conf
=
(
LinphoneTunnelConfig
*
)
it
->
data
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment