+(define (make-rollodex-beh system)
+ (let ((recipients '()))
+ (make-beh (self)
+ (('list) =>
+ (if (null? recipients)
+ (send-message system 'print "Recipients list empty.")
+ (begin
+ (send-message system 'print "Current recipients")
+ (let loop ((r recipients))
+ (unless (null? r)
+ (send-message system 'print (address->string (car r)))
+ (loop (cdr r)))))))
+ (('clear) =>
+ (set! recipients '())
+ (send-message system 'print "Cleared recipient list."))
+ (('add rstr) =>
+ (set! recipients (cons (string->address rstr) recipients))
+ (send-message system 'print "Added recipient to chat."))
+ (('send name str) =>
+ (if (null? recipients)
+ (send-message system 'print "Speaking to the void.")
+ (let loop ((recipients-left recipients))
+ (unless (null? recipients-left)
+ (send-message (car recipients-left) 'show-msg name str)
+ (loop (cdr recipients-left))))))
+ (finally
+ 'sleep))))
+
+(define (make-receiver-beh system)
+ (make-beh (self)
+ (('show-msg from text) =>
+ (send-message system 'print from "> " text)
+ 'sleep)))
+
+