*** empty log message ***
authorArt Cancro <ajc@citadel.org>
Fri, 9 Sep 2005 22:06:12 +0000 (22:06 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 9 Sep 2005 22:06:12 +0000 (22:06 +0000)
webcit/autocompletion.c [new file with mode: 0644]

diff --git a/webcit/autocompletion.c b/webcit/autocompletion.c
new file mode 100644 (file)
index 0000000..5b71a9e
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * $Id$
+ *
+ * ajax-powered autocompletion...
+ */
+
+#include "webcit.h"
+
+
+/*
+ * Recipient autocompletion results
+ */
+void recp_autocomplete(void) {
+       char buf[1024];
+       char name[128];
+
+       output_headers(0, 0, 0, 0, 0, 0, 0);
+
+       wprintf("Content-type: text/html\r\n"
+               "Server: %s\r\n"
+               "Connection: close\r\n"
+               "Pragma: no-cache\r\n"
+               "Cache-Control: no-store\r\n",
+               SERVER);
+       begin_burst();
+
+       wprintf("<ul>");
+
+
+       serv_printf("LIST %s", bstr("recp"));
+       serv_getln(buf, sizeof buf);
+       if (buf[0] == '1') {
+               while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
+                       extract_token(name, buf, 0, '|', sizeof name);
+                       wprintf("<li>");
+                       escputs(name);
+                       wprintf("</li>");
+               }
+       }
+
+       wprintf("</ul>");
+
+       wprintf("\r\n\r\n");
+       wDumpContent(0);
+}
+