# patchyIRCD
-patchy IRC server?????
\ No newline at end of file
+patchy IRC server?????
+
+## How to compile and use
+Basic compilation:
+```
+cp config.example.mk config.mk
+make
+```
+
+Some things are configurable via compile-time flags. In particular, `-DHAS_TLS`
+and some constants defined in `src/config.h`.
+
+For TLS you gonna need to place your certificate and private key in
+`cert.pem` and `key.pem` respectively.
+
+`ops.txt` `users.txt` and `newusers.txt` contain hashed passwords. `ops.txt` is
+used for OPER command, `users.txt` is used for PASS command (which we use for
+our bespoke user account system). NEWACC command adds lines to `newusers.txt`.
+To verify a registration, simply copy lines from `newusers.txt` to `users.txt`.
+You can set password from command line like so `./setpass username file.txt`
+(the file must already exist).
+
+`help.txt` file contains the text for the HELP command. You can use the provided
+`help.example.txt` file.
+
+When the server starts, it reads the `init.txt` file. A fake oper connection
+performs the actions specified in the file. This allows initializing permanent
+channels. If you specify source (i.e. `:nick!user@host` before the command),
+the oper's nick will change accordingly. You can also fake the current unix time
+by prefixing the line with `$123` (`$0` sets the time back to real time). Faking
+nick and time is useful for JOIN and TOPIC commands. `chanlog.txt` records all
+channels changes in this format.
+
+## Command-line options
+Add TCP listeners with `--listenPlain ip port` and `--listenTls ip port`. If
+none are specified, the default is:
+```
+--listenPlain 0 6667
+--listenPlain :: 6667
+--listenTls 0 6697
+--listenTls :: 6697
+```
+IPv4 and IPv6 must be specified separately.
+
+With `--autojoin \#ircmoment` clients will automatically join the `#ircmoment`
+channel. This option can be specified multiple times.
--- /dev/null
+= Account registration
+To use this feature, you connect using TLS on port 6697.
+To register an account run /NEWACC [user] [pass]
+You might have to use /quote NEWACC if your client is bad.
+Registration is verified manually, so contact IRCops to enable your
+account. To login, set up the username/password in your client.
+
+Registering an account has the following benefits:
+- You can take over the nickname that equals to your account name using
+ the /GHOST command.
+- Your username won't be prefixed with a ~, and thus:
+- You can join registered-only channels (+b *!~*@*)
+- You can create secure private channels (+iI *!acc@*)
+
+Username must be in lowercase, though the corresponding nickname doesn't
+have to be.
+
+= User modes
+The ones you can set: +i invisible, +w wallops
+Other modes: +o ircop, +r registered, +Z tls
+
+= Channel modes
+Ban lists: +b ban, +e ban exception, +I invite exception, +q quiet
+Channel prefix: +o operator, +v voice, +w auto-op (+w o:mask, +w v:mask)
+Other modes: +n no external messages, +t protected topic, +s secret
+ +m moderated, +i invite only, +k [key], +l [limit]
+IrcOp only: +P persist
+Additionally you can use MODE #chan +0 to view all ban lists.