an experimental irc client

irc: add VERSION command

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>

+15
+13
src/app.zig
··· 5 5 const zeit = @import("zeit"); 6 6 const ziglua = @import("ziglua"); 7 7 const Scrollbar = @import("Scrollbar.zig"); 8 + const main = @import("main.zig"); 8 9 9 10 const irc = comlink.irc; 10 11 const lua = comlink.lua; ··· 884 885 return client.queueWrite(msg); 885 886 }, 886 887 .redraw => self.vx.queueRefresh(), 888 + .version => { 889 + if (channel == null) return error.InvalidCommand; 890 + const msg = try std.fmt.bufPrint( 891 + &buf, 892 + "NOTICE {s} :\x01VERSION comlink {s}\x01\r\n", 893 + .{ 894 + channel.?.name, 895 + main.version, 896 + }, 897 + ); 898 + return client.queueWrite(msg); 899 + }, 887 900 .lua_function => {}, // we don't handle these from the text-input 888 901 } 889 902 }
+2
src/comlink.zig
··· 29 29 part, 30 30 close, 31 31 redraw, 32 + version, 32 33 lua_function: i32, 33 34 34 35 pub var user_commands: std.StringHashMap(i32) = undefined; ··· 47 48 .{ "part", .part }, 48 49 .{ "close", .close }, 49 50 .{ "redraw", .redraw }, 51 + .{ "version", .version }, 50 52 }); 51 53 52 54 pub fn fromString(str: []const u8) ?Command {