-
Notifications
You must be signed in to change notification settings - Fork 0
/
pull.cgi
executable file
·37 lines (31 loc) · 1.16 KB
/
pull.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env gosh
; -*- scheme -*-
(use sxml.serializer)
(use www.cgi)
(use file.util)
(load "./file")
(define (main args)
(frontend read-from-log pull-filter))
(define (frontend reader filter)
(cgi-main
(lambda (params)
(let ((last-pos (let1 p (cgi-get-parameter "p" params)
(and p (string->number p))))
(log-file (cgi-get-parameter "q" params))
(room-id (cgi-get-parameter "o" params)))
(if room-id
(parameterize
((current-link room-id))
`(,(cgi-header :content-type "text/xml")
,(srl:sxml->xml-noindent
(receive (exps file pos) (reader log-file last-pos)
`(*TOP* (res (pos ,pos)
(file ,file)
(content ,@(filter exps))))))))
`(,(cgi-header :content-type "text/xml")
,(srl:sxml->xml-noindent
(receive (exps file pos) (reader log-file last-pos)
`(*TOP* (res (pos ,pos)
(file ,file)
(content ,@(filter exps))))))))))))
(define (pull-filter x) x)