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