summaryrefslogtreecommitdiff
path: root/ticket.c
diff options
context:
space:
mode:
authorꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-10-01 15:48:59 +0800
committerꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-10-01 15:48:59 +0800
commit8a5a9bc8101c13545f6ffe607cf8e6201c706ffc (patch)
tree673acb50cb421b270abde1839d01ecf8f570ad82 /ticket.c
parent7dcc8142197639a0cbffd75a6ef92a1c9764f1a7 (diff)
Handle every new line in content
Character '#' is not handled yet.
Diffstat (limited to 'ticket.c')
-rw-r--r--ticket.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/ticket.c b/ticket.c
index 0f39f2f..63e037c 100644
--- a/ticket.c
+++ b/ticket.c
@@ -157,9 +157,24 @@ static size_t history_handler(void *contents, size_t size, size_t nmemb
ticket_history->content
= malloc(strlen(token));
strcpy(ticket_history->content, ++token);
-#ifdef DEBUG
- printf("Content: %s\n", token);
-#endif
+ while ((line = strtok_r(NULL, "\n"
+ , &linesaveptr))) {
+ if (!strncmp(line, "Creator", 7))
+ break;
+ char *ptr = realloc(ticket_history
+ ->content
+ , strlen
+ (ticket_history
+ ->content)
+ + strlen(line)
+ + 2);
+ ticket_history->content = ptr;
+ sprintf(ticket_history->content
+ , "%s\n%s"
+ , ticket_history
+ ->content
+ , line);
+ }
} else if (!strcmp(token, "Creator")) {
token = strtok_r(NULL, ":", &tokensaveptr);
ticket_history->creator