summary refs log tree commit diff
path: root/handle.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-08 18:29:01 -0500
committerJune McEnroe <june@causal.agency>2020-02-08 18:29:01 -0500
commitf502260dd0aa73b09bfbb7289b50a67592866166 (patch)
tree66c829e80fc3968b3ffcabc2b11fc25acbc610c8 /handle.c
parentAdd procPipe for subprocesses (diff)
downloadcatgirl-f502260dd0aa73b09bfbb7289b50a67592866166.tar.gz
catgirl-f502260dd0aa73b09bfbb7289b50a67592866166.zip
Scan messages for URLs
Diffstat (limited to '')
-rw-r--r--handle.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/handle.c b/handle.c
index 0780767..f919fcb 100644
--- a/handle.c
+++ b/handle.c
@@ -193,6 +193,7 @@ static void handleReplyISupport(struct Message *msg) {
 static void handleReplyMOTD(struct Message *msg) {
 	require(msg, false, 2);
 	char *line = msg->params[1];
+	urlScan(Network, msg->nick, line);
 	if (!strncmp(line, "- ", 2)) {
 		uiFormat(Network, Cold, tagTime(msg), "\3%d-\3\t%s", Gray, &line[2]);
 	} else {
@@ -227,6 +228,7 @@ static void handlePart(struct Message *msg) {
 		completeClear(id);
 	}
 	completeRemove(id, msg->nick);
+	urlScan(id, msg->nick, msg->params[1]);
 	uiFormat(
 		id, Cold, tagTime(msg),
 		"\3%02d%s\3\tleaves \3%02d%s\3%s%s",
@@ -241,6 +243,7 @@ static void handleKick(struct Message *msg) {
 	size_t id = idFor(msg->params[0]);
 	bool kicked = self.nick && !strcmp(msg->params[1], self.nick);
 	completeTouch(id, msg->nick, hash(msg->user));
+	urlScan(id, msg->nick, msg->params[2]);
 	uiFormat(
 		id, (kicked ? Hot : Cold), tagTime(msg),
 		"%s\3%02d%s\17\tkicks \3%02d%s\3 out of \3%02d%s\3%s%s",
@@ -275,6 +278,7 @@ static void handleQuit(struct Message *msg) {
 	require(msg, true, 0);
 	size_t id;
 	while (None != (id = completeID(msg->nick))) {
+		urlScan(id, msg->nick, msg->params[0]);
 		uiFormat(
 			id, Cold, tagTime(msg),
 			"\3%02d%s\3\tleaves%s%s",
@@ -333,8 +337,10 @@ static void handleReplyTopic(struct Message *msg) {
 	require(msg, false, 3);
 	if (!replies.topic) return;
 	replies.topic--;
+	size_t id = idFor(msg->params[1]);
+	urlScan(id, NULL, msg->params[2]);
 	uiFormat(
-		idFor(msg->params[1]), Cold, tagTime(msg),
+		id, Cold, tagTime(msg),
 		"The sign in \3%02d%s\3 reads: %s",
 		hash(msg->params[1]), msg->params[1], msg->params[2]
 	);
@@ -342,16 +348,18 @@ static void handleReplyTopic(struct Message *msg) {
 
 static void handleTopic(struct Message *msg) {
 	require(msg, true, 2);
+	size_t id = idFor(msg->params[0]);
 	if (msg->params[1][0]) {
+		urlScan(id, msg->nick, msg->params[1]);
 		uiFormat(
-			idFor(msg->params[0]), Warm, tagTime(msg),
+			id, Warm, tagTime(msg),
 			"\3%02d%s\3\tplaces a new sign in \3%02d%s\3: %s",
 			hash(msg->user), msg->nick, hash(msg->params[0]), msg->params[0],
 			msg->params[1]
 		);
 	} else {
 		uiFormat(
-			idFor(msg->params[0]), Warm, tagTime(msg),
+			id, Warm, tagTime(msg),
 			"\3%02d%s\3\tremoves the sign in \3%02d%s\3",
 			hash(msg->user), msg->nick, hash(msg->params[0]), msg->params[0]
 		);
@@ -400,6 +408,7 @@ static void handlePrivmsg(struct Message *msg) {
 	bool action = isAction(msg);
 	bool mention = !mine && isMention(msg);
 	if (!notice && !mine) completeTouch(id, msg->nick, hash(msg->user));
+	urlScan(id, msg->nick, msg->params[1]);
 	if (notice) {
 		uiFormat(
 			id, Warm, tagTime(msg),