def command(cmd, params = {}, options = '')
flood_control
out = ''
response = ''
out += cmd
params.each_pair do |key, value|
out += " #{key}=#{encode_param(value.to_s)}"
end
out += ' ' + options
@sock.puts out
if cmd == 'servernotifyregister'
2.times { response += @sock.gets }
return parse_response(response)
end
loop do
response += @sock.gets
break if response.index(' msg=')
end
should_be_array = %w(
bindinglist serverlist servergrouplist servergroupclientlist
servergroupsbyclientid servergroupclientlist logview channellist
channelfind channelgrouplist channelgroupclientlist channelgrouppermlist
channelpermlist clientlist clientfind clientdblist clientdbfind
channelclientpermlist permissionlist permoverview privilegekeylist
messagelist complainlist banlist ftlist custominfo permfind
)
parsed_response = parse_response(response)
should_be_array.include?(cmd) ? parsed_response : parsed_response.first
end