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
46a9efec
Commit
46a9efec
authored
14 years ago
by
cyan
Browse files
Options
Downloads
Patches
Plain Diff
* More changes for DCC functionality
parent
79ee98f7
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
exec/ircbot.js
+36
-5
36 additions, 5 deletions
exec/ircbot.js
exec/load/ircbot_functions.js
+5
-1
5 additions, 1 deletion
exec/load/ircbot_functions.js
with
41 additions
and
6 deletions
exec/ircbot.js
+
36
−
5
View file @
46a9efec
...
...
@@ -175,9 +175,6 @@ function main() {
}
}
}
mswait
(
10
);
/* Don't peg the CPU */
}
/* Take care of DCC chat sessions */
...
...
@@ -185,18 +182,44 @@ function main() {
if
(
!
dcc_chats
[
c
].
sock
.
is_connected
)
{
log
(
"
Closing session.
"
);
dcc_chats
[
c
].
sock
.
close
();
delete
dcc_chats
[
c
];
continue
;
}
if
(
dcc_chats
[
c
].
waiting_for_password
)
{
if
(
var
dcc_pwd
=
dcc_chats
[
c
].
sock
.
readln
())
{
dcc_chats
[
c
].
o
(
"
Acknowledged.
"
);
var
dcc_pwd
;
if
(
dcc_pwd
=
dcc_chats
[
c
].
sock
.
readln
())
{
var
usr
=
new
User
(
system
.
matchuser
(
dcc_chats
[
c
].
id
));
if
(
!
usr
||
(
dcc_pwd
.
toUpperCase
()
!=
usr
.
security
.
password
))
{
dcc_chats
[
c
].
o
(
null
,
"
Access Denied.
"
);
dcc_chats
[
c
].
sock
.
close
();
delete
dcc_chats
[
c
];
continue
;
}
if
(
dcc_pwd
.
toUpperCase
()
==
usr
.
security
.
password
)
{
dcc_chats
[
c
].
waiting_for_password
=
false
;
dcc_chats
[
c
].
o
(
null
,
"
Welcome aboard.
"
);
}
}
continue
;
}
var
line
=
dcc_chats
[
c
].
sock
.
readln
();
if
(
!
line
||
line
==
""
)
continue
;
var
usr
=
new
User
(
system
.
matchuser
(
dcc_chats
[
c
].
id
));
var
cmd
=
line
.
split
(
"
"
);
cmd
[
0
]
=
cmd
[
0
].
toUpperCase
();
try
{
dcc_chats
[
c
].
check_bot_command
(
cmd
);
}
catch
(
err
)
{
dcc_chats
[
c
].
o
(
null
,
"
ERROR:
"
+
err
);
}
}
if
(
(
time
()
-
Config_Last_Write
)
>
config_write_delay
)
save_everything
();
mswait
(
10
);
/* Don't peg the CPU */
}
}
...
...
@@ -275,6 +298,14 @@ function DCC_Chat(sock,id) {
this
.
waiting_for_password
=
true
;
/* Functions */
this
.
o
=
DCC_Out
;
this
.
check_bot_command
=
function
(
cmd
)
{
Server_check_bot_command
(
this
,
Bot_Commands
,
null
,
this
.
id
,
null
,
cmd
);
for
(
var
bot_cmd
in
Modules
)
{
Server_check_bot_command
(
this
,
Modules
[
bot_cmd
].
Bot_Commands
,
null
,
this
.
id
,
null
,
cmd
);
}
}
}
function
DCC_Out
(
target
,
str
)
{
...
...
This diff is collapsed.
Click to expand it.
exec/load/ircbot_functions.js
+
5
−
1
View file @
46a9efec
...
...
@@ -137,6 +137,11 @@ function Server_command(srv,cmdline,onick,ouh) {
function
Server_CTCP
(
onick
,
ouh
,
cmd
)
{
switch
(
cmd
[
0
])
{
case
"
DCC
"
:
var
usr
=
new
User
(
system
.
matchuser
(
onick
));
if
(
!
usr
.
number
)
{
this
.
o
(
onick
,
"
I don't talk to strangers.
"
,
"
NOTICE
"
);
return
;
}
if
(
cmd
[
4
])
{
if
((
cmd
[
1
].
toUpperCase
()
==
"
CHAT
"
)
&&
(
cmd
[
2
].
toUpperCase
()
==
"
CHAT
"
)
...
...
@@ -146,7 +151,6 @@ function Server_CTCP(onick,ouh,cmd) {
var
port
=
parseInt
(
cmd
[
4
]);
var
sock
=
new
Socket
();
sock
.
connect
(
ip
,
port
,
3
/* Timeout */
);
log
(
"
*** DCC Socket Status:
"
+
sock
.
is_connected
);
if
(
sock
.
is_connected
)
{
sock
.
write
(
"
Enter your password.
\r\n
"
);
dcc_chats
.
push
(
new
DCC_Chat
(
sock
,
onick
));
...
...
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