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

Commit

Permalink
Updated parse_tags to follow the IRC 3.2 spec
Browse files Browse the repository at this point in the history
Signed-off-by: Defman21 <i@defman.me>
  • Loading branch information
Defman21 committed May 30, 2017
1 parent 46abc78 commit d128be0
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions lib/cinch/message.rb
Expand Up @@ -280,16 +280,20 @@ def to_symbol(string)

tags = {}
raw_tags.split(";").each do |tag|
key, value = tag.split("=")
if value =~ /,/
_value = value
value = {}
_value.split(",").each do |item|
_key, _value = item.split "/"
value[to_symbol(_key)] = _value
end
tag_name, tag_value = tag.split("=")
if tag_value =~ /,/
tag_value = tag_value.split(',')
elsif tag_value.nil?
tag_value = tag_name
end
if tag_name =~ /\//
vendor, tag_name = tag_name.split('/')
tags[to_symbol(vendor)] = {
to_symol(tag_name) => tag_value
}
else
tags[to_symbol(tag_name)] = tag_value
end
tags[to_symbol(key)] = value
end
return tags
end
Expand Down

0 comments on commit d128be0

Please sign in to comment.