+
+HashList *CfgTypeHash = NULL;
+typedef struct CfgLineType CfgLineType;
+typedef void (*CfgLineParser)(const CfgLineType *ThisOne, StrBuf *Line, const char *LinePos, SpoolControl *sc);
+typedef void (*CfgLineSerializer)(const CfgLineType *ThisOne, StrBuf *OuptputBuffer, SpoolControl *sc, namelist *data);
+typedef void (*CfgLineDeAllocator)(const CfgLineType *ThisOne, namelist **data);
+struct CfgLineType {
+ RoomNetCfg C;
+ CfgLineParser Parser;
+ CfgLineSerializer Serializer;
+ CfgLineDeAllocator DeAllocator;
+ ConstStr Str;
+ int IsSingleLine;
+};
+#define REGISTERRoomCfgType(a, p, uniq, s, d) RegisterRoomCfgType(#a, sizeof(#a) - 1, a, p, uniq, s, d);
+
+void RegisterRoomCfgType(const char* Name, long len, RoomNetCfg eCfg, CfgLineParser p, int uniq, CfgLineSerializer s, CfgLineDeAllocator d)
+{
+ CfgLineType *pCfg;
+
+ pCfg = (CfgLineType*) malloc(sizeof(CfgLineType));
+ pCfg->Parser = p;
+ pCfg->Serializer = s;
+ pCfg->C = eCfg;
+ pCfg->Str.Key = Name;
+ pCfg->Str.len = len;
+ pCfg->IsSingleLine = uniq;
+
+ if (CfgTypeHash == NULL)
+ CfgTypeHash = NewHash(1, NULL);
+ Put(CfgTypeHash, Name, len, pCfg, NULL);
+}
+
+const CfgLineType *GetCfgTypeByStr(const char *Key, long len)
+{
+ void *pv;
+
+ if (GetHash(CfgTypeHash, Key, len, &pv) && (pv != NULL))
+ {
+ return (const CfgLineType *) pv;
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+const CfgLineType *GetCfgTypeByEnum(RoomNetCfg eCfg, HashPos *It)
+{
+ const char *Key;
+ long len;
+ void *pv;
+ CfgLineType *pCfg;
+
+ RewindHashPos(CfgTypeHash, It, 1);
+ while (GetNextHashPos(CfgTypeHash, It, &len, &Key, &pv) && (pv != NULL))
+ {
+ pCfg = (CfgLineType*) pv;
+ if (pCfg->C == eCfg)
+ return pCfg;
+ }
+ return NULL;
+}
+void ParseDefault(const CfgLineType *ThisOne, StrBuf *Line, const char *LinePos, SpoolControl *sc)
+{
+ namelist *nptr;
+
+ nptr = (namelist *)
+ malloc(sizeof(namelist));
+ nptr->next = sc->NetConfigs[ThisOne->C];
+ nptr->Value = NewStrBufPlain(LinePos, StrLength(Line) - ( LinePos - ChrPtr(Line)) );
+ sc->NetConfigs[ThisOne->C] = nptr;
+}
+
+void ParseLastSent(const CfgLineType *ThisOne, StrBuf *Line, const char *LinePos, SpoolControl *sc)
+{
+ sc->lastsent = extract_long(LinePos, 0);
+}
+void ParseIgnetPushShare(const CfgLineType *ThisOne, StrBuf *Line, const char *LinePos, SpoolControl *sc)
+{
+/*
+ extract_token(nodename, LinePos, 0, '|', sizeof nodename);
+ extract_token(roomname, LinePos, 1, '|', sizeof roomname);
+ mptr = (maplist *) malloc(sizeof(maplist));
+ mptr->next = sc->ignet_push_shares;
+ strcpy(mptr->remote_nodename, nodename);
+ strcpy(mptr->remote_roomname, roomname);
+ sc->ignet_push_shares = mptr;
+*/
+}
+
+void ParseRoomAlias(const CfgLineType *ThisOne, StrBuf *Line, const char *LinePos, SpoolControl *sc)
+{
+/*
+ if (sc->sender != NULL)
+ continue; / * just one alowed... * /
+ extract_token(nptr->name, buf, 1, '|', sizeof nptr->name);
+ sc->sender = nptr;
+*/
+}
+
+void ParseSubPendingLine(const CfgLineType *ThisOne, StrBuf *Line, const char *LinePos, SpoolControl *sc)
+{
+
+ if (time(NULL) - extract_long(LinePos, 3) > EXP) {
+ // skipthisline = 1;
+ }
+ else
+ {
+ }
+
+}
+void ParseUnSubPendingLine(const CfgLineType *ThisOne, StrBuf *Line, const char *LinePos, SpoolControl *sc)
+{
+ ///int skipthisline = 0;
+ if (time(NULL) - extract_long(LinePos, 2) > EXP) {
+ // skipthisline = 1;
+ }
+
+}
+
+void DeleteGenericCfgLine(const CfgLineType *ThisOne, namelist **data)
+{
+ FreeStrBuf(&(*data)->Value);
+ free(*data);
+ *data = NULL;
+}