Method: Isaac::Application#handle
- Defined in:
- lib/isaac.rb
#handle(line) ⇒ Object
This is one hell of a nasty method. Something should be done, I suppose.
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/isaac.rb', line 178 def handle(line) logger.info "> #{line}" if config.verbose case line when /^:(\S+)!\S+ PRIVMSG \S+ :?\001VERSION\001/ @queue << "NOTICE #{$1} :\001VERSION #{config.version}\001" when /^:(\S+)!(\S+) PRIVMSG (\S+) :?(.*)/ nick, userhost, channel, = $1, $2, $3, $4 type = channel.match(/^#/) ? :channel : :private if event = event(type, ) @queue << event.invoke(:nick => nick, :userhost => userhost, :channel => channel, :message => ) end when /^:\S+ 00([1-4])/ @registration << $1.to_i @queue.lock = false if registered? when /^:\S+ ([4-5]\d\d) \S+ (\S+)/ error = $1 nick = channel = $2 if event = event(:error, error.to_i) @queue << event.invoke(:nick => nick, :channel => channel) end when /^PING (\S+)/ #TODO not sure this is correct. Damned RFC. @queue << "PONG #{$1}" when /^:\S+ PONG \S+ :excess/ @queue.lock = false end end |