+ ;; TODO: Not very efficient, it may be worth reimplementing
+ (let ((ls (string->list message)))
+ (string-concatenate
+ (map (lambda (chr) ; CTCP level quoting
+ (case (char->integer chr)
+ ((#o134) (string (integer->char #o134) (integer->char #o134)))
+ ((#o01) (string (integer->char #o134) #\a)) ; X-DELIM
+ (else (string chr))))
+ (string->list
+ (string-concatenate
+ (map (lambda (chr) ; Low-level
+ (let ((m-quote (integer->char #o20)))
+ (case chr
+ ((m-quote) (string m-quote m-quote))
+ ((#\nul) (string m-quote #\0))
+ ((#\nl) (string m-quote #\n))
+ ((#\cr) (string m-quote #\r))
+ (else (string chr)))))
+ ls)))))))
+
+