changeset 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 e8e447a07641
children 4ce9ff808baa
files mcabber/src/TODO mcabber/src/hbuf.h mcabber/src/histolog.c
diffstat 3 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/TODO	Thu May 05 20:05:39 2005 +0000
+++ b/mcabber/src/TODO	Thu May 05 20:50:50 2005 +0000
@@ -17,7 +17,6 @@
   top variable on a resize).
 * Show number of online contacts in folded groups
 * Add a cfg_read_int() function
-* Better prefix usage in the hbuf buffers (use flags for IN/OUT etc.)
 * Buddy buffer in full width (handy for cut'n paste!)
 
 * Commands! :-)
@@ -42,7 +41,6 @@
   - /help
 * Multi-lines
 * Handle message type "error"
-* Shortcut to jump to next message received (shift-tab?)
 * File transfer? :)
 * Conferences :))
 * Show status changes in buddy window (if open)?  Could be great!
--- a/mcabber/src/hbuf.h	Thu May 05 20:05:39 2005 +0000
+++ b/mcabber/src/hbuf.h	Thu May 05 20:50:50 2005 +0000
@@ -6,7 +6,7 @@
 
 // With current implementation a message must fit in a hbuf block,
 // so we shouldn't choose a too small size.
-#define HBB_BLOCKSIZE   2048    // > 20 please
+#define HBB_BLOCKSIZE   4096    // > 20 please
 
 // Flags:
 // - ALLOC: the ptr data has been allocated, it can be freed
--- 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;