* @param remoteJid the remote JID to send the update to
*/
private void internalWaveletUpdate(final WaveletName waveletName,
final List<ByteString> deltaList, final ProtocolHashedVersion committedVersion,
final WaveletUpdateCallback callback, String remoteJid) {
Message message = new Message();
message.setType(Message.Type.normal);
message.setFrom(jid);
message.setTo(remoteJid);
message.setID(XmppUtil.generateUniqueId());
message.addChildElement("request", XmppNamespace.NAMESPACE_XMPP_RECEIPTS);
final String encodedWaveletName;
try {
encodedWaveletName = XmppUtil.waveletNameCodec.waveletNameToURI(waveletName);
} catch (EncodingException e) {
callback.onFailure(FederationErrors.badRequest("Bad wavelet name " + waveletName));
return;
}
Element itemElement = message.addChildElement("event", XmppNamespace.NAMESPACE_PUBSUB_EVENT)
.addElement("items").addElement("item");
if (deltaList != null) {
for (ByteString delta : deltaList) {
Element waveletUpdate =
itemElement.addElement("wavelet-update", XmppNamespace.NAMESPACE_WAVE_SERVER)