~ubuntu-branches/ubuntu/raring/quassel/raring-proposed

« back to all changes in this revision

Viewing changes to src/common/irclisthelper.h

  • Committer: Bazaar Package Importer
  • Author(s): Harald Sitter
  • Date: 2008-06-27 19:21:30 UTC
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20080627192130-kjsrutd8w40x5okn
Tags: upstream-0.2.0~rc1
ImportĀ upstreamĀ versionĀ 0.2.0~rc1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2005-08 by the Quassel Project                          *
 
3
 *   devel@quassel-irc.org                                                 *
 
4
 *                                                                         *
 
5
 *   This program is free software; you can redistribute it and/or modify  *
 
6
 *   it under the terms of the GNU General Public License as published by  *
 
7
 *   the Free Software Foundation; either version 2 of the License, or     *
 
8
 *   (at your option) version 3.                                           *
 
9
 *                                                                         *
 
10
 *   This program is distributed in the hope that it will be useful,       *
 
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
13
 *   GNU General Public License for more details.                          *
 
14
 *                                                                         *
 
15
 *   You should have received a copy of the GNU General Public License     *
 
16
 *   along with this program; if not, write to the                         *
 
17
 *   Free Software Foundation, Inc.,                                       *
 
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 
19
 ***************************************************************************/
 
20
 
 
21
#ifndef IRCLISTHELPER_H
 
22
#define IRCLISTHELPER_H
 
23
 
 
24
#include "syncableobject.h"
 
25
#include "types.h"
 
26
 
 
27
/*
 
28
 * This is a little helper to display channel lists of a network.
 
29
 * The whole process is done in 3 steps:
 
30
 *  1.) the client requests to issue a LIST command with requestChannelList()
 
31
 *  2.) RPL_LIST fills on the core the list of available channels
 
32
 *      when RPL_LISTEND is received the clients will be informed, that they can pull the data
 
33
 *  3.) client pulls the data by calling requestChannelList again. receiving the data in receiveChannelList
 
34
 */
 
35
class IrcListHelper : public SyncableObject {
 
36
  Q_OBJECT
 
37
 
 
38
public:
 
39
  inline IrcListHelper(QObject *parent = 0) : SyncableObject(parent) {};
 
40
 
 
41
  struct ChannelDescription {
 
42
    QString channelName;
 
43
    quint32 userCount;
 
44
    QString topic;
 
45
    ChannelDescription(const QString &channelName_, quint32 userCount_, const QString &topic_) : channelName(channelName_), userCount(userCount_), topic(topic_) {};
 
46
  };
 
47
 
 
48
public slots:
 
49
  inline virtual QVariantList requestChannelList(const NetworkId &netId, const QStringList &channelFilters) { emit channelListRequested(netId, channelFilters); return QVariantList(); }
 
50
  inline virtual void receiveChannelList(const NetworkId &, const QStringList &, const QVariantList &) {};
 
51
  inline virtual void reportFinishedList(const NetworkId &netId) { emit finishedListReported(netId); }
 
52
 
 
53
signals:
 
54
  void channelListRequested(const NetworkId &netId, const QStringList &channelFilters);
 
55
  void finishedListReported(const NetworkId &netId);
 
56
};
 
57
 
 
58
#endif //IRCLISTHELPER_H