]> code.citadel.org Git - citadel.git/blobdiff - webcit/roomops.c
* Removed the last instance if is_room_aide
[citadel.git] / webcit / roomops.c
index 25bb94e9b9d743ca1f730fb64ae9758457e577be..1ab8c8efa93c78d806753c139916f500ac048145 100644 (file)
@@ -16,6 +16,7 @@ char *viewdefs[9];                    /* the different kinds of available views */
  */
 
 void display_whok(void);
+int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP);
 
 /*
  * Initialize the viewdefs with localized strings
@@ -844,8 +845,9 @@ void ParseGoto(folder *room, StrBuf *Line)
        room->is_inbox = StrBufExtractNext_long(Line, &Pos, '|'); // is_mailbox
 
        flag = StrBufExtractNext_long(Line, &Pos, '|');
-       if (WCC->is_aide || flag)
+       if (WCC->is_aide || flag) {
                room->RAFlags |= UA_ADMINALLOWED;
+       }
 
        room->UsersNewMAilboxMessages = StrBufExtractNext_long(Line, &Pos, '|');
 
@@ -1114,7 +1116,7 @@ void display_editroom(void)
        wc_printf("</td>\n");
        wc_printf("<td>&nbsp;</td>\n");
 
-       if ( (WC->axlevel >= 6) || (WC->is_room_aide) ) {
+       if ( ConditionalHaveRoomeditRights(NULL, NULL)) {
 
                wc_printf("<td class=\"");
                if (!strcmp(tab, "config")) {
@@ -1254,7 +1256,7 @@ void display_editroom(void)
                
                        wc_printf("<ul><li>");
                        wc_printf(_("Name of room: "));
-                       wc_printf("<input type=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"%d\">\n",
+                       wc_printf("<input type=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\""ULONG_FMT"\">\n",
                                er_name,
                                (sizeof(er_name)-1)
                                );
@@ -2583,6 +2585,7 @@ void entroom(void)
        int er_floor;
        int er_num_type;
        int er_view;
+       wcsession *WCC = WC;
 
        if (!havebstr("ok_button")) {
                strcpy(WC->ImportantMessage,
@@ -2616,16 +2619,25 @@ void entroom(void)
 
        serv_getln(buf, sizeof buf);
        if (buf[0] != '2') {
-               strcpy(WC->ImportantMessage, &buf[4]);
+               strcpy(WCC->ImportantMessage, &buf[4]);
                display_main_menu();
                return;
        }
-       /** TODO: Room created, now udate the left hand icon bar for this user */
+       /** TODO: Room created, now update the left hand icon bar for this user */
        burn_folder_cache(0);   /* burn the old folder cache */
        
-       
        gotoroom(er_name);
-       do_change_view(er_view);                /* Now go there */
+
+       serv_printf("VIEW %d", er_view);
+       serv_getln(buf, sizeof buf);
+       WCC->CurRoom.view = er_view;
+
+       if ( (WCC != NULL) && ( (WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) )  {
+               display_editroom ();
+       } else {
+               do_change_view(er_view);                /* Now go there */
+       }
+
 }
 
 
@@ -3009,19 +3021,22 @@ void knrooms(void)
                set_preference("roomlistview", ListView, 1);
        }
        /** Sanitize the input so its safe */
-       if(!get_preference("roomlistview", &ListView) ||
+       if((get_preference("roomlistview", &ListView) != 0)||
           ((strcasecmp(ChrPtr(ListView), "folders") != 0) &&
            (strcasecmp(ChrPtr(ListView), "table") != 0))) 
        {
                if (ListView == NULL) {
                        ListView = NewStrBufPlain(HKEY("rooms"));
                        set_preference("roomlistview", ListView, 0);
+                       ListView = NULL;
                }
                else {
-                       StrBufPlain(ListView, HKEY("rooms"));
-                       save_preferences();
+                       ListView = NewStrBufPlain(HKEY("rooms"));
+                       set_preference("roomlistview", ListView, 0);
+                       ListView = NULL;
                }
        }
+       FreeStrBuf(&ListView);
        url_do_template();
 }
 
@@ -3107,14 +3122,15 @@ void tmplput_ungoto(StrBuf *Target, WCTemplputParams *TP)
 int ConditionalRoomAide(StrBuf *Target, WCTemplputParams *TP)
 {
        wcsession *WCC = WC;
-       return (WCC != NULL)? (WCC->is_room_aide == 0) : 0;
+       return (WCC != NULL)? 
+               ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) : 0;
 }
 
 int ConditionalRoomAcessDelete(StrBuf *Target, WCTemplputParams *TP)
 {
        wcsession *WCC = WC;
        return (WCC == NULL)? 0 : 
-               ( (WCC->is_room_aide) || /////TODO!
+               ( ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ||
                   (WCC->CurRoom.is_inbox) || 
                   (WCC->CurRoom.QRFlags2 & QR2_COLLABDEL) );
 }
@@ -3188,7 +3204,7 @@ int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP)
 
        return ( (WCC!= NULL) && 
                 ((WCC->axlevel >= 6) || 
-                 (WCC->is_room_aide) || 
+                 ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ||
                  (WCC->CurRoom.is_inbox) ));
 }
 
@@ -3288,7 +3304,6 @@ InitModule_ROOMOPS
        REGISTERTokenParamDefine(US_COLOR);
        REGISTERTokenParamDefine(US_USER_SET);
 
-
        REGISTERTokenParamDefine(VIEW_BBS);
        REGISTERTokenParamDefine(VIEW_MAILBOX); 
        REGISTERTokenParamDefine(VIEW_ADDRESSBOOK);
@@ -3300,6 +3315,14 @@ InitModule_ROOMOPS
        REGISTERTokenParamDefine(VIEW_JOURNAL);
        REGISTERTokenParamDefine(VIEW_BLOG);
 
+
+       REGISTERTokenParamDefine(ignet_push_share);
+       REGISTERTokenParamDefine(listrecp);
+       REGISTERTokenParamDefine(digestrecp);
+       REGISTERTokenParamDefine(pop3client);
+       REGISTERTokenParamDefine(rssclient);
+       REGISTERTokenParamDefine(participate);
+
        RegisterConditional(HKEY("COND:ROOMAIDE"), 2, ConditionalRoomAide, CTX_NONE);
        RegisterConditional(HKEY("COND:ACCESS:DELETE"), 2, ConditionalRoomAcessDelete, CTX_NONE);