1
0
Fork 0
QuasselClient/src/main.zig
2021-06-03 14:42:39 +01:00

30 lines
935 B
Zig

const std = @import("std");
const read = @import("./qtshit/read.zig");
const write = @import("./qtshit/write.zig");
const initClient = @import("./client.zig").initClient;
pub fn main() !void {
const allocator = std.heap.page_allocator;
var argIter = std.process.args();
_ = try argIter.next(allocator).?;
var host = try argIter.next(allocator).?;
var port = try argIter.next(allocator).?;
var portInt = try std.fmt.parseInt(u16, port, 10);
var username = try argIter.next(allocator).?;
var password = try argIter.next(allocator).?;
std.debug.print("host={s} port={d}\n", .{host, portInt});
var sock = try std.net.tcpConnectToHost(allocator, host, portInt);
var client = initClient(allocator, &sock);
try client.handshake();
try client.quassel_init_packet();
try client.quassel_login(username, password);
while (true) {
try client.read_quassel_packet();
}
}