- return unless m.kind_of?(PrivMessage) && m.public?
- # in channel message, the kind we are interested in
- if(m.message =~ /(\+\+|--)/)
- string = m.message.sub(/\W(--|\+\+)(\(.*?\)|[^(++)(\-\-)\s]+)/, "\2\1")
- seen = Hash.new
- while(string.sub!(/(\(.*?\)|[^(++)(\-\-)\s]+)(\+\+|--)/, ""))
- key = $1
- change = $2
- next if seen[key]
- seen[key] = true
+ return unless m.kind_of?(PrivMessage) && m.public? && m.message.match(/\+\+|--/)
+ arg = nil
+ op = nil
+ ac = Hash.new
+ m.message.split.each_with_index do |tok, i|
+ tok.sub!(/[:,]$/, '') if i == 0
+ catch :me_if_you_can do
+ if m.channel.users[tok].nil?
+ if (tok =~ /^(?:--)(.*[^-].*)$/) || (tok =~ /^(.*[^-].*)(?:--)$/)
+ op, arg = '--', $1
+ next
+ elsif (tok =~ /^(?:\+\+)(.*[^+].*)$/)||(tok =~ /^(.*[^+].*)(?:\+\+)$/)
+ op, arg = '++', $1
+ next
+ end
+ end