Added optional SASL. take that darkf
This commit is contained in:
parent
45ab816815
commit
71f92b839e
33
irc.lamb
33
irc.lamb
|
@ -276,12 +276,13 @@ handleCommand(s, _, "AUTHENTICATE", ["+"]) -> do
|
||||||
s
|
s
|
||||||
end.
|
end.
|
||||||
|
|
||||||
registering_finished = ref!(false).
|
|
||||||
|
|
||||||
handleCommand(s, _, "903", _) -> do
|
handleCommand(s, _, "903", _) -> do
|
||||||
putstrln("SASL authentication successful.");
|
putstrln("SASL authentication successful.");
|
||||||
fputstr(sock, "CAP END\r\n");
|
fputstr(sock, "CAP END\r\n");
|
||||||
setRef!(registering_finished, true);
|
fputstr(sock, "NICK " + config\NICK + "\r\n");
|
||||||
|
fputstr(sock, "USER " + config\NICK + " 0 * :Lamb Da. Bot\r\n");
|
||||||
|
joinChans() -> list\map(\chan -> fputstr(sock, "JOIN " + chan + "\r\n"), config\CHANS);
|
||||||
|
joinChans();
|
||||||
s
|
s
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -308,29 +309,21 @@ end.
|
||||||
-- build our socket and connect to the server
|
-- build our socket and connect to the server
|
||||||
sock = sockopen(config\HOST, config\PORT).
|
sock = sockopen(config\HOST, config\PORT).
|
||||||
|
|
||||||
-- SASL register loop
|
|
||||||
registerLoop(state) ->
|
|
||||||
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
|
-- send introduction
|
||||||
if config\PASS != "" then
|
if config\PASS != "" then
|
||||||
if config\SASL == true then do
|
if config\SASL == true then
|
||||||
fputstr(sock, "CAP REQ :sasl\r\n");
|
fputstr(sock, "CAP REQ :sasl\r\n")
|
||||||
loop(registerLoop, [])
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
fputstr(sock, "PASS " + config\PASS + "\r\n")
|
fputstr(sock, "PASS " + config\PASS + "\r\n")
|
||||||
else (,).
|
else (,).
|
||||||
|
|
||||||
fputstr(sock, "NICK " + config\NICK + "\r\n").
|
if config\SASL == false then do
|
||||||
fputstr(sock, "USER " + config\NICK + " 0 * :Lamb Da. Bot\r\n").
|
fputstr(sock, "NICK " + config\NICK + "\r\n");
|
||||||
joinChans() -> list\map(\chan -> fputstr(sock, "JOIN " + chan + "\r\n"), config\CHANS).
|
fputstr(sock, "USER " + config\NICK + " 0 * :Lamb Da. Bot\r\n");
|
||||||
joinChans().
|
joinChans() -> list\map(\chan -> fputstr(sock, "JOIN " + chan + "\r\n"), config\CHANS);
|
||||||
|
joinChans()
|
||||||
|
end
|
||||||
|
else (,).
|
||||||
|
|
||||||
-- loop receiving lines
|
-- loop receiving lines
|
||||||
mainloop(state) ->
|
mainloop(state) ->
|
||||||
|
|
Loading…
Reference in New Issue