Commit b1ab2d9e authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Update JNI according to latest presence API changes.

parent 0dec8ef3
......@@ -3999,6 +3999,21 @@ JNIEXPORT jint JNICALL Java_org_linphone_core_PresencePersonImpl_clearActivitesN
return (jint)linphone_presence_person_clear_activities_notes(person);
}
/*
* Class: org_linphone_core_PresenceNoteImpl
* Method: newPresenceNoteImpl
* Signature: (Ljava/lang/String;Ljava/lang/String;)J
*/
JNIEXPORT jlong JNICALL Java_org_linphone_core_PresenceNoteImpl_newPresenceNoteImpl(JNIEnv *env, jobject jobj, jstring content, jstring lang) {
LinphonePresenceNote *note;
const char *ccontent = content ? env->GetStringUTFChars(content, NULL) : NULL;
const char *clang = lang ? env->GetStringUTFChars(lang, NULL) : NULL;
note = linphone_presence_note_new(ccontent, clang);
if (clang) env->ReleaseStringUTFChars(lang, clang);
if (ccontent) env->ReleaseStringUTFChars(content, ccontent);
return (jlong)note;
}
/*
* Class: org_linphone_core_PresenceNoteImpl
* Method: unref
......@@ -4020,6 +4035,18 @@ JNIEXPORT jstring JNICALL Java_org_linphone_core_PresenceNoteImpl_getContent(JNI
return ccontent ? env->NewStringUTF(ccontent) : NULL;
}
/*
* Class: org_linphone_core_PresenceNoteImpl
* Method: setContent
* Signature: (JLjava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_org_linphone_core_PresenceNoteImpl_setContent(JNIEnv *env, jobject jobj, jlong ptr, jstring content) {
LinphonePresenceNote *note = (LinphonePresenceNote *)ptr;
const char *ccontent = content ? env->GetStringUTFChars(content, NULL) : NULL;
linphone_presence_note_set_content(note, ccontent);
if (ccontent) env->ReleaseStringUTFChars(content, ccontent);
}
/*
* Class: org_linphone_core_PresenceNoteImpl
* Method: getLang
......@@ -4031,6 +4058,18 @@ JNIEXPORT jstring JNICALL Java_org_linphone_core_PresenceNoteImpl_getLang(JNIEnv
return clang ? env->NewStringUTF(clang) : NULL;
}
/*
* Class: org_linphone_core_PresenceNoteImpl
* Method: setLang
* Signature: (JLjava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_org_linphone_core_PresenceNoteImpl_setLang(JNIEnv *env, jobject jobj, jlong ptr, jstring lang) {
LinphonePresenceNote *note = (LinphonePresenceNote *)ptr;
const char *clang = lang ? env->GetStringUTFChars(lang, NULL) : NULL;
linphone_presence_note_set_lang(note, clang);
if (clang) env->ReleaseStringUTFChars(lang, clang);
}
/*
* Class: org_linphone_core_PayloadTypeImpl
* Method: setRecvFmtp
......
......@@ -27,12 +27,26 @@ public interface PresenceNote {
*/
String getContent();
/**
* @brief Sets the content of a presence note.
* @param[in] content The content of the note.
* @return 0 if successful, a value < 0 in case of error.
*/
int setContent(String content);
/**
* @brief Gets the language of a presence note.
* @return A String containing the language of the presence note, or null if no language is specified.
*/
String getLang();
/**
* @brief Sets the language of a presence note.
* @param[in] lang The language of the note.
* @return 0 if successful, a value < 0 in case of error.
*/
int setLang(String lang);
/**
* @brief Gets the native pointer for this object.
*/
......
......@@ -26,6 +26,11 @@ public class PresenceNoteImpl implements PresenceNote {
mNativePtr = nativePtr;
}
private native long newPresenceNoteImpl(String content, String lang);
protected PresenceNoteImpl(String content, String lang) {
mNativePtr = newPresenceNoteImpl(content, lang);
}
private native void unref(long nativePtr);
protected void finalize() {
unref(mNativePtr);
......@@ -37,12 +42,24 @@ public class PresenceNoteImpl implements PresenceNote {
return getContent(mNativePtr);
}
private native int setContent(long nativePtr, String content);
@Override
public int setContent(String content) {
return setContent(mNativePtr, content);
}
private native String getLang(long nativePtr);
@Override
public String getLang() {
return getLang(mNativePtr);
}
private native int setLang(long nativePtr, String lang);
@Override
public int setLang(String lang) {
return setLang(mNativePtr, lang);
}
public long getNativePtr() {
return mNativePtr;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment