~emersion/goguma-dev

commands: fix kick to accept kick reasons v1 SUPERSEDED

Eli Schwartz: 1
 commands: fix kick to accept kick reasons

 1 files changed, 4 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/goguma-dev/patches/51749/mbox | git am -3
Learn more about email & git

[PATCH] commands: fix kick to accept kick reasons Export this patch

Given the kick message:

```
/kick user123 testing, testing, see if kick messages work
```

The IRC message passed the nick field as:

"user123 testing, testing, see if kick messages work"

which simply did not work at all. Instead, pass only the first word as
the nick, and as a bonus, pass the rest concatenated as the kick reason.

Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
---
 lib/commands.dart | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/commands.dart b/lib/commands.dart
index e42eef7..a7fd0fc 100644
--- a/lib/commands.dart
+++ b/lib/commands.dart
@@ -32,7 +32,10 @@ String? _kick(BuildContext context, String? param) {
	if (!client.isChannel(buffer.name)) {
		throw CommandException('This command can only be used in channels');
	}
	client.send(IrcMessage('KICK', [buffer.name, _requireParam(param)]));
	var parts = _requireParam(param).split(' ');
	var nick = parts[0];
	var reason = parts.length > 1? parts.sublist(1).join(' ') : '';
	client.send(IrcMessage('KICK', [buffer.name, nick, reason]));
	return null;
}

-- 
2.43.2