Skip to content
This repository was archived by the owner on Dec 28, 2018. It is now read-only.

Commit 92ec76d

Browse files
committed
channel password can be part of an irc uri as follows: 'irc://test-shout-bot@irc.freenode.net:6667/#channel?password'. This fix updates the join method to split on '?', which splits the channel name from the password. The @channel_password variable then takes the uri channel password first, the shout-bot initialize password second (to maintain backwards compatibility), or the empty string if neither exist.
1 parent 416e0ef commit 92ec76d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/shout-bot.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ def initialize(server, port, nick, password=nil)
6262

6363
def join(channel, password = nil)
6464
raise ArgumentError unless block_given?
65-
66-
@channel = "##{channel}"
67-
password = password && " #{password}" || ""
68-
@socket.puts "JOIN #{@channel}#{password}"
65+
params = channel.split('?')
66+
@channel = "##{params[0]}"
67+
@channel_password = params[1] || password || ""
68+
@socket.puts "JOIN #{@channel} #{@channel_password}"
6969
yield self
7070
@socket.puts "PART #{@channel}"
7171
end

0 commit comments

Comments
 (0)