summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO2
-rw-r--r--blabouncer.c10
-rw-r--r--blabouncer.conf.example3
-rw-r--r--config.c3
4 files changed, 16 insertions, 2 deletions
diff --git a/TODO b/TODO
index e7d8df2..7e6fb96 100644
--- a/TODO
+++ b/TODO
@@ -11,6 +11,4 @@ Send a PING to the server before assuming a timeout is definite.
Implement daemon (background) mode.
-Implement connect commands (plus maybe a specific NickServ IDENTIFY command).
-
Include NOTICEs in the replay log.
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"));
diff --git a/blabouncer.conf.example b/blabouncer.conf.example
index 09bc00e..6fd5c7a 100644
--- a/blabouncer.conf.example
+++ b/blabouncer.conf.example
@@ -43,6 +43,9 @@ ircserverport = "6697"
# Real IRC server password
#ircserverpassword = "apples"
+# Command to send to the server upon completing registration (e.g. a NickServ password)
+#connectcommand "PRIVMSG NickServ IDENTIFY bananas"
+
# Base directory (defaults to $HOME/.blabouncer/)
# Things such as the logs directory will be placed below this
#basedir = "/home/foo/.blabouncer/"
diff --git a/config.c b/config.c
index 480d567..b615fa2 100644
--- a/config.c
+++ b/config.c
@@ -204,6 +204,9 @@ int createconfigfile(char *filename) {
"# Real IRC server password\n"
"#ircserverpassword = \"apples\"\n"
"\n"
+ "# Command to send to the server upon completing registration (e.g. a NickServ password)\n"
+ "#connectcommand \"PRIVMSG NickServ IDENTIFY bananas\"\n"
+ "\n"
"# Base directory (defaults to $HOME/.blabouncer/)\n"
"# Things such as the logs directory will be placed below this\n"
"#basedir = \"/home/foo/.blabouncer/\"\n"