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
33c1a36a
Commit
33c1a36a
authored
6 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Support the new ?active-users.json query response.
parent
920b953f
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/sbbsimsg_lib.js
+41
-30
41 additions, 30 deletions
exec/load/sbbsimsg_lib.js
with
41 additions
and
30 deletions
exec/load/sbbsimsg_lib.js
+
41
−
30
View file @
33c1a36a
...
...
@@ -52,7 +52,7 @@ function request_active_users()
{
var
requests_sent
=
0
;
for
(
var
i
in
sys_list
)
{
if
(
!
sock
.
sendto
(
"
\r\n
"
,
i
,
IPPORT_SYSTAT
))
// Get list of active users
if
(
!
sock
.
sendto
(
"
?active-users.json
\r\n
"
,
i
,
IPPORT_SYSTAT
))
// Get list of active users
(in JSON fmt, if available)
continue
;
requests_sent
++
;
}
...
...
@@ -67,6 +67,15 @@ function find_name(arr, name)
return
false
;
}
// Converts HH:MM:SS to seconds
function
parseTimeOn
(
str
)
{
var
arr
=
str
.
match
(
/
(\d
+
)\:(\d
+
)\:(\d
+
)
$/
);
if
(
!
arr
)
return
0
;
return
parseInt
(
arr
[
1
]
*
60
*
60
,
10
)
+
parseInt
(
arr
[
2
]
*
60
,
10
)
+
parseInt
(
arr
[
3
],
10
);
}
function
parse_active_users
(
message
,
logon_callback
,
logoff_callback
)
{
if
(
!
message
)
...
...
@@ -78,37 +87,39 @@ function parse_active_users(message, logon_callback, logoff_callback)
}
sys
.
last_response
=
time
();
var
response
=
message
.
data
.
split
(
"
\r\n
"
);
// Skip header
while
(
response
.
length
&&
response
[
0
].
charAt
(
0
)
!=
'
-
'
)
response
.
shift
();
if
(
response
.
length
&&
response
[
0
].
charAt
(
0
)
==
'
-
'
)
response
.
shift
();
// Delete the separator line
while
(
response
.
length
&&
!
response
[
0
].
length
)
response
.
shift
();
// Delete any blank lines
while
(
response
.
length
&&
!
response
[
response
.
length
-
1
].
length
)
response
.
pop
();
// Delete trailing blank lines
var
old_users
=
sys
.
users
.
slice
();
sys
.
users
=
[];
for
(
var
i
in
response
)
{
if
(
response
[
i
]
==
""
)
continue
;
sys
.
users
.
push
(
{
name
:
format
(
"
%.25s
"
,
response
[
i
]).
trimRight
(),
action
:
response
[
i
].
substr
(
26
,
31
).
trimLeft
().
trimRight
(),
timeon
:
response
[
i
].
substr
(
57
,
9
).
trimLeft
(),
age
:
response
[
i
].
substr
(
67
,
3
).
trimLeft
(),
sex
:
response
[
i
].
substr
(
71
,
3
).
trimLeft
(),
node
:
response
[
i
].
substr
(
75
,
4
).
trimLeft
(),
time
:
time
()
}
);
}
if
(
message
.
data
[
0
]
==
'
[
'
)
sys
.
users
=
JSON
.
parse
(
message
.
data
);
else
{
var
response
=
message
.
data
.
split
(
"
\r\n
"
);
// Skip header
while
(
response
.
length
&&
response
[
0
].
charAt
(
0
)
!=
'
-
'
)
response
.
shift
();
if
(
response
.
length
&&
response
[
0
].
charAt
(
0
)
==
'
-
'
)
response
.
shift
();
// Delete the separator line
while
(
response
.
length
&&
!
response
[
0
].
length
)
response
.
shift
();
// Delete any blank lines
while
(
response
.
length
&&
!
response
[
response
.
length
-
1
].
length
)
response
.
pop
();
// Delete trailing blank lines
sys
.
users
=
[];
for
(
var
i
in
response
)
{
if
(
response
[
i
]
==
""
)
continue
;
sys
.
users
.
push
(
{
name
:
format
(
"
%.25s
"
,
response
[
i
]).
trimRight
(),
action
:
response
[
i
].
substr
(
26
,
31
).
trimLeft
().
trimRight
(),
timeon
:
parseTimeOn
(
response
[
i
].
substr
(
57
,
9
).
trimLeft
()),
age
:
response
[
i
].
substr
(
67
,
3
).
trimLeft
(),
sex
:
response
[
i
].
substr
(
71
,
3
).
trimLeft
(),
node
:
response
[
i
].
substr
(
75
,
4
).
trimLeft
()
}
);
}
}
if
(
logon_callback
)
{
var
count
=
0
;
for
(
var
i
in
sys
.
users
)
{
...
...
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