From e77d9cbd556570d06c421b1a018cadae7c2d6aa6 Mon Sep 17 00:00:00 2001 From: glerch Date: Mon, 7 Sep 2015 20:48:45 +0200 Subject: [PATCH] Uemis downloader: multiple buddy support - changed the uemis_add_string to support a delimiter in parameter 3 - passing each nickname to the parse_tag function appending dive->buddy with concatentated nicknames separaed by comma Signed-off-by: glerch Signed-off-by: Dirk Hohndel --- uemis-downloader.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/uemis-downloader.c b/uemis-downloader.c index 0cb0f9fe4..325b3f2ab 100644 --- a/uemis-downloader.c +++ b/uemis-downloader.c @@ -99,7 +99,7 @@ static void uemis_get_index(char *buffer, int *idx) } /* space separated */ -static void uemis_add_string(const char *buffer, char **text) +static void uemis_add_string(const char *buffer, char **text, const char *delimit) { /* do nothing if this is an empty buffer (Uemis sometimes returns a single * space for empty buffers) */ @@ -110,7 +110,7 @@ static void uemis_add_string(const char *buffer, char **text) } else { char *buf = malloc(strlen(buffer) + strlen(*text) + 2); strcpy(buf, *text); - strcat(buf, " "); + strcat(buf, delimit); strcat(buf, buffer); free(*text); *text = buf; @@ -721,18 +721,18 @@ static void parse_tag(struct dive *dive, char *tag, char *val) } else if (!strcmp(tag, "f32Weight")) { uemis_get_weight(val, &dive->weightsystem[0], dive->dc.diveid); } else if (!strcmp(tag, "notes")) { - uemis_add_string(val, &dive->notes); + uemis_add_string(val, &dive->notes , " "); } else if (!strcmp(tag, "u8DiveSuit")) { if (*suit[atoi(val)]) - uemis_add_string(translate("gettextFromC", suit[atoi(val)]), &dive->suit); + uemis_add_string(translate("gettextFromC", suit[atoi(val)]), &dive->suit, " "); } else if (!strcmp(tag, "u8DiveSuitType")) { if (*suit_type[atoi(val)]) - uemis_add_string(translate("gettextFromC", suit_type[atoi(val)]), &dive->suit); + uemis_add_string(translate("gettextFromC", suit_type[atoi(val)]), &dive->suit, " "); } else if (!strcmp(tag, "u8SuitThickness")) { if (*suit_thickness[atoi(val)]) - uemis_add_string(translate("gettextFromC", suit_thickness[atoi(val)]), &dive->suit); - } else if (!strcmp(tag, "dive_no")) { - dive->number = atoi(val); + uemis_add_string(translate("gettextFromC", suit_thickness[atoi(val)]), &dive->suit, " "); + } else if (!strcmp(tag, "nickname")) { + uemis_add_string(val, &dive->buddy, ","); } }