- while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
- extract_token(cnode, buf, 0, '|', sizeof cnode);
- extract_token(csecret, buf, 1, '|', sizeof csecret);
- extract_token(chost, buf, 2, '|', sizeof chost);
- extract_token(cport, buf, 3, '|', sizeof cport);
-
- if (!strcasecmp(node, cnode)) {
- wprintf("<FORM METHOD=\"POST\" ACTION=\"/edit_node\">\n");
- wprintf("<CENTER><TABLE border=0>\n");
- wprintf("<TR><TD>");
- wprintf(_("Node name"));
- wprintf("</TD>");
- wprintf("<TD><INPUT TYPE=\"text\" NAME=\"node\" MAXLENGTH=\"16\" VALUE=\"%s\"></TD></TR>\n", cnode);
- wprintf("<TR><TD>");
- wprintf(_("Shared secret"));
- wprintf("</TD>");
- wprintf("<TD><INPUT TYPE=\"password\" NAME=\"secret\" MAXLENGTH=\"16\" VALUE=\"%s\"></TD></TR>\n", csecret);
- wprintf("<TR><TD>");
- wprintf(_("Host or IP address"));
- wprintf("</TD>");
- wprintf("<TD><INPUT TYPE=\"text\" NAME=\"host\" MAXLENGTH=\"64\" VALUE=\"%s\"></TD></TR>\n", chost);
- wprintf("<TR><TD>");
- wprintf(_("Port number"));
- wprintf("</TD>");
- wprintf("<TD><INPUT TYPE=\"text\" NAME=\"port\" MAXLENGTH=\"8\" VALUE=\"%s\"></TD></TR>\n", cport);
- wprintf("</TABLE><br />");
- wprintf("<INPUT TYPE=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">",
- _("Save changes"));
- wprintf(" ");
- wprintf("<INPUT TYPE=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">",
- _("Cancel"));
- wprintf("</CENTER></FORM>\n");
+ Hash = NewHash(1, NULL);
+
+ Buf = NewStrBuf();
+ while ((len = StrBuf_ServGetln(Buf),
+ strcmp(ChrPtr(Buf), "000"))) {
+ Node = NewNode(Buf);
+ if (Node == NULL)
+ continue;
+ nUsed = GetCount(Hash);
+ nUsed = snprintf(nnn, sizeof(nnn), "%d", nUsed+1);
+ Put(Hash, nnn, nUsed, Node, DeleteNodeConf);
+ }
+ FreeStrBuf(&Buf);
+ return Hash;
+ }
+ return NULL;
+}
+
+
+
+void save_net_conf(HashList *Nodelist)
+{
+ char buf[SIZ];
+ StrBuf *Buf;
+ HashPos *where;
+ void *vNode;
+ NodeConf *Node;
+ const char *Key;
+ long KeyLen;
+
+ serv_puts("CONF putsys|application/x-citadel-ignet-config");
+ serv_getln(buf, sizeof buf);
+ if (buf[0] == '4') {
+ if ((Nodelist != NULL) && (GetCount(Nodelist) > 0)) {
+ where = GetNewHashPos(Nodelist, 0);
+ Buf = NewStrBuf();
+ while (GetNextHashPos(Nodelist, where, &KeyLen, &Key, &vNode)) {
+ Node = (NodeConf*) vNode;
+ if (Node->DeleteMe==0) {
+ SerializeNode(Node, Buf);
+ serv_putbuf(Buf);
+ }