mirror of
https://github.com/moparisthebest/hexchat
synced 2024-11-29 04:32:15 -05:00
Merge pull request #929 from hexchat/928
Fix scrollback_load to deal with e.g. the output of /HELP
This commit is contained in:
commit
5e8bc980e1
@ -303,6 +303,12 @@ scrollback_load (session *sess)
|
|||||||
buf = g_strndup (buf_tmp, n_bytes);
|
buf = g_strndup (buf_tmp, n_bytes);
|
||||||
g_free (buf_tmp);
|
g_free (buf_tmp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Some scrollback lines have three blanks after the timestamp and a newline
|
||||||
|
* Some have only one blank and a newline
|
||||||
|
* Some don't even have a timestamp
|
||||||
|
* Some don't have any text at all
|
||||||
|
*/
|
||||||
if (buf[0] == 'T')
|
if (buf[0] == 'T')
|
||||||
{
|
{
|
||||||
if (sizeof (time_t) == 4)
|
if (sizeof (time_t) == 4)
|
||||||
@ -310,7 +316,7 @@ scrollback_load (session *sess)
|
|||||||
else
|
else
|
||||||
stamp = strtoull (buf + 2, NULL, 10); /* in case time_t is 64 bits */
|
stamp = strtoull (buf + 2, NULL, 10); /* in case time_t is 64 bits */
|
||||||
text = strchr (buf + 3, ' ');
|
text = strchr (buf + 3, ' ');
|
||||||
if (text)
|
if (text && text[1])
|
||||||
{
|
{
|
||||||
if (prefs.hex_text_stripcolor_replay)
|
if (prefs.hex_text_stripcolor_replay)
|
||||||
{
|
{
|
||||||
@ -324,8 +330,19 @@ scrollback_load (session *sess)
|
|||||||
g_free (text);
|
g_free (text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lines++;
|
else
|
||||||
|
{
|
||||||
|
fe_print_text (sess, " ", stamp, TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (strlen (buf))
|
||||||
|
fe_print_text (sess, buf, 0, TRUE);
|
||||||
|
else
|
||||||
|
fe_print_text (sess, " ", 0, TRUE);
|
||||||
|
}
|
||||||
|
lines++;
|
||||||
|
|
||||||
g_free (buf);
|
g_free (buf);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user