summaryrefslogtreecommitdiff
path: root/lib/rbot
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-04-11 22:29:32 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-04-11 22:29:32 +0000
commit8985c8f3e655ba1aef4166e4247696fed3d20e9c (patch)
tree333ab078c6bc3aa1d8c80d8e87c70e61acb82e86 /lib/rbot
parent0d528d46751585eae11510a772b77d241f3c7777 (diff)
New IRC Framework: move #full_irc_downcase() and #full_downcase() methods to Irc::Netmask from Irc::User, and use them in Netmask conversion
Diffstat (limited to 'lib/rbot')
-rw-r--r--lib/rbot/irc.rb36
1 files changed, 19 insertions, 17 deletions
diff --git a/lib/rbot/irc.rb b/lib/rbot/irc.rb
index f34c8f9b..89bf5521 100644
--- a/lib/rbot/irc.rb
+++ b/lib/rbot/irc.rb
@@ -639,21 +639,38 @@ module Irc
ret << "@" << host unless host == "*"
return ret
end
+
def fullform
"#{nick}!#{user}@#{host}"
end
+ # This method downcases the fullform of the netmask. While this may not be
+ # significantly different from the #downcase() method provided by the
+ # ServerOrCasemap mixin, it's significantly different for Netmask
+ # subclasses such as User whose simple downcasing uses the nick only.
+ #
+ 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
+
# Converts the receiver into a Netmask with the given (optional)
# server/casemap association. We return self unless a conversion
# is needed (different casemap/server)
#
- # Subclasses of Netmask will return a new Netmask
+ # Subclasses of Netmask will return a new Netmask, using full_downcase
#
def to_irc_netmask(opts={})
if self.class == Netmask
return self if fits_with_server_and_casemap?(opts)
end
- return self.downcase.to_irc_netmask(opts)
+ return self.full_downcase.to_irc_netmask(opts)
end
# Converts the receiver into a User with the given (optional)
@@ -927,21 +944,6 @@ 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.
#