Commit 419cff55 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Replaced "sender" with "req_jid".


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1680 b35dd754-fafc-0310-a699-88a17e54d16e
parent 62f711bf
...@@ -68,7 +68,7 @@ public class PresenceStatusServlet extends HttpServlet { ...@@ -68,7 +68,7 @@ public class PresenceStatusServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { throws ServletException, IOException {
String sender = request.getParameter("sender"); String sender = request.getParameter("req_jid");
String jid = request.getParameter("jid"); String jid = request.getParameter("jid");
String type = request.getParameter("type"); String type = request.getParameter("type");
type = type == null ? "image" : type; type = type == null ? "image" : type;
......
...@@ -38,18 +38,18 @@ class XMLPresenceProvider extends PresenceInfoProvider { ...@@ -38,18 +38,18 @@ class XMLPresenceProvider extends PresenceInfoProvider {
PrintWriter out = response.getWriter(); PrintWriter out = response.getWriter();
if (presence == null) { if (presence == null) {
// Recreate the unavailable presence with the last known status // Recreate the unavailable presence with the last known status
String username = request.getParameter("username"); JID targetJID = new JID(request.getParameter("jid"));
presence = new Presence(Presence.Type.unavailable); presence = new Presence(Presence.Type.unavailable);
XMPPServer server = XMPPServer.getInstance(); XMPPServer server = XMPPServer.getInstance();
try { try {
User user = server.getUserManager().getUser(username); User user = server.getUserManager().getUser(targetJID.getNode());
String status = server.getPresenceManager().getLastPresenceStatus(user); String status = server.getPresenceManager().getLastPresenceStatus(user);
if (status != null) { if (status != null) {
presence.setStatus(status); presence.setStatus(status);
} }
} }
catch (UserNotFoundException e) {} catch (UserNotFoundException e) {}
presence.setFrom(server.createJID(username, null)); presence.setFrom(targetJID);
} }
out.println(presence.toXML()); out.println(presence.toXML());
out.flush(); out.flush();
...@@ -62,20 +62,14 @@ class XMLPresenceProvider extends PresenceInfoProvider { ...@@ -62,20 +62,14 @@ class XMLPresenceProvider extends PresenceInfoProvider {
// Send a forbidden presence // Send a forbidden presence
Presence presence = new Presence(); Presence presence = new Presence();
presence.setError(PacketError.Condition.forbidden); presence.setError(PacketError.Condition.forbidden);
String username = request.getParameter("username"); try {
if (username != null) { presence.setFrom(new JID(request.getParameter("jid")));
try {
presence.setFrom(XMPPServer.getInstance().createJID(username, null));
}
catch (Exception e) {}
} }
String sender = request.getParameter("sender"); catch (Exception e) {}
if (sender != null) { try {
try { presence.setTo(new JID(request.getParameter("req_jid")));
presence.setTo(new JID(sender));
}
catch (Exception e) {}
} }
catch (Exception e) {}
out.println(presence.toXML()); out.println(presence.toXML());
out.flush(); out.flush();
} }
......
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