Hi, sometimes we need to coerce a stanza into one or more copies and make slight changes, like replacing the 'to' attribute.
StanzaBuilder.createClone facilitates that. It takes a list of attributes which replace original attributes on the copy. Convenience: Now there are convenience methods to replace 'to' and 'from' only in StanzaBuilder.createForward(Stanza original, Entity from, Entity to) and <T extends Stanza> T StanzaBuilder.createForwardStanza( T original, Entity from, Entity to) Downside: These new methods make use of createClone(), so that the list of attributes is build internally from the from and to parameters for every createForward*() call. If you want to relay a message to many addressees (say thousands), we might not want to create 1000 lists, if we only want to replace the from entity for every new stanza and could reuse one list for that for every call of StanzaBuilder.createClone(). (Note that creating a stanza clone is not as memory costly as it might seem, and that to.getFullyQualifiedName() is not always returning a new object) See PresenceAvailabilityHandler.relayTo() for an 'optimized' stanza broadcasting loop. I noticed that MUCMessageHandler's call to StanzaBuilder.createClone doesn't reuse the list in this way and re-creates it in the inner loop. We might want to change that. WDYT? Bernd -- bernd.fondermann brainlounge ++49 69 367 068 39 =tel ++49 69 367 068 39 =fax ++49 177 249 67 13 =mob bernd.fonderm...@brainlounge.de ginnheimer str. 46, D-60487 frankfurt/main www.brainlounge.de