Replaced URIs as optional string representation of addresses.
[sam.git] / chat_client.scm
index 4bf02d8..947418f 100644 (file)
       (match message
         (('start)
          (send-message system 'print "Welcome to chat!\n"
-                       "Your client address is " self ".\n"
+                       "Your client address is " (address->string self) ".\n"
                        "Type '/help' for a list of commands.\n")
          (send-message system 'read self))
         (('show-msg from text)
-         (send-message system 'print "Message from " from ": " text))
+         (send-message system 'print from "> " text))
         (((? string? str))
          (if (string-prefix? "/" str)
              (let* ((maybe-idx (string-index str #\space))
@@ -36,7 +36,7 @@
                   (if (string-null? arg)
                       (send-message system 'print "Missing address of client.")
                       (begin
-                        (set! recipients (cons arg recipients))
+                        (set! recipients (cons (string->address arg) recipients))
                         (send-message system 'print "Added recipient to chat."))))
                  ((or "c" "clear")
                   (set! recipients '())
@@ -51,7 +51,7 @@
                         (send-message system 'print "Current recipients:")
                         (let loop ((recipients-left recipients))
                           (unless (null? recipients-left)
-                            (send-message system 'print (car recipients-left))
+                            (send-message system 'print (address->string (car recipients-left)))
                             (loop (cdr recipients-left)))))))
                  ((or "q" "quit")
                   (send-message system 'shutdown))