Last active
March 14, 2023 01:48
-
-
Save belak/09edcc4f5e51056bf5bc728647659d81 to your computer and use it in GitHub Desktop.
Revisions
-
belak revised this gist
Mar 14, 2023 . 1 changed file with 11 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,18 @@ # IRC User Mode Tracking This doc includes some random notes on implementing mode/presence tracking in IRC. Note that this implementation assumes we don't have access to any IRCv3 caps. There is a rough implementation for go-irc [here](https://github.com/go-irc/irc/blob/master/tracker.go). ## Simple cases - MODE - look up the user and channel and modify this mode - NICK - rename a user - RPL_NAMREPLY (353) - add user to channel and set modes ## Single user cases (anyone other than the connected user) - JOIN - add the user to the channel, creating the user if they aren't tracked yet. @@ -36,9 +40,12 @@ Note that this assumes we don't have access to any IRCv3 caps - A user must be in at least one channel common to the bot, or they will not be tracked. This means they can only use privmsg tracking if they are in at least one common channel. - Modes need to be grabbed from ISUPPORT (005) messages - RFC2812 defines 005 as something else, but this is not how it is used in practice. - We don't really know the bot's NICK until the 001 welcome message ## CAP notes If we can request IRCv3 CAPs, the following make this easier. - multi-prefix allows us to get all modes on joining a channel -
belak revised this gist
Mar 14, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # IRC User tracking Note that this assumes we don't have access to any IRCv3 caps -
belak revised this gist
Mar 31, 2016 . 1 changed file with 6 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,7 @@ Note that this assumes we don't have access to any IRCv3 caps - MODE - look up the user and channel and modify this mode - NICK - rename a user - RPL_NAMREPLY (353) - add user to channel and set modes ## Single user cases (so, anyone other than the bot itself) @@ -28,8 +29,6 @@ Note that this assumes we don't have access to any IRCv3 caps ## Annoying notes: - Without the multi-prefix CAP, in order to properly track a mode change we need to run a NAMES lookup every time a mode changes on a user. - There are a number of race conditions, all over the place, mostly around @@ -38,4 +37,8 @@ Note that this assumes we don't have access to any IRCv3 caps be tracked. This means they can only use privmsg tracking if they are in at least one common channel. - Modes need to be grabbed from ISUPPORT (005) messages - We don't really know the bot's NICK until the 001 welcome message ## CAP notes - multi-prefix allows us to get all modes on joining a channel -
belak revised this gist
Mar 31, 2016 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -37,4 +37,5 @@ Note that this assumes we don't have access to any IRCv3 caps - A user must be in at least one channel common to the bot, or they will not be tracked. This means they can only use privmsg tracking if they are in at least one common channel. - Modes need to be grabbed from ISUPPORT (005) messages - We don't really know the bot's NICK until the 001 welcome message -
belak revised this gist
Mar 31, 2016 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -36,4 +36,5 @@ Note that this assumes we don't have access to any IRCv3 caps private messages. - A user must be in at least one channel common to the bot, or they will not be tracked. This means they can only use privmsg tracking if they are in at least one common channel. - Modes need to be grabbed from ISUPPORT (005) messages -
belak revised this gist
Mar 31, 2016 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,6 +5,7 @@ Note that this assumes we don't have access to any IRCv3 caps ## Simple cases - MODE - look up the user and channel and modify this mode - NICK - rename a user ## Single user cases (so, anyone other than the bot itself) -
belak revised this gist
Mar 31, 2016 . 1 changed file with 7 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,31 +1,31 @@ # User tracking Note that this assumes we don't have access to any IRCv3 caps ## Simple cases - MODE - look up the user and channel and modify this mode ## Single user cases (so, anyone other than the bot itself) - JOIN - add the user to the channel, creating the user if they aren't tracked yet. - PART/KICK - remove the user from a channel, then if they aren't in any other tracked channels, remove them. - QUIT - remove the user from all channels. ## Bot user cases - JOIN - Add the bot to the channel and wait for the RPL_NAMREPLY response - PART/KICK - Remove all users from the given channel and run cleanup as needed. - QUIT - Pretty much a fatal error. ## Useful notes: - When a single user JOINs we don't need to grab modes from anywhere, since they should get MODE called on them after joining. ## Annoying notes: - When a bot joins a channel, we need to look up all users in the channel to grab channel modes. @@ -35,4 +35,4 @@ Note that this assumes we don't have access to any IRCv3 caps private messages. - A user must be in at least one channel common to the bot, or they will not be tracked. This means they can only use privmsg tracking if they are in at least one common channel. -
belak created this gist
Mar 31, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ * User tracking Note that this assumes we don't have access to any IRCv3 caps ** Simple cases - MODE - look up the user and channel and modify this mode ** Single user cases (so, anyone other than the bot itself) - JOIN - add the user to the channel, creating the user if they aren't tracked yet. - PART/KICK - remove the user from a channel, then if they aren't in any other tracked channels, remove them. - QUIT - remove the user from all channels. ** Bot user cases - JOIN - Add the bot to the channel and wait for the RPL_NAMREPLY response - PART/KICK - Remove all users from the given channel and run cleanup as needed. - QUIT - Pretty much a fatal error. ** Useful notes: - When a single user JOINs we don't need to grab modes from anywhere, since they should get MODE called on them after joining. ** Annoying notes: - When a bot joins a channel, we need to look up all users in the channel to grab channel modes. - Without the multi-prefix CAP, in order to properly track a mode change we need to run a NAMES lookup every time a mode changes on a user. - There are a number of race conditions, all over the place, mostly around private messages. - A user must be in at least one channel common to the bot, or they will not be tracked. This means they can only use privmsg tracking if they are in at least one common channel.