an experimental irc client

input: don't allow empty / whitespace only messages

rockorager.dev 6d8f6803 8596cc7b

verified
+12
+12
src/irc.zig
··· 306 306 } 307 307 308 308 fn onSubmit(ptr: ?*anyopaque, ctx: *vxfw.EventContext, input: []const u8) anyerror!void { 309 + // Check the message is not just whitespace 310 + for (input) |b| { 311 + // Break on the first non-whitespace byte 312 + if (!std.ascii.isWhitespace(b)) break; 313 + } else return; 314 + 309 315 const self: *Channel = @ptrCast(@alignCast(ptr orelse unreachable)); 310 316 311 317 // Copy the input into a temporary buffer ··· 1806 1812 } 1807 1813 1808 1814 fn onSubmit(ptr: ?*anyopaque, ctx: *vxfw.EventContext, input: []const u8) anyerror!void { 1815 + // Check the message is not just whitespace 1816 + for (input) |b| { 1817 + // Break on the first non-whitespace byte 1818 + if (!std.ascii.isWhitespace(b)) break; 1819 + } else return; 1820 + 1809 1821 const self: *Client = @ptrCast(@alignCast(ptr orelse unreachable)); 1810 1822 1811 1823 // Copy the input into a temporary buffer