-void CoreIrcListHelper::timerEvent(QTimerEvent *event) {
- int timerId = event->timerId();
- killTimer(timerId);
- NetworkId netId = _queryTimeout.take(timerId);
- endOfChannelList(netId);
+
+bool CoreIrcListHelper::endOfChannelList(const NetworkId &netId)
+{
+ if (_queryTimeoutByNetId.contains(netId)) {
+ // If we recieved an actual RPL_LISTEND, remove the timer
+ int timerId = _queryTimeoutByNetId.take(netId)->timerId();
+ _queryTimeoutByTimerId.remove(timerId);
+ }
+
+ if (_queuedQuery.contains(netId)) {
+ // we're no longer interessted in the current data. drop it and issue a new request.
+ return dispatchQuery(netId, _queuedQuery.take(netId));
+ }
+ else if (_channelLists.contains(netId)) {
+ QVariantList channelList;
+ foreach(ChannelDescription channel, _channelLists[netId]) {
+ QVariantList channelVariant;
+ channelVariant << channel.channelName
+ << channel.userCount
+ << channel.topic;
+ channelList << qVariantFromValue<QVariant>(channelVariant);
+ }
+ _finishedChannelLists[netId] = channelList;
+ _channelLists.remove(netId);
+ reportFinishedList(netId);
+ return true;
+ }
+ else {
+ return false;
+ }
+}
+
+
+void CoreIrcListHelper::timerEvent(QTimerEvent *event)
+{
+ if (!_queryTimeoutByTimerId.contains(event->timerId())) {
+ IrcListHelper::timerEvent(event);
+ return;
+ }
+
+ NetworkId netId = _queryTimeoutByTimerId.take(event->timerId());
+ _queryTimeoutByNetId.remove(netId);
+
+ event->accept();
+ endOfChannelList(netId);