Fixed ssl useage
Signed-off-by: merspieler <merspieler@users.noreply.github.com>
This commit is contained in:
parent
5dfd772a7c
commit
ad9470ed58
1 changed files with 7 additions and 10 deletions
15
__init__.py
15
__init__.py
|
@ -241,14 +241,6 @@ class IRCSkill(MycroftSkill):
|
|||
self.speak("Please connect to a server and join a channel first")
|
||||
|
||||
def _irc_connect(self, server, port, ssl_req, server_password, user, password):
|
||||
if ssl_req:
|
||||
if self.settings['debug']:
|
||||
self.speak("Use SSL")
|
||||
irc_C = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #defines the socket
|
||||
irc = ssl.wrap_socket(irc_C, cert_reqs=ssl.CERT_NONE)
|
||||
else:
|
||||
if self.settings['debug']:
|
||||
self.speak("Connect without ssl")
|
||||
irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #defines the socket
|
||||
|
||||
# Connect
|
||||
|
@ -256,7 +248,7 @@ class IRCSkill(MycroftSkill):
|
|||
if self.settings['debug']:
|
||||
self.speak("Server: " + server)
|
||||
self.speak("Port: " + str(port))
|
||||
irc.settimeout(60)
|
||||
irc.settimeout(15)
|
||||
irc.connect((server, port))
|
||||
except Exception as e:
|
||||
self.speak("Unable to connect to server.")
|
||||
|
@ -264,6 +256,11 @@ class IRCSkill(MycroftSkill):
|
|||
self.speak("Error: " + str(e))
|
||||
return False, irc
|
||||
|
||||
if ssl_req:
|
||||
if self.settings['debug']:
|
||||
self.speak("Use SSL")
|
||||
irc = ssl.wrap_socket(irc)
|
||||
|
||||
irc.setblocking(0)
|
||||
if server_password != "":
|
||||
irc.send("PASS %s\n" % (password))
|
||||
|
|
Loading…
Reference in a new issue