+ m.reply _("sorry, I don't know how to %{request}") % {:request => m.message}\r
+ end\r
+ rescue => e\r
+ m.reply _("couldn't %{cmd}: %{exception}") % {:cmd => cmd, :exception => e}\r
+ end\r
+ end\r
+\r
+ def auth_meet(m, params)\r
+ nick = params[:nick]\r
+ if !nick\r
+ # we are actually responding to a 'hello' command\r
+ unless m.botuser.transient?\r
+ m.reply @bot.lang.get('hello_X') % m.botuser\r
+ return\r
+ end\r
+ nick = m.sourcenick\r
+ irc_user = m.source\r
+ else\r
+ # m.channel is always an Irc::Channel because the command is either\r
+ # public-only 'meet' or private/public 'hello' which was handled by\r
+ # the !nick case, so this shouldn't fail\r
+ irc_user = m.channel.users[nick]\r
+ return m.reply("I don't see anyone named '#{nick}' here") unless irc_user\r
+ end\r
+ # BotUser name\r
+ buname = params[:user] || nick\r
+ begin\r
+ call_event(:botuser,:pre_perm, {:irc_user => irc_user, :bot_user => buname})\r
+ met = @bot.auth.make_permanent(irc_user, buname)\r
+ @bot.auth.set_changed\r
+ call_event(:botuser,:post_perm, {:irc_user => irc_user, :bot_user => buname})\r
+ m.reply @bot.lang.get('hello_X') % met\r
+ @bot.say nick, _("you are now registered as %{buname}. I created a random password for you : %{pass} and you can change it at any time by telling me 'user set password <password>' in private" % {\r
+ :buname => buname,\r
+ :pass => met.password\r
+ })\r
+ rescue RuntimeError\r
+ # or can this happen for other cases too?\r
+ # TODO autologin if forced\r
+ m.reply _("but I already know %{buname}" % {:buname => buname})\r
+ rescue => e\r
+ m.reply _("I had problems meeting %{nick}: %{e}" % { :nick => nick, :e => e })\r