From 3f2bbeda9cae1e3d3f50d984549c82a5a29d2f6f Mon Sep 17 00:00:00 2001 From: Nakidai Date: Fri, 13 Feb 2026 00:19:07 +0300 Subject: Add SETHOSTNAME command Also remove hostname argument from the cli. It'd be better to have it in a config file rather than passing through an argument, it was like that since times config file didn't exist, but time has changed --- handle.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'handle.c') diff --git a/handle.c b/handle.c index 9c4590a..25c6875 100644 --- a/handle.c +++ b/handle.c @@ -517,6 +517,17 @@ setcreation(struct Message *msg, struct Peer *peer) return 0; } +static int +sethostname(struct Message *msg, struct Peer *peer) +{ + ensure(peer->type == CONFIG, reply(peer, 481, "You're not a config file"), 0); + ensure(msg->params[0] && *msg->params[0], reply(peer, 461, msg->command), 0); + + strlcpy(hostname, msg->params[0], sizeof(hostname)); + + return 0; +} + static int setinfo(struct Message *msg, struct Peer *peer) { @@ -649,6 +660,7 @@ static struct Handler { { "privmsg", privmsg }, { "quit", quit }, { "setcreation", setcreation }, + { "sethostname", sethostname }, { "setinfo", setinfo }, { "setoper", setoper }, { "user", user }, -- cgit 1.4.1