mirror of
https://codeberg.org/emersion/gamja.git
synced 2024-11-15 03:15:01 -05: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
1 changed files with 7 additions and 4 deletions
|
@ -215,11 +215,14 @@ export function formatMessage(msg) {
|
|||
}
|
||||
s += msg.command;
|
||||
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(" ");
|
||||
}
|
||||
|
||||
let last = String(msg.params[msg.params.length - 1]);
|
||||
if (last.length === 0 || last === ":" || last.indexOf(" ") >= 0) {
|
||||
s += " :" + last;
|
||||
} else {
|
||||
s += " " + last;
|
||||
}
|
||||
}
|
||||
s += "\r\n";
|
||||
return s;
|
||||
|
|
Loading…
Reference in a new issue