From 980b79e30f5b3361e8cf964a8a371f7c778a8170 Mon Sep 17 00:00:00 2001 From: psychon Date: Fri, 8 Jan 2010 16:32:27 +0000 Subject: [PATCH] Move all of Timers.h into User.cpp Timers.h only contained CUserTimer and that one is only used in CUser. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1696 726aef4b-f618-498e-8847-2d620e286838 --- Client.cpp | 1 - Timers.h | 51 --------------------------------------------------- User.cpp | 36 +++++++++++++++++++++++++++++++++++- 3 files changed, 35 insertions(+), 53 deletions(-) delete mode 100644 Timers.h diff --git a/Client.cpp b/Client.cpp index ccc206ce..f0a109f6 100644 --- a/Client.cpp +++ b/Client.cpp @@ -10,7 +10,6 @@ #include "Chan.h" #include "DCCBounce.h" #include "IRCSock.h" -#include "Timers.h" #include "User.h" #include "znc.h" diff --git a/Timers.h b/Timers.h deleted file mode 100644 index 2f2ecaa3..00000000 --- a/Timers.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2004-2010 See the AUTHORS file for details. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#ifndef _TIMERS_H -#define _TIMERS_H - -#include "Client.h" -#include "IRCSock.h" -#include "User.h" - -class CUserTimer : public CCron { -public: - CUserTimer(CUser* pUser) : CCron() { - m_pUser = pUser; - SetName("CUserTimer::" + m_pUser->GetUserName()); - Start(30); - } - virtual ~CUserTimer() {} - -private: -protected: - virtual void RunJob() { - vector& vClients = m_pUser->GetClients(); - CIRCSock* pIRCSock = m_pUser->GetIRCSock(); - - if (pIRCSock && pIRCSock->GetTimeSinceLastDataTransaction() >= 180) { - pIRCSock->PutIRC("PING :ZNC"); - } - - for (size_t a = 0; a < vClients.size(); a++) { - CClient* pClient = vClients[a]; - - if (pClient->GetTimeSinceLastDataTransaction() >= 180) { - pClient->PutClient("PING :ZNC"); - } - } - - if (m_pUser->IsIRCConnected()) { - m_pUser->JoinChans(); - } - } - - CUser* m_pUser; -}; - -#endif // !_TIMERS_H diff --git a/User.cpp b/User.cpp index b451bd55..cea39dfa 100644 --- a/User.cpp +++ b/User.cpp @@ -11,9 +11,43 @@ #include "DCCSock.h" #include "IRCSock.h" #include "Server.h" -#include "Timers.h" #include "znc.h" +class CUserTimer : public CCron { +public: + CUserTimer(CUser* pUser) : CCron() { + m_pUser = pUser; + SetName("CUserTimer::" + m_pUser->GetUserName()); + Start(30); + } + virtual ~CUserTimer() {} + +private: +protected: + virtual void RunJob() { + vector& vClients = m_pUser->GetClients(); + CIRCSock* pIRCSock = m_pUser->GetIRCSock(); + + if (pIRCSock && pIRCSock->GetTimeSinceLastDataTransaction() >= 180) { + pIRCSock->PutIRC("PING :ZNC"); + } + + for (size_t a = 0; a < vClients.size(); a++) { + CClient* pClient = vClients[a]; + + if (pClient->GetTimeSinceLastDataTransaction() >= 180) { + pClient->PutClient("PING :ZNC"); + } + } + + if (m_pUser->IsIRCConnected()) { + m_pUser->JoinChans(); + } + } + + CUser* m_pUser; +}; + CUser::CUser(const CString& sUserName) { m_pIRCSock = NULL; m_fTimezoneOffset = 0;