aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2010-08-26 08:36:22 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2010-08-26 08:36:22 +0000
commit3d4c2e72e740a6fcb66ec337be194b6c356a96be (patch)
treec8da5e27a17745f13b5b93c109c2c2a4e18a3527 /src
parentd96472c73ff22615ba09b54601e007126c6183c6 (diff)
downloadqxmpp-3d4c2e72e740a6fcb66ec337be194b6c356a96be.tar.gz
rework elementReceived() arguments
Diffstat (limited to 'src')
-rw-r--r--src/QXmppIncomingClient.cpp21
-rw-r--r--src/QXmppIncomingClient.h2
-rw-r--r--src/QXmppIncomingServer.cpp5
-rw-r--r--src/QXmppIncomingServer.h2
-rw-r--r--src/QXmppServer.cpp17
-rw-r--r--src/QXmppServer.h2
6 files changed, 18 insertions, 31 deletions
diff --git a/src/QXmppIncomingClient.cpp b/src/QXmppIncomingClient.cpp
index 6a2e5c49..83b15cc0 100644
--- a/src/QXmppIncomingClient.cpp
+++ b/src/QXmppIncomingClient.cpp
@@ -271,6 +271,7 @@ void QXmppIncomingClient::handleStanza(const QDomElement &nodeRecv)
// bound
emit connected();
+ return;
}
else if (QXmppSessionIq::isSessionIq(nodeRecv) && type == "set")
{
@@ -281,27 +282,21 @@ void QXmppIncomingClient::handleStanza(const QDomElement &nodeRecv)
sessionResult.setType(QXmppIq::Result);
sessionResult.setId(sessionSet.id());
sendPacket(sessionResult);
- }
- else
- {
- QDomElement nodeFull(nodeRecv);
- nodeFull.setAttribute("from", jid());
- // if the recipient is empty, set it to the local domain
- if (nodeFull.attribute("to").isEmpty())
- nodeFull.setAttribute("to", d->domain);
- bool handled = false;
- emit elementReceived(nodeFull, handled);
+ return;
}
}
- else if (nodeRecv.tagName() == "message" || nodeRecv.tagName() == "presence")
+
+ // unhandled stanza, emit it
+ if (nodeRecv.tagName() == "iq" ||
+ nodeRecv.tagName() == "message" ||
+ nodeRecv.tagName() == "presence")
{
QDomElement nodeFull(nodeRecv);
nodeFull.setAttribute("from", jid());
// if the recipient is empty, set it to the local domain
if (nodeFull.attribute("to").isEmpty())
nodeFull.setAttribute("to", d->domain);
- bool handled = false;
- emit elementReceived(nodeFull, handled);
+ emit elementReceived(nodeFull);
}
}
}
diff --git a/src/QXmppIncomingClient.h b/src/QXmppIncomingClient.h
index e269dcf3..384cac82 100644
--- a/src/QXmppIncomingClient.h
+++ b/src/QXmppIncomingClient.h
@@ -62,7 +62,7 @@ public:
signals:
/// This signal is emitted when an element is received.
- void elementReceived(const QDomElement &element, bool &handled);
+ void elementReceived(const QDomElement &element);
protected:
/// \cond
diff --git a/src/QXmppIncomingServer.cpp b/src/QXmppIncomingServer.cpp
index da1b4c92..853eac8e 100644
--- a/src/QXmppIncomingServer.cpp
+++ b/src/QXmppIncomingServer.cpp
@@ -147,9 +147,8 @@ void QXmppIncomingServer::handleStanza(const QDomElement &stanza)
else if (!d->authenticated.isEmpty() &&
jidToDomain(stanza.attribute("from")) == d->authenticated)
{
- // relay packets if the remote party is authenticated
- bool handled = false;
- emit elementReceived(stanza, handled);
+ // relay stanza if the remote party is authenticated
+ emit elementReceived(stanza);
} else {
warning("Received an element, but remote party is not authenticated");
}
diff --git a/src/QXmppIncomingServer.h b/src/QXmppIncomingServer.h
index a4a78177..1dd826c0 100644
--- a/src/QXmppIncomingServer.h
+++ b/src/QXmppIncomingServer.h
@@ -50,7 +50,7 @@ signals:
void dialbackRequestReceived(const QXmppDialback &result);
/// This signal is emitted when an element is received.
- void elementReceived(const QDomElement &element, bool &handled);
+ void elementReceived(const QDomElement &element);
protected:
/// \cond
diff --git a/src/QXmppServer.cpp b/src/QXmppServer.cpp
index 33ea7147..0630eea6 100644
--- a/src/QXmppServer.cpp
+++ b/src/QXmppServer.cpp
@@ -242,11 +242,6 @@ QXmppOutgoingServer* QXmppServer::connectToDomain(const QString &domain)
stream->configuration().setDomain(domain);
stream->configuration().setHost(domain);
stream->configuration().setPort(5269);
- bool check = connect(stream, SIGNAL(elementReceived(QDomElement, bool&)),
- this, SLOT(slotElementReceived(QDomElement, bool&)));
- Q_ASSERT(check);
- Q_UNUSED(check);
-
d->outgoingServers.append(stream);
// connect to remote server
@@ -459,8 +454,8 @@ void QXmppServer::slotClientConnection(QSslSocket *socket)
this, SLOT(slotClientDisconnected()));
Q_ASSERT(check);
- check = connect(stream, SIGNAL(elementReceived(QDomElement, bool&)),
- this, SLOT(slotElementReceived(QDomElement, bool&)));
+ check = connect(stream, SIGNAL(elementReceived(QDomElement)),
+ this, SLOT(slotElementReceived(QDomElement)));
Q_ASSERT(check);
d->incomingClients.append(stream);
@@ -544,10 +539,8 @@ void QXmppServer::slotDialbackRequestReceived(const QXmppDialback &dialback)
/// Handle an incoming XML element.
-void QXmppServer::slotElementReceived(const QDomElement &element, bool &handled)
+void QXmppServer::slotElementReceived(const QDomElement &element)
{
- Q_UNUSED(handled);
-
QXmppStream *incoming = qobject_cast<QXmppStream *>(sender());
if (!incoming)
return;
@@ -572,8 +565,8 @@ void QXmppServer::slotServerConnection(QSslSocket *socket)
this, SLOT(slotDialbackRequestReceived(QXmppDialback)));
Q_ASSERT(check);
- check = connect(stream, SIGNAL(elementReceived(QDomElement, bool&)),
- this, SLOT(slotElementReceived(QDomElement, bool&)));
+ check = connect(stream, SIGNAL(elementReceived(QDomElement)),
+ this, SLOT(slotElementReceived(QDomElement)));
Q_ASSERT(check);
}
diff --git a/src/QXmppServer.h b/src/QXmppServer.h
index 68a85e99..680a2fd5 100644
--- a/src/QXmppServer.h
+++ b/src/QXmppServer.h
@@ -77,7 +77,7 @@ private slots:
void slotClientConnected();
void slotClientDisconnected();
void slotDialbackRequestReceived(const QXmppDialback &dialback);
- void slotElementReceived(const QDomElement &element, bool &handled);
+ void slotElementReceived(const QDomElement &element);
void slotServerConnection(QSslSocket *socket);
private: