 ;    (req (list `(buffers . ,buffers))))
  ;   (send-to-agent req 'buffer-list)))
 
+(defun floobits-event-get_buf (req)
+  (let ((filename (cdr (assoc "full_path" req))))
+  (find-file filename)))
+
 (defun floobits-switch (text)
   (let* ((json-key-type 'string)
   (req (json-read-from-string text))

      (floobits-switch (substring floobits-agent-buffer 0 position))
      (setq floobits-agent-buffer
      (substring floobits-agent-buffer
           (if (> (length floobits-agent-buffer) position) (+ 1 position) position)))
      (floobits-listener process "")))))

(defun floobits-auth()
  (let ((req (list (cons 'name auth)
		   (cons 'username floobits-username)
		   (cons 'room floobits-room)
		   (cons 'secret floobits-secret)
		   (cons 'room_owner floobits-room-owner))))
    (send-to-agent req 'auth)))

(defun create-connection()

(add-hook 'after-change-functions 'after-change nil t)
(add-hook 'find-file-hook 'after-new-buffer nil t)

(create-connection)
