From 0661b2951948df381ea7a0485822e6ad2c0f139c Mon Sep 17 00:00:00 2001 From: Aaron Blakely Date: Sat, 9 Mar 2024 03:57:13 -0600 Subject: [PATCH] add user and real name config options --- lib/irc.h | 3 ++- src/config.c | 6 ++++++ src/irc.c | 6 +++--- xbot.cfg | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/irc.h b/lib/irc.h index 6916472..85177d8 100755 --- a/lib/irc.h +++ b/lib/irc.h @@ -31,7 +31,8 @@ struct irc_conn FILE *srv_fd; #endif - char nick[32]; + char nick[50]; + char user[50]; char admin[256]; char host[256]; char port[5]; diff --git a/src/config.c b/src/config.c index 0594aba..4c99f95 100755 --- a/src/config.c +++ b/src/config.c @@ -33,6 +33,12 @@ struct irc_conn read_config(struct irc_conn bot, char *file) if (config_lookup_string(cf, "bot.nick", &base)) strlcpy(bot.nick, base, sizeof bot.nick); + if (config_lookup_string(cf, "bot.user", &base)) + strlcpy(bot.user, base, sizeof bot.user); + + if (config_lookup_string(cf, "bot.real", &base)) + strlcpy(bot.real_name, base, sizeof bot.real_name); + if (config_lookup_string(cf, "server.host", &base)) strlcpy(bot.host, base, sizeof bot.host); diff --git a/src/irc.c b/src/irc.c index 3cc3143..b7762b8 100755 --- a/src/irc.c +++ b/src/irc.c @@ -134,7 +134,7 @@ void irc_connect(struct irc_conn *bot) void irc_auth(struct irc_conn *bot) { irc_raw(bot, "NICK %s", bot->nick); - irc_raw(bot, "USER %s \" %s :xbot v%s (https://github.com/ablakely/xbot)", bot->nick, bot->host, VERSION); + irc_raw(bot, "USER %s \" %s :%s", bot->user, bot->host, bot->real_name); #ifndef _WIN32 fflush(bot->srv_fd); @@ -291,9 +291,9 @@ void irc_parse_raw(struct irc_conn *bot, char *raw) if (!strcmp("VERSION", ctcp)) { #ifdef _WIN32 - irc_notice(bot, user, "VERSION xbot: v%s (Windows)", VERSION); + irc_notice(bot, user, "VERSION xbot: v%s [Windows] (https://github.com/ablakely/xbot)", VERSION); #else - irc_notice(bot, user, "VERSION xbot: v%s (Linux)", VERSION); + irc_notice(bot, user, "VERSION xbot: v%s [Linux] (https://github.com/ablakely/xbot)", VERSION); #endif } else diff --git a/xbot.cfg b/xbot.cfg index 78eddf1..fe9d7aa 100755 --- a/xbot.cfg +++ b/xbot.cfg @@ -5,6 +5,7 @@ bot: verbose = 1; nick = "xbot"; user = "xbot"; + real = "xbot"; # owner of the bot (nick!user@host) admin = "ab3800!*@owner.ephasic.org";