diff options
author | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-03-27 02:02:59 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-03-27 02:02:59 +0100 |
commit | 4864f7200bbdb3e8d45eb7f165d62274f19e2e7b (patch) | |
tree | 54da6eeef9f9114dfb9e89c4342bdcee266414e2 /src/eu/siacs/conversations/xmpp/XmppConnection.java | |
parent | f4c9c19ec0f50fa7a80f4aa7dd28269335188f55 (diff) |
fixed a couple of muc issues. added jingle listener (which doesn't do anything for now)
Diffstat (limited to 'src/eu/siacs/conversations/xmpp/XmppConnection.java')
-rw-r--r-- | src/eu/siacs/conversations/xmpp/XmppConnection.java | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/src/eu/siacs/conversations/xmpp/XmppConnection.java b/src/eu/siacs/conversations/xmpp/XmppConnection.java index ec5ab1f6c..e265b9976 100644 --- a/src/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/eu/siacs/conversations/xmpp/XmppConnection.java @@ -46,6 +46,7 @@ import eu.siacs.conversations.xmpp.stanzas.AbstractStanza; import eu.siacs.conversations.xmpp.stanzas.IqPacket; import eu.siacs.conversations.xmpp.stanzas.MessagePacket; import eu.siacs.conversations.xmpp.stanzas.PresencePacket; +import eu.siacs.conversations.xmpp.stanzas.jingle.JinglePacket; import eu.siacs.conversations.xmpp.stanzas.streammgmt.AckPacket; import eu.siacs.conversations.xmpp.stanzas.streammgmt.EnablePacket; import eu.siacs.conversations.xmpp.stanzas.streammgmt.RequestPacket; @@ -86,6 +87,7 @@ public class XmppConnection implements Runnable { private Hashtable<String, PacketReceived> packetCallbacks = new Hashtable<String, PacketReceived>(); private OnPresencePacketReceived presenceListener = null; + private OnJinglePacketReceived jingleListener = null; private OnIqPacketReceived unregisteredIqListener = null; private OnMessagePacketReceived messageListener = null; private OnStatusChanged statusListener = null; @@ -284,6 +286,10 @@ 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()))) { + element = new JinglePacket(); + element.setAttributes(currentTag.getAttributes()); + } element.addChild(child); } nextTag = tagReader.readTag(); @@ -296,15 +302,22 @@ public class XmppConnection implements Runnable { private void processIq(Tag currentTag) throws XmlPullParserException, IOException { IqPacket packet = (IqPacket) processPacket(currentTag, PACKET_IQ); - if (packetCallbacks.containsKey(packet.getId())) { - if (packetCallbacks.get(packet.getId()) instanceof OnIqPacketReceived) { - ((OnIqPacketReceived) packetCallbacks.get(packet.getId())) - .onIqPacketReceived(account, packet); + + if (packet instanceof JinglePacket) { + if (this.jingleListener !=null) { + this.jingleListener.onJinglePacketReceived(account, (JinglePacket) packet); + } + } else { + if (packetCallbacks.containsKey(packet.getId())) { + if (packetCallbacks.get(packet.getId()) instanceof OnIqPacketReceived) { + ((OnIqPacketReceived) packetCallbacks.get(packet.getId())) + .onIqPacketReceived(account, packet); + } + + packetCallbacks.remove(packet.getId()); + } else if (this.unregisteredIqListener != null) { + this.unregisteredIqListener.onIqPacketReceived(account, packet); } - - packetCallbacks.remove(packet.getId()); - } else if (this.unregisteredIqListener != null) { - this.unregisteredIqListener.onIqPacketReceived(account, packet); } } @@ -684,6 +697,10 @@ public class XmppConnection implements Runnable { OnPresencePacketReceived listener) { this.presenceListener = listener; } + + public void setOnJinglePacketReceivedListener(OnJinglePacketReceived listener) { + this.jingleListener = listener; + } public void setOnStatusChangedListener(OnStatusChanged listener) { this.statusListener = listener; |