mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Show client identification in notify_connect module
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user