final ActivityDomReader reader = new PersistentActivityDomReader();
List<Element> items=(List<Element>) itemsElement.elements("item");
if ((items!=null) && (items.size()!=0)){
for (Element itemElement :items) {
ActivityEntry activity = reader
.readEntry(new ElementAdapter(itemElement
.element("entry")));
try {
ActivityManager.getInstance().handleMessage(
fromJID.toBareJID(), toJID.toBareJID(),
activity);
} catch (InvalidActivityException e) {
throw new PacketRejectedException();
} catch (AccessDeniedException e) {
throw new PacketRejectedException();
}
}
} else if (itemsElement.element("retract")!=null)
{
Element retractElement = itemsElement.element("retract");
String activityId=reader.readActivityId(new ElementAdapter(retractElement));
ActivityManager.getInstance().deleteMessage(activityId);
}
Set<JID> recipientFullJIDs = getFullJIDs(toJID
.toBareJID());
Iterator<JID> it = recipientFullJIDs.iterator();
Message extendedMessage = message.createCopy();
while (it.hasNext()) {
String fullJid = it.next().toString();
extendedMessage.setTo(fullJid);
server.getMessageRouter().route(extendedMessage);
}
throw new PacketRejectedException();
}
// or a relation event
else if (itemsElement.attribute("node").getValue().equals(
RelationManager.NODE)) {
final RelationDomReader reader = new PersistentRelationDomReader();
for (Element itemElement : (List<Element>) itemsElement
.elements("item")) {
Relation relation = reader.readElement(new ElementAdapter(
itemElement.element("relation")));
try {
RelationManager.getInstance().handleMessage(
fromJID.toBareJID(), toJID.toBareJID(),
relation);