summaryrefslogtreecommitdiff
path: root/blabouncer.c
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-05-29 22:32:45 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-05-29 22:32:45 +0100
commit013e8d87e979b121b1589ca9609e9b721e8f3a81 (patch)
tree3d443f3e239fa7c23b97337897d741749b54395f /blabouncer.c
parented24151c06ebf40ab120b01d8f8ae06a7b6cc0cb (diff)
Implement an optional connect command, providing an example configuration of a NickServ IDENTIFY command.
Diffstat (limited to 'blabouncer.c')
-rw-r--r--blabouncer.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/blabouncer.c b/blabouncer.c
index 60ccf91..e5f1723 100644
--- a/blabouncer.c
+++ b/blabouncer.c
@@ -102,6 +102,7 @@ struct settings {
char ircserver[HOST_NAME_MAX];
char ircserverport[MAXPORTLEN];
char ircserverpassword[MAXDATASIZE - 5]; // -5 for "PASS "
+ char connectcommand[MAXDATASIZE];
char conffile[PATH_MAX];
char certfile[PATH_MAX];
char keyfile[PATH_MAX];
@@ -863,6 +864,10 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli
// Receiving greeting 004 means we're now registered
// Request IRCv3 multi-prefix extension so we can more accurately inform new clients about current user prefixes
sendtoserver(server_ssl, "CAP REQ multi-prefix", strlen("CAP REQ multi-prefix"), 0, clients, settings);
+ // Send the connect command, if set
+ if (settings->connectcommand[0]) {
+ sendtoserver(server_ssl, settings->connectcommand, strlen(settings->connectcommand), 0, clients, settings);
+ }
// If this is a reconnection, JOIN existing channels and catch clients up again
if (ircdstrings->reconnecting) {
// First tell clients if our nick changed
@@ -2547,6 +2552,11 @@ int main(int argc, char *argv[]) {
settings.ircserverpassword[0] = '\0';
}
+ // What is the connect command, if any?
+ if (!getconfstr("connectcommand", settings.conffile, settings.connectcommand)) {
+ settings.connectcommand[0] = '\0';
+ }
+
// Is the base directory set? If not, use the default.
if (!getconfstr("basedir", settings.conffile, settings.basedir)) {
snprintf(settings.basedir, PATH_MAX, "%s/.blabouncer/", getenv("HOME"));