ichverstehe-isaac 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/isaac.gemspec +2 -2
- data/lib/isaac.rb +13 -3
- 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.0.
|
4
|
-
s.date = "2008-11
|
3
|
+
s.version = "0.0.3"
|
4
|
+
s.date = "2008-12-11"
|
5
5
|
s.summary = "The smallish DSL for writing IRC bots"
|
6
6
|
s.email = "ichverstehe@gmail.com"
|
7
7
|
s.homepage = "http://github.com/ichverstehe/isaac"
|
data/lib/isaac.rb
CHANGED
@@ -19,6 +19,7 @@ module Isaac
|
|
19
19
|
class Application
|
20
20
|
def initialize #:nodoc:
|
21
21
|
@events = Hash.new {|k,v| k[v] = []}
|
22
|
+
@registration = []
|
22
23
|
end
|
23
24
|
|
24
25
|
# This is plain stupid. Might be useful for logging or something later on.
|
@@ -91,9 +92,10 @@ module Isaac
|
|
91
92
|
@irc = TCPSocket.open(@config.server, @config.port)
|
92
93
|
puts "Connection established."
|
93
94
|
|
95
|
+
@irc.puts "NICK #{@config.nick}"
|
96
|
+
@irc.puts "USER #{@config.username} foobar foobar :#{@config.realname}"
|
97
|
+
|
94
98
|
@queue = Queue.new(@irc)
|
95
|
-
@queue << "NICK #{@config.nick}"
|
96
|
-
@queue << "USER #{@config.username} foobar foobar :#{@config.realname}"
|
97
99
|
@queue << @events[:connect].first.invoke if @events[:connect].first
|
98
100
|
|
99
101
|
while line = @irc.gets
|
@@ -107,6 +109,11 @@ module Isaac
|
|
107
109
|
end
|
108
110
|
end
|
109
111
|
|
112
|
+
def registered?
|
113
|
+
arr = [1,2,3,4] - @registration
|
114
|
+
arr.empty?
|
115
|
+
end
|
116
|
+
|
110
117
|
# This is one hell of a nasty method. Something should be done, I suppose.
|
111
118
|
def handle(line)
|
112
119
|
puts "> #{line}" if @config.verbose
|
@@ -120,6 +127,9 @@ module Isaac
|
|
120
127
|
if event = event(type, message)
|
121
128
|
@queue << event.invoke(:nick => nick, :userhost => userhost, :channel => channel, :message => message)
|
122
129
|
end
|
130
|
+
when /^:\S+ 00([1-4])/
|
131
|
+
@registration << $1.to_i
|
132
|
+
@queue.lock = false if registered?
|
123
133
|
when /^:\S+ ([4-5]\d\d) \S+ (\S+)/
|
124
134
|
error = $1
|
125
135
|
nick = channel = $2
|
@@ -141,7 +151,7 @@ module Isaac
|
|
141
151
|
@socket = socket
|
142
152
|
@queue = []
|
143
153
|
@transfered = 0
|
144
|
-
@lock =
|
154
|
+
@lock = true
|
145
155
|
transmit
|
146
156
|
end
|
147
157
|
|
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.0.
|
4
|
+
version: 0.0.3
|
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: 2008-11
|
12
|
+
date: 2008-12-11 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|