def parse_args(ar, setting)
cmds = []
locs = []
warns = []
doing_cmds = true
next_must_be_chan = false
want_more = false
last_idx = 0
ar.each_with_index { |x, i|
if doing_cmds
if x == "on" or x == "in"
doing_cmds = false
next_must_be_chan = true if x == "on"
next
end
if "+-".include?(x[0])
warns << ArgumentError.new(_("please do not use + or - in front of command %{command} when resetting") % {:command => x}) unless setting
else
warns << ArgumentError.new(_("+ or - expected in front of %{string}") % {:string => x}) if setting
end
cmds << x
else
if x[-1].chr == ','
want_more = true
else
want_more = false
end
case next_must_be_chan
when false
locs << x.gsub(/^here$/,'_').gsub(/^private$/,'?')
else
warns << ArgumentError.new(_("'%{string}' doesn't look like a channel name") % {:string => x}) unless @bot.server.supports[:chantypes].include?(x[0])
locs << x
end
unless want_more
last_idx = i
break
end
end
}
warns << _("trailing comma") if want_more
warns << _("you probably forgot a comma") unless last_idx == ar.length - 1
return cmds, locs, warns
end