]> code.citadel.org Git - citadel.git/blobdiff - webcit/roomlist.c
* add generic lists with strings
[citadel.git] / webcit / roomlist.c
index 72335f5255a957fe799db5166df30b52e54bec56..5584928a0362a07f1357a0d1c991ca04e9b4c679 100644 (file)
@@ -271,6 +271,7 @@ HashList *GetNetConfigHash(StrBuf *Target, WCTemplputParams *TP)
        StrBuf *Content;
        long WantThisOne;
        long PutTo;
+       long State;
        
        WantThisOne = GetTemplateTokenNumber(Target, TP, 5, 0);
        if (WantThisOne == 0)
@@ -283,27 +284,41 @@ HashList *GetNetConfigHash(StrBuf *Target, WCTemplputParams *TP)
        Line = NewStrBuf();
        Token = NewStrBuf();
        StrBuf_ServGetln(Line);
-       if (GetServerStatus(Line, NULL) == 1) 
+       if (GetServerStatus(Line, &State) == 1) 
        {
                const char *Pos = NULL;
                StrBuf_ServGetln(Line);
                StrBufExtract_NextToken(Token, Line, &Pos, '|');
                PutTo = GetTokenDefine(SKEY(Token), -1);
-               if ((PutTo > 0) && (PutTo < maxRoomNetCfg))
+               if ((PutTo > 0) && 
+                   (PutTo < maxRoomNetCfg) &&
+                   (Pos != StrBufNOTNULL))
                {
                        int n;
+                       HashList *SubH;
 
                        if (WCC->CurRoom.IgnetCfgs[PutTo] == NULL)
                                WCC->CurRoom.IgnetCfgs[PutTo] = NewHash(1, NULL);
-                       Content = NewStrBuf();
-                       StrBufExtract_NextToken(Content, Line, &Pos, '|');
+                       SubH = NewHash(1, NULL);
                        n = GetCount(WCC->CurRoom.IgnetCfgs[PutTo]) + 1;
                        Put(WCC->CurRoom.IgnetCfgs[PutTo], 
                            IKEY(n),
-                           Content, 
-                           HFreeStrBuf);
+                           SubH, 
+                           HDeleteHash);
+                       while (Pos != StrBufNOTNULL) {
+                               Content = NewStrBuf();
+                               StrBufExtract_NextToken(Content, Line, &Pos, '|');
+                               Put(SubH, 
+                                   IKEY(n),
+                                   Content, 
+                                   HFreeStrBuf);
+                       }
                }
        }
+       else if (State == 550)
+               StrBufAppendBufPlain(WCC->ImportantMsg,
+                                    _("Higher access is required to access this function."), -1, 0);
+
 
        return WCC->CurRoom.IgnetCfgs[WantThisOne];
 }
@@ -843,7 +858,7 @@ InitModule_ROOMLIST
        RegisterConditional(HKEY("COND:FLOOR:ISSUBROOM"), 0, ConditionalFloorIsSUBROOM, CTX_FLOORS);
        RegisterConditional(HKEY("COND:ROOM:REST:ISSUBFLOOR"), 0, ConditionalFloorIsRESTSubFloor, CTX_FLOORS);
 
-       RegisterIterator("ITERATE:THISROOM:GNET", 1, NULL, GetNetConfigHash, NULL, NULL, CTX_STRBUF, CTX_NONE, IT_NOFLAG);
+       RegisterIterator("ITERATE:THISROOM:GNET", 1, NULL, GetNetConfigHash, NULL, NULL, CTX_STRBUFARR, CTX_NONE, IT_NOFLAG);
 
        RegisterIterator("LFLR", 0, NULL, GetFloorListHash, NULL, NULL, CTX_FLOORS, CTX_NONE, IT_FLAG_DETECT_GROUPCHANGE);