From 7547eee96d611e224da02e1e4d79713b4d076e32 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 15 May 2019 17:12:21 +0100 Subject: [PATCH] Catch server version string, from RPL_MYINFO --- modules/line_handler/__init__.py | 5 +++++ modules/line_handler/core.py | 3 +++ src/IRCServer.py | 1 + 3 files changed, 9 insertions(+) diff --git a/modules/line_handler/__init__.py b/modules/line_handler/__init__.py index 42a830f7..12cf8e76 100644 --- a/modules/line_handler/__init__.py +++ b/modules/line_handler/__init__.py @@ -67,6 +67,11 @@ class Module(ModuleManager.BaseModule): def handle_005(self, event): core.handle_005(self.events, event) + # RPL_MYINFO + @utils.hook("raw.received.004") + def handle_004(self, event): + core.handle_004(event) + # whois respose (nickname, username, realname, hostname) @utils.hook("raw.received.311", default_event=True) def handle_311(self, event): diff --git a/modules/line_handler/core.py b/modules/line_handler/core.py index cf795ed6..676b9105 100644 --- a/modules/line_handler/core.py +++ b/modules/line_handler/core.py @@ -55,6 +55,9 @@ def handle_005(events, event): events.on("received.005").call(isupport=isupport, server=event["server"]) +def handle_004(event): + event["server"].version = event["args"][2] + def motd_start(event): event["server"].motd_lines.clear() def motd_line(event): diff --git a/src/IRCServer.py b/src/IRCServer.py index 01010fce..c21f5110 100644 --- a/src/IRCServer.py +++ b/src/IRCServer.py @@ -18,6 +18,7 @@ class Server(IRCObject.Object): self.alias = alias self.connection_params = connection_params self.name = None # type: typing.Optional[str] + self.version = None # type: typing.Optional[str] self.nickname = None # type: typing.Optional[str] self.username = None # type: typing.Optional[str]