+void CoreNetwork::setAutoWhoDelay(int delay) {
+ _autoWhoTimer.setInterval(delay * 1000);
+}
+
+void CoreNetwork::setAutoWhoInterval(int interval) {
+ _autoWhoCycleTimer.setInterval(interval * 1000);
+}
+
+void CoreNetwork::setAutoWhoEnabled(bool enabled) {
+ if(enabled && isConnected() && !_autoWhoTimer.isActive())
+ _autoWhoTimer.start();
+ else if(!enabled) {
+ _autoWhoTimer.stop();
+ _autoWhoCycleTimer.stop();
+ }
+}
+
+void CoreNetwork::sendAutoWho() {
+ // Don't send autowho if there are still some pending
+ if(_autoWhoPending.count())
+ return;
+
+ while(!_autoWhoQueue.isEmpty()) {
+ QString chan = _autoWhoQueue.takeFirst();
+ IrcChannel *ircchan = ircChannel(chan);
+ if(!ircchan) continue;
+ if(networkConfig()->autoWhoNickLimit() > 0 && ircchan->ircUsers().count() >= networkConfig()->autoWhoNickLimit())
+ continue;
+ _autoWhoPending[chan]++;
+ putRawLine("WHO " + serverEncode(chan));
+ break;
+ }
+ if(_autoWhoQueue.isEmpty() && networkConfig()->autoWhoEnabled() && !_autoWhoCycleTimer.isActive()) {
+ // Timer was stopped, means a new cycle is due immediately
+ _autoWhoCycleTimer.start();
+ startAutoWhoCycle();
+ }
+}
+