The Channel Browser is currently only via contextmenu of the networks accessible.
Some minor fixes.
Conflicts:
src/client/client.cpp
src/client/client.pri
src/qtui/CMakeLists.txt
src/qtui/mainwin.cpp
src/qtui/qtui.pri
buffersettings.cpp
client.cpp
clientbacklogmanager.cpp
+ clientirclisthelper.cpp
clientsettings.cpp
clientsyncer.cpp
+ irclistmodel.cpp
mappedselectionmodel.cpp
networkmodel.cpp
selectionmodelsynchronizer.cpp
buffermodel.h
client.h
clientbacklogmanager.h
+ clientirclisthelper.h
clientsyncer.h
+ irclistmodel.h
networkmodel.h
mappedselectionmodel.h
quasselui.h
#include "buffersyncer.h"
#include "bufferviewmanager.h"
#include "clientbacklogmanager.h"
+#include "clientirclisthelper.h"
#include "global.h"
#include "identity.h"
#include "ircchannel.h"
_backlogManager(new ClientBacklogManager(this)),
_bufferViewManager(0),
_messageModel(0),
+ _ircListHelper(new ClientIrcListHelper(this)),
_connectedToCore(false),
_syncedToCore(false)
{
_monitorBuffer = new Buffer(BufferInfo(), this);
+ _signalProxy->synchronize(_ircListHelper);
+
connect(_backlogManager, SIGNAL(backlog(BufferId, const QVariantList &)),
this, SLOT(receiveBacklog(BufferId, const QVariantList &)));
}
class BufferModel;
class BufferSyncer;
class ClientBacklogManager;
+class ClientIrcListHelper;
class BufferViewManager;
class IrcUser;
class IrcChannel;
static inline SignalProxy *signalProxy() { return instance()->_signalProxy; }
static inline ClientBacklogManager *backlogManager() { return instance()->_backlogManager; }
+ static inline ClientIrcListHelper *ircListHelper() { return instance()->_ircListHelper; }
static inline BufferViewManager *bufferViewManager() { return instance()->_bufferViewManager; }
static AccountId currentCoreAccount();
BufferSyncer * _bufferSyncer;
ClientBacklogManager *_backlogManager;
BufferViewManager *_bufferViewManager;
+ ClientIrcListHelper *_ircListHelper;
MessageModel *_messageModel;
DEPMOD = common
QT_MOD = core network gui
-SRCS += buffer.cpp buffersettings.cpp clientbacklogmanager.cpp treemodel.cpp networkmodel.cpp buffermodel.cpp \
- client.cpp clientsettings.cpp clientsyncer.cpp mappedselectionmodel.cpp selectionmodelsynchronizer.cpp
-HDRS += buffer.h buffersettings.h clientbacklogmanager.h treemodel.h networkmodel.h buffermodel.h \
- client.h clientsettings.h clientsyncer.h quasselui.h mappedselectionmodel.h selectionmodelsynchronizer.h
+SRCS += buffer.cpp buffersettings.cpp clientbacklogmanager.cpp clientirclisthelper.cpp treemodel.cpp networkmodel.cpp buffermodel.cpp \
+ client.cpp clientsettings.cpp clientsyncer.cpp irclistmodel.cpp mappedselectionmodel.cpp selectionmodelsynchronizer.cpp
+HDRS += buffer.h buffersettings.h clientbacklogmanager.h clientirclisthelper.h treemodel.h networkmodel.h buffermodel.h \
+ client.h clientsettings.h clientsyncer.h quasselui.h irclistmodel.h mappedselectionmodel.h selectionmodelsynchronizer.h
sputdev {
SRCS += messagefilter.cpp messagemodel.cpp
HDRS += messagefilter.h messagemodel.h
}
-
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * 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., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "clientirclisthelper.h"
+
+#include <QStringList>
+
+#include "client.h"
+#include "irclistmodel.h"
+
+QVariantList ClientIrcListHelper::requestChannelList(const NetworkId &netId, const QStringList &channelFilters) {
+ _netId = netId;
+ return IrcListHelper::requestChannelList(netId, channelFilters);
+}
+
+void ClientIrcListHelper::receiveChannelList(const NetworkId &netId, const QStringList &channelFilters, const QVariantList &channels) {
+ QVariantList::const_iterator iter = channels.constBegin();
+ QVariantList::const_iterator iterEnd = channels.constEnd();
+
+ QList<ChannelDescription> channelList;
+ while(iter != iterEnd) {
+ QVariantList channelVar = iter->toList();
+ ChannelDescription channelDescription(channelVar[0].toString(), channelVar[1].toUInt(), channelVar[2].toString());
+ channelList << channelDescription;
+ iter++;
+ }
+
+ emit channelListReceived(netId, channelFilters, channelList);
+}
+
+void ClientIrcListHelper::reportFinishedList(const NetworkId &netId) {
+ if(_netId == netId) {
+ requestChannelList(netId, QStringList());
+ emit finishedListReported(netId);
+ }
+}
+
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * 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., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef CLIENTIRCLISTHELPER_H
+#define CLIENTIRCLISTHELPER_H
+
+#include "irclisthelper.h"
+
+class ClientIrcListHelper : public IrcListHelper {
+ Q_OBJECT
+
+public:
+ inline ClientIrcListHelper(QObject *object = 0) : IrcListHelper(object) {};
+
+ inline virtual const QMetaObject *syncMetaObject() const { return &IrcListHelper::staticMetaObject; }
+
+public slots:
+ virtual QVariantList requestChannelList(const NetworkId &netId, const QStringList &channelFilters);
+ virtual void receiveChannelList(const NetworkId &netId, const QStringList &channelFilters, const QVariantList &channels);
+ virtual void reportFinishedList(const NetworkId &netId);
+
+signals:
+ void channelListReceived(const NetworkId &netId, const QStringList &channelFilters, const QList<IrcListHelper::ChannelDescription> &channelList);
+
+private:
+ NetworkId _netId;
+};
+
+#endif //CLIENTIRCLISTHELPER_H
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * 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., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "irclistmodel.h"
+
+#include <QStringList>
+
+IrcListModel::IrcListModel(QObject *parent)
+ : QAbstractItemModel(parent)
+{
+}
+
+QVariant IrcListModel::data(const QModelIndex &index, int role) const {
+ if(!index.isValid() || index.row() >= rowCount() || index.column() >= columnCount() || role != Qt::DisplayRole)
+ return QVariant();
+
+ IrcListHelper::ChannelDescription channel = _channelList[index.row()];
+
+ switch(index.column()) {
+ case 0:
+ return channel.channelName;
+ case 1:
+ return channel.userCount;
+ case 2:
+ return channel.topic;
+ default:
+ return QVariant();
+ }
+}
+
+Qt::ItemFlags IrcListModel::flags(const QModelIndex &index) const {
+ if(!index.isValid()) {
+ return Qt::ItemIsDropEnabled;
+ } else {
+ return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
+ }
+}
+
+
+QVariant IrcListModel::headerData(int section, Qt::Orientation orientation, int role) const {
+ QStringList header;
+ header << tr("Channel")
+ << tr("Users")
+ << tr("Topic");
+
+ if(orientation == Qt::Horizontal && role == Qt::DisplayRole)
+ return header[section];
+
+ return QVariant();
+}
+
+QModelIndex IrcListModel::index(int row, int column, const QModelIndex &parent) const {
+ Q_UNUSED(parent);
+ if(row >= rowCount() || column >= columnCount())
+ return QModelIndex();
+
+ return createIndex(row, column);
+}
+
+void IrcListModel::setChannelList(const QList<IrcListHelper::ChannelDescription> &channelList) {
+ if(rowCount() > 0) {
+ beginRemoveRows(QModelIndex(), 0, _channelList.count() - 1);
+ _channelList.clear();
+ endRemoveRows();
+ }
+
+ if(channelList.count() > 0) {
+ beginInsertRows(QModelIndex(), 0, channelList.count() - 1);
+ _channelList = channelList;
+ endInsertRows();
+ }
+}
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * 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., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef IRCLISTMODEL_H
+#define IRCLISTMODEL_H
+
+#include "irclisthelper.h"
+
+#include <QAbstractItemModel>
+
+class IrcListModel : public QAbstractItemModel {
+ Q_OBJECT
+
+public:
+ IrcListModel(QObject *parent = 0);
+
+ virtual QVariant data(const QModelIndex &index, int role) const;
+ virtual Qt::ItemFlags flags(const QModelIndex &index) const;
+
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+
+ inline QModelIndex parent(const QModelIndex &) const { return QModelIndex(); }
+
+ inline int rowCount(const QModelIndex &parent = QModelIndex()) const { Q_UNUSED(parent) return _channelList.count(); }
+ inline int columnCount(const QModelIndex &parent = QModelIndex()) const { Q_UNUSED(parent) return 3; }
+
+public slots:
+ void setChannelList(const QList<IrcListHelper::ChannelDescription> &channelList = QList<IrcListHelper::ChannelDescription>());
+
+private:
+ QList<IrcListHelper::ChannelDescription> _channelList;
+};
+
+#endif //IRCLISTMODEL_H
bufferviewmanager.h
identity.h
ircchannel.h
+ irclisthelper.h
ircuser.h
logger.h
network.h
public slots:
virtual QVariantList requestBacklog(BufferId bufferId, int lastMsgs = -1, int offset = -1);
- virtual void receiveBacklog(BufferId, int, int, QVariantList) {};
+ inline virtual void receiveBacklog(BufferId, int, int, QVariantList) {};
signals:
void backlogRequested(BufferId, int, int);
{
}
+BufferInfo BufferInfo::fakeStatusBuffer(NetworkId networkId) {
+ return BufferInfo(0, networkId, StatusBuffer);
+}
+
QString BufferInfo::bufferName() const {
if(isChannelName(_bufferName))
return _bufferName;
BufferInfo();
BufferInfo(BufferId id, NetworkId networkid, Type type, uint gid = 0, QString buf = QString());
+ static BufferInfo fakeStatusBuffer(NetworkId networkId);
+
inline bool isValid() const { return _bufferId != 0; }
inline BufferId bufferId() const { return _bufferId; }
inline NetworkId networkId() const { return _netid; }
logger.cpp message.cpp settings.cpp signalproxy.cpp syncableobject.cpp \
util.cpp network.cpp ircuser.cpp ircchannel.cpp
HDRS += backlogmanager.h bufferinfo.h buffersyncer.h bufferviewconfig.h bufferviewmanager.h global.h identity.h \
- logger.h message.h settings.h signalproxy.h syncableobject.h \
+ irclisthelper.h logger.h message.h settings.h signalproxy.h syncableobject.h \
util.h network.h ircuser.h ircchannel.h types.h
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * 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., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef IRCLISTHELPER_H
+#define IRCLISTHELPER_H
+
+#include "syncableobject.h"
+#include "types.h"
+
+/*
+ * This is a little helper to display channel lists of a network.
+ * The whole process is done in 3 steps:
+ * 1.) the client requests to issue a LIST command with requestChannelList()
+ * 2.) RPL_LIST fills on the core the list of available channels
+ * when RPL_LISTEND is received the clients will be informed, that they can pull the data
+ * 3.) client pulls the data by calling requestChannelList again. receiving the data in receiveChannelList
+ */
+class IrcListHelper : public SyncableObject {
+ Q_OBJECT
+
+public:
+ inline IrcListHelper(QObject *parent = 0) : SyncableObject(parent) {};
+
+ struct ChannelDescription {
+ QString channelName;
+ quint32 userCount;
+ QString topic;
+ ChannelDescription(const QString &channelName_, quint32 userCount_, const QString &topic_) : channelName(channelName_), userCount(userCount_), topic(topic_) {};
+ };
+
+public slots:
+ inline virtual QVariantList requestChannelList(const NetworkId &netId, const QStringList &channelFilters) { emit channelListRequested(netId, channelFilters); return QVariantList(); }
+ inline virtual void receiveChannelList(const NetworkId &, const QStringList &, const QVariantList &) {};
+ inline virtual void reportFinishedList(const NetworkId &netId) { emit finishedListReported(netId); }
+
+signals:
+ void channelListRequested(const NetworkId &netId, const QStringList &channelFilters);
+ void finishedListReported(const NetworkId &netId);
+};
+
+#endif //IRCLISTHELPER_H
corebacklogmanager.cpp
corebufferviewconfig.cpp
corebufferviewmanager.cpp
+ coreirclisthelper.cpp
corenetwork.cpp
coresession.cpp
coresettings.cpp
corebacklogmanager.h
corebufferviewconfig.h
corebufferviewmanager.h
+ coreirclisthelper.h
corenetwork.h
coresession.h
ctcphandler.h
#include <QMetaMethod>
#include "util.h"
-#include "networkconnection.h"
BasicHandler::BasicHandler(NetworkConnection *parent)
: QObject(parent),
// ====================
// protected:
// ====================
-
-Network *BasicHandler::network() const {
- return networkConnection()->network();
-}
-
-NetworkConnection *BasicHandler::networkConnection() const {
- return _networkConnection;
-}
-
BufferInfo::Type BasicHandler::typeByTarget(const QString &target) const {
if(target.isEmpty())
return BufferInfo::StatusBuffer;
#include "message.h"
-class NetworkConnection;
-class Network;
+#include "networkconnection.h"
class BasicHandler : public QObject {
Q_OBJECT
QGenericArgument val7 = QGenericArgument(), QGenericArgument val8 = QGenericArgument());
- Network * network() const;
- NetworkConnection * networkConnection() const;
+ inline Network *network() const { return _networkConnection->network(); }
+ inline NetworkConnection *networkConnection() const { return _networkConnection; }
+
BufferInfo::Type typeByTarget(const QString &target) const;
private:
DEPMOD = common
QT_MOD = core network sql script
-SRCS = core.cpp corebacklogmanager.cpp corebufferviewconfig.cpp corebufferviewmanager.cpp corenetwork.cpp coresession.cpp coresettings.cpp networkconnection.cpp sqlitestorage.cpp abstractsqlstorage.cpp storage.cpp basichandler.cpp \
+SRCS = core.cpp corebacklogmanager.cpp corebufferviewconfig.cpp corebufferviewmanager.cpp coreirclisthelper.cpp corenetwork.cpp coresession.cpp coresettings.cpp networkconnection.cpp sqlitestorage.cpp abstractsqlstorage.cpp storage.cpp basichandler.cpp \
ircserverhandler.cpp userinputhandler.cpp ctcphandler.cpp coreusersettings.cpp sessionthread.cpp
-HDRS = core.h corebacklogmanager.h corebufferviewconfig.h corebufferviewmanager.h corenetwork.h coresession.h coresettings.h networkconnection.h sqlitestorage.h abstractsqlstorage.h storage.h basichandler.h \
+HDRS = core.h corebacklogmanager.h corebufferviewconfig.h corebufferviewmanager.h coreirclisthelper.h corenetwork.h coresession.h coresettings.h networkconnection.h sqlitestorage.h abstractsqlstorage.h storage.h basichandler.h \
ircserverhandler.h userinputhandler.h ctcphandler.h coreusersettings.h sessionthread.h
contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) {
public:
CoreBacklogManager(CoreSession *coreSession = 0);
- virtual const QMetaObject *syncMetaObject() const { return &BacklogManager::staticMetaObject; }
+ inline virtual const QMetaObject *syncMetaObject() const { return &BacklogManager::staticMetaObject; }
CoreSession *coreSession() { return _coreSession; }
CoreBufferViewConfig(int bufferViewId, QObject *parent = 0);
CoreBufferViewConfig(int bufferViewId, const QVariantMap &properties, QObject *parent = 0);
- virtual const QMetaObject *syncMetaObject() const { return &BufferViewConfig::staticMetaObject; }
+ inline virtual const QMetaObject *syncMetaObject() const { return &BufferViewConfig::staticMetaObject; }
public slots:
virtual inline void requestSetBufferViewName(const QString &bufferViewName) { setBufferViewName(bufferViewName); }
CoreBufferViewManager(SignalProxy *proxy, CoreSession *parent);
~CoreBufferViewManager();
- virtual const QMetaObject *syncMetaObject() const { return &BufferViewManager::staticMetaObject; }
+ inline virtual const QMetaObject *syncMetaObject() const { return &BufferViewManager::staticMetaObject; }
public slots:
virtual void requestCreateBufferView(const QVariantMap &properties);
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * 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., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "coreirclisthelper.h"
+
+#include "networkconnection.h"
+#include "userinputhandler.h"
+
+
+QVariantList CoreIrcListHelper::requestChannelList(const NetworkId &netId, const QStringList &channelFilters) {
+ if(_finishedChannelLists.contains(netId))
+ return _finishedChannelLists.take(netId);
+
+ if(_channelLists.contains(netId)) {
+ _queuedQuery[netId] = channelFilters.join(",");
+ } else {
+ _channelLists[netId] = QList<ChannelDescription>();
+
+ NetworkConnection *networkConnection = coreSession()->networkConnection(netId);
+ if(networkConnection)
+ networkConnection->userInputHandler()->handleList(BufferInfo(), channelFilters.join(","));
+ }
+
+ return QVariantList();
+}
+
+bool CoreIrcListHelper::addChannel(const NetworkId &netId, const QString &channelName, quint32 userCount, const QString &topic) {
+ if(!_channelLists.contains(netId))
+ return false;
+
+ _channelLists[netId] << ChannelDescription(channelName, userCount, topic);
+ return true;
+}
+
+bool CoreIrcListHelper::endOfChannelList(const NetworkId &netId) {
+ if(_queuedQuery.contains(netId)) {
+ // we're no longer interessted in the current data. drop it and issue a new request.
+ _channelLists[netId] = QList<ChannelDescription>();
+
+ NetworkConnection *networkConnection = coreSession()->networkConnection(netId);
+ if(networkConnection)
+ networkConnection->userInputHandler()->handleList(BufferInfo(), _queuedQuery[netId]);
+
+ _queuedQuery.remove(netId);
+ return true;
+ } 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;
+ }
+}
+
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * 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., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef COREIRCLISTHELPER_H
+#define COREIRCLISTHELPER_H
+
+#include "irclisthelper.h"
+
+#include "coresession.h"
+
+class CoreIrcListHelper : public IrcListHelper {
+ Q_OBJECT
+
+public:
+ inline CoreIrcListHelper(CoreSession *coreSession) : IrcListHelper(coreSession), _coreSession(coreSession) {};
+
+ inline virtual const QMetaObject *syncMetaObject() const { return &IrcListHelper::staticMetaObject; }
+
+ inline CoreSession *coreSession() const { return _coreSession; }
+
+public slots:
+ virtual QVariantList requestChannelList(const NetworkId &netId, const QStringList &channelFilters);
+ bool addChannel(const NetworkId &netId, const QString &channelName, quint32 userCount, const QString &topic);
+ bool endOfChannelList(const NetworkId &netId);
+
+private:
+ CoreSession *_coreSession;
+
+ QHash<NetworkId, QString> _queuedQuery;
+ QHash<NetworkId, QList<ChannelDescription> > _channelLists;
+ QHash<NetworkId, QVariantList> _finishedChannelLists;
+};
+
+#endif //COREIRCLISTHELPER_H
public:
CoreNetwork(const NetworkId &networkid, CoreSession *session);
- virtual const QMetaObject *syncMetaObject() const { return &Network::staticMetaObject; }
+ inline virtual const QMetaObject *syncMetaObject() const { return &Network::staticMetaObject; }
inline CoreSession *coreSession() const { return _coreSession; }
#include "buffersyncer.h"
#include "corebacklogmanager.h"
#include "corebufferviewmanager.h"
+#include "coreirclisthelper.h"
#include "storage.h"
#include "corenetwork.h"
_bufferSyncer(new BufferSyncer(this)),
_backlogManager(new CoreBacklogManager(this)),
_bufferViewManager(new CoreBufferViewManager(_signalProxy, this)),
+ _ircListHelper(new CoreIrcListHelper(this)),
scriptEngine(new QScriptEngine(this))
{
// init BacklogManager;
p->synchronize(_backlogManager);
-
+
+ // init IrcListHelper;
+ p->synchronize(ircListHelper());
+
// Restore session state
if(restoreState) restoreSessionState();
class BufferSyncer;
class CoreBacklogManager;
class CoreBufferViewManager;
+class CoreIrcListHelper;
class Identity;
class NetworkConnection;
class CoreNetwork;
SignalProxy *signalProxy() const;
+ inline CoreIrcListHelper *ircListHelper() const { return _ircListHelper; }
+
void attachNetworkConnection(NetworkConnection *conn);
//! Return necessary data for restoring the session after restarting the core
BufferSyncer *_bufferSyncer;
CoreBacklogManager *_backlogManager;
CoreBufferViewManager *_bufferViewManager;
+ CoreIrcListHelper *_ircListHelper;
QScriptEngine *scriptEngine;
#include "util.h"
#include "coresession.h"
+#include "coreirclisthelper.h"
#include "networkconnection.h"
#include "network.h"
#include "identity.h"
break;
}
// Ignore these commands.
- case 366: case 376:
+ case 321: case 366: case 376:
break;
// Everything else will be marked in red, so we can add them somewhere.
emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Whois] %1").arg(serverDecode(params).join(" ")));
}
+/* RPL_LIST - "<channel> <# visible> :<topic>" */
+void IrcServerHandler::handle322(const QString &prefix, const QList<QByteArray> ¶ms) {
+ Q_UNUSED(prefix)
+ QString channelName;
+ quint32 userCount = 0;
+ QString topic;
+
+ int paramCount = params.count();
+ switch(paramCount) {
+ case 3:
+ topic = serverDecode(params[2]);
+ case 2:
+ userCount = serverDecode(params[1]).toUInt();
+ case 1:
+ channelName = serverDecode(params[0]);
+ default:
+ break;
+ }
+ if(!networkConnection()->coreSession()->ircListHelper()->addChannel(network()->networkId(), channelName, userCount, topic))
+ emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("Channel %1 has %2 users. Topic is: %3").arg(channelName).arg(userCount).arg(topic));
+}
+
+/* RPL_LISTEND ":End of LIST" */
+void IrcServerHandler::handle323(const QString &prefix, const QList<QByteArray> ¶ms) {
+ Q_UNUSED(prefix)
+ Q_UNUSED(params)
+
+ if(!networkConnection()->coreSession()->ircListHelper()->endOfChannelList(network()->networkId()))
+ emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("End of channel list"));
+}
+
/* RPL_CHANNELMODEIS - "<channel> <mode> <mode params>" */
void IrcServerHandler::handle324(const QString &prefix, const QList<QByteArray> ¶ms) {
Q_UNUSED(prefix);
void handle318(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_ENDOFWHOIS
void handle319(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_WHOISCHANNELS
void handle320(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_WHOISVIRT (is identified to services)
+ void handle322(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_LIST
+ void handle323(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_LISTEND
void handle324(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_CHANNELMODEIS
void handle329(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_??? (channel creation time)
void handle331(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_NOTOPIC
set(SOURCES
aboutdlg.cpp
bufferwidget.cpp
+ channellistdlg.cpp
coreconfigwizard.cpp
coreconnectdlg.cpp
debugconsole.cpp
set(MOC_HDRS
aboutdlg.h
bufferwidget.h
+ channellistdlg.h
coreconfigwizard.h
coreconnectdlg.h
debugconsole.h
aboutdlg.ui
bufferviewwidget.ui
bufferwidget.ui
+ channellistdlg.ui
coreaccounteditdlg.ui
coreconfigwizardintropage.ui
coreconfigwizardadminuserpage.ui
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * 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., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "channellistdlg.h"
+
+#include "client.h"
+#include "clientirclisthelper.h"
+
+#include <QHeaderView>
+
+ChannelListDlg::ChannelListDlg(QWidget *parent)
+ : QDialog(parent),
+ _listFinished(true),
+ _ircListModel(this),
+ _sortFilter(this)
+{
+ _sortFilter.setSourceModel(&_ircListModel);
+ _sortFilter.setFilterCaseSensitivity(Qt::CaseInsensitive);
+ _sortFilter.setFilterKeyColumn(-1);
+
+ ui.setupUi(this);
+ ui.channelListView->setSelectionBehavior(QAbstractItemView::SelectRows);
+ ui.channelListView->setSelectionMode(QAbstractItemView::SingleSelection);
+ ui.channelListView->setAlternatingRowColors(true);
+ ui.channelListView->setTabKeyNavigation(false);
+ ui.channelListView->setModel(&_sortFilter);
+ ui.channelListView->setSortingEnabled(true);
+ ui.channelListView->verticalHeader()->hide();
+ ui.channelListView->horizontalHeader()->setStretchLastSection(true);
+
+ ui.searchChannelsButton->setAutoDefault(false);
+
+ connect(ui.searchChannelsButton, SIGNAL(clicked()), this, SLOT(requestSearch()));
+ connect(ui.channelNameLineEdit, SIGNAL(returnPressed()), this, SLOT(requestSearch()));
+ connect(ui.filterLineEdit, SIGNAL(textChanged(QString)), &_sortFilter, SLOT(setFilterFixedString(QString)));
+ connect(Client::ircListHelper(), SIGNAL(channelListReceived(const NetworkId &, const QStringList &, QList<IrcListHelper::ChannelDescription>)),
+ this, SLOT(receiveChannelList(NetworkId , QStringList, QList<IrcListHelper::ChannelDescription>)));
+ connect(Client::ircListHelper(), SIGNAL(finishedListReported(const NetworkId &)), this, SLOT(reportFinishedList()));
+ connect(ui.channelListView, SIGNAL(activated(QModelIndex)), this, SLOT(joinChannel(QModelIndex)));
+
+ enableQuery(true);
+ showFilterLine(false);
+}
+
+
+void ChannelListDlg::setNetwork(NetworkId netId) {
+ if(_netId == netId)
+ return;
+
+ _netId = netId;
+ _ircListModel.setChannelList();
+}
+
+void ChannelListDlg::requestSearch() {
+ _listFinished = false;
+ enableQuery(false);
+ QStringList channelFilters;
+ channelFilters << ui.channelNameLineEdit->text().trimmed();
+ Client::ircListHelper()->requestChannelList(_netId, channelFilters);
+}
+
+void ChannelListDlg::receiveChannelList(const NetworkId &netId, const QStringList &channelFilters, const QList<IrcListHelper::ChannelDescription> &channelList) {
+ Q_UNUSED(netId)
+ Q_UNUSED(channelFilters)
+
+ showFilterLine(!channelList.isEmpty());
+ _ircListModel.setChannelList(channelList);
+ enableQuery(_listFinished);
+}
+
+void ChannelListDlg::showFilterLine(bool show) {
+ ui.line->setVisible(show);
+ ui.filterLabel->setVisible(show);
+ ui.filterLineEdit->setVisible(show);
+}
+
+void ChannelListDlg::enableQuery(bool enable) {
+ ui.channelNameLineEdit->setEnabled(enable);
+ ui.searchChannelsButton->setEnabled(enable);
+}
+
+void ChannelListDlg::reportFinishedList() {
+ _listFinished = true;
+}
+
+
+void ChannelListDlg::joinChannel(const QModelIndex &index) {
+ Client::instance()->userInput(BufferInfo::fakeStatusBuffer(_netId), QString("/JOIN %1").arg(index.sibling(index.row(), 0).data().toString()));
+}
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * 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., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef CHANNELLISTDLG_H
+#define CHANNELLISTDLG_H
+
+#include "ui_channellistdlg.h"
+
+#include "irclisthelper.h"
+#include "irclistmodel.h"
+#include "types.h"
+
+#include <QSortFilterProxyModel>
+
+class ChannelListDlg : public QDialog {
+ Q_OBJECT
+
+public:
+ ChannelListDlg(QWidget *parent = 0);
+
+ void setNetwork(NetworkId netId);
+
+protected slots:
+ void requestSearch();
+ void receiveChannelList(const NetworkId &netId, const QStringList &channelFilters, const QList<IrcListHelper::ChannelDescription> &channelList);
+ void reportFinishedList();
+ void joinChannel(const QModelIndex &);
+
+private:
+ void showFilterLine(bool show);
+ void enableQuery(bool enable);
+
+ Ui::ChannelListDlg ui;
+
+ bool _listFinished;
+ NetworkId _netId;
+ IrcListModel _ircListModel;
+ QSortFilterProxyModel _sortFilter;
+};
+
+#endif //CHANNELLIST_H
#include "bufferviewconfig.h"
#include "bufferviewfilter.h"
#include "bufferviewmanager.h"
+#include "channellistdlg.h"
#include "client.h"
#include "clientbacklogmanager.h"
#include "coreconnectdlg.h"
#include "signalproxy.h"
#include "topicwidget.h"
#include "inputwidget.h"
+#include "irclistmodel.h"
#include "verticaldock.h"
#include "uisettings.h"
#include "qtuisettings.h"
offlineTrayIcon(":/icons/quassel-icon-offline.png"),
trayIconActive(false),
timer(new QTimer(this)),
+ channelListDlg(new ChannelListDlg(this)),
settingsDlg(new SettingsDlg(this)),
debugConsole(new DebugConsole(this))
{
view->setFilteredModel(Client::bufferModel(), config);
view->show();
+ connect(&view->showChannelList, SIGNAL(triggered()), this, SLOT(showChannelList()));
+
Client::bufferModel()->synchronizeView(view);
dock->setWidget(view);
//exit(1);
}
+void MainWin::showChannelList(NetworkId netId) {
+ if(!netId.isValid()) {
+ QAction *action = qobject_cast<QAction *>(sender());
+ if(action)
+ netId = action->data().value<NetworkId>();
+ }
+ channelListDlg->setNetwork(netId);
+ channelListDlg->show();
+}
+
void MainWin::showSettingsDlg() {
settingsDlg->show();
}
class ServerListDlg;
+class ChannelListDlg;
class CoreConnectDlg;
class Buffer;
class BufferViewConfig;
void addBufferView(int bufferViewConfigId);
void removeBufferView(int bufferViewConfigId);
void receiveMessage(const Message &msg);
+ void showChannelList(NetworkId netId = NetworkId());
void showSettingsDlg();
void showNetworkDlg();
void showManageViewsDlg();
QTimer *timer;
CoreConnectDlg *coreConnectDlg;
+ ChannelListDlg *channelListDlg;
SettingsDlg *settingsDlg;
DebugConsole *debugConsole;
DEPMOD = client common uisupport
QT_MOD = core gui network
-SRCS += aboutdlg.cpp bufferwidget.cpp chatline-old.cpp chatwidget.cpp \
+SRCS += aboutdlg.cpp bufferwidget.cpp channellistdlg.cpp chatline-old.cpp chatwidget.cpp \
coreconfigwizard.cpp coreconnectdlg.cpp debugconsole.cpp inputwidget.cpp \
mainwin.cpp nicklistwidget.cpp qtui.cpp qtuisettings.cpp qtuistyle.cpp settingsdlg.cpp settingspagedlg.cpp \
titlesetter.cpp topicbutton.cpp topicwidget.cpp verticaldock.cpp jumpkeyhandler.cpp
-HDRS += aboutdlg.h bufferwidget.h chatline-old.h chatwidget.h \
+HDRS += aboutdlg.h bufferwidget.h channellistdlg.h chatline-old.h chatwidget.h \
coreconfigwizard.h debugconsole.h inputwidget.h \
coreconnectdlg.h mainwin.h nicklistwidget.h qtui.h qtuisettings.h qtuistyle.h settingsdlg.h settingspagedlg.h \
titlesetter.h topicbutton.h topicwidget.h verticaldock.h jumpkeyhandler.h
HDRS -= chatline-old.h chatwidget.h
}
-FORMNAMES = aboutdlg.ui mainwin.ui coreaccounteditdlg.ui coreconnectdlg.ui bufferviewwidget.ui bufferwidget.ui nicklistwidget.ui settingsdlg.ui \
+FORMNAMES = aboutdlg.ui mainwin.ui channellistdlg.ui coreaccounteditdlg.ui coreconnectdlg.ui bufferviewwidget.ui bufferwidget.ui nicklistwidget.ui settingsdlg.ui \
settingspagedlg.ui topicwidget.ui debugconsole.ui inputwidget.ui \
coreconfigwizardintropage.ui coreconfigwizardadminuserpage.ui coreconfigwizardstorageselectionpage.ui coreconfigwizardsyncpage.ui
--- /dev/null
+<ui version="4.0" >
+ <class>ChannelListDlg</class>
+ <widget class="QDialog" name="ChannelListDlg" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>454</width>
+ <height>406</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Channel List</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout" >
+ <property name="spacing" >
+ <number>2</number>
+ </property>
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout" >
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <property name="leftMargin" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Search Pattern:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="channelNameLineEdit" />
+ </item>
+ <item>
+ <widget class="QPushButton" name="searchChannelsButton" >
+ <property name="text" >
+ <string>Search Channels</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2" >
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <property name="leftMargin" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="filterLabel" >
+ <property name="text" >
+ <string>Filter:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="filterLineEdit" />
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QTableView" name="channelListView" />
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
// to be on the safe side: call QTreeView's method aswell
BufferView::BufferView(QWidget *parent)
: QTreeView(parent),
+ showChannelList(tr("Show Channel List"), this),
_connectNetAction(tr("Connect"), this),
_disconnectNetAction(tr("Disconnect"), this),
_joinChannelAction(tr("Join Channel"), this),
switch(itemType) {
case NetworkModel::NetworkItemType:
+ showChannelList.setData(index.data(NetworkModel::NetworkIdRole));
_disconnectNetAction.setIcon(connectionStateIcon);
_connectNetAction.setIcon(connectionStateIcon);
+ addItemToMenu(showChannelList, contextMenu, index, ActiveState);
addItemToMenu(_disconnectNetAction, contextMenu, index, ActiveState);
addItemToMenu(_connectNetAction, contextMenu, index, InactiveState);
addSeparatorToMenu(contextMenu, index, ActiveState);
bool ok;
QString channelName = QInputDialog::getText(this, tr("Join Channel"), tr("Input channel name:"), QLineEdit::Normal, QString(), &ok);
if(ok && !channelName.isEmpty()) {
- BufferInfo bufferInfo = index.child(0,0).data(NetworkModel::BufferInfoRole).value<BufferInfo>();
- if(bufferInfo.isValid()) {
- Client::instance()->userInput(bufferInfo, QString("/J %1").arg(channelName));
- }
+ Client::instance()->userInput(BufferInfo::fakeStatusBuffer(index.data(NetworkModel::NetworkIdRole).value<NetworkId>()), QString("/J %1").arg(channelName));
+// BufferInfo bufferInfo = index.child(0,0).data(NetworkModel::BufferInfoRole).value<BufferInfo>();
+// if(bufferInfo.isValid()) {
+// Client::instance()->userInput(bufferInfo, QString("/J %1").arg(channelName));
+// }
}
#endif
return;
};
public:
Q_DECLARE_FLAGS(ItemActiveStates, ItemActiveState);
-
+ QAction showChannelList;
private:
QPointer<BufferViewConfig> _config;