@@ -64,7 +64,7 @@ userRecords = {
64
64
* finds the point where the comment header stops and data begins
65
65
* infile:
66
66
* the currently open data file to read
67
- * returns :
67
+ * return :
68
68
* the file object with the pointer located at the point where
69
69
* data begins
70
70
* throws:
@@ -115,9 +115,9 @@ userRecords = {
115
115
/*
116
116
* summary:
117
117
* method loads the dDoc-specific settings file
118
- * returns :
118
+ * return :
119
119
* the per-user settings sub-object
120
- * logs an error and returns null on failure
120
+ * logs an error and throws exception on failure
121
121
*/
122
122
loadSettingsBlob : function ( ) {
123
123
var settingsFile = new File ( userRecords . userDir
@@ -139,7 +139,6 @@ userRecords = {
139
139
throw new dDocException ( "Unable to open " +
140
140
userRecords . userDir + userRecords . settingsFilename ,
141
141
"Can't open user records!" , 1 ) ;
142
- //return null;
143
142
}
144
143
145
144
settingsFile = this . stripComments ( settingsFile ) ;
@@ -151,15 +150,13 @@ userRecords = {
151
150
+ e . toString ( ) + "\n" ) ;
152
151
throw new dDocException ( "Err: " + e . toString ( ) , "Exception" +
153
152
" reading dDoc settings" , 2 ) ;
154
- //return null;
155
153
} finally {
156
154
settingsFile . close ( ) ;
157
155
}
158
156
159
157
if ( ( blob == null ) || ( blob . length < 2 ) ) {
160
158
throw new dDocException ( "Exception: blob too small" ,
161
159
"blob null or length < 2" , 3 ) ;
162
- //return null;
163
160
}
164
161
165
162
blob = JSON . parse ( blob ) ;
@@ -172,7 +169,7 @@ userRecords = {
172
169
* the user number
173
170
* userid:
174
171
* synchronet user number to load
175
- * returns :
172
+ * return :
176
173
* the current user's settings object
177
174
* if no settings for the current user are found, it returns a
178
175
* settings object with all debugging options defaulting to false
@@ -203,6 +200,12 @@ userRecords = {
203
200
/*
204
201
* summary:
205
202
* Saves the per-user settings to the DDOC settings file.
203
+ * userid:
204
+ * User id #
205
+ * settings:
206
+ * Not sure if this is the set of settings just for the user or if
207
+ * for some reason the global settings variable is being passed
208
+ * through here; looking at the calling code will be useful
206
209
*/
207
210
saveSettings : function ( userid , settings ) {
208
211
var json = this . loadSettingsBlob ( ) ;
@@ -228,13 +231,17 @@ userRecords = {
228
231
* summary:
229
232
* method is a wrapper for opening a file of any particular
230
233
* mode; serves as a wrapper for the try/catch shit to not
231
- * be so redundant in code
232
- * fname:
233
- * filename/path to open
234
+ * be so redundant in code; this should be utilized in some more
235
+ * places, I kind of forgot about using this when I was working on
236
+ * dperroom.js and potentially a few other spots where the wheel
237
+ * has been invented again
238
+ * fObj:
239
+ * filename/path of the File object
234
240
* mode:
235
241
* Synchronet API's mode specification for File.open()
236
242
* return:
237
- * Returns null for error, open file object for success
243
+ * Returns open file object for success; throws exception on
244
+ * error
238
245
*/
239
246
openFileWrap : function ( fObj , mode ) {
240
247
try {
@@ -245,17 +252,26 @@ userRecords = {
245
252
fObj . close ( ) ;
246
253
throw new dDocException ( "Exception in openFileWrap" ,
247
254
e . toString ( ) , 1 ) ;
248
- //return null;
249
255
}
250
256
251
257
return fObj ;
252
258
}
253
259
} ,
260
+ //sub-object
254
261
userDataUI : {
255
262
//pushing/pulling output from the user (sorry, I can't stop using that
256
263
//terminology now)
257
264
258
265
// ----++++****====userDataUI methods====****++++----
266
+ /*
267
+ * summary:
268
+ * Method handles looking up a user by the user name and
269
+ * fetches the data from userRecords.userDataIO.loadSettings()
270
+ * in order to determine various bits of information like the
271
+ * doing field and info field
272
+ * uname:
273
+ * Name of the user to profile
274
+ */
259
275
profileUser : function ( uname ) {
260
276
var profileeSettings = { } ;
261
277
var unum , uObj ;
@@ -290,7 +306,7 @@ userRecords = {
290
306
* summary:
291
307
* obtains a new list of lines of text to utilize as the
292
308
* info field from the user
293
- * returns :
309
+ * return :
294
310
* this (up to 5 line) array of user info text
295
311
*/
296
312
getInfo : function ( ) {
@@ -315,7 +331,7 @@ userRecords = {
315
331
/*
316
332
* summary:
317
333
* Asks the user for a new doing message
318
- * returns :
334
+ * return :
319
335
* String value of the new doing message
320
336
*/
321
337
getDoing : function ( ) {
@@ -336,6 +352,8 @@ userRecords = {
336
352
* userid:
337
353
* synchronet user number of the user whose debug flags
338
354
* are being set
355
+ * return:
356
+ * new settings object
339
357
* TODO:
340
358
* connect this function with a sysop settings menu somewhere
341
359
* so that sysops can set their own and others' debugging options
@@ -366,6 +384,13 @@ userRecords = {
366
384
userRecords . userDataIO . saveSettings ( userid , tmpSettings ) ;
367
385
return tmpSettings ;
368
386
} ,
387
+ /*
388
+ * summary:
389
+ * Method displays the different possible debugging options
390
+ * for the user as well as their true/false selected values
391
+ * userid:
392
+ * User id # of the user being examined
393
+ */
369
394
displayDebugFlags : function ( userid ) {
370
395
var flags = Object . keys (
371
396
userRecords . userDataIO . loadSettings ( userid ) . debug ) ;
@@ -376,6 +401,12 @@ userRecords = {
376
401
high_intensity + userSettings . debug [ opt ] + "\n" ) ;
377
402
}
378
403
} ,
404
+ /*
405
+ * summary:
406
+ * Method displays the user information blurb (sans header)
407
+ * userid:
408
+ * User id # for the user being queried
409
+ */
379
410
displayInfo : function ( userid ) {
380
411
var info = userRecords . userDataIO . loadSettings ( userid ) . info ;
381
412
var i ;
@@ -388,6 +419,7 @@ userRecords = {
388
419
}
389
420
390
421
} ,
422
+ //sub-object
391
423
userConfig = {
392
424
//'c'onfig menu stuph
393
425
@@ -399,7 +431,7 @@ userConfig = {
399
431
// ----++++****====userConfig methods====****++++----
400
432
/*
401
433
* summary:
402
- * menu choice response for user configuration options
434
+ * menu choice response for user configuration options
403
435
*/
404
436
reConfigure : function ( ) {
405
437
var stillAlahv = true , uResponse = null ;
@@ -438,9 +470,6 @@ userConfig = {
438
470
console . putmsg ( excuse ) ;
439
471
break ;
440
472
}
441
-
442
473
}
443
-
444
474
}
445
-
446
475
}
0 commit comments