 
 (defun floobits-launch-agent ()
   (when (boundp 'floobits-twisted-agent)
+    (kill-process floobits-twisted-agent)
     (delete-process floobits-twisted-agent))
   (start-process "floobits-twisted-agent" "*Messages*" "~/floobits-agent"))
+
+(defun floobits-leave-room ()
+  "leaves the current rooom"
+  (interactive)
+  (floobits-destroy-connection))
 
 (defun floobits-join-room (floourl)
   "Join a floobits room"

   (message "Successfully joined room %s" floobits-room))

(defun floobits-event-join (req)
  (message "%s joined the room"  (floo-get-item req 'username)))

(defun floobits-event-part (req)
  (message "%s req")
  (message "%s left the room" (floo-get-item req 'username)))

(defun floobits-event-edit (req)

  (floobits-auth))

(defun floobits-destroy-connection ()
  (when floobits-conn
    (message "deleting floobits conn")
    (delete-process floobits-conn)))

(defun floobits-send-to-agent (req event)
  (add-to-list 'req (cons 'version floobits-agent-version))
