diff mcabber/src/histolog.c @ 186:888ad9f15346

[/trunk] Changeset 198 by mikael * Use lowercase jid for history log files * Workaround a problem when loading a history file big a (too) big message * Increase HBB_BLOCKSIZE to 4096
author mikael
date Thu, 05 May 2005 20:50:50 +0000
parents b5aa2b9c425a
children 5cbdcccfab29
line wrap: on
line diff
--- a/mcabber/src/histolog.c	Thu May 05 20:05:39 2005 +0000
+++ b/mcabber/src/histolog.c	Thu May 05 20:50:50 2005 +0000
@@ -43,11 +43,17 @@
 static char *user_histo_file(const char *jid)
 {
   char *filename;
+  char *lowerid, *p;
   if (!UseFileLogging && !FileLoadLogs) return NULL;
 
+  lowerid = g_strdup(jid);
+  for (p=lowerid; *p ; p++)
+    *p = tolower(*p);
+
   filename = g_new(char, strlen(RootDir) + strlen(jid) + 1);
   strcpy(filename, RootDir);
-  strcat(filename, jid);
+  strcat(filename, lowerid);
+  g_free(lowerid);
   return filename;
 }
 
@@ -133,7 +139,8 @@
     if ((type != 'M' && type != 'S') || 
         (data[13] != ' ') || (data[17] != ' ')) {
       scr_LogPrint("Error in history file format");
-      break;
+      //break;
+      continue;
     }
     data[13] = data[17] = 0;
     timestamp = (unsigned long) atol(&data[3]);
@@ -143,9 +150,11 @@
     if (((type == 'M') && (info != 'S' && info != 'R')) ||
         ((type == 'I') && (!strchr("OAIFDCN", info)))) {
       scr_LogPrint("Error in history file format");
-      break;
+      //break;
+      continue;
     }
 
+    // FIXME This will fail when a message is too big
     while (len--) {
       if (fgets(tail, HBB_BLOCKSIZE+24 - (tail-data), fp) == NULL) break;