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
04b6f138
Commit
04b6f138
authored
Sep 14, 2017
by
Erwan Croze
👋🏻
Committed by
Sylvain Berfini
Oct 19, 2017
Browse files
Adding and implementing find_contacts_by_char
parent
86dd768a
Changes
5
Hide whitespace changes
Inline
Side-by-side
coreapi/linphonecore.c
View file @
04b6f138
...
...
@@ -2587,6 +2587,35 @@ void linphone_core_add_friend_list(LinphoneCore *lc, LinphoneFriendList *list) {
linphone_core_notify_friend_list_created
(
lc
,
list
);
}
const
bctbx_list_t
*
linphone_core_find_contacts_by_char
(
LinphoneCore
*
core
,
const
char
*
filter
,
bool_t
sip_only
)
{
// Get sipuri from filter if possible
bctbx_list_t
*
list
,
*
_list
=
NULL
;
LinphoneAddress
*
addr
=
linphone_core_interpret_url
(
core
,
(
sip_only
)
?
filter
:
""
);
bctbx_list_t
*
listFriendsList
=
(
bctbx_list_t
*
)
linphone_core_get_friends_lists
(
core
);
bctbx_list_t
*
listFriend
=
(
listFriendsList
!=
NULL
)
?
(
bctbx_list_t
*
)
linphone_friend_list_get_friends
((
LinphoneFriendList
*
)
listFriendsList
->
data
)
:
NULL
;
if
(
addr
!=
NULL
)
list
=
bctbx_list_new
(
addr
);
while
(
listFriend
!=
NULL
&&
listFriend
->
data
!=
NULL
)
{
LinphoneAddress
*
buff
=
(
LinphoneAddress
*
)
linphone_friend_get_address
((
LinphoneFriend
*
)
listFriend
->
data
);
if
(
buff
!=
NULL
)
{
bctbx_list_t
*
new_list
=
bctbx_list_new
(
buff
);
if
(
list
==
NULL
)
{
_list
=
list
=
new_list
;
}
else
{
if
(
_list
==
NULL
)
_list
=
list
;
_list
->
next
=
new_list
;
_list
=
_list
->
next
;
}
}
listFriend
=
listFriend
->
next
;
}
return
list
;
}
void
linphone_core_enable_audio_adaptive_jittcomp
(
LinphoneCore
*
lc
,
bool_t
val
)
{
lc
->
rtp_conf
.
audio_adaptive_jitt_comp_enabled
=
val
;
}
...
...
coreapi/linphonecore_jni.cc
View file @
04b6f138
...
...
@@ -2436,6 +2436,30 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_getFriendLists(J
return jFriends;
}
extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_findContactsByChar(JNIEnv* env
,jobject thiz
,jlong lc
,jstring jfilter
,jboolean jsiponly) {
const char* filter = GetStringUTFChars(env, jfilter);
const bctbx_list_t* contacts = linphone_core_find_contacts_by_char((LinphoneCore*)lc, filter, jsiponly);
size_t contactsSize = bctbx_list_size(contacts);
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data((LinphoneCore *)lc);
jobjectArray jContacts = env->NewObjectArray(contactsSize, ljb->addressClass, NULL);
for (size_t i = 0; i < contactsSize; i++) {
LinphoneAddress *addr = (LinphoneAddress*)contacts->data;
jobject jcontact = env->NewObject(ljb->addressClass, ljb->addressCtrId, (jlong)addr);
if(jcontact != NULL){
env->SetObjectArrayElement(jContacts, i, jcontact);
}
contacts = contacts->next;
}
ReleaseStringUTFChars(env, jfilter, filter);
return jContacts;
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPresenceInfo(JNIEnv* env
,jobject thiz
,jlong lc
...
...
include/linphone/core.h
View file @
04b6f138
...
...
@@ -5250,6 +5250,15 @@ LINPHONE_PUBLIC const bctbx_list_t * linphone_core_get_friends_lists(const Linph
*/
LINPHONE_PUBLIC
LinphoneFriendList
*
linphone_core_get_default_friend_list
(
const
LinphoneCore
*
lc
);
/**
* Retrieves a list of LinphoneAddress sort and filter
* @param[in] lc LinphoneCore object
* @param[in] filter Chars used for the filter*
* @param[in] sip_only Only sip address or not
* @return \bctbx_list{LinphoneAddress} a list of filtered LinphoneAddress + the LinphoneAddress created with the filter
**/
LINPHONE_PUBLIC
const
bctbx_list_t
*
linphone_core_find_contacts_by_char
(
LinphoneCore
*
core
,
const
char
*
filter
,
bool_t
sip_only
);
/**
* Create a LinphonePresenceActivity with the given type and description.
* @param[in] lc #LinphoneCore object.
...
...
java/common/org/linphone/core/LinphoneCore.java
View file @
04b6f138
...
...
@@ -1100,6 +1100,14 @@ public interface LinphoneCore {
*/
LinphoneFriendList
[]
getFriendLists
();
/**
* Get filtered list by filter
* @param filter
* @param sipOnly get only sip address
* @return LinphoneAddress list
*/
LinphoneAddress
[]
findContactsByChar
(
String
filter
,
boolean
sipOnly
);
/**
* Set my presence status
* @param minutes_away how long in away
...
...
java/impl/org/linphone/core/LinphoneCoreImpl.java
View file @
04b6f138
...
...
@@ -195,7 +195,6 @@ class LinphoneCoreImpl implements LinphoneCore {
private
native
Object
createFriend
(
long
nativePtr
);
private
native
Object
createFriendWithAddress
(
long
nativePtr
,
String
address
);
private
native
int
getIncomingTimeout
(
long
nativePtr
);
LinphoneCoreImpl
(
LinphoneCoreListener
listener
,
File
userConfig
,
File
factoryConfig
,
Object
userdata
,
Object
context
)
throws
IOException
{
mListener
=
listener
;
String
user
=
userConfig
==
null
?
null
:
userConfig
.
getCanonicalPath
();
...
...
@@ -495,6 +494,11 @@ class LinphoneCoreImpl implements LinphoneCore {
return
getFriendLists
(
nativePtr
);
}
private
native
LinphoneAddress
[]
findContactsByChar
(
long
nativePtr
,
String
filter
,
boolean
sipOnly
);
public
synchronized
LinphoneAddress
[]
findContactsByChar
(
String
filter
,
boolean
sipOnly
)
{
return
findContactsByChar
(
nativePtr
,
filter
,
sipOnly
);
}
@SuppressWarnings
(
"deprecation"
)
public
synchronized
void
setPresenceInfo
(
int
minutes_away
,
String
alternative_contact
,
OnlineStatus
status
)
{
setPresenceInfo
(
nativePtr
,
minutes_away
,
alternative_contact
,
status
.
mValue
);
...
...
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