From 4d49ad879bb8c884bc00a88bb11b0c47c98fa8bd Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 10 Jan 2025 18:22:14 -0800 Subject: [PATCH] Update server.py --- server.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index fd2b94d..a47e012 100644 --- a/server.py +++ b/server.py @@ -191,6 +191,9 @@ def session(connection, client, ip, ssl=False): if not data: cause = "Remote host closed the connection" break + for i in mods["allsocket"]: + if "onSocket" in dir(i): + i.onSocket(socket=connection, ip=client[0], value=data.decode(), cachedNick=pending if pending != "*" else None) except Exception as ex: cause = "Read error: " + str(ex) break @@ -229,6 +232,9 @@ def session(connection, client, ip, ssl=False): nickname_list[pending] = connection property_list[pending] = {"host": hostname, "username": username, "realname": realname, "modes": "iw", "last_ping": time.time(), "ping_pending": False, "away": False} lower_nicks[pending.lower()] = pending + for i in mods["allsocket"]: + if "onValidate" in dir(i): + i.onValidate(socket=connection, ip=client[0]) threading.Thread(target=pinger, args=[pending, connection]).start() connection.sendall(bytes(f":{server} 001 {pending} :Welcome to the {displayname} Internet Relay Chat Network {pending}\r\n", "UTF-8")) connection.sendall(bytes(f":{server} 002 {pending} :Your host is {server}[{ip}/6667], running version IRCat-v{__version__}\r\n", "UTF-8")) @@ -586,7 +592,7 @@ def session(connection, client, ip, ssl=False): except Exception as ex: print(traceback.format_exc()) - cause = "Internal IRCat error: " + str(ex) + cause = "" + str(ex) break finally: connection.close()