~ubuntu-branches/ubuntu/quantal/znc/quantal-backports

« back to all changes in this revision

Viewing changes to modules/extra/notify_connect.cpp

  • Committer: Package Import Robot
  • Author(s): Micah Gersten
  • Date: 2013-01-01 19:39:47 UTC
  • mfrom: (21.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20130101193947-zlqyse3v2mjxnhvw
Tags: 1.0-2~ubuntu12.10.1
No-change backport to quantal (LP: #1085731)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2004-2011  See the AUTHORS file for details.
3
 
 *
4
 
 * This program is free software; you can redistribute it and/or modify it
5
 
 * under the terms of the GNU General Public License version 2 as published
6
 
 * by the Free Software Foundation.
7
 
 */
8
 
 
9
 
#include "znc.h"
10
 
#include "User.h"
11
 
 
12
 
class CNotifyConnectMod : public CGlobalModule {
13
 
public:
14
 
        GLOBALMODCONSTRUCTOR(CNotifyConnectMod) {}
15
 
 
16
 
        virtual void OnClientLogin() {
17
 
                SendAdmins(m_pUser->GetUserName() + " attached (from " + m_pClient->GetRemoteIP() + ")");
18
 
        }
19
 
 
20
 
        virtual void OnClientDisconnect() {
21
 
                SendAdmins(m_pUser->GetUserName() + " detached (gone: " + m_pClient->GetRemoteIP() + ")");
22
 
        }
23
 
 
24
 
private:
25
 
        void SendAdmins(const CString &msg) {
26
 
                CZNC::Get().Broadcast(msg, true, NULL, GetClient());
27
 
        }
28
 
};
29
 
 
30
 
GLOBALMODULEDEFS(CNotifyConnectMod, "Notifies all admin users when a client connects or disconnects.")