Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
fb31b945
Commit
fb31b945
authored
6 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
New load/library module to make read/writing to user "properties"
(stored in data/user/*.ini) easy.
parent
83eecea3
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/load/userprops.js
+37
-0
37 additions, 0 deletions
exec/load/userprops.js
with
37 additions
and
0 deletions
exec/load/userprops.js
0 → 100644
+
37
−
0
View file @
fb31b945
// $Id$
function
filename
(
usernum
)
{
return
system
.
data_dir
+
format
(
"
user/%04u.ini
"
,
usernum
);
}
function
get
(
section
,
key
,
usernum
)
{
if
(
!
usernum
)
usernum
=
user
.
number
;
var
file
=
new
File
(
filename
(
usernum
));
if
(
!
file
.
open
(
'
r
'
))
return
false
;
var
result
;
if
(
!
section
)
result
=
file
.
iniGetAllObjects
();
else
if
(
!
key
)
result
=
file
.
iniGetObject
(
section
);
else
result
=
file
.
iniGetValue
(
section
,
key
);
file
.
close
();
return
result
;
}
function
set
(
section
,
key
,
value
,
usernum
)
{
if
(
!
usernum
)
usernum
=
user
.
number
;
var
file
=
new
File
(
filename
(
usernum
));
if
(
!
file
.
open
(
file
.
exists
?
'
r+
'
:
'
w+
'
))
return
false
;
file
.
iniSetValue
(
section
,
key
,
value
);
file
.
close
();
}
this
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment