A basic IRC Client & Server written in Odin as a toy & learning project.
Well no truly "basic" but enough to be simple & reasonably usable.
The Client is limited to 1 channel & server connection at a time.
Whilst the Server is set up to handle multiple channels, has only been tested with one.
Both will handle & send UTF-8, however the Server's case mapping is always ASCII.
Neither are fully written to spec but it should be enough for most cases.
Each sub-package also has a main.odin for easy up and go.
The Server only supports the following commands; INFO, JOIN, KICK, KILL, LIST, LUSERS MOTD, NAMES, NICK, PART, PING, PONG, PRIVMSG, TIME, USER, VERSION, WHO, WHOIS & QUIT. All others are reponded with a ERR_UNKNOWNCOMMAND.
These were chosen as the mininum number of commands needed to operate an IRC server.
package irc_server_example
import irc "basic_irc/server"
main :: proc() {
s: irc.Server
irc.init_server(&s, irc.DEFAULT_ADDRESS)
defer irc.server_cleanup(&s)
// Optionally set a Ctrl-C handler for safe shutdown.
// irc.set_ctrl_hander()
irc.server_runner(&s)
}package irc_client_example
import irc "basic_irc/client"
main :: proc() {
c: irc.Client
irc.init_client(&c, "odin", "127.0.0.1:6697")
defer irc.client_cleanup(&c)
// Optionally get user input for config
/*
if !irc.get_user_config(&c) {
return
}
*/
irc.client_runner(&c)
}Neither the Client or Server have been hardend nor use TLS and should NOT be used on untrusted networks.
It is very likely the Client & Server don't follow common conventions, as I do not use IRC. I tried to do what I belive is reasonable & makes sense.
I have defered to Ergo in one or two places in the server, when I was unsure what to do.
Both the Server & Client have been checked against -vet -strict-style -vet-tabs -disallow-do -warnings-as-errors