Skip to content

Commit e0d861d

Browse files
committed
Coding moderator change for room info
1 parent 1da069b commit e0d861d

2 files changed

Lines changed: 54 additions & 4 deletions

File tree

load/dexpress.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ wholist = {
8686
* NOTE: This needs to be less of a monolith
8787
*/
8888
list_long : function(ul) {
89-
var timeon;
90-
9189
//time to do this the right way
9290
bbs.log_key("w");
9391

load/dperroom.js

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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,24 @@ 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+
this.displayRoomInfoHdr();
142+
93143
if ((infoTxt = poast.getTextBlob(this.maxInfoLines)) != null) {
94144
//save the new room info
95145
/* try {
@@ -101,10 +151,12 @@ roomData = {
101151
"\n");
102152
}*/
103153
roomSettings[bbs.cursub_code].info = infoTxt;
104-
roomSettings[bbs.cursub_code].moderator = user.alias;
154+
//this will be set in a separate method handling moderators
155+
//roomSettings[bbs.cursub_code].moderator = user.alias;
105156
//of course this will have to be replaced with better code to
106157
//make sure the person is authorized, sysop modification of it,
107158
//etc etc etc (re: above)
159+
108160
//roomSettings[bbs.cursub_code].infoCreationDate =
109161
roomData.fileIO.saveRoomInfo();
110162
}
@@ -117,7 +169,7 @@ roomData = {
117169
displayRoomInfo : function() {
118170
this.displayRoomInfoHdr();
119171

120-
roomSettings[bbs.cursub_code] = snagRoomInfoBlob();
172+
roomSettings[bbs.cursub_code] = roomData.fileIO.snagRoomInfoBlob();
121173

122174
if (roomSettings[bbs.cursub_code].info.length == 0) {
123175
//or should we be looking for null here?

0 commit comments

Comments
 (0)