[ prog / sol / mona ]

prog


How does SchemeBBS deal with spam?

2 2021-09-10 10:14

bbs.scm:validate-form params

(define (validate-form params message #!optional headline)
  (let ((fake-message (lookup-def 'message params ""))
        (fake-name (lookup-def 'name params ""))
        (hash (lookup-def 'ornamentum params "")))
    (cond ((and (not (default-object? headline)) (string-null? headline))
           '(empty-headline . "New threads must have a headline"))
          ((string-null? message)
           '(empty-message . "Empty post"))
          ((and (not (default-object? headline)) (> (string-length headline) *max-headline-size*))
	   `(headline-too-long . (string-append "Headline too long (max: " ,(number->string *max-headline-size*) " bytes)")))
          ((> (string-length message) *max-post-size*)
	   `(message-too-long . (string-append "Your post is too long (max: " ,(number->string *max-post-size*) " bytes)")))
          ((not (and (string-null? fake-message)
                     (string-null? fake-name)))
           'spam)
          (else 'ok))))

https://textboard.org/prog/273#t273p6

3


VIP:

do not edit these