aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-10-05 14:26:06 +0200
committeriNPUTmice <daniel@gultsch.de>2014-10-05 14:26:06 +0200
commit6b3097ee27ff256afc22b93efec45d84caa2f53d (patch)
tree4bde95575ca1100f6694525f38834b2aec59277c /src
parentb0574b289fce2a5d89f131829ea178e46b7d168b (diff)
only delivery get and set iq packets to unhandled iq listener. only create jingle packets with type=get or set
Diffstat (limited to 'src')
-rw-r--r--src/eu/siacs/conversations/xmpp/XmppConnection.java28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/eu/siacs/conversations/xmpp/XmppConnection.java b/src/eu/siacs/conversations/xmpp/XmppConnection.java
index 07cd2b45..b789d95f 100644
--- a/src/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -166,10 +166,12 @@ public class XmppConnection implements Runnable {
+ ":" + srvRecordPort);
socket = new Socket(srvRecordServer, srvRecordPort);
}
- } else if (namePort.containsKey("error") && "nosrv".equals(namePort.getString("error", null))) {
+ } else if (namePort.containsKey("error")
+ && "nosrv".equals(namePort.getString("error", null))) {
socket = new Socket(account.getServer(), 5222);
} else {
- Log.d(Config.LOGTAG,account.getJid()+": timeout in DNS resolution");
+ Log.d(Config.LOGTAG, account.getJid()
+ + ": timeout in DNS resolution");
changeStatus(Account.STATUS_OFFLINE);
return;
}
@@ -312,7 +314,7 @@ public class XmppConnection implements Runnable {
}
sendInitialPing();
-
+
} else if (nextTag.isStart("r")) {
tagReader.readElement(nextTag);
AckPacket ack = new AckPacket(this.stanzasReceived, smVersion);
@@ -352,17 +354,18 @@ public class XmppConnection implements Runnable {
}
}
}
-
+
private void sendInitialPing() {
- Log.d(Config.LOGTAG,account.getJid()+": sending intial ping");
+ Log.d(Config.LOGTAG, account.getJid() + ": sending intial ping");
IqPacket iq = new IqPacket(IqPacket.TYPE_GET);
iq.setFrom(account.getFullJid());
iq.addChild("ping", "urn:xmpp:ping");
this.sendIqPacket(iq, new OnIqPacketReceived() {
-
+
@Override
public void onIqPacketReceived(Account account, IqPacket packet) {
- Log.d(Config.LOGTAG,account.getJid()+": online with resource "+account.getResource());
+ Log.d(Config.LOGTAG, account.getJid()
+ + ": online with resource " + account.getResource());
changeStatus(Account.STATUS_ONLINE);
}
});
@@ -392,8 +395,11 @@ public class XmppConnection implements Runnable {
while (!nextTag.isEnd(element.getName())) {
if (!nextTag.isNo()) {
Element child = tagReader.readElement(nextTag);
- if ((packetType == PACKET_IQ)
- && ("jingle".equals(child.getName()))) {
+ String type = currentTag.getAttribute("type");
+ if (packetType == PACKET_IQ
+ && "jingle".equals(child.getName())
+ && ("set".equalsIgnoreCase(type) || "get"
+ .equalsIgnoreCase(type))) {
element = new JinglePacket();
element.setAttributes(currentTag.getAttributes());
}
@@ -430,7 +436,9 @@ public class XmppConnection implements Runnable {
}
packetCallbacks.remove(packet.getId());
- } else if (this.unregisteredIqListener != null) {
+ } else if ((packet.getType() == IqPacket.TYPE_GET || packet
+ .getType() == IqPacket.TYPE_SET)
+ && this.unregisteredIqListener != null) {
this.unregisteredIqListener.onIqPacketReceived(account, packet);
}
}