diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2012-09-05 16:25:18 +0200 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2012-09-05 16:25:18 +0200 |
| commit | 250ab50f87b377039a2e68b1c1cc9bc289ae0907 (patch) | |
| tree | 5e68167836733b019dbe2bd2684cf6f55c8dc51b /src/client/QXmppMucManager.cpp | |
| parent | 2cd20e5ce1c9cfd9986b33af624023868d54a79d (diff) | |
| download | qxmpp-250ab50f87b377039a2e68b1c1cc9bc289ae0907.tar.gz | |
QXmppMucRoom::ban() should only accept bare JIDs
Diffstat (limited to 'src/client/QXmppMucManager.cpp')
| -rw-r--r-- | src/client/QXmppMucManager.cpp | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/src/client/QXmppMucManager.cpp b/src/client/QXmppMucManager.cpp index 828b7e46..c5dd4beb 100644 --- a/src/client/QXmppMucManager.cpp +++ b/src/client/QXmppMucManager.cpp @@ -228,29 +228,20 @@ QXmppMucRoom::Actions QXmppMucRoom::allowedActions() const /// Bans the specified user from the chat room. /// -/// The specified \a jid can be either an "anonymized" room participant JID -/// such of the form theroom@conference.example.com/nickname or a real JID. +/// The specified \a jid is the Bare JID of the form "user@host". /// /// \return true if the request was sent, false otherwise bool QXmppMucRoom::ban(const QString &jid, const QString &reason) { - QString realJid; - if (QXmppUtils::jidToBareJid(jid) == d->jid) { - // an "anonymized" JID was specified, look up the real JID - if (d->participants.contains(jid)) - realJid = d->participants.value(jid).mucItem().jid(); - if (realJid.isEmpty()) { - qWarning("Coud not determine real JID for %s", qPrintable(jid)); - return false; - } - } else { - realJid = jid; + if (!QXmppUtils::jidToResource(jid).isEmpty()) { + qWarning("QXmppMucRoom::ban expects a bare JID"); + return false; } QXmppMucItem item; item.setAffiliation(QXmppMucItem::OutcastAffiliation); - item.setJid(realJid); + item.setJid(jid); item.setReason(reason); QXmppMucAdminIq iq; |
