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
f0c29b98
Commit
f0c29b98
authored
5 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Quick hack for Alterego to support custom/extended node status text.
parent
5d9ffefe
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
exec/load/presence_lib.js
+22
-4
22 additions, 4 deletions
exec/load/presence_lib.js
exec/privatemsg.js
+1
-1
1 addition, 1 deletion
exec/privatemsg.js
src/sbbs3/node.c
+18
-0
18 additions, 0 deletions
src/sbbs3/node.c
with
41 additions
and
5 deletions
exec/load/presence_lib.js
+
22
−
4
View file @
f0c29b98
...
...
@@ -119,8 +119,21 @@ function user_age_and_gender(user, options)
return
output
;
}
function
extended_status
(
num
)
{
var
f
=
new
File
(
system
.
ctrl_dir
+
"
node.exb
"
);
if
(
!
f
.
open
(
"
rb
"
))
return
"
!error
"
+
f
.
error
+
"
opening
"
+
f
.
name
;
f
.
position
=
num
*
128
;
var
str
=
f
.
read
(
128
);
f
.
close
();
return
str
;
}
// Returns a string describing the node status, suitable for printing on a single line
//
// num is zero-based
//
// options values supported/used:
// .include_age
// .include_gender
...
...
@@ -131,9 +144,10 @@ function user_age_and_gender(user, options)
// .gender_separator
// .connection_prefix
// .errors_prefix
function
node_status
(
node
,
is_sysop
,
options
)
function
node_status
(
node
,
is_sysop
,
options
,
num
)
{
var
node_status
=
node
.
status
;
var
misc
=
node
.
misc
;
var
output
=
''
;
switch
(
node_status
)
{
...
...
@@ -143,11 +157,15 @@ function node_status(node, is_sysop, options)
/* Fall-through */
case
NODE_INUSE
:
{
if
(
misc
&
NODE_EXT
)
{
output
+=
extended_status
(
num
);
break
;
}
var
user
=
new
User
(
node
.
useron
);
if
(
options
.
username_prefix
)
output
+=
options
.
username_prefix
;
if
(
js
.
global
.
bbs
&&
(
node
.
misc
&
NODE_ANON
)
&&
!
is_sysop
)
if
(
js
.
global
.
bbs
&&
(
misc
&
NODE_ANON
)
&&
!
is_sysop
)
output
+=
bbs
.
text
(
UNKNOWN_USER
);
else
output
+=
user
.
alias
;
...
...
@@ -187,7 +205,7 @@ function node_status(node, is_sysop, options)
if
(
options
.
username_prefix
)
output
+=
options
.
username_prefix
;
if
(
js
.
global
.
bbs
&&
(
node
.
misc
&
NODE_ANON
)
&&
!
is_sysop
)
if
(
js
.
global
.
bbs
&&
(
misc
&
NODE_ANON
)
&&
!
is_sysop
)
output
+=
bbs
.
text
(
UNKNOWN_USER
);
else
output
+=
system
.
username
(
node
.
useron
);
...
...
@@ -308,7 +326,7 @@ function nodelist(print, active, listself, is_sysop, options)
}
else
others
++
;
var
line
=
format
(
options
.
format
,
n
+
1
,
node_status
(
node
,
is_sysop
,
options
));
var
line
=
format
(
options
.
format
,
n
+
1
,
node_status
(
node
,
is_sysop
,
options
,
n
));
if
(
print
)
writeln
(
line
);
else
...
...
This diff is collapsed.
Click to expand it.
exec/privatemsg.js
+
1
−
1
View file @
f0c29b98
...
...
@@ -91,7 +91,7 @@ while(bbs.online && !(console.aborted)) {
write
(
bbs
.
text
(
NodeLstHdr
));
}
writeln
(
format
(
nodelist_options
.
format
,
n
+
1
,
presence
.
node_status
(
node
,
user
.
is_sysop
,
nodelist_options
)));
,
presence
.
node_status
(
node
,
user
.
is_sysop
,
nodelist_options
,
n
)));
users
[
n
]
=
node
.
useron
;
shown
++
;
}
...
...
This diff is collapsed.
Click to expand it.
src/sbbs3/node.c
+
18
−
0
View file @
f0c29b98
...
...
@@ -74,6 +74,7 @@ enum {
char
tmp
[
256
];
int
nodefile
;
int
nodeexb
;
#if defined(_WIN32)
/* Microsoft-supplied cls() routine - ugh! */
...
...
@@ -239,6 +240,16 @@ static char* node_connection_desc(ushort conn, char* str)
return
str
;
}
static
char
*
extended_status
(
int
num
,
char
*
str
)
{
if
(
nodeexb
<
0
)
return
"No extended status file open"
;
lseek
(
nodeexb
,
num
*
128
,
SEEK_SET
);
read
(
nodeexb
,
str
,
128
);
str
[
127
]
=
0
;
return
str
;
}
/****************************************************************************/
/* Displays the information for node number 'number' contained in 'node' */
/****************************************************************************/
...
...
@@ -280,6 +291,10 @@ void printnodedat(int number, node_t node)
break
;
case
NODE_QUIET
:
case
NODE_INUSE
:
if
(
node
.
misc
&
NODE_EXT
)
{
printf
(
"%s"
,
extended_status
(
number
,
tmp
));
break
;
}
printf
(
"User #%d"
,
node
.
useron
);
printf
(
" "
);
switch
(
node
.
action
)
{
...
...
@@ -494,6 +509,9 @@ int main(int argc, char **argv)
printf
(
"
\7\n
Error %d opening %s.
\n
"
,
errno
,
str
);
exit
(
1
);
}
sprintf
(
str
,
"%snode.exb"
,
ctrl_dir
);
nodeexb
=
sopen
(
str
,
O_RDWR
|
O_BINARY
,
SH_DENYNO
);
sys_nodes
=
filelength
(
nodefile
)
/
sizeof
(
node_t
);
if
(
!
sys_nodes
)
{
printf
(
"%s reflects 0 nodes!
\n
"
,
str
);
...
...
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