Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Synchronet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
138
Issues
138
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Main
Synchronet
Compare Revisions
ac94b066213538a0ef8d91aab6391e2490da7ea4...2b3e62c1ef25b2a77a442dfe69f8209f25271a21
Source
2b3e62c1ef25b2a77a442dfe69f8209f25271a21
Select Git revision
...
Target
ac94b066213538a0ef8d91aab6391e2490da7ea4
Select Git revision
Compare
Commits (2)
strcpy() -> SAFECOPY()
· 0e76bac1
Rob Swindell
authored
Sep 17, 2020
0e76bac1
When a sysop pages a node for private chat, force that node into private chat.
· 2b3e62c1
Rob Swindell
authored
Sep 17, 2020
When a sysop wants to chat, he wants to chat right now, damnit!
2b3e62c1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
72 additions
and
37 deletions
+72
-37
src/sbbs3/chat.cpp
src/sbbs3/chat.cpp
+40
-35
src/sbbs3/getnode.cpp
src/sbbs3/getnode.cpp
+28
-1
src/sbbs3/node.c
src/sbbs3/node.c
+2
-0
src/sbbs3/nodedefs.h
src/sbbs3/nodedefs.h
+1
-0
src/sbbs3/sbbs.h
src/sbbs3/sbbs.h
+1
-1
No files found.
src/sbbs3/chat.cpp
View file @
2b3e62c1
...
...
@@ -771,7 +771,7 @@ bool sbbs_t::chan_access(uint cnum)
/****************************************************************************/
/* Private split-screen (or interspersed) chat with node or local sysop */
/****************************************************************************/
void
sbbs_t
::
privchat
(
bool
local
)
void
sbbs_t
::
privchat
(
bool
forced
,
int
node_num
)
{
char
str
[
128
],
c
,
*
p
,
localbuf
[
5
][
81
],
remotebuf
[
5
][
81
]
,
localline
=
0
,
remoteline
=
0
,
localchar
=
0
,
remotechar
=
0
...
...
@@ -787,8 +787,8 @@ void sbbs_t::privchat(bool local)
node_t
node
;
time_t
last_nodechk
=
0
;
if
(
local
)
n
=
0
;
if
(
forced
)
n
=
node_num
;
else
{
if
(
useron
.
rest
&
FLAG
(
'C'
))
{
...
...
@@ -808,8 +808,12 @@ void sbbs_t::privchat(bool local)
bprintf
(
text
[
NodeNAlreadyInPChat
],
n
);
return
;
}
if
(
SYSOP
&&
getnodedat
(
n
,
&
node
,
true
)
==
0
)
{
node
.
misc
|=
NODE_FCHAT
;
putnodedat
(
n
,
&
node
);
}
else
{
if
((
node
.
action
!=
NODE_PAGE
||
node
.
aux
!=
cfg
.
node_num
)
&&
node
.
misc
&
NODE_POFF
&&
!
SYSOP
)
{
&&
node
.
misc
&
NODE_POFF
)
{
bprintf
(
text
[
CantPageNode
],
node
.
misc
&
NODE_ANON
?
text
[
UNKNOWN_USER
]
:
username
(
&
cfg
,
node
.
useron
,
tmp
));
return
;
...
...
@@ -826,6 +830,7 @@ void sbbs_t::privchat(bool local)
,
username
(
&
cfg
,
node
.
useron
,
tmp
),
n
);
logline
(
"C"
,
str
);
}
}
if
(
getnodedat
(
cfg
.
node_num
,
&
thisnode
,
true
)
==
0
)
{
thisnode
.
action
=
action
=
NODE_PAGE
;
...
...
@@ -858,14 +863,14 @@ void sbbs_t::privchat(bool local)
if
(
getnodedat
(
cfg
.
node_num
,
&
thisnode
,
true
)
==
0
)
{
thisnode
.
action
=
action
=
NODE_PCHT
;
thisnode
.
aux
=
n
;
thisnode
.
misc
&=~
NODE_LCHAT
;
thisnode
.
misc
&=~
(
NODE_LCHAT
|
NODE_FCHAT
)
;
putnodedat
(
cfg
.
node_num
,
&
thisnode
);
}
if
(
!
online
||
sys_status
&
SS_ABORT
)
if
(
!
online
||
(
!
forced
&&
(
sys_status
&
SS_ABORT
))
)
return
;
if
(
local
)
{
if
(
forced
&&
n
==
0
)
{
/* If an external sysop chat event handler is installed, just run that and do nothing else */
if
(
user_event
(
EVENT_LOCAL_CHAT
))
return
;
...
...
@@ -882,7 +887,7 @@ void sbbs_t::privchat(bool local)
*/
if
(
!
(
sys_status
&
SS_SPLITP
))
{
if
(
local
)
if
(
forced
)
bprintf
(
text
[
SysopIsHere
],
cfg
.
sys_op
);
else
bputs
(
text
[
WelcomeToPrivateChat
]);
...
...
@@ -894,7 +899,7 @@ void sbbs_t::privchat(bool local)
return
;
}
if
(
local
)
if
(
forced
&&
n
==
0
)
sprintf
(
inpath
,
"%slchat.dab"
,
cfg
.
node_dir
);
else
sprintf
(
inpath
,
"%schat.dab"
,
cfg
.
node_path
[
n
-
1
]);
...
...
@@ -924,7 +929,7 @@ void sbbs_t::privchat(bool local)
putnodedat
(
cfg
.
node_num
,
&
thisnode
);
}
if
(
!
local
)
{
if
(
n
)
{
// not local
if
(
getnodedat
(
n
,
&
node
,
true
)
==
0
)
{
node
.
misc
|=
NODE_RPCHT
;
/* Set "reset pchat flag" */
putnodedat
(
n
,
&
node
);
/* on other node */
...
...
@@ -955,7 +960,7 @@ void sbbs_t::privchat(bool local)
ansi_save
();
ansi_gotoxy
(
1
,
13
);
remote_y
=
1
;
bprintf
(
local
?
local_sep
:
sep
bprintf
(
forced
?
local_sep
:
sep
,
thisnode
.
misc
&
NODE_MSGW
?
'T'
:
' '
,
sectostr
(
timeleft
,
tmp
)
,
thisnode
.
misc
&
NODE_NMSG
?
'M'
:
' '
);
...
...
@@ -963,7 +968,7 @@ void sbbs_t::privchat(bool local)
local_y
=
14
;
}
while
(
online
&&
(
local
||
!
(
sys_status
&
SS_ABORT
)))
{
while
(
online
&&
(
forced
||
!
(
sys_status
&
SS_ABORT
)))
{
lncntr
=
0
;
if
(
sys_status
&
SS_SPLITP
)
lbuflen
=
0
;
...
...
@@ -1007,7 +1012,7 @@ void sbbs_t::privchat(bool local)
bputs
(
"
\1
i_
\1
n"
);
/* Fake cursor */
ansi_save
();
ansi_gotoxy
(
1
,
13
);
bprintf
(
local
?
local_sep
:
sep
bprintf
(
forced
?
local_sep
:
sep
,
thisnode
.
misc
&
NODE_MSGW
?
'T'
:
' '
,
sectostr
(
timeleft
,
tmp
)
,
thisnode
.
misc
&
NODE_NMSG
?
'M'
:
' '
);
...
...
@@ -1037,7 +1042,7 @@ void sbbs_t::privchat(bool local)
if
(
sys_status
&
SS_SPLITP
&&
local_y
==
24
)
{
ansi_gotoxy
(
1
,
13
);
bprintf
(
local
?
local_sep
:
sep
bprintf
(
forced
?
local_sep
:
sep
,
thisnode
.
misc
&
NODE_MSGW
?
'T'
:
' '
,
sectostr
(
timeleft
,
tmp
)
,
thisnode
.
misc
&
NODE_NMSG
?
'M'
:
' '
);
...
...
@@ -1133,7 +1138,7 @@ void sbbs_t::privchat(bool local)
if
(
sys_status
&
SS_SPLITP
&&
remote_y
==
12
)
{
CRLF
;
bprintf
(
local
?
local_sep
:
sep
bprintf
(
forced
?
local_sep
:
sep
,
thisnode
.
misc
&
NODE_MSGW
?
'T'
:
' '
,
sectostr
(
timeleft
,
tmp
)
,
thisnode
.
misc
&
NODE_NMSG
?
'M'
:
' '
);
...
...
@@ -1194,7 +1199,7 @@ void sbbs_t::privchat(bool local)
nodesync
();
}
if
(
!
local
)
{
if
(
n
!=
0
)
{
getnodedat
(
n
,
&
node
,
0
);
if
((
node
.
action
!=
NODE_PCHT
&&
node
.
action
!=
NODE_PAGE
)
||
node
.
aux
!=
cfg
.
node_num
)
{
...
...
@@ -1270,7 +1275,7 @@ int sbbs_t::getnodetopage(int all, int telegram)
sprintf
(
str
,
text
[
NodeToPrivateChat
],
lastnodemsg
);
mnemonics
(
str
);
strcpy
(
str
,
lastnodemsguser
);
SAFECOPY
(
str
,
lastnodemsguser
);
getstr
(
str
,
LEN_ALIAS
,
K_UPRLWR
|
K_LINE
|
K_EDIT
|
K_AUTODEL
);
if
(
sys_status
&
SS_ABORT
)
{
sys_status
&=
~
SS_ABORT
;
...
...
@@ -1291,7 +1296,7 @@ int sbbs_t::getnodetopage(int all, int telegram)
?
text
[
UNKNOWN_USER
]
:
username
(
&
cfg
,
node
.
useron
,
tmp
));
return
(
0
);
}
strcpy
(
lastnodemsguser
,
str
);
SAFECOPY
(
lastnodemsguser
,
str
);
if
(
telegram
)
return
(
node
.
useron
);
return
(
j
);
...
...
@@ -1332,7 +1337,7 @@ int sbbs_t::getnodetopage(int all, int telegram)
}
if
(
telegram
)
return
(
j
);
strcpy
(
lastnodemsguser
,
str
);
SAFECOPY
(
lastnodemsguser
,
str
);
return
(
i
);
}
}
...
...
src/sbbs3/getnode.cpp
View file @
2b3e62c1
...
...
@@ -109,6 +109,18 @@ int sbbs_t::getnodedat(uint number, node_t *node, bool lockit)
return
(
0
);
}
static
int
getpagingnode
(
scfg_t
*
cfg
)
{
for
(
int
i
=
1
;
i
<=
cfg
->
sys_nodes
;
i
++
)
{
node_t
node
;
if
(
i
==
cfg
->
node_num
)
continue
;
if
(
getnodedat
(
cfg
,
i
,
&
node
,
FALSE
,
NULL
)
==
0
&&
node
.
action
==
NODE_PAGE
&&
node
.
aux
==
cfg
->
node_num
)
return
i
;
}
return
0
;
}
/****************************************************************************/
/* Synchronizes all the nodes knowledge of the other nodes' actions, mode, */
/* status and other flags. */
...
...
@@ -185,6 +197,19 @@ void sbbs_t::nodesync(bool clearline)
RESTORELINE
;
}
if
(
thisnode
.
misc
&
NODE_FCHAT
)
{
// forced into private chat
int
n
=
getpagingnode
(
&
cfg
);
if
(
n
)
{
SAVELINE
;
privchat
(
true
,
n
);
RESTORELINE
;
}
if
(
getnodedat
(
cfg
.
node_num
,
&
thisnode
,
true
)
==
0
)
{
thisnode
.
misc
&=
~
NODE_FCHAT
;
putnodedat
(
cfg
.
node_num
,
&
thisnode
);
}
}
if
(
sys_status
&
SS_USERON
&&
memcmp
(
&
nodesync_user
,
&
useron
,
sizeof
(
user_t
)))
{
getusrdirs
();
getusrsubs
();
...
...
@@ -644,7 +669,7 @@ void sbbs_t::printnodedat(uint number, node_t* node)
outchar
(
')'
);
}
if
(
SYSOP
&&
((
node
->
misc
&
(
NODE_ANON
|
NODE_UDAT
|
NODE_INTR
|
NODE_RRUN
|
NODE_EVENT
|
NODE_DOWN
|
NODE_LCHAT
))
&
(
NODE_ANON
|
NODE_UDAT
|
NODE_INTR
|
NODE_RRUN
|
NODE_EVENT
|
NODE_DOWN
|
NODE_LCHAT
|
NODE_FCHAT
))
||
node
->
status
==
NODE_QUIET
))
{
bputs
(
" ["
);
if
(
node
->
misc
&
NODE_ANON
)
...
...
@@ -663,6 +688,8 @@ void sbbs_t::printnodedat(uint number, node_t* node)
outchar
(
'D'
);
if
(
node
->
misc
&
NODE_LCHAT
)
outchar
(
'C'
);
if
(
node
->
misc
&
NODE_FCHAT
)
outchar
(
'F'
);
outchar
(
']'
);
}
if
(
node
->
errors
&&
SYSOP
)
{
...
...
src/sbbs3/node.c
View file @
2b3e62c1
...
...
@@ -438,6 +438,8 @@ void printnodedat(int number, node_t node)
putchar
(
'D'
);
if
(
node
.
misc
&
NODE_LCHAT
)
putchar
(
'C'
);
if
(
node
.
misc
&
NODE_FCHAT
)
putchar
(
'F'
);
putchar
(
']'
);
}
if
(
node
.
errors
)
printf
(
" %d error%c"
,
node
.
errors
,
node
.
errors
>
1
?
's'
:
'\0'
);
...
...
src/sbbs3/nodedefs.h
View file @
2b3e62c1
...
...
@@ -76,6 +76,7 @@ enum node_status { /* Node Status */
#define NODE_NMSG (1<<11)
/* Node message waiting (new way) */
#define NODE_EXT (1<<12)
/* Extended info on node action */
#define NODE_LCHAT (1<<13)
/* Being pulled into local chat */
#define NODE_FCHAT (1<<14)
/* Being forced into private chat */
enum
node_action
{
/* Node Action */
NODE_MAIN
/* Main Prompt */
...
...
src/sbbs3/sbbs.h
View file @
2b3e62c1
...
...
@@ -927,7 +927,7 @@ public:
void
localguru
(
char
*
guru
,
int
gurunum
);
bool
sysop_page
(
void
);
bool
guru_page
(
void
);
void
privchat
(
bool
local
=
false
);
void
privchat
(
bool
forced
=
false
,
int
node_num
=
0
);
bool
chan_access
(
uint
cnum
);
int
getnodetopage
(
int
all
,
int
telegram
);
...
...