aatxe / irc

the irc crate – usable, async IRC for Rust
Mozilla Public License 2.0
527 stars 100 forks source link

Are `joined_chans` and `config_chans` accidentally switched here in `ClientState::handle_message`? #204

Closed 8573 closed 3 years ago

8573 commented 4 years ago

https://github.com/aatxe/irc/blob/751c56e85bd43ac6cf8589a8707b6c9b2409f102/src/client/mod.rs#L586-L592

I well may be misunderstanding, but this looks to me like "If we've joined a channel C that we weren't supposed to join, then join C again". Is it intended to be "If we've not joined a channel C that we were supposed to join, then join C"?

aatxe commented 4 years ago

The code directly above the part quoted joins anything that is in config_chans (using any keys that are defined in the configuration where appropriate). This code then attempts to rejoin anything that the client had already joined but was not specified in the configuration. In other words, this is an attempt at gracefully restoring channel membership after a disconnection. It's only an attempt because it's possible that some of the channels required an invitation or password to join, and thus this will fail.