changeset 729:39f67cade02c

Use bold font for outgoing messages
author Mikael Berthe <mikael@lilotux.net>
date Mon, 06 Mar 2006 11:59:34 +0100
parents 421b337dc6d2
children e46c680bdd3d
files mcabber/src/hbuf.c mcabber/src/histolog.c mcabber/src/hooks.c mcabber/src/screen.c
diffstat 4 files changed, 28 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/hbuf.c	Mon Mar 06 10:25:24 2006 +0100
+++ b/mcabber/src/hbuf.c	Mon Mar 06 11:59:34 2006 +0100
@@ -248,20 +248,36 @@
 hbb_line **hbuf_get_lines(GList *hbuf, unsigned int n)
 {
   unsigned int i;
+  hbuf_block *blk;
+  guchar last_persist_prefixflags = 0;
+  GList *last_persist;
+
+  last_persist = hbuf_previous_persistent(hbuf);
+  if (last_persist && last_persist != hbuf) {
+    blk = (hbuf_block*)(last_persist->data);
+    last_persist_prefixflags = blk->prefix.flags;
+  }
 
   hbb_line **array = g_new0(hbb_line*, n);
   hbb_line **array_elt = array;
 
   for (i=0 ; i < n ; i++) {
     if (hbuf) {
-      hbuf_block *blk = (hbuf_block*)(hbuf->data);
       int maxlen;
+      blk = (hbuf_block*)(hbuf->data);
       maxlen = blk->ptr_end - blk->ptr;
       *array_elt = (hbb_line*)g_new(hbb_line, 1);
       (*array_elt)->timestamp = blk->prefix.timestamp;
       (*array_elt)->flags     = blk->prefix.flags;
       (*array_elt)->text      = g_strndup(blk->ptr, maxlen);
 
+      if (blk->flags & HBB_FLAG_PERSISTENT) {
+        last_persist_prefixflags = blk->prefix.flags;
+      } else {
+        // Propagate hilighting flag
+        (*array_elt)->flags |= last_persist_prefixflags & HBB_PREFIX_HLIGHT;
+      }
+
       hbuf = g_list_next(hbuf);
     } else
       break;
--- a/mcabber/src/histolog.c	Mon Mar 06 10:25:24 2006 +0100
+++ b/mcabber/src/histolog.c	Mon Mar 06 11:59:34 2006 +0100
@@ -216,7 +216,7 @@
 
     if (type == 'M') {
       if (info == 'S')
-        prefix_flags = HBB_PREFIX_OUT;
+        prefix_flags = HBB_PREFIX_OUT | HBB_PREFIX_HLIGHT;
       else
         prefix_flags = HBB_PREFIX_IN;
       xtext = ut_expand_tabs(&data[26]); // Expand tabs
--- a/mcabber/src/hooks.c	Mon Mar 06 10:25:24 2006 +0100
+++ b/mcabber/src/hooks.c	Mon Mar 06 11:59:34 2006 +0100
@@ -92,7 +92,7 @@
       wmsg = bmsg = g_strdup_printf("PRIV#<%s> %s", resname, msg);
       if (!strncmp(msg, "/me ", 4))
         wmsg = mmsg = g_strdup_printf("PRIV#*%s %s", resname, msg+4);
-      message_flags |= HBB_PREFIX_HLIGHT;
+      /*message_flags |= HBB_PREFIX_HLIGHT;*/
     } else {
       // This is a regular chatroom message.
       // Let's see if we are the message sender, in which case we'll
--- a/mcabber/src/screen.c	Mon Mar 06 10:25:24 2006 +0100
+++ b/mcabber/src/screen.c	Mon Mar 06 11:59:34 2006 +0100
@@ -407,19 +407,18 @@
           dir = '>';
         wprintw(win_entry->win, "%.11s #%c# ", date, dir);
       } else if (line->flags & HBB_PREFIX_IN) {
-        wprintw(win_entry->win, "%.11s", date);
-        if (line->flags & HBB_PREFIX_HLIGHT) wattron(win_entry->win, A_BOLD);
-        wprintw(win_entry->win, " <== ", date);
-        if (line->flags & HBB_PREFIX_HLIGHT) wattroff(win_entry->win, A_BOLD);
+        wprintw(win_entry->win, "%.11s <== ", date);
       } else if (line->flags & HBB_PREFIX_OUT) {
-        wprintw(win_entry->win, "%.11s", date);
-        wattron(win_entry->win, A_BOLD);
-        wprintw(win_entry->win, " --> ", date);
-        wattroff(win_entry->win, A_BOLD);
+        wprintw(win_entry->win, "%.11s --> ", date);
       } else {
         wprintw(win_entry->win, "%.11s     ", date);
       }
-      wprintw(win_entry->win, "%s", line->text);      // line
+
+      // Display line
+      if (line->flags & HBB_PREFIX_HLIGHT) wattron(win_entry->win, A_BOLD);
+      wprintw(win_entry->win, "%s", line->text);
+      if (line->flags & HBB_PREFIX_HLIGHT) wattroff(win_entry->win, A_BOLD);
+
       wclrtoeol(win_entry->win);
       g_free(line->text);
     } else {
@@ -1012,7 +1011,7 @@
 
 void scr_WriteOutgoingMessage(const char *jidto, const char *text)
 {
-  scr_WriteMessage(jidto, text, 0, HBB_PREFIX_OUT);
+  scr_WriteMessage(jidto, text, 0, HBB_PREFIX_OUT|HBB_PREFIX_HLIGHT);
   scr_ShowWindow(jidto);
 }