@@ -37,34 +37,35 @@ def send_messages(messages)
37
37
botname = data [ 'nick' ] . to_s . empty? ? "GitHub#{ rand ( 200 ) } " : data [ 'nick' ]
38
38
command = data [ 'notice' ] . to_i == 1 ? 'NOTICE' : 'PRIVMSG'
39
39
40
- self . puts "PASS #{ data [ 'password' ] } " if !data [ 'password' ] . to_s . empty?
41
- self . puts "NICK #{ botname } "
42
- self . puts "MSG NICKSERV IDENTIFY #{ data [ 'nickservidentify' ] } " if !data [ 'nickservidentify' ] . to_s . empty?
43
- self . puts "USER #{ botname } 8 * :GitHub IRCBot"
40
+ irc_puts "PASS #{ data [ 'password' ] } " if !data [ 'password' ] . to_s . empty?
41
+ irc_puts "NICK #{ botname } "
42
+ irc_puts "MSG NICKSERV IDENTIFY #{ data [ 'nickservidentify' ] } " if !data [ 'nickservidentify' ] . to_s . empty?
43
+ irc_puts "USER #{ botname } 8 * :GitHub IRCBot"
44
44
45
45
loop do
46
- case self . gets
46
+ case irc_gets
47
47
when / 00[1-4] #{ Regexp . escape ( botname ) } /
48
48
break
49
49
when /^PING\s *:\s *(.*)$/
50
- self . puts "PONG #{ $1} "
50
+ irc_puts "PONG #{ $1} "
51
51
end
52
52
end
53
53
54
54
without_join = data [ 'message_without_join' ] == '1'
55
55
rooms . each do |room |
56
56
room , pass = room . split ( "::" )
57
- self . puts "JOIN #{ room } #{ pass } " unless without_join
57
+ irc_puts "JOIN #{ room } #{ pass } " unless without_join
58
58
59
59
Array ( messages ) . each do |message |
60
- self . puts "#{ command } #{ room } :#{ message } "
60
+ irc_puts "#{ command } #{ room } :#{ message } "
61
61
end
62
62
63
- self . puts "PART #{ room } " unless without_join
63
+ irc_puts "PART #{ room } " unless without_join
64
64
end
65
65
66
- self . puts "QUIT"
67
- self . gets until self . eof?
66
+ irc_puts "QUIT"
67
+ irc_response = [ ]
68
+ irc_response << irc_gets unless irc_eof?
68
69
rescue SocketError => boom
69
70
if boom . to_s =~ /getaddrinfo: Name or service not known/
70
71
raise_config_error 'Invalid host'
@@ -79,15 +80,15 @@ def send_messages(messages)
79
80
raise_config_error 'Host does not support SSL'
80
81
end
81
82
82
- def gets
83
+ def irc_gets
83
84
irc . gets
84
85
end
85
86
86
- def eof ?
87
+ def irc_eof ?
87
88
irc . eof?
88
89
end
89
90
90
- def puts ( *args )
91
+ def irc_puts ( *args )
91
92
irc . puts *args
92
93
end
93
94
@@ -125,7 +126,7 @@ def format_commit_message(commit)
125
126
"\002 #{ sha1 [ 0 ..6 ] } \002 (#{ files . size } files in #{ dirs . size } dirs): #{ short } "
126
127
end
127
128
end
128
-
129
+
129
130
def branch_name_matches?
130
131
return true if data [ 'branch_regexes' ] . nil?
131
132
return true if data [ 'branch_regexes' ] . strip == ""
0 commit comments