diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-02-19 16:56:03 +0000 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-02-19 16:56:03 +0000 |
| commit | ed0d231d4ca34ed38d4cd3298c6d9a4a5a643785 (patch) | |
| tree | 898dc592c5ab6216afece02a676962af059fcc6f /source/QXmppUtils.cpp | |
| parent | 3bdcb8f14ff62b44d7ddd021bf187f8f5cae5a59 (diff) | |
| download | qxmpp-ed0d231d4ca34ed38d4cd3298c6d9a4a5a643785.tar.gz | |
in jidToBareJid and jidToResource, check the presence of '/'
Diffstat (limited to 'source/QXmppUtils.cpp')
| -rw-r--r-- | source/QXmppUtils.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/QXmppUtils.cpp b/source/QXmppUtils.cpp index 52f29a44..43f028c6 100644 --- a/source/QXmppUtils.cpp +++ b/source/QXmppUtils.cpp @@ -35,12 +35,18 @@ QString jidToResource(const QString& jid) { - return jid.mid(jid.indexOf(QChar('/'))+1); + const int pos = jid.indexOf(QChar('/')); + if (pos < 0) + return QString; + return jid.mid(pos+1); } QString jidToBareJid(const QString& jid) { - return jid.left(jid.indexOf(QChar('/'))); + const int pos = jid.indexOf(QChar('/')); + if (pos < 0) + return jid; + return jid.left(pos); } QString generateStanzaHash() |
