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
160e2925
Commit
160e2925
authored
23 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Created spamlog() and hacklog() global methods.
parent
8b3e0cc1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sbbs3/js_system.c
+80
-0
80 additions, 0 deletions
src/sbbs3/js_system.c
with
80 additions
and
0 deletions
src/sbbs3/js_system.c
+
80
−
0
View file @
160e2925
...
...
@@ -706,6 +706,84 @@ js_secondstr(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
return
(
JS_TRUE
);
}
static
JSBool
js_spamlog
(
JSContext
*
cx
,
JSObject
*
obj
,
uintN
argc
,
jsval
*
argv
,
jsval
*
rval
)
{
uintN
i
;
char
*
p
;
char
*
prot
=
NULL
;
char
*
reason
=
NULL
;
char
*
host
=
NULL
;
char
*
ip_addr
=
NULL
;
char
*
to
=
NULL
;
scfg_t
*
cfg
;
if
((
cfg
=
(
scfg_t
*
)
JS_GetPrivate
(
cx
,
obj
))
==
NULL
)
return
(
JS_FALSE
);
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
if
(
!
JSVAL_IS_STRING
(
argv
[
i
]))
continue
;
p
=
JS_GetStringBytes
(
JS_ValueToString
(
cx
,
argv
[
i
]));
if
(
p
==
NULL
)
continue
;
if
(
prot
==
NULL
)
prot
=
p
;
else
if
(
reason
==
NULL
)
reason
=
p
;
else
if
(
host
==
NULL
)
host
=
p
;
else
if
(
ip_addr
==
NULL
)
ip_addr
=
p
;
else
if
(
to
==
NULL
)
to
=
p
;
}
*
rval
=
BOOLEAN_TO_JSVAL
(
spamlog
(
cfg
,
prot
,
reason
,
host
,
ip_addr
,
to
));
return
(
JS_TRUE
);
}
static
JSBool
js_hacklog
(
JSContext
*
cx
,
JSObject
*
obj
,
uintN
argc
,
jsval
*
argv
,
jsval
*
rval
)
{
uintN
i
;
char
*
p
;
char
*
prot
=
NULL
;
char
*
user
=
NULL
;
char
*
text
=
NULL
;
char
*
host
=
NULL
;
SOCKADDR_IN
addr
;
scfg_t
*
cfg
;
if
((
cfg
=
(
scfg_t
*
)
JS_GetPrivate
(
cx
,
obj
))
==
NULL
)
return
(
JS_FALSE
);
memset
(
&
addr
,
0
,
sizeof
(
addr
));
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
if
(
JSVAL_IS_INT
(
argv
[
i
]))
{
if
(
addr
.
sin_addr
.
S_un
.
S_addr
==
0
)
addr
.
sin_addr
.
S_un
.
S_addr
=
JSVAL_TO_INT
(
argv
[
i
]);
else
addr
.
sin_port
=
(
ushort
)
JSVAL_TO_INT
(
argv
[
i
]);
continue
;
}
if
(
!
JSVAL_IS_STRING
(
argv
[
i
]))
continue
;
p
=
JS_GetStringBytes
(
JS_ValueToString
(
cx
,
argv
[
i
]));
if
(
p
==
NULL
)
continue
;
if
(
prot
==
NULL
)
prot
=
p
;
else
if
(
user
==
NULL
)
user
=
p
;
else
if
(
text
==
NULL
)
text
=
p
;
else
if
(
host
==
NULL
)
host
=
p
;
}
*
rval
=
BOOLEAN_TO_JSVAL
(
hacklog
(
cfg
,
prot
,
user
,
text
,
host
,
&
addr
));
return
(
JS_TRUE
);
}
static
JSFunctionSpec
js_system_functions
[]
=
{
{
"alias"
,
js_alias
,
1
},
// return user name for alias
...
...
@@ -716,6 +794,8 @@ static JSFunctionSpec js_system_functions[] = {
{
"timestr"
,
js_timestr
,
0
},
// convert a time_t into a time string
{
"datestr"
,
js_datestr
,
0
},
// convert a time_t into a date string
{
"secondstr"
,
js_secondstr
,
1
},
// convert a time_t into a hh:mm:ss string
{
"spamlog"
,
js_spamlog
,
5
},
// spamlog(prot,reason,host,ip,to)
{
"hacklog"
,
js_hacklog
,
5
},
// hacklog(prot,user,text,host,ip,port)
{
0
}
};
...
...
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