summaryrefslogtreecommitdiff
path: root/lib/rbot/irc.rb
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-02-12 12:22:27 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-02-12 12:22:27 +0000
commit9c50738a84bec26402902513a4cd21b54dcc0a80 (patch)
tree81319e7b48d4237a222a22c3036e9739b911d171 /lib/rbot/irc.rb
parent740d29ab04108fc9cddabe5d3f3142100263e33e (diff)
Fix casemap/server mismatch problems when moving the bots between servers with different casemaps
Diffstat (limited to 'lib/rbot/irc.rb')
-rw-r--r--lib/rbot/irc.rb19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/rbot/irc.rb b/lib/rbot/irc.rb
index ab730278..b8ca4593 100644
--- a/lib/rbot/irc.rb
+++ b/lib/rbot/irc.rb
@@ -547,7 +547,7 @@ module Irc
if self.class == Netmask
return self if fits_with_server_and_casemap?(opts)
end
- return self.fullform.to_irc_netmask(server_and_casemap.merge(opts))
+ return self.downcase.to_irc_netmask(opts)
end
# Converts the receiver into a User with the given (optional)
@@ -821,6 +821,21 @@ module Irc
end
end
+ # Users can be either simply downcased (their nick only)
+ # or fully downcased: this will return the fullform downcased
+ # according to the given casemap.
+ #
+ def full_irc_downcase(cmap=casemap)
+ self.fullform.irc_downcase(cmap)
+ end
+
+ # full_downcase() will return the fullform downcased according to the
+ # User's own casemap
+ #
+ def full_downcase
+ self.full_irc_downcase
+ end
+
# Since to_irc_user runs the same checks on server and channel as
# to_irc_netmask, we just try that and return self if it works.
#
@@ -828,7 +843,7 @@ module Irc
#
def to_irc_user(opts={})
return self if fits_with_server_and_casemap?(opts)
- return self.fullform.to_irc_user(server_and_casemap(opts))
+ return self.full_downcase.to_irc_user(opts)
end
# We can replace everything at once with data from another User