diff options
| author | Nakidai <nakidai@disroot.org> | 2026-02-13 00:19:07 +0300 |
|---|---|---|
| committer | Nakidai <nakidai@disroot.org> | 2026-02-13 00:19:07 +0300 |
| commit | 3f2bbeda9cae1e3d3f50d984549c82a5a29d2f6f (patch) | |
| tree | a116461d3102fdf2be87bd033780873f9cd55c8f /handle.c | |
| parent | 83c7d5f26cc3dcc93967a694b6b07447e839d6c1 (diff) | |
| download | libreircd-3f2bbeda9cae1e3d3f50d984549c82a5a29d2f6f.tar.gz libreircd-3f2bbeda9cae1e3d3f50d984549c82a5a29d2f6f.zip | |
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
Diffstat (limited to 'handle.c')
| -rw-r--r-- | handle.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/handle.c b/handle.c index 9c4590a..25c6875 100644 --- a/handle.c +++ b/handle.c @@ -518,6 +518,17 @@ setcreation(struct Message *msg, struct Peer *peer) } 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) { ensure(peer->type == CONFIG, reply(peer, 481, "You're not a config file"), 0); @@ -649,6 +660,7 @@ static struct Handler { { "privmsg", privmsg }, { "quit", quit }, { "setcreation", setcreation }, + { "sethostname", sethostname }, { "setinfo", setinfo }, { "setoper", setoper }, { "user", user }, |