summary refs log tree commit diff
path: root/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'client.c')
-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;
 
03Use more octal char literalsJune McEnroe 2018-08-03Send a WHO in response to NAMES to get usernamesJune McEnroe 2018-08-03Colorize nicks and channelsJune McEnroe 2018-08-03Add support for mIRC colorsJune McEnroe 2018-08-03Handle bold, italic, underlineJune McEnroe 2018-08-03Add prift function for "prefix shift"June McEnroe 2018-08-03Link with -lcurseswJune McEnroe 2018-08-02Use libtls "compat" ciphersJune McEnroe 2018-08-02Add UI and handle some kinds of server messagesJune McEnroe 2018-08-02Add chroot.tar targetJune McEnroe