Difference between revisions of "Account Tracking"

From EggWiki
Jump to navigation Jump to search
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
In Eggdrop version 1.9.3, the ability to identify users based on their IRC service account name was added. However, Eggdrop's ability to 100% accurately track the account name associated with a user on a channel depends on three server-provided features
* WHOX. WHOX is an updated version of the WHO command that can provide the account name of users in a channel when requested. WHOX allows Eggdrop to obtain the account status of members already present in a channel when it joins. You can view if your IRC server supports WHOX by viewing the 005 line when you connect to the server.
* Extended-join. Extended-join is an IRCv3 capability that sends the account name of a user (if present) when a user joins a channel. Extended-join allows Eggdrop to obtain the account status of a member as they join a channel. You can view if your IRC server supports this capability by sending /quote CAP LS with your IRC client and viewing the response.
* Account-notify. Account-notify is an IRCv3 capability that notifies members in a channel when a user authenticates to server. Account-notify allows Eggdrop to update the account status of a user if they authenticate after joining a channel. You can view if your IRC server supports this capability by sending /quote CAP LS with your IRC client and viewing the response.
If these three capabilities are all present and enabled, Eggdrop can accurately track a user's account status at all times. If one or more of these three capabilities is missing, Eggdrop will attempt a "best-effort" at tracking account status based on the information it can glean from the capabilities that are enabled. Additionally, you can negotiate the "account-tag" capability (if the IRC server supports it) and Eggdrop will update the account information of a user that speaks in a channel. For those that like tables, it looks like this:
{| class="wikitable"
{| class="wikitable"
! style="text-align:left;"| Updates the account list when the...
! style="text-align:left;"| Eggdrop updates the account list when the...
! WHOX
! WHOX
! extended-join
! account-notify
! account-notify
! account-tag
! account-tag
! extended-join
|-
|-
|... bot joins a channel
|... bot joins a channel
Line 14: Line 21:
|... auth'd user joins a channel
|... auth'd user joins a channel
|
|
| style="text-align:center;" | X
|
|
|
|
| style="text-align:center;" | X
|-
|-
|... auth'd user talks
|... user authenticates on a channel
|
|
|
|
Line 24: Line 31:
|
|
|-
|-
|... user authenticates on a channel
|... auth'd user talks
|
|
| style="text-align:center;" | X
|
|
|
|
| style="text-align:center;" | X
|}
|}


== Use in Tcl Scripts ==
The ability to track accounts opens up a wealth of possibilities for Tcl scripts. In order to trigger Tcl script events to cover all instances where a user logs in, it is recommended to pair an ACCOUNT bind with a JOIN bind. This will allow you to check the account (if any) associated with a user as they join, as well as if they authenticate after joining.


 
== Imperfect Tracking ==
 
If the WHOX, extended-join and account-notify are not all enabled, the accuracy of the account list looks like this:
 
 


{| class="wikitable"
{| class="wikitable"
Line 42: Line 49:
! extended-join
! extended-join
! account-tag
! account-tag
| Eggdrop properly tracks a user's account status when...
| Eggdrop properly tracks a user's account status...
|-
|-
| style="text-align:center;" | X
| style="text-align:center;" | X
Line 48: Line 55:
|
|
|
|
| ... the bot joins the channel and the user is already authenticated
| ... when the bot joins the channel and the user is already authenticated
|-
|-
| style="text-align:center;" | X
| style="text-align:center;" | X
Line 54: Line 61:
|
|
|
|
| ...the bot joins the channel and the user is already authenticated, of the user authenticates in a common channel
| ... when the bot joins the channel and the user is already authenticated, or the user authenticates in a common channel
|-
|-
| style="text-align:center;" | X
| style="text-align:center;" | X
Line 68: Line 75:
| ... all the time
| ... all the time
|-
|-
| style="text-align:center;" | X
| style="text-align:center;" | X
| style="text-align:center;" | X
|  
|  
| style="text-align:center;" | X
| style="text-align:center;" | X
| style="text-align:center;" | X
| ... when the bot joins the channel and the user is already authenticated, or if the user authenticates in a common channel, or an authenticated user joins then talks in a common channel
| ... when the bot joins the channel and the user is already authenticated, or if the user is authenticated before they join a common channel, or once a they join a common channel then authenticate and then talk
|-
|-
| style="text-align:center;" | X
| style="text-align:center;" | X
| style="text-align:center;" | X
|  
|  
|  
| style="text-align:center;" | X
| style="text-align:center;" | X
| ... when the bot joins the channel and the user is already authenticated, or if the user is authenticated before they join a common channel, or once they talk after authenticating and joining a common channel
| ... when the bot joins the channel and the user is already authenticated, or once an authenticated user talks after joining
|-
|-
| style="text-align:center;" | X
| style="text-align:center;" | X
|  
|  
|
| style="text-align:center;" | X
| style="text-align:center;" | X
| ... when the bot joins the channel, once an authenticated user talks after joining
| style="text-align:center;" | X
| ... when the bot joins the channel and the user is already authenticated, or if the user is authenticated before they join a common channel, or once a they join a common channel then authenticate and then talk
|-
|-
|
|
Line 91: Line 98:
|  
|  
| ... when a user authenticates in a common channel or an already authenticated user joins a channel
| ... when a user authenticates in a common channel or an already authenticated user joins a channel
|-
| style="text-align:center;" | X
|
| style="text-align:center;" | X
|
| ... when the bot joins the channel and the user is already authenticated, or an already authenticated user joins a channel
|-
|-
|  
|  
Line 102: Line 115:
| style="text-align:center;" | X
| style="text-align:center;" | X
| style="text-align:center;" | X
| style="text-align:center;" | X
| ... when an authenticated user joins a channel and the user is already authenticated, when a user authenticates in the channel, when a user authenticated before the bot joined talks
| ... when an authenticated user joins a common channel, or when a user authenticates in the channel, or when a user authenticated before the bot joined talks
|-
|-
|  
|  
Line 108: Line 121:
|
|
| style="text-align:center;" | X
| style="text-align:center;" | X
| ... when a user authenticates in a common channel or a user who authenticated before the bot joined talks
| ... when a user authenticates in a common channel, or a user who authenticated before the bot joined talks
|-
|-
|  
|  
Line 129: Line 142:
|-
|-
|}
|}
== Example Tcl Script ==
This is an example script that allows an authenticated user to op someone via a public command
<code><pre>
bind PUB * .op acct_op
proc acct_op {nick user hand chan text} {
    set accthand [finduser -a [getaccount $nick]]
    if [string match $accthand ""] {
      putserv "PRIVMSG $chan :You are not authenticated"
      return 1
    }
    if {[matchattr $accthand +o|+o $chan]} {
      pushmode $chan +o $text
      putserv "PRIVMSG $chan :Op'ing $nick"
    } else {
      putserv "PRIVMSG $chan :You do not have access to .op"
    }
}
</pre></code>
This is an example script that performs actions when a user authenticates or joins a channel already authenticated
<code><pre>
bind ACCOUNT * * acct_track_acct
bind JOIN * * acct_track_join
proc acct_track_acct {nick user hand chan acct} {
    if {[string match $acct ""]} {
      putserv "PRIVMSG $chan :$nick de-authenticated"
    } else {
      putserv "PRIVMSG $chan :$nick is now authenticated as $acct"
    }
}
proc acct_track_join {nick user hand chan} {
    set acctnick [getaccount $nick]
    if {[string match $acctnick ""]} {
      putserv "PRIVMSG $chan :$nick joined and is not authenticated."
    } else {
      putserv "PRIVMSG $chan :$nick joined and is authenticated as $acctnick"
    }
}
</pre></code>

Latest revision as of 17:38, 13 July 2022

In Eggdrop version 1.9.3, the ability to identify users based on their IRC service account name was added. However, Eggdrop's ability to 100% accurately track the account name associated with a user on a channel depends on three server-provided features

  • WHOX. WHOX is an updated version of the WHO command that can provide the account name of users in a channel when requested. WHOX allows Eggdrop to obtain the account status of members already present in a channel when it joins. You can view if your IRC server supports WHOX by viewing the 005 line when you connect to the server.
  • Extended-join. Extended-join is an IRCv3 capability that sends the account name of a user (if present) when a user joins a channel. Extended-join allows Eggdrop to obtain the account status of a member as they join a channel. You can view if your IRC server supports this capability by sending /quote CAP LS with your IRC client and viewing the response.
  • Account-notify. Account-notify is an IRCv3 capability that notifies members in a channel when a user authenticates to server. Account-notify allows Eggdrop to update the account status of a user if they authenticate after joining a channel. You can view if your IRC server supports this capability by sending /quote CAP LS with your IRC client and viewing the response.

If these three capabilities are all present and enabled, Eggdrop can accurately track a user's account status at all times. If one or more of these three capabilities is missing, Eggdrop will attempt a "best-effort" at tracking account status based on the information it can glean from the capabilities that are enabled. Additionally, you can negotiate the "account-tag" capability (if the IRC server supports it) and Eggdrop will update the account information of a user that speaks in a channel. For those that like tables, it looks like this:

Eggdrop updates the account list when the... WHOX extended-join account-notify account-tag
... bot joins a channel X
... auth'd user joins a channel X
... user authenticates on a channel X
... auth'd user talks X

Use in Tcl Scripts

The ability to track accounts opens up a wealth of possibilities for Tcl scripts. In order to trigger Tcl script events to cover all instances where a user logs in, it is recommended to pair an ACCOUNT bind with a JOIN bind. This will allow you to check the account (if any) associated with a user as they join, as well as if they authenticate after joining.

Imperfect Tracking

If the WHOX, extended-join and account-notify are not all enabled, the accuracy of the account list looks like this:

WHOX account-notify extended-join account-tag Eggdrop properly tracks a user's account status...
X ... when the bot joins the channel and the user is already authenticated
X X ... when the bot joins the channel and the user is already authenticated, or the user authenticates in a common channel
X X X ... all the time
X X X X ... all the time
X X X ... when the bot joins the channel and the user is already authenticated, or if the user authenticates in a common channel, or an authenticated user joins then talks in a common channel
X X ... when the bot joins the channel and the user is already authenticated, or once an authenticated user talks after joining
X X X ... when the bot joins the channel and the user is already authenticated, or if the user is authenticated before they join a common channel, or once a they join a common channel then authenticate and then talk
X X ... when a user authenticates in a common channel or an already authenticated user joins a channel
X X ... when the bot joins the channel and the user is already authenticated, or an already authenticated user joins a channel
X ... when a user authenticates in a common channel
X X X ... when an authenticated user joins a common channel, or when a user authenticates in the channel, or when a user authenticated before the bot joined talks
X X ... when a user authenticates in a common channel, or a user who authenticated before the bot joined talks
X X .. when an already authenticated user joins the channel or a user who authenticated before the bot joined talks
X ... when an authenticated user joins the channel
X ... when an authenticated user talks

Example Tcl Script

This is an example script that allows an authenticated user to op someone via a public command

bind PUB * .op acct_op

proc acct_op {nick user hand chan text} {
    set accthand [finduser -a [getaccount $nick]]
    if [string match $accthand ""] {
      putserv "PRIVMSG $chan :You are not authenticated"
      return 1
    }
    if {[matchattr $accthand +o|+o $chan]} {
      pushmode $chan +o $text
      putserv "PRIVMSG $chan :Op'ing $nick"
    } else {
      putserv "PRIVMSG $chan :You do not have access to .op"
    }
}

This is an example script that performs actions when a user authenticates or joins a channel already authenticated

bind ACCOUNT * * acct_track_acct
bind JOIN * * acct_track_join

proc acct_track_acct {nick user hand chan acct} {
    if {[string match $acct ""]} {
      putserv "PRIVMSG $chan :$nick de-authenticated"
    } else {
      putserv "PRIVMSG $chan :$nick is now authenticated as $acct"
    }
}

proc acct_track_join {nick user hand chan} {
    set acctnick [getaccount $nick]
    if {[string match $acctnick ""]} {
      putserv "PRIVMSG $chan :$nick joined and is not authenticated."
    } else {
      putserv "PRIVMSG $chan :$nick joined and is authenticated as $acctnick"
    }
}