@@ -81,6 +81,38 @@ roomData = {
8181 console . putmsg ( green + high_intensity + "\nStaying the same for " +
8282 "now . . .\n" ) ;
8383 }
84+ } ,
85+ /*
86+ * summary:
87+ * If the current user is the sysop/cosysop, allows editing of the
88+ * room's info to set a moderator
89+ */
90+ changeRoomModerator : function ( ) {
91+ var newMod = new String ( ) ;
92+
93+ if ( user . security . level >= 80 ) {
94+ //go ahead and set the moderator for this room/sub
95+ console . putmsg ( yellow + high_intensity + "Changing moderator for " +
96+ user . cursub + "\nNew Moderator: " + green ) ;
97+ newMod = console . getstr ( "New Moderator: " , 40 ) ; //max user alias len
98+
99+ while ( system . matchuser ( newMod ) == 0 ) {
100+ console . putmsg ( yellow + newMod + " not found.\n" ) ;
101+ newMod = console . getstr ( "New Moderator: " , 40 ) ;
102+ }
103+
104+ roomSettings [ bbs . cursub_code ] . moderator = newMod ;
105+ } else {
106+ //add some error logging here at some point, as well; this could be
107+ //a security concern at some point
108+ console . putmsg ( red + high_intensity + "Your security level is not" +
109+ " high enough to change room moderator.\nMust we log this?\n" ) ;
110+ throw new dDocException ( "changeRoomModerator() Exception" ,
111+ "Not high enough security to change room moderator" , 1 ) ;
112+ }
113+
114+ roomData . fileIO . saveRoomInfo ( ) ;
115+
84116 } ,
85117 /*
86118 * summary:
@@ -90,6 +122,28 @@ roomData = {
90122 changeRoomInfo : function ( ) {
91123 var infoTxt = new Array ( ) ;
92124
125+ if ( roomSettings [ bbs . cursub_code ] . moderator != user . alias ) {
126+ try {
127+ this . changeRoomModerator ( ) ;
128+ } catch ( e ) {
129+ if ( userSettings . debug . misc ) {
130+ console . putmsg ( yellow + "Unable to change room mod!\n" +
131+ "Msg: " + red + high_intensity + e . message + "\n" ) ;
132+ }
133+
134+ throw new dDocException ( "changeRoomInfo() Exception" ,
135+ "Exception in changeRoomModerator()" , 1 ) ;
136+ //that should keep anyone from getting beyond here that
137+ //shouldn't be
138+ }
139+ }
140+
141+ var nao = new Date ( ) ;
142+ roomSettings [ bbs . cursub_code ] . infoCreationDate =
143+ nao . getDate ( ) + nao . toUTCString ( ) ;
144+
145+ this . displayRoomInfoHdr ( ) ;
146+
93147 if ( ( infoTxt = poast . getTextBlob ( this . maxInfoLines ) ) != null ) {
94148 //save the new room info
95149 /* try {
@@ -101,10 +155,12 @@ roomData = {
101155 "\n");
102156 }*/
103157 roomSettings [ bbs . cursub_code ] . info = infoTxt ;
104- roomSettings [ bbs . cursub_code ] . moderator = user . alias ;
158+ //this will be set in a separate method handling moderators
159+ //roomSettings[bbs.cursub_code].moderator = user.alias;
105160 //of course this will have to be replaced with better code to
106161 //make sure the person is authorized, sysop modification of it,
107162 //etc etc etc (re: above)
163+
108164 //roomSettings[bbs.cursub_code].infoCreationDate =
109165 roomData . fileIO . saveRoomInfo ( ) ;
110166 }
@@ -117,12 +173,7 @@ roomData = {
117173 displayRoomInfo : function ( ) {
118174 this . displayRoomInfoHdr ( ) ;
119175
120- try {
121- roomSettings [ bbs . cursub_code ] = snagRoomInfoBlob ( ) ;
122- } catch ( e ) {
123- console . putmsg ( "Unable to snagRoomInfoBlob(): " + e . name +
124- "\nMsg: " + e . message + "\n" ) ;
125- }
176+ roomSettings [ bbs . cursub_code ] = roomData . fileIO . snagRoomInfoBlob ( ) ;
126177
127178 if ( roomSettings [ bbs . cursub_code ] . info . length == 0 ) {
128179 //or should we be looking for null here?
0 commit comments