--- a/mcabber/src/histolog.c Sat May 07 06:34:47 2005 +0000
+++ b/mcabber/src/histolog.c Sat May 07 07:33:10 2005 +0000
@@ -113,6 +113,7 @@
guint prefix_flags;
guint len;
FILE *fp;
+ struct stat bufstat;
guint err = 0;
if (!FileLoadLogs) return;
@@ -129,6 +130,13 @@
g_free(filename);
if (!fp) { g_free(data); return; }
+ // If file is large (> 512 here), display a message to inform the user
+ // (it can take a while...)
+ if (!fstat(fileno(fp), &bufstat)) {
+ if (bufstat.st_size > 524288)
+ scr_LogPrint("Reading <%s> history file...", jid);
+ }
+
/* See write_histo_line() for line format... */
while (!feof(fp)) {
if (fgets(data, HBB_BLOCKSIZE+24, fp) == NULL) break;
@@ -161,12 +169,13 @@
continue;
}
- // FIXME This will fail when a message is too big
+ // XXX This will fail when a message is too big
while (len--) {
if (fgets(tail, HBB_BLOCKSIZE+24 - (tail-data), fp) == NULL) break;
while (*tail) tail++;
}
+ // Remove last CR
if ((tail > data+18) && (*(tail-1) == '\n'))
*(tail-1) = 0;