From 8fbe7ee1d47c7957f35ca9268c4072df7921cec1 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 12 Aug 2013 10:52:15 +0200 Subject: [PATCH] Added JNI glue for deleteHistory and getUnreadMessagesCount methods of LinphoneChatRoom --- coreapi/linphonecore_jni.cc | 10 ++++++++++ java/common/org/linphone/core/LinphoneChatRoom.java | 11 +++++++++++ java/impl/org/linphone/core/LinphoneChatRoomImpl.java | 10 ++++++++++ 3 files changed, 31 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index cfac60c85..55ea828bd 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -2078,6 +2078,16 @@ extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_createLinphoneChatM return (jlong) chatMessage; } +extern "C" jint Java_org_linphone_core_LinphoneChatRoomImpl_getUnreadMessagesCount(JNIEnv* env + ,jobject thiz + ,jlong ptr) { + return (jint) linphone_chat_room_get_unread_messages_count((LinphoneChatRoom*)ptr); +} +extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_deleteHistory(JNIEnv* env + ,jobject thiz + ,jlong ptr) { + linphone_chat_room_delete_history((LinphoneChatRoom*)ptr); +} extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_destroy(JNIEnv* env ,jobject thiz ,jlong ptr) { diff --git a/java/common/org/linphone/core/LinphoneChatRoom.java b/java/common/org/linphone/core/LinphoneChatRoom.java index 9e48d6598..cfea18f9f 100644 --- a/java/common/org/linphone/core/LinphoneChatRoom.java +++ b/java/common/org/linphone/core/LinphoneChatRoom.java @@ -59,4 +59,15 @@ public interface LinphoneChatRoom { * Destroys a LinphoneChatRoom. */ void destroy(); + + /** + * Returns the amount of unread messages associated with the peer of this chatRoom. + * @return the amount of unread messages + */ + int getUnreadMessagesCount(); + + /** + * Deletes all the messages associated with the peer of this chat room + */ + void deleteHistory(); } diff --git a/java/impl/org/linphone/core/LinphoneChatRoomImpl.java b/java/impl/org/linphone/core/LinphoneChatRoomImpl.java index abe2c52d8..faead77ca 100644 --- a/java/impl/org/linphone/core/LinphoneChatRoomImpl.java +++ b/java/impl/org/linphone/core/LinphoneChatRoomImpl.java @@ -28,6 +28,8 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom { private native void sendMessage2(long ptr, long message, StateListener listener); private native long[] getHistory(long ptr); private native void destroy(long ptr); + private native int getUnreadMessagesCount(long ptr); + private native void deleteHistory(long ptr); protected LinphoneChatRoomImpl(long aNativePtr) { nativePtr = aNativePtr; @@ -67,4 +69,12 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom { public void destroy() { destroy(nativePtr); } + + public int getUnreadMessagesCount() { + return getUnreadMessagesCount(nativePtr); + } + + public void deleteHistory() { + deleteHistory(nativePtr); + } }