3
* Copyright (C) 2003 Justin Karneges
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) any later version.
10
* This library 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 GNU
13
* Lesser General Public License for more details.
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
#include "xmpp_discoitem.h"
25
class DiscoItem::Private
39
Identities identities;
42
DiscoItem::DiscoItem()
47
DiscoItem::DiscoItem(const DiscoItem &from)
53
DiscoItem & DiscoItem::operator= (const DiscoItem &from)
56
d->name = from.d->name;
57
d->node = from.d->node;
58
d->action = from.d->action;
59
d->features = from.d->features;
60
d->identities = from.d->identities;
65
DiscoItem::~DiscoItem()
70
AgentItem DiscoItem::toAgentItem() const
78
if ( !identities().isEmpty() )
79
id = identities().first();
81
ai.setCategory( id.category );
82
ai.setType( id.type );
84
ai.setFeatures( d->features );
89
void DiscoItem::fromAgentItem(const AgentItem &ai)
95
id.category = ai.category();
102
setIdentities( idList );
104
setFeatures( ai.features() );
107
const Jid &DiscoItem::jid() const
112
void DiscoItem::setJid(const Jid &j)
117
const QString &DiscoItem::name() const
122
void DiscoItem::setName(const QString &n)
127
const QString &DiscoItem::node() const
132
void DiscoItem::setNode(const QString &n)
137
DiscoItem::Action DiscoItem::action() const
142
void DiscoItem::setAction(Action a)
147
const Features &DiscoItem::features() const
152
void DiscoItem::setFeatures(const Features &f)
157
const DiscoItem::Identities &DiscoItem::identities() const
159
return d->identities;
162
void DiscoItem::setIdentities(const Identities &i)
166
if ( name().isEmpty() && i.count() )
167
setName( i.first().name );
171
DiscoItem::Action DiscoItem::string2action(QString s)
177
else if ( s == "remove" )
185
QString DiscoItem::action2string(Action a)
191
else if ( a == Remove )