* knrooms():
authorWilfried Goesgens <dothebart@citadel.org>
Mon, 13 Sep 2010 21:47:24 +0000 (23:47 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Mon, 13 Sep 2010 21:47:24 +0000 (23:47 +0200)
 - use the right values for the type of display
 - detect properly whether we need to set a default

webcit/roomops.c

index 9da586382e43979f0bb45abe2b598e55c4f7698f..8aed0e6f686d55fdd5c83e789adb559825c6ef16 100644 (file)
@@ -1105,22 +1105,16 @@ void knrooms(void)
                set_preference("roomlistview", ListView, 1);
        }
        /** Sanitize the input so its safe */
-       if((get_preference("roomlistview", &ListView) != 0)||
-          ((strcasecmp(ChrPtr(ListView), "folders") != 0) &&
-           (strcasecmp(ChrPtr(ListView), "table") != 0))) 
+       if ((get_preference("roomlistview", &ListView) == 0)||
+           (
+                   (strcasecmp(ChrPtr(ListView), "folders") != 0) &&
+                   (strcasecmp(ChrPtr(ListView), "rooms") != 0)
+                   )
+               )
        {
-               if (ListView == NULL) {
-                       ListView = NewStrBufPlain(HKEY("rooms"));
-                       set_preference("roomlistview", ListView, 0);
-                       ListView = NULL;
-               }
-               else {
-                       ListView = NewStrBufPlain(HKEY("rooms"));
-                       set_preference("roomlistview", ListView, 0);
-                       ListView = NULL;
-               }
+               ListView = NewStrBufPlain(HKEY("rooms"));
+               set_preference("roomlistview", ListView, 0);
        }
-       FreeStrBuf(&ListView);
        url_do_template();
 }