use 0x01 for seps in labels string so users can use pipe if they want to

This commit is contained in:
2017-08-05 23:56:35 +02:00
parent 4551ad6dbe
commit 0b3cfe0e74
6 changed files with 10 additions and 17 deletions
+4 -12
View File
@@ -22,24 +22,16 @@ httpd_cgi_state ICACHE_FLASH_ATTR tplScreen(HttpdConnData *connData, char *token
return HTTPD_CGI_DONE;
}
char buff[100];
char buff2[10];
char buff[150];
if (streq(token, "term_title")) {
httpdSend(connData, termconf_scratch.title, -1);
if (streq(token, "labels_seq")) {
screenSerializeLabelsToBuffer(buff, 150);
httpdSend(connData, buff, -1);
}
else if (streq(token, "theme")) {
sprintf(buff, "%d", termconf->theme);
httpdSend(connData, buff, -1);
}
else {
for (int i = 1; i <= 5; i++) {
sprintf(buff2, "btn%d", i);
if (streq(token, buff2)) {
httpdSend(connData, termconf_scratch.btn[i-1], -1);
}
}
}
return HTTPD_CGI_DONE;
}
+1 -1
View File
@@ -683,7 +683,7 @@ void ICACHE_FLASH_ATTR
screenSerializeLabelsToBuffer(char *buffer, size_t buf_len)
{
// let's just assume it's long enough - called with the huge websocket buffer
sprintf(buffer, "T%s|%s|%s|%s|%s|%s",
sprintf(buffer, "T%s\x01%s\x01%s\x01%s\x01%s\x01%s", // use 0x01 as separator
termconf_scratch.title,
termconf_scratch.btn[0],
termconf_scratch.btn[1],