Recently, while doing some work for a company, I was required to update some of their code to support new needs.
They had recently started an IRC server for internal communications as well as for their users.
This was in addition to their other public services.
While other public services may provide a system for web notifications, IRC does not.
Their current software could post some content to a webhook to send off these notifications, but I had to create a system that would receive them and post them to their IRC server.
The result is this project.
I wrote this bot for a very specific purpose, in a single day, and just made the code public.
I am not intending to maintain it.
Don't be surprised if it breaks, or doesn't do what you want.
Usage
The bot is actually pretty simple to use.
You need it to run on a server, and you can specify the port used for the webserver in src/config.h.
When the bot starts it joins the channel specified in the config.
To get it to join/leave more channels, private message the bot JOIN #channel or LEAVE #channel.
The bot is capable of identifying admins via idents and vhosts.
You need to specify these also in the config.
The bot can identify to a registered nick too.
First, register the nick with a password of your choice, then put that password in the config file.
If no password is defined, the bot will not attempt to identify.
To actually make it post, just send a POST request to the webserver, with the content value being the content you want it to post.
This content is read as plaintext, and is not URL encoded in any way.
This can allow for IRC command injection, so I do not recomment you make this webserver public.
The webserver supports basic authentication, so please use that if you are leaving this exposed to the internet.
You can optionally make this webserver SSL encrypted, but you will need to provide a SSL certificate for it in the file `cert.pem` in the same directory as the bot executable.
You can do this with the following command: openssl req -x509 -nodes -newkey rsa:4096 -keyout cert.pem -out cert.pem -days 365
Technical
IRC is a simple protocol and the IRC bot part of the code is contained in src/irc.c.
The webserver is also fairly simple and is in src/webserver.c.
To keep track of channels it's in, the bot maintains a linked list of channels.
When the bot is started, it creats 2 threads: the webserver, and the IRC bot.
The connections are just handled by sockets, which are wrapped through the OpenSSL library.
This is optional for the webserver, since, on internal connections, there is not much point using encryption.
It is also optional for the IRC connection, since not all IRC servers support SSL.