summaryrefslogtreecommitdiffstats
path: root/src/kvirc/kernel/kvi_lagmeter.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-24 02:13:59 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-24 02:13:59 +0000
commita6d58bb6052ac8cb01805a48c4ad2f129126116f (patch)
treedd867a099fcbb263a8009a9fb22695b87855dad6 /src/kvirc/kernel/kvi_lagmeter.h
downloadkvirc-a6d58bb6052ac8cb01805a48c4ad2f129126116f.tar.gz
kvirc-a6d58bb6052ac8cb01805a48c4ad2f129126116f.zip
Added KDE3 version of kvirc
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvirc@1095341 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/kvirc/kernel/kvi_lagmeter.h')
-rw-r--r--src/kvirc/kernel/kvi_lagmeter.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/kvirc/kernel/kvi_lagmeter.h b/src/kvirc/kernel/kvi_lagmeter.h
new file mode 100644
index 0000000..6fb68ae
--- /dev/null
+++ b/src/kvirc/kernel/kvi_lagmeter.h
@@ -0,0 +1,74 @@
+#ifndef _KVI_LAGMETER_H_
+#define _KVI_LAGMETER_H_
+//=============================================================================
+//
+// File : kvi_lagmeter.h
+// Creation date : Fri Oct 18 13:30:26 CEST 2002 by Juanjo Álvarez
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 1999-2002 Szymon Stefanek (pragma at kvirc dot net)
+//
+// This program is FREE software. You can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//=============================================================================
+
+#include "kvi_settings.h"
+#include "kvi_string.h"
+#include "kvi_pointerlist.h"
+
+#include <qobject.h>
+
+class KviIrcConnection;
+
+class KviLagCheck
+{
+public:
+ KviStr szKey;
+ long lSecs; // since epoch
+ long lUSecs;
+ unsigned int uReliability; // [0-100]
+};
+
+class KVIRC_API KviLagMeter : public QObject
+{
+ Q_OBJECT
+ friend class KviIrcConnection;
+protected:
+ KviLagMeter(KviIrcConnection * c);
+ ~KviLagMeter();
+protected:
+ KviIrcConnection * m_pConnection;
+ unsigned int m_uLag; // last computed lag
+ unsigned int m_uLastEmittedLag; // last emitted lag
+ long m_tLastCompleted; // time when the last lag was completed (gettimeofday!)
+ unsigned int m_uLastReliability; // how much reliable was the last completed check ?
+ KviPointerList<KviLagCheck> * m_pCheckList;
+ long m_tFirstOwnCheck; // time when the first ping after a completed check was sent
+ long m_tLastOwnCheck; // time when the last ping was sent
+ bool m_bOnAlarm;
+ bool * m_pDeletionSignal; // we use this to signal our own delete
+public:
+ // lag checks should be done only against the user's server
+ // please make SURE that the key is unique!
+ void lagCheckRegister(const char * key,unsigned int uReliability = 50);
+ bool lagCheckComplete(const char * key);
+ void lagCheckAbort(const char * key);
+ unsigned int lag(){ return m_uLag; };
+ unsigned int secondsSinceLastCompleted();
+protected:
+ virtual void timerEvent(QTimerEvent * e);
+};
+
+#endif // _KVI_LAGMETER_H_