Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix bugs in tracking bot's own usermodes #116

Merged
merged 2 commits into from

2 participants

@Elberet

These changes fix two bugs in how the bot tracks its own usermodes:

  1. The @modes array retains its values between reconnect attempts; this results in modes not being set when the bot reconnects to IRC.
  2. When actively setting modes, modes are added a second time to @modes when Cinch::IRC handles the MODE message.
lib/cinch/bot.rb
@@ -265,6 +265,8 @@ def start(plugins = true)
}
end
+ @modes = []
@dominikh Owner

We indent with spaces, not tabs. If you fix that, I can merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Elberet

Now indenting with spaces, as requested. :smile:

@dominikh dominikh merged commit 55b1633 into from
@dominikh
Owner

Merged, thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 1 deletion.
  1. +2 −0  lib/cinch/bot.rb
  2. +1 −1  lib/cinch/irc.rb
View
2  lib/cinch/bot.rb
@@ -265,6 +265,8 @@ def start(plugins = true)
}
end
+ @modes = []
+
@loggers.info "Connecting to #{@config.server}:#{@config.port}"
@irc = IRC.new(self)
@irc.start
View
2  lib/cinch/irc.rb
@@ -480,7 +480,7 @@ def on_mode(msg, events)
modes = ModeParser.parse_modes(msg.params[1], msg.params[2..-1])
modes.each do |direction, mode, _|
if direction == :add
- @bot.modes << mode
+ @bot.modes << mode unless @bot.modes.include?(mode)
else
@bot.modes.delete(mode)
end
Something went wrong with that request. Please try again.