summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-02-02 14:26:07 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-02-02 14:26:07 +0000
commit298e8b2908980822908c4f8bc4fda6d7413e1bd5 (patch)
tree379151936df7b929f72ef1ce4bd59fcc76952dec /data
parentb0db99d951fc28268fd0c11f65a4de660fb8b8ef (diff)
Fix rm methods in bans plugin
Diffstat (limited to 'data')
-rw-r--r--data/rbot/plugins/bans.rb28
1 files changed, 22 insertions, 6 deletions
diff --git a/data/rbot/plugins/bans.rb b/data/rbot/plugins/bans.rb
index 4972b41a..39f50b00 100644
--- a/data/rbot/plugins/bans.rb
+++ b/data/rbot/plugins/bans.rb
@@ -219,7 +219,8 @@ class BansPlugin < Plugin
autos = @registry[:onjoin]
count = autos.length
- idx = params[:idx].to_i
+ idx = nil
+ idx = params[:idx].to_i if params[:idx]
if idx
if idx > count
@@ -242,7 +243,11 @@ class BansPlugin < Plugin
end
end
@registry[:onjoin] = autos
- m.okay if count > autos.length
+ if count > autos.length
+ m.okay
+ else
+ m.reply "No matching onjoin rule for #{host} found"
+ end
end
def add_badword(m, params=nil)
@@ -268,7 +273,8 @@ class BansPlugin < Plugin
badwords = @registry[:badwords]
count = badwords.length
- idx = params[:idx].to_i
+ idx = nil
+ idx = params[:idx].to_i if params[:idx]
if idx
if idx > count
@@ -284,12 +290,17 @@ class BansPlugin < Plugin
badwords.each { |badword|
next unless ['all', badword.channel].include?(channel)
+ debug "Removing #{badword.inspect}" if badword == regexp
badwords.delete(badword) if badword == regexp
}
end
@registry[:badwords] = badwords
- m.okay if count > badwords.length
+ if count > badwords.length
+ m.okay
+ else
+ m.reply "No matching badword #{regexp} found"
+ end
end
def add_whitelist(m, params=nil)
@@ -319,7 +330,8 @@ class BansPlugin < Plugin
wl = @registry[:whitelist]
count = wl.length
- idx = params[:idx].to_i
+ idx = nil
+ idx = params[:idx].to_i if params[:idx]
if idx
if idx > count
@@ -342,7 +354,11 @@ class BansPlugin < Plugin
end
end
@registry[:whitelist] = wl
- m.okay if count > whitelist.length
+ if count > whitelist.length
+ m.okay
+ else
+ m.reply "No host matching #{host}"
+ end
end
private