From: Manuel Nickschas Date: Tue, 19 Feb 2008 23:30:24 +0000 (+0000) Subject: We now send WHO every 60 seconds for all channels we are in. This keeps the nicklist, X-Git-Tag: 0.2.0-alpha1~20 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=c0bbc724cda7acf652d9d2ce80605ebb53c4a2ff We now send WHO every 60 seconds for all channels we are in. This keeps the nicklist, especially the away status, current. Temporarily RPL_WHO output is completely disabled to not spam the status buffer. We need to find a way to distinguish auto queries from user-generated ones... Also made the networkmodel aware of away status changes in IrcUser. --- diff --git a/src/client/networkmodel.cpp b/src/client/networkmodel.cpp index 05340a36..e96e3678 100644 --- a/src/client/networkmodel.cpp +++ b/src/client/networkmodel.cpp @@ -484,6 +484,8 @@ IrcUserItem::IrcUserItem(IrcUser *ircUser, AbstractTreeItem *parent) connect(ircUser, SIGNAL(nickSet(QString)), this, SLOT(setNick(QString))); + connect(ircUser, SIGNAL(awaySet(bool)), + this, SLOT(setAway(bool))); } QString IrcUserItem::nickName() const { @@ -567,6 +569,11 @@ void IrcUserItem::setNick(QString newNick) { emit dataChanged(0); } +void IrcUserItem::setAway(bool away) { + Q_UNUSED(away); + emit dataChanged(0); +} + /***************************************** * NetworkModel *****************************************/ diff --git a/src/client/networkmodel.h b/src/client/networkmodel.h index 9cfc7b7a..6ac06f8e 100644 --- a/src/client/networkmodel.h +++ b/src/client/networkmodel.h @@ -182,9 +182,10 @@ public: virtual quint64 id() const; virtual QVariant data(int column, int role) const; virtual QString toolTip(int column) const; - + private slots: void setNick(QString newNick); + void setAway(bool); private: QPointer _ircUser; diff --git a/src/core/ircserverhandler.cpp b/src/core/ircserverhandler.cpp index 3b58903c..335bd3a5 100644 --- a/src/core/ircserverhandler.cpp +++ b/src/core/ircserverhandler.cpp @@ -463,7 +463,9 @@ void IrcServerHandler::handle314(const QString &prefix, const QList /* RPL_ENDOFWHO: " :End of WHO list" */ void IrcServerHandler::handle315(const QString &prefix, const QList ¶ms) { Q_UNUSED(prefix) - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Who] %1").arg(serverDecode(params).join(" "))); + // FIXME temporarily made silent + Q_UNUSED(params) + // emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Who] %1").arg(serverDecode(params).join(" "))); } /* RPL_WHOISIDLE - " :seconds idle" @@ -538,7 +540,8 @@ void IrcServerHandler::handle352(const QString &prefix, const QList ircuser->setRealName(serverDecode(params.last()).section(" ", 1)); } - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Who] %1").arg(serverDecode(params).join(" "))); + // FIXME temporarily made silent + //emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Who] %1").arg(serverDecode(params).join(" "))); } /* RPL_NAMREPLY */ diff --git a/src/core/networkconnection.cpp b/src/core/networkconnection.cpp index 651a1bea..e56bb933 100644 --- a/src/core/networkconnection.cpp +++ b/src/core/networkconnection.cpp @@ -46,7 +46,13 @@ NetworkConnection::NetworkConnection(Network *network, CoreSession *session) : Q _autoReconnectCount(0) { _autoReconnectTimer.setSingleShot(true); + + // TODO make configurable + _whoTimer.setInterval(60 * 1000); + _whoTimer.setSingleShot(false); + connect(&_autoReconnectTimer, SIGNAL(timeout()), this, SLOT(doAutoReconnect())); + connect(&_whoTimer, SIGNAL(timeout()), this, SLOT(sendWho())); connect(network, SIGNAL(currentServerSet(const QString &)), this, SLOT(networkInitialized(const QString &))); connect(network, SIGNAL(useAutoReconnectSet(bool)), this, SLOT(autoReconnectSettingsChanged())); @@ -204,7 +210,8 @@ void NetworkConnection::networkInitialized(const QString ¤tServer) { setConnectionState(Network::Initialized); network()->setConnected(true); emit connected(networkId()); - + sendWho(); + _whoTimer.start(); } void NetworkConnection::sendPerform() { @@ -294,6 +301,7 @@ void NetworkConnection::socketStateChanged(QAbstractSocket::SocketState socketSt } void NetworkConnection::socketDisconnected() { + _whoTimer.stop(); network()->setConnected(false); emit disconnected(networkId()); if(_autoReconnectCount == 0) emit quitRequested(networkId()); @@ -338,6 +346,12 @@ void NetworkConnection::putCmd(const QString &cmd, const QVariantList ¶ms, c putRawLine(msg); } +void NetworkConnection::sendWho() { + foreach(QString chan, network()->channels()) { + putRawLine("WHO " + serverEncode(chan)); + } +} + void NetworkConnection::addChannelKey(const QString &channel, const QString &key) { if(key.isEmpty()) removeChannelKey(channel); else _channelKeys[channel] = key; diff --git a/src/core/networkconnection.h b/src/core/networkconnection.h index f9db5154..57fd9d25 100644 --- a/src/core/networkconnection.h +++ b/src/core/networkconnection.h @@ -95,6 +95,7 @@ private slots: void sendPerform(); void autoReconnectSettingsChanged(); void doAutoReconnect(); + void sendWho(); void nickChanged(const QString &newNick, const QString &oldNick); // this signal is inteded to rename query buffers in the storage backend signals: @@ -129,6 +130,7 @@ private: Network *_network; CoreSession *_coreSession; + BufferInfo _statusBufferInfo; IrcServerHandler *_ircServerHandler; UserInputHandler *_userInputHandler; @@ -138,6 +140,8 @@ private: QTimer _autoReconnectTimer; int _autoReconnectCount; + QTimer _whoTimer; + class ParseError : public Exception { public: ParseError(QString cmd, QString prefix, QStringList params);