From 160dc76b0efccc8ef78f006718dd6029f54b10fe Mon Sep 17 00:00:00 2001
From: Sylvain Berfini <Sylvain.Berfini@Belledonne-Communications.com>
Date: Wed, 13 Jun 2012 10:15:16 +0200
Subject: [PATCH] Created and exported some methods to manage call logs from
 Java

---
 coreapi/linphonecore.c                             |  8 ++++++++
 coreapi/linphonecore.h                             |  2 ++
 coreapi/linphonecore_jni.cc                        | 12 ++++++++++++
 java/common/org/linphone/core/LinphoneCallLog.java |  2 ++
 java/common/org/linphone/core/LinphoneCore.java    | 11 +++++++++++
 5 files changed, 35 insertions(+)

diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c
index c0531ae9a5..ada24237d8 100644
--- a/coreapi/linphonecore.c
+++ b/coreapi/linphonecore.c
@@ -3485,6 +3485,14 @@ void linphone_core_clear_call_logs(LinphoneCore *lc){
 	call_logs_write_to_config_file(lc);
 }
 
+int linphone_core_get_missed_calls_count(LinphoneCore *lc) {
+	return lc->missed_calls;
+}
+
+void linphone_core_remove_call_log(LinphoneCore *lc, void *data) {
+	lc->call_logs = ms_list_remove(lc->call_logs, data);
+}
+
 static void toggle_video_preview(LinphoneCore *lc, bool_t val){
 #ifdef VIDEO_ENABLED
 	if (val){
diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h
index 59dbca0cba..a59353a21b 100644
--- a/coreapi/linphonecore.h
+++ b/coreapi/linphonecore.h
@@ -969,6 +969,8 @@ void linphone_core_set_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, bool_t val);
 /* returns a list of LinphoneCallLog */
 const MSList * linphone_core_get_call_logs(LinphoneCore *lc);
 void linphone_core_clear_call_logs(LinphoneCore *lc);
+int linphone_core_get_missed_calls_count(LinphoneCore *lc);
+void linphone_core_remove_call_log(LinphoneCore *lc, void *data);
 
 /* video support */
 bool_t linphone_core_video_supported(LinphoneCore *lc);
diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc
index 52f5d24ad5..f3ba286857 100644
--- a/coreapi/linphonecore_jni.cc
+++ b/coreapi/linphonecore_jni.cc
@@ -642,6 +642,18 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_stopDtmf(	JNIEnv*  env
 	linphone_core_stop_dtmf((LinphoneCore*)lc);
 }
 
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_getMissedCallsCount(JNIEnv*  env
+																		,jobject  thiz
+																		,jlong lc) {
+	linphone_core_get_missed_calls_count((LinphoneCore*)lc);
+}
+
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_removeCallLog(JNIEnv*  env
+																		,jobject  thiz
+																		,jlong lc, jlong log) {
+	linphone_core_remove_call_log((LinphoneCore*)lc, (void*) log);
+}
+
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_clearCallLogs(JNIEnv*  env
 																		,jobject  thiz
 																		,jlong lc) {
diff --git a/java/common/org/linphone/core/LinphoneCallLog.java b/java/common/org/linphone/core/LinphoneCallLog.java
index 015f071dfb..c56f324d13 100644
--- a/java/common/org/linphone/core/LinphoneCallLog.java
+++ b/java/common/org/linphone/core/LinphoneCallLog.java
@@ -94,4 +94,6 @@ public interface LinphoneCallLog {
 	 * @return
 	 */
 	public CallStatus getStatus();
+	
+	public long getNativePtr();
 }
diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java
index 0d8e14ae9a..b6830863c4 100644
--- a/java/common/org/linphone/core/LinphoneCore.java
+++ b/java/common/org/linphone/core/LinphoneCore.java
@@ -20,6 +20,7 @@ package org.linphone.core;
 
 import java.util.Vector;
 
+import org.linphone.core.LinphoneCallLog;
 import org.linphone.core.LinphoneCallParams;
 
 /**
@@ -759,4 +760,14 @@ public interface LinphoneCore {
 	void setUserAgent(String name, String version);
 	
 	void setCpuCount(int count);
+	
+	/**
+	 * remove a call log
+	 */
+	public void removeCallLog(LinphoneCallLog log);
+	
+	/**
+	 * @return count of missed calls
+	 */
+	public int getMissedCallsCount();
 }
-- 
GitLab