add user and real name config options

This commit is contained in:
Aaron Blakely 2024-03-09 03:57:13 -06:00
parent 015c20e061
commit 0661b29519
4 changed files with 12 additions and 4 deletions

View File

@ -31,7 +31,8 @@ struct irc_conn
FILE *srv_fd; FILE *srv_fd;
#endif #endif
char nick[32]; char nick[50];
char user[50];
char admin[256]; char admin[256];
char host[256]; char host[256];
char port[5]; char port[5];

View File

@ -33,6 +33,12 @@ struct irc_conn read_config(struct irc_conn bot, char *file)
if (config_lookup_string(cf, "bot.nick", &base)) if (config_lookup_string(cf, "bot.nick", &base))
strlcpy(bot.nick, base, sizeof bot.nick); 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)) if (config_lookup_string(cf, "server.host", &base))
strlcpy(bot.host, base, sizeof bot.host); strlcpy(bot.host, base, sizeof bot.host);

View File

@ -134,7 +134,7 @@ void irc_connect(struct irc_conn *bot)
void irc_auth(struct irc_conn *bot) void irc_auth(struct irc_conn *bot)
{ {
irc_raw(bot, "NICK %s", bot->nick); 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 #ifndef _WIN32
fflush(bot->srv_fd); fflush(bot->srv_fd);
@ -291,9 +291,9 @@ void irc_parse_raw(struct irc_conn *bot, char *raw)
if (!strcmp("VERSION", ctcp)) if (!strcmp("VERSION", ctcp))
{ {
#ifdef _WIN32 #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 #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 #endif
} }
else else

View File

@ -5,6 +5,7 @@ bot:
verbose = 1; verbose = 1;
nick = "xbot"; nick = "xbot";
user = "xbot"; user = "xbot";
real = "xbot";
# owner of the bot (nick!user@host) # owner of the bot (nick!user@host)
admin = "ab3800!*@owner.ephasic.org"; admin = "ab3800!*@owner.ephasic.org";