From 33da982390fcdfa1671dca47fbb90d11392fb468 Mon Sep 17 00:00:00 2001 From: Pistos Date: Wed, 18 Aug 2010 22:45:00 -0400 Subject: [PATCH] Use downcased channel names. Fixed logic errors in unsubscription command. --- lib/mathetes/plugins/github-hook.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/mathetes/plugins/github-hook.rb b/lib/mathetes/plugins/github-hook.rb index 92d3555..8cc5bde 100644 --- a/lib/mathetes/plugins/github-hook.rb +++ b/lib/mathetes/plugins/github-hook.rb @@ -165,7 +165,7 @@ def initialize( mathetes ) @repos.transaction do repo = args[ 1 ] @repos[ repo ] ||= Array.new - channel = args[ 2 ] || message.channel.name + channel = ( args[ 2 ] || message.channel.name ).downcase @repos[ repo ] << channel message.answer "#{channel} subscribed to github repository #{repo}." end @@ -198,10 +198,11 @@ def initialize( mathetes ) message.answer "#{BANG_COMMAND} #{args[0]} [#channel]" else @repos.transaction do - repo = @repos[ args[1] ] - channel = args[2] || message.channel.name - if repo - if repo.delete( channel ) + repo = args[1] + channels = @repos[ repo ] + channel = ( args[2] || message.channel.name ).downcase + if channels && channels.any? + if channels.delete( channel ) message.answer "#{channel} unsubscribed from github repository #{repo}." else message.answer "#{channel} not subscribed to github repository #{repo}?"