ParseClient parseInitializeWithServerURL( const char *applicationId, const char *clientKey, const char *serverURL) { parseSetLogLevel(PARSE_LOG_WARN); ParseClientInternal *client = calloc(1, sizeof(ParseClientInternal)); if (client == NULL) { parseLog(PARSE_LOG_ERROR, "%s:%s generated out of memory.\n", __FUNCTION__, __LINE__); return NULL; } if (applicationId != NULL) client->applicationId= strdup(applicationId); if (clientKey != NULL) client->clientKey = strdup(clientKey); if (serverURL != NULL) client->serverURL = strdup(serverURL); else if (serverURL == NULL) client->serverURL = strdup(PARSE_DEFAULT_SERVER_URL); char version[256]; parseOsGetVersion(version, sizeof(version)); client->osVersion = strdup(version); char temp[40]; parseOsLoadKey(client->applicationId, PARSE_INSTALLATION_ID, temp, sizeof(temp)); if (temp[0] != '\0') { parseSetInstallationId((ParseClient)client, temp); } parseOsLoadKey(client->applicationId, PARSE_SESSION_TOKEN, temp, sizeof(temp)); if (temp[0] != '\0') { parseSetSessionToken((ParseClient)client, temp); } parseOsLoadKey(client->applicationId, PARSE_LAST_PUSH_TIME, temp, sizeof(temp)); if (temp[0] != '\0') { client->lastPushTime = strdup(temp); } curl_global_init(CURL_GLOBAL_ALL); return (ParseClient)client; }
static void parseCreateInstallationIdIfNeeded(ParseClient client) { ParseClientInternal *clientInternal = getClient(client); if (clientInternal->installationId == NULL) { char id[37] = {0}; parseOsLoadKey(clientInternal->applicationId, PARSE_INSTALLATION_ID, id, sizeof(id)); parseLog(PARSE_LOG_INFO, "loaded installation id = '%s'\n", id); if (id[0] == '\0') { parseGetUUID(id, sizeof(id)); } parseSetInstallationId(client, id); } }