~emersion/goguma-dev

commands: Add /PART v1 APPLIED

delthas: 1
 commands: Add /PART

 1 files changed, 20 insertions(+), 0 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/50305/mbox | git am -3
Learn more about email & git

[PATCH] commands: Add /PART Export this patch

This also enables advanced users to do /part detach.
---
Tested locally.

 lib/commands.dart | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/lib/commands.dart b/lib/commands.dart
index 6c66b8d..e42eef7 100644
--- a/lib/commands.dart
+++ b/lib/commands.dart
@@ -2,6 +2,7 @@ import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart';

import 'client.dart';
import 'database.dart';
import 'irc.dart';
import 'models.dart';

@@ -49,6 +50,24 @@ String? _mode(BuildContext context, String? param) {
	return null;
}

String? _part(BuildContext context, String? param) {
	var client = context.read<Client>();
	var bufferList = context.read<BufferListModel>();
	var buffer = context.read<BufferModel>();
	var db = context.read<DB>();
	if (!client.isChannel(buffer.name)) {
		throw CommandException('This command can only be used in channels');
	}
	if (param != null) {
		client.send(IrcMessage('PART', [buffer.name, param]));
	} else {
		client.send(IrcMessage('PART', [buffer.name]));
	}
	bufferList.setArchived(buffer, true);
	db.storeBuffer(buffer.entry);
	return null;
}

String? _quote(BuildContext context, String? param) {
	var client = context.read<Client>();
	IrcMessage msg;
@@ -66,5 +85,6 @@ const Map<String, Command> commands = {
	'kick': _kick,
	'me': _me,
	'mode': _mode,
	'part': _part,
	'quote': _quote,
};

base-commit: 1bcb771223fcb8e18e5df503e52b0d7bb0f7486b
-- 
2.44.0
Pushed, thanks!