Behaviours are now tagged lists.
[sam.git] / chat_client.scm
index e12bc67..48736a8 100644 (file)
                    (let loop ((recipients-left recipients))
                      (unless (null? recipients-left)
                        (send-message (car recipients-left) 'show-msg name str)
-                       (loop (cdr recipients-left))))))
-              (finally
-               'sleep))))
+                       (loop (cdr recipients-left)))))))))
                
 (define (make-receiver-beh system)
   (make-beh (self)
             (('show-msg from text) =>
-             (send-message system 'print from "> " text)
-             'sleep)))
+             (send-message system 'print from "> " text))))
             
 
 (define (make-client-beh system)
@@ -43,7 +40,8 @@
               (('start) =>
                (send-message system 'print "Welcome to chat!\n"
                              "Your client address is " (address->string receiver) ".\n"
-                             "Type '/help' for a list of commands.\n"))
+                             "Type '/help' for a list of commands.\n")
+               (send-message system 'read self))
               (((? string? str)) =>
                (if (string-prefix? "/" str)
                    (let* ((maybe-idx (string-index str #\space))
                         (send-message system 'shutdown))
                        (else
                         (send-message system 'print "Unrecognised command '" cmd "'"))))
-                   (send-message rollodex 'send name str)))
-
-              (finally
-               (send-message system 'read self)
-               'sleep))))
+                   (send-message rollodex 'send name str))
+               (send-message system 'read self)))))
 
 (define-beh main-beh (self)
   ((system) =>