+ # Logs out any Irc::User matching Irc::Netmask _m_ and logged in\r
+ # to a transient BotUser\r
+ #\r
+ def logout_transients(m)\r
+ debug "to check: #{@botusers.keys.join ' '}"\r
+ @botusers.keys.each do |iu|\r
+ debug "checking #{iu.fullform} against #{m.fullform}"\r
+ bu = @botusers[iu]\r
+ bu.transient? or next\r
+ iu.matches?(m) or next\r
+ @botusers.delete(iu).autologin = false\r
+ end\r
+ end\r
+\r
+ # Makes transient BotUser _user_ into a permanent BotUser\r
+ # named _name_; if _user_ is an Irc::User, act on the transient\r
+ # BotUser (if any) it's logged in as\r
+ #\r
+ def make_permanent(user, name)\r
+ buname = BotUser.sanitize_username(name)\r
+ # TODO merge BotUser instead?\r
+ raise "there's already a BotUser called #{name}" if include?(buname)\r
+\r
+ tuser = nil\r
+ case user\r
+ when String, Irc::User\r
+ tuser = irc_to_botuser(user)\r
+ when BotUser\r
+ tuser = user\r
+ else\r
+ raise TypeError, "sorry, don't know how to make #{user.class} into a permanent BotUser"\r
+ end\r
+ return nil unless tuser\r
+ raise TypeError, "#{tuser} is not transient" unless tuser.transient?\r
+\r
+ tuser.make_permanent(buname)\r
+ @allbotusers[tuser.username.to_sym] = tuser\r
+\r
+ return tuser\r
+ end\r
+\r