mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-18 11:38:08 +00:00
Added a way to get/set organization field in vCard from API
This commit is contained in:
parent
9b6ebbc00c
commit
34edd8acb5
6 changed files with 92 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue