   (floobits-auth))
 
 (defun floobits-destroy-connection ()
-  (when (and (boundp 'floobits-conn) floobits-conn)
+  (when floobits-conn
     (message "deleting floobits conn")
-    (setq floobits-conn nil)))
+    (delete-process floobits-conn)))
 
 (defun floobits-send-to-agent (req event)
   (add-to-list 'req (cons 'version floobits-agent-version))

   (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)


(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"
