+-----------------------------------------------------------------------
| Running ${PKGSTEM} on OpenBSD
+-----------------------------------------------------------------------

First ~/.epicrc
===============

By default EPIC5 is very minimalistic, but yet it is very powerful
IRC client, which can be greatly extended by embeded scripting
language, customizing almost every aspect of IRC. Since EPIC4 a lot of
functionality has been moved from C code to ircII scripts, which made
client more secure and more customizable. Without loading at least
several scripts at the beginning, client will be almost unusable.

$ cat ~/.epicrc
# set default paths where to look for the scripts
set load_path ~/.epic:${LOCALBASE}/share/epic5/script

# global script provides functions which were coded in C before (up/down
# arrows for history, ctcp, some internal functions, etc), this script
# is almost always required to get other scripts working
load global

# tabkey and reconnect functionality is implemented as a scripts, take
# a look inside this files to better customize their settings
load tabkey.ce
load reconnect

# switch windows by alt+<number>
load altchan

# by default client has no color formatting at all, if you prefer more
# colorful look, load this script, also a good start to understand general
# scripting capabilities of epic
load colors

Changing default server list
============================

To change default server list set IRCLIB environment variable in
your shell pointing to a directory and put ircII.servers file there,
each line of the file describing a server, format is documented in
http://help.epicsol.org/server_description

Example for Libera.Chat:

irc.libera.chat:7000:password=MYPASSWORD:nick=MYNICK:type=IRC-SSL

Don't forget to 'chmod 0600' the file, if you use passwords there.

SASL is supported by sasl_auth (PLAIN method only, use SSL) and
sasl_nistp256 scripts. Look comments in those scripts to get more
details how to use them.

pledge(2) and unveil(2)
=======================

EPIC5 has support for the syscalls on OpenBSD, you can use it in your
~/.epicrc file.

Example usage:

# don't forget to unveil /etc/ssl/cert.pem if you use ssl
@ unveil_set = [/home/user/irclogs rwc /usr/local/share/epic5/script r]

fe ($unveil_set) path perm {
	xecho -b Unveiling $path with $perm: $unveil($path $perm)
}

# forbid further unveil() calls
if (unveil() == 0) {
	xecho -b Successfully unveiled!
} else {
	xecho -b Unveil failed!
}

# this is minimal set of promises, you will need "wpath cpath fattr"
# for logging to work and "exec id" for /exec, also unveil /bin/sh for
# executing, or use /exec -direct (~ expando won't work in that case),
# with this syntax you can specify only first (promises) argument to
# pledge(2)
if (pledge(stdio rpath inet dns tty proc) == 0) {
	xecho -b Successfully pledged!
} else {
	xecho -b Pledge failed!
}

# using kwargs is also supported, you can use it to specify execpromises
# argument
if (plege({"promises": "...", "execpromises": "..."}) == 0) {
	xecho -b Successfully pledged!
} else {
	xecho -b Pledge failed!
}
