summaryrefslogtreecommitdiff
path: root/lib/rbot
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2009-11-01 09:44:01 +0100
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2009-11-01 09:54:30 +0100
commit34ca2ba507e4246f1bc1851b04d2ecdffd433a19 (patch)
tree87fe9f6332fb6dcecbb0cacc358ebca89abbd815 /lib/rbot
parent96218423c1200c9281b8b4261a924565c4eafd2a (diff)
Ruby 1.9 compat: use String#[0,1] for channel prefixes
This ensures that checks are correct in both Ruby 1.8 and 1.9
Diffstat (limited to 'lib/rbot')
-rw-r--r--lib/rbot/irc.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/rbot/irc.rb b/lib/rbot/irc.rb
index 7970a773..c893fc27 100644
--- a/lib/rbot/irc.rb
+++ b/lib/rbot/irc.rb
@@ -1381,7 +1381,7 @@ module Irc
#
def initialize(name, topic=nil, users=[], opts={})
raise ArgumentError, "Channel name cannot be empty" if name.to_s.empty?
- warn "Unknown channel prefix #{name[0].chr}" if name !~ /^[&#+!]/
+ warn "Unknown channel prefix #{name[0,1]}" if name !~ /^[&#+!]/
raise ArgumentError, "Invalid character in #{name.inspect}" if name =~ /[ \x07,]/
init_server_or_casemap(opts)
@@ -1418,31 +1418,31 @@ module Irc
# The channel prefix
#
def prefix
- name[0].chr
+ name[0,1]
end
# A channel is local to a server if it has the '&' prefix
#
def local?
- name[0] == 0x26
+ name[0,1] == '&'
end
# A channel is modeless if it has the '+' prefix
#
def modeless?
- name[0] == 0x2b
+ name[0,1] == '+'
end
# A channel is safe if it has the '!' prefix
#
def safe?
- name[0] == 0x21
+ name[0,1] == '!'
end
# A channel is normal if it has the '#' prefix
#
def normal?
- name[0] == 0x23
+ name[0,1] == '#'
end
# Create a new mode
@@ -1818,7 +1818,7 @@ module Irc
return ex
else
- prefix = name[0].chr
+ prefix = name[0,1]
# Give a warning if the new Channel goes over some server limits.
#