diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-08-09 09:36:37 +0000 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-08-09 09:36:37 +0000 |
| commit | a89181602654a01a36c0a67304d18a1d3ac83131 (patch) | |
| tree | 3fd10ad8c0af5c9604bab4c5680878a1d49688f0 /source/QXmppStream.cpp | |
| parent | db75b528f968ce6bd14e79832f25697ebbe8de23 (diff) | |
| download | qxmpp-a89181602654a01a36c0a67304d18a1d3ac83131.tar.gz | |
fully parse JID returned in Bind IQ, needed for SASL anonymous authentication (issue #57)
Diffstat (limited to 'source/QXmppStream.cpp')
| -rw-r--r-- | source/QXmppStream.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/source/QXmppStream.cpp b/source/QXmppStream.cpp index f2f712ca..b888a521 100644 --- a/source/QXmppStream.cpp +++ b/source/QXmppStream.cpp @@ -506,9 +506,18 @@ void QXmppStream::parser(const QByteArray& data) // bind result if (bind.type() == QXmppIq::Result) { - QString resource = jidToResource(bind.jid()); - if (!resource.isEmpty()) - configuration().setResource(resource); + if (!bind.jid().isEmpty()) + { + QRegExp jidRegex("^([^@/]+)@([^@/]+)/(.+)$"); + if (jidRegex.exactMatch(bind.jid())) + { + configuration().setUser(jidRegex.cap(1)); + configuration().setDomain(jidRegex.cap(2)); + configuration().setResource(jidRegex.cap(3)); + } else { + warning("Bind IQ received with invalid JID: " + bind.jid()); + } + } if (m_sessionAvailable) sendSessionIQ(); } |
