mirror of
https://codeberg.org/emersion/gamja
synced 2025-03-13 07:48:37 +01:00
lib/irc: only add colon to trailing arg when necessary
This mirrors go-irc's behavior:
7ba1a1858f/parser.go (L374)
Closes: https://todo.sr.ht/~emersion/gamja/103
This commit is contained in:
parent
c428e504fe
commit
a51be5037d
@ -215,11 +215,14 @@ export function formatMessage(msg) {
|
|||||||
}
|
}
|
||||||
s += msg.command;
|
s += msg.command;
|
||||||
if (msg.params && msg.params.length > 0) {
|
if (msg.params && msg.params.length > 0) {
|
||||||
let last = msg.params[msg.params.length - 1];
|
|
||||||
if (msg.params.length > 1) {
|
|
||||||
s += " " + msg.params.slice(0, -1).join(" ");
|
s += " " + msg.params.slice(0, -1).join(" ");
|
||||||
}
|
|
||||||
|
let last = String(msg.params[msg.params.length - 1]);
|
||||||
|
if (last.length === 0 || last === ":" || last.indexOf(" ") >= 0) {
|
||||||
s += " :" + last;
|
s += " :" + last;
|
||||||
|
} else {
|
||||||
|
s += " " + last;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
s += "\r\n";
|
s += "\r\n";
|
||||||
return s;
|
return s;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user