mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
Add xmlrpc request for is_phone_number_used
This commit is contained in:
parent
9d04e12c48
commit
ceabf26451
6 changed files with 289 additions and 176 deletions
|
|
@ -125,6 +125,14 @@ void linphone_account_creator_cbs_set_recover_phone_account(LinphoneAccountCreat
|
|||
cbs->recover_phone_account = cb;
|
||||
}
|
||||
|
||||
LinphoneAccountCreatorCbsStatusCb linphone_account_creator_cbs_get_is_phone_number_used(const LinphoneAccountCreatorCbs *cbs) {
|
||||
return cbs->is_phone_number_used;
|
||||
}
|
||||
|
||||
void linphone_account_creator_cbs_set_is_phone_number_used(LinphoneAccountCreatorCbs *cbs, LinphoneAccountCreatorCbsStatusCb cb) {
|
||||
cbs->is_phone_number_used = cb;
|
||||
}
|
||||
|
||||
|
||||
static void _linphone_account_creator_destroy(LinphoneAccountCreator *creator) {
|
||||
linphone_xml_rpc_session_release(creator->xmlrpc_session); /*this will drop all pending requests if any*/
|
||||
|
|
@ -678,6 +686,42 @@ LinphoneAccountCreatorStatus linphone_account_creator_is_account_activated(Linph
|
|||
}
|
||||
/****************** END OF CREATE ACCOUNT VALIDATED SECTION********************/
|
||||
|
||||
/****************** START OF PHONE NUMBER VALIDATED SECTION *******************/
|
||||
|
||||
static void _is_phone_number_used_cb(LinphoneXmlRpcRequest *request) {
|
||||
LinphoneAccountCreator *creator = (LinphoneAccountCreator *)linphone_xml_rpc_request_get_user_data(request);
|
||||
if (creator->callbacks->is_phone_number_used != NULL) {
|
||||
LinphoneAccountCreatorStatus status = LinphoneAccountCreatorReqFailed;
|
||||
const char* resp = linphone_xml_rpc_request_get_string_response(request);
|
||||
if (linphone_xml_rpc_request_get_status(request) == LinphoneXmlRpcStatusOk) {
|
||||
status = (strcmp(resp, "OK") == 0) ? LinphoneAccountCreatorPhoneNumberUsed : LinphoneAccountCreatorPhoneNumberNotUsed;
|
||||
}
|
||||
creator->callbacks->is_phone_number_used(creator, status, resp);
|
||||
}
|
||||
}
|
||||
|
||||
LinphoneAccountCreatorStatus linphone_account_creator_is_phone_number_used(LinphoneAccountCreator *creator) {
|
||||
LinphoneXmlRpcRequest *request;
|
||||
char *identity = _get_identity(creator);
|
||||
if (!identity) {
|
||||
if (creator->callbacks->is_account_activated != NULL) {
|
||||
creator->callbacks->is_account_activated(creator, LinphoneAccountCreatorReqFailed, "Missing required parameters");
|
||||
}
|
||||
return LinphoneAccountCreatorReqFailed;
|
||||
}
|
||||
request = linphone_xml_rpc_request_new_with_args("is_account_activated", LinphoneXmlRpcArgString,
|
||||
LinphoneXmlRpcArgString, creator->username ? creator->username : creator->phone_number,
|
||||
LinphoneXmlRpcArgNone);
|
||||
linphone_xml_rpc_request_set_user_data(request, creator);
|
||||
linphone_xml_rpc_request_cbs_set_response(linphone_xml_rpc_request_get_callbacks(request), _is_account_activated_cb);
|
||||
linphone_xml_rpc_session_send_request(creator->xmlrpc_session, request);
|
||||
linphone_xml_rpc_request_unref(request);
|
||||
ms_free(identity);
|
||||
return LinphoneAccountCreatorOK;
|
||||
}
|
||||
|
||||
/****************** END OF PHONE NUMBER VALIDATED SECTION *********************/
|
||||
|
||||
/****************** START OF LINK PHONE NUMBER WITH ACCOUNT SECTION ***********/
|
||||
static void _link_phone_number_with_account_cb(LinphoneXmlRpcRequest *request) {
|
||||
LinphoneAccountCreator *creator = (LinphoneAccountCreator *)linphone_xml_rpc_request_get_user_data(request);
|
||||
|
|
|
|||
|
|
@ -53,15 +53,21 @@ typedef enum _LinphoneAccountCreatorStatus {
|
|||
LinphoneAccountCreatorAccountNotLinked,
|
||||
|
||||
LinphoneAccountCreatorEmailInvalid,
|
||||
|
||||
LinphoneAccountCreatorUsernameInvalid,
|
||||
LinphoneAccountCreatorUsernameTooShort,
|
||||
LinphoneAccountCreatorUsernameTooLong,
|
||||
LinphoneAccountCreatorUsernameInvalidSize,
|
||||
|
||||
LinphoneAccountCreatorPhoneNumberInvalid,
|
||||
LinphoneAccountCreatorPhoneNumberTooShort,
|
||||
LinphoneAccountCreatorPhoneNumberTooLong,
|
||||
LinphoneAccountCreatorPhoneNumberUsed,
|
||||
LinphoneAccountCreatorPhoneNumberNotUsed,
|
||||
|
||||
LinphoneAccountCreatorPasswordTooShort,
|
||||
LinphoneAccountCreatorPasswordTooLong,
|
||||
|
||||
LinphoneAccountCreatorDomainInvalid,
|
||||
LinphoneAccountCreatorRouteInvalid,
|
||||
LinphoneAccountCreatorDisplayNameInvalid,
|
||||
|
|
@ -299,6 +305,13 @@ LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_activate_a
|
|||
**/
|
||||
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_is_account_activated(LinphoneAccountCreator *creator);
|
||||
|
||||
/**
|
||||
* Send an XML-RPC request to test the existence a phone number with a Linphone account.
|
||||
* @param[in] creator LinphoneAccountCreator object
|
||||
* @return LinphoneAccountCreatorOk if the request has been sent, LinphoneAccountCreatorReqFailed otherwise
|
||||
**/
|
||||
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_is_phone_number_used(LinphoneAccountCreator *creator);
|
||||
|
||||
/**
|
||||
* Send an XML-RPC request to link a phone number with a Linphone account.
|
||||
* @param[in] creator LinphoneAccountCreator object
|
||||
|
|
@ -454,6 +467,20 @@ LINPHONE_PUBLIC LinphoneAccountCreatorCbsStatusCb linphone_account_creator_cbs_g
|
|||
**/
|
||||
LINPHONE_PUBLIC void linphone_account_creator_cbs_set_is_account_activated(LinphoneAccountCreatorCbs *cbs, LinphoneAccountCreatorCbsStatusCb cb);
|
||||
|
||||
/**
|
||||
* Get the is phone number used callback.
|
||||
* @param[in] cbs LinphoneAccountCreatorCbs object.
|
||||
* @return The current is phone number used callback
|
||||
**/
|
||||
LINPHONE_PUBLIC LinphoneAccountCreatorCbsStatusCb linphone_account_creator_cbs_get_is_phone_number_used(const LinphoneAccountCreatorCbs *cbs);
|
||||
|
||||
/**
|
||||
* Set the is phone number used callback.
|
||||
* @param[in] cbs LinphoneAccountCreatorCbs object.
|
||||
* @param[in] cb is phone number to be used.
|
||||
**/
|
||||
LINPHONE_PUBLIC void linphone_account_creator_cbs_set_is_phone_number_used(LinphoneAccountCreatorCbs *cbs, LinphoneAccountCreatorCbsStatusCb cb);
|
||||
|
||||
LINPHONE_PUBLIC void linphone_account_creator_cbs_set_recover_phone_account(LinphoneAccountCreatorCbs *cbs, LinphoneAccountCreatorCbsStatusCb cb);
|
||||
LINPHONE_PUBLIC LinphoneAccountCreatorCbsStatusCb linphone_account_creator_cbs_get_recover_phone_account(const LinphoneAccountCreatorCbs *cbs);
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ void linphone_android_log_handler(int prio, char *str) {
|
|||
} else {
|
||||
current = str;
|
||||
while ((next = strchr(current, '\n')) != NULL) {
|
||||
|
||||
|
||||
*next = '\0';
|
||||
if (next != str && next[-1] == '\r')
|
||||
next[-1] = '\0';
|
||||
|
|
@ -101,7 +101,7 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreFactoryImpl__1setLogHa
|
|||
if (jhandler) {
|
||||
handler_class = (jclass) env->GetObjectClass(jhandler);
|
||||
loghandler_id = env->GetMethodID(handler_class, "log", "(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V");
|
||||
|
||||
|
||||
if (loghandler_id == NULL) {
|
||||
ms_fatal("log method not found");
|
||||
}
|
||||
|
|
@ -124,7 +124,7 @@ static void linphone_android_ortp_log_handler(const char *domain, OrtpLogLevel l
|
|||
case ORTP_FATAL: prio = ANDROID_LOG_FATAL; levname="fatal"; break;
|
||||
default: prio = ANDROID_LOG_DEFAULT; break;
|
||||
}
|
||||
|
||||
|
||||
if (handler_obj) {
|
||||
JNIEnv *env = ms_get_jni_env();
|
||||
jstring jdomain = env->NewStringUTF(LogDomain);
|
||||
|
|
@ -209,10 +209,10 @@ class LinphoneJavaBindings {
|
|||
public:
|
||||
LinphoneJavaBindings(JNIEnv *env) {
|
||||
listenerClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCoreListener"));
|
||||
|
||||
|
||||
authMethodClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$AuthMethod"));
|
||||
authMethodFromIntId = env->GetStaticMethodID(authMethodClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$AuthMethod;");
|
||||
|
||||
|
||||
/*displayStatus(LinphoneCore lc,String message);*/
|
||||
displayStatusId = env->GetMethodID(listenerClass,"displayStatus","(Lorg/linphone/core/LinphoneCore;Ljava/lang/String;)V");
|
||||
|
||||
|
|
@ -288,7 +288,7 @@ public:
|
|||
|
||||
chatMessageStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneChatMessage$State"));
|
||||
chatMessageStateFromIntId = env->GetStaticMethodID(chatMessageStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneChatMessage$State;");
|
||||
|
||||
|
||||
authInfoClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneAuthInfoImpl"));
|
||||
authInfoCtrId = env->GetMethodID(authInfoClass,"<init>", "(J)V");
|
||||
|
||||
|
|
@ -310,7 +310,7 @@ public:
|
|||
|
||||
friendClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneFriendImpl"));
|
||||
friendCtrId = env->GetMethodID(friendClass,"<init>", "(J)V");
|
||||
|
||||
|
||||
friendListClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneFriendListImpl"));
|
||||
friendListCtrId = env->GetMethodID(friendListClass,"<init>", "(J)V");
|
||||
friendListCreatedId = env->GetMethodID(listenerClass, "friendListCreated", "(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneFriendList;)V");
|
||||
|
|
@ -335,20 +335,20 @@ public:
|
|||
|
||||
subscriptionDirClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/SubscriptionDir"));
|
||||
subscriptionDirFromIntId = env->GetStaticMethodID(subscriptionDirClass,"fromInt","(I)Lorg/linphone/core/SubscriptionDir;");
|
||||
|
||||
|
||||
msFactoryClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/mediastream/Factory"));
|
||||
msFactoryCtrId = env->GetMethodID(msFactoryClass,"<init>", "(J)V");
|
||||
|
||||
|
||||
accountCreatorClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneAccountCreatorImpl"));
|
||||
accountCreatorCtrId = env->GetMethodID(accountCreatorClass, "<init>", "(J)V");
|
||||
accountCreatorStatusClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneAccountCreator$Status"));
|
||||
accountCreatorStatusFromIntId = env->GetStaticMethodID(accountCreatorStatusClass,"fromInt","(I)Lorg/linphone/core/LinphoneAccountCreator$Status;");
|
||||
}
|
||||
|
||||
|
||||
void setCore(jobject c) {
|
||||
core = c;
|
||||
}
|
||||
|
||||
|
||||
jobject getCore() {
|
||||
return core;
|
||||
}
|
||||
|
|
@ -381,7 +381,7 @@ public:
|
|||
env->DeleteGlobalRef(accountCreatorClass);
|
||||
env->DeleteGlobalRef(accountCreatorStatusClass);
|
||||
}
|
||||
|
||||
|
||||
jobject core;
|
||||
|
||||
jclass listenerClass;
|
||||
|
|
@ -399,7 +399,7 @@ public:
|
|||
jmethodID authenticationRequestedId;
|
||||
jmethodID publishStateId;
|
||||
jmethodID notifyRecvId;
|
||||
|
||||
|
||||
jclass authMethodClass;
|
||||
jmethodID authMethodFromIntId;
|
||||
|
||||
|
|
@ -432,7 +432,7 @@ public:
|
|||
jclass ecCalibratorStatusClass;
|
||||
jmethodID ecCalibrationStatusId;
|
||||
jmethodID ecCalibratorStatusFromIntId;
|
||||
|
||||
|
||||
jclass authInfoClass;
|
||||
jmethodID authInfoCtrId;
|
||||
|
||||
|
|
@ -487,10 +487,10 @@ public:
|
|||
jmethodID logCollectionUploadStateId;
|
||||
jmethodID logCollectionUploadStateFromIntId;
|
||||
jmethodID logCollectionUploadProgressId;
|
||||
|
||||
|
||||
jclass msFactoryClass;
|
||||
jmethodID msFactoryCtrId;
|
||||
|
||||
|
||||
jclass accountCreatorClass;
|
||||
jmethodID accountCreatorCtrId;
|
||||
jclass accountCreatorStatusClass;
|
||||
|
|
@ -612,7 +612,7 @@ jobject getChatRoom(JNIEnv *env, LinphoneChatRoom *room) {
|
|||
jobject getFriend(JNIEnv *env, LinphoneFriend *lfriend){
|
||||
jobject jobj=0;
|
||||
|
||||
|
||||
|
||||
if (lfriend != NULL){
|
||||
LinphoneCore *lc = linphone_friend_get_core(lfriend);
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
|
|
@ -706,7 +706,7 @@ jobject getXmlRpcRequest(JNIEnv *env, LinphoneXmlRpcRequest *lrequest) {
|
|||
if (lrequest != NULL) {
|
||||
jclass xmlRpcSessionClass = (jclass)env->FindClass("org/linphone/core/LinphoneXmlRpcRequestImpl");
|
||||
jmethodID xmlRpcSessionCtrId = env->GetMethodID(xmlRpcSessionClass, "<init>", "(J)V");
|
||||
|
||||
|
||||
void *up = linphone_xml_rpc_request_get_user_data(lrequest);
|
||||
if (up == NULL) {
|
||||
jobj = env->NewObject(xmlRpcSessionClass, xmlRpcSessionCtrId, (jlong)lrequest);
|
||||
|
|
@ -751,7 +751,7 @@ public:
|
|||
LinphoneCoreData(JNIEnv *env, jobject lc, LinphoneCoreVTable *vTable, jobject alistener, LinphoneJavaBindings *ljb) {
|
||||
core = env->NewGlobalRef(lc);
|
||||
listener = env->NewGlobalRef(alistener);
|
||||
|
||||
|
||||
memset(vTable, 0, sizeof(LinphoneCoreVTable));
|
||||
|
||||
if (ljb->displayStatusId) {
|
||||
|
|
@ -789,7 +789,7 @@ public:
|
|||
if (ljb->authInfoRequestedId) {
|
||||
vTable->auth_info_requested = authInfoRequested;
|
||||
}
|
||||
|
||||
|
||||
if (ljb->authenticationRequestedId) {
|
||||
vTable->authentication_requested = authenticationRequested;
|
||||
}
|
||||
|
|
@ -848,7 +848,7 @@ public:
|
|||
if (ljb->logCollectionUploadStateId) {
|
||||
vTable->log_collection_upload_state_changed = logCollectionUploadStateChange;
|
||||
}
|
||||
|
||||
|
||||
if (ljb->friendListCreatedId) {
|
||||
vTable->friend_list_created = friendListCreated;
|
||||
}
|
||||
|
|
@ -856,14 +856,14 @@ public:
|
|||
vTable->friend_list_removed = friendListRemoved;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
~LinphoneCoreData() {
|
||||
JNIEnv *env = 0;
|
||||
jvm->AttachCurrentThread(&env,NULL);
|
||||
env->DeleteGlobalRef(core);
|
||||
env->DeleteGlobalRef(listener);
|
||||
}
|
||||
|
||||
|
||||
jobject core;
|
||||
jobject listener;
|
||||
|
||||
|
|
@ -876,7 +876,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
|
|
@ -894,7 +894,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
|
|
@ -926,7 +926,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
|
|
@ -946,7 +946,7 @@ public:
|
|||
env->SetLongField(jcore, myFieldID, (jlong)lc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void globalStateChange(LinphoneCore *lc, LinphoneGlobalState gstate,const char* message) {
|
||||
JNIEnv *env = 0;
|
||||
jint result = jvm->AttachCurrentThread(&env,NULL);
|
||||
|
|
@ -954,15 +954,15 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
|
||||
|
||||
jobject jcore = lcData->core;
|
||||
/*at this stage, the java object may not be aware of its C object, because linphone_core_new() hasn't returned yet.*/
|
||||
setCoreIfNotDone(env,jcore, lc);
|
||||
|
||||
|
||||
jstring msg = message ? env->NewStringUTF(message) : NULL;
|
||||
env->CallVoidMethod(lcData->listener
|
||||
,ljb->globalStateId
|
||||
|
|
@ -982,7 +982,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
|
|
@ -1010,7 +1010,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
|
|
@ -1037,7 +1037,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
|
|
@ -1053,12 +1053,12 @@ public:
|
|||
JNIEnv *env = 0;
|
||||
jint result = jvm->AttachCurrentThread(&env,NULL);
|
||||
jobject jfriend = NULL;
|
||||
|
||||
|
||||
if (result != 0) {
|
||||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
|
|
@ -1077,7 +1077,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
|
|
@ -1097,7 +1097,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
|
|
@ -1115,7 +1115,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
jobject jmsg;
|
||||
jobject jroom;
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
|
|
@ -1128,7 +1128,7 @@ public:
|
|||
,(jroom = getChatRoom(env, room))
|
||||
,(jmsg = getChatMessage(env, msg)));
|
||||
handle_possible_java_exception(env, lcData->listener);
|
||||
|
||||
|
||||
if (jmsg) {
|
||||
env->DeleteLocalRef(jmsg);
|
||||
}
|
||||
|
|
@ -1143,7 +1143,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
jobject jroom;
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
|
|
@ -1153,7 +1153,7 @@ public:
|
|||
,lcData->core
|
||||
,(jroom = getChatRoom(env, room)));
|
||||
handle_possible_java_exception(env, lcData->listener);
|
||||
|
||||
|
||||
if (jroom) {
|
||||
env->DeleteLocalRef(jroom);
|
||||
}
|
||||
|
|
@ -1195,7 +1195,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
|
|
@ -1220,7 +1220,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
|
|
@ -1239,7 +1239,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneInfoMessage *copy_info=linphone_info_message_copy(info);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
|
|
@ -1261,7 +1261,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
|
|
@ -1289,7 +1289,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
|
|
@ -1311,7 +1311,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
|
|
@ -1333,7 +1333,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
|
|
@ -1350,7 +1350,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
|
|
@ -1379,7 +1379,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
|
|
@ -1412,7 +1412,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
|
|
@ -1443,7 +1443,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
|
|
@ -1461,7 +1461,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
|
|
@ -1483,7 +1483,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
|
|
@ -1500,7 +1500,7 @@ public:
|
|||
ms_error("cannot attach VM");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
jobject jfriendlist;
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
|
|
@ -1510,7 +1510,7 @@ public:
|
|||
,lcData->core
|
||||
,(jfriendlist = getFriendList(env, list)));
|
||||
handle_possible_java_exception(env, lcData->listener);
|
||||
|
||||
|
||||
if (jfriendlist) {
|
||||
env->DeleteLocalRef(jfriendlist);
|
||||
}
|
||||
|
|
@ -1538,7 +1538,7 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_newLinphoneCore(JNIEnv*
|
|||
const char* factoryConfig = GetStringUTFChars(env, jfactoryConfig);
|
||||
|
||||
LinphoneJavaBindings *ljb = new LinphoneJavaBindings(env);
|
||||
|
||||
|
||||
LinphoneCoreVTable *vTable = linphone_core_v_table_new();
|
||||
LinphoneCoreData* ldata = new LinphoneCoreData(env, thiz, vTable, jlistener, ljb);
|
||||
linphone_core_v_table_set_user_data(vTable, ldata);
|
||||
|
|
@ -1733,7 +1733,7 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_getProxyConfigLi
|
|||
}
|
||||
proxies = proxies->next;
|
||||
}
|
||||
|
||||
|
||||
return jProxies;
|
||||
}
|
||||
|
||||
|
|
@ -2318,7 +2318,7 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_getFriendList(JN
|
|||
}
|
||||
friends = friends->next;
|
||||
}
|
||||
|
||||
|
||||
return jFriends;
|
||||
}
|
||||
|
||||
|
|
@ -2338,7 +2338,7 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_getFriendLists(J
|
|||
}
|
||||
friends = friends->next;
|
||||
}
|
||||
|
||||
|
||||
return jFriends;
|
||||
}
|
||||
|
||||
|
|
@ -3608,7 +3608,7 @@ static void contact_created(LinphoneFriendList *list, LinphoneFriend *lf) {
|
|||
|
||||
LinphoneFriendListCbs *cbs = linphone_friend_list_get_callbacks(list);
|
||||
jobject listener = (jobject) linphone_friend_list_cbs_get_user_data(cbs);
|
||||
|
||||
|
||||
if (listener == NULL) {
|
||||
ms_error("contact_created() notification without listener");
|
||||
return ;
|
||||
|
|
@ -3635,7 +3635,7 @@ static void contact_updated(LinphoneFriendList *list, LinphoneFriend *lf_new, Li
|
|||
|
||||
LinphoneFriendListCbs *cbs = linphone_friend_list_get_callbacks(list);
|
||||
jobject listener = (jobject) linphone_friend_list_cbs_get_user_data(cbs);
|
||||
|
||||
|
||||
if (listener == NULL) {
|
||||
ms_error("contact_updated() notification without listener");
|
||||
return ;
|
||||
|
|
@ -3664,7 +3664,7 @@ static void contact_removed(LinphoneFriendList *list, LinphoneFriend *lf) {
|
|||
|
||||
LinphoneFriendListCbs *cbs = linphone_friend_list_get_callbacks(list);
|
||||
jobject listener = (jobject) linphone_friend_list_cbs_get_user_data(cbs);
|
||||
|
||||
|
||||
if (listener == NULL) {
|
||||
ms_error("contact_removed() notification without listener");
|
||||
return ;
|
||||
|
|
@ -3691,7 +3691,7 @@ static void sync_status_changed(LinphoneFriendList *list, LinphoneFriendListSync
|
|||
|
||||
LinphoneFriendListCbs *cbs = linphone_friend_list_get_callbacks(list);
|
||||
jobject listener = (jobject) linphone_friend_list_cbs_get_user_data(cbs);
|
||||
|
||||
|
||||
if (listener == NULL) {
|
||||
ms_error("sync_status_changed() notification without listener");
|
||||
return ;
|
||||
|
|
@ -3700,7 +3700,7 @@ static void sync_status_changed(LinphoneFriendList *list, LinphoneFriendListSync
|
|||
jmethodID method = env->GetMethodID(clazz, "onLinphoneFriendSyncStatusChanged","(Lorg/linphone/core/LinphoneFriendList;Lorg/linphone/core/LinphoneFriendList$State;Ljava/lang/String;)V");
|
||||
jobject jlist = getFriendList(env, list);
|
||||
env->DeleteLocalRef(clazz);
|
||||
|
||||
|
||||
LinphoneCore *lc = linphone_friend_list_get_core((LinphoneFriendList *)list);
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
jstring msg = message ? env->NewStringUTF(message) : NULL;
|
||||
|
|
@ -3831,7 +3831,7 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneFriendListImpl_getFriendL
|
|||
}
|
||||
friends = friends->next;
|
||||
}
|
||||
|
||||
|
||||
return jFriends;
|
||||
}
|
||||
|
||||
|
|
@ -4124,7 +4124,7 @@ extern "C" jobjectArray _LinphoneChatRoomImpl_getHistory(JNIEnv* env, jobject th
|
|||
bctbx_list_t *list = history;
|
||||
size_t historySize = bctbx_list_size(history);
|
||||
jobjectArray jHistory = env->NewObjectArray(historySize, ljb->chatMessageClass, NULL);
|
||||
|
||||
|
||||
for (size_t i = 0; i < historySize; i++) {
|
||||
LinphoneChatMessage *msg = (LinphoneChatMessage *)history->data;
|
||||
jobject jmsg = getChatMessage(env, msg);
|
||||
|
|
@ -4132,7 +4132,7 @@ extern "C" jobjectArray _LinphoneChatRoomImpl_getHistory(JNIEnv* env, jobject th
|
|||
env->SetObjectArrayElement(jHistory, i, jmsg);
|
||||
env->DeleteLocalRef(jmsg);
|
||||
}
|
||||
|
||||
|
||||
history = history->next;
|
||||
}
|
||||
/*getChatMessage() acquired a ref that is "transfered" to the java object. We must drop
|
||||
|
|
@ -4233,17 +4233,17 @@ extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_createFileTransferM
|
|||
|
||||
linphone_content_set_type(content, tmp = GetStringUTFChars(env, jtype));
|
||||
ReleaseStringUTFChars(env, jtype, tmp);
|
||||
|
||||
|
||||
linphone_content_set_subtype(content, tmp = GetStringUTFChars(env, jsubtype));
|
||||
ReleaseStringUTFChars(env, jsubtype, tmp);
|
||||
|
||||
|
||||
linphone_content_set_name(content, tmp = GetStringUTFChars(env, jname));
|
||||
ReleaseStringUTFChars(env, jname, tmp);
|
||||
|
||||
|
||||
linphone_content_set_size(content, data_size);
|
||||
|
||||
|
||||
message = linphone_chat_room_create_file_transfer_message((LinphoneChatRoom *)ptr, content);
|
||||
|
||||
|
||||
linphone_content_unref(content);
|
||||
|
||||
return (jlong) message;
|
||||
|
|
@ -4419,7 +4419,7 @@ static void message_state_changed(LinphoneChatMessage* msg, LinphoneChatMessageS
|
|||
}
|
||||
|
||||
jobject listener = (jobject) msg->message_state_changed_user_data;
|
||||
|
||||
|
||||
if (listener == NULL) {
|
||||
ms_error("message_state_changed() notification without listener");
|
||||
return ;
|
||||
|
|
@ -5462,7 +5462,7 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_tunnelGetServers
|
|||
const bctbx_list_t *servers = linphone_tunnel_get_servers(tunnel);
|
||||
const bctbx_list_t *it;
|
||||
int i;
|
||||
|
||||
|
||||
tunnelConfigArray = env->NewObjectArray(bctbx_list_size(servers), tunnelConfigClass, NULL);
|
||||
for(it = servers, i=0; it != NULL; it = it->next, i++) {
|
||||
LinphoneTunnelConfig *conf = (LinphoneTunnelConfig *)it->data;
|
||||
|
|
@ -5703,20 +5703,20 @@ static LinphoneContent *create_content_from_java_args(JNIEnv *env, LinphoneCore
|
|||
|
||||
linphone_content_set_type(content, tmp = GetStringUTFChars(env, jtype));
|
||||
ReleaseStringUTFChars(env, jtype, tmp);
|
||||
|
||||
|
||||
linphone_content_set_subtype(content, tmp = GetStringUTFChars(env, jsubtype));
|
||||
ReleaseStringUTFChars(env, jsubtype, tmp);
|
||||
|
||||
|
||||
if (jname){
|
||||
linphone_content_set_name(content, tmp = GetStringUTFChars(env, jname));
|
||||
ReleaseStringUTFChars(env, jname, tmp);
|
||||
}
|
||||
|
||||
|
||||
if (jencoding){
|
||||
linphone_content_set_encoding(content, tmp = GetStringUTFChars(env, jencoding));
|
||||
ReleaseStringUTFChars(env, jencoding, tmp);
|
||||
}
|
||||
|
||||
|
||||
linphone_content_set_buffer(content, data, env->GetArrayLength(jdata));
|
||||
env->ReleaseByteArrayElements(jdata,(jbyte*)data,JNI_ABORT);
|
||||
}
|
||||
|
|
@ -5737,7 +5737,7 @@ JNIEXPORT jobject JNICALL Java_org_linphone_core_LinphoneCoreImpl_subscribe(JNIE
|
|||
jobject jev=NULL;
|
||||
const char *evname = GetStringUTFChars(env, jevname);
|
||||
|
||||
|
||||
|
||||
ev=linphone_core_subscribe(lc,addr,evname,expires, content);
|
||||
if (content) linphone_content_unref(content);
|
||||
ReleaseStringUTFChars(env, jevname, evname);
|
||||
|
|
@ -6011,16 +6011,16 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneInfoMessageImpl_setContent
|
|||
LinphoneInfoMessage *infomsg = (LinphoneInfoMessage*) infoptr;
|
||||
LinphoneContent * content = linphone_content_new();
|
||||
const char *tmp;
|
||||
|
||||
|
||||
linphone_content_set_type(content, tmp = GetStringUTFChars(env, jtype));
|
||||
ReleaseStringUTFChars(env, jtype, tmp);
|
||||
|
||||
|
||||
linphone_content_set_type(content, tmp = GetStringUTFChars(env, jsubtype));
|
||||
ReleaseStringUTFChars(env, jsubtype, tmp);
|
||||
|
||||
|
||||
linphone_content_set_string_buffer(content, tmp = GetStringUTFChars(env, jdata));
|
||||
ReleaseStringUTFChars(env, jdata, tmp);
|
||||
|
||||
|
||||
linphone_info_message_set_content(infomsg, content);
|
||||
linphone_content_unref(content);
|
||||
}
|
||||
|
|
@ -6143,7 +6143,7 @@ JNIEXPORT jint JNICALL Java_org_linphone_core_LinphoneEventImpl_updatePublish(JN
|
|||
jtype, jsubtype, jdata, jencoding, NULL);
|
||||
LinphoneEvent *ev=(LinphoneEvent*)evptr;
|
||||
jint err;
|
||||
|
||||
|
||||
err=linphone_event_update_publish(ev, content);
|
||||
|
||||
if (content) linphone_content_unref(content);
|
||||
|
|
@ -6214,7 +6214,7 @@ JNIEXPORT jobject JNICALL Java_org_linphone_core_LinphoneCoreImpl_createSubscrib
|
|||
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneEventImpl_sendSubscribe(JNIEnv *env, jobject thiz, jlong eventptr, jstring jtype, jstring jsubtype, jbyteArray jdata, jstring jencoding) {
|
||||
LinphoneContent *content = create_content_from_java_args(env, linphone_event_get_core((LinphoneEvent*)eventptr),
|
||||
jtype, jsubtype, jdata, jencoding, NULL);
|
||||
|
||||
|
||||
linphone_event_send_subscribe((LinphoneEvent*) eventptr, content);
|
||||
if (content) linphone_content_unref(content);
|
||||
}
|
||||
|
|
@ -7383,7 +7383,7 @@ extern "C" jboolean JNICALL Java_org_linphone_core_LinphoneCoreImpl_videoMultica
|
|||
|
||||
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setDnsServers(JNIEnv *env, jobject thiz, jlong lc, jobjectArray servers){
|
||||
bctbx_list_t *l = NULL;
|
||||
|
||||
|
||||
if (servers != NULL){
|
||||
int count = env->GetArrayLength(servers);
|
||||
|
||||
|
|
@ -7723,7 +7723,7 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneConferenceImpl_getPartici
|
|||
jmethodID addr_constructor = env->GetMethodID(addr_class, "<init>", "(J)V");
|
||||
jobjectArray jaddr_list;
|
||||
int i;
|
||||
|
||||
|
||||
participants = linphone_conference_get_participants((LinphoneConference *)pconference);
|
||||
jaddr_list = env->NewObjectArray(bctbx_list_size(participants), addr_class, NULL);
|
||||
for(it=participants, i=0; it; it=bctbx_list_next(it), i++) {
|
||||
|
|
@ -7861,18 +7861,18 @@ static void xml_request_response(LinphoneXmlRpcRequest *request) {
|
|||
ms_error("cannot attach VM\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneXmlRpcRequestCbs *cbs = linphone_xml_rpc_request_get_callbacks(request);
|
||||
jobject listener = (jobject) linphone_xml_rpc_request_cbs_get_user_data(cbs);
|
||||
if (listener == NULL) {
|
||||
ms_error("xml_request_response() notification without listener");
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
jclass clazz = (jclass) env->GetObjectClass(listener);
|
||||
jmethodID method = env->GetMethodID(clazz, "onXmlRpcRequestResponse","(Lorg/linphone/core/LinphoneXmlRpcRequest;)V");
|
||||
env->DeleteLocalRef(clazz);
|
||||
|
||||
|
||||
env->CallVoidMethod(listener, method, getXmlRpcRequest(env, request));
|
||||
}
|
||||
|
||||
|
|
@ -7969,14 +7969,14 @@ static void account_creator_is_account_used(LinphoneAccountCreator *creator, Lin
|
|||
ms_error("account_creator_response() notification without listener");
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
LinphoneCore *lc = (LinphoneCore *)creator->core;
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
|
||||
|
||||
jclass clazz = (jclass) env->GetObjectClass(listener);
|
||||
jmethodID method = env->GetMethodID(clazz, "onAccountCreatorIsAccountUsed","(Lorg/linphone/core/LinphoneAccountCreator;Lorg/linphone/core/LinphoneAccountCreator$Status;)V");
|
||||
env->DeleteLocalRef(clazz);
|
||||
|
||||
|
||||
jobject statusObject = env->CallStaticObjectMethod(ljb->accountCreatorStatusClass, ljb->accountCreatorStatusFromIntId, (jint)status);
|
||||
env->CallVoidMethod(listener, method, getAccountCreator(env, creator), statusObject);
|
||||
}
|
||||
|
|
@ -7988,21 +7988,21 @@ static void account_creator_create_account(LinphoneAccountCreator *creator, Linp
|
|||
ms_error("cannot attach VM\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneAccountCreatorCbs *cbs = linphone_account_creator_get_callbacks(creator);
|
||||
jobject listener = (jobject) linphone_account_creator_cbs_get_user_data(cbs);
|
||||
if (listener == NULL) {
|
||||
ms_error("account_creator_response() notification without listener");
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
LinphoneCore *lc = (LinphoneCore *)creator->core;
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
|
||||
|
||||
jclass clazz = (jclass) env->GetObjectClass(listener);
|
||||
jmethodID method = env->GetMethodID(clazz, "onAccountCreatorAccountCreated","(Lorg/linphone/core/LinphoneAccountCreator;Lorg/linphone/core/LinphoneAccountCreator$Status;)V");
|
||||
env->DeleteLocalRef(clazz);
|
||||
|
||||
|
||||
jobject statusObject = env->CallStaticObjectMethod(ljb->accountCreatorStatusClass, ljb->accountCreatorStatusFromIntId, (jint)status);
|
||||
env->CallVoidMethod(listener, method, getAccountCreator(env, creator), statusObject);
|
||||
}
|
||||
|
|
@ -8014,21 +8014,21 @@ static void account_creator_activate_account(LinphoneAccountCreator *creator, Li
|
|||
ms_error("cannot attach VM\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneAccountCreatorCbs *cbs = linphone_account_creator_get_callbacks(creator);
|
||||
jobject listener = (jobject) linphone_account_creator_cbs_get_user_data(cbs);
|
||||
if (listener == NULL) {
|
||||
ms_error("account_creator_response() notification without listener");
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
LinphoneCore *lc = (LinphoneCore *)creator->core;
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
|
||||
|
||||
jclass clazz = (jclass) env->GetObjectClass(listener);
|
||||
jmethodID method = env->GetMethodID(clazz, "onAccountCreatorAccountActivated","(Lorg/linphone/core/LinphoneAccountCreator;Lorg/linphone/core/LinphoneAccountCreator$Status;)V");
|
||||
env->DeleteLocalRef(clazz);
|
||||
|
||||
|
||||
jobject statusObject = env->CallStaticObjectMethod(ljb->accountCreatorStatusClass, ljb->accountCreatorStatusFromIntId, (jint)status);
|
||||
env->CallVoidMethod(listener, method, getAccountCreator(env, creator), statusObject);
|
||||
}
|
||||
|
|
@ -8040,21 +8040,21 @@ static void account_creator_link_phone_number_with_account(LinphoneAccountCreato
|
|||
ms_error("cannot attach VM\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneAccountCreatorCbs *cbs = linphone_account_creator_get_callbacks(creator);
|
||||
jobject listener = (jobject) linphone_account_creator_cbs_get_user_data(cbs);
|
||||
if (listener == NULL) {
|
||||
ms_error("account_creator_response() notification without listener");
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
LinphoneCore *lc = (LinphoneCore *)creator->core;
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
|
||||
|
||||
jclass clazz = (jclass) env->GetObjectClass(listener);
|
||||
jmethodID method = env->GetMethodID(clazz, "onAccountCreatorAccountLinkedWithPhoneNumber","(Lorg/linphone/core/LinphoneAccountCreator;Lorg/linphone/core/LinphoneAccountCreator$Status;)V");
|
||||
env->DeleteLocalRef(clazz);
|
||||
|
||||
|
||||
jobject statusObject = env->CallStaticObjectMethod(ljb->accountCreatorStatusClass, ljb->accountCreatorStatusFromIntId, (jint)status);
|
||||
env->CallVoidMethod(listener, method, getAccountCreator(env, creator), statusObject);
|
||||
}
|
||||
|
|
@ -8092,21 +8092,47 @@ static void account_creator_is_account_linked(LinphoneAccountCreator *creator, L
|
|||
ms_error("cannot attach VM\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneAccountCreatorCbs *cbs = linphone_account_creator_get_callbacks(creator);
|
||||
jobject listener = (jobject) linphone_account_creator_cbs_get_user_data(cbs);
|
||||
if (listener == NULL) {
|
||||
ms_error("account_creator_response() notification without listener");
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
LinphoneCore *lc = (LinphoneCore *)creator->core;
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
|
||||
|
||||
jclass clazz = (jclass) env->GetObjectClass(listener);
|
||||
jmethodID method = env->GetMethodID(clazz, "onAccountCreatorIsAccountLinked","(Lorg/linphone/core/LinphoneAccountCreator;Lorg/linphone/core/LinphoneAccountCreator$Status;)V");
|
||||
env->DeleteLocalRef(clazz);
|
||||
|
||||
|
||||
jobject statusObject = env->CallStaticObjectMethod(ljb->accountCreatorStatusClass, ljb->accountCreatorStatusFromIntId, (jint)status);
|
||||
env->CallVoidMethod(listener, method, getAccountCreator(env, creator), statusObject);
|
||||
}
|
||||
|
||||
static void account_creator_is_phone_number_used(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status, const char *resp) {
|
||||
JNIEnv *env = 0;
|
||||
jint result = jvm->AttachCurrentThread(&env,NULL);
|
||||
if (result != 0) {
|
||||
ms_error("cannot attach VM\n");
|
||||
return;
|
||||
}
|
||||
|
||||
LinphoneAccountCreatorCbs *cbs = linphone_account_creator_get_callbacks(creator);
|
||||
jobject listener = (jobject) linphone_account_creator_cbs_get_user_data(cbs);
|
||||
if (listener == NULL) {
|
||||
ms_error("account_creator_response() notification without listener");
|
||||
return ;
|
||||
}
|
||||
|
||||
LinphoneCore *lc = (LinphoneCore *)creator->core;
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
|
||||
jclass clazz = (jclass) env->GetObjectClass(listener);
|
||||
jmethodID method = env->GetMethodID(clazz, "onAccountCreatorIsPhoneNumberUsed","(Lorg/linphone/core/LinphoneAccountCreator;Lorg/linphone/core/LinphoneAccountCreator$Status;)V");
|
||||
env->DeleteLocalRef(clazz);
|
||||
|
||||
jobject statusObject = env->CallStaticObjectMethod(ljb->accountCreatorStatusClass, ljb->accountCreatorStatusFromIntId, (jint)status);
|
||||
env->CallVoidMethod(listener, method, getAccountCreator(env, creator), statusObject);
|
||||
}
|
||||
|
|
@ -8118,21 +8144,21 @@ static void account_creator_is_account_activated(LinphoneAccountCreator *creator
|
|||
ms_error("cannot attach VM\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneAccountCreatorCbs *cbs = linphone_account_creator_get_callbacks(creator);
|
||||
jobject listener = (jobject) linphone_account_creator_cbs_get_user_data(cbs);
|
||||
if (listener == NULL) {
|
||||
ms_error("account_creator_response() notification without listener");
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
LinphoneCore *lc = (LinphoneCore *)creator->core;
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
|
||||
|
||||
jclass clazz = (jclass) env->GetObjectClass(listener);
|
||||
jmethodID method = env->GetMethodID(clazz, "onAccountCreatorIsAccountActivated","(Lorg/linphone/core/LinphoneAccountCreator;Lorg/linphone/core/LinphoneAccountCreator$Status;)V");
|
||||
env->DeleteLocalRef(clazz);
|
||||
|
||||
|
||||
jobject statusObject = env->CallStaticObjectMethod(ljb->accountCreatorStatusClass, ljb->accountCreatorStatusFromIntId, (jint)status);
|
||||
env->CallVoidMethod(listener, method, getAccountCreator(env, creator), statusObject);
|
||||
}
|
||||
|
|
@ -8144,21 +8170,21 @@ static void account_creator_phone_account_recovered(LinphoneAccountCreator *crea
|
|||
ms_error("cannot attach VM\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneAccountCreatorCbs *cbs = linphone_account_creator_get_callbacks(creator);
|
||||
jobject listener = (jobject) linphone_account_creator_cbs_get_user_data(cbs);
|
||||
if (listener == NULL) {
|
||||
ms_error("account_creator_response() notification without listener");
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
LinphoneCore *lc = (LinphoneCore *)creator->core;
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
|
||||
|
||||
jclass clazz = (jclass) env->GetObjectClass(listener);
|
||||
jmethodID method = env->GetMethodID(clazz, "onAccountCreatorPhoneAccountRecovered","(Lorg/linphone/core/LinphoneAccountCreator;Lorg/linphone/core/LinphoneAccountCreator$Status;)V");
|
||||
env->DeleteLocalRef(clazz);
|
||||
|
||||
|
||||
jobject statusObject = env->CallStaticObjectMethod(ljb->accountCreatorStatusClass, ljb->accountCreatorStatusFromIntId, (jint)status);
|
||||
env->CallVoidMethod(listener, method, getAccountCreator(env, creator), statusObject);
|
||||
}
|
||||
|
|
@ -8346,6 +8372,11 @@ extern "C" jint Java_org_linphone_core_LinphoneAccountCreatorImpl_isAccountLinke
|
|||
return (jint) linphone_account_creator_is_account_linked(account_creator);
|
||||
}
|
||||
|
||||
extern "C" jint Java_org_linphone_core_LinphoneAccountCreatorImpl_isPhoneNumberUsed(JNIEnv *env, jobject thiz, jlong ptr) {
|
||||
LinphoneAccountCreator *account_creator = (LinphoneAccountCreator *)ptr;
|
||||
return (jint) linphone_account_creator_is_phone_number_used(account_creator);
|
||||
}
|
||||
|
||||
extern "C" jint Java_org_linphone_core_LinphoneAccountCreatorImpl_isAccountActivated(JNIEnv *env, jobject thiz, jlong ptr) {
|
||||
LinphoneAccountCreator *account_creator = (LinphoneAccountCreator *)ptr;
|
||||
return (jint) linphone_account_creator_is_account_activated(account_creator);
|
||||
|
|
@ -8433,4 +8464,4 @@ extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getTlsKeyPath(JNIEnv
|
|||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ void linphone_friend_list_subscription_state_changed(LinphoneCore *lc, LinphoneE
|
|||
void _linphone_friend_list_release(LinphoneFriendList *list);
|
||||
/*get rls either from list or core if any*/
|
||||
const LinphoneAddress * _linphone_friend_list_get_rls_address(const LinphoneFriendList *list);
|
||||
|
||||
|
||||
void linphone_friend_invalidate_subscription(LinphoneFriend *lf);
|
||||
void linphone_friend_close_subscriptions(LinphoneFriend *lf);
|
||||
void _linphone_friend_release(LinphoneFriend *lf);
|
||||
|
|
@ -1018,7 +1018,7 @@ struct _LinphoneCore
|
|||
bool_t send_call_stats_periodical_updates;
|
||||
bool_t forced_ice_relay;
|
||||
bool_t short_turn_refresh;
|
||||
|
||||
|
||||
char localip[LINPHONE_IPADDR_SIZE];
|
||||
int device_rotation;
|
||||
int max_calls;
|
||||
|
|
@ -1058,14 +1058,14 @@ struct _LinphoneCore
|
|||
jmethodID multicast_lock_release_id;
|
||||
#endif
|
||||
LinphoneVcardContext *vcard_context;
|
||||
|
||||
|
||||
/*for tests only*/
|
||||
bool_t zrtp_not_available_simulation;
|
||||
|
||||
|
||||
/* string for TLS auth instead of path to files */
|
||||
char *tls_cert;
|
||||
char *tls_key;
|
||||
|
||||
|
||||
/*default resource list server*/
|
||||
LinphoneAddress *default_rls_addr;
|
||||
};
|
||||
|
|
@ -1175,7 +1175,7 @@ void _linphone_core_codec_config_write(LinphoneCore *lc);
|
|||
#define LINPHONE_MAX_CALL_HISTORY_UNLIMITED (-1)
|
||||
#ifndef LINPHONE_MAX_CALL_HISTORY_SIZE
|
||||
#ifdef SQLITE_STORAGE_ENABLED
|
||||
#define LINPHONE_MAX_CALL_HISTORY_SIZE LINPHONE_MAX_CALL_HISTORY_UNLIMITED
|
||||
#define LINPHONE_MAX_CALL_HISTORY_SIZE LINPHONE_MAX_CALL_HISTORY_UNLIMITED
|
||||
#else
|
||||
#define LINPHONE_MAX_CALL_HISTORY_SIZE 30
|
||||
#endif
|
||||
|
|
@ -1334,7 +1334,7 @@ struct _LinphoneAccountCreatorCbs {
|
|||
LinphoneAccountCreatorCbsStatusCb create_account;
|
||||
LinphoneAccountCreatorCbsStatusCb activate_account;
|
||||
LinphoneAccountCreatorCbsStatusCb is_account_activated;
|
||||
|
||||
LinphoneAccountCreatorCbsStatusCb is_phone_number_used;
|
||||
LinphoneAccountCreatorCbsStatusCb link_phone_number_with_account;
|
||||
LinphoneAccountCreatorCbsStatusCb activate_phone_number_link;
|
||||
LinphoneAccountCreatorCbsStatusCb recover_phone_account;
|
||||
|
|
|
|||
|
|
@ -31,8 +31,9 @@ public interface LinphoneAccountCreator {
|
|||
void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, Status status);
|
||||
void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, Status status);
|
||||
void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, Status status);
|
||||
void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, Status status);
|
||||
}
|
||||
|
||||
|
||||
public static class Status {
|
||||
static private Vector<Status> values = new Vector<Status>();
|
||||
private final int mValue;
|
||||
|
|
@ -59,20 +60,22 @@ public interface LinphoneAccountCreator {
|
|||
public final static Status PhoneNumberInvalid = new Status(17, "PhoneNumberInvalid");
|
||||
public final static Status PhoneNumberTooShort = new Status(18, "PhoneNumberTooShort");
|
||||
public final static Status PhoneNumberTooLong = new Status(19, "PhoneNumberTooLong");
|
||||
public final static Status PasswordTooShort = new Status(20, "PasswordTooShort");
|
||||
public final static Status PasswordTooLong = new Status(21, "PasswordTooLong");
|
||||
public final static Status DomainInvalid = new Status(22, "DomainInvalid");
|
||||
public final static Status RouteInvalid = new Status(23, "RouteInvalid");
|
||||
public final static Status DisplayNameInvalid = new Status(24, "DisplayNameInvalid");
|
||||
public final static Status TransportNotSupported = new Status(25, "TransportNotSupported");
|
||||
public final static Status CountryCodeInvalid = new Status(26, "CountryCodeInvalid");
|
||||
|
||||
public final static Status PhoneNumberUsed = new Status(20, "PhoneNumberUsed");
|
||||
public final static Status PhoneNumberNotUsed = new Status(21, "PhoneNumberNotUsed");
|
||||
public final static Status PasswordTooShort = new Status(22, "PasswordTooShort");
|
||||
public final static Status PasswordTooLong = new Status(23, "PasswordTooLong");
|
||||
public final static Status DomainInvalid = new Status(24, "DomainInvalid");
|
||||
public final static Status RouteInvalid = new Status(25, "RouteInvalid");
|
||||
public final static Status DisplayNameInvalid = new Status(26, "DisplayNameInvalid");
|
||||
public final static Status TransportNotSupported = new Status(27, "TransportNotSupported");
|
||||
public final static Status CountryCodeInvalid = new Status(28, "CountryCodeInvalid");
|
||||
|
||||
private Status(int value, String stringValue) {
|
||||
mValue = value;
|
||||
values.addElement(this);
|
||||
mStringValue = stringValue;
|
||||
}
|
||||
|
||||
|
||||
public static Status fromInt(int value) {
|
||||
for (int i=0; i < values.size(); i++) {
|
||||
Status state = (Status) values.elementAt(i);
|
||||
|
|
@ -80,71 +83,73 @@ public interface LinphoneAccountCreator {
|
|||
}
|
||||
throw new RuntimeException("Status not found [" + value + "]");
|
||||
}
|
||||
|
||||
|
||||
public String toString() {
|
||||
return mStringValue;
|
||||
}
|
||||
|
||||
|
||||
public int toInt() {
|
||||
return mValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void setListener(LinphoneAccountCreatorListener listener);
|
||||
|
||||
|
||||
Status setUsername(String username);
|
||||
|
||||
|
||||
String getUsername();
|
||||
|
||||
|
||||
Status setPhoneNumber(String phoneNumber, String countryCode);
|
||||
|
||||
|
||||
String getPhoneNumber();
|
||||
|
||||
|
||||
Status setPassword(String password);
|
||||
|
||||
|
||||
String getPassword();
|
||||
|
||||
Status setHa1(String ha1);
|
||||
|
||||
String getHa1();
|
||||
|
||||
|
||||
Status setActivationCode(String activationCode);
|
||||
|
||||
|
||||
Status setTransport(TransportType transport);
|
||||
|
||||
|
||||
TransportType getTransport();
|
||||
|
||||
|
||||
Status setDomain(String domain);
|
||||
|
||||
|
||||
String getDomain();
|
||||
|
||||
|
||||
Status setRoute(String route);
|
||||
|
||||
|
||||
String getRoute();
|
||||
|
||||
|
||||
Status setDisplayName(String displayName);
|
||||
|
||||
|
||||
String getDisplayName();
|
||||
|
||||
|
||||
Status setEmail(String email);
|
||||
|
||||
|
||||
String getEmail();
|
||||
|
||||
|
||||
Status isAccountUsed();
|
||||
|
||||
|
||||
Status createAccount();
|
||||
|
||||
|
||||
Status activateAccount();
|
||||
|
||||
|
||||
Status isAccountActivated();
|
||||
|
||||
|
||||
Status linkPhoneNumberWithAccount();
|
||||
|
||||
|
||||
Status activatePhoneNumberLink();
|
||||
|
||||
Status isAccountLinked();
|
||||
|
||||
Status isPhoneNumberUsed();
|
||||
|
||||
Status recoverPhoneAccount();
|
||||
|
||||
|
||||
LinphoneProxyConfig configure();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,16 +21,16 @@ import org.linphone.core.LinphoneAddress.TransportType;
|
|||
|
||||
public class LinphoneAccountCreatorImpl implements LinphoneAccountCreator {
|
||||
protected long nativePtr;
|
||||
|
||||
|
||||
protected LinphoneAccountCreatorImpl(long aNativePtr) {
|
||||
nativePtr = aNativePtr;
|
||||
}
|
||||
|
||||
|
||||
private native long newLinphoneAccountCreator(long lc, String url);
|
||||
public LinphoneAccountCreatorImpl(LinphoneCore lc, String url) {
|
||||
nativePtr = newLinphoneAccountCreator(((LinphoneCoreImpl)lc).nativePtr, url);
|
||||
}
|
||||
|
||||
|
||||
public long getNativePtr() {
|
||||
return nativePtr;
|
||||
}
|
||||
|
|
@ -45,7 +45,7 @@ public class LinphoneAccountCreatorImpl implements LinphoneAccountCreator {
|
|||
public void setListener(LinphoneAccountCreatorListener listener) {
|
||||
setListener(nativePtr, listener);
|
||||
}
|
||||
|
||||
|
||||
private native int setUsername(long ptr, String username);
|
||||
@Override
|
||||
public Status setUsername(String username) {
|
||||
|
|
@ -141,7 +141,7 @@ public class LinphoneAccountCreatorImpl implements LinphoneAccountCreator {
|
|||
public Status setDisplayName(String displayName) {
|
||||
return Status.fromInt(setDisplayName(nativePtr, displayName));
|
||||
}
|
||||
|
||||
|
||||
private native String getDisplayName(long ptr);
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
|
|
@ -159,19 +159,19 @@ public class LinphoneAccountCreatorImpl implements LinphoneAccountCreator {
|
|||
public String getEmail() {
|
||||
return getEmail(nativePtr);
|
||||
}
|
||||
|
||||
|
||||
private native int isAccountUsed(long ptr);
|
||||
@Override
|
||||
public Status isAccountUsed() {
|
||||
return Status.fromInt(isAccountUsed(nativePtr));
|
||||
}
|
||||
|
||||
|
||||
private native int createAccount(long ptr);
|
||||
@Override
|
||||
public Status createAccount() {
|
||||
return Status.fromInt(createAccount(nativePtr));
|
||||
}
|
||||
|
||||
|
||||
private native int activateAccount(long ptr);
|
||||
@Override
|
||||
public Status activateAccount() {
|
||||
|
|
@ -183,31 +183,37 @@ public class LinphoneAccountCreatorImpl implements LinphoneAccountCreator {
|
|||
public Status isAccountLinked() {
|
||||
return Status.fromInt(isAccountLinked(nativePtr));
|
||||
}
|
||||
|
||||
|
||||
private native int isPhoneNumberUsed(long ptr);
|
||||
@Override
|
||||
public Status isPhoneNumberUsed() {
|
||||
return Status.fromInt(isPhoneNumberUsed(nativePtr));
|
||||
}
|
||||
|
||||
private native int isAccountActivated(long ptr);
|
||||
@Override
|
||||
public Status isAccountActivated() {
|
||||
return Status.fromInt(isAccountActivated(nativePtr));
|
||||
}
|
||||
|
||||
|
||||
private native int linkPhoneNumberWithAccount(long ptr);
|
||||
@Override
|
||||
public Status linkPhoneNumberWithAccount() {
|
||||
return Status.fromInt(linkPhoneNumberWithAccount(nativePtr));
|
||||
}
|
||||
|
||||
|
||||
private native int activatePhoneNumberLink(long ptr);
|
||||
@Override
|
||||
public Status activatePhoneNumberLink() {
|
||||
return Status.fromInt(activatePhoneNumberLink(nativePtr));
|
||||
}
|
||||
|
||||
|
||||
private native int recoverPhoneAccount(long ptr);
|
||||
@Override
|
||||
public Status recoverPhoneAccount() {
|
||||
return Status.fromInt(recoverPhoneAccount(nativePtr));
|
||||
}
|
||||
|
||||
|
||||
private native LinphoneProxyConfig configure(long ptr);
|
||||
@Override
|
||||
public LinphoneProxyConfig configure() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue