Some tweaking of NotificationsSettingsPage
[quassel.git] / src / core / networkconnection.cpp
index f5e6a36..760dcb3 100644 (file)
@@ -29,7 +29,6 @@
 
 #include "ircchannel.h"
 #include "ircuser.h"
-#include "network.h"
 #include "identity.h"
 
 #include "ircserverhandler.h"
@@ -64,7 +63,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 +217,8 @@ void NetworkConnection::networkInitialized(const QString &currentServer) {
   network()->setConnected(true);
   emit connected(networkId());
 
+  _pingTimer.start();
+
   if(_autoWhoEnabled) {
     _autoWhoCycleTimer.start();
     _autoWhoTimer.start();
@@ -370,6 +374,7 @@ void NetworkConnection::socketCloseTimeout() {
 }
 
 void NetworkConnection::socketDisconnected() {
+  _pingTimer.stop();
   _autoWhoCycleTimer.stop();
   _autoWhoTimer.stop();
   _autoWhoQueue.clear();
@@ -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();