diff options
| author | Jeremy Lainé <jeremy.laine@wifirst.fr> | 2012-09-11 07:58:27 +0200 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@wifirst.fr> | 2012-09-11 07:58:27 +0200 |
| commit | a2ec42b2376ad949d2aad121ae8b4376dc613d80 (patch) | |
| tree | 5fe20ebf47e1e53ce4b5facd3cacb2162509fb5e /src/client/QXmppTransferManager.cpp | |
| parent | 7aaa28a56371590ac4e23c6c8c4f4f2b823cacfb (diff) | |
| parent | 67a3e2c205d340b9accd4746cc1367e1408c3b8f (diff) | |
| download | qxmpp-a2ec42b2376ad949d2aad121ae8b4376dc613d80.tar.gz | |
Merge branch 'master' of https://code.google.com/p/qxmpp
Diffstat (limited to 'src/client/QXmppTransferManager.cpp')
| -rw-r--r-- | src/client/QXmppTransferManager.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/client/QXmppTransferManager.cpp b/src/client/QXmppTransferManager.cpp index 20905a02..44fbe72c 100644 --- a/src/client/QXmppTransferManager.cpp +++ b/src/client/QXmppTransferManager.cpp @@ -61,6 +61,7 @@ public: QDateTime date; QByteArray hash; QString name; + QString description; qint64 size; }; @@ -113,6 +114,16 @@ void QXmppTransferFileInfo::setName(const QString &name) d->name = name; } +QString QXmppTransferFileInfo::description() const +{ + return d->description; +} + +void QXmppTransferFileInfo::setDescription(const QString &description) +{ + d->description = description; +} + qint64 QXmppTransferFileInfo::size() const { return d->size; @@ -1252,7 +1263,7 @@ void QXmppTransferManager::_q_jobStateChanged(QXmppTransferJob::State state) /// /// The remote party will be given the choice to accept or refuse the transfer. /// -QXmppTransferJob *QXmppTransferManager::sendFile(const QString &jid, const QString &filePath, const QString &sid) +QXmppTransferJob *QXmppTransferManager::sendFile(const QString &jid, const QString &filePath, const QString &sid, const QString &description) { if (jid.isEmpty()) { warning("Refusing to send file to an empty jid"); @@ -1265,6 +1276,7 @@ QXmppTransferJob *QXmppTransferManager::sendFile(const QString &jid, const QStri fileInfo.setDate(info.lastModified()); fileInfo.setName(info.fileName()); fileInfo.setSize(info.size()); + fileInfo.setDescription(description); // open file QIODevice *device = new QFile(filePath); @@ -1343,6 +1355,13 @@ QXmppTransferJob *QXmppTransferManager::sendFile(const QString &jid, QIODevice * file.setAttribute("hash", job->fileHash().toHex()); file.setAttribute("name", job->fileName()); file.setAttribute("size", QString::number(job->fileSize())); + if (!fileInfo.description().isEmpty()) + { + QXmppElement desc; + desc.setTagName("desc"); + desc.setValue(fileInfo.description()); + file.appendChild(desc); + } items.append(file); QXmppElement feature; @@ -1628,6 +1647,7 @@ void QXmppTransferManager::streamInitiationSetReceived(const QXmppStreamInitiati job->d->fileInfo.setHash(QByteArray::fromHex(item.attribute("hash").toAscii())); job->d->fileInfo.setName(item.attribute("name")); job->d->fileInfo.setSize(item.attribute("size").toLongLong()); + job->d->fileInfo.setDescription(item.firstChildElement("desc").value()); } } |
