Commit 30b04f5e authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Replaced linphone_dial_plan_get_all in linphonecore_jni.cc by linphone_dial_plan_get_all_list

parent 454e14d7
...@@ -226,28 +226,30 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreFactoryImpl_getAllDia ...@@ -226,28 +226,30 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreFactoryImpl_getAllDia
jclass addr_class = env->FindClass("org/linphone/core/DialPlanImpl"); jclass addr_class = env->FindClass("org/linphone/core/DialPlanImpl");
jmethodID addr_constructor = env->GetMethodID(addr_class, "<init>", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;)V"); jmethodID addr_constructor = env->GetMethodID(addr_class, "<init>", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;)V");
jobjectArray jaddr_array; jobjectArray jaddr_array;
int i, size = 0; size_t i;
countries = (LinphoneDialPlan *)linphone_dial_plan_get_all(); const bctbx_list_t *countries = linphone_dial_plan_get_all_list();
size_t size = bctbx_list_size(countries);
while (countries[size].country != NULL) size++; jaddr_array = env->NewObjectArray((int)size, addr_class, NULL);
jaddr_array = env->NewObjectArray(size, addr_class, NULL); for (i = 0; i < size; i++) {
LinphoneDialPlan* dp = (LinphoneDialPlan*)countries->data;
for (i=0; i < size ; i++) { jstring jcountry = env->NewStringUTF(linphone_dial_plan_get_country(dp));
jstring jcountry = env->NewStringUTF(countries[i].country); jstring jiso = env->NewStringUTF(linphone_dial_plan_get_iso_country_code(dp));
jstring jiso = env->NewStringUTF(countries[i].iso_country_code); jstring jccc = env->NewStringUTF(linphone_dial_plan_get_country_calling_code(dp));
jstring jccc = env->NewStringUTF(countries[i].ccc); jint jnnl = (jint)linphone_dial_plan_get_national_number_length(dp);
jint jnnl = (jint)countries[i].nnl; jstring jicp = env->NewStringUTF(linphone_dial_plan_get_international_call_prefix(dp));
jstring jicp = env->NewStringUTF(countries[i].icp);
jobject jaddr = env->NewObject(addr_class, addr_constructor, jcountry, jiso, jccc, jnnl, jicp); jobject jaddr = env->NewObject(addr_class, addr_constructor, jcountry, jiso, jccc, jnnl, jicp);
env->SetObjectArrayElement(jaddr_array, i, jaddr); env->SetObjectArrayElement(jaddr_array, (int)i, jaddr);
env->DeleteLocalRef(jcountry); env->DeleteLocalRef(jcountry);
env->DeleteLocalRef(jiso); env->DeleteLocalRef(jiso);
env->DeleteLocalRef(jccc); env->DeleteLocalRef(jccc);
env->DeleteLocalRef(jicp); env->DeleteLocalRef(jicp);
countries = countries->next;
} }
return jaddr_array; return jaddr_array;
} }
......
...@@ -79,7 +79,8 @@ LINPHONE_PUBLIC int linphone_dial_plan_lookup_ccc_from_e164(const char* e164); ...@@ -79,7 +79,8 @@ LINPHONE_PUBLIC int linphone_dial_plan_lookup_ccc_from_e164(const char* e164);
/** /**
* Return NULL-terminated array of all known dial plans * Return NULL-terminated array of all known dial plans
* @deprecated use linphone_dial_plan_get_all_list instead * @deprecated use linphone_dial_plan_get_all_list instead, this method will always return NULL
* @donotwrap
**/ **/
LINPHONE_PUBLIC const LinphoneDialPlan* linphone_dial_plan_get_all(void); LINPHONE_PUBLIC const LinphoneDialPlan* linphone_dial_plan_get_all(void);
......
...@@ -76,7 +76,7 @@ const LinphoneDialPlan* linphone_dial_plan_by_ccc(const char *ccc) { ...@@ -76,7 +76,7 @@ const LinphoneDialPlan* linphone_dial_plan_by_ccc(const char *ccc) {
} }
const LinphoneDialPlan* linphone_dial_plan_get_all() { const LinphoneDialPlan* linphone_dial_plan_get_all() {
return NULL; //TODO return NULL;
} }
const bctbx_list_t * linphone_dial_plan_get_all_list() { const bctbx_list_t * linphone_dial_plan_get_all_list() {
......
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