* GetNetConfigHash(): fix some edge cases
authorWilfried Göesgens <willi@citadel.org>
Mon, 16 Aug 2010 22:45:06 +0000 (22:45 +0000)
committerWilfried Göesgens <willi@citadel.org>
Mon, 16 Aug 2010 22:45:06 +0000 (22:45 +0000)
* folder: add another pointer for the notnull, there is a 0 in that enum
* SetCurrentRoomFlags(): debug output the flags before saving them
* room/edit/tab_listserv: reorder list, so it doesn't look that funny with the subscription URL.

webcit/roomlist.c
webcit/roomops.c
webcit/roomops.h
webcit/static/t/room/edit/digestrecp_removal.html
webcit/static/t/room/edit/listrecp_removal.html
webcit/static/t/room/edit/tab_listserv.html

index 0a8e7fb9decb6292b6990edb5b09c551b5948ad0..ec6ef59248efcdc661650a46f5cb0da1fe595679 100644 (file)
@@ -291,13 +291,13 @@ HashList *GetNetConfigHash(StrBuf *Target, WCTemplputParams *TP)
        long PutTo;
        long State;
        
-       WantThisOne = GetTemplateTokenNumber(Target, TP, 5, 0);
-       if (WantThisOne == 0)
+       WantThisOne = GetTemplateTokenNumber(Target, TP, 5, -1);
+       if ((WantThisOne < 0) || (WantThisOne > maxRoomNetCfg))
                return NULL;
-       if (WCC->CurRoom.IgnetCfgs[0] == (HashList*) StrBufNOTNULL)
+       if (WCC->CurRoom.IgnetCfgs[maxRoomNetCfg] == (HashList*) StrBufNOTNULL)
                return WCC->CurRoom.IgnetCfgs[WantThisOne];
 
-       WCC->CurRoom.IgnetCfgs[0] = (HashList*) StrBufNOTNULL;
+       WCC->CurRoom.IgnetCfgs[maxRoomNetCfg] = (HashList*) StrBufNOTNULL;
        serv_puts("GNET");
        Line = NewStrBuf();
        Token = NewStrBuf();
@@ -308,7 +308,7 @@ HashList *GetNetConfigHash(StrBuf *Target, WCTemplputParams *TP)
                StrBuf_ServGetln(Line);
                StrBufExtract_NextToken(Token, Line, &Pos, '|');
                PutTo = GetTokenDefine(SKEY(Token), -1);
-               if ((PutTo > 0) && 
+               if ((PutTo >= 0) && 
                    (PutTo < maxRoomNetCfg) &&
                    (Pos != StrBufNOTNULL))
                {
@@ -316,13 +316,20 @@ HashList *GetNetConfigHash(StrBuf *Target, WCTemplputParams *TP)
                        HashList *SubH;
 
                        if (WCC->CurRoom.IgnetCfgs[PutTo] == NULL)
+                       {
+                               n = 0;
                                WCC->CurRoom.IgnetCfgs[PutTo] = NewHash(1, NULL);
+                       }
+                       else 
+                       {
+                               n = GetCount(WCC->CurRoom.IgnetCfgs[PutTo]);
+                       }
                        SubH = NewHash(1, NULL);
-                       n = GetCount(WCC->CurRoom.IgnetCfgs[PutTo]) + 1;
                        Put(WCC->CurRoom.IgnetCfgs[PutTo], 
                            IKEY(n),
                            SubH, 
                            HDeleteHash);
+                       n = 0;
                        while (Pos != StrBufNOTNULL) {
                                Content = NewStrBuf();
                                StrBufExtract_NextToken(Content, Line, &Pos, '|');
index 04e251dffec2ba2ec15ad4870024290be9155886..0f1e8637b8c6007c402ac20a4b76524db63770a8 100644 (file)
@@ -706,6 +706,9 @@ int SetCurrentRoomFlags(folder *Room)
        StrBuf *Buf;
 
        Buf = NewStrBuf();
+       DBG_QR(Room->QRFlags);
+       DBG_QR2(Room->QRFlags2);
+
        serv_printf("SETR %s|%s|%s|%ld|%d|%d|%ld|%ld|%ld",
                    ChrPtr(Room->name),
                    ChrPtr(Room->XAPass),
index 0917a41d48415e4a53de3960d4602b27a80894ae..4f82fa373ac8e57e3e92d8ef4a82361e0d1d4f37 100644 (file)
@@ -104,7 +104,7 @@ typedef struct _folder {
        
        int BumpUsers; /* if SETR set to 1 to make all users who knew this room to forget about it. */
 
-       HashList *IgnetCfgs[maxRoomNetCfg];
+       HashList *IgnetCfgs[maxRoomNetCfg + 1];
 }folder;
 
 HashList *GetFloorListHash(StrBuf *Target, WCTemplputParams *TP);
index d77ee7542a3d9510415e05284c697f59949e59f1..45280107a566fb59e788ad468bbcdcf1cfc1c60d 100644 (file)
@@ -1 +1 @@
-<?CONTEXTSTR("X")><a href="netedit?cmd=remove?tab=listserv?line=digestrecp|<?CONTEXTSTR("U")>"><?_("(remove)")></a><br />
+<a href="netedit?cmd=remove?tab=listserv?line=digestrecp|<?CONTEXTSTRARR("U")>"><?_("(remove)")></a><br />
index 0072069bdd366dbb5ed194b749189251c78b7991..8e35a9d2a50e7e99b9e394e6c77d92c91b07715f 100644 (file)
@@ -1 +1 @@
-<?CONTEXTSTR("X")><a href="netedit?cmd=remove?tab=listserv?line=listrecp|<?CONTEXTSTR("U")>"><?_("(remove)")></a><br />
+<a href="netedit?cmd=remove?tab=listserv?line=listrecp|<?CONTEXTSTRARR("U")>"><?_("(remove)")></a><br />
index d76df96f94737c35803280b6e865151502306b86..749586551feb05d8ac25523aea17a71c58710119 100644 (file)
 
                <br />
                <form method="get" action="toggle_self_service">
-                       <!-- Self Service subscription? -->
                        <table>
-                               <tr>
-                                       <td><?_("Allow self-service subscribe/unsubscribe requests.")></td>
-                                       <td><input type="checkbox" name="QR2_SelfList" value="yes" <?%("COND:THISROOM:FLAG:QR2", 20, #"QR2_SELFLIST", 1, 'checked="checked" ', "")> /></td>
-                               </tr>
-                               <tr>
-                                       <td colspan="2">
-                                               <?_("The URL for subscribe/unsubscribe is: ")>
-                                               <tt><?%("COND:IS_HTTPS", 3, 1, 0, "https", "http")>://<?SERV:FQDN>/listsub</tt>
-                                       </td>
-                               </tr>
                                <!-- Public posting? -->
                                <tr>
                                        <td><?_("Allow non-subscribers to mail to this room.")></td>
                                        <td><?_("Room post publication needs Aide permission.")></td>
                                        <td><input type="checkbox" name="QR2_Moderated" value="yes" <?%("COND:THISROOM:FLAG:QR2", 20, #"QR2_MODERATED", 1, 'checked="checked" ', "")> /></td>
                                </tr>
+                               <!-- Self Service subscription? -->
+                               <tr>
+                                       <td><?_("Allow self-service subscribe/unsubscribe requests.")></td>
+                                       <td><input type="checkbox" name="QR2_SelfList" value="yes" <?%("COND:THISROOM:FLAG:QR2", 20, #"QR2_SELFLIST", 1, 'checked="checked" ', "")> /></td>
+                               </tr>
+                               <tr>
+                               <!-- Give the admin some hint how to access the subscriber interface -->
+                                       <td colspan="2">
+                                               <?_("The URL for subscribe/unsubscribe is: ")>
+                                               <tt><?%("COND:IS_HTTPS", 3, 1, 0, "https", "http")>://<?SERV:FQDN>/listsub</tt>
+                                       </td>
+                               </tr>
+
                                <tr>
                                        <td colspan="2" align="center">
                                                <input type="hidden" name="last_tabsel" value="<?TAB:N>" />