X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fnetconf.c;h=ee7c5a91fd7f4bf4e30dbe568453873f71c99fa8;hb=9f145319b92b196662aa51cb2e3d7c392629965e;hp=49836b2f3994b7ef1f2edde43bb3ac544a74d858;hpb=523c1b0f7a3002c6aaa3eb833b55eb0cf07674ff;p=citadel.git diff --git a/webcit/netconf.c b/webcit/netconf.c index 49836b2f3..ee7c5a91f 100644 --- a/webcit/netconf.c +++ b/webcit/netconf.c @@ -1,19 +1,24 @@ /* * $Id$ + */ +/** + * \defgroup NetShareConf Functions which handle network and sharing configuration. * - * Functions which handle network and sharing configuration. - * + * \ingroup CitadelConfig */ - +/*@{*/ #include "webcit.h" +/** + * \brief edit a network node + */ void edit_node(void) { char buf[SIZ]; char node[SIZ]; char cnode[SIZ]; FILE *fp; - if (strlen(bstr("ok_button")) > 0) { + if (havebstr("ok_button")) { strcpy(node, bstr("node") ); fp = tmpfile(); if (fp != NULL) { @@ -26,24 +31,28 @@ void edit_node(void) { fprintf(fp, "%s\n", buf); } } - fprintf(fp, "%s|%s|%s|%s\n", - bstr("node"), - bstr("secret"), - bstr("host"), - bstr("port") ); - } rewind(fp); + } - serv_puts("CONF putsys|application/x-citadel-ignet-config"); - serv_getln(buf, sizeof buf); - if (buf[0] == '4') { + serv_puts("CONF putsys|application/x-citadel-ignet-config"); + serv_getln(buf, sizeof buf); + if (buf[0] == '4') { + if (fp != NULL) { while (fgets(buf, sizeof buf, fp) != NULL) { buf[strlen(buf)-1] = 0; - serv_puts(buf); + if (buf[0] != 0) { + serv_puts(buf); + } } - serv_puts("000"); + fclose(fp); } - fclose(fp); + serv_printf("%s|%s|%s|%s", + bstr("node"), + bstr("secret"), + bstr("host"), + bstr("port") ); + } + serv_puts("000"); } } @@ -51,19 +60,22 @@ void edit_node(void) { } - +/** + * \brief add a node + */ void display_add_node(void) { output_headers(1, 1, 2, 0, 0, 0); wprintf("
\n"); - wprintf("
"); - wprintf(""); + wprintf("

"); wprintf(_("Add a new node")); - wprintf(""); - wprintf("

\n"); - wprintf("
\n
\n"); + wprintf(""); + wprintf("
\n"); + + wprintf("
\n"); - wprintf("
\n"); + wprintf("\n"); + wprintf("\n", WC->nonce); wprintf("
\n"); wprintf("", _("Node name")); wprintf("\n"); @@ -72,7 +84,7 @@ void display_add_node(void) wprintf("", _("Host or IP address")); wprintf("\n"); wprintf("", _("Port number")); - wprintf("\n"); + wprintf("\n"); wprintf("
%s
%s
%s

"); wprintf("", _("Add node")); wprintf(" "); @@ -82,6 +94,9 @@ void display_add_node(void) wDumpContent(1); } +/** + * \brief modify an existing node + */ void display_edit_node(void) { char buf[512]; @@ -95,13 +110,13 @@ void display_edit_node(void) output_headers(1, 1, 2, 0, 0, 0); wprintf("
\n"); - wprintf("
"); - wprintf(""); + wprintf("

"); wprintf(_("Edit node configuration for ")); escputs(node); - wprintf("\n"); - wprintf("

\n"); - wprintf("
\n
\n"); + wprintf(""); + wprintf("
\n"); + + wprintf("
\n"); serv_puts("CONF getsys|application/x-citadel-ignet-config"); serv_getln(buf, sizeof buf); @@ -113,7 +128,8 @@ void display_edit_node(void) extract_token(cport, buf, 3, '|', sizeof cport); if (!strcasecmp(node, cnode)) { - wprintf("\n"); + wprintf("\n"); + wprintf("\n", WC->nonce); wprintf("
\n"); wprintf("
"); wprintf(_("Node name")); @@ -143,7 +159,7 @@ void display_edit_node(void) } } - else { /* command error getting configuration */ + else { /** command error getting configuration */ wprintf("%s
\n", &buf[4]); } @@ -151,7 +167,9 @@ void display_edit_node(void) } - +/** + * \brief display all configured nodes + */ void display_netconf(void) { char buf[SIZ]; @@ -159,20 +177,20 @@ void display_netconf(void) output_headers(1, 1, 2, 0, 0, 0); wprintf("
\n"); - wprintf("
"); - wprintf(""); + wprintf("

"); wprintf(_("Network configuration")); - wprintf("\n"); - wprintf("

\n"); - wprintf("
\n
\n"); + wprintf(""); + wprintf("
\n"); + + wprintf("
\n"); wprintf("
"); - wprintf(""); + wprintf(""); wprintf(_("Add a new node")); wprintf("
\n"); wprintf("
"); - wprintf("
"); + wprintf(""); - wprintf(""); - wprintf("
"); wprintf(""); wprintf(_("Currently configured nodes")); wprintf("\n"); @@ -186,12 +204,12 @@ void display_netconf(void) wprintf("
"); escputs(node); wprintf(""); wprintf(_("(Edit)")); wprintf(""); wprintf(_("(Delete)")); @@ -203,19 +221,21 @@ void display_netconf(void) wDumpContent(1); } - +/** + * \brief display the dialog to verify the deletion + */ void display_confirm_delete_node(void) { char node[SIZ]; output_headers(1, 1, 2, 0, 0, 0); wprintf("
\n"); - wprintf("
"); - wprintf(""); + wprintf("

"); wprintf(_("Confirm delete")); - wprintf("\n"); - wprintf("

\n"); - wprintf("
\n
\n"); + wprintf(""); + wprintf("
\n"); + + wprintf("
\n"); strcpy(node, bstr("node")); wprintf("
"); @@ -223,18 +243,20 @@ void display_confirm_delete_node(void) wprintf(""); escputs(node); wprintf("?
\n"); - wprintf("
"); wprintf(_("Yes")); wprintf("   "); - wprintf(""); + wprintf(""); wprintf(_("No")); wprintf("
\n"); wDumpContent(1); } - +/** + * \brief actually delete the node + */ void delete_node(void) { char buf[SIZ]; @@ -273,29 +295,4 @@ void delete_node(void) } -void add_node(void) -{ - char node[SIZ]; - char buf[SIZ]; - - strcpy(node, bstr("node")); - - if (strlen(bstr("add_button")) > 0) { - sprintf(buf, "NSET addnode|%s", node); - serv_puts(buf); - serv_getln(buf, sizeof buf); - if (buf[0] == '1') { - output_headers(1, 1, 0, 0, 0, 0); - server_to_text(); - wprintf(""); - wprintf(_("Back to menu")); - wprintf("\n"); - wDumpContent(1); - } else { - strcpy(WC->ImportantMessage, &buf[4]); - display_netconf(); - } - } -} - - +/*@}*/