mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 16:22:35 +01:00
msgbuf: do a better job of handling gotchas with parsing tags
This commit is contained in:
parent
c84003aeb5
commit
08006c16f8
1 changed files with 12 additions and 5 deletions
|
@ -43,7 +43,7 @@ msgbuf_parse(struct MsgBuf *msgbuf, char *line)
|
|||
|
||||
if (*ch == '@')
|
||||
{
|
||||
char *t = ch++;
|
||||
char *t = ch + 1;
|
||||
|
||||
ch = strchr(ch, ' ');
|
||||
if (ch != NULL)
|
||||
|
@ -54,21 +54,28 @@ msgbuf_parse(struct MsgBuf *msgbuf, char *line)
|
|||
char *eq = strchr(t, '=');
|
||||
|
||||
if (next != NULL)
|
||||
{
|
||||
*next = '\0';
|
||||
|
||||
if (eq > next)
|
||||
eq = NULL;
|
||||
}
|
||||
|
||||
if (eq != NULL)
|
||||
*eq = '\0';
|
||||
*eq++ = '\0';
|
||||
|
||||
if (*t && *t != ' ')
|
||||
msgbuf_append_tag(msgbuf, t, eq);
|
||||
else
|
||||
break;
|
||||
|
||||
if (next != NULL)
|
||||
t = next + 1;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
*ch++ = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue