2
Copyright (c) 2007 by Olivier Goffart <ogoffart@kde.org>
4
Kopete (c) 2007 by the Kopete developers <kopete-devel@kde.org>
6
*************************************************************************
8
* This program is free software; you can redistribute it and/or modify *
9
* it under the terms of the GNU General Public License as published by *
10
* the Free Software Foundation; either version 2 of the License, or *
11
* (at your option) any later version. *
13
*************************************************************************
16
#include "jt_privatestorage.h"
17
#include "xmpp_xmlcommon.h"
18
#include "xmpp_client.h"
24
//----------------------------------------------------------------------------
26
//----------------------------------------------------------------------------
27
class JT_PrivateStorage::Private
30
Private() : type(-1) {}
37
JT_PrivateStorage::JT_PrivateStorage(Task *parent)
38
:Task(parent), d(new Private())
42
JT_PrivateStorage::~JT_PrivateStorage()
47
void JT_PrivateStorage::get(const QString& tag, const QString& xmlns)
50
d->iq = createIQ(doc(), "get" , QString() , id() );
51
QDomElement query = doc()->createElement("query");
52
query.setAttribute("xmlns", "jabber:iq:private");
53
d->iq.appendChild(query);
54
QDomElement s = doc()->createElement(tag);
56
s.setAttribute("xmlns", xmlns);
60
void JT_PrivateStorage::set(const QDomElement& element)
64
QDomNode n=doc()->importNode(element,true);
66
d->iq = createIQ(doc(), "set" , QString() , id() );
67
QDomElement query = doc()->createElement("query");
68
query.setAttribute("xmlns", "jabber:iq:private");
69
d->iq.appendChild(query);
73
void JT_PrivateStorage::onGo()
78
bool JT_PrivateStorage::take(const QDomElement &x)
80
QString to = client()->host();
81
if(!iqVerify(x, to, id()))
84
if(x.attribute("type") == "result") {
86
QDomElement q = queryTag(x);
87
for(QDomNode n = q.firstChild(); !n.isNull(); n = n.nextSibling()) {
88
QDomElement i = n.toElement();
106
QDomElement JT_PrivateStorage::element( )
111
#include "jt_privatestorage.moc"