Highlight nickname by prefixing message with >. - irc - IRC client based on c9x.me/irc client (HTM) git clone git://git.codemadness.org/irc (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit 9d13c27310b659f41379c638b799281d7735201c (DIR) parent 588eaca2cef25a0e061d977126c1af0ceb63a443 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Sun, 24 Apr 2016 16:29:51 +0200 Highlight nickname by prefixing message with >. Diffstat: M Makefile | 2 +- M irc.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) --- (DIR) diff --git 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} (DIR) diff --git a/irc.c b/irc.c @@ -21,12 +21,13 @@ #include <locale.h> #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")) {