Mercurial > hg
changeset 197:c289e3c39c48
[/trunk] Changeset 209 by mikael
* screen.c: display prefixes "*<*" or "*>*" when both info and in/out prefixes
are requested.
* hbuf.c: set HBB_PREFIX_INFO prefix when a line is too long to fit in an
hbuf block
* histolog.c: display a message when reading a big history file (because it
can hang the ui for a while)
author | mikael |
---|---|
date | Sat, 07 May 2005 07:33:10 +0000 |
parents | 58eb8ad9ef74 |
children | 4cfea50155bf |
files | mcabber/src/hbuf.c mcabber/src/histolog.c mcabber/src/screen.c |
diffstat | 3 files changed, 19 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mcabber/src/hbuf.c Sat May 07 06:34:47 2005 +0000 +++ b/mcabber/src/hbuf.c Sat May 07 07:33:10 2005 +0000 @@ -78,6 +78,7 @@ if (strlen(text) >= HBB_BLOCKSIZE) { // Too long text = "[ERR:LINE_TOO_LONG]"; + hbuf_block_elt->prefix.flags |= HBB_PREFIX_INFO; } if (hbuf_block_elt->ptr + strlen(text) >= hbuf_block_elt->ptr_end_alloc) { // Too long for the current allocated bloc, we need another one
--- 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;
--- a/mcabber/src/screen.c Sat May 07 06:34:47 2005 +0000 +++ b/mcabber/src/screen.c Sat May 07 07:33:10 2005 +0000 @@ -295,12 +295,17 @@ strftime(date, 35, "%m-%d %H:%M", localtime(&line->timestamp)); } else strcpy(date, " "); - if (line->flags & HBB_PREFIX_IN) + if (line->flags & HBB_PREFIX_INFO) { + char dir = '*'; + if (line->flags & HBB_PREFIX_IN) + dir = '<'; + else if (line->flags & HBB_PREFIX_OUT) + dir = '>'; + wprintw(win_entry->win, "%.11s *%c* ", date, dir); + } else if (line->flags & HBB_PREFIX_IN) wprintw(win_entry->win, "%.11s <== ", date); else if (line->flags & HBB_PREFIX_OUT) wprintw(win_entry->win, "%.11s --> ", date); - else if (line->flags & HBB_PREFIX_INFO) - wprintw(win_entry->win, "%.11s *** ", date); else { wprintw(win_entry->win, "%.11s ", date); }