Permalink
Browse files

More work towards refactoring out the server stuff / simplifying and …

…ultimately cleaning it all up
  • Loading branch information...
1 parent bcc41a2 commit 0e8aef95f78b4d89a86c849ea00a891967a41b10 @Sutto committed Nov 5, 2008
Showing with 14 additions and 20 deletions.
  1. +1 −6 data/motd
  2. +3 −1 lib/kookaburra/base_extension.rb
  3. +6 −12 lib/kookaburra/irc/client.rb
  4. +2 −1 lib/kookaburra/irc/server.rb
  5. +2 −0 lib/message_server.rb
View
@@ -1,7 +1,2 @@
-Oh hai there.
-Welcome to Kookaburra - the Ruby
-IRC daemon with drb access.
-
-Kookaburra is built on top of
-ruby-ircd.
+ * Welcome to Kookaburra v0.1 - a Ruby IRCD. *
@@ -56,7 +56,9 @@ def setup!
def run!
begin
EventMachine::run do
- EventMachine::add_periodic_timer(90) { Kookaburra::IRC::Server.ping_all }
+ EventMachine::add_periodic_timer(60) do
+ Kookaburra::IRC::Server.ping_all
+ end
EventMachine::start_server "0.0.0.0", Kookaburra::Settings.port, Kookaburra::IRC::Server
end
rescue Exception => e
@@ -74,19 +74,13 @@ def handle_nick(s)
else
#check if we are just nicking ourselves.
unless Kookaburra::Stores.users[s] == self
- #verify the connectivity of earlier guy
- unless Kookaburra::Stores.users[s].closed?
- reply :numeric, Replies::ERR_NICKNAMEINUSE,"* #{s} ","Nickname is already in use."
- @nick_tries += 1
- if @nick_tries > Kookaburra::Settings.max_nick_tries
- Kookaburra.logger.info "Kicking user #{s} after #{@nick_tries} failed nick attempts"
- handle_abort
- end
- return
- else
- Kookaburra::Stores.users[s].handle_abort
- Kookaburra::Stores.users[s] = self
+ reply :numeric, Replies::ERR_NICKNAMEINUSE, "* #{s} ","Nickname is already in use."
+ @nick_tries += 1
+ if @nick_tries > Kookaburra::Settings.max_nick_tries
+ Kookaburra.logger.info "Kicking user #{s} after #{@nick_tries} failed nick attempts"
+ handle_abort
end
+ return
end
end
@nick_tries = 0
@@ -108,8 +108,9 @@ def handle_client_input(input, client)
end
def self.ping_all
+ Kookaburra.logger.info "Pinging all users"
Kookaburra::Stores.users.each_user do |client|
- client.send_ping
+ client.send_ping
end
end
View
@@ -1,5 +1,7 @@
require 'drb'
+# Ugly ass DRB message server class.
+# Needs to be seriously refactored.
class MessageServer
def self.stored_messages_path; File.join(Kookaburra.root, "data/messages"); end

0 comments on commit 0e8aef9

Please sign in to comment.