Skip to content

Commit

Permalink
Use downcased channel names. Fixed logic errors in unsubscription com…
Browse files Browse the repository at this point in the history
…mand.
  • Loading branch information
Pistos committed Aug 19, 2010
1 parent ac97ba0 commit 33da982
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/mathetes/plugins/github-hook.rb
Expand Up @@ -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
Expand Down Expand Up @@ -198,10 +198,11 @@ def initialize( mathetes )
message.answer "#{BANG_COMMAND} #{args[0]} <github repo name> [#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}?"
Expand Down

0 comments on commit 33da982

Please sign in to comment.