# File rbot/plugins/karma.rb, line 33 def listen(m) if(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 key.sub!(/^\((.*)\)$/, "\1") key.gsub!(/\s+/, " ") next unless(key.length > 0) next if(key == m.sourcenick) if(change == "++") @registry[key] += 1 elsif(change == "--") @registry[key] -= 1 end end end end end