Permalink
Browse files

Work towards refactoring Kookaburra

  • Loading branch information...
1 parent fb0c283 commit 2f2b0e8dc248f32e9191753788714dafd2248038 @Sutto committed Nov 5, 2008
View
@@ -1,2 +1,2 @@
**/.DS_Store
-messages.data
+data/messages
View
@@ -0,0 +1,20 @@
+h1. Kookaburra - a Ruby IRCD
+
+Kookaburra is an simple open source IRCD written in Ruby.
+
+It's a fork of "ruby-ircd":http://code.google.com/p/ruby-ircd/ with the following
+new features:
+
+# Better layout - proper module hierarchy
+# DRB interface
+# a catch all channel
+# A proper logger
+# proper option support
+# settings via configatron
+
+To use, try:
+
+ sudo gem install eventmachine extlib configatron
+ ./script/server
+
+Kudos!
View
@@ -0,0 +1,5 @@
+desc "Cleans up stuff"
+task :clean do
+ system "rm -rf log/ircd.log && touch log/ircd.log"
+ system "rm -rf data/messages"
+end
View
@@ -0,0 +1,7 @@
+# Use Kookaburra::Settings or configatron
+
+Kookaburra::Settings.host_name = Socket.gethostname.split(/\./).shift
+Kookaburra::Settings.max_nick_tries = 5 # Up to 5 tries
+Kookaburra::Settings.port = 6667
+Kookaburra::Settings.verbose = false
+Kookaburra::Settings.log_level = :info
View
@@ -0,0 +1,7 @@
+Oh hai there.
+
+Welcome to Kookaburra - the Ruby
+IRC daemon with drb access.
+
+Kookaburra is built on top of
+ruby-ircd.
View
@@ -1,23 +0,0 @@
-$user_store = SynchronizedStore.new
-class << $user_store
- def <<(client)
- self[client.nick] = client
- end
-
- alias nicks keys
- alias each_user each_value
-end
-
-$channel_store = SynchronizedStore.new
-class << $channel_store
- def add(c)
- self[c] ||= IRCChannel.new(c)
- end
-
- def remove(c)
- self.delete[c]
- end
-
- alias each_channel each_value
- alias channels keys
-end
View
@@ -1,41 +0,0 @@
-class GlobalChannel
-
- def privatemsg(msg, client)
- # Broadcast to all users
- $user_store.each_user do |user|
- user.reply :privmsg, client.userprefix, "#all", msg
- end
- end
-
- def notice(msg, client)
- $user_store.each_user {|user|
- user.reply :notice, client.userprefix, @name, msg
- }
- end
-
- def each_user(&blk)
- $user_store.each_user(&blk)
- end
-
- def name; "#all"; end
-
- def nicks; $user_store.nicks + ["Steve"]; end
-
- def topic
- "All that is posted on Kookaburra"
- end
-
- def join(client); true; end
-
- def part(client, msg); true; end
-
- def quit(client, msg); true; end
-
- def is_member?(user); true; end
- alias has_nick? is_member?
-
- def mode(u)
- u == "Steve" ? "@" : " "
- end
-
-end
View
@@ -1,90 +0,0 @@
-class IRCChannel < SynchronizedStore
-
- attr_reader :name, :topic
- alias each_user each_value
-
- def initialize(name)
- super()
-
- @topic = "There is no topic"
- @name = name
- @oper = []
- Kookaburra.logger.info "Creating channel #{@name}"
- end
-
- def add(client)
- @oper << client.nick if @oper.empty? and @store.empty?
- self[client.nick] = client
- end
-
- def remove(client)
- delete(client.nick)
- end
-
- def join(client)
- return false if is_member? client
- add client
- #send join to each user in the channel
- each_user {|user|
- user.reply :join, client.userprefix, @name
- }
- return true
- end
-
- def part(client, msg)
- return false if !is_member? client
- each_user {|user|
- user.reply :part, client.userprefix, @name, msg
- }
- remove client
- $channel_store.delete(@name) if self.empty?
- return true
- end
-
- def quit(client, msg)
- #remove client should happen before sending notification
- #to others since we dont want a notification to ourselves
- #after quit.
- remove client
- each_user {|user|
- user.reply :quit, client.userprefix, @name, msg if user!= client
- }
- $channel_store.delete(@name) if self.empty?
- end
-
- def privatemsg(msg, client)
- each_user {|user|
- user.reply :privmsg, client.userprefix, @name, msg if user != client
- }
- $channel_store["#all"].privatemsg "#{msg} - from #{@name}", client
- end
-
- def notice(msg, client)
- each_user {|user|
- user.reply :notice, client.userprefix, @name, msg if user != client
- }
- end
-
- def topic(msg=nil,client=nil)
- return @topic if msg.nil?
- @topic = msg
- each_user {|user|
- user.reply :topic, client.userprefix, @name, msg
- }
- return @topic
- end
-
- def nicks
- return keys
- end
-
- def mode(u)
- return @oper.include?(u.nick) ? '@' : ''
- end
-
- def is_member?(m)
- values.include?(m)
- end
-
- alias has_nick? is_member?
-end
Oops, something went wrong.

0 comments on commit 2f2b0e8

Please sign in to comment.