From 9d13c27310b659f41379c638b799281d7735201c Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sun, 24 Apr 2016 16:29:51 +0200 Subject: Highlight nickname by prefixing message with >. --- Makefile | 2 +- irc.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 308c060..5b280d7 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ BIN = irc -CFLAGS = -std=c99 -Os -D_POSIX_C_SOURCE=201112 +CFLAGS = -std=c99 -Os -D_POSIX_C_SOURCE=201112 -D_GNU_SOURCE LDFLAGS = -lncurses all: ${BIN} diff --git a/irc.c b/irc.c index 0b15ea1..ad38d2a 100644 --- a/irc.c +++ b/irc.c @@ -21,12 +21,13 @@ #include #undef CTRL -#define CTRL(x) (x & 037) +#define CTRL(x) (x & 037) #define SCROLL 15 #define INDENT 21 #define DATEFMT "%H:%M" -#define PFMT "%-12s < %s" +#define PFMT " %-12s < %s" +#define PFMTHIGH "> %-12s < %s" #define SRV "irc.oftc.net" #define PORT 6667 @@ -268,7 +269,10 @@ scmd(char *usr, char *cmd, char *par, char *data) } if (!strcmp(cmd, "PRIVMSG")) { if (!pm || !data) return; - pushf(chfind(pm), PFMT, usr, data); + if (strcasestr(data, nick)) + pushf(chfind(pm), PFMTHIGH, usr, data); + else + pushf(chfind(pm), PFMT, usr, data); } else if (!strcmp(cmd, "PING")) { sndf("PONG :%s", data?data:"(null)"); } else if (!strcmp(cmd, "PART")) { -- cgit v1.2.3