summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma2016-04-24 16:29:51 +0200
committerQuentin Carbonneaux2016-04-27 11:44:02 -0400
commit9d13c27310b659f41379c638b799281d7735201c (patch)
tree64adbf3ceb216335e306a5d348eb338e8abe1109
parent588eaca2cef25a0e061d977126c1af0ceb63a443 (diff)
Highlight nickname by prefixing message with >.
-rw-r--r--Makefile2
-rw-r--r--irc.c10
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 <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")) {