Update reference to hive to be dynamic state, simplify create-actor.
[8sync.git] / demos / ircbot.scm
index 00c48ffe2eef8d6883802f78fd1918ba9c6353ef..c8571561d9582285c24e5601fae9c181e76a9342 100755 (executable)
@@ -26,7 +26,8 @@
              (oop goops)
              (srfi srfi-37)
              (ice-9 format)
-             (ice-9 match))
+             (ice-9 match)
+             (fibers conditions))
 
 (define-class <my-irc-bot> (<irc-bot>))
 
                   (server "irc.freenode.net")
                   (channels '("##botchat"))
                   (repl #f))
-  (define hive (make-hive))
-  (define irc-bot
-    (bootstrap-actor* hive <my-irc-bot> "irc-bot"
-                      #:username username
-                      #:server server
-                      #:channels channels))
-  (define repl-manager
-    (cond
-     ((string? repl)
-      (bootstrap-actor* hive <repl-manager> "repl"
-                        #:path repl))
-     (repl
-      (bootstrap-actor* hive <repl-manager> "repl"))))
+  (run-hive
+   (lambda (hive)
+     (define irc-bot
+       (bootstrap-actor* hive <my-irc-bot> "irc-bot"
+                         #:username username
+                         #:server server
+                         #:channels channels))
+     (define repl-manager
+       (cond
+        ((string? repl)
+         (bootstrap-actor* hive <repl-manager> "repl"
+                           #:path repl))
+        (repl
+         (bootstrap-actor* hive <repl-manager> "repl"))))
 
-  ;; TODO: load REPL
-  (run-hive hive '()))
+     (wait (make-condition)))))
 
 (define (main args)
   (define parsed-args (parse-args "ircbot.scm" args))