lib/net/irc/client.rb in net-irc-0.0.7 vs lib/net/irc/client.rb in net-irc-0.0.8

- old
+ new

@@ -64,11 +64,11 @@ end # Default RPL_WELCOME callback. # This sets @prefix from the message. def on_rpl_welcome(m) - @prefix = Prefix.new(m[1][/\S+$/]) + @prefix = Prefix.new(m[1][/\S+\z/]) end # Default RPL_ISUPPORT callback. # This detects server's configurations. def on_rpl_isupport(m) @@ -100,10 +100,16 @@ # # include Net::IRC::Constants # post PRIVMSG, "#channel", "foobar" def post(command, *params) m = Message.new(nil, command, params.map {|s| - s ? s.gsub(/[\r\n]/, " ") : "" + if s + s.force_encoding("ASCII-8BIT") if s.respond_to? :force_encoding + #s.gsub(/\r\n|[\r\n]/, " ") + s.tr("\r\n", " ") + else + "" + end }) @log.debug "SEND: #{m.to_s.chomp}" @socket << m end