diff options
author | June McEnroe <june@causal.agency> | 2020-02-26 02:37:14 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-02-26 02:37:14 -0500 |
commit | 8705de3da60bcffa11169218441f1782fb55fe86 (patch) | |
tree | 7e9f9da116123ba47d3c7cf9f21aebe17bb72194 | |
parent | Tweak buffer sizes (diff) | |
download | pounce-8705de3da60bcffa11169218441f1782fb55fe86.tar.gz pounce-8705de3da60bcffa11169218441f1782fb55fe86.zip |
Use %n for tags when formatting intercepted PRIVMSG/NOTICE
Diffstat (limited to '')
-rw-r--r-- | client.c | 20 |
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; |