Changeset 18508 in project


Ignore:
Timestamp:
06/16/10 14:58:00 (10 years ago)
Author:
Moritz Heidkamp
Message:

vandusen: allow for more than two choices in polls

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/vandusen/trunk/vandusen-poll.scm

    r18507 r18508  
    11(module vandusen-poll ()
    22
    3 (import chicken scheme srfi-1 extras data-structures)
     3(import chicken scheme srfi-1 extras data-structures srfi-13)
    44(use vandusen irc)
    55
     
    1212
    1313          (command 'poll
    14                    `(: "poll" (+ space) (submatch (+ (~ #\:))) ":" (* space) ,choice (* "," (* space) ,choice (* space)))
    15                    (lambda (m question . choices)
    16                      (let ((poll-idx (length polls)))
     14                   `(: "poll" (+ space) (submatch (+ (~ #\:))) ":" (* space) (submatch (+ any)) (* space))
     15                   (lambda (m question choices)
     16                     (let ((choices  (map string-trim-both (string-split choices ",")))
     17                           (poll-idx (length polls)))
    1718
    1819                       (set! polls (append polls (list (cons question choices))))
     
    2324                              (choices (string-intersperse choices ", ")))
    2425
    25                          (reply-to m (format "Poll #~A is now open: ~A" (add1 poll-idx) choices) prefixed: #f)))))
     26                         (reply-to m (format "poll #~A is now open: ~A" (add1 poll-idx) choices) prefixed: #f)))))
    2627
    2728          (command 'vote
Note: See TracChangeset for help on using the changeset viewer.