code cleanup + logging of spoofed iq packets
This commit is contained in:
parent
d64496eab6
commit
0d6d09b7e9
|
@ -430,8 +430,7 @@ public class XmppConnection implements Runnable {
|
|||
return element;
|
||||
}
|
||||
|
||||
private void processIq(final Tag currentTag) throws XmlPullParserException,
|
||||
IOException {
|
||||
private void processIq(final Tag currentTag) throws XmlPullParserException, IOException {
|
||||
final IqPacket packet = (IqPacket) processPacket(currentTag, PACKET_IQ);
|
||||
|
||||
if (packet.getId() == null) {
|
||||
|
@ -440,8 +439,7 @@ public class XmppConnection implements Runnable {
|
|||
|
||||
if (packet instanceof JinglePacket) {
|
||||
if (this.jingleListener != null) {
|
||||
this.jingleListener.onJinglePacketReceived(account,
|
||||
(JinglePacket) packet);
|
||||
this.jingleListener.onJinglePacketReceived(account,(JinglePacket) packet);
|
||||
}
|
||||
} else {
|
||||
if (packetCallbacks.containsKey(packet.getId())) {
|
||||
|
@ -449,20 +447,20 @@ public class XmppConnection implements Runnable {
|
|||
// Packets to the server should have responses from the server
|
||||
if (packetCallbackDuple.first.toServer(account)) {
|
||||
if (packet.fromServer(account)) {
|
||||
packetCallbackDuple.second
|
||||
.onIqPacketReceived(account, packet);
|
||||
packetCallbackDuple.second.onIqPacketReceived(account, packet);
|
||||
packetCallbacks.remove(packet.getId());
|
||||
} else {
|
||||
Log.e(Config.LOGTAG,account.getJid().toBareJid().toString()+": ignoring spoofed iq packet");
|
||||
}
|
||||
} else {
|
||||
if (packet.getFrom().equals(packetCallbackDuple.first.getTo())) {
|
||||
packetCallbackDuple.second
|
||||
.onIqPacketReceived(account, packet);
|
||||
packetCallbackDuple.second.onIqPacketReceived(account, packet);
|
||||
packetCallbacks.remove(packet.getId());
|
||||
} else {
|
||||
Log.e(Config.LOGTAG,account.getJid().toBareJid().toString()+": ignoring spoofed iq packet");
|
||||
}
|
||||
}
|
||||
} else if ((packet.getType() == IqPacket.TYPE.GET || packet
|
||||
.getType() == IqPacket.TYPE.SET)
|
||||
&& this.unregisteredIqListener != null) {
|
||||
} else if (packet.getType() == IqPacket.TYPE.GET|| packet.getType() == IqPacket.TYPE.SET) {
|
||||
this.unregisteredIqListener.onIqPacketReceived(account, packet);
|
||||
}
|
||||
}
|
||||
|
@ -836,7 +834,7 @@ public class XmppConnection implements Runnable {
|
|||
|
||||
}
|
||||
|
||||
private void sendUnmodifiedIqPacket(final IqPacket packet, final OnIqPacketReceived callback) {
|
||||
private synchronized void sendUnmodifiedIqPacket(final IqPacket packet, final OnIqPacketReceived callback) {
|
||||
if (packet.getId() == null) {
|
||||
final String id = nextRandomId();
|
||||
packet.setAttribute("id", id);
|
||||
|
|
Loading…
Reference in a new issue