diff --git a/src/app.zig b/src/app.zig index 751693f..e5f97a6 100644 --- a/src/app.zig +++ b/src/app.zig @@ -5,6 +5,7 @@ const vaxis = @import("vaxis"); const zeit = @import("zeit"); const ziglua = @import("ziglua"); const Scrollbar = @import("Scrollbar.zig"); +const main = @import("main.zig"); const irc = comlink.irc; const lua = comlink.lua; @@ -884,6 +885,18 @@ pub const App = struct { return client.queueWrite(msg); }, .redraw => self.vx.queueRefresh(), + .version => { + if (channel == null) return error.InvalidCommand; + const msg = try std.fmt.bufPrint( + &buf, + "NOTICE {s} :\x01VERSION comlink {s}\x01\r\n", + .{ + channel.?.name, + main.version, + }, + ); + return client.queueWrite(msg); + }, .lua_function => {}, // we don't handle these from the text-input } } diff --git a/src/comlink.zig b/src/comlink.zig index 0a649b7..24977ee 100644 --- a/src/comlink.zig +++ b/src/comlink.zig @@ -29,6 +29,7 @@ pub const Command = union(enum) { part, close, redraw, + version, lua_function: i32, pub var user_commands: std.StringHashMap(i32) = undefined; @@ -47,6 +48,7 @@ pub const Command = union(enum) { .{ "part", .part }, .{ "close", .close }, .{ "redraw", .redraw }, + .{ "version", .version }, }); pub fn fromString(str: []const u8) ?Command {