From e36c077346020f7a4313534f5b91bec7cff1684b Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 19 Jan 2023 13:55:45 +0000 Subject: Log the versions of third-party libraries used by modules. --- src/modules/extra/m_pgsql.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/modules/extra/m_pgsql.cpp') diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index 99bd0ed79..fc4ec23c1 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -37,6 +37,7 @@ #include +#include #include "inspircd.h" #include "modules/sql.h" @@ -575,6 +576,21 @@ public: ClearAllConnections(); } + void init() override + { + int version = PQlibVersion(); + int minor = version / 100 % 100; + int revision = version % 100; + if (version >= 10'00'00) + { + // Ref: https://www.postgresql.org/docs/current/libpq-misc.html#LIBPQ-PQLIBVERSION + minor = revision; + revision = 0; + } + ServerInstance->Logs.Normal(MODNAME, "Module was compiled against libpq version %s and is running against version %d.%d.%d", + PG_VERSION, version / 10000, minor, revision); + } + void ReadConfig(ConfigStatus& status) override { ReadConf(); -- cgit v1.3.1-10-gc9f91