only delivery get and set iq packets to unhandled iq listener. only create jingle packets with type=get or set

This commit is contained in:
iNPUTmice 2014-10-05 14:26:06 +02:00
parent b0574b289f
commit 6b3097ee27

View File

@ -166,10 +166,12 @@ public class XmppConnection implements Runnable {
+ ":" + srvRecordPort); + ":" + srvRecordPort);
socket = new Socket(srvRecordServer, 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); socket = new Socket(account.getServer(), 5222);
} else { } 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); changeStatus(Account.STATUS_OFFLINE);
return; return;
} }
@ -362,7 +364,8 @@ public class XmppConnection implements Runnable {
@Override @Override
public void onIqPacketReceived(Account account, IqPacket packet) { 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); changeStatus(Account.STATUS_ONLINE);
} }
}); });
@ -392,8 +395,11 @@ public class XmppConnection implements Runnable {
while (!nextTag.isEnd(element.getName())) { while (!nextTag.isEnd(element.getName())) {
if (!nextTag.isNo()) { if (!nextTag.isNo()) {
Element child = tagReader.readElement(nextTag); Element child = tagReader.readElement(nextTag);
if ((packetType == PACKET_IQ) String type = currentTag.getAttribute("type");
&& ("jingle".equals(child.getName()))) { if (packetType == PACKET_IQ
&& "jingle".equals(child.getName())
&& ("set".equalsIgnoreCase(type) || "get"
.equalsIgnoreCase(type))) {
element = new JinglePacket(); element = new JinglePacket();
element.setAttributes(currentTag.getAttributes()); element.setAttributes(currentTag.getAttributes());
} }
@ -430,7 +436,9 @@ public class XmppConnection implements Runnable {
} }
packetCallbacks.remove(packet.getId()); 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); this.unregisteredIqListener.onIqPacketReceived(account, packet);
} }
} }