adding server lag indicator to the network tooltip
[quassel.git] / src / core / networkconnection.cpp
index f5e6a36..6768095 100644 (file)
@@ -64,7 +64,10 @@ NetworkConnection::NetworkConnection(Network *network, CoreSession *session)
   _autoReconnectTimer.setSingleShot(true);
   _socketCloseTimer.setSingleShot(true);
   connect(&_socketCloseTimer, SIGNAL(timeout()), this, SLOT(socketCloseTimeout()));
-  
+
+  _pingTimer.setInterval(60000);
+  connect(&_pingTimer, SIGNAL(timeout()), this, SLOT(sendPing()));
+
   _autoWhoTimer.setInterval(_autoWhoDelay * 1000);
   _autoWhoCycleTimer.setInterval(_autoWhoInterval * 1000);
   
@@ -215,6 +218,8 @@ void NetworkConnection::networkInitialized(const QString &currentServer) {
   network()->setConnected(true);
   emit connected(networkId());
 
+  _pingTimer.start();
+
   if(_autoWhoEnabled) {
     _autoWhoCycleTimer.start();
     _autoWhoTimer.start();
@@ -502,6 +507,10 @@ void NetworkConnection::putCmd(const QString &cmd, const QList<QByteArray> &para
   putRawLine(msg);
 }
 
+void NetworkConnection::sendPing() {
+  userInputHandler()->handlePing(BufferInfo(), QString());
+}
+
 void NetworkConnection::sendAutoWho() {
   while(!_autoWhoQueue.isEmpty()) {
     QString chan = _autoWhoQueue.takeFirst();