diff options
author | glerch <guido.lerch@gmail.com> | 2015-09-07 20:48:45 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-09-07 17:42:57 -0700 |
commit | e77d9cbd556570d06c421b1a018cadae7c2d6aa6 (patch) | |
tree | 06f671af9925188ddcfbc7a9d4ecb825a17a5800 /uemis-downloader.c | |
parent | bc3a2ff89b8143d253f66b852bf5521911371428 (diff) | |
download | subsurface-e77d9cbd556570d06c421b1a018cadae7c2d6aa6.tar.gz |
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 <guido.lerch@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'uemis-downloader.c')
-rw-r--r-- | uemis-downloader.c | 16 |
1 files 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, ","); } } |