// for all extensions
while (extensions.hasNext()) {
Extension ext = (Extension) extensions.next();
// if map extension
if (ext instanceof MapTag) {
MapTag map = (MapTag) ext;
// logMap(map);
// adds map into temporary hashtable
curMaps.add(map);
JID jid = msg.getFrom();
String completeID = new String(jid.getUser() + "@" +
jid.getDomain() + "/" + map.getID());
maps.put(completeID, map);
}
}
// if that was not map message ends
if (curMaps.isEmpty())
return;
// if it was map message, looks for included map images
extensions = msg.getExtensions();
while (extensions.hasNext()) {
Extension ext = (Extension) extensions.next();
// for all included files
if (ext instanceof IQXOOB) {
IQXOOB oob = (IQXOOB) ext;
JID jid = msg.getFrom();
try {
handleMapOOB(oob, jid);
} catch (IOException e) {}
}
}
// for all just received maps
Enumeration mapEnum = curMaps.elements();
while (mapEnum.hasMoreElements()) {
JID jid = msg.getFrom();
String originID = new String(jid.getUser() + "@" + jid.getDomain());
MapTag map = (MapTag) mapEnum.nextElement();
// add references to referenced maps
processMap(map, originID);
// saves map into local cache
saveMap(map, originID);
fireMapReceived(map, originID);