Merge "Accessbot fix for running on Python 3.12"
This commit is contained in:
commit
e1127848aa
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
import configparser
|
import configparser
|
||||||
import argparse
|
import argparse
|
||||||
|
import functools
|
||||||
import irc.client
|
import irc.client
|
||||||
import logging
|
import logging
|
||||||
import ssl
|
import ssl
|
||||||
@ -47,7 +48,12 @@ class SetAccess(irc.client.SimpleIRCClient):
|
|||||||
self.changes = []
|
self.changes = []
|
||||||
self.identified = False
|
self.identified = False
|
||||||
if self.port == 6697:
|
if self.port == 6697:
|
||||||
factory = irc.connection.Factory(wrapper=ssl.wrap_socket)
|
# Taken from the example in the Factory class docstring at
|
||||||
|
# https://github.com/jaraco/irc/blob/main/irc/connection.py
|
||||||
|
context = ssl.create_default_context()
|
||||||
|
wrapper = functools.partial(
|
||||||
|
context.wrap_socket, server_hostname=self.server)
|
||||||
|
factory = irc.connection.Factory(wrapper=wrapper)
|
||||||
self.connect(self.server, self.port, self.nick,
|
self.connect(self.server, self.port, self.nick,
|
||||||
connect_factory=factory)
|
connect_factory=factory)
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user