about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--handle.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/handle.c b/handle.c
index 759d494..973845f 100644
--- a/handle.c
+++ b/handle.c
@@ -66,11 +66,6 @@ static void parse(
 	va_end(ap);
 }
 
-static bool isSelf(const char *user) {
-	if (!user) return false;
-	return !strcmp(user, self.user);
-}
-
 static bool isPing(const char *mesg) {
 	size_t len = strlen(self.nick);
 	const char *match = mesg;
@@ -193,7 +188,7 @@ static void handleJoin(char *prefix, char *params) {
 	parse(prefix, &nick, &user, NULL, params, 1, 0, &chan);
 	struct Tag tag = tagFor(chan);
 
-	if (isSelf(user)) {
+	if (!strcmp(nick, self.nick)) {
 		tabTouch(TagNone, chan);
 		uiViewTag(tag);
 		logReplay(tag);
@@ -213,7 +208,7 @@ static void handlePart(char *prefix, char *params) {
 	parse(prefix, &nick, &user, NULL, params, 1, 1, &chan, &mesg);
 	struct Tag tag = tagFor(chan);
 
-	if (isSelf(user)) {
+	if (!strcmp(nick, self.nick)) {
 		tabClear(tag);
 	} else {
 		tabRemove(tag, nick);
@@ -317,7 +312,7 @@ static void handleTopic(char *prefix, char *params) {
 	parse(prefix, &nick, &user, NULL, params, 2, 0, &chan, &topic);
 	struct Tag tag = tagFor(chan);
 
-	if (!isSelf(user)) tabTouch(tag, nick);
+	if (strcmp(nick, self.nick)) tabTouch(tag, nick);
 
 	urlScan(tag, topic);
 	uiFmt(
@@ -376,7 +371,7 @@ static void handleNick(char *prefix, char *params) {
 	char *prev, *user, *next;
 	parse(prefix, &prev, &user, NULL, params, 1, 0, &next);
 
-	if (isSelf(user)) {
+	if (!strcmp(prev, self.nick)) {
 		free(self.nick);
 		self.nick = strdup(next);
 		if (!self.nick) err(EX_OSERR, "strdup");
@@ -402,10 +397,10 @@ static void handleCTCP(struct Tag tag, char *nick, char *user, char *mesg) {
 	char *params = strsep(&mesg, "\1");
 	if (strcmp(ctcp, "ACTION")) return;
 
-	if (!isSelf(user)) tabTouch(tag, nick);
+	if (strcmp(nick, self.nick)) tabTouch(tag, nick);
 
 	urlScan(tag, params);
-	bool ping = !isSelf(user) && isPing(params);
+	bool ping = strcmp(nick, self.nick) && isPing(params);
 	uiFmt(
 		tag, (ping ? UIHot : UIWarm),
 		"%c\3%d* %s\17 %s",
@@ -424,16 +419,16 @@ static void handlePrivmsg(char *prefix, char *params) {
 		return;
 	}
 
-	bool self = isSelf(user);
-	if (!self) tabTouch(tag, nick);
+	bool me = !strcmp(nick, self.nick);
+	if (!me) tabTouch(tag, nick);
 
 	urlScan(tag, mesg);
-	bool hot = !self && (direct || isPing(mesg));
-	bool ping = !self && isPing(mesg);
+	bool hot = !me && (direct || isPing(mesg));
+	bool ping = !me && isPing(mesg);
 	uiFmt(
 		tag, (hot ? UIHot : UIWarm),
 		"%c\3%d%c%s%c\17 %s",
-		ping["\17\26"], formatColor(user), self["<("], nick, self[">)"], mesg
+		ping["\17\26"], formatColor(user), me["<("], nick, me[">)"], mesg
 	);
 	logFmt(tag, NULL, "<%s> %s", nick, mesg);
 }
@@ -444,10 +439,10 @@ static void handleNotice(char *prefix, char *params) {
 	struct Tag tag = TagStatus;
 	if (user) tag = (strcmp(chan, self.nick) ? tagFor(chan) : tagFor(nick));
 
-	if (!isSelf(user)) tabTouch(tag, nick);
+	if (strcmp(nick, self.nick)) tabTouch(tag, nick);
 
 	urlScan(tag, mesg);
-	bool ping = !isSelf(user) && isPing(mesg);
+	bool ping = strcmp(nick, self.nick) && isPing(mesg);
 	uiFmt(
 		tag, (ping ? UIHot : UIWarm),
 		"%c\3%d-%s-\17 %s",
c/commit/install.sh?id=fed52c75edeab8a250b24304d050e6fd85b8f2fc&follow=1'>Move /opt/local back, cheat port select to use system manJune McEnroe This is not really how you're supposed to use the select system, I don't think, since the mandoc package actually creates those files, but it does work. This lets me actually use the git installed by MacPorts. 2020-09-12Move /opt/local behind /usr againJune McEnroe The reason I did this with pkgsrc was because I actually don't want the man(1) from mandoc, since it won't follow MANSECT. Same applies to MacPorts. I wish I could disable its man(1) with a variant or whatever. 2020-09-12Enable toc in cgit renderings of man pagesJune McEnroe But keep it disabled for READMEs since they always use non-standard sections and the TOC is just distracting there, I think. Also add the style so its h1 is the same size as the ones inside sections... 2020-09-11Install mandoc on macOSJune McEnroe 2020-09-11Rewrite install script yet againJune McEnroe 2020-09-11Remove NetBSD from install scriptJune McEnroe I never use it. 2020-09-11Use MacPorts rather than pkgsrcJune McEnroe My system is probably such a mess now... 2020-09-11Add debian VM name to sshJune McEnroe 2020-09-11Add influencer tweetJune McEnroe 2020-09-10Add The Kingdom of GodsJune McEnroe Reading has really slowed down :( 2020-09-07Add SunglassesJune McEnroe An IRC find. 2020-09-06Add Between the BreathsJune McEnroe One of those good songs from a soundtrack of a film that probably isn't? The summary sounds a lot more interesting than the title implies, at least. 2020-09-04Open /dev/tty in nudgeJune McEnroe This makes it work even when it's run connected to a pipe, i.e. as the notify command of catgirl... 2020-09-04Add nudgeJune McEnroe 2020-09-03Build fbclock with -lzJune McEnroe I guess this got lost somewhere, long ago... 2020-08-29Add tweets from retweetsJune McEnroe