add irc name box; closes #24

This commit is contained in:
Stephen Chang 2013-10-10 00:49:24 -04:00
parent 5364497525
commit 6373964654

View File

@ -40,7 +40,7 @@
(define-values (connection ready) (define-values (connection ready)
(irc-connect "card.freenode.net" 6667 "pasterack" "pasterack" "pasterack.org")) (irc-connect "card.freenode.net" 6667 "pasterack" "pasterack" "pasterack.org"))
(sync ready) (sync ready)
(define irc-channels '("#racket")) (define irc-channels '("#racktest"))
(for ([chan irc-channels]) (irc-join-channel connection chan)) (for ([chan irc-channels]) (irc-join-channel connection chan))
(define sample-pastes (define sample-pastes
@ -318,24 +318,30 @@
(input ([type "hidden"] [name "fork-from"] [value ,fork-from])) (input ([type "hidden"] [name "fork-from"] [value ,fork-from]))
(br) (br)
(table (tr (table (tr
;; paste to irc (td ((style "width:12em")))
(td ((style "font-size:90%")) ;; as-text checkbox ----------
(input ([type "checkbox"] [name "irc"] [value "off"])) (td (input ([type "checkbox"] [name "astext"] [value "off"])))
(span " Paste to " (td ((style "font-size:90%")) " Submit as text only")
,(mk-link racket-irc-url "#racket")
" channel"))
(td ((style "width:10px"))) (td ((style "width:10px")))
;; submit button ;; submit button -------------
(td ((style "width:5em")) (td ((style "width:5em"))
(input ([type "image"] [alt "Submit Paste and Run"] (input ([type "image"] [alt "Submit Paste and Run"]
[src "/submit.png"]))) [src "/submit.png"])))
;; as-text checkbox ;; paste to irc --------------
(td (input ([type "checkbox"] [name "astext"] [value "off"]))) (td ((style "font-size:90%"))
(td ((style "font-size:90%")) " Submit as text only") (input ([type "checkbox"] [name "irc"] [value "off"]))
(td ((style "width:20px")))) (span " Alert "
(tr (td) (td ([colspan "4"]) ,status)) ,(mk-link racket-irc-url "#racket")
" channel; your name/nick: ")
(input ([type "text"] [name "nick"] [size "10"]
[style ,(~~ "background-color:#FFFFF0"
"border:inset thin"
"font-size:105%"
"font-family:'PT Sans',sans-serif")])))
)
(tr (td ([colspan "3"])) (td ([colspan "3"]) ,status))
;; status message ;; status message
(tr (td) (td ([colspan "4"]) (tr (td ([colspan "3"])) (td ([colspan "3"])
,(if (string=? "" fork-from) "" ,(if (string=? "" fork-from) ""
`(span "Forked from paste # " ,fork-from)))))) `(span "Forked from paste # " ,fork-from))))))
(br)(br)(br) (br)(br)(br)
@ -386,8 +392,12 @@
'fork-from fork-from 'fork-from fork-from
'views 0)) 'views 0))
(when (exists-binding? 'irc bs) (when (exists-binding? 'irc bs)
(for ([c irc-channels]) (irc-send-message connection c (define nick (extract-binding/single 'nick bs))
(++ paste-name ": " paste-url)))) (for ([c irc-channels])
(irc-send-message connection c
(++ (if (string=? "" nick) "" (++ nick " pasted: "))
(if (string=? "" paste-name) "" (++ paste-name ", "))
paste-url))))
(fprintf log-port "~a\t~a\t~a\t~a\n" (fprintf log-port "~a\t~a\t~a\t~a\n"
tm-str paste-num paste-name (request-client-ip request)) tm-str paste-num paste-name (request-client-ip request))
(response/xexpr (response/xexpr