"User not found", true));
} // end of try-catch
break;
case set:
if (packet.getFrom().equals(session.getConnectionId())) {
Element elvCard = packet.getElement().getChild(ELEMENTS[0]);
// This is added to support old vCard protocol where element
// name was all upper cases. So here I am checking both
// possibilities
if (elvCard == null) {
elvCard = packet.getElement().getChild(ELEMENTS[1]);
}
if (elvCard != null) {
log.finer("Adding vCard: " + elvCard.toString());
session.setPublicData(ID, VCARD_KEY, elvCard.toString());
} else {
log.finer("Removing vCard");
session.removePublicData(ID, VCARD_KEY);
} // end of else
results.offer(packet.okResult((String)null, 0));
} else {
results.offer(Authorization.NOT_AUTHORIZED.getResponseMessage(packet,
"You are not authorized to set vcard data.", true));
} // end of else
break;
case result:
case error:
Element elem = packet.getElement().clone();
Packet result = new Packet(elem);
result.setTo(session.getConnectionId());
result.setFrom(packet.getTo());
results.offer(result);
break;
default:
results.offer(Authorization.BAD_REQUEST.getResponseMessage(packet,
"Request type is incorrect", false));
break;
} // end of switch (type)
} else {
Element result = packet.getElement().clone();
// According to spec we must set proper FROM attribute
// result.setAttribute("from", session.getJID());
results.offer(new Packet(result));
} // end of else
} catch (NotAuthorizedException e) {