loop not ending

This commit is contained in:
Nicholas Chambers 2017-06-22 04:44:19 +01:00
parent 5f607d8d31
commit 45ab816815
1 changed files with 9 additions and 6 deletions

View File

@ -276,12 +276,12 @@ handleCommand(s, _, "AUTHENTICATE", ["+"]) -> do
s
end.
registering_finished = false.
registering_finished = ref!(false).
handleCommand(s, _, "903", _) -> do
putstrln("SASL authentication successful.");
fputstr(sock, "CAP END\r\n");
registering_finished = true;
setRef!(registering_finished, true);
s
end.
@ -310,16 +310,19 @@ sock = sockopen(config\HOST, config\PORT).
-- SASL register loop
registerLoop(state) ->
if op\and(feof(sock) != true, finished_registering == false) then do
line = fgetline(state, line)
if op\and(feof(sock) != true, readRef!(registering_finished) == false) then do
line = fgetline(sock);
handleLine(state, line);
putstrln(repr(readRef!(registering_finished)))
end
else false.
-- send introduction
if config\PASS != "" then
if config\SASL == true then
fputstr(sock, "CAP REQ :sasl\r\n")
if config\SASL == true then do
fputstr(sock, "CAP REQ :sasl\r\n");
loop(registerLoop, [])
end
else
fputstr(sock, "PASS " + config\PASS + "\r\n")
else (,).