+// Copyright (c) 1999-2004 by the citadel.org team
+// This program is open source software. Use, duplication, or disclosure is subject to the GNU General Public License v3.
+
+
#include "webcit.h"
void display_netconf(void);
+CtxType CTX_NODECONF = CTX_NONE;
/*----------------------------------------------------------------------*/
/* Business Logic */
/*----------------------------------------------------------------------*/
StrBuf *Secret;
StrBuf *Host;
StrBuf *Port;
-}NodeConf;
+} NodeConf;
-void DeleteNodeConf(void *vNode)
-{
+void DeleteNodeConf(void *vNode) {
NodeConf *Node = (NodeConf*) vNode;
FreeStrBuf(&Node->NodeName);
FreeStrBuf(&Node->Secret);
free(Node);
}
-NodeConf *NewNode(StrBuf *SerializedNode)
-{
+NodeConf *NewNode(StrBuf *SerializedNode) {
NodeConf *Node;
if (StrLength(SerializedNode) < 8)
- return NULL; /** we need at least 4 pipes and some other text so its invalid. */
+ return NULL; /* we need at least 4 pipes and some other text so its invalid. */
Node = (NodeConf *) malloc(sizeof(NodeConf));
Node->DeleteMe = 0;
Node->NodeName=NewStrBuf();
return Node;
}
-NodeConf *HttpGetNewNode(void)
-{
+NodeConf *HttpGetNewNode(void) {
NodeConf *Node;
if (!havebstr("node") ||
return Node;
}
-void SerializeNode(NodeConf *Node, StrBuf *Buf)
-{
+void SerializeNode(NodeConf *Node, StrBuf *Buf) {
StrBufPrintf(Buf, "%s|%s|%s|%s",
ChrPtr(Node->NodeName),
ChrPtr(Node->Secret),
}
-HashList *load_netconf(StrBuf *Target, WCTemplputParams *TP)
-{
+HashList *load_netconf(StrBuf *Target, WCTemplputParams *TP) {
StrBuf *Buf;
HashList *Hash;
char nnn[64];
-void save_net_conf(HashList *Nodelist)
-{
+void save_net_conf(HashList *Nodelist) {
char buf[SIZ];
StrBuf *Buf;
HashPos *where;
/*
* modify an existing node
*/
-void display_edit_node(void)
-{
+void display_edit_node(void) {
WCTemplputParams SubTP;
HashList *NodeConfig;
const StrBuf *Index;
/*
* display all configured nodes
*/
-void display_netconf(void)
-{
+void display_netconf(void) {
wDumpContent(1);
}
/*
* display the dialog to verify the deletion
*/
-void display_confirm_delete_node(void)
-{
+void display_confirm_delete_node(void) {
wDumpContent(1);
}
/*
* actually delete the node
*/
-void delete_node(void)
-{
+void delete_node(void) {
HashList *NodeConfig;
const StrBuf *Index;
NodeConf *Node;
}
-void tmplput_NodeName(StrBuf *Target, WCTemplputParams *TP)
-{
+void tmplput_NodeName(StrBuf *Target, WCTemplputParams *TP) {
NodeConf *Node = (NodeConf*) CTX(CTX_NODECONF);
StrBufAppendTemplate(Target, TP, Node->NodeName, 0);
}
-void tmplput_Secret(StrBuf *Target, WCTemplputParams *TP)
-{
+void tmplput_Secret(StrBuf *Target, WCTemplputParams *TP) {
NodeConf *Node = (NodeConf*) CTX(CTX_NODECONF);
StrBufAppendTemplate(Target, TP, Node->Secret, 0);
}
-void tmplput_Host(StrBuf *Target, WCTemplputParams *TP)
-{
+void tmplput_Host(StrBuf *Target, WCTemplputParams *TP) {
NodeConf *Node= (NodeConf*) CTX(CTX_NODECONF);
StrBufAppendTemplate(Target, TP, Node->Host, 0);
}
-void tmplput_Port(StrBuf *Target, WCTemplputParams *TP)
-{
+void tmplput_Port(StrBuf *Target, WCTemplputParams *TP) {
NodeConf *Node= (NodeConf*) CTX(CTX_NODECONF);
StrBufAppendTemplate(Target, TP, Node->Port, 0);
}
InitModule_NETCONF
(void)
{
+ RegisterCTX(CTX_NODECONF);
WebcitAddUrlHandler(HKEY("display_edit_node"), "", 0, display_edit_node, 0);
WebcitAddUrlHandler(HKEY("aide_ignetconf_edit_node"), "", 0, edit_node, 0);