Module: IIRC::Members
- Included in:
- Batteries
- Defined in:
- lib/iirc/modules/members.rb
Overview
Note:
IIRC doesn't send NAMES by itself, but will process any replies received, such as to JOIN, or any requests you have made yourself.
Processes lists of channel participants sent by the server into #members.
Namely, it processes NAMES replies, such as the ones sent automatically when we
join a channel.
Instance Method Summary collapse
- #configure_members_tracking ⇒ Object private
-
#members ⇒ Hash<String,[String]>
Nicknames present in channels, by channel.
- #members_receiving ⇒ Hash private
- #receive_names(evt) ⇒ Object private
- #receive_names_end(evt) ⇒ Object private
Instance Method Details
#configure_members_tracking ⇒ Object (private)
Note:
In a future release, this may also track using JOIN/KICK/PART, etc.
18 19 20 21 |
# File 'lib/iirc/modules/members.rb', line 18 def configure_members_tracking on :'353', :receive_names on :'366', :receive_names_end end |
#members ⇒ Hash<String,[String]>
Nicknames present in channels, by channel. Updated from NAMES replies.
12 13 14 |
# File 'lib/iirc/modules/members.rb', line 12 def members @members ||= {} end |
#members_receiving ⇒ Hash (private)
35 36 37 |
# File 'lib/iirc/modules/members.rb', line 35 def members_receiving @members_receiving ||= Hash.new { |h,k| h[k] = [] } end |
#receive_names(evt) ⇒ Object (private)
23 24 25 26 27 |
# File 'lib/iirc/modules/members.rb', line 23 def receive_names evt names = evt.args[3] channel = evt.args[2] members_receiving[channel].concat names.tr('&+@%~', '').split(' ') end |
#receive_names_end(evt) ⇒ Object (private)
29 30 31 32 |
# File 'lib/iirc/modules/members.rb', line 29 def receive_names_end evt channel = evt.args[1] members[channel] = members_receiving.delete(channel) end |