Sha256: 4e9ceade640b6f6c399e4f0c6406f3c56bda65a55ebf842f61f8bbcd3e72d9ac

Contents?: true

Size: 623 Bytes

Versions: 12

Compression:

Stored size: 623 Bytes

Contents

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

  if !dat[:plug].chans[m[1]] || !dat[:plug].chans[m[1]][:collecting]
    dat[:plug].chans[m[1]] = {}
    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

12 entries across 12 versions & 1 rubygems

Version Path
protonbot-0.2.7 lib/protonbot/core_plugin/codes/names.rb
protonbot-0.2.6 lib/protonbot/core_plugin/codes/names.rb
protonbot-0.2.5 lib/protonbot/core_plugin/codes/names.rb
protonbot-0.2.4 lib/protonbot/core_plugin/codes/names.rb
protonbot-0.2.3 lib/protonbot/core_plugin/codes/names.rb
protonbot-0.2.2 lib/protonbot/core_plugin/codes/names.rb
protonbot-0.2.1 lib/protonbot/core_plugin/codes/names.rb
protonbot-0.2.0 lib/protonbot/core_plugin/codes/names.rb
protonbot-0.1.3 lib/protonbot/core_plugin/codes/names.rb
protonbot-0.1.2 lib/protonbot/core_plugin/codes/names.rb
protonbot-0.1.1 lib/protonbot/core_plugin/codes/names.rb
protonbot-0.1.0 lib/protonbot/core_plugin/codes/names.rb