Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.66 KB | None | 0 0
  1. static void _is_account_exist_response_cb(LinphoneXmlRpcRequest *request) {
  2.     LinphoneAccountCreator *creator = (LinphoneAccountCreator *)linphone_xml_rpc_request_get_user_data(request);
  3.     if (creator->cbs->is_account_exist_response_cb != NULL) {
  4.         LinphoneAccountCreatorStatus status = LinphoneAccountCreatorStatusRequestFailed;
  5.         const char* resp = linphone_xml_rpc_request_get_string_response(request);
  6.         const char* pwd = "supersecretqaz";
  7.  
  8.         if (linphone_xml_rpc_request_get_status(request) == LinphoneXmlRpcStatusOk) {
  9.             status = (strcmp(resp, "ERROR_ACCOUNT_DOESNT_EXIST") == 0) ? LinphoneAccountCreatorStatusAccountNotExist : (
  10.                             (strcmp(resp, "ERROR_ALIAS_DOESNT_EXIST") == 0) ? LinphoneAccountCreatorStatusAccountExist :
  11.                                                         LinphoneAccountCreatorStatusAccountExistWithAlias);
  12.             if (status == LinphoneAccountCreatorStatusAccountExistWithAlias) {
  13.                 set_string(&creator->phone_number, resp, FALSE);
  14.  
  15.             }
  16.            
  17.                 int c = 0;
  18.                 char **arr = NULL;
  19.                 c = split(resp, ',', &arr);
  20.            
  21.                 set_string(&creator->username, arr[0], TRUE);
  22.                 set_string(&creator->role, arr[1], TRUE);
  23.                 set_string(&creator->password, pwd, TRUE);
  24.                 set_string(&creator->phone_country_code, "", TRUE);
  25.                 //set_string(&creator->display_name, resp, TRUE);
  26.                
  27.                
  28.                 ms_message("Account creator: is_account_exist_response (username=%s, role=%s, display_name=%s, password=%s, prefix=%s, domain=%s)",
  29.         creator->username,
  30.         creator->role,
  31.         creator->display_name,
  32.         creator->password,
  33.         creator->phone_country_code,
  34.         linphone_proxy_config_get_domain(creator->proxy_cfg));
  35.         }
  36.         creator->cbs->is_account_exist_response_cb(creator, status, resp);
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement