about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-08-14 21:26:27 -0400
committerJune McEnroe <june@causal.agency>2018-08-14 21:26:27 -0400
commit7082820299742c96e14a5065d11f7a106f566185 (patch)
tree54f7bb31dd8f51ecfa147d6728c8b457dd26cfba
parentClean up termEvent state machine (diff)
downloadcatgirl-7082820299742c96e14a5065d11f7a106f566185.tar.gz
catgirl-7082820299742c96e14a5065d11f7a106f566185.zip
Detect pings in ACTIONs
-rw-r--r--handle.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/handle.c b/handle.c
index c93522e..adc8f59 100644
--- a/handle.c
+++ b/handle.c
@@ -93,7 +93,8 @@ static bool isSelf(const char *nick, const char *user) {
 	return false;
 }
 
-static bool isPing(const char *mesg) {
+static bool isPing(const char *nick, const char *user, const char *mesg) {
+	if (isSelf(nick, user)) return false;
 	size_t len = strlen(self.nick);
 	const char *match = mesg;
 	while (NULL != (match = strcasestr(match, self.nick))) {
@@ -297,9 +298,10 @@ static void handleCTCP(struct Tag tag, char *nick, char *user, char *mesg) {
 	if (strcmp(ctcp, "ACTION")) return;
 	if (!isSelf(nick, user)) tabTouch(tag, nick);
 	urlScan(tag, params);
+	bool ping = isPing(nick, user, params);
 	uiFmt(
-		tag, "\3%d* %s\3 %s",
-		color(user), nick, params
+		tag, "%c\3%d* %s\17 %s",
+		ping["\17\26"], color(user), nick, params
 	);
 }
 
@@ -314,7 +316,7 @@ static void handlePrivmsg(char *prefix, char *params) {
 	if (!isSelf(nick, user)) tabTouch(tag, nick);
 	urlScan(tag, mesg);
 	bool self = isSelf(nick, user);
-	bool ping = !self && isPing(mesg);
+	bool ping = isPing(nick, user, mesg);
 	uiFmt(
 		tag, "%c\3%d%c%s%c\17 %s",
 		ping["\17\26"], color(user), self["<("], nick, self[">)"], mesg