From c3b368a68ab2929206776f6a1dcc1edcbbda2e38 Mon Sep 17 00:00:00 2001 From: Blair Bonnett Date: Mon, 6 Aug 2012 23:58:57 +1200 Subject: [PATCH] Add ability to reserve SIDs for certain users. If you have a bot connected to the hub, and you want to add a user command to interact with the bot via PM, you need to know its session ID (SID). However, SIDs are assigned when the client first connects, prior to the nickname being sent, and so we cannot just assign a certain SID based on the nickname as part of the connection routine. To overcome this, this commit adds the ability to reserve the first few SIDs (at hub start time, when the SIDs are known) for certain nicknames. The user manager then checks each time a user logs in to see if the nickname matches a reserved one, and if so sets up an alias from the reserved SID to the SID the user was given. This alias is only checked for private messages (the ADC DMSG or EMSG commands) which are routed to the real user. Any other commands are ignored as there should be no need for such aliasing. The list of nicknames to reserve SIDs for is read from a space-separated list in the reserved_sids parameter of the config file. The reserved users must also be registered users (i.e., given a password) -- if they are not, the alias is not set up for them. --- src/core/config.xml | 18 +++++++ src/core/gen_config.c | 16 ++++++ src/core/gen_config.h | 1 + src/core/hub.c | 7 +++ src/core/usermanager.c | 109 +++++++++++++++++++++++++++++++++++++++++ src/core/usermanager.h | 10 ++++ 6 files changed, 161 insertions(+) diff --git a/src/core/config.xml b/src/core/config.xml index b5e949d..da0528b 100644 --- a/src/core/config.xml +++ b/src/core/config.xml @@ -117,6 +117,24 @@ 0.4.0 + +