projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
modernize: Replace most remaining old-style connects by PMF ones
[quassel.git]
/
src
/
core
/
coreirclisthelper.cpp
diff --git
a/src/core/coreirclisthelper.cpp
b/src/core/coreirclisthelper.cpp
index
5b0ef23
..
9ff68fa
100644
(file)
--- a/
src/core/coreirclisthelper.cpp
+++ b/
src/core/coreirclisthelper.cpp
@@
-1,5
+1,5
@@
/***************************************************************************
/***************************************************************************
- * Copyright (C) 2005-
09 by the Quassel Project
*
+ * Copyright (C) 2005-
2018 by the Quassel Project
*
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
@@
-15,7
+15,7
@@
* 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., *
* 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., *
- * 5
9 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
+ * 5
1 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
***************************************************************************/
#include "coreirclisthelper.h"
***************************************************************************/
#include "coreirclisthelper.h"
@@
-23,7
+23,8
@@
#include "corenetwork.h"
#include "coreuserinputhandler.h"
#include "corenetwork.h"
#include "coreuserinputhandler.h"
-INIT_SYNCABLE_OBJECT(CoreIrcListHelper)
+constexpr auto kTimeoutMs = 5000;
+
QVariantList CoreIrcListHelper::requestChannelList(const NetworkId &netId, const QStringList &channelFilters)
{
if (_finishedChannelLists.contains(netId))
QVariantList CoreIrcListHelper::requestChannelList(const NetworkId &netId, const QStringList &channelFilters)
{
if (_finishedChannelLists.contains(netId))
@@
-45,6
+46,9
@@
bool CoreIrcListHelper::addChannel(const NetworkId &netId, const QString &channe
return false;
_channelLists[netId] << ChannelDescription(channelName, userCount, topic);
return false;
_channelLists[netId] << ChannelDescription(channelName, userCount, topic);
+ if (_queryTimeoutByNetId.contains(netId))
+ _queryTimeoutByNetId[netId]->start(kTimeoutMs, this);
+
return true;
}
return true;
}
@@
-55,7
+59,12
@@
bool CoreIrcListHelper::dispatchQuery(const NetworkId &netId, const QString &que
if (network) {
_channelLists[netId] = QList<ChannelDescription>();
network->userInputHandler()->handleList(BufferInfo(), query);
if (network) {
_channelLists[netId] = QList<ChannelDescription>();
network->userInputHandler()->handleList(BufferInfo(), query);
- _queryTimeout[startTimer(10000)] = netId;
+
+ auto timer = std::make_shared<QBasicTimer>();
+ timer->start(kTimeoutMs, this);
+ _queryTimeoutByNetId[netId] = timer;
+ _queryTimeoutByTimerId[timer->timerId()] = netId;
+
return true;
}
else {
return true;
}
else {
@@
-66,6
+75,12
@@
bool CoreIrcListHelper::dispatchQuery(const NetworkId &netId, const QString &que
bool CoreIrcListHelper::endOfChannelList(const NetworkId &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));
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));
@@
-92,8
+107,14
@@
bool CoreIrcListHelper::endOfChannelList(const NetworkId &netId)
void CoreIrcListHelper::timerEvent(QTimerEvent *event)
{
void CoreIrcListHelper::timerEvent(QTimerEvent *event)
{
- int timerId = event->timerId();
- killTimer(timerId);
- NetworkId netId = _queryTimeout.take(timerId);
+ if (!_queryTimeoutByTimerId.contains(event->timerId())) {
+ IrcListHelper::timerEvent(event);
+ return;
+ }
+
+ NetworkId netId = _queryTimeoutByTimerId.take(event->timerId());
+ _queryTimeoutByNetId.remove(netId);
+
+ event->accept();
endOfChannelList(netId);
}
endOfChannelList(netId);
}