~rockorager/comlink

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH] irc: implement /part command

Details
Message ID
<20240719175014.71875-1-greg@gpanders.com>
DKIM signature
pass
Download raw message
Patch: +21 -1
/close is an alias.
---
 src/App.zig | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/App.zig b/src/App.zig
index 5d0e864..f5b22f9 100644
--- a/src/App.zig
+++ b/src/App.zig
@@ -786,7 +786,7 @@ pub fn run(self: *App) !void {
                                if (std.mem.indexOf(u8, content, msg.client.config.nick)) |_| {
                                    var buf: [64]u8 = undefined;
                                    const title_or_err = if (msg.source) |source|
                                        std.fmt.bufPrint(&buf, "{s} - {s}", .{channel.name, source })
                                        std.fmt.bufPrint(&buf, "{s} - {s}", .{ channel.name, source })
                                    else
                                        std.fmt.bufPrint(&buf, "{s}", .{channel.name});
                                    const title = title_or_err catch title: {
@@ -1272,6 +1272,8 @@ pub const Command = enum {
    quit,
    who,
    names,
    part,
    close,

    /// if we should append a space when completing
    pub fn appendSpace(self: Command) bool {
@@ -1280,6 +1282,8 @@ pub const Command = enum {
            .join,
            .me,
            .msg,
            .part,
            .close,
            => true,
            else => false,
        };
@@ -1383,6 +1387,22 @@ pub fn handleCommand(self: *App, buffer: Buffer, cmd: []const u8) !void {
            );
            return self.queueWrite(client, msg);
        },
        .part, .close => {
            if (channel == null) return error.InvalidCommand;
            var it = std.mem.tokenizeScalar(u8, cmd, ' ');

            // Skip command
            _ = it.next();

            const msg = try std.fmt.bufPrint(
                &buf,
                "PART {s}\r\n",
                .{
                    it.next() orelse channel.?.name,
                },
            );
            return self.queueWrite(client, msg);
        },
    }
}

-- 
2.45.2
Details
Message ID
<D2TRDMRG8TW5.3DQILBQYSYTR5@partin.io>
In-Reply-To
<20240719175014.71875-1-greg@gpanders.com> (view parent)
DKIM signature
pass
Download raw message
Reviewed-by: Tristan Partin <tristan@partin.io>

-- 
Tristan Partin
https://tristan.partin.io
Details
Message ID
<D2UJJ33DPUHU.17D96HQQP3PU6@timculverhouse.com>
In-Reply-To
<20240719175014.71875-1-greg@gpanders.com> (view parent)
DKIM signature
pass
Download raw message
On Fri Jul 19, 2024 at 12:50 PM CDT, Gregory Anders wrote:
> /close is an alias.
> ---

Applied! Thanks!

-- 
Tim
Reply to thread Export thread (mbox)