protected final void afterLogin() {
if (wasLoggedIn) {
XmppUtils.notifyEventListeners(connectionListeners, new ConnectionEvent(this, ConnectionEvent.Type.RECONNECTION_SUCCEEDED, null, Duration.ZERO));
}
wasLoggedIn = true;
Queue<Stanza> toBeResent = new ArrayDeque<>(unacknowledgedStanzas);
unacknowledgedStanzas.clear();
toBeResent.forEach(stanza -> {
Instant originalSendDate = stanzaSendDate.remove(stanza);
if (originalSendDate != null) {
DelayedDelivery delayedDelivery = new DelayedDelivery(originalSendDate);
if (stanza instanceof ExtensibleStanza && !stanza.hasExtension(DelayedDelivery.class)) {
((ExtensibleStanza) stanza).addExtension(delayedDelivery);
}
}
this.sendInternal(stanza, true);
});
}