--- a/mcabber/contrib/themes/light.txt Sat Apr 28 12:16:45 2007 +0200
+++ b/mcabber/contrib/themes/light.txt Sat Apr 28 21:52:57 2007 +0200
@@ -4,6 +4,7 @@
set color_background = white
set color_general = black
set color_msgout = cyan
+set color_msghl = yellow
set color_bgstatus = black
set color_status = green
set color_roster = blue
--- a/mcabber/contrib/themes/light2.txt Sat Apr 28 12:16:45 2007 +0200
+++ b/mcabber/contrib/themes/light2.txt Sat Apr 28 21:52:57 2007 +0200
@@ -4,6 +4,7 @@
set color_background = white
set color_general = black
set color_msgout = blue
+set color_msghl = red
set color_bgstatus = black
set color_status = brightcyan
set color_roster = magenta
--- a/mcabber/contrib/themes/oliver.txt Sat Apr 28 12:16:45 2007 +0200
+++ b/mcabber/contrib/themes/oliver.txt Sat Apr 28 21:52:57 2007 +0200
@@ -4,6 +4,7 @@
set color_background = blue
set color_general = white
set color_msgout = cyan
+set color_msghl = yellow
set color_bgstatus = yellow
set color_status = red
set color_roster = cyan
--- a/mcabber/mcabberrc.example Sat Apr 28 12:16:45 2007 +0200
+++ b/mcabber/mcabberrc.example Sat Apr 28 21:52:57 2007 +0200
@@ -230,6 +230,7 @@
# background: background color of the chat window and the log window
# general: text color in the chat window and the log window
# msgout: text color in the chat window for outgoing messages
+# msghl: text color in the chat window for highlighted messages (MUC)
# bgstatus: background color of the status lines
# status: text color of the status lines
# roster: text color of the roster (buddylist) normal items
@@ -241,6 +242,7 @@
#set color_background = black
#set color_general = white
#set color_msgout = cyan
+#set color_msghl = yellow
#set color_bgstatus = blue
#set color_status = white
#set color_roster = green
--- a/mcabber/src/hbuf.c Sat Apr 28 12:16:45 2007 +0200
+++ b/mcabber/src/hbuf.c Sat Apr 28 21:52:57 2007 +0200
@@ -294,7 +294,7 @@
{
unsigned int i;
hbuf_block *blk;
- guchar last_persist_prefixflags = 0;
+ guint last_persist_prefixflags = 0;
GList *last_persist; // last persistent flags
hbb_line **array, **array_elt;
@@ -327,8 +327,9 @@
if ((blk->flags & HBB_FLAG_PERSISTENT) && blk->prefix.flags) {
last_persist_prefixflags = blk->prefix.flags;
} else {
- // Propagate highlighting flag
- (*array_elt)->flags |= last_persist_prefixflags & HBB_PREFIX_HLIGHT;
+ // Propagate highlighting flags
+ (*array_elt)->flags |= last_persist_prefixflags &
+ (HBB_PREFIX_HLIGHT_OUT | HBB_PREFIX_HLIGHT);
}
hbuf = g_list_next(hbuf);
--- a/mcabber/src/hbuf.h Sat Apr 28 12:16:45 2007 +0200
+++ b/mcabber/src/hbuf.h Sat Apr 28 21:52:57 2007 +0200
@@ -14,17 +14,18 @@
#define HBB_FLAG_ALLOC 1
#define HBB_FLAG_PERSISTENT 2
-#define HBB_PREFIX_IN 1U
-#define HBB_PREFIX_OUT 2U
-#define HBB_PREFIX_STATUS 4U
-#define HBB_PREFIX_AUTH 8U
-#define HBB_PREFIX_INFO 16U
-#define HBB_PREFIX_ERR 32U
-#define HBB_PREFIX_NOFLAG 64U
-#define HBB_PREFIX_HLIGHT 128U
-#define HBB_PREFIX_NONE 256U
-#define HBB_PREFIX_SPECIAL 512U
-#define HBB_PREFIX_PGPCRYPT 1024U
+#define HBB_PREFIX_IN (1U<<0)
+#define HBB_PREFIX_OUT (1U<<1)
+#define HBB_PREFIX_STATUS (1U<<2)
+#define HBB_PREFIX_AUTH (1U<<3)
+#define HBB_PREFIX_INFO (1U<<4)
+#define HBB_PREFIX_ERR (1U<<5)
+#define HBB_PREFIX_NOFLAG (1U<<6)
+#define HBB_PREFIX_HLIGHT_OUT (1U<<7)
+#define HBB_PREFIX_HLIGHT (1U<<8)
+#define HBB_PREFIX_NONE (1U<<9)
+#define HBB_PREFIX_SPECIAL (1U<<10)
+#define HBB_PREFIX_PGPCRYPT (1U<<11)
typedef struct {
time_t timestamp;
--- a/mcabber/src/histolog.c Sat Apr 28 12:16:45 2007 +0200
+++ b/mcabber/src/histolog.c Sat Apr 28 21:52:57 2007 +0200
@@ -280,7 +280,7 @@
if (type == 'M') {
char *converted;
if (info == 'S')
- prefix_flags = HBB_PREFIX_OUT | HBB_PREFIX_HLIGHT;
+ prefix_flags = HBB_PREFIX_OUT | HBB_PREFIX_HLIGHT_OUT;
else
prefix_flags = HBB_PREFIX_IN;
converted = from_utf8(&data[dataoffset+1]);
--- a/mcabber/src/hooks.c Sat Apr 28 12:16:45 2007 +0200
+++ b/mcabber/src/hooks.c Sat Apr 28 21:52:57 2007 +0200
@@ -30,6 +30,7 @@
#include "hbuf.h"
#include "settings.h"
#include "utils.h"
+#include "utf8.h"
static char *extcmd;
@@ -112,13 +113,27 @@
wmsg = mmsg = g_strdup_printf("PRIV#*%s %s", resname, msg+4);
}
}
+ 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
- // highlight it.
const char *nick = buddy_getnickname(roster_usr->data);
- if (resname && nick && !strcmp(resname, nick))
- message_flags |= HBB_PREFIX_HLIGHT;
+
+ if (nick) {
+ // Let's see if we are the message sender, in which case we'll
+ // highlight it.
+ if (resname && !strcmp(resname, nick)) {
+ message_flags |= HBB_PREFIX_HLIGHT_OUT;
+ } else {
+ // We're not the sender. Can we see our nick?
+ if (startswith(msg, nick, TRUE)) {
+ // The message starts with our nick. Let's check it's not
+ // followed immediately by an alphnumeric character.
+ if (!iswalnum(get_char(msg+strlen(nick))))
+ message_flags |= HBB_PREFIX_HLIGHT;
+ }
+ // We could do a more global check...
+ }
+ }
}
}
--- a/mcabber/src/screen.c Sat Apr 28 12:16:45 2007 +0200
+++ b/mcabber/src/screen.c Sat Apr 28 21:52:57 2007 +0200
@@ -178,6 +178,7 @@
"", "",
"general",
"msgout",
+ "msghl",
"status",
"roster",
"rostersel",
@@ -228,6 +229,10 @@
init_pair(i+1, ((color) ? FindColor(color) : COLOR_CYAN),
FindColor(background));
break;
+ case COLOR_MSGHL:
+ init_pair(i+1, ((color) ? FindColor(color) : COLOR_YELLOW),
+ FindColor(background));
+ break;
case COLOR_STATUS:
init_pair(i+1, ((color) ? FindColor(color) : COLOR_WHITE),
FindColor(backstatus));
@@ -629,8 +634,10 @@
// NOTE: update PREFIX_WIDTH if you change the date format!!
// You need to set it to the whole prefix length + 1
if (line) {
- if (line->flags & HBB_PREFIX_HLIGHT)
+ if (line->flags & HBB_PREFIX_HLIGHT_OUT)
wattrset(win_entry->win, get_color(COLOR_MSGOUT));
+ else if (line->flags & HBB_PREFIX_HLIGHT)
+ wattrset(win_entry->win, get_color(COLOR_MSGHL));
if (line->timestamp && !(line->flags & HBB_PREFIX_SPECIAL)) {
strftime(date, 30, "%m-%d %H:%M", localtime(&line->timestamp));
@@ -665,7 +672,8 @@
wprintw(win_entry->win, "%s", line->text); // Display text line
- if (line->flags & HBB_PREFIX_HLIGHT)
+ if (line->flags & HBB_PREFIX_HLIGHT_OUT ||
+ line->flags & HBB_PREFIX_HLIGHT)
wattrset(win_entry->win, get_color(COLOR_GENERAL));
wclrtoeol(win_entry->win);
g_free(line->text);
@@ -1462,7 +1470,8 @@
time_t timestamp, guint prefix)
{
if (!(prefix &
- ~HBB_PREFIX_NOFLAG & ~HBB_PREFIX_HLIGHT & ~HBB_PREFIX_PGPCRYPT))
+ ~HBB_PREFIX_NOFLAG & ~HBB_PREFIX_HLIGHT & ~HBB_PREFIX_HLIGHT_OUT &
+ ~HBB_PREFIX_PGPCRYPT))
prefix |= HBB_PREFIX_IN;
scr_WriteMessage(jidfrom, text, timestamp, prefix);
@@ -1474,7 +1483,7 @@
roster_elt = roster_find(jidto, jidsearch,
ROSTER_TYPE_USER|ROSTER_TYPE_AGENT|ROSTER_TYPE_ROOM);
- scr_WriteMessage(jidto, text, 0, prefix|HBB_PREFIX_OUT|HBB_PREFIX_HLIGHT);
+ scr_WriteMessage(jidto, text, 0, prefix|HBB_PREFIX_OUT|HBB_PREFIX_HLIGHT_OUT);
// Show jidto's buffer unless the buddy is not in the buddylist
if (roster_elt && g_list_position(buddylist, roster_elt->data) != -1)
--- a/mcabber/src/screen.h Sat Apr 28 12:16:45 2007 +0200
+++ b/mcabber/src/screen.h Sat Apr 28 21:52:57 2007 +0200
@@ -40,6 +40,7 @@
enum colors {
COLOR_GENERAL = 3,
COLOR_MSGOUT,
+ COLOR_MSGHL,
COLOR_STATUS,
COLOR_ROSTER,
COLOR_ROSTERSEL,