webcit_before_automake is now the trunk
[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                 SERVER);
27         begin_burst();
28
29         wprintf("<ul>");
30
31         serv_printf("AUTO %s", partial);
32         serv_getln(buf, sizeof buf);
33         if (buf[0] == '1') {
34                 while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
35                         extract_token(name, buf, 0, '|', sizeof name);
36                         wprintf("<li>");
37                         escputs(name);
38                         wprintf("</li>");
39                 }
40         }
41
42         wprintf("</ul>");
43
44         wprintf("\r\n\r\n");
45         wDumpContent(0);
46 }
47
48
49 /** @} */