Headers to avoid pages being cached are now done
[citadel.git] / webcit / autocompletion.c
1 /*
2  * $Id$
3  *//**
4  * \defgroup AjaxAutoCompletion ajax-powered autocompletion...
5  * \ingroup ClientPower
6  */
7
8 /*@{*/
9 #include "webcit.h"
10
11 /**
12  * \brief Recipient autocompletion results
13  * \param partial the account to search for ??????
14  */
15 void recp_autocomplete(char *partial) {
16         char buf[1024];
17         char name[128];
18
19         output_headers(0, 0, 0, 0, 0, 0);
20
21         wprintf("Content-type: text/html\r\n"
22                 "Server: %s\r\n"
23                 "Connection: close\r\n"
24                 "Pragma: no-cache\r\n"
25                 "Cache-Control: no-store\r\n"
26                 "Expires: -1\r\n"
27                 ,
28                 SERVER);
29         begin_burst();
30
31         wprintf("<ul>");
32
33         serv_printf("AUTO %s", partial);
34         serv_getln(buf, sizeof buf);
35         if (buf[0] == '1') {
36                 while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
37                         extract_token(name, buf, 0, '|', sizeof name);
38                         wprintf("<li>");
39                         escputs(name);
40                         wprintf("</li>");
41                 }
42         }
43
44         wprintf("</ul>");
45
46         wprintf("\r\n\r\n");
47         wDumpContent(0);
48 }
49
50
51 /** @} */