Added support for newlines in TEXT command.

This commit is contained in:
Jason Watkins
2015-04-08 09:04:33 -07:00
parent f8372f6f4d
commit c3e284fc02
5 changed files with 48 additions and 36 deletions

View File

@@ -507,19 +507,19 @@ int handleTEXT(char *buf, int len)
updateLog("[TEXT] ERROR: Length less than 14 bytes", 39);
return -1;
}
int msgLen = buf[13];
size_t msgLen = (unsigned char)buf[13];
if (msgLen == 0)
{
updateLog("[TEXT] Text cleared", 19);
XPCClearMessage();
updateLog("[TEXT] Text cleared", 19);
}
else
{
updateLog("[TEXT] Text set", 15);
int x = *((int*)(buf + 5));
int y = *((int*)(buf + 9));
strncpy(msg, buf + 14, msgLen);
XPCSetMessage(x, y, msg);
updateLog("[TEXT] Text set", 15);
}
return 0;
}