Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
BC
public
liblinphone
Commits
34edd8ac
Commit
34edd8ac
authored
Mar 16, 2016
by
Sylvain Berfini
🎩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a way to get/set organization field in vCard from API
parent
9b6ebbc0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
92 additions
and
1 deletion
+92
-1
coreapi/linphonecore_jni.cc
coreapi/linphonecore_jni.cc
+25
-0
coreapi/vcard.cc
coreapi/vcard.cc
+22
-0
coreapi/vcard.h
coreapi/vcard.h
+15
-1
coreapi/vcard_stubs.c
coreapi/vcard_stubs.c
+8
-0
java/common/org/linphone/core/LinphoneFriend.java
java/common/org/linphone/core/LinphoneFriend.java
+10
-0
java/impl/org/linphone/core/LinphoneFriendImpl.java
java/impl/org/linphone/core/LinphoneFriendImpl.java
+12
-0
No files found.
coreapi/linphonecore_jni.cc
View file @
34edd8ac
...
...
@@ -3431,6 +3431,31 @@ extern "C" jstring Java_org_linphone_core_LinphoneFriendImpl_getName(JNIEnv* en
return
name
?
env
->
NewStringUTF
(
name
)
:
NULL
;
}
extern
"C"
jstring
Java_org_linphone_core_LinphoneFriendImpl_getOrganization
(
JNIEnv
*
env
,
jobject
thiz
,
jlong
ptr
)
{
LinphoneFriend
*
lf
=
(
LinphoneFriend
*
)
ptr
;
LinphoneVcard
*
lvc
=
linphone_friend_get_vcard
(
lf
);
if
(
lvc
)
{
const
char
*
org
=
linphone_vcard_get_organization
(
lvc
);
return
org
?
env
->
NewStringUTF
(
org
)
:
NULL
;
}
return
NULL
;
}
extern
"C"
void
Java_org_linphone_core_LinphoneFriendImpl_setOrganization
(
JNIEnv
*
env
,
jobject
thiz
,
jlong
ptr
,
jstring
jorg
)
{
LinphoneFriend
*
lf
=
(
LinphoneFriend
*
)
ptr
;
LinphoneVcard
*
lvc
=
linphone_friend_get_vcard
(
lf
);
if
(
lvc
)
{
const
char
*
org
=
env
->
GetStringUTFChars
(
jorg
,
NULL
);
linphone_vcard_set_organization
(
lvc
,
org
);
env
->
ReleaseStringUTFChars
(
jorg
,
org
);
}
}
extern
"C"
void
Java_org_linphone_core_LinphoneFriendImpl_setIncSubscribePolicy
(
JNIEnv
*
env
,
jobject
thiz
,
jlong
ptr
...
...
coreapi/vcard.cc
View file @
34edd8ac
...
...
@@ -163,6 +163,28 @@ MSList* linphone_vcard_get_sip_addresses(const LinphoneVcard *vCard) {
return
result
;
}
void
linphone_vcard_set_organization
(
LinphoneVcard
*
vCard
,
const
char
*
organization
)
{
if
(
!
vCard
)
return
;
if
(
vCard
->
belCard
->
getOrganizations
().
size
()
>
0
)
{
const
shared_ptr
<
belcard
::
BelCardOrganization
>
org
=
vCard
->
belCard
->
getOrganizations
().
front
();
org
->
setValue
(
organization
);
}
else
{
shared_ptr
<
belcard
::
BelCardOrganization
>
org
=
belcard
::
BelCardGeneric
::
create
<
belcard
::
BelCardOrganization
>
();
org
->
setValue
(
organization
);
vCard
->
belCard
->
addOrganization
(
org
);
}
}
const
char
*
linphone_vcard_get_organization
(
const
LinphoneVcard
*
vCard
)
{
if
(
vCard
&&
vCard
->
belCard
->
getOrganizations
().
size
()
>
0
)
{
const
shared_ptr
<
belcard
::
BelCardOrganization
>
org
=
vCard
->
belCard
->
getOrganizations
().
front
();
return
org
->
getValue
().
c_str
();
}
return
NULL
;
}
bool_t
linphone_vcard_generate_unique_id
(
LinphoneVcard
*
vCard
)
{
char
uuid
[
64
];
...
...
coreapi/vcard.h
View file @
34edd8ac
...
...
@@ -122,6 +122,20 @@ void linphone_vcard_edit_main_sip_address(LinphoneVcard *vCard, const char *sip_
*/
LINPHONE_PUBLIC
MSList
*
linphone_vcard_get_sip_addresses
(
const
LinphoneVcard
*
vCard
);
/**
* Fills the Organization field of the vCard
* @param[in] vCard the LinphoneVcard
* @param[in] url the Organization
*/
LINPHONE_PUBLIC
void
linphone_vcard_set_organization
(
LinphoneVcard
*
vCard
,
const
char
*
organization
);
/**
* Gets the Organization of the vCard
* @param[in] vCard the LinphoneVcard
* @return the Organization of the vCard or NULL
*/
LINPHONE_PUBLIC
const
char
*
linphone_vcard_get_organization
(
const
LinphoneVcard
*
vCard
);
/**
* Generates a random unique id for the vCard.
* If is required to be able to synchronize the vCard with a CardDAV server
...
...
@@ -163,7 +177,7 @@ LINPHONE_PUBLIC const char* linphone_vcard_get_etag(const LinphoneVcard *vCard);
* @param[in] vCard the LinphoneVcard
* @param[in] url the URL
*/
LINPHONE_PUBLIC
void
linphone_vcard_set_url
(
LinphoneVcard
*
vCard
,
const
char
*
url
);
LINPHONE_PUBLIC
void
linphone_vcard_set_url
(
LinphoneVcard
*
vCard
,
const
char
*
url
);
/**
* Gets the URL of the vCard
...
...
coreapi/vcard_stubs.c
View file @
34edd8ac
...
...
@@ -71,6 +71,14 @@ MSList* linphone_vcard_get_sip_addresses(const LinphoneVcard *vCard) {
return
NULL
;
}
void
linphone_vcard_set_organization
(
LinphoneVcard
*
vCard
,
const
char
*
organization
)
{
}
const
char
*
linphone_vcard_get_organization
(
const
LinphoneVcard
*
vCard
)
{
return
NULL
;
}
bool_t
linphone_vcard_generate_unique_id
(
LinphoneVcard
*
vCard
)
{
return
FALSE
;
}
...
...
java/common/org/linphone/core/LinphoneFriend.java
View file @
34edd8ac
...
...
@@ -155,4 +155,14 @@ public interface LinphoneFriend {
* @return
*/
String
getName
();
/**
* Set an organization for this friend
* @param organization
*/
void
setOrganization
(
String
organization
);
/**
* Get organization of this friend
* @return
*/
String
getOrganization
();
}
java/impl/org/linphone/core/LinphoneFriendImpl.java
View file @
34edd8ac
...
...
@@ -130,4 +130,16 @@ class LinphoneFriendImpl implements LinphoneFriend, Serializable {
public
String
getName
()
{
return
getName
(
nativePtr
);
}
private
native
void
setOrganization
(
long
nativePtr
,
String
organization
);
@Override
public
void
setOrganization
(
String
organization
)
{
setOrganization
(
nativePtr
,
organization
);
}
private
native
String
getOrganization
(
long
nativePtr
);
@Override
public
String
getOrganization
()
{
return
getOrganization
(
nativePtr
);
}
}
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