~ubuntu-branches/ubuntu/vivid/psi/vivid

« back to all changes in this revision

Viewing changes to src/capabilities/capsmanager.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2008-08-28 18:46:52 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080828184652-iiik12dl91nq7cdi
Tags: 0.12-2
Uploading to unstable (Closes: Bug#494352)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * capsmanager.h
 
3
 * Copyright (C) 2006  Remko Troncon
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU General Public License
 
7
 * as published by the Free Software Foundation; either version 2
 
8
 * of the License, or (at your option) any later version.
 
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 library; if not, write to the Free Software
 
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
 *
 
19
 */
 
20
 
 
21
#ifndef CAPSMANAGER_H
 
22
#define CAPSMANAGER_H
 
23
 
 
24
#include <QMap>
 
25
#include <QList>
 
26
#include <QString>
 
27
#include <QObject>
 
28
#include <QPointer>
 
29
 
 
30
#include "protocol/discoinfoquerier.h"
 
31
#include "capsspec.h"
 
32
#include "capsregistry.h"
 
33
#include "xmpp_features.h"
 
34
 
 
35
namespace XMPP {
 
36
        class Jid;
 
37
}
 
38
using namespace XMPP;
 
39
 
 
40
class CapsManager : public QObject
 
41
{
 
42
        Q_OBJECT
 
43
 
 
44
public:
 
45
        CapsManager(const XMPP::Jid&, CapsRegistry* registry, Protocol::DiscoInfoQuerier* discoInfoQuerier);
 
46
        ~CapsManager();
 
47
 
 
48
        bool isEnabled();
 
49
        void setEnabled(bool);
 
50
 
 
51
        void updateCaps(const Jid& jid, const QString& node, const QString& ver, const QString& ext);
 
52
        void disableCaps(const Jid& jid);
 
53
        bool capsEnabled(const Jid& jid) const;
 
54
        XMPP::Features features(const Jid& jid) const;
 
55
        QString clientName(const Jid& jid) const;
 
56
        QString clientVersion(const Jid& jid) const;
 
57
        
 
58
signals:
 
59
        /**
 
60
         * This signal is emitted when the feature list of a given JID have changed.
 
61
         */
 
62
        void capsChanged(const Jid& jid);
 
63
 
 
64
protected:
 
65
        CapsSpec getCapsSpecForNode(const XMPP::Jid& jid, const QString& disco_node, bool& ok) const;
 
66
 
 
67
protected slots:
 
68
        void getDiscoInfo_success(const XMPP::Jid& jid, const QString& node, const XMPP::DiscoItem& item);
 
69
        void getDiscoInfo_error(const XMPP::Jid& jid, const QString& node, int error_code, const QString& error_string);
 
70
 
 
71
        void capsRegistered(const CapsSpec&);
 
72
 
 
73
private:
 
74
        XMPP::Jid jid_;
 
75
        QPointer<CapsRegistry> registry_;
 
76
        QPointer<Protocol::DiscoInfoQuerier> discoInfoQuerier_;
 
77
        bool isEnabled_;
 
78
        QMap<QString,CapsSpec> capsSpecs_;
 
79
        QMap<CapsSpec,QList<QString> > capsJids_;
 
80
};
 
81
 
 
82
 
 
83
#endif