summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-26 02:37:14 -0500
committerJune McEnroe <june@causal.agency>2020-02-26 02:37:14 -0500
commit8705de3da60bcffa11169218441f1782fb55fe86 (patch)
tree7e9f9da116123ba47d3c7cf9f21aebe17bb72194
parentTweak buffer sizes (diff)
downloadpounce-8705de3da60bcffa11169218441f1782fb55fe86.tar.gz
pounce-8705de3da60bcffa11169218441f1782fb55fe86.zip
Use %n for tags when formatting intercepted PRIVMSG/NOTICE
-rw-r--r--client.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/client.c b/client.c
index 2405004..088691a 100644
--- a/client.c
+++ b/client.c
@@ -227,20 +227,16 @@ static void handleQuit(struct Client *client, struct Message *msg) {
 
 static void handlePrivmsg(struct Client *client, struct Message *msg) {
 	if (!msg->params[0] || !msg->params[1]) return;
+
+	int origin;
 	char line[MessageCap];
-	if (msg->tags) {
-		snprintf(
-			line, sizeof(line), "@%s :%s %s %s :%s",
-			msg->tags, stateEcho(), msg->cmd, msg->params[0], msg->params[1]
-		);
-	} else {
-		snprintf(
-			line, sizeof(line), ":%s %s %s :%s",
-			stateEcho(), msg->cmd, msg->params[0], msg->params[1]
-		);
-	}
+	snprintf(
+		line, sizeof(line), "@%s %n:%s %s %s :%s",
+		(msg->tags ? msg->tags : ""), &origin,
+		stateEcho(), msg->cmd, msg->params[0], msg->params[1]
+	);
 	size_t diff = ringDiff(client->consumer);
-	ringProduce(line);
+	ringProduce((msg->tags ? line : &line[origin]));
 	if (!diff) ringConsume(NULL, client->consumer);
 	if (!strcmp(msg->params[0], stateNick())) return;
 
k to xsessionJune McEnroe 2021-02-07Set cursor theme and sizeJune McEnroe 2021-02-07Use scrot for up -s if no screencaptureJune McEnroe 2021-02-07Enable mouse acceleration in XJune McEnroe 2021-02-07Set colours for Xt and cwmJune McEnroe 2021-02-07Set urgency on bell in xtermJune McEnroe 2021-02-07Add bindings for brightness controlJune McEnroe 2021-02-07Set X key repeat rateJune McEnroe 2021-02-07Bump font size to 12June McEnroe 2021-02-07Fully configure and rebind cwmJune McEnroe 2021-02-07Add BintiJune McEnroe 2021-02-07Finish configuring xtermJune McEnroe 2021-02-06Enable tapping, reverse scroll, set scaling in wsconsctlJune McEnroe 2021-02-06Set root window to black on purple snowJune McEnroe 2021-02-06Add xmodmap configurationJune McEnroe 2021-02-06Add initial OpenBSD X configurationJune McEnroe 2021-02-06Add xterm output to schemeJune McEnroe7 -0500'>2021-02-07Set colours for Xt and cwmJune McEnroe And increase XTerm internalBorder. 2021-02-07Set urgency on bell in xtermJune McEnroe 2021-02-07Add bindings for brightness controlJune McEnroe Weirdly the Fn key doesn't change how the F row registers... I wonder if I can do something about that. 2021-02-07Set X key repeat rateJune McEnroe 2021-02-07Bump font size to 12June McEnroe 11 is what I use on macOS, but I feel like my eyes are working harder here. 2021-02-07Fully configure and rebind cwmJune McEnroe This is sort of a mix of trying to emulate macOS somewhat for my muscle memory and just rebinding some of the cwm defaults to use 4- rather than M-. 2021-02-07Add BintiJune McEnroe 2021-02-07Finish configuring xtermJune McEnroe 2021-02-06Enable tapping, reverse scroll, set scaling in wsconsctlJune McEnroe 2021-02-06Set root window to black on purple snowJune McEnroe 2021-02-06Add xmodmap configurationJune McEnroe 2021-02-06Add initial OpenBSD X configurationJune McEnroe cwm still needs a lot more rebinding, and I need to actually look at its other options. xterm definitely still needs some configuration, but I at least managed to get it to use a decent looking font. Very happy that OpenBSD includes Luxi Mono, which is what my usual font, Go Mono, is based on anyway. Still missing is xmodmap and such. 2021-02-06Add xterm output to schemeJune McEnroe