buybuy plaintext important message.
[citadel.git] / webcit / netconf.c
index cdd265a412da3f5e96c2a9b7a722f4928fa4eccc..8683879ffc2bbd74873bda4caad4855a7a21d508 100644 (file)
@@ -1,12 +1,3 @@
-/* 
- * $Id$
- */
-/**
- * \defgroup NetShareConf Functions which handle network and sharing configuration.
- *
- * \ingroup CitadelConfig
- */
-/*@{*/
 #include "webcit.h"
 
 void display_netconf(void);
@@ -87,8 +78,8 @@ HashList *load_netconf(StrBuf *Target, WCTemplputParams *TP)
        HashList *Hash;
        char nnn[64];
        char buf[SIZ];
-       long len;
        int nUsed;
+       long len;
        NodeConf *Node;
 
        serv_puts("CONF getsys|application/x-citadel-ignet-config");
@@ -98,7 +89,7 @@ HashList *load_netconf(StrBuf *Target, WCTemplputParams *TP)
 
                Buf = NewStrBuf();
                while ((len = StrBuf_ServGetln(Buf),
-                       strcmp(ChrPtr(Buf), "000"))) {
+                       (len != 3) || !strcmp(ChrPtr(Buf), "000"))) {
                        Node = NewNode(Buf);
                        if (Node == NULL)
                                continue;
@@ -152,8 +143,8 @@ void save_net_conf(HashList *Nodelist)
 
 
 
-/**
- * \brief edit a network node
+/*
+ * edit a network node
  */
 void edit_node(void) {
        HashList *NodeConfig;
@@ -164,7 +155,7 @@ void edit_node(void) {
                Index = sbstr("index");
                NewNode = HttpGetNewNode();
                if ((NewNode == NULL) || (Index == NULL)) {
-                       sprintf(WC->ImportantMessage, _("Invalid Parameter"));
+                       AppendImportantMessage(_("Invalid Parameter"), -1);
                        url_do_template();
                        return;
                }
@@ -178,8 +169,8 @@ void edit_node(void) {
 }
 
 
-/**
- * \brief modify an existing node
+/*
+ * modify an existing node
  */
 void display_edit_node(void)
 {
@@ -191,7 +182,7 @@ void display_edit_node(void)
 
        Index = sbstr("index");
        if (Index == NULL) {
-               sprintf(WC->ImportantMessage, _("Invalid Parameter"));
+               AppendImportantMessage(_("Invalid Parameter"), -1);
                url_do_template();
                return;
        }
@@ -199,14 +190,13 @@ void display_edit_node(void)
        NodeConfig = load_netconf(NULL, &NoCtx);
        if (!GetHash(NodeConfig, ChrPtr(Index), StrLength(Index), &vNode) || 
            (vNode == NULL)) {
-               sprintf(WC->ImportantMessage, _("Invalid Parameter"));
+               AppendImportantMessage(_("Invalid Parameter"), -1);
                url_do_template();
                DeleteHash(&NodeConfig);
                return;
        }
        
        memset(&SubTP, 0, sizeof(WCTemplputParams));
-       SVPutBuf("ITERATE:KEY", Index, 1);
        SubTP.Filter.ContextType = CTX_NODECONF;
        SubTP.Context = vNode;
        begin_burst();
@@ -219,16 +209,16 @@ void display_edit_node(void)
 }
 
 
-/**
- * \brief display all configured nodes
+/*
+ * display all configured nodes
  */
 void display_netconf(void)
 {
        wDumpContent(1);
 }
 
-/**
- * \brief display the dialog to verify the deletion
+/*
+ * display the dialog to verify the deletion
  */
 void display_confirm_delete_node(void)
 {
@@ -236,8 +226,8 @@ void display_confirm_delete_node(void)
 }
 
 
-/**
- * \brief actually delete the node
+/*
+ * actually delete the node
  */
 void delete_node(void)
 {
@@ -248,7 +238,7 @@ void delete_node(void)
 
        Index = sbstr("index");
        if (Index == NULL) {
-               sprintf(WC->ImportantMessage, _("Invalid Parameter"));
+               AppendImportantMessage(_("Invalid Parameter"), -1);
                url_do_template();
                return;
        }
@@ -256,7 +246,7 @@ void delete_node(void)
        NodeConfig = load_netconf(NULL, &NoCtx);
        if (!GetHash(NodeConfig, ChrPtr(Index), StrLength(Index), &vNode) || 
            (vNode == NULL)) {
-               sprintf(WC->ImportantMessage, _("Invalid Parameter"));
+               AppendImportantMessage(_("Invalid Parameter"), -1);
                url_do_template();
                DeleteHash(&NodeConfig);
                return;
@@ -314,4 +304,3 @@ InitModule_NETCONF
 
        RegisterIterator("NODECONFIG", 0, NULL, load_netconf, NULL, DeleteHash, CTX_NODECONF, CTX_NONE, IT_NOFLAG);
 }
-/*@}*/