<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -15,7 +15,7 @@ module IRC
 class Client
     ##
     # constants
-    VERSION = '1.0-alpha'
+    VERSION = '0.1.1'
 
     ##
     # instance attributes</diff>
      <filename>lib/irc/client.rb</filename>
    </modified>
    <modified>
      <diff>@@ -104,7 +104,7 @@ class EventQueue
         end
 
         # Now we can exit... any events that got added by handling routines
-        # just don't happen. This is arguably a bug - XXX.
+        # just don't happen. This is arguably a bug.
         @handlers[:exit].each { |b| b.call(*needs_exit.args) } if needs_exit
 
         self</diff>
      <filename>lib/irc/event.rb</filename>
    </modified>
    <modified>
      <diff>@@ -21,7 +21,7 @@ class Rhuidean
     ME       = 'rhuidean'
 
     # The full version number.
-    VERSION  = '1.0-alpha'
+    VERSION  = '0.1.1'
 
     # The codename for this major version.
     CODENAME = 'praxis'
@@ -106,6 +106,24 @@ class Rhuidean
             puts &quot;#{ME}: warning: everything will be logged in the clear!&quot;
         end
 
+        # Check to see if we're already running.
+        if File.exists?('var/rhuidean.pid')
+            curpid = nil
+
+            File.open('var/rhuidean.pid', 'r') do |f|
+                curpid = f.read.chomp.to_i
+            end
+
+            begin
+                Process.kill(0, curpid)
+            rescue Errno::ESRCH
+                File.delete('var/rhuidean.pid')
+            else
+                puts &quot;#{ME}: daemon is already running&quot;
+                abort
+            end
+        end
+
         # Fork into the background
         if willfork
             begin
@@ -120,13 +138,15 @@ class Rhuidean
                 Dir.chdir(wd)
                 File.umask(0)
             else # This is the parent process.
+                # Write the PID file.
+                Dir.mkdir('var') unless File.exists?('var')
+                File.open('var/rhuidean.pid', 'w') { |f| f.puts(pid) }
+
                 puts &quot;#{ME}: pid #{pid}&quot;
                 puts &quot;#{ME}: running in background mode from #{Dir.getwd}&quot;
                 abort
             end
 
-            # XXX - write pid/check if running
-
             $stdin.close
             $stdout.close
             $stderr.close
@@ -135,8 +155,6 @@ class Rhuidean
             puts &quot;#{ME}: running in foreground mode from #{Dir.getwd}&quot;
         end
 
-        #sleep # XXX - can't let callandor connect to irc...
-
         # XXX - configuration file, eventually.
         servers = { 'irc.malkier.net' =&gt; 6667 }#,
                     #'66.225.223.45' =&gt; 6667 }</diff>
      <filename>lib/rhuidean.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>879e4dcd196581df0c31ab977132520ce2065a5a</id>
    </parent>
  </parents>
  <author>
    <name>Eric Will</name>
    <email>rakaur@malkier.net</email>
  </author>
  <url>http://github.com/rakaur/rhuidean/commit/842daf3cb4027fb4abbf8e0aa08bc8434e42a214</url>
  <id>842daf3cb4027fb4abbf8e0aa08bc8434e42a214</id>
  <committed-date>2009-10-07T10:59:14-07:00</committed-date>
  <authored-date>2009-10-07T10:25:47-07:00</authored-date>
  <message>Version bump.</message>
  <tree>303811795dc2dd44264c2a8109289a0c0148f07f</tree>
  <committer>
    <name>Eric Will</name>
    <email>rakaur@malkier.net</email>
  </committer>
</commit>
