Feature 4 layer location

This commit is contained in:
刘学利
2022-02-10 02:46:49 +00:00
parent 267cfaa09a
commit d5ef785cb9
5 changed files with 52 additions and 27 deletions

View File

@@ -233,17 +233,25 @@ static int set_location(struct TLD_handle_t *_handle, struct streaminfo *a_strea
char buff[1024]={0};
int buff_len=sizeof(buff);
if(location_info!=NULL)
if(location_info==NULL)
{
len+=string_cat(buff+len, buff_len-len, location_info->city_full);
buff[len++]=',';
len+=string_cat(buff+len, buff_len-len, location_info->province_full);
buff[len++]=',';
len+=string_cat(buff+len, buff_len-len, location_info->country_full);
TLD_append(_handle, field_name, (void *)buff, TLD_TYPE_STRING);
return 0;
}
len+=string_cat(buff+len, buff_len-len, location_info->country_full);
buff[len++]='.';
len+=string_cat(buff+len, buff_len-len, location_info->province_full);
buff[len++]='.';
len+=string_cat(buff+len, buff_len-len, location_info->city_full);
if(location_info->subdivision_addr!=NULL)
{
buff[len++]='.';
len+=string_cat(buff+len, buff_len-len, location_info->subdivision_addr);
}
TLD_append(_handle, field_name, (void *)buff, TLD_TYPE_STRING);
return 1;
}