* summary.c: summary screen is now updated using ajax instead of refreshing
[citadel.git] / webcit / autocompletion.c
1 /*
2  * $Id$
3  *
4  * ajax-powered autocompletion...
5  */
6
7 #include "webcit.h"
8
9 /*
10  * Recipient autocompletion results
11  */
12 void recp_autocomplete(char *partial) {
13         char buf[1024];
14         char name[128];
15
16         output_headers(0, 0, 0, 0, 0, 0);
17
18         wprintf("Content-type: text/html\r\n"
19                 "Server: %s\r\n"
20                 "Connection: close\r\n"
21                 "Pragma: no-cache\r\n"
22                 "Cache-Control: no-store\r\n",
23                 SERVER);
24         begin_burst();
25
26         wprintf("<ul>");
27
28         serv_printf("AUTO %s", partial);
29         serv_getln(buf, sizeof buf);
30         if (buf[0] == '1') {
31                 while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
32                         extract_token(name, buf, 0, '|', sizeof name);
33                         wprintf("<li>");
34                         escputs(name);
35                         wprintf("</li>");
36                 }
37         }
38
39         wprintf("</ul>");
40
41         wprintf("\r\n\r\n");
42         wDumpContent(0);
43 }
44