* Attempting to add a smart host in webcit was instead adding it as an RBL host....
[citadel.git] / webcit / autocompletion.c
blob4cf4ccd6f659ff139fe84df68da623d681c6282e
1 /*
2 * $Id$
4 * ajax-powered autocompletion...
5 */
7 #include "webcit.h"
9 /*
10 * Recipient autocompletion results
12 void recp_autocomplete(char *partial) {
13 char buf[1024];
14 char name[128];
16 output_headers(0, 0, 0, 0, 0, 0);
18 hprintf("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 "Expires: -1\r\n"
25 PACKAGE_STRING);
26 begin_burst();
28 wprintf("<ul>");
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>");
41 wprintf("</ul>");
43 wprintf("\r\n\r\n");
44 wDumpContent(0);
48 void _recp_autocomplete(void) {recp_autocomplete(bstr("recp"));}
49 void _cc_autocomplete(void) {recp_autocomplete(bstr("cc"));}
50 void _bcc_autocomplete(void) {recp_autocomplete(bstr("bcc"));}
53 void
54 InitModule_AUTO_COMPLETE
55 (void)
57 WebcitAddUrlHandler(HKEY("recp_autocomplete"), _recp_autocomplete, 0);
58 WebcitAddUrlHandler(HKEY("cc_autocomplete"), _cc_autocomplete, 0);
59 WebcitAddUrlHandler(HKEY("bcc_autocomplete"), _bcc_autocomplete, 0);