warns << ArgumentError("#{x} doesn't look like a channel name") unless @bot.server.supports[:chantypes].include?(x[0])\r
locs << x\r
end\r
- unless wants_more\r
+ unless want_more\r
last_idx = i\r
break\r
end\r
begin\r
user = @bot.auth.get_botuser(splits[-1].sub(/^all$/,"everyone"))\r
rescue\r
- return m.reply("couldn't find botuser #{user}")\r
+ return m.reply("couldn't find botuser #{splits[-1]}")\r
end\r
return m.reply("you can't change permissions for #{user.username}") if user == @bot.auth.botowner\r
splits.slice!(-2,2) if has_for\r
end\r
\r
def auth_view_perm(m, params)\r
+ begin\r
+ user = @bot.auth.get_botuser(params[:user].sub(/^all$/,"everyone"))\r
+ rescue\r
+ return m.reply("couldn't find botuser #{params[:user]}")\r
+ end\r
+ perm = user.perm\r
+ str = []\r
+ perm.each { |k, val|\r
+ next if val.perm.empty?\r
+ case k\r
+ when :*\r
+ str << "on any channel: "\r
+ when :"?"\r
+ str << "in private: "\r
+ else\r
+ str << "on #{k}: "\r
+ end\r
+ sub = []\r
+ val.perm.each { |cmd, bool|\r
+ sub << (bool ? "+" : "-")\r
+ sub.last << cmd.to_s\r
+ }\r
+ str.last << sub.join(', ')\r
+ }\r
+ if str.empty?\r
+ m.reply "no permissions set for #{user.username}"\r
+ else\r
+ m.reply "permissions for #{user.username}:: #{str.join('; ')}"\r
+ end\r
end\r
\r
def get_botuser_for(user)\r
:action => 'auth_edit_perm',\r
:auth_path => ':edit::reset:'\r
\r
+auth.map "permissions view for :user",\r
+ :action => 'auth_view_perm',\r
+ :auth_path => '::'\r
+\r
auth.default_auth('*', false)\r
\r