Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ircClient.nick instead of nickname when guarding against events for current nick #257

Merged
merged 1 commit into from
Jul 1, 2017

Conversation

Throne3d
Copy link
Collaborator

@Throne3d Throne3d commented Jul 1, 2017

As the irc library can change the nick of the bot when connecting (e.g. because the nick is currently taken, by some other user), this.nickname may not correspond to the current nickname and so when receiving a join event upon joining a channel (prior to the names event), the current guard against this can pass despite it being an event for the bot.

This modifies it to check against ircClient.nick where relevant, and also modifies the test stubs to allow adding the nickname to the config and exposing this functionality in tests.

To see the failure before this patch, enable ircStatusNotices and run two copies of the bot; the second should crash upon joining a channel, as it will have a modified nickname (e.g. 'testbot1').

The use of ...args in the constructor is because it seems writing constructor(_, nickname, _) clashes due to same-named parameters, and constructor(_server, nickname, _ircOptions) seems to complain about unused variables (though the _s are intended to show that this has been acknowledged).

As the irc library can change the nick of the bot when
connecting (e.g. because the nick is currently taken, by
some other user), `this.nickname` may not correspond to the
current nickname and so when receiving a join event upon
joining a channel (prior to the names event), the current
guard against this can pass despite it being an event for
the bot.

This modifies it to check against ircClient.nick where
relevant, and also modifies the test stubs to allow adding
the nickname to the config and exposing this functionality
in tests.

To see the failure before this patch, enable
`ircStatusNotices` and run two copies of the bot; the
second should crash upon joining a channel, as it will have
a modified nickname (e.g. 'testbot1').
@Throne3d Throne3d added the bug label Jul 1, 2017
@Throne3d Throne3d self-assigned this Jul 1, 2017
@coveralls
Copy link

coveralls commented Jul 1, 2017

Coverage Status

Coverage remained the same at 98.456% when pulling 76fda25 on Throne3d:fix/nickname-differs into 80c3752 on reactiflux:master.

@ekmartin
Copy link
Member

ekmartin commented Jul 1, 2017

Good catch, thanks!

@ekmartin ekmartin merged commit d7b4ab5 into reactiflux:master Jul 1, 2017
@Throne3d Throne3d deleted the fix/nickname-differs branch July 1, 2017 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants