# HG changeset patch # User mikael # Date 1119683729 0 # Node ID 7016513930765c3e37c733fa92fc1feffeb75908 # Parent fca26cafb7c89badf8af057e3051c267636e8874 [/trunk] Changeset 261 by mikael * Show more information when a history file parse error occurs diff -r fca26cafb7c8 -r 701651393076 mcabber/src/histolog.c --- a/mcabber/src/histolog.c Tue Jun 14 19:42:25 2005 +0000 +++ b/mcabber/src/histolog.c Sat Jun 25 07:15:29 2005 +0000 @@ -120,6 +120,7 @@ struct stat bufstat; guint err = 0; guint oldformat; + guint ln = 0; // line number if (!FileLoadLogs) return; @@ -146,6 +147,7 @@ while (!feof(fp)) { int format_off =0; if (fgets(data, HBB_BLOCKSIZE+24, fp) == NULL) break; + ln++; for (tail = data; *tail; tail++) ; @@ -162,7 +164,7 @@ (oldformat && ((data[13] != ' ') || (data[17] != ' '))) || ((!oldformat) && ((data[21] != ' ') || (data[25] != ' ')))) { if (!err) { - scr_LogPrint("Error in history file format (%s)", jid); + scr_LogPrint("Error in history file format (%s), l.%u", jid, ln); err = 1; } //break; @@ -179,7 +181,7 @@ if (((type == 'M') && (info != 'S' && info != 'R')) || ((type == 'I') && (!strchr("OAIFDCN", info)))) { if (!err) { - scr_LogPrint("Error in history file format (%s)", jid); + scr_LogPrint("Error in history file format (%s), l.%u", jid, ln); err = 1; } //break; @@ -188,10 +190,15 @@ // XXX This will fail when a message is too big while (len--) { + ln++; if (fgets(tail, HBB_BLOCKSIZE+24 - (tail-data), fp) == NULL) break; while (*tail) tail++; } + // Small check for too long messages + if (tail+1 >= HBB_BLOCKSIZE+24 + data) { + scr_LogPrint("Message is too big in history file!"); + } // Remove last CR if ((tail > data+18+format_off) && (*(tail-1) == '\n')) *(tail-1) = 0;