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",
hi line numberingJune McEnroe Tags are much better for referring to specific parts of a file and line numbering is better done by a post-processing tool such as cat -n or producing a two-column HTML <table>. 2019-02-18Add Tag class to hiJune McEnroe 2019-02-17Generate HTML with hi -n -f html -o anchorJune McEnroe Running hi twice to insert stuff between the head and the content is a bit of a hack but oh well. 2019-02-17Add hi -f html -o anchor for line number linksJune McEnroe 2019-02-17Simplify temp trap in upJune McEnroe 2019-02-17Add line numbers to hiJune McEnroe Renames previous -n option to -m to stay consistent with cat -n. Prefixing lines with line numbers affects where the first tab indent ends up relative to the text above it. Not sure if it's worth fixing somehow. 2019-02-17Always split spans after newlinesJune McEnroe Simplifies ANSI and IRC output code, and prepares for line numbered output. 2019-02-15Color format specifiers light cyan in vimJune McEnroe 2019-02-15Highlight Interp as yellowJune McEnroe 2019-02-15Highlight strings in sh command substitutionsJune McEnroe 2019-02-15Add nmap gpJune McEnroe 2019-02-14Avoid newline when copying URL to pasteboardJune McEnroe 2019-02-13Add forgotten "sixth" book of H2G2June McEnroe