Show client identification in notify_connect module

This commit is contained in:
Oleh Prypin
2015-11-26 17:00:30 +02:00
parent b7aff7f7ea
commit facec8d4a3

View File

@@ -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<CNotifyConnectMod>(CModInfo& Info) {