From: Art Cancro Date: Sun, 18 Nov 2001 05:39:54 +0000 (+0000) Subject: * more work on netconf X-Git-Tag: v7.86~6727 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=9f8dafcb927147337cc4082a0fbedbc54de91f66;p=citadel.git * more work on netconf --- diff --git a/webcit/netconf.c b/webcit/netconf.c index 2f77d73e0..5c3553ace 100644 --- a/webcit/netconf.c +++ b/webcit/netconf.c @@ -33,48 +33,69 @@ struct sharelist { }; +void edit_node(void) { + + if (strcmp(bstr("sc"), "OK")) { + /* FIXME do something */ + } + + display_netconf(); +} + + + void display_edit_node(void) { char buf[SIZ]; char node[SIZ]; - char sroom[SIZ]; + char cnode[SIZ]; + char csecret[SIZ]; + char chost[SIZ]; + char cport[SIZ]; strcpy(node, bstr("node")); output_headers(1); wprintf("
"); wprintf("Edit share list for "); + wprintf("Edit node configuration for "); escputs(node); wprintf("\n"); wprintf("
\n"); - wprintf("
\n"); - wprintf("Add a shared room
\n"); - - wprintf("Return to network configuration screen
\n"); - - serv_printf("NSET roomlist|%s", node); + serv_puts("CONF getsys|application/x-citadel-ignet-config"); serv_gets(buf); if (buf[0] == '1') { - wprintf("\n"); while (serv_gets(buf), strcmp(buf, "000")) { - extract(sroom, buf, 0); - wprintf(""); - wprintf(""); - wprintf("\n"); + extract(cnode, buf, 0); + extract(csecret, buf, 1); + extract(chost, buf, 2); + extract(cport, buf, 3); + + if (!strcasecmp(node, cnode)) { + wprintf("\n"); + wprintf("
"); - escputs(sroom); - wprintf("(UnShare)
\n"); + wprintf(""); + wprintf("\n", cnode); + wprintf(""); + wprintf("\n", csecret); + wprintf(""); + wprintf("\n", chost); + wprintf(""); + wprintf("\n", cport); + wprintf("
Node name
Shared secret
Host or IP
Port

"); + wprintf(""); + wprintf(""); + wprintf("
\n"); + } + } - wprintf("\n"); } + + else { /* command error getting configuration */ + wprintf("%s
\n", &buf[4]); + } + wDumpContent(1); } @@ -123,34 +144,6 @@ void display_netconf(void) } -void display_confirm_unshare(void) -{ - char node[SIZ]; - char sroom[SIZ]; - - output_headers(1); - wprintf("
"); - wprintf("Confirm unshare\n"); - wprintf("
\n"); - - strcpy(node, bstr("node")); - strcpy(sroom, bstr("sroom")); - wprintf("
Are you sure you want to unshare "); - escputs(sroom); - wprintf("?
\n"); - wprintf("Yes   "); - wprintf("No
\n"); - wDumpContent(1); -} - - void display_confirm_delete_node(void) { char node[SIZ]; @@ -193,29 +186,6 @@ void delete_node(void) } -void unshare(void) -{ - char node[SIZ]; - char sroom[SIZ]; - char buf[SIZ]; - - strcpy(node, bstr("node")); - strcpy(sroom, bstr("sroom")); - sprintf(buf, "NSET unshare|%s|%s", node, sroom); - serv_puts(buf); - serv_gets(buf); - if (buf[0] == '1') { - output_headers(1); - server_to_text(); - wprintf("Back to menu\n"); - wDumpContent(1); - } else { - display_error(&buf[4]); - } -} - - - void display_add_node(void) { @@ -265,104 +235,3 @@ void add_node(void) } - -void display_share(void) -{ - char buf[SIZ]; - char node[SIZ]; - char sroom[SIZ]; - struct sharelist *shlist = NULL; - struct sharelist *shptr; - int already_shared; - - strcpy(node, bstr("node")); - - output_headers(1); - wprintf("
"); - wprintf("Add a shared room\n"); - wprintf("
\n"); - - wprintf("
"); - wprintf("
\n"); - wprintf("\n"); - - sprintf(buf, "NSET roomlist|%s", node); - serv_puts(buf); - serv_gets(buf); - if (buf[0] == '1') { - while (serv_gets(buf), strcmp(buf, "000")) { - shptr = (struct sharelist *) - malloc(sizeof(struct sharelist)); - shptr->next = shlist; - extract(shptr->shname, buf, 0); - shlist = shptr; - } - } - wprintf("\n"); - wprintf("
\n"); - - wprintf(""); - wprintf(""); - - wprintf("
\n"); - wDumpContent(1); - - /* free the list */ - while (shlist != NULL) { - shptr = shlist->next; - free(shlist); - shlist = shptr; - } - -} - - - -void share(void) -{ - char node[SIZ]; - char buf[SIZ]; - char sc[SIZ]; - char sroom[SIZ]; - - strcpy(node, bstr("node")); - strcpy(sc, bstr("sc")); - strcpy(sroom, bstr("sroom")); - - if (!strcmp(sc, "Share")) { - sprintf(buf, "NSET share|%s|%s", node, sroom); - serv_puts(buf); - serv_gets(buf); - if (buf[0] == '1') { - output_headers(1); - server_to_text(); - wprintf("Back to menu\n"); - wDumpContent(1); - } else { - display_error(&buf[4]); - } - - } -} diff --git a/webcit/webcit.c b/webcit/webcit.c index 6e884e88a..b4327cbb0 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -938,24 +938,18 @@ void session_loop(struct httprequest *req) changepw(); } else if (!strcasecmp(action, "display_edit_node")) { display_edit_node(); + } else if (!strcasecmp(action, "edit_node")) { + edit_node(); } else if (!strcasecmp(action, "display_netconf")) { display_netconf(); - } else if (!strcasecmp(action, "display_confirm_unshare")) { - display_confirm_unshare(); } else if (!strcasecmp(action, "display_confirm_delete_node")) { display_confirm_delete_node(); } else if (!strcasecmp(action, "delete_node")) { delete_node(); - } else if (!strcasecmp(action, "unshare")) { - unshare(); } else if (!strcasecmp(action, "display_add_node")) { display_add_node(); } else if (!strcasecmp(action, "add_node")) { add_node(); - } else if (!strcasecmp(action, "display_share")) { - display_share(); - } else if (!strcasecmp(action, "share")) { - share(); } else if (!strcasecmp(action, "terminate_session")) { slrp_highest(); terminate_session(); diff --git a/webcit/webcit.h b/webcit/webcit.h index b0e25f4f8..499f05850 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -252,15 +252,12 @@ void register_user(void); void display_changepw(void); void changepw(void); void display_edit_node(void); +void edit_node(void); void display_netconf(void); -void display_confirm_unshare(void); void display_confirm_delete_node(void); void delete_node(void); -void unshare(void); void display_add_node(void); void add_node(void); -void display_share(void); -void share(void); void terminate_session(void); void edit_me(void); void display_siteconfig(void);