Sha256: a23c8e8c04a28ab5e9ba473247ed4897f2dbd9ac3cea4ea6b74465a82310d9e7

Contents?: true

Size: 638 Bytes

Versions: 8

Compression:

Stored size: 638 Bytes

Contents

hook(type: :code, code: @numeric::NAMREPLY) do |dat|
  m = /[=*@] (.+?) :(.+)/.match(dat[:extra])

  unless dat[:plug].chans[m[1]]
    dat[:plug].chans[m[1]] = {}
  end

  unless dat[:plug].chans[m[1]][:collecting]
    dat[:plug].chans[m[1]][:collecting] = true
    dat[:plug].chans[m[1]][:users] = []
  end
  users = m[2].split(' ')
  users.each do |user|
    user = /[@+%&]*(.+)/.match(user)[1]
    dat[:plug].chans[m[1]][:users] << user
    dat[:plug].users[user] = { nick: user }
  end
end

hook(type: :code, code: @numeric::ENDOFNAMES) do |dat|
  m = /(.+?) :.*/.match(dat[:extra])

  dat[:plug].chans[m[1]][:collecting] = false
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
protonbot-0.3.7 lib/protonbot/core_plugin/codes/names.rb
protonbot-0.3.6 lib/protonbot/core_plugin/codes/names.rb
protonbot-0.3.5 lib/protonbot/core_plugin/codes/names.rb
protonbot-0.3.4 lib/protonbot/core_plugin/codes/names.rb
protonbot-0.3.3 lib/protonbot/core_plugin/codes/names.rb
protonbot-0.3.2 lib/protonbot/core_plugin/codes/names.rb
protonbot-0.3.1 lib/protonbot/core_plugin/codes/names.rb
protonbot-0.3.0 lib/protonbot/core_plugin/codes/names.rb