Commit e9a58db9 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Refactoring work. JM-256


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1244 b35dd754-fafc-0310-a699-88a17e54d16e
parent 0da2a54c
...@@ -374,8 +374,6 @@ public class ClientSession extends Session { ...@@ -374,8 +374,6 @@ public class ClientSession extends Session {
} }
catch (Exception e) { catch (Exception e) {
Log.error(LocaleUtils.getLocalizedString("admin.error"), e); Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
// TODO: Should attempt to do something with the packet
conn.close();
} }
} }
} }
......
...@@ -192,7 +192,7 @@ public class IQRouter extends BasicModule { ...@@ -192,7 +192,7 @@ public class IQRouter extends BasicModule {
} }
Session session = sessionManager.getSession(packet.getFrom()); Session session = sessionManager.getSession(packet.getFrom());
if (session != null) { if (session != null) {
session.getConnection().deliver(reply); session.process(reply);
} }
else { else {
Log.warn("Packet could not be delivered " + packet); Log.warn("Packet could not be delivered " + packet);
...@@ -213,7 +213,7 @@ public class IQRouter extends BasicModule { ...@@ -213,7 +213,7 @@ public class IQRouter extends BasicModule {
if (XMPPServer.getInstance().isLocal(recipientJID)) { if (XMPPServer.getInstance().isLocal(recipientJID)) {
Session session = sessionManager.getBestRoute(recipientJID); Session session = sessionManager.getBestRoute(recipientJID);
if (session != null) { if (session != null) {
session.getConnection().deliver(packet); session.process(packet);
handlerFound = true; handlerFound = true;
} }
else { else {
...@@ -238,7 +238,7 @@ public class IQRouter extends BasicModule { ...@@ -238,7 +238,7 @@ public class IQRouter extends BasicModule {
IQ reply = IQ.createResultIQ(packet); IQ reply = IQ.createResultIQ(packet);
reply.setChildElement(packet.getChildElement().createCopy()); reply.setChildElement(packet.getChildElement().createCopy());
reply.setError(PacketError.Condition.service_unavailable); reply.setError(PacketError.Condition.service_unavailable);
session.getConnection().deliver(reply); session.process(reply);
} }
} }
} }
......
...@@ -108,7 +108,7 @@ public class OfflineMessageStrategy extends BasicModule { ...@@ -108,7 +108,7 @@ public class OfflineMessageStrategy extends BasicModule {
Message errorResponse = message.createCopy(); Message errorResponse = message.createCopy();
errorResponse.setError(new PacketError(PacketError.Condition.item_not_found, errorResponse.setError(new PacketError(PacketError.Condition.item_not_found,
PacketError.Type.continue_processing)); PacketError.Type.continue_processing));
session.getConnection().deliver(errorResponse); session.process(errorResponse);
} }
catch (Exception e) { catch (Exception e) {
Log.error(e); Log.error(e);
......
...@@ -157,7 +157,7 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo { ...@@ -157,7 +157,7 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo {
// Send the response directly since we want to be sure that we are sending it back // Send the response directly since we want to be sure that we are sending it back
// to the correct session. Any other session of the same user but with different // to the correct session. Any other session of the same user but with different
// resource is incorrect. // resource is incorrect.
session.getConnection().deliver(response); session.process(response);
} }
catch (Exception e) { catch (Exception e) {
Log.error("Error handling authentication IQ packet", e); Log.error("Error handling authentication IQ packet", e);
......
...@@ -58,7 +58,7 @@ public abstract class IQHandler extends BasicModule implements ChannelHandler { ...@@ -58,7 +58,7 @@ public abstract class IQHandler extends BasicModule implements ChannelHandler {
response.setError(PacketError.Condition.not_authorized); response.setError(PacketError.Condition.not_authorized);
Session session = sessionManager.getSession(iq.getFrom()); Session session = sessionManager.getSession(iq.getFrom());
if (!session.getConnection().isClosed()) { if (!session.getConnection().isClosed()) {
session.getConnection().deliver(response); session.process(response);
} }
} }
catch (Exception de) { catch (Exception de) {
......
...@@ -213,7 +213,7 @@ public class IQRegisterHandler extends IQHandler implements ServerFeaturesProvid ...@@ -213,7 +213,7 @@ public class IQRegisterHandler extends IQHandler implements ServerFeaturesProvid
GroupManager.getInstance().deleteUser(user); GroupManager.getInstance().deleteUser(user);
reply = IQ.createResultIQ(packet); reply = IQ.createResultIQ(packet);
session.getConnection().deliver(reply); session.process(reply);
// Close the user's connection // Close the user's connection
session.getConnection().close(); session.getConnection().close();
// The reply has been sent so clean up the variable // The reply has been sent so clean up the variable
...@@ -340,7 +340,7 @@ public class IQRegisterHandler extends IQHandler implements ServerFeaturesProvid ...@@ -340,7 +340,7 @@ public class IQRegisterHandler extends IQHandler implements ServerFeaturesProvid
} }
if (reply != null) { if (reply != null) {
// why is this done here instead of letting the iq handler do it? // why is this done here instead of letting the iq handler do it?
session.getConnection().deliver(reply); session.process(reply);
} }
return null; return null;
} }
......
...@@ -191,10 +191,10 @@ public class PresenceUpdateHandler extends BasicModule implements ChannelHandler ...@@ -191,10 +191,10 @@ public class PresenceUpdateHandler extends BasicModule implements ChannelHandler
Roster roster = rosterManager.getRoster(username); Roster roster = rosterManager.getRoster(username);
for (RosterItem item : roster.getRosterItems()) { for (RosterItem item : roster.getRosterItems()) {
if (item.getRecvStatus() == RosterItem.RECV_SUBSCRIBE) { if (item.getRecvStatus() == RosterItem.RECV_SUBSCRIBE) {
session.getConnection().deliver(createSubscribePresence(item.getJid(), true)); session.process(createSubscribePresence(item.getJid(), true));
} }
else if (item.getRecvStatus() == RosterItem.RECV_UNSUBSCRIBE) { else if (item.getRecvStatus() == RosterItem.RECV_UNSUBSCRIBE) {
session.getConnection().deliver(createSubscribePresence(item.getJid(), false)); session.process(createSubscribePresence(item.getJid(), false));
} }
if (item.getSubStatus() == RosterItem.SUB_TO if (item.getSubStatus() == RosterItem.SUB_TO
|| item.getSubStatus() == RosterItem.SUB_BOTH) { || item.getSubStatus() == RosterItem.SUB_BOTH) {
...@@ -204,7 +204,7 @@ public class PresenceUpdateHandler extends BasicModule implements ChannelHandler ...@@ -204,7 +204,7 @@ public class PresenceUpdateHandler extends BasicModule implements ChannelHandler
// deliver offline messages if any // deliver offline messages if any
Collection<Message> messages = messageStore.getMessages(username); Collection<Message> messages = messageStore.getMessages(username);
for (Message message : messages) { for (Message message : messages) {
session.getConnection().deliver(message); session.process(message);
} }
} }
} }
......
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