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
0a500b1b
Commit
0a500b1b
authored
23 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Created logoffuserdat() function to handle common logoff user record updates.
parent
a0c222c1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sbbs3/userdat.c
+36
-0
36 additions, 0 deletions
src/sbbs3/userdat.c
src/sbbs3/userdat.h
+1
-0
1 addition, 0 deletions
src/sbbs3/userdat.h
with
37 additions
and
0 deletions
src/sbbs3/userdat.c
+
36
−
0
View file @
0a500b1b
...
...
@@ -1285,3 +1285,39 @@ void DLLCALL subtract_cdt(scfg_t* cfg, user_t* user, long amt)
else
/* no free credits */
user
->
cdt
=
adjustuserrec
(
cfg
,
user
->
number
,
U_CDT
,
10
,
-
amt
);
}
BOOL
DLLCALL
logoffuserdat
(
scfg_t
*
cfg
,
user_t
*
user
,
time_t
now
,
time_t
logontime
)
{
char
str
[
128
];
struct
tm
*
tm
,
tm_now
;
user
->
tlast
=
(
now
-
logontime
)
/
60
;
putuserrec
(
cfg
,
user
->
number
,
U_LASTON
,
8
,
ultoa
(
now
,
str
,
16
));
putuserrec
(
cfg
,
user
->
number
,
U_TLAST
,
5
,
ultoa
(
user
->
tlast
,
str
,
10
));
adjustuserrec
(
cfg
,
user
->
number
,
U_TIMEON
,
5
,
user
->
tlast
);
adjustuserrec
(
cfg
,
user
->
number
,
U_TTODAY
,
5
,
user
->
tlast
);
/* Convert time_t to struct tm */
tm
=
gmtime
(
&
now
);
if
(
tm
==
NULL
)
return
(
FALSE
);
tm_now
=*
tm
;
tm
=
gmtime
(
&
logontime
);
if
(
tm
==
NULL
)
return
(
FALSE
);
/* Reset daily stats if new day */
if
(
tm
->
tm_mday
!=
tm_now
.
tm_mday
)
{
/* date has changed while online */
putuserrec
(
cfg
,
user
->
number
,
U_LTODAY
,
5
,
"0"
);
/* so zero logons today */
putuserrec
(
cfg
,
user
->
number
,
U_ETODAY
,
5
,
"0"
);
/* and e-mails today */
putuserrec
(
cfg
,
user
->
number
,
U_PTODAY
,
5
,
"0"
);
/* and posts today */
putuserrec
(
cfg
,
user
->
number
,
U_FREECDT
,
10
/* and free credits per day */
,
ultoa
(
cfg
->
level_freecdtperday
[
user
->
level
],
str
,
10
));
putuserrec
(
cfg
,
user
->
number
,
U_TTODAY
,
5
,
"0"
);
/* and time on today */
putuserrec
(
cfg
,
user
->
number
,
U_TEXTRA
,
5
,
"0"
);
/* and extra time */
}
return
(
TRUE
);
}
This diff is collapsed.
Click to expand it.
src/sbbs3/userdat.h
+
1
−
0
View file @
0a500b1b
...
...
@@ -89,6 +89,7 @@ DLLEXPORT BOOL DLLCALL chk_ar(scfg_t* cfg, uchar* str, user_t* user); /* checks
DLLEXPORT
int
DLLCALL
getuserrec
(
scfg_t
*
,
int
usernumber
,
int
start
,
int
length
,
char
*
str
);
DLLEXPORT
int
DLLCALL
putuserrec
(
scfg_t
*
,
int
usernumber
,
int
start
,
uint
length
,
char
*
str
);
DLLEXPORT
ulong
DLLCALL
adjustuserrec
(
scfg_t
*
,
int
usernumber
,
int
start
,
int
length
,
long
adj
);
DLLEXPORT
BOOL
DLLCALL
logoffuserdat
(
scfg_t
*
,
user_t
*
,
time_t
now
,
time_t
logontime
);
DLLEXPORT
void
DLLCALL
subtract_cdt
(
scfg_t
*
,
user_t
*
,
long
amt
);
#ifdef __cplusplus
...
...
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