Commit af7f4b84 authored by Derek DeMoro's avatar Derek DeMoro Committed by derek

Adding new CompositePacket


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@652 b35dd754-fafc-0310-a699-88a17e54d16e
parent 6c36219a
...@@ -126,7 +126,9 @@ public class SocketReadThread extends Thread { ...@@ -126,7 +126,9 @@ public class SocketReadThread extends Thread {
Presence packet = presence.createCopy(); Presence packet = presence.createCopy();
packet.setType(Presence.Type.unavailable); packet.setType(Presence.Type.unavailable);
packet.setFrom(session.getAddress()); packet.setFrom(session.getAddress());
router.route(packet);
CompositePacket<Presence> compPacket = new CompositePacket<Presence>(packet, session);
router.route(compPacket);
clearSignout = true; clearSignout = true;
} }
} }
...@@ -177,34 +179,35 @@ public class SocketReadThread extends Thread { ...@@ -177,34 +179,35 @@ public class SocketReadThread extends Thread {
if (document != null) { if (document != null) {
Element doc = document.getRootElement(); Element doc = document.getRootElement();
CompositePacket packet = null;
String tag = doc.getName(); String tag = doc.getName();
if ("message".equals(tag)) { if ("message".equals(tag)) {
Message packet = new Message(doc); Message message = new Message(doc);
packet.setFrom(session.getAddress()); packet = new CompositePacket<Message>(message, session);
auditor.audit(packet);
router.route(packet);
session.incrementClientPacketCount();
} }
else if ("presence".equals(tag)) { else if ("presence".equals(tag)) {
Presence packet = new Presence(doc); Presence presence = new Presence(doc);
packet.setFrom(session.getAddress()); packet = new CompositePacket<Presence>(presence, session);
auditor.audit(packet);
router.route(packet);
session.incrementClientPacketCount();
// Update the flag that indicates if the user made a clean sign out // Update the flag that indicates if the user made a clean sign out
clearSignout = (Presence.Type.unavailable == packet.getType() ? true : false); clearSignout = (Presence.Type.unavailable == presence.getType() ? true : false);
} }
else if ("iq".equals(tag)) { else if ("iq".equals(tag)) {
IQ packet = getIQ(doc); IQ iq = getIQ(doc);
packet.setFrom(session.getAddress()); packet = new CompositePacket<IQ>(iq, session);
auditor.audit(packet);
router.route(packet);
session.incrementClientPacketCount();
} }
else { else {
throw new XmlPullParserException(LocaleUtils.getLocalizedString("admin.error.packet.tag") + tag); throw new XmlPullParserException(LocaleUtils.getLocalizedString("admin.error.packet.tag") + tag);
} }
// Route to the Packet Auditor
auditor.audit(packet);
// Route to PacketRouter
router.route(packet);
// Increment number of sessions.
session.incrementClientPacketCount();
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment