summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-08-23 12:35:58 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-08-23 12:35:58 +0000
commitd2cd565d48bc38cba05fa311b8e57d7c93499d50 (patch)
treeae6532a47da6ab3d5ab300def3d8228f0db6a880
parent3ae571e67d5a40e7f9fb4694b16e6feb1ec1466e (diff)
New Auth module: keep auth.password and botowner passwords in sync when changing them
-rw-r--r--lib/rbot/botuser.rb1
-rw-r--r--lib/rbot/core/auth.rb3
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/rbot/botuser.rb b/lib/rbot/botuser.rb
index d859e9c3..5ae7fc2b 100644
--- a/lib/rbot/botuser.rb
+++ b/lib/rbot/botuser.rb
@@ -19,6 +19,7 @@ module Irc
BotConfig.register BotConfigStringValue.new( 'auth.password',
:default => 'rbotauth', :wizard => true,
+ :on_change => Proc.new {|bot, v| bot.auth.botowner.password = v},
:desc => _('Password for the bot owner'))
BotConfig.register BotConfigBooleanValue.new( 'auth.login_by_mask',
:default => 'true',
diff --git a/lib/rbot/core/auth.rb b/lib/rbot/core/auth.rb
index d1cdfd42..82fd1aa4 100644
--- a/lib/rbot/core/auth.rb
+++ b/lib/rbot/core/auth.rb
@@ -299,6 +299,9 @@ class AuthModule < CoreBotModule
def set_prop(botuser, prop, val)
k = prop.to_s.gsub("-","_")
botuser.send( (k + "=").to_sym, val)
+ if prop == :password and botuser == @bot.auth.botowner
+ @bot.config.items[:'auth.password'].set_string(@bot.auth.botowner.password)
+ end
end
def reset_prop(botuser, prop)