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.
This commit is contained in:
@@ -117,6 +117,24 @@
|
||||
<since>0.4.0</since>
|
||||
</option>
|
||||
|
||||
<option name="reserved_sids" type="string" default="">
|
||||
<short>Alias reserved SIDs to certain users.</short>
|
||||
<check regexp="((\S+)(\s(\S+))*)?" />
|
||||
<description><![CDATA[
|
||||
<p>
|
||||
When setting up user commands, you may want to be able to use them to private message a certain account (e.g., a bot connected to the hub). Since a session ID (SID) is allocated to a client prior to it sending its nickname, this is not directly possible. Instead, you can reserve fixed SIDs which are aliased to a particular user when they connect. As they are reserved when the hub starts up, these have predictable values.
|
||||
</p>
|
||||
<p>
|
||||
Each nickname in the list must be separated by a space. The SID AAAA is reserved for the hub itself. The first nickname in the list will be aliased to AAAB, the second to AAAC and so on. Fixed SIDs can only be allocated to registered users - if somebody without a password logs in under a reserved nickname, the alias will not be applied (but they can still log in). Also, they are only checked when a private message is sent, so any other messages to/from the aliased SID will be dropped as an unknown user per the ADC protocol.
|
||||
</p>
|
||||
]]></description>
|
||||
<example><![CDATA[
|
||||
# QuoteBot = AAAB, StatBot = AAAC
|
||||
reserved_sids = QuoteBot StatBot
|
||||
]]></example>
|
||||
<since>0.5.0</since>
|
||||
</option>
|
||||
|
||||
<option name="obsolete_clients" type="boolean" default="0">
|
||||
<short>Support obsolete clients using a ADC protocol prior to 1.0</short>
|
||||
<description><![CDATA[
|
||||
|
||||
Reference in New Issue
Block a user