summary refs log tree commit diff
path: root/handle.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-09-02 01:06:45 -0400
committerJune McEnroe <june@causal.agency>2018-09-02 01:12:41 -0400
commit9a63155b2d000efacc474ca4fe5ac007afb4a93e (patch)
treeee55b81c8f0accf8fbf4883b8839e5079b3db6c0 /handle.c
parentAdd aswprintf (diff)
downloadcatgirl-9a63155b2d000efacc474ca4fe5ac007afb4a93e.tar.gz
catgirl-9a63155b2d000efacc474ca4fe5ac007afb4a93e.zip
Treat all direct messages as pings
Diffstat (limited to '')
-rw-r--r--handle.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/handle.c b/handle.c
index 865bbad..5058e34 100644
--- a/handle.c
+++ b/handle.c
@@ -370,7 +370,8 @@ static void handleCTCP(struct Tag tag, char *nick, char *user, char *mesg) {
 static void handlePrivmsg(char *prefix, char *params) {
 	char *nick, *user, *chan, *mesg;
 	shift(prefix, &nick, &user, NULL, params, 2, 0, &chan, &mesg);
-	struct Tag tag = (strcmp(chan, self.nick) ? tagFor(chan) : tagFor(nick));
+	bool direct = !strcmp(chan, self.nick);
+	struct Tag tag = (direct ? tagFor(nick) : tagFor(chan));
 	if (mesg[0] == '\1') {
 		handleCTCP(tag, nick, user, mesg);
 		return;
@@ -380,7 +381,7 @@ static void handlePrivmsg(char *prefix, char *params) {
 	if (!self) tabTouch(tag, nick);
 
 	urlScan(tag, mesg);
-	bool ping = !self && isPing(mesg);
+	bool ping = !self && (direct || isPing(mesg));
 	uiFmt(
 		tag, (ping ? UI_HOT : UI_WARM),
 		"%c\3%d%c%s%c\17 %s",
2-22Document the interfaceJune McEnroe 2022-02-20Clean up unimplemented editing mode stuffJune McEnroe 2022-02-20Save input buffer contentsJune McEnroe 2022-02-20Share a cut buffer between all edit buffersJune McEnroe 2022-02-20Assert return values in edit testsJune McEnroe 2022-02-20Move mbs out of struct Edit, use a global bufferJune McEnroe 2022-02-20Clear edit buffer before running commandJune McEnroe 2022-02-20Show indicator in status when window has pending inputJune McEnroe 2022-02-20Use separate edit buffers for each IDJune McEnroe 2022-02-20Make sure new cap is actually larger than new lengthJune McEnroe 2022-02-20Remove unused mbs.len field from struct EditJune McEnroe 2022-02-19Remove unneeded includes in ui.cJune McEnroe 2022-02-19Reimplement tab completeJune McEnroe 2022-02-19Handle errors from editFn, etc.June McEnroe 2022-02-19Reimplement text macrosJune McEnroe 2022-02-19Factor out input handling to input.cJune McEnroe 2022-02-19Factor out window management to window.cJune McEnroe 2022-02-19Enable -Wmissing-prototypesJune McEnroe 2022-02-19Fix edit.[ch] license notice additional permissionsJune McEnroe 2022-02-19Run line editing testsJune McEnroe 2022-02-18Implement new line editing "library"June McEnroe 2022-02-18Simplify cursor positioning in inputJune McEnroe 2022-02-18Fix M-f orderingJune McEnroe 2022-02-12Move sandman build to scripts/MakefileJune McEnroe 2022-02-12Use compat_readpassphrase.c on LinuxJune McEnroe 2022-02-12Copy RPP defines from oconfigureJune McEnroe