Have rawlog properly handle newlines
This is most noticable with /cycle or the missing USER command on connect.
This commit is contained in:
parent
25d0793766
commit
26cefd0587
|
@ -154,20 +154,29 @@ open_rawlog (struct server *serv)
|
||||||
void
|
void
|
||||||
fe_add_rawlog (server *serv, char *text, int len, int outbound)
|
fe_add_rawlog (server *serv, char *text, int len, int outbound)
|
||||||
{
|
{
|
||||||
|
char **split_text;
|
||||||
char *new_text;
|
char *new_text;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (!serv->gui->rawlog_window)
|
if (!serv->gui->rawlog_window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
new_text = malloc (len + 7);
|
split_text = g_strsplit (text, "\r\n", 0);
|
||||||
|
|
||||||
len = sprintf (new_text, "\0033>>\017 %s", text);
|
for (i = 0; i < g_strv_length (split_text); i++)
|
||||||
if (outbound)
|
|
||||||
{
|
{
|
||||||
new_text[1] = '4';
|
if (split_text[i][0] == 0)
|
||||||
new_text[2] = '<';
|
break;
|
||||||
new_text[3] = '<';
|
|
||||||
|
if (outbound)
|
||||||
|
new_text = g_strconcat ("\0034<<\017 ", split_text[i], NULL);
|
||||||
|
else
|
||||||
|
new_text = g_strconcat ("\0033>>\017 ", split_text[i], NULL);
|
||||||
|
|
||||||
|
gtk_xtext_append (GTK_XTEXT (serv->gui->rawlog_textlist)->buffer, new_text, strlen (new_text));
|
||||||
|
|
||||||
|
g_free (new_text);
|
||||||
}
|
}
|
||||||
gtk_xtext_append (GTK_XTEXT (serv->gui->rawlog_textlist)->buffer, new_text, len);
|
|
||||||
free (new_text);
|
g_strfreev (split_text);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue