IQ reply = IQ.createResultIQ(packet);
Element iq = packet.getChildElement();
String name = iq.getName();
boolean isPersonal = iq.element("personal") != null;
Agent agent;
try {
agent = workgroup.getAgentManager().getAgent(packet.getFrom());
}
catch (AgentNotFoundException e) {
sendItemNotFound(packet, workgroup);
return;
}
if ("macros".equals(name) && !isPersonal) {
Element globalMacros = reply.setChildElement("macros", "http://jivesoftware.com/protocol/workgroup");
DbProperties props = workgroup.getProperties();
String macroModel = props.getProperty("jive.macro" + workgroup.getID());
if (ModelUtil.hasLength(macroModel)) {
globalMacros.addElement("model").setText(macroModel);
}
else {
sendItemNotFound(packet, workgroup);
return;
}
}
else if (isPersonal) {
Element personalMacros = reply.setChildElement("macros", "http://jivesoftware.com/protocol/workgroup");
DbProperties props = agent.getProperties();
String macroModel = props.getProperty("personal.macro");
if (ModelUtil.hasLength(macroModel)) {
personalMacros.addElement("model").setText(macroModel);
}
else {