|
| 1 | +Account tracking in Eggdrop |
| 2 | + |
| 3 | +In Eggdrop 1.9.3, Eggdrop added the ability to associate nicknames with |
| 4 | +the service accounts they are logged into. It is IMPORTANT to note that |
| 5 | +Eggdrop's ability to do this is dependent on an IRC server's |
| 6 | +implementation of three features- the IRCv3 extended-join capability, |
| 7 | +the IRCv3 account-notify capability, and WHOX support. All three of |
| 8 | +these features must be supported by the server and, in the case of |
| 9 | +extended-join and account-notify, requested by Eggdrop in order for |
| 10 | +Eggdrop to maintain "perfect" association between nicknames and account |
| 11 | +statuses. |
| 12 | + |
| 13 | +REQUIRED SERVER CAPABILITIES |
| 14 | + |
| 15 | +You're going to see this repeated a lot- the IRC server must support |
| 16 | +three features in order for Eggdrop to accurately associate accounts |
| 17 | +with nicknames. These three features allow Eggdrop to always know the |
| 18 | +current association between an account and a nickname by getting account |
| 19 | +statuses of users already on a channel when it joins, new users joining |
| 20 | +a channel, and users who authenticate while on a channel. |
| 21 | + |
| 22 | +extended-join |
| 23 | + |
| 24 | +extended-join is an IRCv3-defined capability that adds the account name |
| 25 | +of a user to the JOIN message sent by the IRC server, alerting clients |
| 26 | +that a new member has joined a channel. Enabling this capability allows |
| 27 | +Eggdrop to immediately determine the account name associated with a user |
| 28 | +joining a channel |
| 29 | + |
| 30 | +account-notify |
| 31 | + |
| 32 | +account-notify is an IRCv3-defined capability that sends a message to a |
| 33 | +channel when a member of the channel either authenticates or |
| 34 | +deauthenticates from their account. Enabling this capability allows |
| 35 | +Eggdrop to immediately associate an account to a channel member when |
| 36 | +they authenticate or deauthenticate. |
| 37 | + |
| 38 | +WHOX |
| 39 | + |
| 40 | +'WHOX <https://ircv3.net/specs/extensions/whox>`_ is a server feature |
| 41 | +that allows a client to request custom fields to be returned in a WHO |
| 42 | +response. If a server supports this capability, Eggdrop sends a WHOX |
| 43 | +query to the server when it joins a channel, allowing it to immediately |
| 44 | +determine accounts associated with channel members when Eggdrop joins a |
| 45 | +channel. |
| 46 | + |
| 47 | +ENABLING EGGDROP ACCOUNT TRACKING |
| 48 | + |
| 49 | +By default, the Eggdrop config file will attempt to enable all the |
| 50 | +capabilities required for account tracking. There are two settings to |
| 51 | +pay attention to : |
| 52 | + |
| 53 | + # To request the account-notify feature via CAP, set this to 1 |
| 54 | + set account-notify 1 |
| 55 | + |
| 56 | + # To request the extended-join feature via CAP, set this to 1 |
| 57 | + set extended-join 1 |
| 58 | + |
| 59 | +The ability of a server to support WHOX queries is determined via a |
| 60 | +server's ISUPPORT (005) reply. If a server supports WHOX queries, |
| 61 | +Eggdrop will automatically enable this feature. |
| 62 | + |
| 63 | +CHECKING ACCOUNT-TRACKING STATUS |
| 64 | + |
| 65 | +While Eggdrop is running, join the partyline and type .status. If |
| 66 | +account-tracking is enabled (both the server supports and Eggdrop has |
| 67 | +requested), you'll see this line : |
| 68 | + |
| 69 | + Loaded module information: |
| 70 | + #eggdroptest : (not on channel) |
| 71 | + Channels: #eggdroptest (trying) |
| 72 | + Account tracking: Enabled <--- This line |
| 73 | + Online as: BeerBot (BeerBot) |
| 74 | + |
| 75 | +Otherwise, the prompt will tell you which required capability is |
| 76 | +missing/not enabled : |
| 77 | + |
| 78 | + Loaded module information: |
| 79 | + #eggdroptest : 2 members, enforcing "+tn" (greet) |
| 80 | + Channels: #eggdroptest (need ops) |
| 81 | + Account tracking: Best-effort (Missing capabilities: extended-join, see .status all for details) <---- This line |
| 82 | + Online as: Eggdrop (Eggdrop) |
| 83 | + |
| 84 | +DETERMINING IF A SERVER SUPPORTS ACCOUNT CAPABILITIES |
| 85 | + |
| 86 | +A server announces the capabilities it supports via a CAP request. If |
| 87 | +you have Tcl enabled on the partyline (or via a raw message from a |
| 88 | +client), you can send .tcl cap ls and see if the extended-join and |
| 89 | +account-notify capabilities are supported by the server. If they are not |
| 90 | +listed, the server does not support it. |
| 91 | + |
| 92 | +A server announces if it supports WHOX via its ISUPPORT (005) |
| 93 | +announcement. If you have Tcl enabled on the partyline, you can send |
| 94 | +.tcl issupport isset WHOX and if it returns '1', WHOX is supported by |
| 95 | +the server. |
| 96 | + |
| 97 | +BEST-EFFORT ACCOUNT TRACKING |
| 98 | + |
| 99 | +If a server only supports some, but not all, of the required |
| 100 | +capabilities, Eggdrop will switch to 'best effort' account tracking. |
| 101 | +This means Eggdrop will update account statuses whenever it sees account |
| 102 | +information, but in this mode Eggdrop cannot guarantee that all account |
| 103 | +associations are up to date. |
| 104 | + |
| 105 | +If a server does not support extended-join, Eggdrop will not be able to |
| 106 | +determine the account associated with a user when they join. Eggdrop can |
| 107 | +update this information by sending a WHOX to the server. |
| 108 | + |
| 109 | +If a server does not support account-notify, Eggdrop will not be able to |
| 110 | +determine the account associated with a user if they |
| 111 | +authenticate/deauthenticate from their account after joining a channel. |
| 112 | +Eggdrop can update this information by sending a WHOX to the server. |
| 113 | + |
| 114 | +If a server does not support WHOX, Eggdrop will not be able to determine |
| 115 | +the accounts associated with users already on a channel before Eggdrop |
| 116 | +joined. There is no reliable way to update this information. |
| 117 | + |
| 118 | +One workaround to significantly increase the accuracy of account |
| 119 | +tracking for scripts in a 'best effort' scenario would be to issue a |
| 120 | +WHOX query (assuming the server supports it), wait for the reply from |
| 121 | +the server, and then query for the account information. |
| 122 | + |
| 123 | +account-tag |
| 124 | + |
| 125 | +One supplementary capability that can assist a best-effort account |
| 126 | +tracking scenario is the IRCv3-defined account-tag capability. The |
| 127 | +account-tag capability attaches a tag with the account name associated |
| 128 | +with the user sending a command. Enabling this capability allows Eggdrop |
| 129 | +to update its account tracking every time a user talks in channel, sets |
| 130 | +a mode, sends a kick, etc. While still not able to offer the same level |
| 131 | +of accuracy as enabling the "main three" account tracking features, it |
| 132 | +can increase the overall accuracy of the account list. Additionally, |
| 133 | +binds that react to user activity (pub, kick, mode, etc) containing |
| 134 | +account-tag will update the internal account list prior to executing the |
| 135 | +associated callback, so looking up the account name in the callback can |
| 136 | +be considered accurate. |
| 137 | + |
| 138 | +USING ACCOUNTS WITH TCL SCRIPTS |
| 139 | + |
| 140 | +The Eggdrop Tcl ACCOUNT bind is triggered whenever an existing account |
| 141 | +record stored by Eggdrop is modified, such as a user de/authenticating |
| 142 | +to their account while in a channel, or information such as an |
| 143 | +account-tag being seen that updates an existing user. However, the |
| 144 | +ACCOUNT bind will NOT be triggered for the creation of a new user |
| 145 | +record, such as a user joining a channel. The bind is triggered for |
| 146 | +every channel the user is seen on- this means if a user is present with |
| 147 | +Eggdrop on four channels, the bind will be executed four times, each |
| 148 | +time with a different channel variable being passed to the associated |
| 149 | +Tcl procedure. Additionally, in a best-effort account tracking |
| 150 | +situation, Eggdrop will update the account associated with a user on all |
| 151 | +channels, not just the channel the event is seen on (and thus resulting |
| 152 | +in a bind trigger for each channel the user is on). |
| 153 | + |
| 154 | +In order to trigger Tcl script events to cover all instances where a |
| 155 | +user logs in, you need to pair an ACCOUNT bind with a JOIN bind. This |
| 156 | +will allow you to execute account-based events when a user joins as well |
| 157 | +as if they authenticate after joining. |
0 commit comments