Skip to content
This repository has been archived by the owner on Apr 13, 2019. It is now read-only.

User.channels returns an empty array #123

Closed
tilegg opened this issue Jul 14, 2013 · 1 comment
Closed

User.channels returns an empty array #123

tilegg opened this issue Jul 14, 2013 · 1 comment

Comments

@tilegg
Copy link
Contributor

tilegg 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
Copy link
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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants