Highlight nickname by prefixing message with >. - irc - Unnamed repository; edi… | |
git clone git://vernunftzentrum.de/irc.git | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit 9d13c27310b659f41379c638b799281d7735201c | |
parent 588eaca2cef25a0e061d977126c1af0ceb63a443 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Sun, 24 Apr 2016 16:29:51 +0200 | |
Highlight nickname by prefixing message with >. | |
Diffstat: | |
Makefile | 2 +- | |
irc.c | 10 +++++++--- | |
2 files changed, 8 insertions(+), 4 deletions(-) | |
--- | |
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} | |
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")) { |