forked from mirrors/linphone-iphone
Add missing functions to presence JNI.
This commit is contained in:
parent
c91ba39633
commit
50f145ed77
3 changed files with 72 additions and 1 deletions
|
|
@ -2007,7 +2007,7 @@ extern "C" jint Java_org_linphone_core_LinphoneFriendImpl_getStatus(JNIEnv* env
|
|||
*/
|
||||
JNIEXPORT jobject JNICALL Java_org_linphone_core_LinphoneFriendImpl_getPresenceModel(JNIEnv *env, jobject jobj, jlong ptr) {
|
||||
LinphoneFriend *lf = (LinphoneFriend *)ptr;
|
||||
const LinphonePresenceModel *model = linphone_friend_get_presence_model(lf);
|
||||
LinphonePresenceModel *model = (LinphonePresenceModel *)linphone_friend_get_presence_model(lf);
|
||||
if (model == NULL) return NULL;
|
||||
RETURN_USER_DATA_OBJECT("PresenceModelImpl", linphone_presence_model, model);
|
||||
}
|
||||
|
|
@ -3120,6 +3120,41 @@ JNIEXPORT jint JNICALL Java_org_linphone_core_PresenceModelImpl_getBasicStatus(J
|
|||
return (jint)linphone_presence_model_get_basic_status(model);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_linphone_core_PresenceModelImpl
|
||||
* Method: getTimestamp
|
||||
* Signature: (J)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_linphone_core_PresenceModelImpl_getTimestamp(JNIEnv *env, jobject jobj, jlong ptr) {
|
||||
LinphonePresenceModel *model = (LinphonePresenceModel *)ptr;
|
||||
return (jlong)linphone_presence_model_get_timestamp(model);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_linphone_core_PresenceModelImpl
|
||||
* Method: getContact
|
||||
* Signature: (J)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_org_linphone_core_PresenceModelImpl_getContact(JNIEnv *env, jobject jobj, jlong ptr) {
|
||||
LinphonePresenceModel *model = (LinphonePresenceModel *)ptr;
|
||||
char *ccontact = linphone_presence_model_get_contact(model);
|
||||
jstring jcontact = ccontact ? env->NewStringUTF(ccontact) : NULL;
|
||||
if (ccontact) ms_free(ccontact);
|
||||
return jcontact;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_linphone_core_PresenceModelImpl
|
||||
* Method: setContact
|
||||
* Signature: (JLjava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_linphone_core_PresenceModelImpl_setContact(JNIEnv *env, jobject jobj, jlong ptr, jstring contact) {
|
||||
LinphonePresenceModel *model = (LinphonePresenceModel *)ptr;
|
||||
const char *ccontact = contact ? env->GetStringUTFChars(contact, NULL) : NULL;
|
||||
linphone_presence_model_set_contact(model, ccontact);
|
||||
if (ccontact) env->ReleaseStringUTFChars(contact, ccontact);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_linphone_core_PresenceModelImpl
|
||||
* Method: nbActivities
|
||||
|
|
|
|||
|
|
@ -56,6 +56,24 @@ public interface PresenceModel {
|
|||
*/
|
||||
BasicStatus getBasicStatus();
|
||||
|
||||
/**
|
||||
* @brief Gets the timestamp of a presence model.
|
||||
* @return The timestamp of the #LinphonePresenceModel object or -1 on error.
|
||||
*/
|
||||
long getTimestamp();
|
||||
|
||||
/**
|
||||
* @brief Gets the contact of a presence model.
|
||||
* @return A string containing the contact, or null if no contact is found.
|
||||
*/
|
||||
String getContact();
|
||||
|
||||
/**
|
||||
* @brief Sets the contact of a presence model.
|
||||
* @param contact The contact string to set.
|
||||
*/
|
||||
void setContact(String contact);
|
||||
|
||||
/**
|
||||
* @brief Gets the number of activities included in the presence model.
|
||||
* @return The number of activities included in the #PresenceModel object.
|
||||
|
|
|
|||
|
|
@ -41,6 +41,24 @@ public class PresenceModelImpl implements PresenceModel {
|
|||
return BasicStatus.fromInt(getBasicStatus(mNativePtr));
|
||||
}
|
||||
|
||||
private native long getTimestamp(long nativePtr);
|
||||
@Override
|
||||
public long getTimestamp() {
|
||||
return getTimestamp(mNativePtr);
|
||||
}
|
||||
|
||||
private native String getContact(long nativePtr);
|
||||
@Override
|
||||
public String getContact() {
|
||||
return getContact(mNativePtr);
|
||||
}
|
||||
|
||||
private native void setContact(long nativePtr, String contact);
|
||||
@Override
|
||||
public void setContact(String contact) {
|
||||
setContact(mNativePtr, contact);
|
||||
}
|
||||
|
||||
private native long nbActivities(long nativePtr);
|
||||
@Override
|
||||
public long nbActivities() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue