diff --git a/modules/notify_connect.cpp b/modules/notify_connect.cpp index b05177ff..c080e3ee 100644 --- a/modules/notify_connect.cpp +++ b/modules/notify_connect.cpp @@ -22,17 +22,28 @@ public: MODCONSTRUCTOR(CNotifyConnectMod) {} void OnClientLogin() override { - SendAdmins(GetUser()->GetUserName() + " attached (from " + GetClient()->GetRemoteIP() + ")"); + NotifyAdmins("attached"); } void OnClientDisconnect() override { - SendAdmins(GetUser()->GetUserName() + " detached (from " + GetClient()->GetRemoteIP() + ")"); + NotifyAdmins("detached"); } private: void SendAdmins(const CString &msg) { CZNC::Get().Broadcast(msg, true, nullptr, GetClient()); } + + void NotifyAdmins(const CString &event) { + CString client = GetUser()->GetUserName(); + if (GetClient()->GetIdentifier() != "") { + client += "@"; + client += GetClient()->GetIdentifier(); + } + CString ip = GetClient()->GetRemoteIP(); + + SendAdmins(client + " " + event + " (from " + ip + ")"); + } }; template<> void TModInfo(CModInfo& Info) {