Commit d6fc5e8a authored by jehan's avatar jehan
Browse files

fix presence id generation

parent e41203a4
...@@ -717,7 +717,7 @@ static void sip_config_read(LinphoneCore *lc) ...@@ -717,7 +717,7 @@ static void sip_config_read(LinphoneCore *lc)
/* get proxies config */ /* get proxies config */
for(i=0;; i++){ for(i=0;; i++){
LinphoneProxyConfig *cfg=linphone_proxy_config_new_from_config_file(lc->config,i); LinphoneProxyConfig *cfg=linphone_proxy_config_new_from_config_file(lc,i);
if (cfg!=NULL){ if (cfg!=NULL){
linphone_core_add_proxy_config(lc,cfg); linphone_core_add_proxy_config(lc,cfg);
}else{ }else{
......
...@@ -81,15 +81,17 @@ static const char *person_prefix = "/pidf:presence/dm:person"; ...@@ -81,15 +81,17 @@ static const char *person_prefix = "/pidf:presence/dm:person";
/***************************************************************************** /*****************************************************************************
* PRIVATE FUNCTIONS * * PRIVATE FUNCTIONS *
****************************************************************************/ ****************************************************************************/
/*defined in http://www.w3.org/TR/REC-xml/*/
static char presence_id_valid_characters[] = "0123456789abcdefghijklmnopqrstuvwxyz"; static char presence_id_valid_characters[] = "0123456789abcdefghijklmnopqrstuvwxyz-.";
/*NameStartChar (NameChar)**/
static char presence_id_valid_start_characters[] = ":_abcdefghijklmnopqrstuvwxyz";
static char * generate_presence_id(void) { static char * generate_presence_id(void) {
char id[7]; char id[7];
int i; int i;
id[0] = presence_id_valid_start_characters[random() % (sizeof(presence_id_valid_start_characters)-1)];
for (i = 0; i < 6; i++) { for (i = 1; i < 6; i++) {
id[i] = presence_id_valid_characters[random() % sizeof(presence_id_valid_characters)]; id[i] = presence_id_valid_characters[random() % (sizeof(presence_id_valid_characters)-1)];
} }
id[6] = '\0'; id[6] = '\0';
......
...@@ -360,7 +360,7 @@ LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const L ...@@ -360,7 +360,7 @@ LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const L
const char *linphone_core_find_best_identity(LinphoneCore *lc, const LinphoneAddress *to); const char *linphone_core_find_best_identity(LinphoneCore *lc, const LinphoneAddress *to);
int linphone_core_get_local_ip_for(int type, const char *dest, char *result); int linphone_core_get_local_ip_for(int type, const char *dest, char *result);
LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(struct _LpConfig *config, int index); LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LinphoneCore *lc, int index);
void linphone_proxy_config_write_to_config_file(struct _LpConfig* config,LinphoneProxyConfig *obj, int index); void linphone_proxy_config_write_to_config_file(struct _LpConfig* config,LinphoneProxyConfig *obj, int index);
int linphone_proxy_config_normalize_number(LinphoneProxyConfig *cfg, const char *username, char *result, size_t result_len); int linphone_proxy_config_normalize_number(LinphoneProxyConfig *cfg, const char *username, char *result, size_t result_len);
......
...@@ -1211,7 +1211,7 @@ void linphone_proxy_config_write_to_config_file(LpConfig *config, LinphoneProxyC ...@@ -1211,7 +1211,7 @@ void linphone_proxy_config_write_to_config_file(LpConfig *config, LinphoneProxyC
LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LpConfig *config, int index) LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LinphoneCore* lc, int index)
{ {
const char *tmp; const char *tmp;
const char *identity; const char *identity;
...@@ -1219,6 +1219,7 @@ LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LpConfig *config ...@@ -1219,6 +1219,7 @@ LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LpConfig *config
LinphoneProxyConfig *cfg; LinphoneProxyConfig *cfg;
char key[50]; char key[50];
int interval; int interval;
LpConfig *config=lc->config;
sprintf(key,"proxy_%i",index); sprintf(key,"proxy_%i",index);
...@@ -1226,7 +1227,7 @@ LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LpConfig *config ...@@ -1226,7 +1227,7 @@ LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LpConfig *config
return NULL; return NULL;
} }
cfg=linphone_proxy_config_new(); cfg=linphone_core_create_proxy_config(lc);
identity=lp_config_get_string(config,key,"reg_identity",NULL); identity=lp_config_get_string(config,key,"reg_identity",NULL);
proxy=lp_config_get_string(config,key,"reg_proxy",NULL); proxy=lp_config_get_string(config,key,"reg_proxy",NULL);
......
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