Commit 0d99374c authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

If no TO was specified in the GET request then answer the sender's vCard. JM-270


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1299 b35dd754-fafc-0310-a699-88a17e54d16e
parent 6c18ec87
...@@ -73,7 +73,6 @@ public class IQvCardHandler extends IQHandler { ...@@ -73,7 +73,6 @@ public class IQvCardHandler extends IQHandler {
public IQ handleIQ(IQ packet) throws UnauthorizedException, PacketException { public IQ handleIQ(IQ packet) throws UnauthorizedException, PacketException {
IQ result = null; IQ result = null;
try { try {
JID recipient = packet.getTo();
IQ.Type type = packet.getType(); IQ.Type type = packet.getType();
if (type.equals(IQ.Type.set)) { if (type.equals(IQ.Type.set)) {
User user = userManager.getUser(packet.getFrom().getNode()); User user = userManager.getUser(packet.getFrom().getNode());
...@@ -86,6 +85,12 @@ public class IQvCardHandler extends IQHandler { ...@@ -86,6 +85,12 @@ public class IQvCardHandler extends IQHandler {
result = IQ.createResultIQ(packet); result = IQ.createResultIQ(packet);
} }
else if (type.equals(IQ.Type.get)) { else if (type.equals(IQ.Type.get)) {
JID recipient = packet.getTo();
// If no TO was specified then get the vCard of the sender of the packet
if (recipient == null) {
recipient = packet.getFrom();
}
result = IQ.createResultIQ(packet); result = IQ.createResultIQ(packet);
Element vcard = DocumentHelper.createElement(QName.get("vCard", "vcard-temp")); Element vcard = DocumentHelper.createElement(QName.get("vCard", "vcard-temp"));
......
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