ichverstehe-isaac 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/isaac.gemspec +2 -2
- data/lib/isaac.rb +16 -12
- metadata +2 -2
data/isaac.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "isaac"
|
3
|
-
s.version = "0.2.
|
4
|
-
s.date = "2009-04-
|
3
|
+
s.version = "0.2.5"
|
4
|
+
s.date = "2009-04-25"
|
5
5
|
s.summary = "The smallish DSL for writing IRC bots"
|
6
6
|
s.email = "harry@vangberg.name"
|
7
7
|
s.homepage = "http://github.com/ichverstehe/isaac"
|
data/lib/isaac.rb
CHANGED
@@ -119,25 +119,25 @@ module Isaac
|
|
119
119
|
def parse(input)
|
120
120
|
puts "<< #{input}" if @bot.config.verbose
|
121
121
|
case input.chomp
|
122
|
-
when
|
123
|
-
@registration << $
|
122
|
+
when /(^:\S+ )?00([1-4])/
|
123
|
+
@registration << $2.to_i
|
124
124
|
if registered?
|
125
125
|
@queue.unlock
|
126
126
|
@bot.dispatch(:connect)
|
127
127
|
end
|
128
|
-
when
|
129
|
-
message "NOTICE #{$
|
128
|
+
when /(^:(\S+)!\S+ )?PRIVMSG \S+ :?\001VERSION\001/
|
129
|
+
message "NOTICE #{$2} :\001VERSION #{@bot.config.version}\001"
|
130
130
|
when /^PING (\S+)/
|
131
131
|
@queue.unlock
|
132
132
|
message "PONG #{$1}"
|
133
|
-
when
|
134
|
-
env = { :nick => $
|
133
|
+
when /(^:(\S+)!(\S+) )?PRIVMSG (\S+) :?(.*)/
|
134
|
+
env = { :nick => $2, :userhost => $3, :channel => $4, :message => $5 }
|
135
135
|
type = env[:channel].match(/^#/) ? :channel : :private
|
136
136
|
@bot.dispatch(type, env)
|
137
|
-
when
|
138
|
-
env = {:error => $
|
137
|
+
when /(^:\S+ )?([4-5]\d\d) \S+ (\S+)/
|
138
|
+
env = {:error => $2.to_i, :message => $2, :nick => $3, :channel => $3}
|
139
139
|
@bot.dispatch(:error, env)
|
140
|
-
when
|
140
|
+
when /(^:\S+ )?PONG/
|
141
141
|
@queue.unlock
|
142
142
|
end
|
143
143
|
end
|
@@ -178,7 +178,7 @@ module Isaac
|
|
178
178
|
end
|
179
179
|
|
180
180
|
def transfered_after_next_send
|
181
|
-
@transfered + @queue.first.size +
|
181
|
+
@transfered + @queue.first.size + 2 # the 2 is for \r\n
|
182
182
|
end
|
183
183
|
|
184
184
|
def exceed_limit?
|
@@ -187,7 +187,11 @@ module Isaac
|
|
187
187
|
|
188
188
|
def lock_and_ping
|
189
189
|
lock
|
190
|
-
@socket.
|
190
|
+
@socket.print "PING :#{@server}\r\n"
|
191
|
+
end
|
192
|
+
|
193
|
+
def next_message
|
194
|
+
@queue.shift.to_s.chomp + "\r\n"
|
191
195
|
end
|
192
196
|
|
193
197
|
def invoke
|
@@ -196,7 +200,7 @@ module Isaac
|
|
196
200
|
lock_and_ping; break
|
197
201
|
else
|
198
202
|
@transfered = transfered_after_next_send
|
199
|
-
@socket.
|
203
|
+
@socket.print next_message
|
200
204
|
# puts ">> #{msg}" if @bot.config.verbose
|
201
205
|
end
|
202
206
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ichverstehe-isaac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harry Vangberg
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-25 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|