2 * Copyright (C) 2010 Rion
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #ifndef XMPP_BITSOFBINARY_H
21 #define XMPP_BITSOFBINARY_H
23 #include <QDomElement>
26 #include <QSharedDataPointer>
27 #include "xmpp/jid/jid.h"
31 class JT_BitsOfBinary
;
39 BoBData(const BoBData
&other
);
40 BoBData(const QDomElement
&);
42 BoBData
&operator=(const BoBData
&other
);
47 void setCid(const QString
&);
49 QByteArray
data() const;
50 void setData(const QByteArray
&);
53 void setType(const QString
&);
55 unsigned int maxAge() const;
56 void setMaxAge(unsigned int);
58 void fromXml(const QDomElement
&);
59 QDomElement
toXml(QDomDocument
*doc
) const;
62 QSharedDataPointer
<Private
> d
;
67 class BoBCache
: public QObject
72 BoBCache(QObject
*parent
);
73 virtual void put(const BoBData
&) = 0;
74 virtual BoBData
get(const QString
&) = 0;
79 class BoBManager
: public QObject
85 void setCache(BoBCache
*);
87 BoBData
bobData(const QString
&);
88 BoBData
makeBoBData(const QByteArray
&data
, const QString
&type
,
89 unsigned int maxAge
= 0);
90 QString
addLocalFile(const QString
&filename
,
91 const QString
&type
= "application/octet-stream");
93 void append(const BoBData
&);
97 QHash
<QString
, QPair
<QString
,QString
> > _localFiles
; //cid => (filename, mime)
102 #endif // XMPP_BITSOFBINARY_H