aboutsummaryrefslogtreecommitdiff
path: root/src/client/QXmppTransferManager.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2015-08-15 11:15:58 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2015-08-15 11:15:58 +0200
commit1d8a342304ce2090340748dae51999d20f6fc6d5 (patch)
tree3098fcc17245a693ffcf85d138cd0a9de39758d4 /src/client/QXmppTransferManager.cpp
parent152ae594d855263ac21f403a73963000bfdf98c9 (diff)
downloadqxmpp-1d8a342304ce2090340748dae51999d20f6fc6d5.tar.gz
check sendFile is actually given a full JID
Diffstat (limited to 'src/client/QXmppTransferManager.cpp')
-rw-r--r--src/client/QXmppTransferManager.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/client/QXmppTransferManager.cpp b/src/client/QXmppTransferManager.cpp
index 0616163d..e32aded7 100644
--- a/src/client/QXmppTransferManager.cpp
+++ b/src/client/QXmppTransferManager.cpp
@@ -1282,17 +1282,19 @@ void QXmppTransferManager::_q_jobStateChanged(QXmppTransferJob::State state)
emit jobStarted(job);
}
-/// Send file to a remote party.
+/// Sends the file at \a filePath to a remote party.
///
/// The remote party will be given the choice to accept or refuse the transfer.
///
+/// Returns 0 if the \a jid is not valid or if the file at \a filePath cannot be read.
+///
/// \note The recipient's \a jid must be a full JID with a resource, for instance "user@host/resource".
///
QXmppTransferJob *QXmppTransferManager::sendFile(const QString &jid, const QString &filePath, const QString &description)
{
- if (jid.isEmpty()) {
- warning("Refusing to send file to an empty jid");
+ if (QXmppUtils::jidToResource(jid).isEmpty()) {
+ warning("The file recipient's JID must be a full JID");
return 0;
}
@@ -1333,10 +1335,12 @@ QXmppTransferJob *QXmppTransferManager::sendFile(const QString &jid, const QStri
return job;
}
-/// Send file to a remote party.
+/// Sends the file in \a device to a remote party.
///
/// The remote party will be given the choice to accept or refuse the transfer.
///
+/// Returns 0 if the \a jid is not valid.
+///
/// \note The recipient's \a jid must be a full JID with a resource, for instance "user@host/resource".
///
@@ -1345,8 +1349,8 @@ QXmppTransferJob *QXmppTransferManager::sendFile(const QString &jid, QIODevice *
bool check;
Q_UNUSED(check);
- if (jid.isEmpty()) {
- warning("Refusing to send file to an empty jid");
+ if (QXmppUtils::jidToResource(jid).isEmpty()) {
+ warning("The file recipient's JID must be a full JID");
return 0;
}