User.channels returns an empty array #123

Closed
tiegs opened this Issue Jul 14, 2013 · 1 comment

Projects

None yet

2 participants

@tiegs
tiegs commented Jul 14, 2013

I'm writing a bot for quakenet, when trying to get a users channels using the user.channels-method, cinch returns an empty array.

A short snippet what I'm trying to archive:

on :private, "!status" do |m|
  auth_by_channel(m.user)
end

auth_by_channel(user)
  user.whois
  puts "CHANNELS: #{user.channels}"
end

=> []

I assume this is caused by the array generated by Cinch::IRC::on_319 is overwritten by Cinch::User::end_of_whois.
If instead the array is submitted by using the @whois_updates[user].merge!-method in Cinch::IRC::on_319 the channels are assigned correctly (at least for me).

Additionally the regex (/#{@isupport["CHANTYPES"].join}[^ ]+/o) used by Cinch::IRC::on_319 did not create an array of Channel-objects in my project.

I'm using ruby 2.0.0p247 and cinch 2.0.5 on Linux.

I'm not sure if my change does not break any design-principles of cinch. Anyway I commited it to my fork, 3cd4e6c

Maybe it's going to help you solving the problem :)

@dominikh
Member

Yeah, looks like you found two bugs in the on_319 method (wrong regexp and wrong way of setting the channels). I'll test your change later today and commit it if it works.

If you send your change as a pull request I'll merge them with your name.

@dominikh dominikh closed this Jul 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment