summaryrefslogtreecommitdiff
path: root/lib/rbot
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbot')
-rw-r--r--lib/rbot/botuser.rb19
-rw-r--r--lib/rbot/message.rb2
2 files changed, 19 insertions, 2 deletions
diff --git a/lib/rbot/botuser.rb b/lib/rbot/botuser.rb
index fe28947b..dc019655 100644
--- a/lib/rbot/botuser.rb
+++ b/lib/rbot/botuser.rb
@@ -217,10 +217,10 @@ module Irc
attr_reader :password
attr_reader :netmasks
attr_reader :perm
+ attr_reader :data
attr_writer :login_by_mask
attr_writer :autologin
attr_writer :transient
- attr_accessor :data
# Checks if the BotUser is transient
def transient?
@@ -810,4 +810,21 @@ module Irc
end
+ class User
+
+ # A convenience method to automatically found the botuser
+ # associated with the receiver
+ #
+ def botuser
+ Irc::Auth.authmanager.irc_to_botuser(self)
+ end
+
+ # The botuser is used to store data associated with the
+ # given Irc::User
+ #
+ def data
+ self.botuser.data
+ end
+ end
+
end
diff --git a/lib/rbot/message.rb b/lib/rbot/message.rb
index 6331825d..969dbc7d 100644
--- a/lib/rbot/message.rb
+++ b/lib/rbot/message.rb
@@ -167,7 +167,7 @@ module Irc
# Access the botuser corresponding to the source, if any
#
def botuser
- @bot.auth.autologin(@source) rescue @bot.auth.everyone
+ m.source.botuser rescue @bot.auth.everyone
end